Code

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