Code

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