Code

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