1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
8 # libtool >= 2.2
9 [
10 LT_CONFIG_LTDL_DIR([libltdl])
11 LT_INIT([dlopen])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
14 ]
15 ,
16 # libtool <= 1.5
17 [
18 AC_LIBLTDL_CONVENIENCE
19 AC_SUBST(LTDLINCL)
20 AC_SUBST(LIBLTDL)
21 AC_LIBTOOL_DLOPEN
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
24 ]
25 )
27 AM_INIT_AUTOMAKE(dist-bzip2)
28 AC_LANG(C)
30 AC_PREFIX_DEFAULT("/opt/collectd")
32 AC_SYS_LARGEFILE
34 #
35 # Checks for programs.
36 #
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_MAKE_SET
42 AM_PROG_CC_C_O
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
45 AC_DISABLE_STATIC
46 AC_PROG_LIBTOOL
47 AC_PROG_LEX
48 AC_PROG_YACC
49 PKG_PROG_PKG_CONFIG
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
55 case $host_os in
56 *linux*)
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
58 ac_system="Linux"
59 ;;
60 *solaris*)
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
62 ac_system="Solaris"
63 ;;
64 *darwin*)
65 ac_system="Darwin"
66 ;;
67 *openbsd*)
68 ac_system="OpenBSD"
69 ;;
70 *aix*)
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
72 ac_system="AIX"
73 ;;
74 *)
75 ac_system="unknown"
76 esac
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
80 then
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
83 then
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
85 fi
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
89 fi
91 if test "x$ac_system" = "xSolaris"
92 then
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 fi
95 if test "x$ac_system" = "xAIX"
96 then
97 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
98 fi
100 # Where to install .pc files.
101 pkgconfigdir="${libdir}/pkgconfig"
102 AC_SUBST(pkgconfigdir)
104 # Check for standards compliance mode
105 AC_ARG_ENABLE(standards,
106 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
107 [enable_standards="$enableval"],
108 [enable_standards="no"])
109 if test "x$enable_standards" = "xyes"
110 then
111 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
112 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
113 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
114 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
115 if test "x$GCC" = "xyes"
116 then
117 CFLAGS="$CFLAGS -std=c99"
118 fi
119 fi
120 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
122 #
123 # Checks for header files.
124 #
125 AC_HEADER_STDC
126 AC_HEADER_SYS_WAIT
127 AC_HEADER_DIRENT
128 AC_HEADER_STDBOOL
130 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
132 # For ping library
133 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
134 [#if HAVE_STDINT_H
135 # include <stdint.h>
136 #endif
137 #if HAVE_SYS_TYPES_H
138 # include <sys/types.h>
139 #endif
140 ])
141 AC_CHECK_HEADERS(netinet/in.h, [], [],
142 [#if HAVE_STDINT_H
143 # include <stdint.h>
144 #endif
145 #if HAVE_SYS_TYPES_H
146 # include <sys/types.h>
147 #endif
148 #if HAVE_NETINET_IN_SYSTM_H
149 # include <netinet/in_systm.h>
150 #endif
151 ])
152 AC_CHECK_HEADERS(netinet/ip.h, [], [],
153 [#if HAVE_STDINT_H
154 # include <stdint.h>
155 #endif
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 ])
166 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
167 [#if HAVE_STDINT_H
168 # include <stdint.h>
169 #endif
170 #if HAVE_SYS_TYPES_H
171 # include <sys/types.h>
172 #endif
173 #if HAVE_NETINET_IN_SYSTM_H
174 # include <netinet/in_systm.h>
175 #endif
176 #if HAVE_NETINET_IN_H
177 # include <netinet/in.h>
178 #endif
179 #if HAVE_NETINET_IP_H
180 # include <netinet/ip.h>
181 #endif
182 ])
183 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
184 [#if HAVE_STDINT_H
185 # include <stdint.h>
186 #endif
187 #if HAVE_SYS_TYPES_H
188 # include <sys/types.h>
189 #endif
190 #if HAVE_NETINET_IN_SYSTM_H
191 # include <netinet/in_systm.h>
192 #endif
193 #if HAVE_NETINET_IN_H
194 # include <netinet/in.h>
195 #endif
196 #if HAVE_NETINET_IP_H
197 # include <netinet/ip.h>
198 #endif
199 ])
200 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
201 [#if HAVE_STDINT_H
202 # include <stdint.h>
203 #endif
204 #if HAVE_SYS_TYPES_H
205 # include <sys/types.h>
206 #endif
207 #if HAVE_NETINET_IN_SYSTM_H
208 # include <netinet/in_systm.h>
209 #endif
210 #if HAVE_NETINET_IN_H
211 # include <netinet/in.h>
212 #endif
213 ])
214 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
215 [#if HAVE_STDINT_H
216 # include <stdint.h>
217 #endif
218 #if HAVE_SYS_TYPES_H
219 # include <sys/types.h>
220 #endif
221 #if HAVE_NETINET_IN_SYSTM_H
222 # include <netinet/in_systm.h>
223 #endif
224 #if HAVE_NETINET_IN_H
225 # include <netinet/in.h>
226 #endif
227 #if HAVE_NETINET_IP6_H
228 # include <netinet/ip6.h>
229 #endif
230 ])
231 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
232 [#if HAVE_STDINT_H
233 # include <stdint.h>
234 #endif
235 #if HAVE_SYS_TYPES_H
236 # include <sys/types.h>
237 #endif
238 #if HAVE_NETINET_IN_SYSTM_H
239 # include <netinet/in_systm.h>
240 #endif
241 #if HAVE_NETINET_IN_H
242 # include <netinet/in.h>
243 #endif
244 #if HAVE_NETINET_IP_H
245 # include <netinet/ip.h>
246 #endif
247 ])
248 AC_CHECK_HEADERS(netinet/udp.h, [], [],
249 [#if HAVE_STDINT_H
250 # include <stdint.h>
251 #endif
252 #if HAVE_SYS_TYPES_H
253 # include <sys/types.h>
254 #endif
255 #if HAVE_NETINET_IN_SYSTM_H
256 # include <netinet/in_systm.h>
257 #endif
258 #if HAVE_NETINET_IN_H
259 # include <netinet/in.h>
260 #endif
261 #if HAVE_NETINET_IP_H
262 # include <netinet/ip.h>
263 #endif
264 ])
266 # For cpu modules
267 AC_CHECK_HEADERS(sys/dkstat.h)
268 if test "x$ac_system" = "xDarwin"
269 then
270 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
271 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
272 fi
273 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
274 [
275 #if HAVE_SYS_TYPES_H
276 # include <sys/types.h>
277 #endif
278 #if HAVE_SYS_PARAM_H
279 # include <sys/param.h>
280 #endif
281 ])
283 AC_MSG_CHECKING([for sysctl kern.cp_times])
284 if test -x /sbin/sysctl
285 then
286 /sbin/sysctl kern.cp_times 2>/dev/null
287 if test $? -eq 0
288 then
289 AC_MSG_RESULT([yes])
290 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
291 [Define if sysctl supports kern.cp_times])
292 else
293 AC_MSG_RESULT([no])
294 fi
295 else
296 AC_MSG_RESULT([no])
297 fi
299 # For hddtemp module
300 AC_CHECK_HEADERS(linux/major.h libgen.h)
302 # For the battery plugin
303 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
304 [
305 #if HAVE_IOKIT_IOKITLIB_H
306 # include <IOKit/IOKitLib.h>
307 #endif
308 #if HAVE_IOKIT_IOTYPES_H
309 # include <IOKit/IOTypes.h>
310 #endif
311 ])
313 # For the swap module
314 have_linux_wireless_h="no"
315 if test "x$ac_system" = "xLinux"
316 then
317 AC_CHECK_HEADERS(linux/wireless.h,
318 [have_linux_wireless_h="yes"],
319 [have_linux_wireless_h="no"],
320 [
321 #include <dirent.h>
322 #include <sys/ioctl.h>
323 #include <sys/socket.h>
324 ])
325 fi
327 # For the swap module
328 have_sys_swap_h="yes"
329 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
330 [
331 #undef _FILE_OFFSET_BITS
332 #undef _LARGEFILE64_SOURCE
333 #if HAVE_SYS_TYPES_H
334 # include <sys/types.h>
335 #endif
336 #if HAVE_SYS_PARAM_H
337 # include <sys/param.h>
338 #endif
339 ])
341 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
342 then
343 hint_64=""
344 if test "x$GCC" = "xyes"
345 then
346 hint_64="CFLAGS='-m64'"
347 else
348 hint_64="CFLAGS='-xarch=v9'"
349 fi
350 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
351 fi
353 # For load module
354 # For the processes plugin
355 # For users module
356 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
358 # For interface plugin
359 AC_CHECK_HEADERS(ifaddrs.h)
360 AC_CHECK_HEADERS(net/if.h, [], [],
361 [
362 #if HAVE_SYS_TYPES_H
363 # include <sys/types.h>
364 #endif
365 #if HAVE_SYS_SOCKET_H
366 # include <sys/socket.h>
367 #endif
368 ])
369 AC_CHECK_HEADERS(linux/if.h, [], [],
370 [
371 #if HAVE_SYS_TYPES_H
372 # include <sys/types.h>
373 #endif
374 #if HAVE_SYS_SOCKET_H
375 # include <sys/socket.h>
376 #endif
377 ])
378 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
379 [
380 #if HAVE_SYS_TYPES_H
381 # include <sys/types.h>
382 #endif
383 #if HAVE_SYS_SOCKET_H
384 # include <sys/socket.h>
385 #endif
386 #if HAVE_LINUX_IF_H
387 # include <linux/if.h>
388 #endif
389 ])
391 # For ipvs module
392 have_linux_ip_vs_h="no"
393 have_net_ip_vs_h="no"
394 have_ip_vs_h="no"
395 ip_vs_h_needs_kernel_cflags="no"
396 if test "x$ac_system" = "xLinux"
397 then
398 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
399 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
400 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
402 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
403 then
404 SAVE_CFLAGS="$CFLAGS"
405 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
407 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
409 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
410 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
411 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
413 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
414 then
415 ip_vs_h_needs_kernel_cflags="yes"
416 fi
418 CFLAGS="$SAVE_CFLAGS"
419 fi
420 fi
421 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
423 # For quota module
424 AC_CHECK_HEADERS(sys/ucred.h, [], [],
425 [
426 #if HAVE_SYS_TYPES_H
427 # include <sys/types.h>
428 #endif
429 #if HAVE_SYS_PARAM_H
430 # include <sys/param.h>
431 #endif
432 ])
434 # For mount interface
435 AC_CHECK_HEADERS(sys/mount.h, [], [],
436 [
437 #if HAVE_SYS_TYPES_H
438 # include <sys/types.h>
439 #endif
440 #if HAVE_SYS_PARAM_H
441 # include <sys/param.h>
442 #endif
443 ])
445 # For the email plugin
446 AC_CHECK_HEADERS(linux/un.h, [], [],
447 [
448 #if HAVE_SYS_SOCKET_H
449 # include <sys/socket.h>
450 #endif
451 ])
453 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
455 # For the dns plugin
456 AC_CHECK_HEADERS(arpa/nameser.h)
457 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
458 [
459 #if HAVE_ARPA_NAMESER_H
460 # include <arpa/nameser.h>
461 #endif
462 ])
464 AC_CHECK_HEADERS(net/if_arp.h, [], [],
465 [#if HAVE_SYS_SOCKET_H
466 # include <sys/socket.h>
467 #endif
468 ])
469 AC_CHECK_HEADERS(net/ppp_defs.h)
470 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
471 [#if HAVE_NET_PPP_DEFS_H
472 # include <net/ppp_defs.h>
473 #endif
474 ])
475 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
476 [#if HAVE_STDINT_H
477 # include <stdint.h>
478 #endif
479 #if HAVE_SYS_TYPES_H
480 # include <sys/types.h>
481 #endif
482 #if HAVE_SYS_SOCKET_H
483 # include <sys/socket.h>
484 #endif
485 #if HAVE_NET_IF_H
486 # include <net/if.h>
487 #endif
488 #if HAVE_NETINET_IN_H
489 # include <netinet/in.h>
490 #endif
491 ])
493 # For the multimeter plugin
494 have_termios_h="no"
495 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
497 #
498 # Checks for typedefs, structures, and compiler characteristics.
499 #
500 AC_C_CONST
501 AC_TYPE_PID_T
502 AC_TYPE_SIZE_T
503 AC_TYPE_UID_T
504 AC_HEADER_TIME
506 #
507 # Checks for library functions.
508 #
509 AC_PROG_GCC_TRADITIONAL
510 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
512 AC_FUNC_STRERROR_R
514 SAVE_CFLAGS="$CFLAGS"
515 # Emulate behavior of src/Makefile.am
516 if test "x$GCC" = "xyes"
517 then
518 CFLAGS="$CFLAGS -Wall -Werror"
519 fi
521 AC_CACHE_CHECK([for strtok_r],
522 [c_cv_have_strtok_r_default],
523 AC_LINK_IFELSE(
524 AC_LANG_PROGRAM(
525 [[[[
526 #include <stdlib.h>
527 #include <stdio.h>
528 #include <string.h>
529 ]]]],
530 [[[[
531 char buffer[] = "foo,bar,baz";
532 char *token;
533 char *dummy;
534 char *saveptr;
536 dummy = buffer;
537 saveptr = NULL;
538 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
539 {
540 dummy = NULL;
541 printf ("token = %s;\n", token);
542 }
543 ]]]]),
544 [c_cv_have_strtok_r_default="yes"],
545 [c_cv_have_strtok_r_default="no"]
546 )
547 )
549 if test "x$c_cv_have_strtok_r_default" = "xno"
550 then
551 CFLAGS="$CFLAGS -D_REENTRANT=1"
553 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
554 [c_cv_have_strtok_r_reentrant],
555 AC_LINK_IFELSE(
556 AC_LANG_PROGRAM(
557 [[[[
558 #include <stdlib.h>
559 #include <stdio.h>
560 #include <string.h>
561 ]]]],
562 [[[[
563 char buffer[] = "foo,bar,baz";
564 char *token;
565 char *dummy;
566 char *saveptr;
568 dummy = buffer;
569 saveptr = NULL;
570 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
571 {
572 dummy = NULL;
573 printf ("token = %s;\n", token);
574 }
575 ]]]]),
576 [c_cv_have_strtok_r_reentrant="yes"],
577 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
578 )
579 )
580 fi
582 CFLAGS="$SAVE_CFLAGS"
583 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
584 then
585 CFLAGS="$CFLAGS -D_REENTRANT=1"
586 fi
588 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
590 socket_needs_socket="no"
591 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
592 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
594 clock_gettime_needs_rt="no"
595 clock_gettime_needs_posix4="no"
596 have_clock_gettime="no"
597 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
598 if test "x$have_clock_gettime" = "xno"
599 then
600 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
601 have_clock_gettime="yes"])
602 fi
603 if test "x$have_clock_gettime" = "xno"
604 then
605 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
606 have_clock_gettime="yes"])
607 fi
608 if test "x$have_clock_gettime" = "xyes"
609 then
610 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
611 else
612 AC_MSG_WARN(cannot find clock_gettime)
613 fi
615 nanosleep_needs_rt="no"
616 nanosleep_needs_posix4="no"
617 AC_CHECK_FUNCS(nanosleep,
618 [],
619 AC_CHECK_LIB(rt, nanosleep,
620 [nanosleep_needs_rt="yes"],
621 AC_CHECK_LIB(posix4, nanosleep,
622 [nanosleep_needs_posix4="yes"],
623 AC_MSG_ERROR(cannot find nanosleep))))
625 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
626 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
628 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
629 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
630 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
631 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
632 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
633 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
634 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
635 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
636 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
637 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
638 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
639 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
641 # Check for strptime {{{
642 if test "x$GCC" = "xyes"
643 then
644 SAVE_CFLAGS="$CFLAGS"
645 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
646 fi
648 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
649 if test "x$have_strptime" = "xyes"
650 then
651 AC_CACHE_CHECK([whether strptime is exported by default],
652 [c_cv_have_strptime_default],
653 AC_COMPILE_IFELSE(
654 AC_LANG_PROGRAM(
655 [[
656 AC_INCLUDES_DEFAULT
657 #include <time.h>
658 ]],
659 [[
660 struct tm stm;
661 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
662 ]]),
663 [c_cv_have_strptime_default="yes"],
664 [c_cv_have_strptime_default="no"]))
665 fi
666 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
667 then
668 AC_CACHE_CHECK([whether strptime needs standards mode],
669 [c_cv_have_strptime_standards],
670 AC_COMPILE_IFELSE(
671 AC_LANG_PROGRAM(
672 [[
673 #ifndef _ISOC99_SOURCE
674 # define _ISOC99_SOURCE 1
675 #endif
676 #ifndef _POSIX_C_SOURCE
677 # define _POSIX_C_SOURCE 200112L
678 #endif
679 #ifndef _XOPEN_SOURCE
680 # define _XOPEN_SOURCE 500
681 #endif
682 AC_INCLUDES_DEFAULT
683 #include <time.h>
684 ]],
685 [[
686 struct tm stm;
687 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
688 ]]),
689 [c_cv_have_strptime_standards="yes"],
690 [c_cv_have_strptime_standards="no"]))
692 if test "x$c_cv_have_strptime_standards" = "xyes"
693 then
694 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
695 else
696 have_strptime="no"
697 fi
698 fi
700 if test "x$GCC" = "xyes"
701 then
702 CFLAGS="$SAVE_CFLAGS"
703 fi
705 # }}} Check for strptime
707 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
708 if test "x$have_swapctl" = "xyes"; then
709 AC_CACHE_CHECK([whether swapctl takes two arguments],
710 [c_cv_have_swapctl_two_args],
711 AC_COMPILE_IFELSE(
712 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
713 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
714 # undef _FILE_OFFSET_BITS
715 # undef _LARGEFILE64_SOURCE
716 #endif
717 #include <sys/stat.h>
718 #include <sys/swap.h>]],
719 [[
720 int num = swapctl(0, NULL);
721 ]]
722 ),
723 [c_cv_have_swapctl_two_args="yes"],
724 [c_cv_have_swapctl_two_args="no"]
725 )
726 )
727 AC_CACHE_CHECK([whether swapctl takes three arguments],
728 [c_cv_have_swapctl_three_args],
729 AC_COMPILE_IFELSE(
730 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
731 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
732 # undef _FILE_OFFSET_BITS
733 # undef _LARGEFILE64_SOURCE
734 #endif
735 #include <sys/stat.h>
736 #include <sys/swap.h>]],
737 [[
738 int num = swapctl(0, NULL,0);
739 ]]
740 ),
741 [c_cv_have_swapctl_three_args="yes"],
742 [c_cv_have_swapctl_three_args="no"]
743 )
744 )
745 fi
746 # Check for different versions of `swapctl' here..
747 if test "x$have_swapctl" = "xyes"; then
748 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
749 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
750 [Define if the function swapctl exists and takes two arguments.])
751 fi
752 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
753 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
754 [Define if the function swapctl exists and takes three arguments.])
755 fi
756 fi
758 # Check for NAN
759 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
760 [
761 if test "x$withval" = "xno"; then
762 nan_type="none"
763 else if test "x$withval" = "xyes"; then
764 nan_type="zero"
765 else
766 nan_type="$withval"
767 fi; fi
768 ],
769 [nan_type="none"])
770 if test "x$nan_type" = "xnone"; then
771 AC_CACHE_CHECK([whether NAN is defined by default],
772 [c_cv_have_nan_default],
773 AC_COMPILE_IFELSE(
774 AC_LANG_PROGRAM(
775 [[
776 #include <stdlib.h>
777 #include <math.h>
778 static double foo = NAN;
779 ]],
780 [[
781 if (isnan (foo))
782 return 0;
783 else
784 return 1;
785 ]]),
786 [c_cv_have_nan_default="yes"],
787 [c_cv_have_nan_default="no"]
788 )
789 )
790 if test "x$c_cv_have_nan_default" = "xyes"
791 then
792 nan_type="default"
793 fi
794 fi
795 if test "x$nan_type" = "xnone"; then
796 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
797 [c_cv_have_nan_isoc],
798 AC_COMPILE_IFELSE(
799 AC_LANG_PROGRAM(
800 [[
801 #include <stdlib.h>
802 #define __USE_ISOC99 1
803 #include <math.h>
804 static double foo = NAN;
805 ]],
806 [[
807 if (isnan (foo))
808 return 0;
809 else
810 return 1;
811 ]]),
812 [c_cv_have_nan_isoc="yes"],
813 [c_cv_have_nan_isoc="no"]
814 )
815 )
816 if test "x$c_cv_have_nan_isoc" = "xyes"
817 then
818 nan_type="isoc99"
819 fi
820 fi
821 if test "x$nan_type" = "xnone"; then
822 SAVE_LDFLAGS=$LDFLAGS
823 LDFLAGS="$LDFLAGS -lm"
824 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
825 [c_cv_have_nan_zero],
826 AC_RUN_IFELSE(
827 AC_LANG_PROGRAM(
828 [[
829 #include <stdlib.h>
830 #include <math.h>
831 #ifdef NAN
832 # undef NAN
833 #endif
834 #define NAN (0.0 / 0.0)
835 #ifndef isnan
836 # define isnan(f) ((f) != (f))
837 #endif
838 static double foo = NAN;
839 ]],
840 [[
841 if (isnan (foo))
842 return 0;
843 else
844 return 1;
845 ]]),
846 [c_cv_have_nan_zero="yes"],
847 [c_cv_have_nan_zero="no"]
848 )
849 )
850 LDFLAGS=$SAVE_LDFLAGS
851 if test "x$c_cv_have_nan_zero" = "xyes"
852 then
853 nan_type="zero"
854 fi
855 fi
857 if test "x$nan_type" = "xdefault"; then
858 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
859 [Define if NAN is defined by default and can initialize static variables.])
860 else if test "x$nan_type" = "xisoc99"; then
861 AC_DEFINE(NAN_STATIC_ISOC, 1,
862 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
863 else if test "x$nan_type" = "xzero"; then
864 AC_DEFINE(NAN_ZERO_ZERO, 1,
865 [Define if NAN can be defined as (0.0 / 0.0)])
866 else
867 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
868 fi; fi; fi
870 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
871 [
872 if test "x$withval" = "xnothing"; then
873 fp_layout_type="nothing"
874 else if test "x$withval" = "xendianflip"; then
875 fp_layout_type="endianflip"
876 else if test "x$withval" = "xintswap"; then
877 fp_layout_type="intswap"
878 else
879 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
880 fi; fi; fi
881 ],
882 [fp_layout_type="unknown"])
884 if test "x$fp_layout_type" = "xunknown"; then
885 AC_CACHE_CHECK([if doubles are stored in x86 representation],
886 [c_cv_fp_layout_need_nothing],
887 AC_RUN_IFELSE(
888 AC_LANG_PROGRAM(
889 [[[[
890 #include <stdlib.h>
891 #include <stdio.h>
892 #include <string.h>
893 #if HAVE_STDINT_H
894 # include <stdint.h>
895 #endif
896 #if HAVE_INTTYPES_H
897 # include <inttypes.h>
898 #endif
899 #if HAVE_STDBOOL_H
900 # include <stdbool.h>
901 #endif
902 ]]]],
903 [[[[
904 uint64_t i0;
905 uint64_t i1;
906 uint8_t c[8];
907 double d;
909 d = 8.642135e130;
910 memcpy ((void *) &i0, (void *) &d, 8);
912 i1 = i0;
913 memcpy ((void *) c, (void *) &i1, 8);
915 if ((c[0] == 0x2f) && (c[1] == 0x25)
916 && (c[2] == 0xc0) && (c[3] == 0xc7)
917 && (c[4] == 0x43) && (c[5] == 0x2b)
918 && (c[6] == 0x1f) && (c[7] == 0x5b))
919 return (0);
920 else
921 return (1);
922 ]]]]),
923 [c_cv_fp_layout_need_nothing="yes"],
924 [c_cv_fp_layout_need_nothing="no"]
925 )
926 )
927 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
928 fp_layout_type="nothing"
929 fi
930 fi
931 if test "x$fp_layout_type" = "xunknown"; then
932 AC_CACHE_CHECK([if endianflip converts to x86 representation],
933 [c_cv_fp_layout_need_endianflip],
934 AC_RUN_IFELSE(
935 AC_LANG_PROGRAM(
936 [[[[
937 #include <stdlib.h>
938 #include <stdio.h>
939 #include <string.h>
940 #if HAVE_STDINT_H
941 # include <stdint.h>
942 #endif
943 #if HAVE_INTTYPES_H
944 # include <inttypes.h>
945 #endif
946 #if HAVE_STDBOOL_H
947 # include <stdbool.h>
948 #endif
949 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
950 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
951 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
952 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
953 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
954 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
955 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
956 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
957 ]]]],
958 [[[[
959 uint64_t i0;
960 uint64_t i1;
961 uint8_t c[8];
962 double d;
964 d = 8.642135e130;
965 memcpy ((void *) &i0, (void *) &d, 8);
967 i1 = endianflip (i0);
968 memcpy ((void *) c, (void *) &i1, 8);
970 if ((c[0] == 0x2f) && (c[1] == 0x25)
971 && (c[2] == 0xc0) && (c[3] == 0xc7)
972 && (c[4] == 0x43) && (c[5] == 0x2b)
973 && (c[6] == 0x1f) && (c[7] == 0x5b))
974 return (0);
975 else
976 return (1);
977 ]]]]),
978 [c_cv_fp_layout_need_endianflip="yes"],
979 [c_cv_fp_layout_need_endianflip="no"]
980 )
981 )
982 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
983 fp_layout_type="endianflip"
984 fi
985 fi
986 if test "x$fp_layout_type" = "xunknown"; then
987 AC_CACHE_CHECK([if intswap converts to x86 representation],
988 [c_cv_fp_layout_need_intswap],
989 AC_RUN_IFELSE(
990 AC_LANG_PROGRAM(
991 [[[[
992 #include <stdlib.h>
993 #include <stdio.h>
994 #include <string.h>
995 #if HAVE_STDINT_H
996 # include <stdint.h>
997 #endif
998 #if HAVE_INTTYPES_H
999 # include <inttypes.h>
1000 #endif
1001 #if HAVE_STDBOOL_H
1002 # include <stdbool.h>
1003 #endif
1004 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1005 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1006 ]]]],
1007 [[[[
1008 uint64_t i0;
1009 uint64_t i1;
1010 uint8_t c[8];
1011 double d;
1013 d = 8.642135e130;
1014 memcpy ((void *) &i0, (void *) &d, 8);
1016 i1 = intswap (i0);
1017 memcpy ((void *) c, (void *) &i1, 8);
1019 if ((c[0] == 0x2f) && (c[1] == 0x25)
1020 && (c[2] == 0xc0) && (c[3] == 0xc7)
1021 && (c[4] == 0x43) && (c[5] == 0x2b)
1022 && (c[6] == 0x1f) && (c[7] == 0x5b))
1023 return (0);
1024 else
1025 return (1);
1026 ]]]]),
1027 [c_cv_fp_layout_need_intswap="yes"],
1028 [c_cv_fp_layout_need_intswap="no"]
1029 )
1030 )
1031 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1032 fp_layout_type="intswap"
1033 fi
1034 fi
1036 if test "x$fp_layout_type" = "xnothing"; then
1037 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1038 [Define if doubles are stored in x86 representation.])
1039 else if test "x$fp_layout_type" = "xendianflip"; then
1040 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1041 [Define if endianflip is needed to convert to x86 representation.])
1042 else if test "x$fp_layout_type" = "xintswap"; then
1043 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1044 [Define if intswap is needed to convert to x86 representation.])
1045 else
1046 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1047 fi; fi; fi
1049 have_getfsstat="no"
1050 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1051 have_getvfsstat="no"
1052 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1053 have_listmntent="no"
1054 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1056 have_getmntent="no"
1057 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1058 if test "x$have_getmntent" = "xno"; then
1059 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1060 fi
1061 if test "x$have_getmntent" = "xno"; then
1062 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1063 fi
1064 if test "x$have_getmntent" = "xno"; then
1065 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1066 fi
1068 if test "x$have_getmntent" = "xc"; then
1069 AC_CACHE_CHECK([whether getmntent takes one argument],
1070 [c_cv_have_one_getmntent],
1071 AC_COMPILE_IFELSE(
1072 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1073 #include "$srcdir/src/utils_mount.h"]],
1074 [[
1075 FILE *fh;
1076 struct mntent *me;
1077 fh = setmntent ("/etc/mtab", "r");
1078 me = getmntent (fh);
1079 ]]
1080 ),
1081 [c_cv_have_one_getmntent="yes"],
1082 [c_cv_have_one_getmntent="no"]
1083 )
1084 )
1085 AC_CACHE_CHECK([whether getmntent takes two arguments],
1086 [c_cv_have_two_getmntent],
1087 AC_COMPILE_IFELSE(
1088 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1089 #include "$srcdir/src/utils_mount.h"]],
1090 [[
1091 FILE *fh;
1092 struct mnttab mt;
1093 int status;
1094 fh = fopen ("/etc/mnttab", "r");
1095 status = getmntent (fh, &mt);
1096 ]]
1097 ),
1098 [c_cv_have_two_getmntent="yes"],
1099 [c_cv_have_two_getmntent="no"]
1100 )
1101 )
1102 fi
1104 # Check for different versions of `getmntent' here..
1106 if test "x$have_getmntent" = "xc"; then
1107 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1108 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1109 [Define if the function getmntent exists and takes one argument.])
1110 fi
1111 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1112 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1113 [Define if the function getmntent exists and takes two arguments.])
1114 fi
1115 fi
1116 if test "x$have_getmntent" = "xsun"; then
1117 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1118 [Define if the function getmntent exists. It's the version from libsun.])
1119 fi
1120 if test "x$have_getmntent" = "xseq"; then
1121 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1122 [Define if the function getmntent exists. It's the version from libseq.])
1123 fi
1124 if test "x$have_getmntent" = "xgen"; then
1125 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1126 [Define if the function getmntent exists. It's the version from libgen.])
1127 fi
1129 # Check for htonll
1130 AC_MSG_CHECKING([if have htonll defined])
1132 have_htonll="no"
1133 AC_LINK_IFELSE([
1134 AC_LANG_PROGRAM([
1135 #include <sys/types.h>
1136 #include <netinet/in.h>
1137 #if HAVE_INTTYPES_H
1138 # include <inttypes.h>
1139 #endif
1140 ], [
1141 return htonll(0);
1142 ])
1143 ], [
1144 have_htonll="yes"
1145 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1146 ])
1148 AC_MSG_RESULT([$have_htonll])
1150 # Check for structures
1151 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1152 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1153 [],
1154 [
1155 #include <sys/types.h>
1156 #include <sys/socket.h>
1157 #include <net/if.h>
1158 ])
1159 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1160 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1161 [],
1162 [
1163 #include <sys/types.h>
1164 #include <sys/socket.h>
1165 #include <linux/if.h>
1166 #include <linux/netdevice.h>
1167 ])
1169 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1170 [],
1171 [
1172 #include <netinet/in.h>
1173 #include <net/if.h>
1174 ])
1176 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1177 [
1178 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1179 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1180 have_struct_kinfo_proc_freebsd="yes"
1181 ],
1182 [
1183 have_struct_kinfo_proc_freebsd="no"
1184 ],
1185 [
1186 #include <kvm.h>
1187 #include <sys/param.h>
1188 #include <sys/sysctl.h>
1189 #include <sys/user.h>
1190 ])
1192 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1193 [
1194 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1195 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1196 have_struct_kinfo_proc_openbsd="yes"
1197 ],
1198 [
1199 have_struct_kinfo_proc_openbsd="no"
1200 ],
1201 [
1202 #include <sys/param.h>
1203 #include <sys/sysctl.h>
1204 #include <kvm.h>
1205 ])
1207 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1208 [#define _BSD_SOURCE
1209 #if HAVE_STDINT_H
1210 # include <stdint.h>
1211 #endif
1212 #if HAVE_SYS_TYPES_H
1213 # include <sys/types.h>
1214 #endif
1215 #if HAVE_NETINET_IN_SYSTM_H
1216 # include <netinet/in_systm.h>
1217 #endif
1218 #if HAVE_NETINET_IN_H
1219 # include <netinet/in.h>
1220 #endif
1221 #if HAVE_NETINET_IP_H
1222 # include <netinet/ip.h>
1223 #endif
1224 #if HAVE_NETINET_UDP_H
1225 # include <netinet/udp.h>
1226 #endif
1227 ])
1228 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1229 [#define _BSD_SOURCE
1230 #if HAVE_STDINT_H
1231 # include <stdint.h>
1232 #endif
1233 #if HAVE_SYS_TYPES_H
1234 # include <sys/types.h>
1235 #endif
1236 #if HAVE_NETINET_IN_SYSTM_H
1237 # include <netinet/in_systm.h>
1238 #endif
1239 #if HAVE_NETINET_IN_H
1240 # include <netinet/in.h>
1241 #endif
1242 #if HAVE_NETINET_IP_H
1243 # include <netinet/ip.h>
1244 #endif
1245 #if HAVE_NETINET_UDP_H
1246 # include <netinet/udp.h>
1247 #endif
1248 ])
1250 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1251 [],
1252 [],
1253 [
1254 #if HAVE_KSTAT_H
1255 # include <kstat.h>
1256 #endif
1257 ])
1259 #
1260 # Checks for libraries begin here
1261 #
1262 with_libresolv="yes"
1263 AC_CHECK_LIB(resolv, res_search,
1264 [
1265 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1266 ],
1267 [with_libresolv="no"])
1268 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1270 dnl Check for HAL (hardware abstraction library)
1271 with_libhal="yes"
1272 AC_CHECK_LIB(hal,libhal_device_property_exists,
1273 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1274 [with_libhal="no"])
1275 if test "x$with_libhal" = "xyes"; then
1276 if test "x$PKG_CONFIG" != "x"; then
1277 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1278 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1279 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1280 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1281 fi
1282 fi
1284 m4_divert_once([HELP_WITH], [
1285 collectd additional packages:])
1287 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1289 if test "x$ac_system" = "xAIX"
1290 then
1291 with_perfstat="yes"
1292 with_procinfo="yes"
1293 else
1294 with_perfstat="no (AIX only)"
1295 with_procinfo="no (AIX only)"
1296 fi
1298 if test "x$with_perfstat" = "xyes"
1299 then
1300 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1301 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1302 fi
1303 if test "x$with_perfstat" = "xyes"
1304 then
1305 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1306 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1307 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1308 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1309 then
1310 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1311 fi
1312 fi
1313 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1315 # Processes plugin under AIX.
1316 if test "x$with_procinfo" = "xyes"
1317 then
1318 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1319 fi
1320 if test "x$with_procinfo" = "xyes"
1321 then
1322 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1323 fi
1325 if test "x$ac_system" = "xSolaris"
1326 then
1327 with_kstat="yes"
1328 with_devinfo="yes"
1329 else
1330 with_kstat="no (Solaris only)"
1331 with_devinfo="no (Solaris only)"
1332 fi
1334 if test "x$with_kstat" = "xyes"
1335 then
1336 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1337 fi
1338 if test "x$with_kstat" = "xyes"
1339 then
1340 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1341 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1342 fi
1343 if test "x$with_kstat" = "xyes"
1344 then
1345 AC_DEFINE(HAVE_LIBKSTAT, 1,
1346 [Define to 1 if you have the 'kstat' library (-lkstat)])
1347 fi
1348 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1349 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1351 with_libiokit="no"
1352 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1353 [
1354 with_libiokit="yes"
1355 ],
1356 [
1357 with_libiokit="no"
1358 ])
1359 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1361 with_libkvm="no"
1362 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1363 if test "x$with_kvm_getprocs" = "xyes"
1364 then
1365 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1366 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1367 with_libkvm="yes"
1368 fi
1369 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1371 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1372 if test "x$with_kvm_getswapinfo" = "xyes"
1373 then
1374 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1375 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1376 with_libkvm="yes"
1377 fi
1378 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1380 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1381 if test "x$with_kvm_nlist" = "xyes"
1382 then
1383 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1384 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1385 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1386 with_libkvm="yes"
1387 fi
1388 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1390 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1391 if test "x$with_kvm_openfiles" = "xyes"
1392 then
1393 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1394 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1395 with_libkvm="yes"
1396 fi
1397 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1399 # --with-libcredis {{{
1400 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1401 [
1402 if test "x$withval" = "xyes"
1403 then
1404 with_libcredis="yes"
1405 else if test "x$withval" = "xno"
1406 then
1407 with_libcredis="no"
1408 else
1409 with_libcredis="yes"
1410 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1411 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1412 fi; fi
1413 ],
1414 [with_libcredis="yes"])
1416 SAVE_CPPFLAGS="$CPPFLAGS"
1417 SAVE_LDFLAGS="$LDFLAGS"
1419 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1420 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1422 if test "x$with_libcredis" = "xyes"
1423 then
1424 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1425 then
1426 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1427 fi
1428 AC_CHECK_HEADERS(credis.h,
1429 [with_libcredis="yes"],
1430 [with_libcredis="no (credis.h not found)"])
1431 fi
1432 if test "x$with_libcredis" = "xyes"
1433 then
1434 if test "x$LIBCREDIS_LDFLAGS" != "x"
1435 then
1436 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1437 fi
1438 AC_CHECK_LIB(credis, credis_info,
1439 [with_libcredis="yes"],
1440 [with_libcredis="no (symbol 'credis_info' not found)"])
1442 fi
1444 CPPFLAGS="$SAVE_CPPFLAGS"
1445 LDFLAGS="$SAVE_LDFLAGS"
1447 if test "x$with_libcredis" = "xyes"
1448 then
1449 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1450 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1451 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1452 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1453 fi
1454 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1455 # }}}
1457 # --with-libcurl {{{
1458 with_curl_config="curl-config"
1459 with_curl_cflags=""
1460 with_curl_libs=""
1461 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1462 [
1463 if test "x$withval" = "xno"
1464 then
1465 with_libcurl="no"
1466 else if test "x$withval" = "xyes"
1467 then
1468 with_libcurl="yes"
1469 else
1470 if test -f "$withval" && test -x "$withval"
1471 then
1472 with_curl_config="$withval"
1473 with_libcurl="yes"
1474 else if test -x "$withval/bin/curl-config"
1475 then
1476 with_curl_config="$withval/bin/curl-config"
1477 with_libcurl="yes"
1478 fi; fi
1479 with_libcurl="yes"
1480 fi; fi
1481 ],
1482 [
1483 with_libcurl="yes"
1484 ])
1485 if test "x$with_libcurl" = "xyes"
1486 then
1487 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1488 curl_config_status=$?
1490 if test $curl_config_status -ne 0
1491 then
1492 with_libcurl="no ($with_curl_config failed)"
1493 else
1494 SAVE_CPPFLAGS="$CPPFLAGS"
1495 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1497 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1499 CPPFLAGS="$SAVE_CPPFLAGS"
1500 fi
1501 fi
1502 if test "x$with_libcurl" = "xyes"
1503 then
1504 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1505 curl_config_status=$?
1507 if test $curl_config_status -ne 0
1508 then
1509 with_libcurl="no ($with_curl_config failed)"
1510 else
1511 AC_CHECK_LIB(curl, curl_easy_init,
1512 [with_libcurl="yes"],
1513 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1514 [$with_curl_libs])
1515 fi
1516 fi
1517 if test "x$with_libcurl" = "xyes"
1518 then
1519 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1520 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1521 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1522 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1523 fi
1524 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1525 # }}}
1527 # --with-libdbi {{{
1528 with_libdbi_cppflags=""
1529 with_libdbi_ldflags=""
1530 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1531 [
1532 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1533 then
1534 with_libdbi_cppflags="-I$withval/include"
1535 with_libdbi_ldflags="-L$withval/lib"
1536 with_libdbi="yes"
1537 else
1538 with_libdbi="$withval"
1539 fi
1540 ],
1541 [
1542 with_libdbi="yes"
1543 ])
1544 if test "x$with_libdbi" = "xyes"
1545 then
1546 SAVE_CPPFLAGS="$CPPFLAGS"
1547 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1549 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1551 CPPFLAGS="$SAVE_CPPFLAGS"
1552 fi
1553 if test "x$with_libdbi" = "xyes"
1554 then
1555 SAVE_CPPFLAGS="$CPPFLAGS"
1556 SAVE_LDFLAGS="$LDFLAGS"
1557 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1558 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1560 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1562 CPPFLAGS="$SAVE_CPPFLAGS"
1563 LDFLAGS="$SAVE_LDFLAGS"
1564 fi
1565 if test "x$with_libdbi" = "xyes"
1566 then
1567 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1568 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1569 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1570 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1571 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1572 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1573 fi
1574 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1575 # }}}
1577 # --with-libesmtp {{{
1578 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1579 [
1580 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1581 then
1582 LDFLAGS="$LDFLAGS -L$withval/lib"
1583 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1584 with_libesmtp="yes"
1585 else
1586 with_libesmtp="$withval"
1587 fi
1588 ],
1589 [
1590 with_libesmtp="yes"
1591 ])
1592 if test "x$with_libesmtp" = "xyes"
1593 then
1594 AC_CHECK_LIB(esmtp, smtp_create_session,
1595 [
1596 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1597 ], [with_libesmtp="no (libesmtp not found)"])
1598 fi
1599 if test "x$with_libesmtp" = "xyes"
1600 then
1601 AC_CHECK_HEADERS(libesmtp.h,
1602 [
1603 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1604 ], [with_libesmtp="no (libesmtp.h not found)"])
1605 fi
1606 if test "x$with_libesmtp" = "xyes"
1607 then
1608 collect_libesmtp=1
1609 else
1610 collect_libesmtp=0
1611 fi
1612 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1613 [Wether or not to use the esmtp library])
1614 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1615 # }}}
1617 # --with-libganglia {{{
1618 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1619 [
1620 if test -f "$withval" && test -x "$withval"
1621 then
1622 with_libganglia_config="$withval"
1623 with_libganglia="yes"
1624 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1625 then
1626 with_libganglia_config="$withval/bin/ganglia-config"
1627 with_libganglia="yes"
1628 else if test -d "$withval"
1629 then
1630 GANGLIA_CPPFLAGS="-I$withval/include"
1631 GANGLIA_LDFLAGS="-L$withval/lib"
1632 with_libganglia="yes"
1633 else
1634 with_libganglia_config="ganglia-config"
1635 with_libganglia="$withval"
1636 fi; fi; fi
1637 ],
1638 [
1639 with_libganglia_config="ganglia-config"
1640 with_libganglia="yes"
1641 ])
1643 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1644 then
1645 if test "x$GANGLIA_CPPFLAGS" = "x"
1646 then
1647 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1648 fi
1650 if test "x$GANGLIA_LDFLAGS" = "x"
1651 then
1652 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1653 fi
1655 if test "x$GANGLIA_LIBS" = "x"
1656 then
1657 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1658 fi
1659 fi
1661 SAVE_CPPFLAGS="$CPPFLAGS"
1662 SAVE_LDFLAGS="$LDFLAGS"
1663 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1664 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1666 if test "x$with_libganglia" = "xyes"
1667 then
1668 AC_CHECK_HEADERS(gm_protocol.h,
1669 [
1670 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1671 [Define to 1 if you have the <gm_protocol.h> header file.])
1672 ], [with_libganglia="no (gm_protocol.h not found)"])
1673 fi
1675 if test "x$with_libganglia" = "xyes"
1676 then
1677 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1678 [
1679 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1680 [Define to 1 if you have the ganglia library (-lganglia).])
1681 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1682 fi
1684 CPPFLAGS="$SAVE_CPPFLAGS"
1685 LDFLAGS="$SAVE_LDFLAGS"
1687 AC_SUBST(GANGLIA_CPPFLAGS)
1688 AC_SUBST(GANGLIA_LDFLAGS)
1689 AC_SUBST(GANGLIA_LIBS)
1690 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1691 # }}}
1693 # --with-libgcrypt {{{
1694 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1695 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1696 GCRYPT_LIBS="$GCRYPT_LIBS"
1697 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1698 [
1699 if test -f "$withval" && test -x "$withval"
1700 then
1701 with_libgcrypt_config="$withval"
1702 with_libgcrypt="yes"
1703 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1704 then
1705 with_libgcrypt_config="$withval/bin/gcrypt-config"
1706 with_libgcrypt="yes"
1707 else if test -d "$withval"
1708 then
1709 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1710 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1711 with_libgcrypt="yes"
1712 else
1713 with_libgcrypt_config="gcrypt-config"
1714 with_libgcrypt="$withval"
1715 fi; fi; fi
1716 ],
1717 [
1718 with_libgcrypt_config="libgcrypt-config"
1719 with_libgcrypt="yes"
1720 ])
1722 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1723 then
1724 if test "x$GCRYPT_CPPFLAGS" = "x"
1725 then
1726 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1727 fi
1729 if test "x$GCRYPT_LDFLAGS" = "x"
1730 then
1731 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1732 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1733 fi
1735 if test "x$GCRYPT_LIBS" = "x"
1736 then
1737 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1738 fi
1739 fi
1741 SAVE_CPPFLAGS="$CPPFLAGS"
1742 SAVE_LDFLAGS="$LDFLAGS"
1743 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1744 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1746 if test "x$with_libgcrypt" = "xyes"
1747 then
1748 if test "x$GCRYPT_CPPFLAGS" != "x"
1749 then
1750 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1751 fi
1752 AC_CHECK_HEADERS(gcrypt.h,
1753 [with_libgcrypt="yes"],
1754 [with_libgcrypt="no (gcrypt.h not found)"])
1755 fi
1757 if test "x$with_libgcrypt" = "xyes"
1758 then
1759 if test "x$GCRYPT_LDFLAGS" != "x"
1760 then
1761 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1762 fi
1763 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1764 [with_libgcrypt="yes"],
1765 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1767 if test "$with_libgcrypt" != "no"; then
1768 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1769 fi
1770 fi
1772 CPPFLAGS="$SAVE_CPPFLAGS"
1773 LDFLAGS="$SAVE_LDFLAGS"
1775 if test "x$with_libgcrypt" = "xyes"
1776 then
1777 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1778 fi
1780 AC_SUBST(GCRYPT_CPPFLAGS)
1781 AC_SUBST(GCRYPT_LDFLAGS)
1782 AC_SUBST(GCRYPT_LIBS)
1783 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1784 # }}}
1786 # --with-libiptc {{{
1787 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1788 [
1789 if test "x$withval" = "xshipped"
1790 then
1791 with_libiptc="own"
1792 else if test "x$withval" = "xyes"
1793 then
1794 with_libiptc="pkgconfig"
1795 else if test "x$withval" = "xno"
1796 then
1797 with_libiptc="no"
1798 else
1799 with_libiptc="yes"
1800 with_libiptc_cflags="-I$withval/include"
1801 with_libiptc_libs="-L$withval/lib"
1802 fi; fi; fi
1803 ],
1804 [
1805 if test "x$ac_system" = "xLinux"
1806 then
1807 with_libiptc="pkgconfig"
1808 else
1809 with_libiptc="no (Linux only)"
1810 fi
1811 ])
1813 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1814 then
1815 with_libiptc="no (Don't have pkg-config)"
1816 fi
1818 if test "x$with_libiptc" = "xpkgconfig"
1819 then
1820 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1821 if test $? -ne 0
1822 then
1823 with_libiptc="no (pkg-config doesn't know libiptc)"
1824 fi
1825 fi
1826 if test "x$with_libiptc" = "xpkgconfig"
1827 then
1828 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1829 if test $? -ne 0
1830 then
1831 with_libiptc="no ($PKG_CONFIG failed)"
1832 fi
1833 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1834 if test $? -ne 0
1835 then
1836 with_libiptc="no ($PKG_CONFIG failed)"
1837 fi
1838 fi
1840 SAVE_CPPFLAGS="$CPPFLAGS"
1841 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1843 # check whether the header file for libiptc is available.
1844 if test "x$with_libiptc" = "xpkgconfig"
1845 then
1846 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1847 [with_libiptc="no (header file missing)"])
1848 fi
1849 # If the header file is available, check for the required type declaractions.
1850 # They may be missing in old versions of libiptc. In that case, they will be
1851 # declared in the iptables plugin.
1852 if test "x$with_libiptc" = "xpkgconfig"
1853 then
1854 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1855 fi
1856 # Check for the iptc_init symbol in the library.
1857 # This could be in iptc or ip4tc
1858 if test "x$with_libiptc" = "xpkgconfig"
1859 then
1860 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1861 [with_libiptc="pkgconfig"],
1862 [with_libiptc="no"],
1863 [$with_libiptc_libs])
1864 fi
1865 if test "x$with_libiptc" = "xpkgconfig"
1866 then
1867 with_libiptc="yes"
1868 fi
1870 CPPFLAGS="$SAVE_CPPFLAGS"
1872 if test "x$with_libiptc" = "xown"
1873 then
1874 with_libiptc_cflags=""
1875 with_libiptc_libs=""
1876 fi
1877 if test "x$with_libiptc" = "xown"
1878 then
1879 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1880 [
1881 with_libiptc="no (Linux iptables headers not found)"
1882 ],
1883 [
1884 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1885 ])
1886 fi
1887 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1888 if test "x$with_libiptc" = "xown"
1889 then
1890 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1891 with_libiptc="yes"
1892 fi
1894 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1895 if test "x$with_libiptc" = "xyes"
1896 then
1897 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1898 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1899 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1900 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1901 fi
1902 # }}}
1904 # --with-java {{{
1905 with_java_home="$JAVA_HOME"
1906 with_java_vmtype="client"
1907 with_java_cflags=""
1908 with_java_libs=""
1909 JAVAC="$JAVAC"
1910 JAR="$JAR"
1911 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1912 [
1913 if test "x$withval" = "xno"
1914 then
1915 with_java="no"
1916 else if test "x$withval" = "xyes"
1917 then
1918 with_java="yes"
1919 else
1920 with_java_home="$withval"
1921 with_java="yes"
1922 fi; fi
1923 ],
1924 [with_java="yes"])
1925 if test "x$with_java" = "xyes"
1926 then
1927 if test -d "$with_java_home"
1928 then
1929 AC_MSG_CHECKING([for jni.h])
1930 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1931 if test "x$TMPDIR" != "x"
1932 then
1933 AC_MSG_RESULT([found in $TMPDIR])
1934 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1935 else
1936 AC_MSG_RESULT([not found])
1937 fi
1939 AC_MSG_CHECKING([for jni_md.h])
1940 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1941 if test "x$TMPDIR" != "x"
1942 then
1943 AC_MSG_RESULT([found in $TMPDIR])
1944 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1945 else
1946 AC_MSG_RESULT([not found])
1947 fi
1949 AC_MSG_CHECKING([for libjvm.so])
1950 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1951 if test "x$TMPDIR" != "x"
1952 then
1953 AC_MSG_RESULT([found in $TMPDIR])
1954 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1955 else
1956 AC_MSG_RESULT([not found])
1957 fi
1959 if test "x$JAVAC" = "x"
1960 then
1961 AC_MSG_CHECKING([for javac])
1962 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1963 if test "x$TMPDIR" != "x"
1964 then
1965 JAVAC="$TMPDIR"
1966 AC_MSG_RESULT([$JAVAC])
1967 else
1968 AC_MSG_RESULT([not found])
1969 fi
1970 fi
1971 if test "x$JAR" = "x"
1972 then
1973 AC_MSG_CHECKING([for jar])
1974 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1975 if test "x$TMPDIR" != "x"
1976 then
1977 JAR="$TMPDIR"
1978 AC_MSG_RESULT([$JAR])
1979 else
1980 AC_MSG_RESULT([not found])
1981 fi
1982 fi
1983 else if test "x$with_java_home" != "x"
1984 then
1985 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1986 fi; fi
1987 fi
1989 if test "x$JAVA_CPPFLAGS" != "x"
1990 then
1991 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1992 fi
1993 if test "x$JAVA_CFLAGS" != "x"
1994 then
1995 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1996 fi
1997 if test "x$JAVA_LDFLAGS" != "x"
1998 then
1999 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2000 fi
2001 if test "x$JAVAC" = "x"
2002 then
2003 with_javac_path="$PATH"
2004 if test "x$with_java_home" != "x"
2005 then
2006 with_javac_path="$with_java_home:with_javac_path"
2007 if test -d "$with_java_home/bin"
2008 then
2009 with_javac_path="$with_java_home/bin:with_javac_path"
2010 fi
2011 fi
2013 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2014 fi
2015 if test "x$JAVAC" = "x"
2016 then
2017 with_java="no (javac not found)"
2018 fi
2019 if test "x$JAR" = "x"
2020 then
2021 with_jar_path="$PATH"
2022 if test "x$with_java_home" != "x"
2023 then
2024 with_jar_path="$with_java_home:$with_jar_path"
2025 if test -d "$with_java_home/bin"
2026 then
2027 with_jar_path="$with_java_home/bin:$with_jar_path"
2028 fi
2029 fi
2031 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2032 fi
2033 if test "x$JAR" = "x"
2034 then
2035 with_java="no (jar not found)"
2036 fi
2038 SAVE_CPPFLAGS="$CPPFLAGS"
2039 SAVE_CFLAGS="$CFLAGS"
2040 SAVE_LDFLAGS="$LDFLAGS"
2041 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2042 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2043 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2045 if test "x$with_java" = "xyes"
2046 then
2047 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2048 fi
2049 if test "x$with_java" = "xyes"
2050 then
2051 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2052 [with_java="yes"],
2053 [with_java="no (libjvm not found)"],
2054 [$JAVA_LIBS])
2055 fi
2056 if test "x$with_java" = "xyes"
2057 then
2058 JAVA_LIBS="$JAVA_LIBS -ljvm"
2059 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2060 fi
2062 CPPFLAGS="$SAVE_CPPFLAGS"
2063 CFLAGS="$SAVE_CFLAGS"
2064 LDFLAGS="$SAVE_LDFLAGS"
2066 AC_SUBST(JAVA_CPPFLAGS)
2067 AC_SUBST(JAVA_CFLAGS)
2068 AC_SUBST(JAVA_LDFLAGS)
2069 AC_SUBST(JAVA_LIBS)
2070 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2071 # }}}
2073 # --with-libmemcached {{{
2074 with_libmemcached_cppflags=""
2075 with_libmemcached_ldflags=""
2076 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2077 [
2078 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2079 then
2080 with_libmemcached_cppflags="-I$withval/include"
2081 with_libmemcached_ldflags="-L$withval/lib"
2082 with_libmemcached="yes"
2083 else
2084 with_libmemcached="$withval"
2085 fi
2086 ],
2087 [
2088 with_libmemcached="yes"
2089 ])
2090 if test "x$with_libmemcached" = "xyes"
2091 then
2092 SAVE_CPPFLAGS="$CPPFLAGS"
2093 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2095 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2097 CPPFLAGS="$SAVE_CPPFLAGS"
2098 fi
2099 if test "x$with_libmemcached" = "xyes"
2100 then
2101 SAVE_CPPFLAGS="$CPPFLAGS"
2102 SAVE_LDFLAGS="$LDFLAGS"
2103 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2104 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2106 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2108 CPPFLAGS="$SAVE_CPPFLAGS"
2109 LDFLAGS="$SAVE_LDFLAGS"
2110 fi
2111 if test "x$with_libmemcached" = "xyes"
2112 then
2113 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2114 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2115 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2116 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2117 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2118 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2119 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2120 fi
2121 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2122 # }}}
2124 # --with-libmodbus {{{
2125 with_libmodbus_config=""
2126 with_libmodbus_cflags=""
2127 with_libmodbus_libs=""
2128 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2129 [
2130 if test "x$withval" = "xno"
2131 then
2132 with_libmodbus="no"
2133 else if test "x$withval" = "xyes"
2134 then
2135 with_libmodbus="use_pkgconfig"
2136 else if test -d "$with_libmodbus/lib"
2137 then
2138 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2139 with_libmodbus_cflags="-I$withval/include"
2140 with_libmodbus_libs="-L$withval/lib -lmodbus"
2141 with_libmodbus="yes"
2142 fi; fi; fi
2143 ],
2144 [with_libmodbus="use_pkgconfig"])
2146 # configure using pkg-config
2147 if test "x$with_libmodbus" = "xuse_pkgconfig"
2148 then
2149 if test "x$PKG_CONFIG" = "x"
2150 then
2151 with_libmodbus="no (Don't have pkg-config)"
2152 fi
2153 fi
2154 if test "x$with_libmodbus" = "xuse_pkgconfig"
2155 then
2156 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
2157 $PKG_CONFIG --exists 'modbus' 2>/dev/null
2158 if test $? -ne 0
2159 then
2160 with_libmodbus="no (pkg-config doesn't know modbus)"
2161 fi
2162 fi
2163 if test "x$with_libmodbus" = "xuse_pkgconfig"
2164 then
2165 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
2166 if test $? -ne 0
2167 then
2168 with_libmodbus="no ($PKG_CONFIG failed)"
2169 fi
2170 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
2171 if test $? -ne 0
2172 then
2173 with_libmodbus="no ($PKG_CONFIG failed)"
2174 fi
2175 fi
2176 if test "x$with_libmodbus" = "xuse_pkgconfig"
2177 then
2178 with_libmodbus="yes"
2179 fi
2181 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2182 # the actual checks.
2183 if test "x$with_libmodbus" = "xyes"
2184 then
2185 SAVE_CPPFLAGS="$CPPFLAGS"
2186 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2188 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2190 CPPFLAGS="$SAVE_CPPFLAGS"
2191 fi
2192 if test "x$with_libmodbus" = "xyes"
2193 then
2194 SAVE_CPPFLAGS="$CPPFLAGS"
2195 SAVE_LDFLAGS="$LDFLAGS"
2197 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2198 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2200 AC_CHECK_LIB(modbus, modbus_connect,
2201 [with_libmodbus="yes"],
2202 [with_libmodbus="no (symbol modbus_connect not found)"])
2204 CPPFLAGS="$SAVE_CPPFLAGS"
2205 LDFLAGS="$SAVE_LDFLAGS"
2206 fi
2207 if test "x$with_libmodbus" = "xyes"
2208 then
2209 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2210 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2211 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2212 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2213 fi
2214 # }}}
2216 # --with-libmysql {{{
2217 with_mysql_config="mysql_config"
2218 with_mysql_cflags=""
2219 with_mysql_libs=""
2220 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2221 [
2222 if test "x$withval" = "xno"
2223 then
2224 with_libmysql="no"
2225 else if test "x$withval" = "xyes"
2226 then
2227 with_libmysql="yes"
2228 else
2229 if test -f "$withval" && test -x "$withval";
2230 then
2231 with_mysql_config="$withval"
2232 else if test -x "$withval/bin/mysql_config"
2233 then
2234 with_mysql_config="$withval/bin/mysql_config"
2235 fi; fi
2236 with_libmysql="yes"
2237 fi; fi
2238 ],
2239 [
2240 with_libmysql="yes"
2241 ])
2242 if test "x$with_libmysql" = "xyes"
2243 then
2244 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2245 mysql_config_status=$?
2247 if test $mysql_config_status -ne 0
2248 then
2249 with_libmysql="no ($with_mysql_config failed)"
2250 else
2251 SAVE_CPPFLAGS="$CPPFLAGS"
2252 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2254 have_mysql_h="no"
2255 have_mysql_mysql_h="no"
2256 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2258 if test "x$have_mysql_h" = "xno"
2259 then
2260 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2261 fi
2263 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2264 then
2265 with_libmysql="no (mysql.h not found)"
2266 fi
2268 CPPFLAGS="$SAVE_CPPFLAGS"
2269 fi
2270 fi
2271 if test "x$with_libmysql" = "xyes"
2272 then
2273 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2274 mysql_config_status=$?
2276 if test $mysql_config_status -ne 0
2277 then
2278 with_libmysql="no ($with_mysql_config failed)"
2279 else
2280 AC_CHECK_LIB(mysqlclient, mysql_init,
2281 [with_libmysql="yes"],
2282 [with_libmysql="no (symbol 'mysql_init' not found)"],
2283 [$with_mysql_libs])
2285 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2286 [with_libmysql="yes"],
2287 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2288 [$with_mysql_libs])
2289 fi
2290 fi
2291 if test "x$with_libmysql" = "xyes"
2292 then
2293 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2294 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2295 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2296 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2297 fi
2298 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2299 # }}}
2301 # --with-libnetlink {{{
2302 with_libnetlink_cflags=""
2303 with_libnetlink_libs="-lnetlink"
2304 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2305 [
2306 echo "libnetlink: withval = $withval"
2307 if test "x$withval" = "xyes"
2308 then
2309 with_libnetlink="yes"
2310 else if test "x$withval" = "xno"
2311 then
2312 with_libnetlink="no"
2313 else
2314 if test -d "$withval/include"
2315 then
2316 with_libnetlink_cflags="-I$withval/include"
2317 with_libnetlink_libs="-L$withval/lib -lnetlink"
2318 with_libnetlink="yes"
2319 else
2320 AC_MSG_ERROR("no such directory: $withval/include")
2321 fi
2322 fi; fi
2323 ],
2324 [
2325 if test "x$ac_system" = "xLinux"
2326 then
2327 with_libnetlink="yes"
2328 else
2329 with_libnetlink="no (Linux only library)"
2330 fi
2331 ])
2332 if test "x$with_libnetlink" = "xyes"
2333 then
2334 SAVE_CFLAGS="$CFLAGS"
2335 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2337 with_libnetlink="no (libnetlink.h not found)"
2339 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2340 [
2341 with_libnetlink="yes"
2342 break
2343 ], [],
2344 [#include <stdio.h>
2345 #include <sys/types.h>
2346 #include <asm/types.h>
2347 #include <sys/socket.h>
2348 #include <linux/netlink.h>
2349 #include <linux/rtnetlink.h>])
2350 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2351 [#include <stdio.h>
2352 #include <sys/types.h>
2353 #include <asm/types.h>
2354 #include <sys/socket.h>])
2356 AC_COMPILE_IFELSE(
2357 [#include <stdio.h>
2358 #include <sys/types.h>
2359 #include <asm/types.h>
2360 #include <sys/socket.h>
2361 #include <linux/netlink.h>
2362 #include <linux/rtnetlink.h>
2364 int main (void)
2365 {
2366 int retval = TCA_STATS2;
2367 return (retval);
2368 }],
2369 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2370 []);
2372 AC_COMPILE_IFELSE(
2373 [#include <stdio.h>
2374 #include <sys/types.h>
2375 #include <asm/types.h>
2376 #include <sys/socket.h>
2377 #include <linux/netlink.h>
2378 #include <linux/rtnetlink.h>
2380 int main (void)
2381 {
2382 int retval = TCA_STATS;
2383 return (retval);
2384 }],
2385 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2386 []);
2388 CFLAGS="$SAVE_CFLAGS"
2389 fi
2390 if test "x$with_libnetlink" = "xyes"
2391 then
2392 AC_CHECK_LIB(netlink, rtnl_open,
2393 [with_libnetlink="yes"],
2394 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2395 [$with_libnetlink_libs])
2396 fi
2397 if test "x$with_libnetlink" = "xyes"
2398 then
2399 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2400 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2401 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2402 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2403 fi
2404 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2405 # }}}
2407 # --with-libnetapp {{{
2408 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2409 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2410 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2411 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2412 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2413 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2414 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2415 [
2416 if test -d "$withval"
2417 then
2418 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2419 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2420 with_libnetapp="yes"
2421 else
2422 with_libnetapp="$withval"
2423 fi
2424 ],
2425 [
2426 with_libnetapp="yes"
2427 ])
2429 SAVE_CPPFLAGS="$CPPFLAGS"
2430 SAVE_LDFLAGS="$LDFLAGS"
2431 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2432 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2434 if test "x$with_libnetapp" = "xyes"
2435 then
2436 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2437 then
2438 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2439 fi
2440 AC_CHECK_HEADERS(netapp_api.h,
2441 [with_libnetapp="yes"],
2442 [with_libnetapp="no (netapp_api.h not found)"])
2443 fi
2445 if test "x$with_libnetapp" = "xyes"
2446 then
2447 if test "x$LIBNETAPP_LDFLAGS" != "x"
2448 then
2449 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2450 fi
2452 if test "x$LIBNETAPP_LIBS" = "x"
2453 then
2454 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2455 fi
2456 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2458 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2459 [with_libnetapp="yes"],
2460 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2461 [$LIBNETAPP_LIBS])
2462 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2463 fi
2465 CPPFLAGS="$SAVE_CPPFLAGS"
2466 LDFLAGS="$SAVE_LDFLAGS"
2468 if test "x$with_libnetapp" = "xyes"
2469 then
2470 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2471 fi
2473 AC_SUBST(LIBNETAPP_CPPFLAGS)
2474 AC_SUBST(LIBNETAPP_LDFLAGS)
2475 AC_SUBST(LIBNETAPP_LIBS)
2476 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2477 # }}}
2479 # --with-libnetsnmp {{{
2480 with_snmp_config="net-snmp-config"
2481 with_snmp_cflags=""
2482 with_snmp_libs=""
2483 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2484 [
2485 if test "x$withval" = "xno"
2486 then
2487 with_libnetsnmp="no"
2488 else if test "x$withval" = "xyes"
2489 then
2490 with_libnetsnmp="yes"
2491 else
2492 if test -x "$withval"
2493 then
2494 with_snmp_config="$withval"
2495 with_libnetsnmp="yes"
2496 else
2497 with_snmp_config="$withval/bin/net-snmp-config"
2498 with_libnetsnmp="yes"
2499 fi
2500 fi; fi
2501 ],
2502 [with_libnetsnmp="yes"])
2503 if test "x$with_libnetsnmp" = "xyes"
2504 then
2505 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2506 snmp_config_status=$?
2508 if test $snmp_config_status -ne 0
2509 then
2510 with_libnetsnmp="no ($with_snmp_config failed)"
2511 else
2512 SAVE_CPPFLAGS="$CPPFLAGS"
2513 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2515 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2517 CPPFLAGS="$SAVE_CPPFLAGS"
2518 fi
2519 fi
2520 if test "x$with_libnetsnmp" = "xyes"
2521 then
2522 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2523 snmp_config_status=$?
2525 if test $snmp_config_status -ne 0
2526 then
2527 with_libnetsnmp="no ($with_snmp_config failed)"
2528 else
2529 AC_CHECK_LIB(netsnmp, init_snmp,
2530 [with_libnetsnmp="yes"],
2531 [with_libnetsnmp="no (libnetsnmp not found)"],
2532 [$with_snmp_libs])
2533 fi
2534 fi
2535 if test "x$with_libnetsnmp" = "xyes"
2536 then
2537 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2538 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2539 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2540 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2541 fi
2542 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2543 # }}}
2545 # --with-liboconfig {{{
2546 with_own_liboconfig="no"
2547 liboconfig_LDFLAGS="$LDFLAGS"
2548 liboconfig_CPPFLAGS="$CPPFLAGS"
2549 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2550 [
2551 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2552 then
2553 if test -d "$withval/lib"
2554 then
2555 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2556 fi
2557 if test -d "$withval/include"
2558 then
2559 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2560 fi
2561 fi
2562 if test "x$withval" = "xno"
2563 then
2564 AC_MSG_ERROR("liboconfig is required")
2565 fi
2566 ],
2567 [
2568 with_liboconfig="yes"
2569 ])
2571 save_LDFLAGS="$LDFLAGS"
2572 save_CPPFLAGS="$CPPFLAGS"
2573 LDFLAGS="$liboconfig_LDFLAGS"
2574 CPPFLAGS="$liboconfig_CPPFLAGS"
2575 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2576 [
2577 with_liboconfig="yes"
2578 with_own_liboconfig="no"
2579 ],
2580 [
2581 with_liboconfig="yes"
2582 with_own_liboconfig="yes"
2583 LDFLAGS="$save_LDFLAGS"
2584 CPPFLAGS="$save_CPPFLAGS"
2585 ])
2587 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2588 if test "x$with_own_liboconfig" = "xyes"
2589 then
2590 with_liboconfig="yes (shipped version)"
2591 fi
2592 # }}}
2594 # --with-liboping {{{
2595 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2596 [
2597 if test "x$withval" = "xyes"
2598 then
2599 with_liboping="yes"
2600 else if test "x$withval" = "xno"
2601 then
2602 with_liboping="no"
2603 else
2604 with_liboping="yes"
2605 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2606 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2607 fi; fi
2608 ],
2609 [with_liboping="yes"])
2611 SAVE_CPPFLAGS="$CPPFLAGS"
2612 SAVE_LDFLAGS="$LDFLAGS"
2614 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2615 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2617 if test "x$with_liboping" = "xyes"
2618 then
2619 if test "x$LIBOPING_CPPFLAGS" != "x"
2620 then
2621 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2622 fi
2623 AC_CHECK_HEADERS(oping.h,
2624 [with_liboping="yes"],
2625 [with_liboping="no (oping.h not found)"])
2626 fi
2627 if test "x$with_liboping" = "xyes"
2628 then
2629 if test "x$LIBOPING_LDFLAGS" != "x"
2630 then
2631 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2632 fi
2633 AC_CHECK_LIB(oping, ping_construct,
2634 [with_liboping="yes"],
2635 [with_liboping="no (symbol 'ping_construct' not found)"])
2636 fi
2638 CPPFLAGS="$SAVE_CPPFLAGS"
2639 LDFLAGS="$SAVE_LDFLAGS"
2641 if test "x$with_liboping" = "xyes"
2642 then
2643 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2644 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2645 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2646 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2647 fi
2648 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2649 # }}}
2651 # --with-oracle {{{
2652 with_oracle_cppflags=""
2653 with_oracle_libs=""
2654 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2655 [
2656 if test "x$withval" = "xyes"
2657 then
2658 if test "x$ORACLE_HOME" = "x"
2659 then
2660 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2661 fi
2662 with_oracle="yes"
2663 else if test "x$withval" = "xno"
2664 then
2665 with_oracle="no"
2666 else
2667 with_oracle="yes"
2668 ORACLE_HOME="$withval"
2669 fi; fi
2670 ],
2671 [
2672 if test "x$ORACLE_HOME" = "x"
2673 then
2674 with_oracle="no (ORACLE_HOME is not set)"
2675 else
2676 with_oracle="yes"
2677 fi
2678 ])
2679 if test "x$ORACLE_HOME" != "x"
2680 then
2681 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2683 if test -e "$ORACLE_HOME/lib/ldflags"
2684 then
2685 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2686 fi
2687 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2688 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2689 fi
2690 if test "x$with_oracle" = "xyes"
2691 then
2692 SAVE_CPPFLAGS="$CPPFLAGS"
2693 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2695 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2697 CPPFLAGS="$SAVE_CPPFLAGS"
2698 fi
2699 if test "x$with_oracle" = "xyes"
2700 then
2701 SAVE_CPPFLAGS="$CPPFLAGS"
2702 SAVE_LDFLAGS="$LDFLAGS"
2703 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2704 LDFLAGS="$LDFLAGS $with_oracle_libs"
2706 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2708 CPPFLAGS="$SAVE_CPPFLAGS"
2709 LDFLAGS="$SAVE_LDFLAGS"
2710 fi
2711 if test "x$with_oracle" = "xyes"
2712 then
2713 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2714 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2715 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2716 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2717 fi
2718 # }}}
2720 # --with-libowcapi {{{
2721 with_libowcapi_cppflags=""
2722 with_libowcapi_libs="-lowcapi"
2723 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2724 [
2725 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2726 then
2727 with_libowcapi_cppflags="-I$withval/include"
2728 with_libowcapi_libs="-L$withval/lib -lowcapi"
2729 with_libowcapi="yes"
2730 else
2731 with_libowcapi="$withval"
2732 fi
2733 ],
2734 [
2735 with_libowcapi="yes"
2736 ])
2737 if test "x$with_libowcapi" = "xyes"
2738 then
2739 SAVE_CPPFLAGS="$CPPFLAGS"
2740 CPPFLAGS="$with_libowcapi_cppflags"
2742 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2744 CPPFLAGS="$SAVE_CPPFLAGS"
2745 fi
2746 if test "x$with_libowcapi" = "xyes"
2747 then
2748 SAVE_LDFLAGS="$LDFLAGS"
2749 SAVE_CPPFLAGS="$CPPFLAGS"
2750 LDFLAGS="$with_libowcapi_libs"
2751 CPPFLAGS="$with_libowcapi_cppflags"
2753 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2755 LDFLAGS="$SAVE_LDFLAGS"
2756 CPPFLAGS="$SAVE_CPPFLAGS"
2757 fi
2758 if test "x$with_libowcapi" = "xyes"
2759 then
2760 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2761 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2762 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2763 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2764 fi
2765 # }}}
2767 # --with-libpcap {{{
2768 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2769 [
2770 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2771 then
2772 LDFLAGS="$LDFLAGS -L$withval/lib"
2773 CPPFLAGS="$CPPFLAGS -I$withval/include"
2774 with_libpcap="yes"
2775 else
2776 with_libpcap="$withval"
2777 fi
2778 ],
2779 [
2780 with_libpcap="yes"
2781 ])
2782 if test "x$with_libpcap" = "xyes"
2783 then
2784 AC_CHECK_LIB(pcap, pcap_open_live,
2785 [
2786 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2787 ], [with_libpcap="no (libpcap not found)"])
2788 fi
2789 if test "x$with_libpcap" = "xyes"
2790 then
2791 AC_CHECK_HEADERS(pcap.h,,
2792 [with_libpcap="no (pcap.h not found)"])
2793 fi
2794 if test "x$with_libpcap" = "xyes"
2795 then
2796 AC_CHECK_HEADERS(pcap-bpf.h,,
2797 [with_libpcap="no (pcap-bpf.h not found)"])
2798 fi
2799 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2800 # }}}
2802 # --with-libperl {{{
2803 perl_interpreter="perl"
2804 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2805 [
2806 if test -x "$withval"
2807 then
2808 perl_interpreter="$withval"
2809 with_libperl="yes"
2810 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2811 then
2812 LDFLAGS="$LDFLAGS -L$withval/lib"
2813 CPPFLAGS="$CPPFLAGS -I$withval/include"
2814 perl_interpreter="$withval/bin/perl"
2815 with_libperl="yes"
2816 else
2817 with_libperl="$withval"
2818 fi; fi
2819 ],
2820 [
2821 with_libperl="yes"
2822 ])
2824 AC_MSG_CHECKING([for perl])
2825 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2826 if test -x "$perl_interpreter"
2827 then
2828 AC_MSG_RESULT([yes ($perl_interpreter)])
2829 else
2830 perl_interpreter=""
2831 AC_MSG_RESULT([no])
2832 fi
2834 AC_SUBST(PERL, "$perl_interpreter")
2836 if test "x$with_libperl" = "xyes" \
2837 && test -n "$perl_interpreter"
2838 then
2839 SAVE_CFLAGS="$CFLAGS"
2840 SAVE_LDFLAGS="$LDFLAGS"
2841 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2842 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2843 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2844 CFLAGS="$CFLAGS $PERL_CFLAGS"
2845 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2847 AC_CACHE_CHECK([for libperl],
2848 [c_cv_have_libperl],
2849 AC_LINK_IFELSE(
2850 AC_LANG_PROGRAM(
2851 [[
2852 #define PERL_NO_GET_CONTEXT
2853 #include <EXTERN.h>
2854 #include <perl.h>
2855 #include <XSUB.h>
2856 ]],
2857 [[
2858 dTHX;
2859 load_module (PERL_LOADMOD_NOIMPORT,
2860 newSVpv ("Collectd::Plugin::FooBar", 24),
2861 Nullsv);
2862 ]]),
2863 [c_cv_have_libperl="yes"],
2864 [c_cv_have_libperl="no"]
2865 )
2866 )
2868 if test "x$c_cv_have_libperl" = "xyes"
2869 then
2870 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2871 AC_SUBST(PERL_CFLAGS)
2872 AC_SUBST(PERL_LDFLAGS)
2873 else
2874 with_libperl="no"
2875 fi
2877 CFLAGS="$SAVE_CFLAGS"
2878 LDFLAGS="$SAVE_LDFLAGS"
2879 else if test -z "$perl_interpreter"; then
2880 with_libperl="no (no perl interpreter found)"
2881 c_cv_have_libperl="no"
2882 fi; fi
2883 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2885 if test "x$with_libperl" = "xyes"
2886 then
2887 SAVE_CFLAGS="$CFLAGS"
2888 SAVE_LDFLAGS="$LDFLAGS"
2889 CFLAGS="$CFLAGS $PERL_CFLAGS"
2890 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2892 AC_CACHE_CHECK([if perl supports ithreads],
2893 [c_cv_have_perl_ithreads],
2894 AC_LINK_IFELSE(
2895 AC_LANG_PROGRAM(
2896 [[
2897 #include <EXTERN.h>
2898 #include <perl.h>
2899 #include <XSUB.h>
2901 #if !defined(USE_ITHREADS)
2902 # error "Perl does not support ithreads!"
2903 #endif /* !defined(USE_ITHREADS) */
2904 ]],
2905 [[ ]]),
2906 [c_cv_have_perl_ithreads="yes"],
2907 [c_cv_have_perl_ithreads="no"]
2908 )
2909 )
2911 if test "x$c_cv_have_perl_ithreads" = "xyes"
2912 then
2913 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2914 fi
2916 CFLAGS="$SAVE_CFLAGS"
2917 LDFLAGS="$SAVE_LDFLAGS"
2918 fi
2920 if test "x$with_libperl" = "xyes"
2921 then
2922 SAVE_CFLAGS="$CFLAGS"
2923 SAVE_LDFLAGS="$LDFLAGS"
2924 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2925 # (see issues #41 and #42)
2926 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2927 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2929 AC_CACHE_CHECK([for broken Perl_load_module()],
2930 [c_cv_have_broken_perl_load_module],
2931 AC_LINK_IFELSE(
2932 AC_LANG_PROGRAM(
2933 [[
2934 #define PERL_NO_GET_CONTEXT
2935 #include <EXTERN.h>
2936 #include <perl.h>
2937 #include <XSUB.h>
2938 ]],
2939 [[
2940 dTHX;
2941 load_module (PERL_LOADMOD_NOIMPORT,
2942 newSVpv ("Collectd::Plugin::FooBar", 24),
2943 Nullsv);
2944 ]]),
2945 [c_cv_have_broken_perl_load_module="no"],
2946 [c_cv_have_broken_perl_load_module="yes"]
2947 )
2948 )
2950 CFLAGS="$SAVE_CFLAGS"
2951 LDFLAGS="$SAVE_LDFLAGS"
2952 fi
2953 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2954 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2956 if test "x$with_libperl" = "xyes"
2957 then
2958 SAVE_CFLAGS="$CFLAGS"
2959 SAVE_LDFLAGS="$LDFLAGS"
2960 CFLAGS="$CFLAGS $PERL_CFLAGS"
2961 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2963 AC_CHECK_MEMBER(
2964 [struct mgvtbl.svt_local],
2965 [have_struct_mgvtbl_svt_local="yes"],
2966 [have_struct_mgvtbl_svt_local="no"],
2967 [
2968 #include <EXTERN.h>
2969 #include <perl.h>
2970 #include <XSUB.h>
2971 ])
2973 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2974 then
2975 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2976 [Define if Perl's struct mgvtbl has member svt_local.])
2977 fi
2979 CFLAGS="$SAVE_CFLAGS"
2980 LDFLAGS="$SAVE_LDFLAGS"
2981 fi
2982 # }}}
2984 # --with-libpq {{{
2985 with_pg_config="pg_config"
2986 with_libpq_includedir=""
2987 with_libpq_libdir=""
2988 with_libpq_cppflags=""
2989 with_libpq_ldflags=""
2990 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2991 [Path to libpq.])],
2992 [
2993 if test "x$withval" = "xno"
2994 then
2995 with_libpq="no"
2996 else if test "x$withval" = "xyes"
2997 then
2998 with_libpq="yes"
2999 else
3000 if test -f "$withval" && test -x "$withval";
3001 then
3002 with_pg_config="$withval"
3003 else if test -x "$withval/bin/pg_config"
3004 then
3005 with_pg_config="$withval/bin/pg_config"
3006 fi; fi
3007 with_libpq="yes"
3008 fi; fi
3009 ],
3010 [
3011 with_libpq="yes"
3012 ])
3013 if test "x$with_libpq" = "xyes"
3014 then
3015 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3016 pg_config_status=$?
3018 if test $pg_config_status -eq 0
3019 then
3020 if test -n "$with_libpq_includedir"; then
3021 for dir in $with_libpq_includedir; do
3022 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3023 done
3024 fi
3025 else
3026 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3027 fi
3029 SAVE_CPPFLAGS="$CPPFLAGS"
3030 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3032 AC_CHECK_HEADERS(libpq-fe.h, [],
3033 [with_libpq="no (libpq-fe.h not found)"], [])
3035 CPPFLAGS="$SAVE_CPPFLAGS"
3036 fi
3037 if test "x$with_libpq" = "xyes"
3038 then
3039 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3040 pg_config_status=$?
3042 if test $pg_config_status -eq 0
3043 then
3044 if test -n "$with_libpq_libdir"; then
3045 for dir in $with_libpq_libdir; do
3046 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3047 done
3048 fi
3049 else
3050 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3051 fi
3053 SAVE_LDFLAGS="$LDFLAGS"
3054 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3056 AC_CHECK_LIB(pq, PQconnectdb,
3057 [with_libpq="yes"],
3058 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3060 AC_CHECK_LIB(pq, PQserverVersion,
3061 [with_libpq="yes"],
3062 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3064 LDFLAGS="$SAVE_LDFLAGS"
3065 fi
3066 if test "x$with_libpq" = "xyes"
3067 then
3068 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3069 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3070 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3071 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3072 fi
3073 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3074 # }}}
3076 # --with-libpthread {{{
3077 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3078 [ if test "x$withval" != "xno" \
3079 && test "x$withval" != "xyes"
3080 then
3081 LDFLAGS="$LDFLAGS -L$withval/lib"
3082 CPPFLAGS="$CPPFLAGS -I$withval/include"
3083 with_libpthread="yes"
3084 else
3085 if test "x$withval" = "xno"
3086 then
3087 with_libpthread="no (disabled)"
3088 fi
3089 fi
3090 ], [with_libpthread="yes"])
3091 if test "x$with_libpthread" = "xyes"
3092 then
3093 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3094 fi
3096 if test "x$with_libpthread" = "xyes"
3097 then
3098 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3099 fi
3100 if test "x$with_libpthread" = "xyes"
3101 then
3102 collect_pthread=1
3103 else
3104 collect_pthread=0
3105 fi
3106 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3107 [Wether or not to use pthread (POSIX threads) library])
3108 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3109 # }}}
3111 # --with-python {{{
3112 with_python_prog=""
3113 with_python_path="$PATH"
3114 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3115 [
3116 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3117 then
3118 with_python="$withval"
3119 else if test -x "$withval"
3120 then
3121 with_python_prog="$withval"
3122 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3123 with_python="yes"
3124 else if test -d "$withval"
3125 then
3126 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3127 with_python="yes"
3128 else
3129 AC_MSG_WARN([Argument not recognized: $withval])
3130 fi; fi; fi
3131 ], [with_python="yes"])
3133 SAVE_PATH="$PATH"
3134 SAVE_CPPFLAGS="$CPPFLAGS"
3135 SAVE_LDFLAGS="$LDFLAGS"
3136 SAVE_LIBS="$LIBS"
3138 PATH="$with_python_path"
3140 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3141 then
3142 AC_MSG_CHECKING([for python])
3143 with_python_prog="`which python 2>/dev/null`"
3144 if test "x$with_python_prog" = "x"
3145 then
3146 AC_MSG_RESULT([not found])
3147 with_python="no (interpreter not found)"
3148 else
3149 AC_MSG_RESULT([$with_python_prog])
3150 fi
3151 fi
3153 if test "x$with_python" = "xyes"
3154 then
3155 AC_MSG_CHECKING([for Python CPPFLAGS])
3156 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3157 python_config_status=$?
3159 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3160 then
3161 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3162 with_python="no"
3163 else
3164 AC_MSG_RESULT([$python_include_path])
3165 fi
3166 fi
3168 if test "x$with_python" = "xyes"
3169 then
3170 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3171 AC_CHECK_HEADERS(Python.h,
3172 [with_python="yes"],
3173 [with_python="no ('Python.h' not found)"])
3174 fi
3176 if test "x$with_python" = "xyes"
3177 then
3178 AC_MSG_CHECKING([for Python LDFLAGS])
3179 python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
3180 python_config_status=$?
3182 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3183 then
3184 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3185 with_python="no"
3186 else
3187 AC_MSG_RESULT([$python_library_path])
3188 fi
3189 fi
3191 if test "x$with_python" = "xyes"
3192 then
3193 AC_MSG_CHECKING([for Python LIBS])
3194 python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3195 python_config_status=$?
3197 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3198 then
3199 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3200 with_python="no"
3201 else
3202 AC_MSG_RESULT([$python_library_flags])
3203 fi
3204 fi
3206 if test "x$with_python" = "xyes"
3207 then
3208 LDFLAGS="-L$python_library_path $LDFLAGS"
3209 LIBS="$python_library_flags $LIBS"
3211 AC_CHECK_FUNC(PyObject_CallFunction,
3212 [with_python="yes"],
3213 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3214 fi
3216 PATH="$SAVE_PATH"
3217 CPPFLAGS="$SAVE_CPPFLAGS"
3218 LDFLAGS="$SAVE_LDFLAGS"
3219 LIBS="$SAVE_LIBS"
3221 if test "x$with_python" = "xyes"
3222 then
3223 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3224 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3225 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3226 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3227 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3228 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3229 fi
3230 # }}} --with-python
3232 # --with-librabbitmq {{{
3233 with_librabbitmq_cppflags=""
3234 with_librabbitmq_ldflags=""
3235 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3236 [
3237 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3238 then
3239 with_librabbitmq_cppflags="-I$withval/include"
3240 with_librabbitmq_ldflags="-L$withval/lib"
3241 with_librabbitmq="yes"
3242 else
3243 with_librabbitmq="$withval"
3244 fi
3245 ],
3246 [
3247 with_librabbitmq="yes"
3248 ])
3249 SAVE_CPPFLAGS="$CPPFLAGS"
3250 SAVE_LDFLAGS="$LDFLAGS"
3251 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3252 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3253 if test "x$with_librabbitmq" = "xyes"
3254 then
3255 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3256 fi
3257 if test "x$with_librabbitmq" = "xyes"
3258 then
3259 # librabbitmq up to version 0.9.1 provides "library_errno", later
3260 # versions use "library_error". The library does not provide a version
3261 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3262 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3263 [
3264 #if HAVE_STDLIB_H
3265 # include <stdlib.h>
3266 #endif
3267 #if HAVE_STDIO_H
3268 # include <stdio.h>
3269 #endif
3270 #if HAVE_STDINT_H
3271 # include <stdint.h>
3272 #endif
3273 #if HAVE_INTTYPES_H
3274 # include <inttypes.h>
3275 #endif
3276 #include <amqp.h>
3277 ])
3278 fi
3279 if test "x$with_librabbitmq" = "xyes"
3280 then
3281 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3282 fi
3283 if test "x$with_librabbitmq" = "xyes"
3284 then
3285 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3286 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3287 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3288 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3289 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3290 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3291 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3292 fi
3293 CPPFLAGS="$SAVE_CPPFLAGS"
3294 LDFLAGS="$SAVE_LDFLAGS"
3295 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3296 # }}}
3298 # --with-librouteros {{{
3299 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3300 [
3301 if test "x$withval" = "xyes"
3302 then
3303 with_librouteros="yes"
3304 else if test "x$withval" = "xno"
3305 then
3306 with_librouteros="no"
3307 else
3308 with_librouteros="yes"
3309 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3310 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3311 fi; fi
3312 ],
3313 [with_librouteros="yes"])
3315 SAVE_CPPFLAGS="$CPPFLAGS"
3316 SAVE_LDFLAGS="$LDFLAGS"
3318 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3319 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3321 if test "x$with_librouteros" = "xyes"
3322 then
3323 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3324 then
3325 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3326 fi
3327 AC_CHECK_HEADERS(routeros_api.h,
3328 [with_librouteros="yes"],
3329 [with_librouteros="no (routeros_api.h not found)"])
3330 fi
3331 if test "x$with_librouteros" = "xyes"
3332 then
3333 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3334 then
3335 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3336 fi
3337 AC_CHECK_LIB(routeros, ros_interface,
3338 [with_librouteros="yes"],
3339 [with_librouteros="no (symbol 'ros_interface' not found)"])
3340 fi
3342 CPPFLAGS="$SAVE_CPPFLAGS"
3343 LDFLAGS="$SAVE_LDFLAGS"
3345 if test "x$with_librouteros" = "xyes"
3346 then
3347 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3348 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3349 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3350 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3351 fi
3352 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3353 # }}}
3355 # --with-librrd {{{
3356 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3357 librrd_cflags=""
3358 librrd_ldflags=""
3359 librrd_threadsafe="yes"
3360 librrd_rrdc_update="no"
3361 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3362 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3363 then
3364 librrd_cflags="-I$withval/include"
3365 librrd_ldflags="-L$withval/lib"
3366 with_librrd="yes"
3367 else
3368 with_librrd="$withval"
3369 fi
3370 ], [with_librrd="yes"])
3371 if test "x$with_librrd" = "xyes"
3372 then
3373 SAVE_CPPFLAGS="$CPPFLAGS"
3374 SAVE_LDFLAGS="$LDFLAGS"
3376 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3377 LDFLAGS="$LDFLAGS $librrd_ldflags"
3379 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3381 CPPFLAGS="$SAVE_CPPFLAGS"
3382 LDFLAGS="$SAVE_LDFLAGS"
3383 fi
3384 if test "x$with_librrd" = "xyes"
3385 then
3386 SAVE_CPPFLAGS="$CPPFLAGS"
3387 SAVE_LDFLAGS="$LDFLAGS"
3389 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3390 LDFLAGS="$LDFLAGS $librrd_ldflags"
3392 AC_CHECK_LIB(rrd_th, rrd_update_r,
3393 [with_librrd="yes"
3394 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3395 ],
3396 [librrd_threadsafe="no"
3397 AC_CHECK_LIB(rrd, rrd_update,
3398 [with_librrd="yes"
3399 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3400 ],
3401 [with_librrd="no (symbol 'rrd_update' not found)"],
3402 [-lm])
3403 ],
3404 [-lm])
3406 if test "x$librrd_threadsafe" = "xyes"
3407 then
3408 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3409 else
3410 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3411 fi
3413 CPPFLAGS="$SAVE_CPPFLAGS"
3414 LDFLAGS="$SAVE_LDFLAGS"
3415 fi
3416 if test "x$with_librrd" = "xyes"
3417 then
3418 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3419 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3420 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3421 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3422 fi
3423 if test "x$librrd_threadsafe" = "xyes"
3424 then
3425 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3426 fi
3427 # }}}
3429 # --with-libsensors {{{
3430 with_sensors_cflags=""
3431 with_sensors_ldflags=""
3432 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3433 [
3434 if test "x$withval" = "xno"
3435 then
3436 with_libsensors="no"
3437 else
3438 with_libsensors="yes"
3439 if test "x$withval" != "xyes"
3440 then
3441 with_sensors_cflags="-I$withval/include"
3442 with_sensors_ldflags="-L$withval/lib"
3443 with_libsensors="yes"
3444 fi
3445 fi
3446 ],
3447 [
3448 if test "x$ac_system" = "xLinux"
3449 then
3450 with_libsensors="yes"
3451 else
3452 with_libsensors="no (Linux only library)"
3453 fi
3454 ])
3455 if test "x$with_libsensors" = "xyes"
3456 then
3457 SAVE_CPPFLAGS="$CPPFLAGS"
3458 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3460 # AC_CHECK_HEADERS(sensors/sensors.h,
3461 # [
3462 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3463 # ],
3464 # [with_libsensors="no (sensors/sensors.h not found)"])
3465 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3467 CPPFLAGS="$SAVE_CPPFLAGS"
3468 fi
3469 if test "x$with_libsensors" = "xyes"
3470 then
3471 SAVE_CPPFLAGS="$CPPFLAGS"
3472 SAVE_LDFLAGS="$LDFLAGS"
3473 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3474 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3476 AC_CHECK_LIB(sensors, sensors_init,
3477 [
3478 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3479 ],
3480 [with_libsensors="no (libsensors not found)"])
3482 CPPFLAGS="$SAVE_CPPFLAGS"
3483 LDFLAGS="$SAVE_LDFLAGS"
3484 fi
3485 if test "x$with_libsensors" = "xyes"
3486 then
3487 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3488 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3489 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3490 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3491 fi
3492 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3493 # }}}
3495 # --with-libstatgrab {{{
3496 with_libstatgrab_cflags=""
3497 with_libstatgrab_ldflags=""
3498 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3499 [
3500 if test "x$withval" != "xno" \
3501 && test "x$withval" != "xyes"
3502 then
3503 with_libstatgrab_cflags="-I$withval/include"
3504 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3505 with_libstatgrab="yes"
3506 with_libstatgrab_pkg_config="no"
3507 else
3508 with_libstatgrab="$withval"
3509 with_libstatgrab_pkg_config="yes"
3510 fi
3511 ],
3512 [
3513 with_libstatgrab="yes"
3514 with_libstatgrab_pkg_config="yes"
3515 ])
3517 if test "x$with_libstatgrab" = "xyes" \
3518 && test "x$with_libstatgrab_pkg_config" = "xyes"
3519 then
3520 if test "x$PKG_CONFIG" != "x"
3521 then
3522 AC_MSG_CHECKING([pkg-config for libstatgrab])
3523 temp_result="found"
3524 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3525 if test "$?" != "0"
3526 then
3527 with_libstatgrab_pkg_config="no"
3528 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3529 temp_result="not found"
3530 fi
3531 AC_MSG_RESULT([$temp_result])
3532 else
3533 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3534 with_libstatgrab_pkg_config="no"
3535 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3536 fi
3537 fi
3539 if test "x$with_libstatgrab" = "xyes" \
3540 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3541 && test "x$with_libstatgrab_cflags" = "x"
3542 then
3543 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3544 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3545 if test "$?" = "0"
3546 then
3547 with_libstatgrab_cflags="$temp_result"
3548 else
3549 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3550 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3551 fi
3552 AC_MSG_RESULT([$temp_result])
3553 fi
3555 if test "x$with_libstatgrab" = "xyes" \
3556 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3557 && test "x$with_libstatgrab_ldflags" = "x"
3558 then
3559 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3560 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3561 if test "$?" = "0"
3562 then
3563 with_libstatgrab_ldflags="$temp_result"
3564 else
3565 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3566 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3567 fi
3568 AC_MSG_RESULT([$temp_result])
3569 fi
3571 if test "x$with_libstatgrab" = "xyes"
3572 then
3573 SAVE_CPPFLAGS="$CPPFLAGS"
3574 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3576 AC_CHECK_HEADERS(statgrab.h,
3577 [with_libstatgrab="yes"],
3578 [with_libstatgrab="no (statgrab.h not found)"])
3580 CPPFLAGS="$SAVE_CPPFLAGS"
3581 fi
3583 if test "x$with_libstatgrab" = "xyes"
3584 then
3585 SAVE_CFLAGS="$CFLAGS"
3586 SAVE_LDFLAGS="$LDFLAGS"
3588 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3589 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3591 AC_CHECK_LIB(statgrab, sg_init,
3592 [with_libstatgrab="yes"],
3593 [with_libstatgrab="no (symbol sg_init not found)"])
3595 CFLAGS="$SAVE_CFLAGS"
3596 LDFLAGS="$SAVE_LDFLAGS"
3597 fi
3599 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3600 if test "x$with_libstatgrab" = "xyes"
3601 then
3602 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3603 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3604 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3605 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3606 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3607 fi
3608 # }}}
3610 # --with-libtokyotyrant {{{
3611 with_libtokyotyrant_cppflags=""
3612 with_libtokyotyrant_ldflags=""
3613 with_libtokyotyrant_libs=""
3614 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3615 [
3616 if test "x$withval" = "xno"
3617 then
3618 with_libtokyotyrant="no"
3619 else if test "x$withval" = "xyes"
3620 then
3621 with_libtokyotyrant="yes"
3622 else
3623 with_libtokyotyrant_cppflags="-I$withval/include"
3624 with_libtokyotyrant_ldflags="-L$withval/include"
3625 with_libtokyotyrant_libs="-ltokyotyrant"
3626 with_libtokyotyrant="yes"
3627 fi; fi
3628 ],
3629 [
3630 with_libtokyotyrant="yes"
3631 ])
3633 if test "x$with_libtokyotyrant" = "xyes"
3634 then
3635 if $PKG_CONFIG --exists tokyotyrant
3636 then
3637 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3638 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3639 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3640 fi
3641 fi
3643 SAVE_CPPFLAGS="$CPPFLAGS"
3644 SAVE_LDFLAGS="$LDFLAGS"
3645 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3646 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3648 if test "x$with_libtokyotyrant" = "xyes"
3649 then
3650 AC_CHECK_HEADERS(tcrdb.h,
3651 [
3652 AC_DEFINE(HAVE_TCRDB_H, 1,
3653 [Define to 1 if you have the <tcrdb.h> header file.])
3654 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3655 fi
3657 if test "x$with_libtokyotyrant" = "xyes"
3658 then
3659 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3660 [
3661 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3662 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3663 ],
3664 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3665 [$with_libtokyotyrant_libs])
3666 fi
3668 CPPFLAGS="$SAVE_CPPFLAGS"
3669 LDFLAGS="$SAVE_LDFLAGS"
3671 if test "x$with_libtokyotyrant" = "xyes"
3672 then
3673 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3674 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3675 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3676 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3677 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3678 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3679 fi
3680 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3681 # }}}
3683 # --with-libupsclient {{{
3684 with_libupsclient_config=""
3685 with_libupsclient_cflags=""
3686 with_libupsclient_libs=""
3687 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3688 [
3689 if test "x$withval" = "xno"
3690 then
3691 with_libupsclient="no"
3692 else if test "x$withval" = "xyes"
3693 then
3694 with_libupsclient="use_pkgconfig"
3695 else
3696 if test -x "$withval"
3697 then
3698 with_libupsclient_config="$withval"
3699 with_libupsclient="use_libupsclient_config"
3700 else if test -x "$withval/bin/libupsclient-config"
3701 then
3702 with_libupsclient_config="$withval/bin/libupsclient-config"
3703 with_libupsclient="use_libupsclient_config"
3704 else
3705 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3706 with_libupsclient_cflags="-I$withval/include"
3707 with_libupsclient_libs="-L$withval/lib -lupsclient"
3708 with_libupsclient="yes"
3709 fi; fi
3710 fi; fi
3711 ],
3712 [with_libupsclient="use_pkgconfig"])
3714 # configure using libupsclient-config
3715 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3716 then
3717 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3718 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3719 if test $? -ne 0
3720 then
3721 with_libupsclient="no ($with_libupsclient_config failed)"
3722 fi
3723 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3724 if test $? -ne 0
3725 then
3726 with_libupsclient="no ($with_libupsclient_config failed)"
3727 fi
3728 fi
3729 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3730 then
3731 with_libupsclient="yes"
3732 fi
3734 # configure using pkg-config
3735 if test "x$with_libupsclient" = "xuse_pkgconfig"
3736 then
3737 if test "x$PKG_CONFIG" = "x"
3738 then
3739 with_libupsclient="no (Don't have pkg-config)"
3740 fi
3741 fi
3742 if test "x$with_libupsclient" = "xuse_pkgconfig"
3743 then
3744 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3745 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3746 if test $? -ne 0
3747 then
3748 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3749 fi
3750 fi
3751 if test "x$with_libupsclient" = "xuse_pkgconfig"
3752 then
3753 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3754 if test $? -ne 0
3755 then
3756 with_libupsclient="no ($PKG_CONFIG failed)"
3757 fi
3758 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3759 if test $? -ne 0
3760 then
3761 with_libupsclient="no ($PKG_CONFIG failed)"
3762 fi
3763 fi
3764 if test "x$with_libupsclient" = "xuse_pkgconfig"
3765 then
3766 with_libupsclient="yes"
3767 fi
3769 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3770 # the actual checks.
3771 if test "x$with_libupsclient" = "xyes"
3772 then
3773 SAVE_CPPFLAGS="$CPPFLAGS"
3774 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3776 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3778 CPPFLAGS="$SAVE_CPPFLAGS"
3779 fi
3780 if test "x$with_libupsclient" = "xyes"
3781 then
3782 SAVE_CPPFLAGS="$CPPFLAGS"
3783 SAVE_LDFLAGS="$LDFLAGS"
3785 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3786 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3788 AC_CHECK_LIB(upsclient, upscli_connect,
3789 [with_libupsclient="yes"],
3790 [with_libupsclient="no (symbol upscli_connect not found)"])
3792 CPPFLAGS="$SAVE_CPPFLAGS"
3793 LDFLAGS="$SAVE_LDFLAGS"
3794 fi
3795 if test "x$with_libupsclient" = "xyes"
3796 then
3797 SAVE_CPPFLAGS="$CPPFLAGS"
3798 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3800 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3801 [#include <stdlib.h>
3802 #include <stdio.h>
3803 #include <upsclient.h>])
3805 CPPFLAGS="$SAVE_CPPFLAGS"
3806 fi
3807 if test "x$with_libupsclient" = "xyes"
3808 then
3809 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3810 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3811 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3812 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3813 fi
3814 # }}}
3816 # --with-libxmms {{{
3817 with_xmms_config="xmms-config"
3818 with_xmms_cflags=""
3819 with_xmms_libs=""
3820 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3821 [
3822 if test "x$withval" != "xno" \
3823 && test "x$withval" != "xyes"
3824 then
3825 if test -f "$withval" && test -x "$withval";
3826 then
3827 with_xmms_config="$withval"
3828 else if test -x "$withval/bin/xmms-config"
3829 then
3830 with_xmms_config="$withval/bin/xmms-config"
3831 fi; fi
3832 with_libxmms="yes"
3833 else if test "x$withval" = "xno"
3834 then
3835 with_libxmms="no"
3836 else
3837 with_libxmms="yes"
3838 fi; fi
3839 ],
3840 [
3841 with_libxmms="yes"
3842 ])
3843 if test "x$with_libxmms" = "xyes"
3844 then
3845 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3846 xmms_config_status=$?
3848 if test $xmms_config_status -ne 0
3849 then
3850 with_libxmms="no"
3851 fi
3852 fi
3853 if test "x$with_libxmms" = "xyes"
3854 then
3855 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3856 xmms_config_status=$?
3858 if test $xmms_config_status -ne 0
3859 then
3860 with_libxmms="no"
3861 fi
3862 fi
3863 if test "x$with_libxmms" = "xyes"
3864 then
3865 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3866 [
3867 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3868 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3869 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3870 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3871 ],
3872 [
3873 with_libxmms="no"
3874 ],
3875 [$with_xmms_libs])
3876 fi
3877 with_libxmms_numeric=0
3878 if test "x$with_libxmms" = "xyes"
3879 then
3880 with_libxmms_numeric=1
3881 fi
3882 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3883 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3884 # }}}
3886 # --with-libyajl {{{
3887 with_libyajl_cppflags=""
3888 with_libyajl_ldflags=""
3889 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3890 [
3891 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3892 then
3893 with_libyajl_cppflags="-I$withval/include"
3894 with_libyajl_ldflags="-L$withval/lib"
3895 with_libyajl="yes"
3896 else
3897 with_libyajl="$withval"
3898 fi
3899 ],
3900 [
3901 with_libyajl="yes"
3902 ])
3903 if test "x$with_libyajl" = "xyes"
3904 then
3905 SAVE_CPPFLAGS="$CPPFLAGS"
3906 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3908 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3909 AC_CHECK_HEADERS(yajl/yajl_version.h)
3911 CPPFLAGS="$SAVE_CPPFLAGS"
3912 fi
3913 if test "x$with_libyajl" = "xyes"
3914 then
3915 SAVE_CPPFLAGS="$CPPFLAGS"
3916 SAVE_LDFLAGS="$LDFLAGS"
3917 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3918 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3920 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3922 CPPFLAGS="$SAVE_CPPFLAGS"
3923 LDFLAGS="$SAVE_LDFLAGS"
3924 fi
3925 if test "x$with_libyajl" = "xyes"
3926 then
3927 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3928 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3929 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3930 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3931 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3932 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3933 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3934 fi
3935 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3936 # }}}
3938 # --with-libvarnish {{{
3939 with_libvarnish_cppflags=""
3940 with_libvarnish_cflags=""
3941 with_libvarnish_libs=""
3942 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
3943 [
3944 if test "x$withval" = "xno"
3945 then
3946 with_libvarnish="no"
3947 else if test "x$withval" = "xyes"
3948 then
3949 with_libvarnish="use_pkgconfig"
3950 else if test -d "$with_libvarnish/lib"
3951 then
3952 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
3953 with_libvarnish_cflags="-I$withval/include"
3954 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
3955 with_libvarnish="yes"
3956 fi; fi; fi
3957 ],
3958 [with_libvarnish="use_pkgconfig"])
3960 # configure using pkg-config
3961 if test "x$with_libvarnish" = "xuse_pkgconfig"
3962 then
3963 if test "x$PKG_CONFIG" = "x"
3964 then
3965 with_libvarnish="no (Don't have pkg-config)"
3966 fi
3967 fi
3968 if test "x$with_libvarnish" = "xuse_pkgconfig"
3969 then
3970 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
3971 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
3972 if test $? -ne 0
3973 then
3974 with_libvarnish="no (pkg-config doesn't know varnishapi)"
3975 fi
3976 fi
3977 if test "x$with_libvarnish" = "xuse_pkgconfig"
3978 then
3979 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
3980 if test $? -ne 0
3981 then
3982 with_libvarnish="no ($PKG_CONFIG failed)"
3983 fi
3984 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
3985 if test $? -ne 0
3986 then
3987 with_libvarnish="no ($PKG_CONFIG failed)"
3988 fi
3989 fi
3990 if test "x$with_libvarnish" = "xuse_pkgconfig"
3991 then
3992 with_libvarnish="yes"
3993 fi
3995 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
3996 # the actual checks.
3997 if test "x$with_libvarnish" = "xyes"
3998 then
3999 SAVE_CPPFLAGS="$CPPFLAGS"
4000 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4001 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4003 CPPFLAGS="$SAVE_CPPFLAGS"
4004 fi
4005 if test "x$with_libvarnish" = "xyes"
4006 then
4007 SAVE_CPPFLAGS="$CPPFLAGS"
4008 #SAVE_LDFLAGS="$LDFLAGS"
4010 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4011 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4013 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
4014 [with_libvarnish="yes"],
4015 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
4016 [$with_libvarnish_libs])
4018 CPPFLAGS="$SAVE_CPPFLAGS"
4019 #LDFLAGS="$SAVE_LDFLAGS"
4020 fi
4021 if test "x$with_libvarnish" = "xyes"
4022 then
4023 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4024 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4025 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4026 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4027 fi
4028 # }}}
4030 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4031 with_libxml2="no (pkg-config isn't available)"
4032 with_libxml2_cflags=""
4033 with_libxml2_ldflags=""
4034 with_libvirt="no (pkg-config isn't available)"
4035 with_libvirt_cflags=""
4036 with_libvirt_ldflags=""
4037 if test "x$PKG_CONFIG" != "x"
4038 then
4039 pkg-config --exists 'libxml-2.0' 2>/dev/null
4040 if test "$?" = "0"
4041 then
4042 with_libxml2="yes"
4043 else
4044 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4045 fi
4047 pkg-config --exists libvirt 2>/dev/null
4048 if test "$?" = "0"
4049 then
4050 with_libvirt="yes"
4051 else
4052 with_libvirt="no (pkg-config doesn't know libvirt)"
4053 fi
4054 fi
4055 if test "x$with_libxml2" = "xyes"
4056 then
4057 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4058 if test $? -ne 0
4059 then
4060 with_libxml2="no"
4061 fi
4062 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4063 if test $? -ne 0
4064 then
4065 with_libxml2="no"
4066 fi
4067 fi
4068 if test "x$with_libxml2" = "xyes"
4069 then
4070 SAVE_CPPFLAGS="$CPPFLAGS"
4071 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4073 AC_CHECK_HEADERS(libxml/parser.h, [],
4074 [with_libxml2="no (libxml/parser.h not found)"])
4076 CPPFLAGS="$SAVE_CPPFLAGS"
4077 fi
4078 if test "x$with_libxml2" = "xyes"
4079 then
4080 SAVE_CFLAGS="$CFLAGS"
4081 SAVE_LDFLAGS="$LDFLAGS"
4083 CFLAGS="$CFLAGS $with_libxml2_cflags"
4084 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4086 AC_CHECK_LIB(xml2, xmlXPathEval,
4087 [with_libxml2="yes"],
4088 [with_libxml2="no (symbol xmlXPathEval not found)"])
4090 CFLAGS="$SAVE_CFLAGS"
4091 LDFLAGS="$SAVE_LDFLAGS"
4092 fi
4093 dnl Add the right compiler flags and libraries.
4094 if test "x$with_libxml2" = "xyes"; then
4095 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4096 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4097 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4098 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4099 fi
4100 if test "x$with_libvirt" = "xyes"
4101 then
4102 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4103 if test $? -ne 0
4104 then
4105 with_libvirt="no"
4106 fi
4107 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4108 if test $? -ne 0
4109 then
4110 with_libvirt="no"
4111 fi
4112 fi
4113 if test "x$with_libvirt" = "xyes"
4114 then
4115 SAVE_CPPFLAGS="$CPPFLAGS"
4116 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4118 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4119 [with_libvirt="no (libvirt/libvirt.h not found)"])
4121 CPPFLAGS="$SAVE_CPPFLAGS"
4122 fi
4123 if test "x$with_libvirt" = "xyes"
4124 then
4125 SAVE_CFLAGS="$CFLAGS"
4126 SAVE_LDFLAGS="$LDFLAGS"
4128 CFLAGS="$CFLAGS $with_libvirt_cflags"
4129 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4131 AC_CHECK_LIB(virt, virDomainBlockStats,
4132 [with_libvirt="yes"],
4133 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4135 CFLAGS="$SAVE_CFLAGS"
4136 LDFLAGS="$SAVE_LDFLAGS"
4137 fi
4138 dnl Add the right compiler flags and libraries.
4139 if test "x$with_libvirt" = "xyes"; then
4140 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4141 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4142 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4143 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4144 fi
4145 # }}}
4147 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4148 with_libopenipmipthread="yes"
4149 with_libopenipmipthread_cflags=""
4150 with_libopenipmipthread_libs=""
4152 AC_MSG_CHECKING([for pkg-config])
4153 temp_result="no"
4154 if test "x$PKG_CONFIG" = "x"
4155 then
4156 with_libopenipmipthread="no"
4157 temp_result="no"
4158 else
4159 temp_result="$PKG_CONFIG"
4160 fi
4161 AC_MSG_RESULT([$temp_result])
4163 if test "x$with_libopenipmipthread" = "xyes"
4164 then
4165 AC_MSG_CHECKING([for libOpenIPMIpthread])
4166 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4167 if test "$?" != "0"
4168 then
4169 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4170 fi
4171 AC_MSG_RESULT([$with_libopenipmipthread])
4172 fi
4174 if test "x$with_libopenipmipthread" = "xyes"
4175 then
4176 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4177 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4178 if test "$?" = "0"
4179 then
4180 with_libopenipmipthread_cflags="$temp_result"
4181 else
4182 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4183 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4184 fi
4185 AC_MSG_RESULT([$temp_result])
4186 fi
4188 if test "x$with_libopenipmipthread" = "xyes"
4189 then
4190 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4191 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4192 if test "$?" = "0"
4193 then
4194 with_libopenipmipthread_ldflags="$temp_result"
4195 else
4196 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4197 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4198 fi
4199 AC_MSG_RESULT([$temp_result])
4200 fi
4202 if test "x$with_libopenipmipthread" = "xyes"
4203 then
4204 SAVE_CPPFLAGS="$CPPFLAGS"
4205 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4207 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4208 [with_libopenipmipthread="yes"],
4209 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4210 [#include <OpenIPMI/ipmiif.h>
4211 #include <OpenIPMI/ipmi_err.h>
4212 #include <OpenIPMI/ipmi_posix.h>
4213 #include <OpenIPMI/ipmi_conn.h>
4214 ])
4216 CPPFLAGS="$SAVE_CPPFLAGS"
4217 fi
4219 if test "x$with_libopenipmipthread" = "xyes"
4220 then
4221 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4222 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4223 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4224 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4225 fi
4226 # }}}
4228 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4229 [with_libnotify="yes"],
4230 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4231 with_libnotify="no"
4232 else
4233 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4234 fi])
4236 # Check for enabled/disabled features
4237 #
4239 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4240 # ------------------------------------------------------------
4241 dnl
4242 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4243 dnl
4244 AC_DEFUN(
4245 [AC_COLLECTD],
4246 [
4247 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4248 m4_if(
4249 [$2],
4250 [enable],
4251 [dnl
4252 m4_define([EnDis],[disabled])dnl
4253 m4_define([YesNo],[no])dnl
4254 ],dnl
4255 [m4_if(
4256 [$2],
4257 [disable],
4258 [dnl
4259 m4_define([EnDis],[enabled])dnl
4260 m4_define([YesNo],[yes])dnl
4261 ],
4262 [dnl
4263 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4264 ]dnl
4265 )]dnl
4266 )dnl
4267 m4_if([$3], [feature], [],
4268 [m4_if(
4269 [$3], [module], [],
4270 [dnl
4271 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4272 ]dnl
4273 )]dnl
4274 )dnl
4275 AC_ARG_ENABLE(
4276 [$1],
4277 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4278 [],
4279 enable_$1='[YesNo]'dnl
4280 )# AC_ARG_ENABLE
4281 if test "x$enable_$1" = "xno"
4282 then
4283 collectd_$1=0
4284 else
4285 if test "x$enable_$1" = "xyes"
4286 then
4287 collectd_$1=1
4288 else
4289 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4290 collectd_$1=1
4291 enable_$1='yes'
4292 fi
4293 fi
4294 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4295 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4296 ]dnl
4297 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4299 # AC_PLUGIN(name, default, info)
4300 # ------------------------------------------------------------
4301 dnl
4302 AC_DEFUN(
4303 [AC_PLUGIN],
4304 [
4305 enable_plugin="no"
4306 force="no"
4307 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4308 [
4309 if test "x$enableval" = "xyes"
4310 then
4311 enable_plugin="yes"
4312 else if test "x$enableval" = "xforce"
4313 then
4314 enable_plugin="yes"
4315 force="yes"
4316 else
4317 enable_plugin="no (disabled on command line)"
4318 fi; fi
4319 ],
4320 [
4321 if test "x$enable_all_plugins" = "xauto"
4322 then
4323 if test "x$2" = "xyes"
4324 then
4325 enable_plugin="yes"
4326 else
4327 enable_plugin="no"
4328 fi
4329 else
4330 enable_plugin="$enable_all_plugins"
4331 fi
4332 ])
4333 if test "x$enable_plugin" = "xyes"
4334 then
4335 if test "x$2" = "xyes" || test "x$force" = "xyes"
4336 then
4337 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4338 if test "x$2" != "xyes"
4339 then
4340 dependency_warning="yes"
4341 fi
4342 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4343 dependency_error="yes"
4344 enable_plugin="no (dependency error)"
4345 fi
4346 fi
4347 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4348 enable_$1="$enable_plugin"
4349 ]
4350 )# AC_PLUGIN(name, default, info)
4352 m4_divert_once([HELP_ENABLE], [
4353 collectd features:])
4354 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4355 AC_COLLECTD([debug], [enable], [feature], [debugging])
4356 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4357 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4359 dependency_warning="no"
4360 dependency_error="no"
4362 plugin_ascent="no"
4363 plugin_battery="no"
4364 plugin_bind="no"
4365 plugin_conntrack="no"
4366 plugin_contextswitch="no"
4367 plugin_cpu="no"
4368 plugin_cpufreq="no"
4369 plugin_curl_json="no"
4370 plugin_curl_xml="no"
4371 plugin_df="no"
4372 plugin_disk="no"
4373 plugin_entropy="no"
4374 plugin_interface="no"
4375 plugin_ipmi="no"
4376 plugin_ipvs="no"
4377 plugin_irq="no"
4378 plugin_libvirt="no"
4379 plugin_load="no"
4380 plugin_memory="no"
4381 plugin_multimeter="no"
4382 plugin_nfs="no"
4383 plugin_fscache="no"
4384 plugin_perl="no"
4385 plugin_processes="no"
4386 plugin_protocols="no"
4387 plugin_serial="no"
4388 plugin_swap="no"
4389 plugin_tape="no"
4390 plugin_tcpconns="no"
4391 plugin_ted="no"
4392 plugin_thermal="no"
4393 plugin_users="no"
4394 plugin_uptime="no"
4395 plugin_vmem="no"
4396 plugin_vserver="no"
4397 plugin_wireless="no"
4398 plugin_zfs_arc="no"
4400 # Linux
4401 if test "x$ac_system" = "xLinux"
4402 then
4403 plugin_battery="yes"
4404 plugin_conntrack="yes"
4405 plugin_contextswitch="yes"
4406 plugin_cpu="yes"
4407 plugin_cpufreq="yes"
4408 plugin_disk="yes"
4409 plugin_entropy="yes"
4410 plugin_interface="yes"
4411 plugin_irq="yes"
4412 plugin_load="yes"
4413 plugin_memory="yes"
4414 plugin_nfs="yes"
4415 plugin_fscache="yes"
4416 plugin_processes="yes"
4417 plugin_protocols="yes"
4418 plugin_serial="yes"
4419 plugin_swap="yes"
4420 plugin_tcpconns="yes"
4421 plugin_thermal="yes"
4422 plugin_uptime="yes"
4423 plugin_vmem="yes"
4424 plugin_vserver="yes"
4425 plugin_wireless="yes"
4427 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4428 then
4429 plugin_ipvs="yes"
4430 fi
4431 fi
4433 if test "x$ac_system" = "xOpenBSD"
4434 then
4435 plugin_tcpconns="yes"
4436 fi
4438 # Mac OS X devices
4439 if test "x$with_libiokit" = "xyes"
4440 then
4441 plugin_battery="yes"
4442 plugin_disk="yes"
4443 fi
4445 # AIX
4446 if test "x$with_perfstat" = "xyes"
4447 then
4448 plugin_cpu="yes"
4449 plugin_disk="yes"
4450 plugin_memory="yes"
4451 plugin_swap="yes"
4452 plugin_interface="yes"
4453 plugin_load="yes"
4454 fi
4456 if test "x$with_procinfo" = "xyes"
4457 then
4458 plugin_processes="yes"
4459 fi
4461 # Solaris
4462 if test "x$with_kstat" = "xyes"
4463 then
4464 plugin_uptime="yes"
4465 plugin_zfs_arc="yes"
4466 fi
4468 if test "x$with_devinfo$with_kstat" = "xyesyes"
4469 then
4470 plugin_cpu="yes"
4471 plugin_disk="yes"
4472 plugin_interface="yes"
4473 plugin_memory="yes"
4474 plugin_tape="yes"
4475 fi
4477 # libstatgrab
4478 if test "x$with_libstatgrab" = "xyes"
4479 then
4480 plugin_cpu="yes"
4481 plugin_disk="yes"
4482 plugin_interface="yes"
4483 plugin_load="yes"
4484 plugin_memory="yes"
4485 plugin_swap="yes"
4486 plugin_users="yes"
4487 fi
4489 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4490 then
4491 plugin_ascent="yes"
4492 if test "x$have_strptime" = "xyes"
4493 then
4494 plugin_bind="yes"
4495 fi
4496 fi
4498 if test "x$with_libopenipmipthread" = "xyes"
4499 then
4500 plugin_ipmi="yes"
4501 fi
4503 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4504 then
4505 plugin_curl_json="yes"
4506 fi
4508 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4509 then
4510 plugin_curl_xml="yes"
4511 fi
4513 if test "x$have_processor_info" = "xyes"
4514 then
4515 plugin_cpu="yes"
4516 fi
4517 if test "x$have_sysctl" = "xyes"
4518 then
4519 plugin_cpu="yes"
4520 plugin_memory="yes"
4521 plugin_uptime="yes"
4522 if test "x$ac_system" = "xDarwin"
4523 then
4524 plugin_swap="yes"
4525 fi
4526 fi
4527 if test "x$have_sysctlbyname" = "xyes"
4528 then
4529 plugin_contextswitch="yes"
4530 plugin_cpu="yes"
4531 plugin_memory="yes"
4532 plugin_tcpconns="yes"
4533 fi
4535 # Df plugin: Check if we know how to determine mount points first.
4536 #if test "x$have_listmntent" = "xyes"; then
4537 # plugin_df="yes"
4538 #fi
4539 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4540 then
4541 plugin_df="yes"
4542 fi
4543 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4544 then
4545 plugin_df="yes"
4546 fi
4547 #if test "x$have_getmntent" = "xseq"
4548 #then
4549 # plugin_df="yes"
4550 #fi
4551 if test "x$c_cv_have_one_getmntent" = "xyes"
4552 then
4553 plugin_df="yes"
4554 fi
4556 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4557 if test "x$plugin_df" = "xyes"
4558 then
4559 plugin_df="no"
4560 if test "x$have_statfs" = "xyes"
4561 then
4562 plugin_df="yes"
4563 fi
4564 if test "x$have_statvfs" = "xyes"
4565 then
4566 plugin_df="yes"
4567 fi
4568 fi
4570 if test "x$have_getifaddrs" = "xyes"
4571 then
4572 plugin_interface="yes"
4573 fi
4575 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4576 then
4577 plugin_libvirt="yes"
4578 fi
4580 if test "x$have_getloadavg" = "xyes"
4581 then
4582 plugin_load="yes"
4583 fi
4585 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4586 then
4587 plugin_perl="yes"
4588 fi
4590 # Mac OS X memory interface
4591 if test "x$have_host_statistics" = "xyes"
4592 then
4593 plugin_memory="yes"
4594 fi
4596 if test "x$have_termios_h" = "xyes"
4597 then
4598 plugin_multimeter="yes"
4599 plugin_ted="yes"
4600 fi
4602 if test "x$have_thread_info" = "xyes"
4603 then
4604 plugin_processes="yes"
4605 fi
4607 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4608 then
4609 plugin_processes="yes"
4610 fi
4612 if test "x$with_kvm_getswapinfo" = "xyes"
4613 then
4614 plugin_swap="yes"
4615 fi
4617 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4618 then
4619 plugin_swap="yes"
4620 fi
4622 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4623 then
4624 plugin_tcpconns="yes"
4625 fi
4627 if test "x$have_getutent" = "xyes"
4628 then
4629 plugin_users="yes"
4630 fi
4631 if test "x$have_getutxent" = "xyes"
4632 then
4633 plugin_users="yes"
4634 fi
4636 m4_divert_once([HELP_ENABLE], [
4637 collectd plugins:])
4639 AC_ARG_ENABLE([all-plugins],
4640 AC_HELP_STRING([--enable-all-plugins],
4641 [enable all plugins (auto by def)]),
4642 [
4643 if test "x$enableval" = "xyes"
4644 then
4645 enable_all_plugins="yes"
4646 else if test "x$enableval" = "xauto"
4647 then
4648 enable_all_plugins="auto"
4649 else
4650 enable_all_plugins="no"
4651 fi; fi
4652 ],
4653 [enable_all_plugins="auto"])
4655 m4_divert_once([HELP_ENABLE], [])
4657 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4658 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4659 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4660 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4661 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4662 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4663 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4664 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4665 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4666 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4667 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4668 AC_PLUGIN([csv], [yes], [CSV output plugin])
4669 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4670 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4671 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4672 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4673 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4674 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4675 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4676 AC_PLUGIN([email], [yes], [EMail statistics])
4677 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4678 AC_PLUGIN([exec], [yes], [Execution of external programs])
4679 AC_PLUGIN([filecount], [yes], [Count files in directories])
4680 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4681 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4682 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4683 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4684 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4685 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4686 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4687 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4688 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4689 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4690 AC_PLUGIN([load], [$plugin_load], [System load])
4691 AC_PLUGIN([logfile], [yes], [File logging plugin])
4692 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4693 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4694 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4695 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4696 AC_PLUGIN([match_regex], [yes], [The regex match])
4697 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4698 AC_PLUGIN([match_value], [yes], [The value match])
4699 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4700 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4701 AC_PLUGIN([memcached], [yes], [memcached statistics])
4702 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4703 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4704 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4705 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4706 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4707 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4708 AC_PLUGIN([network], [yes], [Network communication plugin])
4709 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4710 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4711 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4712 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4713 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4714 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4715 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4716 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4717 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4718 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4719 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4720 # FIXME: Check for libevent, too.
4721 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4722 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4723 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4724 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4725 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4726 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4727 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4728 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4729 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4730 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4731 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4732 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4733 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4734 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4735 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4736 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4737 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4738 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4739 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4740 AC_PLUGIN([target_notification], [yes], [The notification target])
4741 AC_PLUGIN([target_replace], [yes], [The replace target])
4742 AC_PLUGIN([target_scale],[yes], [The scale target])
4743 AC_PLUGIN([target_set], [yes], [The set target])
4744 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4745 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4746 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4747 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4748 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4749 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4750 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4751 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4752 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4753 AC_PLUGIN([users], [$plugin_users], [User statistics])
4754 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4755 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4756 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4757 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4758 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4759 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4760 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4761 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4762 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4764 dnl Default configuration file
4765 # Load either syslog or logfile
4766 LOAD_PLUGIN_SYSLOG=""
4767 LOAD_PLUGIN_LOGFILE=""
4769 AC_MSG_CHECKING([which default log plugin to load])
4770 default_log_plugin="none"
4771 if test "x$enable_syslog" = "xyes"
4772 then
4773 default_log_plugin="syslog"
4774 else
4775 LOAD_PLUGIN_SYSLOG="##"
4776 fi
4778 if test "x$enable_logfile" = "xyes"
4779 then
4780 if test "x$default_log_plugin" = "xnone"
4781 then
4782 default_log_plugin="logfile"
4783 else
4784 LOAD_PLUGIN_LOGFILE="#"
4785 fi
4786 else
4787 LOAD_PLUGIN_LOGFILE="##"
4788 fi
4789 AC_MSG_RESULT([$default_log_plugin])
4791 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4792 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4794 DEFAULT_LOG_LEVEL="info"
4795 if test "x$enable_debug" = "xyes"
4796 then
4797 DEFAULT_LOG_LEVEL="debug"
4798 fi
4799 AC_SUBST(DEFAULT_LOG_LEVEL)
4801 # Load only one of rrdtool, network, csv in the default config.
4802 LOAD_PLUGIN_RRDTOOL=""
4803 LOAD_PLUGIN_NETWORK=""
4804 LOAD_PLUGIN_CSV=""
4806 AC_MSG_CHECKING([which default write plugin to load])
4807 default_write_plugin="none"
4808 if test "x$enable_rrdtool" = "xyes"
4809 then
4810 default_write_plugin="rrdtool"
4811 else
4812 LOAD_PLUGIN_RRDTOOL="##"
4813 fi
4815 if test "x$enable_network" = "xyes"
4816 then
4817 if test "x$default_write_plugin" = "xnone"
4818 then
4819 default_write_plugin="network"
4820 else
4821 LOAD_PLUGIN_NETWORK="#"
4822 fi
4823 else
4824 LOAD_PLUGIN_NETWORK="##"
4825 fi
4827 if test "x$enable_csv" = "xyes"
4828 then
4829 if test "x$default_write_plugin" = "xnone"
4830 then
4831 default_write_plugin="csv"
4832 else
4833 LOAD_PLUGIN_CSV="#"
4834 fi
4835 else
4836 LOAD_PLUGIN_CSV="##"
4837 fi
4838 AC_MSG_RESULT([$default_write_plugin])
4840 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4841 AC_SUBST(LOAD_PLUGIN_NETWORK)
4842 AC_SUBST(LOAD_PLUGIN_CSV)
4844 dnl ip_vs.h
4845 if test "x$ac_system" = "xLinux" \
4846 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4847 then
4848 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4849 fi
4851 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4852 then
4853 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4854 fi
4856 dnl Perl bindings
4857 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4858 [
4859 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4860 then
4861 PERL_BINDINGS_OPTIONS="$withval"
4862 with_perl_bindings="yes"
4863 else
4864 PERL_BINDINGS_OPTIONS=""
4865 with_perl_bindings="$withval"
4866 fi
4867 ],
4868 [
4869 PERL_BINDINGS_OPTIONS=""
4870 if test -n "$perl_interpreter"
4871 then
4872 with_perl_bindings="yes"
4873 else
4874 with_perl_bindings="no (no perl interpreter found)"
4875 fi
4876 ])
4877 if test "x$with_perl_bindings" = "xyes"
4878 then
4879 PERL_BINDINGS="perl"
4880 else
4881 PERL_BINDINGS=""
4882 fi
4883 AC_SUBST(PERL_BINDINGS)
4884 AC_SUBST(PERL_BINDINGS_OPTIONS)
4886 dnl libcollectdclient
4887 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4888 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4889 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4891 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4893 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4895 AC_SUBST(LCC_VERSION_MAJOR)
4896 AC_SUBST(LCC_VERSION_MINOR)
4897 AC_SUBST(LCC_VERSION_PATCH)
4898 AC_SUBST(LCC_VERSION_EXTRA)
4899 AC_SUBST(LCC_VERSION_STRING)
4901 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4903 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4905 if test "x$with_librrd" = "xyes" \
4906 && test "x$librrd_threadsafe" != "xyes"
4907 then
4908 with_librrd="yes (warning: librrd is not thread-safe)"
4909 fi
4911 if test "x$with_libperl" = "xyes"
4912 then
4913 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4914 else
4915 enable_perl="no (needs libperl)"
4916 fi
4918 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4919 then
4920 enable_perl="no (libperl doesn't support ithreads)"
4921 fi
4923 if test "x$with_perl_bindings" = "xyes" \
4924 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4925 then
4926 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4927 fi
4929 cat <<EOF;
4931 Configuration:
4932 Libraries:
4933 libcurl . . . . . . . $with_libcurl
4934 libdbi . . . . . . . $with_libdbi
4935 libcredis . . . . . . $with_libcredis
4936 libesmtp . . . . . . $with_libesmtp
4937 libganglia . . . . . $with_libganglia
4938 libgcrypt . . . . . . $with_libgcrypt
4939 libiokit . . . . . . $with_libiokit
4940 libiptc . . . . . . . $with_libiptc
4941 libjvm . . . . . . . $with_java
4942 libkstat . . . . . . $with_kstat
4943 libkvm . . . . . . . $with_libkvm
4944 libmemcached . . . . $with_libmemcached
4945 libmodbus . . . . . . $with_libmodbus
4946 libmysql . . . . . . $with_libmysql
4947 libnetapp . . . . . . $with_libnetapp
4948 libnetlink . . . . . $with_libnetlink
4949 libnetsnmp . . . . . $with_libnetsnmp
4950 libnotify . . . . . . $with_libnotify
4951 liboconfig . . . . . $with_liboconfig
4952 libopenipmi . . . . . $with_libopenipmipthread
4953 liboping . . . . . . $with_liboping
4954 libpcap . . . . . . . $with_libpcap
4955 libperfstat . . . . . $with_perfstat
4956 libperl . . . . . . . $with_libperl
4957 libpq . . . . . . . . $with_libpq
4958 libpthread . . . . . $with_libpthread
4959 librabbitmq . . . . . $with_librabbitmq
4960 librouteros . . . . . $with_librouteros
4961 librrd . . . . . . . $with_librrd
4962 libsensors . . . . . $with_libsensors
4963 libstatgrab . . . . . $with_libstatgrab
4964 libtokyotyrant . . . $with_libtokyotyrant
4965 libupsclient . . . . $with_libupsclient
4966 libvarnish . . . . . $with_libvarnish
4967 libvirt . . . . . . . $with_libvirt
4968 libxml2 . . . . . . . $with_libxml2
4969 libxmms . . . . . . . $with_libxmms
4970 libyajl . . . . . . . $with_libyajl
4971 libevent . . . . . . $with_libevent
4972 protobuf-c . . . . . $have_protoc_c
4973 oracle . . . . . . . $with_oracle
4974 python . . . . . . . $with_python
4976 Features:
4977 daemon mode . . . . . $enable_daemon
4978 debug . . . . . . . . $enable_debug
4980 Bindings:
4981 perl . . . . . . . . $with_perl_bindings
4983 Modules:
4984 amqp . . . . . . . $enable_amqp
4985 apache . . . . . . . $enable_apache
4986 apcups . . . . . . . $enable_apcups
4987 apple_sensors . . . . $enable_apple_sensors
4988 ascent . . . . . . . $enable_ascent
4989 battery . . . . . . . $enable_battery
4990 bind . . . . . . . . $enable_bind
4991 conntrack . . . . . . $enable_conntrack
4992 contextswitch . . . . $enable_contextswitch
4993 cpu . . . . . . . . . $enable_cpu
4994 cpufreq . . . . . . . $enable_cpufreq
4995 csv . . . . . . . . . $enable_csv
4996 curl . . . . . . . . $enable_curl
4997 curl_json . . . . . . $enable_curl_json
4998 curl_xml . . . . . . $enable_curl_xml
4999 dbi . . . . . . . . . $enable_dbi
5000 df . . . . . . . . . $enable_df
5001 disk . . . . . . . . $enable_disk
5002 dns . . . . . . . . . $enable_dns
5003 email . . . . . . . . $enable_email
5004 entropy . . . . . . . $enable_entropy
5005 exec . . . . . . . . $enable_exec
5006 filecount . . . . . . $enable_filecount
5007 fscache . . . . . . . $enable_fscache
5008 gmond . . . . . . . . $enable_gmond
5009 hddtemp . . . . . . . $enable_hddtemp
5010 interface . . . . . . $enable_interface
5011 ipmi . . . . . . . . $enable_ipmi
5012 iptables . . . . . . $enable_iptables
5013 ipvs . . . . . . . . $enable_ipvs
5014 irq . . . . . . . . . $enable_irq
5015 java . . . . . . . . $enable_java
5016 libvirt . . . . . . . $enable_libvirt
5017 load . . . . . . . . $enable_load
5018 logfile . . . . . . . $enable_logfile
5019 lpar... . . . . . . . $enable_lpar
5020 madwifi . . . . . . . $enable_madwifi
5021 match_empty_counter . $enable_match_empty_counter
5022 match_hashed . . . . $enable_match_hashed
5023 match_regex . . . . . $enable_match_regex
5024 match_timediff . . . $enable_match_timediff
5025 match_value . . . . . $enable_match_value
5026 mbmon . . . . . . . . $enable_mbmon
5027 memcachec . . . . . . $enable_memcachec
5028 memcached . . . . . . $enable_memcached
5029 memory . . . . . . . $enable_memory
5030 modbus . . . . . . . $enable_modbus
5031 multimeter . . . . . $enable_multimeter
5032 mysql . . . . . . . . $enable_mysql
5033 netapp . . . . . . . $enable_netapp
5034 netlink . . . . . . . $enable_netlink
5035 network . . . . . . . $enable_network
5036 nfs . . . . . . . . . $enable_nfs
5037 nginx . . . . . . . . $enable_nginx
5038 notify_desktop . . . $enable_notify_desktop
5039 notify_email . . . . $enable_notify_email
5040 ntpd . . . . . . . . $enable_ntpd
5041 nut . . . . . . . . . $enable_nut
5042 olsrd . . . . . . . . $enable_olsrd
5043 onewire . . . . . . . $enable_onewire
5044 openvpn . . . . . . . $enable_openvpn
5045 oracle . . . . . . . $enable_oracle
5046 perl . . . . . . . . $enable_perl
5047 pinba . . . . . . . . $enable_pinba
5048 ping . . . . . . . . $enable_ping
5049 postgresql . . . . . $enable_postgresql
5050 powerdns . . . . . . $enable_powerdns
5051 processes . . . . . . $enable_processes
5052 protocols . . . . . . $enable_protocols
5053 python . . . . . . . $enable_python
5054 redis . . . . . . . . $enable_redis
5055 routeros . . . . . . $enable_routeros
5056 rrdcached . . . . . . $enable_rrdcached
5057 rrdtool . . . . . . . $enable_rrdtool
5058 sensors . . . . . . . $enable_sensors
5059 serial . . . . . . . $enable_serial
5060 snmp . . . . . . . . $enable_snmp
5061 swap . . . . . . . . $enable_swap
5062 syslog . . . . . . . $enable_syslog
5063 table . . . . . . . . $enable_table
5064 tail . . . . . . . . $enable_tail
5065 tape . . . . . . . . $enable_tape
5066 target_notification . $enable_target_notification
5067 target_replace . . . $enable_target_replace
5068 target_scale . . . . $enable_target_scale
5069 target_set . . . . . $enable_target_set
5070 target_v5upgrade . . $enable_target_v5upgrade
5071 tcpconns . . . . . . $enable_tcpconns
5072 teamspeak2 . . . . . $enable_teamspeak2
5073 ted . . . . . . . . . $enable_ted
5074 thermal . . . . . . . $enable_thermal
5075 threshold . . . . . . $enable_threshold
5076 tokyotyrant . . . . . $enable_tokyotyrant
5077 unixsock . . . . . . $enable_unixsock
5078 uptime . . . . . . . $enable_uptime
5079 users . . . . . . . . $enable_users
5080 uuid . . . . . . . . $enable_uuid
5081 varnish . . . . . . . $enable_varnish
5082 vmem . . . . . . . . $enable_vmem
5083 vserver . . . . . . . $enable_vserver
5084 wireless . . . . . . $enable_wireless
5085 write_http . . . . . $enable_write_http
5086 write_redis . . . . . $enable_write_redis
5087 xmms . . . . . . . . $enable_xmms
5088 zfs_arc . . . . . . . $enable_zfs_arc
5090 EOF
5092 if test "x$dependency_error" = "xyes"; then
5093 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5094 fi
5096 if test "x$dependency_warning" = "xyes"; then
5097 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5098 fi
5100 # vim: set fdm=marker :