Code

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