Code

Merge pull request #36 from octo/mh/softraid
[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 ipvs module
407 have_linux_ip_vs_h="no"
408 have_net_ip_vs_h="no"
409 have_ip_vs_h="no"
410 ip_vs_h_needs_kernel_cflags="no"
411 if test "x$ac_system" = "xLinux"
412 then
413         AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
414         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
415         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
417         if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
418         then
419                 SAVE_CFLAGS="$CFLAGS"
420                 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
422                 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
424                 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
425                 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
426                 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
428                 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
429                 then
430                         ip_vs_h_needs_kernel_cflags="yes"
431                 fi
433                 CFLAGS="$SAVE_CFLAGS"
434         fi
435 fi
436 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
438 # For quota module
439 AC_CHECK_HEADERS(sys/ucred.h, [], [],
441 #if HAVE_SYS_TYPES_H
442 #  include <sys/types.h>
443 #endif
444 #if HAVE_SYS_PARAM_H
445 # include <sys/param.h>
446 #endif
447 ])
449 # For mount interface
450 AC_CHECK_HEADERS(sys/mount.h, [], [],
452 #if HAVE_SYS_TYPES_H
453 #  include <sys/types.h>
454 #endif
455 #if HAVE_SYS_PARAM_H
456 # include <sys/param.h>
457 #endif
458 ])
460 # For the email plugin
461 AC_CHECK_HEADERS(linux/un.h, [], [],
463 #if HAVE_SYS_SOCKET_H
464 #       include <sys/socket.h>
465 #endif
466 ])
468 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)
470 # For the dns plugin
471 AC_CHECK_HEADERS(arpa/nameser.h)
472 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
474 #if HAVE_ARPA_NAMESER_H
475 # include <arpa/nameser.h>
476 #endif
477 ])
479 AC_CHECK_HEADERS(net/if_arp.h, [], [],
480 [#if HAVE_SYS_SOCKET_H
481 # include <sys/socket.h>
482 #endif
483 ])
484 AC_CHECK_HEADERS(net/ppp_defs.h)
485 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
486 [#if HAVE_NET_PPP_DEFS_H
487 # include <net/ppp_defs.h>
488 #endif
489 ])
490 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
491 [#if HAVE_STDINT_H
492 # include <stdint.h>
493 #endif
494 #if HAVE_SYS_TYPES_H
495 # include <sys/types.h>
496 #endif
497 #if HAVE_SYS_SOCKET_H
498 # include <sys/socket.h>
499 #endif
500 #if HAVE_NET_IF_H
501 # include <net/if.h>
502 #endif
503 #if HAVE_NETINET_IN_H
504 # include <netinet/in.h>
505 #endif
506 ])
508 # For the multimeter plugin
509 have_termios_h="no"
510 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
513 # Checks for typedefs, structures, and compiler characteristics.
515 AC_C_CONST
516 AC_TYPE_PID_T
517 AC_TYPE_SIZE_T
518 AC_TYPE_UID_T
519 AC_HEADER_TIME
522 # Checks for library functions.
524 AC_PROG_GCC_TRADITIONAL
525 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
527 AC_FUNC_STRERROR_R
529 SAVE_CFLAGS="$CFLAGS"
530 # Emulate behavior of src/Makefile.am
531 if test "x$GCC" = "xyes"
532 then
533         CFLAGS="$CFLAGS -Wall -Werror"
534 fi
536 AC_CACHE_CHECK([for strtok_r],
537   [c_cv_have_strtok_r_default],
538   AC_LINK_IFELSE(
539     AC_LANG_PROGRAM(
540     [[[[
541 #include <stdlib.h>
542 #include <stdio.h>
543 #include <string.h>
544     ]]]],
545     [[[[
546       char buffer[] = "foo,bar,baz";
547       char *token;
548       char *dummy;
549       char *saveptr;
551       dummy = buffer;
552       saveptr = NULL;
553       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
554       {
555         dummy = NULL;
556         printf ("token = %s;\n", token);
557       }
558     ]]]]),
559     [c_cv_have_strtok_r_default="yes"],
560     [c_cv_have_strtok_r_default="no"]
561   )
564 if test "x$c_cv_have_strtok_r_default" = "xno"
565 then
566   CFLAGS="$CFLAGS -D_REENTRANT=1"
568   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
569     [c_cv_have_strtok_r_reentrant],
570     AC_LINK_IFELSE(
571       AC_LANG_PROGRAM(
572       [[[[
573 #include <stdlib.h>
574 #include <stdio.h>
575 #include <string.h>
576       ]]]],
577       [[[[
578         char buffer[] = "foo,bar,baz";
579         char *token;
580         char *dummy;
581         char *saveptr;
583         dummy = buffer;
584         saveptr = NULL;
585         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
586         {
587           dummy = NULL;
588           printf ("token = %s;\n", token);
589         }
590       ]]]]),
591       [c_cv_have_strtok_r_reentrant="yes"],
592       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
593     )
594   )
595 fi
597 CFLAGS="$SAVE_CFLAGS"
598 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
599 then
600         CFLAGS="$CFLAGS -D_REENTRANT=1"
601 fi
603 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
605 socket_needs_socket="no"
606 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
607 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
609 clock_gettime_needs_rt="no"
610 clock_gettime_needs_posix4="no"
611 have_clock_gettime="no"
612 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
613 if test "x$have_clock_gettime" = "xno"
614 then
615         AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
616                                          have_clock_gettime="yes"])
617 fi
618 if test "x$have_clock_gettime" = "xno"
619 then
620         AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
621                                              have_clock_gettime="yes"])
622 fi
623 if test "x$have_clock_gettime" = "xyes"
624 then
625         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
626 else
627         AC_MSG_WARN(cannot find clock_gettime)
628 fi
630 nanosleep_needs_rt="no"
631 nanosleep_needs_posix4="no"
632 AC_CHECK_FUNCS(nanosleep,
633     [],
634     AC_CHECK_LIB(rt, nanosleep,
635         [nanosleep_needs_rt="yes"],
636         AC_CHECK_LIB(posix4, nanosleep,
637             [nanosleep_needs_posix4="yes"],
638             AC_MSG_ERROR(cannot find nanosleep))))
640 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
641 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
643 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
644 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
645 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
646 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
647 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
648 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
649 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
650 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
651 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
652 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
653 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
654 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
656 # Check for strptime {{{
657 if test "x$GCC" = "xyes"
658 then
659         SAVE_CFLAGS="$CFLAGS"
660         CFLAGS="$CFLAGS -Wall -Wextra -Werror"
661 fi
663 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
664 if test "x$have_strptime" = "xyes"
665 then
666         AC_CACHE_CHECK([whether strptime is exported by default],
667                        [c_cv_have_strptime_default],
668                        AC_COMPILE_IFELSE(
669 AC_LANG_PROGRAM(
670 [[
671 AC_INCLUDES_DEFAULT
672 #include <time.h>
673 ]],
674 [[
675  struct tm stm;
676  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
677 ]]),
678                        [c_cv_have_strptime_default="yes"],
679                        [c_cv_have_strptime_default="no"]))
680 fi
681 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
682 then
683         AC_CACHE_CHECK([whether strptime needs standards mode],
684                        [c_cv_have_strptime_standards],
685                        AC_COMPILE_IFELSE(
686 AC_LANG_PROGRAM(
687 [[
688 #ifndef _ISOC99_SOURCE
689 # define _ISOC99_SOURCE 1
690 #endif
691 #ifndef _POSIX_C_SOURCE
692 # define _POSIX_C_SOURCE 200112L
693 #endif
694 #ifndef _XOPEN_SOURCE
695 # define _XOPEN_SOURCE 500
696 #endif
697 AC_INCLUDES_DEFAULT
698 #include <time.h>
699 ]],
700 [[
701  struct tm stm;
702  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
703 ]]),
704                        [c_cv_have_strptime_standards="yes"],
705                        [c_cv_have_strptime_standards="no"]))
707         if test "x$c_cv_have_strptime_standards" = "xyes"
708         then
709                 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
710         else
711                 have_strptime="no"
712         fi
713 fi
715 if test "x$GCC" = "xyes"
716 then
717         CFLAGS="$SAVE_CFLAGS"
718 fi
720 # }}} Check for strptime
722 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
723 if test "x$have_swapctl" = "xyes"; then
724         AC_CACHE_CHECK([whether swapctl takes two arguments],
725                 [c_cv_have_swapctl_two_args],
726                 AC_COMPILE_IFELSE(
727                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
728 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
729 #  undef _FILE_OFFSET_BITS
730 #  undef _LARGEFILE64_SOURCE
731 #endif
732 #include <sys/stat.h>
733 #include <sys/swap.h>]],
734                                 [[
735                                 int num = swapctl(0, NULL);
736                                 ]]
737                         ),
738                         [c_cv_have_swapctl_two_args="yes"],
739                         [c_cv_have_swapctl_two_args="no"]
740                 )
741         )
742         AC_CACHE_CHECK([whether swapctl takes three arguments],
743                 [c_cv_have_swapctl_three_args],
744                 AC_COMPILE_IFELSE(
745                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
746 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
747 #  undef _FILE_OFFSET_BITS
748 #  undef _LARGEFILE64_SOURCE
749 #endif
750 #include <sys/stat.h>
751 #include <sys/swap.h>]],
752                                 [[
753                                 int num = swapctl(0, NULL,0);
754                                 ]]
755                         ),
756                         [c_cv_have_swapctl_three_args="yes"],
757                         [c_cv_have_swapctl_three_args="no"]
758                 )
759         )
760 fi
761 # Check for different versions of `swapctl' here..
762 if test "x$have_swapctl" = "xyes"; then
763         if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
764                 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
765                           [Define if the function swapctl exists and takes two arguments.])
766         fi
767         if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
768                 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
769                           [Define if the function swapctl exists and takes three arguments.])
770         fi
771 fi
773 # Check for NAN
774 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
776  if test "x$withval" = "xno"; then
777          nan_type="none"
778  else if test "x$withval" = "xyes"; then
779          nan_type="zero"
780  else
781          nan_type="$withval"
782  fi; fi
783 ],
784 [nan_type="none"])
785 if test "x$nan_type" = "xnone"; then
786   AC_CACHE_CHECK([whether NAN is defined by default],
787     [c_cv_have_nan_default],
788     AC_COMPILE_IFELSE(
789       AC_LANG_PROGRAM(
790       [[
791 #include <stdlib.h>
792 #include <math.h>
793 static double foo = NAN;
794       ]],
795       [[
796        if (isnan (foo))
797         return 0;
798        else
799         return 1;
800       ]]),
801       [c_cv_have_nan_default="yes"],
802       [c_cv_have_nan_default="no"]
803     )
804   )
805   if test "x$c_cv_have_nan_default" = "xyes"
806   then
807     nan_type="default"
808   fi
809 fi
810 if test "x$nan_type" = "xnone"; then
811   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
812     [c_cv_have_nan_isoc],
813     AC_COMPILE_IFELSE(
814       AC_LANG_PROGRAM(
815       [[
816 #include <stdlib.h>
817 #define __USE_ISOC99 1
818 #include <math.h>
819 static double foo = NAN;
820       ]],
821       [[
822        if (isnan (foo))
823         return 0;
824        else
825         return 1;
826       ]]),
827       [c_cv_have_nan_isoc="yes"],
828       [c_cv_have_nan_isoc="no"]
829     )
830   )
831   if test "x$c_cv_have_nan_isoc" = "xyes"
832   then
833     nan_type="isoc99"
834   fi
835 fi
836 if test "x$nan_type" = "xnone"; then
837   SAVE_LDFLAGS=$LDFLAGS
838   LDFLAGS="$LDFLAGS -lm"
839   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
840     [c_cv_have_nan_zero],
841     AC_RUN_IFELSE(
842       AC_LANG_PROGRAM(
843       [[
844 #include <stdlib.h>
845 #include <math.h>
846 #ifdef NAN
847 # undef NAN
848 #endif
849 #define NAN (0.0 / 0.0)
850 #ifndef isnan
851 # define isnan(f) ((f) != (f))
852 #endif
853 static double foo = NAN;
854       ]],
855       [[
856        if (isnan (foo))
857         return 0;
858        else
859         return 1;
860       ]]),
861       [c_cv_have_nan_zero="yes"],
862       [c_cv_have_nan_zero="no"]
863     )
864   )
865   LDFLAGS=$SAVE_LDFLAGS
866   if test "x$c_cv_have_nan_zero" = "xyes"
867   then
868     nan_type="zero"
869   fi
870 fi
872 if test "x$nan_type" = "xdefault"; then
873   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
874     [Define if NAN is defined by default and can initialize static variables.])
875 else if test "x$nan_type" = "xisoc99"; then
876   AC_DEFINE(NAN_STATIC_ISOC, 1,
877     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
878 else if test "x$nan_type" = "xzero"; then
879   AC_DEFINE(NAN_ZERO_ZERO, 1,
880     [Define if NAN can be defined as (0.0 / 0.0)])
881 else
882   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
883 fi; fi; fi
885 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
887  if test "x$withval" = "xnothing"; then
888         fp_layout_type="nothing"
889  else if test "x$withval" = "xendianflip"; then
890         fp_layout_type="endianflip"
891  else if test "x$withval" = "xintswap"; then
892         fp_layout_type="intswap"
893  else
894         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
895 fi; fi; fi
896 ],
897 [fp_layout_type="unknown"])
899 if test "x$fp_layout_type" = "xunknown"; then
900   AC_CACHE_CHECK([if doubles are stored in x86 representation],
901     [c_cv_fp_layout_need_nothing],
902     AC_RUN_IFELSE(
903       AC_LANG_PROGRAM(
904       [[[[
905 #include <stdlib.h>
906 #include <stdio.h>
907 #include <string.h>
908 #if HAVE_STDINT_H
909 # include <stdint.h>
910 #endif
911 #if HAVE_INTTYPES_H
912 # include <inttypes.h>
913 #endif
914 #if HAVE_STDBOOL_H
915 # include <stdbool.h>
916 #endif
917       ]]]],
918       [[[[
919         uint64_t i0;
920         uint64_t i1;
921         uint8_t c[8];
922         double d;
924         d = 8.642135e130; 
925         memcpy ((void *) &i0, (void *) &d, 8);
927         i1 = i0;
928         memcpy ((void *) c, (void *) &i1, 8);
930         if ((c[0] == 0x2f) && (c[1] == 0x25)
931                         && (c[2] == 0xc0) && (c[3] == 0xc7)
932                         && (c[4] == 0x43) && (c[5] == 0x2b)
933                         && (c[6] == 0x1f) && (c[7] == 0x5b))
934                 return (0);
935         else
936                 return (1);
937       ]]]]),
938       [c_cv_fp_layout_need_nothing="yes"],
939       [c_cv_fp_layout_need_nothing="no"]
940     )
941   )
942   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
943     fp_layout_type="nothing"
944   fi
945 fi
946 if test "x$fp_layout_type" = "xunknown"; then
947   AC_CACHE_CHECK([if endianflip converts to x86 representation],
948     [c_cv_fp_layout_need_endianflip],
949     AC_RUN_IFELSE(
950       AC_LANG_PROGRAM(
951       [[[[
952 #include <stdlib.h>
953 #include <stdio.h>
954 #include <string.h>
955 #if HAVE_STDINT_H
956 # include <stdint.h>
957 #endif
958 #if HAVE_INTTYPES_H
959 # include <inttypes.h>
960 #endif
961 #if HAVE_STDBOOL_H
962 # include <stdbool.h>
963 #endif
964 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
965                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
966                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
967                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
968                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
969                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
970                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
971                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
972       ]]]],
973       [[[[
974         uint64_t i0;
975         uint64_t i1;
976         uint8_t c[8];
977         double d;
979         d = 8.642135e130; 
980         memcpy ((void *) &i0, (void *) &d, 8);
982         i1 = endianflip (i0);
983         memcpy ((void *) c, (void *) &i1, 8);
985         if ((c[0] == 0x2f) && (c[1] == 0x25)
986                         && (c[2] == 0xc0) && (c[3] == 0xc7)
987                         && (c[4] == 0x43) && (c[5] == 0x2b)
988                         && (c[6] == 0x1f) && (c[7] == 0x5b))
989                 return (0);
990         else
991                 return (1);
992       ]]]]),
993       [c_cv_fp_layout_need_endianflip="yes"],
994       [c_cv_fp_layout_need_endianflip="no"]
995     )
996   )
997   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
998     fp_layout_type="endianflip"
999   fi
1000 fi
1001 if test "x$fp_layout_type" = "xunknown"; then
1002   AC_CACHE_CHECK([if intswap converts to x86 representation],
1003     [c_cv_fp_layout_need_intswap],
1004     AC_RUN_IFELSE(
1005       AC_LANG_PROGRAM(
1006       [[[[
1007 #include <stdlib.h>
1008 #include <stdio.h>
1009 #include <string.h>
1010 #if HAVE_STDINT_H
1011 # include <stdint.h>
1012 #endif
1013 #if HAVE_INTTYPES_H
1014 # include <inttypes.h>
1015 #endif
1016 #if HAVE_STDBOOL_H
1017 # include <stdbool.h>
1018 #endif
1019 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1020                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1021       ]]]],
1022       [[[[
1023         uint64_t i0;
1024         uint64_t i1;
1025         uint8_t c[8];
1026         double d;
1028         d = 8.642135e130; 
1029         memcpy ((void *) &i0, (void *) &d, 8);
1031         i1 = intswap (i0);
1032         memcpy ((void *) c, (void *) &i1, 8);
1034         if ((c[0] == 0x2f) && (c[1] == 0x25)
1035                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1036                         && (c[4] == 0x43) && (c[5] == 0x2b)
1037                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1038                 return (0);
1039         else
1040                 return (1);
1041       ]]]]),
1042       [c_cv_fp_layout_need_intswap="yes"],
1043       [c_cv_fp_layout_need_intswap="no"]
1044     )
1045   )
1046   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1047     fp_layout_type="intswap"
1048   fi
1049 fi
1051 if test "x$fp_layout_type" = "xnothing"; then
1052   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1053   [Define if doubles are stored in x86 representation.])
1054 else if test "x$fp_layout_type" = "xendianflip"; then
1055   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1056   [Define if endianflip is needed to convert to x86 representation.])
1057 else if test "x$fp_layout_type" = "xintswap"; then
1058   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1059   [Define if intswap is needed to convert to x86 representation.])
1060 else
1061   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1062 fi; fi; fi
1064 have_getfsstat="no"
1065 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1066 have_getvfsstat="no"
1067 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1068 have_listmntent="no"
1069 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1071 have_getmntent="no"
1072 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1073 if test "x$have_getmntent" = "xno"; then
1074         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1075 fi
1076 if test "x$have_getmntent" = "xno"; then
1077         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1078 fi
1079 if test "x$have_getmntent" = "xno"; then
1080         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1081 fi
1083 if test "x$have_getmntent" = "xc"; then
1084         AC_CACHE_CHECK([whether getmntent takes one argument],
1085                 [c_cv_have_one_getmntent],
1086                 AC_COMPILE_IFELSE(
1087                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1088 #include "$srcdir/src/utils_mount.h"]],
1089                                 [[
1090                                  FILE *fh;
1091                                  struct mntent *me;
1092                                  fh = setmntent ("/etc/mtab", "r");
1093                                  me = getmntent (fh);
1094                                 ]]
1095                         ),
1096                         [c_cv_have_one_getmntent="yes"],
1097                         [c_cv_have_one_getmntent="no"]
1098                 )
1099         )
1100         AC_CACHE_CHECK([whether getmntent takes two arguments],
1101                 [c_cv_have_two_getmntent],
1102                 AC_COMPILE_IFELSE(
1103                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1104 #include "$srcdir/src/utils_mount.h"]],
1105                                 [[
1106                                  FILE *fh;
1107                                  struct mnttab mt;
1108                                  int status;
1109                                  fh = fopen ("/etc/mnttab", "r");
1110                                  status = getmntent (fh, &mt);
1111                                 ]]
1112                         ),
1113                         [c_cv_have_two_getmntent="yes"],
1114                         [c_cv_have_two_getmntent="no"]
1115                 )
1116         )
1117 fi
1119 # Check for different versions of `getmntent' here..
1121 if test "x$have_getmntent" = "xc"; then
1122         if test "x$c_cv_have_one_getmntent" = "xyes"; then
1123                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1124                           [Define if the function getmntent exists and takes one argument.])
1125         fi
1126         if test "x$c_cv_have_two_getmntent" = "xyes"; then
1127                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1128                           [Define if the function getmntent exists and takes two arguments.])
1129         fi
1130 fi
1131 if test "x$have_getmntent" = "xsun"; then
1132         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1133                   [Define if the function getmntent exists. It's the version from libsun.])
1134 fi
1135 if test "x$have_getmntent" = "xseq"; then
1136         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1137                   [Define if the function getmntent exists. It's the version from libseq.])
1138 fi
1139 if test "x$have_getmntent" = "xgen"; then
1140         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1141                   [Define if the function getmntent exists. It's the version from libgen.])
1142 fi
1144 # Check for htonll
1145 AC_MSG_CHECKING([if have htonll defined])
1147     have_htonll="no"
1148     AC_LINK_IFELSE([
1149        AC_LANG_PROGRAM([
1150 #include <sys/types.h>
1151 #include <netinet/in.h>
1152 #if HAVE_INTTYPES_H
1153 # include <inttypes.h>
1154 #endif
1155        ], [
1156           return htonll(0);
1157        ])
1158     ], [
1159       have_htonll="yes"
1160       AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1161     ])
1162  
1163 AC_MSG_RESULT([$have_htonll])
1165 # Check for structures
1166 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1167         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1168         [],
1169         [
1170         #include <sys/types.h>
1171         #include <sys/socket.h>
1172         #include <net/if.h>
1173         ])
1174 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1175         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1176         [],
1177         [
1178         #include <sys/types.h>
1179         #include <sys/socket.h>
1180         #include <linux/if.h>
1181         #include <linux/netdevice.h>
1182         ])
1184 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1185         [],
1186         [
1187         #include <netinet/in.h>
1188         #include <net/if.h>
1189         ])
1191 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1192         [
1193                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1194                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
1195                 have_struct_kinfo_proc_freebsd="yes"
1196         ],
1197         [
1198                 have_struct_kinfo_proc_freebsd="no"
1199         ],
1200         [
1201 #include <kvm.h>
1202 #include <sys/param.h>
1203 #include <sys/sysctl.h>
1204 #include <sys/user.h>
1205         ])
1207 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1208         [
1209                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1210                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
1211                 have_struct_kinfo_proc_openbsd="yes"
1212         ],
1213         [
1214                 have_struct_kinfo_proc_openbsd="no"
1215         ],
1216         [
1217 #include <sys/param.h>
1218 #include <sys/sysctl.h>
1219 #include <kvm.h>
1220         ])
1222 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1223 [#define _BSD_SOURCE
1224 #if HAVE_STDINT_H
1225 # include <stdint.h>
1226 #endif
1227 #if HAVE_SYS_TYPES_H
1228 # include <sys/types.h>
1229 #endif
1230 #if HAVE_NETINET_IN_SYSTM_H
1231 # include <netinet/in_systm.h>
1232 #endif
1233 #if HAVE_NETINET_IN_H
1234 # include <netinet/in.h>
1235 #endif
1236 #if HAVE_NETINET_IP_H
1237 # include <netinet/ip.h>
1238 #endif
1239 #if HAVE_NETINET_UDP_H
1240 # include <netinet/udp.h>
1241 #endif
1242 ])
1243 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1244 [#define _BSD_SOURCE
1245 #if HAVE_STDINT_H
1246 # include <stdint.h>
1247 #endif
1248 #if HAVE_SYS_TYPES_H
1249 # include <sys/types.h>
1250 #endif
1251 #if HAVE_NETINET_IN_SYSTM_H
1252 # include <netinet/in_systm.h>
1253 #endif
1254 #if HAVE_NETINET_IN_H
1255 # include <netinet/in.h>
1256 #endif
1257 #if HAVE_NETINET_IP_H
1258 # include <netinet/ip.h>
1259 #endif
1260 #if HAVE_NETINET_UDP_H
1261 # include <netinet/udp.h>
1262 #endif
1263 ])
1265 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1266         [],
1267         [],
1268         [
1269 #if HAVE_KSTAT_H
1270 # include <kstat.h>
1271 #endif
1272         ])
1275 # Checks for libraries begin here
1278 with_libresolv="yes"
1279 AC_CHECK_LIB(resolv, res_search,
1281         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1282 ],
1283 [with_libresolv="no"])
1284 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1286 dnl Check for HAL (hardware abstraction library)
1287 with_libhal="yes"
1288 AC_CHECK_LIB(hal,libhal_device_property_exists,
1289              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1290              [with_libhal="no"])
1291 if test "x$with_libhal" = "xyes"; then
1292         if test "x$PKG_CONFIG" != "x"; then
1293                 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1294                 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1295                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1296                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1297         fi
1298 fi
1300 m4_divert_once([HELP_WITH], [
1301 collectd additional packages:])
1303 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"]) 
1305 if test "x$ac_system" = "xAIX"
1306 then
1307         with_perfstat="yes"
1308         with_procinfo="yes"
1309 else
1310         with_perfstat="no (AIX only)"
1311         with_procinfo="no (AIX only)"
1312 fi
1314 if test "x$with_perfstat" = "xyes"
1315 then
1316         AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1317 #       AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1318 fi
1319 if test "x$with_perfstat" = "xyes"
1320 then
1321          AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1322          # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1323          AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1324          if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1325          then
1326                 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1327          fi
1328 fi
1329 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1331 # Processes plugin under AIX.
1332 if test "x$with_procinfo" = "xyes"
1333 then
1334         AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1335 fi
1336 if test "x$with_procinfo" = "xyes"
1337 then
1338          AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1339 fi
1341 if test "x$ac_system" = "xSolaris"
1342 then
1343         with_kstat="yes"
1344         with_devinfo="yes"
1345 else
1346         with_kstat="no (Solaris only)"
1347         with_devinfo="no (Solaris only)"
1348 fi
1350 if test "x$with_kstat" = "xyes"
1351 then
1352         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1353 fi
1354 if test "x$with_kstat" = "xyes"
1355 then
1356         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1357         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1358 fi
1359 if test "x$with_kstat" = "xyes"
1360 then
1361         AC_DEFINE(HAVE_LIBKSTAT, 1,
1362                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1363 fi
1364 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1365 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1367 with_libiokit="no"
1368 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1370         with_libiokit="yes"
1371 ], 
1373         with_libiokit="no"
1374 ])
1375 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1377 with_libkvm="no"
1378 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1379 if test "x$with_kvm_getprocs" = "xyes"
1380 then
1381         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1382                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1383         with_libkvm="yes"
1384 fi
1385 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1387 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1388 if test "x$with_kvm_getswapinfo" = "xyes"
1389 then
1390         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1391                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1392         with_libkvm="yes"
1393 fi
1394 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1396 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1397 if test "x$with_kvm_nlist" = "xyes"
1398 then
1399         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1400                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1401         with_libkvm="yes"
1402 fi
1403 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1405 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1406 if test "x$with_kvm_openfiles" = "xyes"
1407 then
1408         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1409                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1410         with_libkvm="yes"
1411 fi
1412 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1414 # --with-libcredis {{{
1415 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1417  if test "x$withval" = "xyes"
1418  then
1419          with_libcredis="yes"
1420  else if test "x$withval" = "xno"
1421  then
1422          with_libcredis="no"
1423  else
1424          with_libcredis="yes"
1425          LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1426          LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1427  fi; fi
1428 ],
1429 [with_libcredis="yes"])
1431 SAVE_CPPFLAGS="$CPPFLAGS"
1432 SAVE_LDFLAGS="$LDFLAGS"
1434 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1435 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1437 if test "x$with_libcredis" = "xyes"
1438 then
1439         if test "x$LIBCREDIS_CPPFLAGS" != "x"
1440         then
1441                 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1442         fi
1443         AC_CHECK_HEADERS(credis.h,
1444         [with_libcredis="yes"],
1445         [with_libcredis="no (credis.h not found)"])
1446 fi
1447 if test "x$with_libcredis" = "xyes"
1448 then
1449         if test "x$LIBCREDIS_LDFLAGS" != "x"
1450         then
1451                 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1452         fi
1453         AC_CHECK_LIB(credis, credis_info,
1454         [with_libcredis="yes"],
1455         [with_libcredis="no (symbol 'credis_info' not found)"])
1457 fi
1459 CPPFLAGS="$SAVE_CPPFLAGS"
1460 LDFLAGS="$SAVE_LDFLAGS"
1462 if test "x$with_libcredis" = "xyes"
1463 then
1464         BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1465         BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1466         AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1467         AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1468 fi
1469 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1470 # }}}
1472 # --with-libcurl {{{
1473 with_curl_config="curl-config"
1474 with_curl_cflags=""
1475 with_curl_libs=""
1476 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1478         if test "x$withval" = "xno"
1479         then
1480                 with_libcurl="no"
1481         else if test "x$withval" = "xyes"
1482         then
1483                 with_libcurl="yes"
1484         else
1485                 if test -f "$withval" && test -x "$withval"
1486                 then
1487                         with_curl_config="$withval"
1488                         with_libcurl="yes"
1489                 else if test -x "$withval/bin/curl-config"
1490                 then
1491                         with_curl_config="$withval/bin/curl-config"
1492                         with_libcurl="yes"
1493                 fi; fi
1494                 with_libcurl="yes"
1495         fi; fi
1496 ],
1498         with_libcurl="yes"
1499 ])
1500 if test "x$with_libcurl" = "xyes"
1501 then
1502         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1503         curl_config_status=$?
1505         if test $curl_config_status -ne 0
1506         then
1507                 with_libcurl="no ($with_curl_config failed)"
1508         else
1509                 SAVE_CPPFLAGS="$CPPFLAGS"
1510                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1512                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1514                 CPPFLAGS="$SAVE_CPPFLAGS"
1515         fi
1516 fi
1517 if test "x$with_libcurl" = "xyes"
1518 then
1519         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1520         curl_config_status=$?
1522         if test $curl_config_status -ne 0
1523         then
1524                 with_libcurl="no ($with_curl_config failed)"
1525         else
1526                 AC_CHECK_LIB(curl, curl_easy_init,
1527                  [with_libcurl="yes"],
1528                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1529                  [$with_curl_libs])
1530         fi
1531 fi
1532 if test "x$with_libcurl" = "xyes"
1533 then
1534         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1535         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1536         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1537         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1538 fi
1539 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1540 # }}}
1542 # --with-libdbi {{{
1543 with_libdbi_cppflags=""
1544 with_libdbi_ldflags=""
1545 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1547         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1548         then
1549                 with_libdbi_cppflags="-I$withval/include"
1550                 with_libdbi_ldflags="-L$withval/lib"
1551                 with_libdbi="yes"
1552         else
1553                 with_libdbi="$withval"
1554         fi
1555 ],
1557         with_libdbi="yes"
1558 ])
1559 if test "x$with_libdbi" = "xyes"
1560 then
1561         SAVE_CPPFLAGS="$CPPFLAGS"
1562         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1564         AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1566         CPPFLAGS="$SAVE_CPPFLAGS"
1567 fi
1568 if test "x$with_libdbi" = "xyes"
1569 then
1570         SAVE_CPPFLAGS="$CPPFLAGS"
1571         SAVE_LDFLAGS="$LDFLAGS"
1572         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1573         LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1575         AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1577         CPPFLAGS="$SAVE_CPPFLAGS"
1578         LDFLAGS="$SAVE_LDFLAGS"
1579 fi
1580 if test "x$with_libdbi" = "xyes"
1581 then
1582         BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1583         BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1584         BUILD_WITH_LIBDBI_LIBS="-ldbi"
1585         AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1586         AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1587         AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1588 fi
1589 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1590 # }}}
1592 # --with-libesmtp {{{
1593 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1595         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1596         then
1597                 LDFLAGS="$LDFLAGS -L$withval/lib"
1598                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1599                 with_libesmtp="yes"
1600         else
1601                 with_libesmtp="$withval"
1602         fi
1603 ],
1605         with_libesmtp="yes"
1606 ])
1607 if test "x$with_libesmtp" = "xyes"
1608 then
1609         AC_CHECK_LIB(esmtp, smtp_create_session,
1610         [
1611                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1612         ], [with_libesmtp="no (libesmtp not found)"])
1613 fi
1614 if test "x$with_libesmtp" = "xyes"
1615 then
1616         AC_CHECK_HEADERS(libesmtp.h,
1617         [
1618                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1619         ], [with_libesmtp="no (libesmtp.h not found)"])
1620 fi
1621 if test "x$with_libesmtp" = "xyes"
1622 then
1623         collect_libesmtp=1
1624 else
1625         collect_libesmtp=0
1626 fi
1627 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1628         [Wether or not to use the esmtp library])
1629 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1630 # }}}
1632 # --with-libganglia {{{
1633 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1635  if test -f "$withval" && test -x "$withval"
1636  then
1637          with_libganglia_config="$withval"
1638          with_libganglia="yes"
1639  else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1640  then
1641          with_libganglia_config="$withval/bin/ganglia-config"
1642          with_libganglia="yes"
1643  else if test -d "$withval"
1644  then
1645          GANGLIA_CPPFLAGS="-I$withval/include"
1646          GANGLIA_LDFLAGS="-L$withval/lib"
1647          with_libganglia="yes"
1648  else
1649          with_libganglia_config="ganglia-config"
1650          with_libganglia="$withval"
1651  fi; fi; fi
1652 ],
1654  with_libganglia_config="ganglia-config"
1655  with_libganglia="yes"
1656 ])
1658 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1659 then
1660         if test "x$GANGLIA_CPPFLAGS" = "x"
1661         then
1662                 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1663         fi
1665         if test "x$GANGLIA_LDFLAGS" = "x"
1666         then
1667                 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1668         fi
1670         if test "x$GANGLIA_LIBS" = "x"
1671         then
1672                 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1673         fi
1674 fi
1676 SAVE_CPPFLAGS="$CPPFLAGS"
1677 SAVE_LDFLAGS="$LDFLAGS"
1678 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1679 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1681 if test "x$with_libganglia" = "xyes"
1682 then
1683         AC_CHECK_HEADERS(gm_protocol.h,
1684         [
1685                 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1686                           [Define to 1 if you have the <gm_protocol.h> header file.])
1687         ], [with_libganglia="no (gm_protocol.h not found)"])
1688 fi
1690 if test "x$with_libganglia" = "xyes"
1691 then
1692         AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1693         [
1694                 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1695                           [Define to 1 if you have the ganglia library (-lganglia).])
1696         ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1697 fi
1699 CPPFLAGS="$SAVE_CPPFLAGS"
1700 LDFLAGS="$SAVE_LDFLAGS"
1702 AC_SUBST(GANGLIA_CPPFLAGS)
1703 AC_SUBST(GANGLIA_LDFLAGS)
1704 AC_SUBST(GANGLIA_LIBS)
1705 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1706 # }}}
1708 # --with-libgcrypt {{{
1709 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1710 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1711 GCRYPT_LIBS="$GCRYPT_LIBS"
1712 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1714  if test -f "$withval" && test -x "$withval"
1715  then
1716          with_libgcrypt_config="$withval"
1717          with_libgcrypt="yes"
1718  else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1719  then
1720          with_libgcrypt_config="$withval/bin/gcrypt-config"
1721          with_libgcrypt="yes"
1722  else if test -d "$withval"
1723  then
1724          GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1725          GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1726          with_libgcrypt="yes"
1727  else
1728          with_libgcrypt_config="gcrypt-config"
1729          with_libgcrypt="$withval"
1730  fi; fi; fi
1731 ],
1733  with_libgcrypt_config="libgcrypt-config"
1734  with_libgcrypt="yes"
1735 ])
1737 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1738 then
1739         if test "x$GCRYPT_CPPFLAGS" = "x"
1740         then
1741                 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1742         fi
1744         if test "x$GCRYPT_LDFLAGS" = "x"
1745         then
1746                 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1747                 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1748         fi
1750         if test "x$GCRYPT_LIBS" = "x"
1751         then
1752                 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1753         fi
1754 fi
1756 SAVE_CPPFLAGS="$CPPFLAGS"
1757 SAVE_LDFLAGS="$LDFLAGS"
1758 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1759 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1761 if test "x$with_libgcrypt" = "xyes"
1762 then
1763         if test "x$GCRYPT_CPPFLAGS" != "x"
1764         then
1765                 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1766         fi
1767         AC_CHECK_HEADERS(gcrypt.h,
1768                 [with_libgcrypt="yes"],
1769                 [with_libgcrypt="no (gcrypt.h not found)"])
1770 fi
1772 if test "x$with_libgcrypt" = "xyes"
1773 then
1774         if test "x$GCRYPT_LDFLAGS" != "x"
1775         then
1776                 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1777         fi
1778         AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1779                 [with_libgcrypt="yes"],
1780                 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1782         if test "$with_libgcrypt" != "no"; then
1783                 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1784         fi
1785 fi
1787 CPPFLAGS="$SAVE_CPPFLAGS"
1788 LDFLAGS="$SAVE_LDFLAGS"
1790 if test "x$with_libgcrypt" = "xyes"
1791 then
1792         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1793 fi
1795 AC_SUBST(GCRYPT_CPPFLAGS)
1796 AC_SUBST(GCRYPT_LDFLAGS)
1797 AC_SUBST(GCRYPT_LIBS)
1798 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1799 # }}}
1801 # --with-libiptc {{{
1802 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1804         if test "x$withval" = "xshipped"
1805         then
1806                 with_libiptc="own"
1807         else if test "x$withval" = "xyes"
1808         then
1809                 with_libiptc="pkgconfig"
1810         else if test "x$withval" = "xno"
1811         then
1812                 with_libiptc="no"
1813         else
1814                 with_libiptc="yes"
1815                 with_libiptc_cflags="-I$withval/include"
1816                 with_libiptc_libs="-L$withval/lib"
1817         fi; fi; fi
1818 ],
1820         if test "x$ac_system" = "xLinux"
1821         then
1822                 with_libiptc="pkgconfig"
1823         else
1824                 with_libiptc="no (Linux only)"
1825         fi
1826 ])
1828 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1829 then
1830         with_libiptc="no (Don't have pkg-config)"
1831 fi
1833 if test "x$with_libiptc" = "xpkgconfig"
1834 then
1835         $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1836         if test $? -ne 0
1837         then
1838                 with_libiptc="no (pkg-config doesn't know libiptc)"
1839         fi
1840 fi
1841 if test "x$with_libiptc" = "xpkgconfig"
1842 then
1843         with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1844         if test $? -ne 0
1845         then
1846                 with_libiptc="no ($PKG_CONFIG failed)"
1847         fi
1848         with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1849         if test $? -ne 0
1850         then
1851                 with_libiptc="no ($PKG_CONFIG failed)"
1852         fi
1853 fi
1855 SAVE_CPPFLAGS="$CPPFLAGS"
1856 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1858 # check whether the header file for libiptc is available.
1859 if test "x$with_libiptc" = "xpkgconfig"
1860 then
1861         AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1862                         [with_libiptc="no (header file missing)"])
1863 fi
1864 # If the header file is available, check for the required type declaractions.
1865 # They may be missing in old versions of libiptc. In that case, they will be
1866 # declared in the iptables plugin.
1867 if test "x$with_libiptc" = "xpkgconfig"
1868 then
1869         AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1870 fi
1871 # Check for the iptc_init symbol in the library.
1872 if test "x$with_libiptc" = "xpkgconfig"
1873 then
1874         AC_CHECK_LIB(iptc, iptc_init,
1875                         [with_libiptc="pkgconfig"],
1876                         [with_libiptc="no"],
1877                         [$with_libiptc_libs])
1878 fi
1879 if test "x$with_libiptc" = "xpkgconfig"
1880 then
1881         with_libiptc="yes"
1882 fi
1884 CPPFLAGS="$SAVE_CPPFLAGS"
1886 if test "x$with_libiptc" = "xown"
1887 then
1888         with_libiptc_cflags=""
1889         with_libiptc_libs=""
1890 fi
1891 if test "x$with_libiptc" = "xown"
1892 then
1893         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1894         [
1895                 with_libiptc="no (Linux iptables headers not found)"
1896         ],
1897         [
1898 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1899         ])
1900 fi
1901 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1902 if test "x$with_libiptc" = "xown"
1903 then
1904         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1905         with_libiptc="yes"
1906 fi
1908 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1909 if test "x$with_libiptc" = "xyes"
1910 then
1911         BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1912         BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1913         AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1914         AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1915 fi
1916 # }}}
1918 # --with-java {{{
1919 with_java_home="$JAVA_HOME"
1920 with_java_vmtype="client"
1921 with_java_cflags=""
1922 with_java_libs=""
1923 JAVAC="$JAVAC"
1924 JAR="$JAR"
1925 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1927         if test "x$withval" = "xno"
1928         then
1929                 with_java="no"
1930         else if test "x$withval" = "xyes"
1931         then
1932                 with_java="yes"
1933         else
1934                 with_java_home="$withval"
1935                 with_java="yes"
1936         fi; fi
1937 ],
1938 [with_java="yes"])
1939 if test "x$with_java" = "xyes"
1940 then
1941         if test -d "$with_java_home"
1942         then
1943                 AC_MSG_CHECKING([for jni.h])
1944                 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1945                 if test "x$TMPDIR" != "x"
1946                 then
1947                         AC_MSG_RESULT([found in $TMPDIR])
1948                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1949                 else
1950                         AC_MSG_RESULT([not found])
1951                 fi
1953                 AC_MSG_CHECKING([for jni_md.h])
1954                 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1955                 if test "x$TMPDIR" != "x"
1956                 then
1957                         AC_MSG_RESULT([found in $TMPDIR])
1958                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1959                 else
1960                         AC_MSG_RESULT([not found])
1961                 fi
1963                 AC_MSG_CHECKING([for libjvm.so])
1964                 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1965                 if test "x$TMPDIR" != "x"
1966                 then
1967                         AC_MSG_RESULT([found in $TMPDIR])
1968                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1969                 else
1970                         AC_MSG_RESULT([not found])
1971                 fi
1973                 if test "x$JAVAC" = "x"
1974                 then
1975                         AC_MSG_CHECKING([for javac])
1976                         TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1977                         if test "x$TMPDIR" != "x"
1978                         then
1979                                 JAVAC="$TMPDIR"
1980                                 AC_MSG_RESULT([$JAVAC])
1981                         else
1982                                 AC_MSG_RESULT([not found])
1983                         fi
1984                 fi
1985                 if test "x$JAR" = "x"
1986                 then
1987                         AC_MSG_CHECKING([for jar])
1988                         TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1989                         if test "x$TMPDIR" != "x"
1990                         then
1991                                 JAR="$TMPDIR"
1992                                 AC_MSG_RESULT([$JAR])
1993                         else
1994                                 AC_MSG_RESULT([not found])
1995                         fi
1996                 fi
1997         else if test "x$with_java_home" != "x"
1998         then
1999                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2000         fi; fi
2001 fi
2003 if test "x$JAVA_CPPFLAGS" != "x"
2004 then
2005         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2006 fi
2007 if test "x$JAVA_CFLAGS" != "x"
2008 then
2009         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2010 fi
2011 if test "x$JAVA_LDFLAGS" != "x"
2012 then
2013         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2014 fi
2015 if test "x$JAVAC" = "x"
2016 then
2017         with_javac_path="$PATH"
2018         if test "x$with_java_home" != "x"
2019         then
2020                 with_javac_path="$with_java_home:with_javac_path"
2021                 if test -d "$with_java_home/bin"
2022                 then
2023                         with_javac_path="$with_java_home/bin:with_javac_path"
2024                 fi
2025         fi
2027         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2028 fi
2029 if test "x$JAVAC" = "x"
2030 then
2031         with_java="no (javac not found)"
2032 fi
2033 if test "x$JAR" = "x"
2034 then
2035         with_jar_path="$PATH"
2036         if test "x$with_java_home" != "x"
2037         then
2038                 with_jar_path="$with_java_home:$with_jar_path"
2039                 if test -d "$with_java_home/bin"
2040                 then
2041                         with_jar_path="$with_java_home/bin:$with_jar_path"
2042                 fi
2043         fi
2045         AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2046 fi
2047 if test "x$JAR" = "x"
2048 then
2049         with_java="no (jar not found)"
2050 fi
2052 SAVE_CPPFLAGS="$CPPFLAGS"
2053 SAVE_CFLAGS="$CFLAGS"
2054 SAVE_LDFLAGS="$LDFLAGS"
2055 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2056 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2057 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2059 if test "x$with_java" = "xyes"
2060 then
2061         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2062 fi
2063 if test "x$with_java" = "xyes"
2064 then
2065         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2066         [with_java="yes"],
2067         [with_java="no (libjvm not found)"],
2068         [$JAVA_LIBS])
2069 fi
2070 if test "x$with_java" = "xyes"
2071 then
2072         JAVA_LIBS="$JAVA_LIBS -ljvm"
2073         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2074 fi
2076 CPPFLAGS="$SAVE_CPPFLAGS"
2077 CFLAGS="$SAVE_CFLAGS"
2078 LDFLAGS="$SAVE_LDFLAGS"
2080 AC_SUBST(JAVA_CPPFLAGS)
2081 AC_SUBST(JAVA_CFLAGS)
2082 AC_SUBST(JAVA_LDFLAGS)
2083 AC_SUBST(JAVA_LIBS)
2084 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2085 # }}}
2087 # --with-libmemcached {{{
2088 with_libmemcached_cppflags=""
2089 with_libmemcached_ldflags=""
2090 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2092         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2093         then
2094                 with_libmemcached_cppflags="-I$withval/include"
2095                 with_libmemcached_ldflags="-L$withval/lib"
2096                 with_libmemcached="yes"
2097         else
2098                 with_libmemcached="$withval"
2099         fi
2100 ],
2102         with_libmemcached="yes"
2103 ])
2104 if test "x$with_libmemcached" = "xyes"
2105 then
2106         SAVE_CPPFLAGS="$CPPFLAGS"
2107         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2109         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2111         CPPFLAGS="$SAVE_CPPFLAGS"
2112 fi
2113 if test "x$with_libmemcached" = "xyes"
2114 then
2115         SAVE_CPPFLAGS="$CPPFLAGS"
2116         SAVE_LDFLAGS="$LDFLAGS"
2117         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2118         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2120         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2122         CPPFLAGS="$SAVE_CPPFLAGS"
2123         LDFLAGS="$SAVE_LDFLAGS"
2124 fi
2125 if test "x$with_libmemcached" = "xyes"
2126 then
2127         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2128         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2129         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2130         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2131         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2132         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2133         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2134 fi
2135 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2136 # }}}
2138 # --with-libmodbus {{{
2139 with_libmodbus_config=""
2140 with_libmodbus_cflags=""
2141 with_libmodbus_libs=""
2142 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2144         if test "x$withval" = "xno"
2145         then
2146                 with_libmodbus="no"
2147         else if test "x$withval" = "xyes"
2148         then
2149                 with_libmodbus="use_pkgconfig"
2150         else if test -d "$with_libmodbus/lib"
2151         then
2152                 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2153                 with_libmodbus_cflags="-I$withval/include"
2154                 with_libmodbus_libs="-L$withval/lib -lmodbus"
2155                 with_libmodbus="yes"
2156         fi; fi; fi
2157 ],
2158 [with_libmodbus="use_pkgconfig"])
2160 # configure using pkg-config
2161 if test "x$with_libmodbus" = "xuse_pkgconfig"
2162 then
2163         if test "x$PKG_CONFIG" = "x"
2164         then
2165                 with_libmodbus="no (Don't have pkg-config)"
2166         fi
2167 fi
2168 if test "x$with_libmodbus" = "xuse_pkgconfig"
2169 then
2170         AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2171         $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2172         if test $? -ne 0
2173         then
2174                 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2175         fi
2176 fi
2177 if test "x$with_libmodbus" = "xuse_pkgconfig"
2178 then
2179         with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2180         if test $? -ne 0
2181         then
2182                 with_libmodbus="no ($PKG_CONFIG failed)"
2183         fi
2184         with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2185         if test $? -ne 0
2186         then
2187                 with_libmodbus="no ($PKG_CONFIG failed)"
2188         fi
2189 fi
2190 if test "x$with_libmodbus" = "xuse_pkgconfig"
2191 then
2192         with_libmodbus="yes"
2193 fi
2195 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2196 # the actual checks.
2197 if test "x$with_libmodbus" = "xyes"
2198 then
2199         SAVE_CPPFLAGS="$CPPFLAGS"
2200         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2202         AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2204         CPPFLAGS="$SAVE_CPPFLAGS"
2205 fi
2206 if test "x$with_libmodbus" = "xyes"
2207 then
2208         SAVE_CPPFLAGS="$CPPFLAGS"
2209         SAVE_LDFLAGS="$LDFLAGS"
2211         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2212         LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2214         AC_CHECK_LIB(modbus, modbus_connect,
2215                      [with_libmodbus="yes"],
2216                      [with_libmodbus="no (symbol modbus_connect not found)"])
2218         CPPFLAGS="$SAVE_CPPFLAGS"
2219         LDFLAGS="$SAVE_LDFLAGS"
2220 fi
2221 if test "x$with_libmodbus" = "xyes"
2222 then
2223         BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2224         BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2225         AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2226         AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2227 fi
2228 # }}}
2230 # --with-libmongoc {{{
2231 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2233  if test "x$withval" = "xyes"
2234  then
2235          with_libmongoc="yes"
2236  else if test "x$withval" = "xno"
2237  then
2238          with_libmongoc="no"
2239  else
2240          with_libmongoc="yes"
2241          LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2242          LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2243  fi; fi
2244 ],
2245 [with_libmongoc="yes"])
2247 SAVE_CPPFLAGS="$CPPFLAGS"
2248 SAVE_LDFLAGS="$LDFLAGS"
2250 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2251 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2253 if test "x$with_libmongoc" = "xyes"
2254 then
2255         if test "x$LIBMONGOC_CPPFLAGS" != "x"
2256         then
2257                 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2258         fi
2259         AC_CHECK_HEADERS(mongo.h,
2260         [with_libmongoc="yes"],
2261         [with_libmongoc="no ('mongo.h' not found)"],
2262 [#if HAVE_STDINT_H
2263 # define MONGO_HAVE_STDINT 1
2264 #else
2265 # define MONGO_USE_LONG_LONG_INT 1
2266 #endif
2267 ])
2268 fi
2269 if test "x$with_libmongoc" = "xyes"
2270 then
2271         if test "x$LIBMONGOC_LDFLAGS" != "x"
2272         then
2273                 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2274         fi
2275         AC_CHECK_LIB(mongoc, mongo_run_command,
2276         [with_libmongoc="yes"],
2277         [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2278 fi
2280 CPPFLAGS="$SAVE_CPPFLAGS"
2281 LDFLAGS="$SAVE_LDFLAGS"
2283 if test "x$with_libmongoc" = "xyes"
2284 then
2285         BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2286         BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2287         AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2288         AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2289 fi
2290 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2291 # }}}
2293 # --with-libmysql {{{
2294 with_mysql_config="mysql_config"
2295 with_mysql_cflags=""
2296 with_mysql_libs=""
2297 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2299         if test "x$withval" = "xno"
2300         then
2301                 with_libmysql="no"
2302         else if test "x$withval" = "xyes"
2303         then
2304                 with_libmysql="yes"
2305         else
2306                 if test -f "$withval" && test -x "$withval";
2307                 then
2308                         with_mysql_config="$withval"
2309                 else if test -x "$withval/bin/mysql_config"
2310                 then
2311                         with_mysql_config="$withval/bin/mysql_config"
2312                 fi; fi
2313                 with_libmysql="yes"
2314         fi; fi
2315 ],
2317         with_libmysql="yes"
2318 ])
2319 if test "x$with_libmysql" = "xyes"
2320 then
2321         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2322         mysql_config_status=$?
2324         if test $mysql_config_status -ne 0
2325         then
2326                 with_libmysql="no ($with_mysql_config failed)"
2327         else
2328                 SAVE_CPPFLAGS="$CPPFLAGS"
2329                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2331                 have_mysql_h="no"
2332                 have_mysql_mysql_h="no"
2333                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2335                 if test "x$have_mysql_h" = "xno"
2336                 then
2337                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2338                 fi
2340                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2341                 then
2342                         with_libmysql="no (mysql.h not found)"
2343                 fi
2345                 CPPFLAGS="$SAVE_CPPFLAGS"
2346         fi
2347 fi
2348 if test "x$with_libmysql" = "xyes"
2349 then
2350         with_mysql_libs=`$with_mysql_config --libs_r 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                 AC_CHECK_LIB(mysqlclient, mysql_init,
2358                  [with_libmysql="yes"],
2359                  [with_libmysql="no (symbol 'mysql_init' not found)"],
2360                  [$with_mysql_libs])
2362                 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2363                  [with_libmysql="yes"],
2364                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2365                  [$with_mysql_libs])
2366         fi
2367 fi
2368 if test "x$with_libmysql" = "xyes"
2369 then
2370         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2371         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2372         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2373         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2374 fi
2375 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2376 # }}}
2378 # --with-libnetlink {{{
2379 with_libnetlink_cflags=""
2380 with_libnetlink_libs="-lnetlink"
2381 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2383  echo "libnetlink: withval = $withval"
2384  if test "x$withval" = "xyes"
2385  then
2386          with_libnetlink="yes"
2387  else if test "x$withval" = "xno"
2388  then
2389          with_libnetlink="no"
2390  else
2391          if test -d "$withval/include"
2392          then
2393                  with_libnetlink_cflags="-I$withval/include"
2394                  with_libnetlink_libs="-L$withval/lib -lnetlink"
2395                  with_libnetlink="yes"
2396          else
2397                  AC_MSG_ERROR("no such directory: $withval/include")
2398          fi
2399  fi; fi
2400 ],
2402  if test "x$ac_system" = "xLinux"
2403  then
2404          with_libnetlink="yes"
2405  else
2406          with_libnetlink="no (Linux only library)"
2407  fi
2408 ])
2409 if test "x$with_libnetlink" = "xyes"
2410 then
2411         SAVE_CFLAGS="$CFLAGS"
2412         CFLAGS="$CFLAGS $with_libnetlink_cflags"
2414         with_libnetlink="no (libnetlink.h not found)"
2416         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2417         [
2418          with_libnetlink="yes"
2419          break
2420         ], [],
2421 [#include <stdio.h>
2422 #include <sys/types.h>
2423 #include <asm/types.h>
2424 #include <sys/socket.h>
2425 #include <linux/netlink.h>
2426 #include <linux/rtnetlink.h>])
2427         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2428 [#include <stdio.h>
2429 #include <sys/types.h>
2430 #include <asm/types.h>
2431 #include <sys/socket.h>])
2433         AC_COMPILE_IFELSE(
2434 [#include <stdio.h>
2435 #include <sys/types.h>
2436 #include <asm/types.h>
2437 #include <sys/socket.h>
2438 #include <linux/netlink.h>
2439 #include <linux/rtnetlink.h>
2441 int main (void)
2443         int retval = TCA_STATS2;
2444         return (retval);
2445 }],
2446         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2447         []);
2449         AC_COMPILE_IFELSE(
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>
2457 int main (void)
2459         int retval = TCA_STATS;
2460         return (retval);
2461 }],
2462         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2463         []);
2465         CFLAGS="$SAVE_CFLAGS"
2466 fi
2467 if test "x$with_libnetlink" = "xyes"
2468 then
2469         AC_CHECK_LIB(netlink, rtnl_open,
2470                      [with_libnetlink="yes"],
2471                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2472                      [$with_libnetlink_libs])
2473 fi
2474 if test "x$with_libnetlink" = "xyes"
2475 then
2476         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2477         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2478         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2479         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2480 fi
2481 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2482 # }}}
2484 # --with-libnetapp {{{
2485 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2486 AC_ARG_VAR([LIBNETAPP_LDFLAGS],  [Linker flags required to build with libnetapp])
2487 AC_ARG_VAR([LIBNETAPP_LIBS],     [Other libraries required to link against libnetapp])
2488 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2489 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2490 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2491 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2493  if test -d "$withval"
2494  then
2495          LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2496          LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2497          with_libnetapp="yes"
2498  else
2499          with_libnetapp="$withval"
2500  fi
2501 ],
2503  with_libnetapp="yes"
2504 ])
2506 SAVE_CPPFLAGS="$CPPFLAGS"
2507 SAVE_LDFLAGS="$LDFLAGS"
2508 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2509 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2511 if test "x$with_libnetapp" = "xyes"
2512 then
2513         if test "x$LIBNETAPP_CPPFLAGS" != "x"
2514         then
2515                 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2516         fi
2517         AC_CHECK_HEADERS(netapp_api.h,
2518                 [with_libnetapp="yes"],
2519                 [with_libnetapp="no (netapp_api.h not found)"])
2520 fi
2522 if test "x$with_libnetapp" = "xyes"
2523 then
2524         if test "x$LIBNETAPP_LDFLAGS" != "x"
2525         then
2526                 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2527         fi
2529         if test "x$LIBNETAPP_LIBS" = "x"
2530         then
2531                 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2532         fi
2533         AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2535         AC_CHECK_LIB(netapp, na_server_invoke_elem,
2536                 [with_libnetapp="yes"],
2537                 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2538                 [$LIBNETAPP_LIBS])
2539         LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2540 fi
2542 CPPFLAGS="$SAVE_CPPFLAGS"
2543 LDFLAGS="$SAVE_LDFLAGS"
2545 if test "x$with_libnetapp" = "xyes"
2546 then
2547         AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2548 fi
2550 AC_SUBST(LIBNETAPP_CPPFLAGS)
2551 AC_SUBST(LIBNETAPP_LDFLAGS)
2552 AC_SUBST(LIBNETAPP_LIBS)
2553 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2554 # }}}
2556 # --with-libnetsnmp {{{
2557 with_snmp_config="net-snmp-config"
2558 with_snmp_cflags=""
2559 with_snmp_libs=""
2560 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2562         if test "x$withval" = "xno"
2563         then
2564                 with_libnetsnmp="no"
2565         else if test "x$withval" = "xyes"
2566         then
2567                 with_libnetsnmp="yes"
2568         else
2569                 if test -x "$withval"
2570                 then
2571                         with_snmp_config="$withval"
2572                         with_libnetsnmp="yes"
2573                 else
2574                         with_snmp_config="$withval/bin/net-snmp-config"
2575                         with_libnetsnmp="yes"
2576                 fi
2577         fi; fi
2578 ],
2579 [with_libnetsnmp="yes"])
2580 if test "x$with_libnetsnmp" = "xyes"
2581 then
2582         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2583         snmp_config_status=$?
2585         if test $snmp_config_status -ne 0
2586         then
2587                 with_libnetsnmp="no ($with_snmp_config failed)"
2588         else
2589                 SAVE_CPPFLAGS="$CPPFLAGS"
2590                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2591                 
2592                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2594                 CPPFLAGS="$SAVE_CPPFLAGS"
2595         fi
2596 fi
2597 if test "x$with_libnetsnmp" = "xyes"
2598 then
2599         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2600         snmp_config_status=$?
2602         if test $snmp_config_status -ne 0
2603         then
2604                 with_libnetsnmp="no ($with_snmp_config failed)"
2605         else
2606                 AC_CHECK_LIB(netsnmp, init_snmp,
2607                 [with_libnetsnmp="yes"],
2608                 [with_libnetsnmp="no (libnetsnmp not found)"],
2609                 [$with_snmp_libs])
2610         fi
2611 fi
2612 if test "x$with_libnetsnmp" = "xyes"
2613 then
2614         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2615         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2616         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2617         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2618 fi
2619 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2620 # }}}
2622 # --with-liboconfig {{{
2623 with_own_liboconfig="no"
2624 liboconfig_LDFLAGS="$LDFLAGS"
2625 liboconfig_CPPFLAGS="$CPPFLAGS"
2626 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2628         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2629         then
2630                 if test -d "$withval/lib"
2631                 then
2632                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2633                 fi
2634                 if test -d "$withval/include"
2635                 then
2636                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2637                 fi
2638         fi
2639         if test "x$withval" = "xno"
2640         then
2641                 AC_MSG_ERROR("liboconfig is required")
2642         fi
2643 ],
2645         with_liboconfig="yes"
2646 ])
2648 save_LDFLAGS="$LDFLAGS"
2649 save_CPPFLAGS="$CPPFLAGS"
2650 LDFLAGS="$liboconfig_LDFLAGS"
2651 CPPFLAGS="$liboconfig_CPPFLAGS"
2652 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2654         with_liboconfig="yes"
2655         with_own_liboconfig="no"
2656 ],
2658         with_liboconfig="yes"
2659         with_own_liboconfig="yes"
2660         LDFLAGS="$save_LDFLAGS"
2661         CPPFLAGS="$save_CPPFLAGS"
2662 ])
2664 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2665 if test "x$with_own_liboconfig" = "xyes"
2666 then
2667         with_liboconfig="yes (shipped version)"
2668 fi
2669 # }}}
2671 # --with-liboping {{{
2672 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2674  if test "x$withval" = "xyes"
2675  then
2676          with_liboping="yes"
2677  else if test "x$withval" = "xno"
2678  then
2679          with_liboping="no"
2680  else
2681          with_liboping="yes"
2682          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2683          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2684  fi; fi
2685 ],
2686 [with_liboping="yes"])
2688 SAVE_CPPFLAGS="$CPPFLAGS"
2689 SAVE_LDFLAGS="$LDFLAGS"
2691 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2692 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2694 if test "x$with_liboping" = "xyes"
2695 then
2696         if test "x$LIBOPING_CPPFLAGS" != "x"
2697         then
2698                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2699         fi
2700         AC_CHECK_HEADERS(oping.h,
2701         [with_liboping="yes"],
2702         [with_liboping="no (oping.h not found)"])
2703 fi
2704 if test "x$with_liboping" = "xyes"
2705 then
2706         if test "x$LIBOPING_LDFLAGS" != "x"
2707         then
2708                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2709         fi
2710         AC_CHECK_LIB(oping, ping_construct,
2711         [with_liboping="yes"],
2712         [with_liboping="no (symbol 'ping_construct' not found)"])
2713 fi
2715 CPPFLAGS="$SAVE_CPPFLAGS"
2716 LDFLAGS="$SAVE_LDFLAGS"
2718 if test "x$with_liboping" = "xyes"
2719 then
2720         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2721         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2722         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2723         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2724 fi
2725 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2726 # }}}
2728 # --with-oracle {{{
2729 with_oracle_cppflags=""
2730 with_oracle_libs=""
2731 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2733         if test "x$withval" = "xyes"
2734         then
2735                 if test "x$ORACLE_HOME" = "x"
2736                 then
2737                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2738                 fi
2739                 with_oracle="yes"
2740         else if test "x$withval" = "xno"
2741         then
2742                 with_oracle="no"
2743         else
2744                 with_oracle="yes"
2745                 ORACLE_HOME="$withval"
2746         fi; fi
2747 ],
2749         if test "x$ORACLE_HOME" = "x"
2750         then
2751                 with_oracle="no (ORACLE_HOME is not set)"
2752         else
2753                 with_oracle="yes"
2754         fi
2755 ])
2756 if test "x$ORACLE_HOME" != "x"
2757 then
2758         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2760         if test -e "$ORACLE_HOME/lib/ldflags"
2761         then
2762                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2763         fi
2764         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2765         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2766 fi
2767 if test "x$with_oracle" = "xyes"
2768 then
2769         SAVE_CPPFLAGS="$CPPFLAGS"
2770         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2772         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2774         CPPFLAGS="$SAVE_CPPFLAGS"
2775 fi
2776 if test "x$with_oracle" = "xyes"
2777 then
2778         SAVE_CPPFLAGS="$CPPFLAGS"
2779         SAVE_LDFLAGS="$LDFLAGS"
2780         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2781         LDFLAGS="$LDFLAGS $with_oracle_libs"
2783         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2785         CPPFLAGS="$SAVE_CPPFLAGS"
2786         LDFLAGS="$SAVE_LDFLAGS"
2787 fi
2788 if test "x$with_oracle" = "xyes"
2789 then
2790         BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2791         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2792         AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2793         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2794 fi
2795 # }}}
2797 # --with-libowcapi {{{
2798 with_libowcapi_cppflags=""
2799 with_libowcapi_libs="-lowcapi"
2800 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2802         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2803         then
2804                 with_libowcapi_cppflags="-I$withval/include"
2805                 with_libowcapi_libs="-L$withval/lib -lowcapi"
2806                 with_libowcapi="yes"
2807         else
2808                 with_libowcapi="$withval"
2809         fi
2810 ],
2812         with_libowcapi="yes"
2813 ])
2814 if test "x$with_libowcapi" = "xyes"
2815 then
2816         SAVE_CPPFLAGS="$CPPFLAGS"
2817         CPPFLAGS="$with_libowcapi_cppflags"
2818         
2819         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2821         CPPFLAGS="$SAVE_CPPFLAGS"
2822 fi
2823 if test "x$with_libowcapi" = "xyes"
2824 then
2825         SAVE_LDFLAGS="$LDFLAGS"
2826         SAVE_CPPFLAGS="$CPPFLAGS"
2827         LDFLAGS="$with_libowcapi_libs"
2828         CPPFLAGS="$with_libowcapi_cppflags"
2829         
2830         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2832         LDFLAGS="$SAVE_LDFLAGS"
2833         CPPFLAGS="$SAVE_CPPFLAGS"
2834 fi
2835 if test "x$with_libowcapi" = "xyes"
2836 then
2837         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2838         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2839         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2840         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2841 fi
2842 # }}}
2844 # --with-libpcap {{{
2845 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2847         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2848         then
2849                 LDFLAGS="$LDFLAGS -L$withval/lib"
2850                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2851                 with_libpcap="yes"
2852         else
2853                 with_libpcap="$withval"
2854         fi
2855 ],
2857         with_libpcap="yes"
2858 ])
2859 if test "x$with_libpcap" = "xyes"
2860 then
2861         AC_CHECK_LIB(pcap, pcap_open_live,
2862         [
2863                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2864         ], [with_libpcap="no (libpcap not found)"])
2865 fi
2866 if test "x$with_libpcap" = "xyes"
2867 then
2868         AC_CHECK_HEADERS(pcap.h,,
2869                          [with_libpcap="no (pcap.h not found)"])
2870 fi
2871 if test "x$with_libpcap" = "xyes"
2872 then
2873         AC_CHECK_HEADERS(pcap-bpf.h,,
2874                          [with_libpcap="no (pcap-bpf.h not found)"])
2875 fi
2876 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2877 # }}}
2879 # --with-libperl {{{
2880 perl_interpreter="perl"
2881 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2883         if test -x "$withval"
2884         then
2885                 perl_interpreter="$withval"
2886                 with_libperl="yes"
2887         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2888         then
2889                 LDFLAGS="$LDFLAGS -L$withval/lib"
2890                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2891                 perl_interpreter="$withval/bin/perl"
2892                 with_libperl="yes"
2893         else
2894                 with_libperl="$withval"
2895         fi; fi
2896 ],
2898         with_libperl="yes"
2899 ])
2901 AC_MSG_CHECKING([for perl])
2902 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2903 if test -x "$perl_interpreter"
2904 then
2905         AC_MSG_RESULT([yes ($perl_interpreter)])
2906 else
2907         perl_interpreter=""
2908         AC_MSG_RESULT([no])
2909 fi
2911 AC_SUBST(PERL, "$perl_interpreter")
2913 if test "x$with_libperl" = "xyes" \
2914         && test -n "$perl_interpreter"
2915 then
2916   SAVE_CFLAGS="$CFLAGS"
2917   SAVE_LDFLAGS="$LDFLAGS"
2918 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2919   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2920   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2921   CFLAGS="$CFLAGS $PERL_CFLAGS"
2922   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2924   AC_CACHE_CHECK([for libperl],
2925     [c_cv_have_libperl],
2926     AC_LINK_IFELSE(
2927       AC_LANG_PROGRAM(
2928       [[
2929 #define PERL_NO_GET_CONTEXT
2930 #include <EXTERN.h>
2931 #include <perl.h>
2932 #include <XSUB.h>
2933       ]],
2934       [[
2935        dTHX;
2936        load_module (PERL_LOADMOD_NOIMPORT,
2937                          newSVpv ("Collectd::Plugin::FooBar", 24),
2938                          Nullsv);
2939       ]]),
2940       [c_cv_have_libperl="yes"],
2941       [c_cv_have_libperl="no"]
2942     )
2943   )
2945   if test "x$c_cv_have_libperl" = "xyes"
2946   then
2947           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2948           AC_SUBST(PERL_CFLAGS)
2949           AC_SUBST(PERL_LDFLAGS)
2950   else
2951           with_libperl="no"
2952   fi
2954   CFLAGS="$SAVE_CFLAGS"
2955   LDFLAGS="$SAVE_LDFLAGS"
2956 else if test -z "$perl_interpreter"; then
2957   with_libperl="no (no perl interpreter found)"
2958   c_cv_have_libperl="no"
2959 fi; fi
2960 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2962 if test "x$with_libperl" = "xyes"
2963 then
2964         SAVE_CFLAGS="$CFLAGS"
2965         SAVE_LDFLAGS="$LDFLAGS"
2966         CFLAGS="$CFLAGS $PERL_CFLAGS"
2967         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2969         AC_CACHE_CHECK([if perl supports ithreads],
2970                 [c_cv_have_perl_ithreads],
2971                 AC_LINK_IFELSE(
2972                         AC_LANG_PROGRAM(
2973                         [[
2974 #include <EXTERN.h>
2975 #include <perl.h>
2976 #include <XSUB.h>
2978 #if !defined(USE_ITHREADS)
2979 # error "Perl does not support ithreads!"
2980 #endif /* !defined(USE_ITHREADS) */
2981                         ]],
2982                         [[ ]]),
2983                         [c_cv_have_perl_ithreads="yes"],
2984                         [c_cv_have_perl_ithreads="no"]
2985                 )
2986         )
2988         if test "x$c_cv_have_perl_ithreads" = "xyes"
2989         then
2990                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2991         fi
2993         CFLAGS="$SAVE_CFLAGS"
2994         LDFLAGS="$SAVE_LDFLAGS"
2995 fi
2997 if test "x$with_libperl" = "xyes"
2998 then
2999         SAVE_CFLAGS="$CFLAGS"
3000         SAVE_LDFLAGS="$LDFLAGS"
3001         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3002         # (see issues #41 and #42)
3003         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3004         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3006         AC_CACHE_CHECK([for broken Perl_load_module()],
3007                 [c_cv_have_broken_perl_load_module],
3008                 AC_LINK_IFELSE(
3009                         AC_LANG_PROGRAM(
3010                         [[
3011 #define PERL_NO_GET_CONTEXT
3012 #include <EXTERN.h>
3013 #include <perl.h>
3014 #include <XSUB.h>
3015                         ]],
3016                         [[
3017                          dTHX;
3018                          load_module (PERL_LOADMOD_NOIMPORT,
3019                              newSVpv ("Collectd::Plugin::FooBar", 24),
3020                              Nullsv);
3021                         ]]),
3022                         [c_cv_have_broken_perl_load_module="no"],
3023                         [c_cv_have_broken_perl_load_module="yes"]
3024                 )
3025         )
3027         CFLAGS="$SAVE_CFLAGS"
3028         LDFLAGS="$SAVE_LDFLAGS"
3029 fi
3030 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3031                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3033 if test "x$with_libperl" = "xyes"
3034 then
3035         SAVE_CFLAGS="$CFLAGS"
3036         SAVE_LDFLAGS="$LDFLAGS"
3037         CFLAGS="$CFLAGS $PERL_CFLAGS"
3038         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3040         AC_CHECK_MEMBER(
3041                 [struct mgvtbl.svt_local],
3042                 [have_struct_mgvtbl_svt_local="yes"],
3043                 [have_struct_mgvtbl_svt_local="no"],
3044                 [
3045 #include <EXTERN.h>
3046 #include <perl.h>
3047 #include <XSUB.h>
3048                 ])
3050         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3051         then
3052                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3053                                   [Define if Perl's struct mgvtbl has member svt_local.])
3054         fi
3056         CFLAGS="$SAVE_CFLAGS"
3057         LDFLAGS="$SAVE_LDFLAGS"
3058 fi
3059 # }}}
3061 # --with-libpq {{{
3062 with_pg_config="pg_config"
3063 with_libpq_includedir=""
3064 with_libpq_libdir=""
3065 with_libpq_cppflags=""
3066 with_libpq_ldflags=""
3067 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3068         [Path to libpq.])],
3070         if test "x$withval" = "xno"
3071         then
3072                 with_libpq="no"
3073         else if test "x$withval" = "xyes"
3074         then
3075                 with_libpq="yes"
3076         else
3077                 if test -f "$withval" && test -x "$withval";
3078                 then
3079                         with_pg_config="$withval"
3080                 else if test -x "$withval/bin/pg_config"
3081                 then
3082                         with_pg_config="$withval/bin/pg_config"
3083                 fi; fi
3084                 with_libpq="yes"
3085         fi; fi
3086 ],
3088         with_libpq="yes"
3089 ])
3090 if test "x$with_libpq" = "xyes"
3091 then
3092         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3093         pg_config_status=$?
3095         if test $pg_config_status -eq 0
3096         then
3097                 if test -n "$with_libpq_includedir"; then
3098                         for dir in $with_libpq_includedir; do
3099                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3100                         done
3101                 fi
3102         else
3103                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3104         fi
3106         SAVE_CPPFLAGS="$CPPFLAGS"
3107         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3109         AC_CHECK_HEADERS(libpq-fe.h, [],
3110                 [with_libpq="no (libpq-fe.h not found)"], [])
3112         CPPFLAGS="$SAVE_CPPFLAGS"
3113 fi
3114 if test "x$with_libpq" = "xyes"
3115 then
3116         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3117         pg_config_status=$?
3119         if test $pg_config_status -eq 0
3120         then
3121                 if test -n "$with_libpq_libdir"; then
3122                         for dir in $with_libpq_libdir; do
3123                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3124                         done
3125                 fi
3126         else
3127                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3128         fi
3130         SAVE_LDFLAGS="$LDFLAGS"
3131         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3133         AC_CHECK_LIB(pq, PQconnectdb,
3134                 [with_libpq="yes"],
3135                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3137         AC_CHECK_LIB(pq, PQserverVersion,
3138                 [with_libpq="yes"],
3139                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3141         LDFLAGS="$SAVE_LDFLAGS"
3142 fi
3143 if test "x$with_libpq" = "xyes"
3144 then
3145         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3146         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3147         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3148         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3149 fi
3150 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3151 # }}}
3153 # --with-libpthread {{{
3154 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3155 [       if test "x$withval" != "xno" \
3156                 && test "x$withval" != "xyes"
3157         then
3158                 LDFLAGS="$LDFLAGS -L$withval/lib"
3159                 CPPFLAGS="$CPPFLAGS -I$withval/include"
3160                 with_libpthread="yes"
3161         else
3162                 if test "x$withval" = "xno"
3163                 then
3164                         with_libpthread="no (disabled)"
3165                 fi
3166         fi
3167 ], [with_libpthread="yes"])
3168 if test "x$with_libpthread" = "xyes"
3169 then
3170         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3171 fi
3173 if test "x$with_libpthread" = "xyes"
3174 then
3175         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3176 fi
3177 if test "x$with_libpthread" = "xyes"
3178 then
3179         collect_pthread=1
3180 else
3181         collect_pthread=0
3182 fi
3183 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3184         [Wether or not to use pthread (POSIX threads) library])
3185 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3186 # }}}
3188 # --with-python {{{
3189 with_python_prog=""
3190 with_python_path="$PATH"
3191 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3193  if test "x$withval" = "xyes" || test "x$withval" = "xno"
3194  then
3195          with_python="$withval"
3196  else if test -x "$withval"
3197  then
3198          with_python_prog="$withval"
3199          with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3200          with_python="yes"
3201  else if test -d "$withval"
3202  then
3203          with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3204          with_python="yes"
3205  else
3206          AC_MSG_WARN([Argument not recognized: $withval])
3207  fi; fi; fi
3208 ], [with_python="yes"])
3210 SAVE_PATH="$PATH"
3211 SAVE_CPPFLAGS="$CPPFLAGS"
3212 SAVE_LDFLAGS="$LDFLAGS"
3213 SAVE_LIBS="$LIBS"
3215 PATH="$with_python_path"
3217 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3218 then
3219         AC_MSG_CHECKING([for python])
3220         with_python_prog="`which python 2>/dev/null`"
3221         if test "x$with_python_prog" = "x"
3222         then
3223                 AC_MSG_RESULT([not found])
3224                 with_python="no (interpreter not found)"
3225         else
3226                 AC_MSG_RESULT([$with_python_prog])
3227         fi
3228 fi
3230 if test "x$with_python" = "xyes"
3231 then
3232         AC_MSG_CHECKING([for Python CPPFLAGS])
3233         python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3234         python_config_status=$?
3236         if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3237         then
3238                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3239                 with_python="no"
3240         else
3241                 AC_MSG_RESULT([$python_include_path])
3242         fi
3243 fi
3245 if test "x$with_python" = "xyes"
3246 then
3247         CPPFLAGS="-I$python_include_path $CPPFLAGS"
3248         AC_CHECK_HEADERS(Python.h,
3249                          [with_python="yes"],
3250                          [with_python="no ('Python.h' not found)"])
3251 fi
3253 if test "x$with_python" = "xyes"
3254 then
3255         AC_MSG_CHECKING([for Python LDFLAGS])
3256         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`
3257         python_config_status=$?
3259         if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3260         then
3261                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3262                 with_python="no"
3263         else
3264                 AC_MSG_RESULT([$python_library_path])
3265         fi
3266 fi
3268 if test "x$with_python" = "xyes"
3269 then
3270         AC_MSG_CHECKING([for Python LIBS])
3271         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`
3272         python_config_status=$?
3274         if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3275         then
3276                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3277                 with_python="no"
3278         else
3279                 AC_MSG_RESULT([$python_library_flags])
3280         fi
3281 fi
3283 if test "x$with_python" = "xyes"
3284 then
3285         LDFLAGS="-L$python_library_path $LDFLAGS"
3286         LIBS="$python_library_flags $LIBS"
3288         AC_CHECK_FUNC(PyObject_CallFunction,
3289                       [with_python="yes"],
3290                       [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3291 fi
3293 PATH="$SAVE_PATH"
3294 CPPFLAGS="$SAVE_CPPFLAGS"
3295 LDFLAGS="$SAVE_LDFLAGS"
3296 LIBS="$SAVE_LIBS"
3298 if test "x$with_python" = "xyes"
3299 then
3300         BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3301         BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3302         BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3303         AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3304         AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3305         AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3306 fi
3307 # }}} --with-python
3309 # --with-librabbitmq {{{
3310 with_librabbitmq_cppflags=""
3311 with_librabbitmq_ldflags=""
3312 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3314         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3315         then
3316                 with_librabbitmq_cppflags="-I$withval/include"
3317                 with_librabbitmq_ldflags="-L$withval/lib"
3318                 with_librabbitmq="yes"
3319         else
3320                 with_librabbitmq="$withval"
3321         fi
3322 ],
3324         with_librabbitmq="yes"
3325 ])
3326 if test "x$with_librabbitmq" = "xyes"
3327 then
3328         SAVE_CPPFLAGS="$CPPFLAGS"
3329         CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3331         AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3333         CPPFLAGS="$SAVE_CPPFLAGS"
3334 fi
3335 if test "x$with_librabbitmq" = "xyes"
3336 then
3337         SAVE_CPPFLAGS="$CPPFLAGS"
3338         SAVE_LDFLAGS="$LDFLAGS"
3339         CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3340         LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3342         AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3344         CPPFLAGS="$SAVE_CPPFLAGS"
3345         LDFLAGS="$SAVE_LDFLAGS"
3346 fi
3347 if test "x$with_librabbitmq" = "xyes"
3348 then
3349         BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3350         BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3351         BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3352         AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3353         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3354         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3355         AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3356 fi
3357 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3358 # }}}
3360 # --with-librouteros {{{
3361 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3363  if test "x$withval" = "xyes"
3364  then
3365          with_librouteros="yes"
3366  else if test "x$withval" = "xno"
3367  then
3368          with_librouteros="no"
3369  else
3370          with_librouteros="yes"
3371          LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3372          LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3373  fi; fi
3374 ],
3375 [with_librouteros="yes"])
3377 SAVE_CPPFLAGS="$CPPFLAGS"
3378 SAVE_LDFLAGS="$LDFLAGS"
3380 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3381 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3383 if test "x$with_librouteros" = "xyes"
3384 then
3385         if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3386         then
3387                 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3388         fi
3389         AC_CHECK_HEADERS(routeros_api.h,
3390         [with_librouteros="yes"],
3391         [with_librouteros="no (routeros_api.h not found)"])
3392 fi
3393 if test "x$with_librouteros" = "xyes"
3394 then
3395         if test "x$LIBROUTEROS_LDFLAGS" != "x"
3396         then
3397                 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3398         fi
3399         AC_CHECK_LIB(routeros, ros_interface,
3400         [with_librouteros="yes"],
3401         [with_librouteros="no (symbol 'ros_interface' not found)"])
3402 fi
3404 CPPFLAGS="$SAVE_CPPFLAGS"
3405 LDFLAGS="$SAVE_LDFLAGS"
3407 if test "x$with_librouteros" = "xyes"
3408 then
3409         BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3410         BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3411         AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3412         AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3413 fi
3414 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3415 # }}}
3417 # --with-librrd {{{
3418 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3419 librrd_cflags=""
3420 librrd_ldflags=""
3421 librrd_threadsafe="yes"
3422 librrd_rrdc_update="no"
3423 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3424 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
3425         then
3426                 librrd_cflags="-I$withval/include"
3427                 librrd_ldflags="-L$withval/lib"
3428                 with_librrd="yes"
3429         else
3430                 with_librrd="$withval"
3431         fi
3432 ], [with_librrd="yes"])
3433 if test "x$with_librrd" = "xyes"
3434 then
3435         SAVE_CPPFLAGS="$CPPFLAGS"
3436         SAVE_LDFLAGS="$LDFLAGS"
3438         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3439         LDFLAGS="$LDFLAGS $librrd_ldflags"
3441         AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3443         CPPFLAGS="$SAVE_CPPFLAGS"
3444         LDFLAGS="$SAVE_LDFLAGS"
3445 fi
3446 if test "x$with_librrd" = "xyes"
3447 then
3448         SAVE_CPPFLAGS="$CPPFLAGS"
3449         SAVE_LDFLAGS="$LDFLAGS"
3451         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3452         LDFLAGS="$LDFLAGS $librrd_ldflags"
3454         AC_CHECK_LIB(rrd_th, rrd_update_r,
3455         [with_librrd="yes"
3456          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3457         ],
3458         [librrd_threadsafe="no"
3459          AC_CHECK_LIB(rrd, rrd_update,
3460          [with_librrd="yes"
3461           librrd_ldflags="$librrd_ldflags -lrrd -lm"
3462          ],
3463          [with_librrd="no (symbol 'rrd_update' not found)"],
3464          [-lm])
3465         ],
3466         [-lm])
3468         if test "x$librrd_threadsafe" = "xyes"
3469         then
3470                 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3471         else
3472                 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3473         fi
3475         CPPFLAGS="$SAVE_CPPFLAGS"
3476         LDFLAGS="$SAVE_LDFLAGS"
3477 fi
3478 if test "x$with_librrd" = "xyes"
3479 then
3480         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3481         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3482         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3483         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3484 fi
3485 if test "x$librrd_threadsafe" = "xyes"
3486 then
3487         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3488 fi
3489 # }}}
3491 # --with-libsensors {{{
3492 with_sensors_cflags=""
3493 with_sensors_ldflags=""
3494 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3496         if test "x$withval" = "xno"
3497         then
3498                 with_libsensors="no"
3499         else
3500                 with_libsensors="yes"
3501                 if test "x$withval" != "xyes"
3502                 then
3503                         with_sensors_cflags="-I$withval/include"
3504                         with_sensors_ldflags="-L$withval/lib"
3505                         with_libsensors="yes"
3506                 fi
3507         fi
3508 ],
3510         if test "x$ac_system" = "xLinux"
3511         then
3512                 with_libsensors="yes"
3513         else
3514                 with_libsensors="no (Linux only library)"
3515         fi
3516 ])
3517 if test "x$with_libsensors" = "xyes"
3518 then
3519         SAVE_CPPFLAGS="$CPPFLAGS"
3520         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3522 #       AC_CHECK_HEADERS(sensors/sensors.h,
3523 #       [
3524 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3525 #       ],
3526 #       [with_libsensors="no (sensors/sensors.h not found)"])
3527         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3529         CPPFLAGS="$SAVE_CPPFLAGS"
3530 fi
3531 if test "x$with_libsensors" = "xyes"
3532 then
3533         SAVE_CPPFLAGS="$CPPFLAGS"
3534         SAVE_LDFLAGS="$LDFLAGS"
3535         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3536         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3538         AC_CHECK_LIB(sensors, sensors_init,
3539         [
3540                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3541         ],
3542         [with_libsensors="no (libsensors not found)"])
3544         CPPFLAGS="$SAVE_CPPFLAGS"
3545         LDFLAGS="$SAVE_LDFLAGS"
3546 fi
3547 if test "x$with_libsensors" = "xyes"
3548 then
3549         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3550         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3551         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3552         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3553 fi
3554 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3555 # }}}
3557 # --with-libstatgrab {{{
3558 with_libstatgrab_cflags=""
3559 with_libstatgrab_ldflags=""
3560 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3562  if test "x$withval" != "xno" \
3563    && test "x$withval" != "xyes"
3564  then
3565    with_libstatgrab_cflags="-I$withval/include"
3566    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3567    with_libstatgrab="yes"
3568    with_libstatgrab_pkg_config="no"
3569  else
3570    with_libstatgrab="$withval"
3571    with_libstatgrab_pkg_config="yes"
3572  fi
3573  ],
3575  with_libstatgrab="yes"
3576  with_libstatgrab_pkg_config="yes"
3577 ])
3579 if test "x$with_libstatgrab" = "xyes" \
3580   && test "x$with_libstatgrab_pkg_config" = "xyes"
3581 then
3582   if test "x$PKG_CONFIG" != "x"
3583   then
3584     AC_MSG_CHECKING([pkg-config for libstatgrab])
3585     temp_result="found"
3586     $PKG_CONFIG --exists libstatgrab 2>/dev/null
3587     if test "$?" != "0"
3588     then
3589       with_libstatgrab_pkg_config="no"
3590       with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3591       temp_result="not found"
3592     fi
3593     AC_MSG_RESULT([$temp_result])
3594   else
3595     AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3596     with_libstatgrab_pkg_config="no"
3597     with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3598   fi
3599 fi
3601 if test "x$with_libstatgrab" = "xyes" \
3602   && test "x$with_libstatgrab_pkg_config" = "xyes" \
3603   && test "x$with_libstatgrab_cflags" = "x"
3604 then
3605   AC_MSG_CHECKING([for libstatgrab CFLAGS])
3606   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3607   if test "$?" = "0"
3608   then
3609     with_libstatgrab_cflags="$temp_result"
3610   else
3611     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3612     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3613   fi
3614   AC_MSG_RESULT([$temp_result])
3615 fi
3617 if test "x$with_libstatgrab" = "xyes" \
3618   && test "x$with_libstatgrab_pkg_config" = "xyes" \
3619   && test "x$with_libstatgrab_ldflags" = "x"
3620 then
3621   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3622   temp_result="`$PKG_CONFIG --libs libstatgrab`"
3623   if test "$?" = "0"
3624   then
3625     with_libstatgrab_ldflags="$temp_result"
3626   else
3627     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3628     temp_result="$PKG_CONFIG --libs libstatgrab failed"
3629   fi
3630   AC_MSG_RESULT([$temp_result])
3631 fi
3633 if test "x$with_libstatgrab" = "xyes"
3634 then
3635   SAVE_CPPFLAGS="$CPPFLAGS"
3636   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3638   AC_CHECK_HEADERS(statgrab.h,
3639                    [with_libstatgrab="yes"],
3640                    [with_libstatgrab="no (statgrab.h not found)"])
3642   CPPFLAGS="$SAVE_CPPFLAGS"
3643 fi
3645 if test "x$with_libstatgrab" = "xyes"
3646 then
3647   SAVE_CFLAGS="$CFLAGS"
3648   SAVE_LDFLAGS="$LDFLAGS"
3650   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3651   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3653   AC_CHECK_LIB(statgrab, sg_init,
3654                [with_libstatgrab="yes"],
3655                [with_libstatgrab="no (symbol sg_init not found)"])
3657   CFLAGS="$SAVE_CFLAGS"
3658   LDFLAGS="$SAVE_LDFLAGS"
3659 fi
3661 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3662 if test "x$with_libstatgrab" = "xyes"
3663 then
3664   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3665   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3666   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3667   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3668   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3669 fi
3670 # }}}
3672 # --with-libtokyotyrant {{{
3673 with_libtokyotyrant_cppflags=""
3674 with_libtokyotyrant_ldflags=""
3675 with_libtokyotyrant_libs=""
3676 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3678   if test "x$withval" = "xno"
3679   then
3680     with_libtokyotyrant="no"
3681   else if test "x$withval" = "xyes"
3682   then
3683     with_libtokyotyrant="yes"
3684   else
3685     with_libtokyotyrant_cppflags="-I$withval/include"
3686     with_libtokyotyrant_ldflags="-L$withval/include"
3687     with_libtokyotyrant_libs="-ltokyotyrant"
3688     with_libtokyotyrant="yes"
3689   fi; fi
3690 ],
3692   with_libtokyotyrant="yes"
3693 ])
3695 if test "x$with_libtokyotyrant" = "xyes"
3696 then
3697   if $PKG_CONFIG --exists tokyotyrant
3698   then
3699     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3700     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3701     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3702   fi
3703 fi
3705 SAVE_CPPFLAGS="$CPPFLAGS"
3706 SAVE_LDFLAGS="$LDFLAGS"
3707 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3708 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3710 if test "x$with_libtokyotyrant" = "xyes"
3711 then
3712   AC_CHECK_HEADERS(tcrdb.h,
3713   [
3714           AC_DEFINE(HAVE_TCRDB_H, 1,
3715                     [Define to 1 if you have the <tcrdb.h> header file.])
3716   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3717 fi
3719 if test "x$with_libtokyotyrant" = "xyes"
3720 then
3721   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3722   [
3723           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3724                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3725   ],
3726   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3727   [$with_libtokyotyrant_libs])
3728 fi
3730 CPPFLAGS="$SAVE_CPPFLAGS"
3731 LDFLAGS="$SAVE_LDFLAGS"
3733 if test "x$with_libtokyotyrant" = "xyes"
3734 then 
3735   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3736   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3737   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3738   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3739   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3740   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3741 fi
3742 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3743 # }}}
3745 # --with-libupsclient {{{
3746 with_libupsclient_config=""
3747 with_libupsclient_cflags=""
3748 with_libupsclient_libs=""
3749 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3751         if test "x$withval" = "xno"
3752         then
3753                 with_libupsclient="no"
3754         else if test "x$withval" = "xyes"
3755         then
3756                 with_libupsclient="use_pkgconfig"
3757         else
3758                 if test -x "$withval"
3759                 then
3760                         with_libupsclient_config="$withval"
3761                         with_libupsclient="use_libupsclient_config"
3762                 else if test -x "$withval/bin/libupsclient-config"
3763                 then
3764                         with_libupsclient_config="$withval/bin/libupsclient-config"
3765                         with_libupsclient="use_libupsclient_config"
3766                 else
3767                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3768                         with_libupsclient_cflags="-I$withval/include"
3769                         with_libupsclient_libs="-L$withval/lib -lupsclient"
3770                         with_libupsclient="yes"
3771                 fi; fi
3772         fi; fi
3773 ],
3774 [with_libupsclient="use_pkgconfig"])
3776 # configure using libupsclient-config
3777 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3778 then
3779         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3780         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3781         if test $? -ne 0
3782         then
3783                 with_libupsclient="no ($with_libupsclient_config failed)"
3784         fi
3785         with_libupsclient_libs="`$with_libupsclient_config --libs`"
3786         if test $? -ne 0
3787         then
3788                 with_libupsclient="no ($with_libupsclient_config failed)"
3789         fi
3790 fi
3791 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3792 then
3793         with_libupsclient="yes"
3794 fi
3796 # configure using pkg-config
3797 if test "x$with_libupsclient" = "xuse_pkgconfig"
3798 then
3799         if test "x$PKG_CONFIG" = "x"
3800         then
3801                 with_libupsclient="no (Don't have pkg-config)"
3802         fi
3803 fi
3804 if test "x$with_libupsclient" = "xuse_pkgconfig"
3805 then
3806         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3807         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3808         if test $? -ne 0
3809         then
3810                 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3811         fi
3812 fi
3813 if test "x$with_libupsclient" = "xuse_pkgconfig"
3814 then
3815         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3816         if test $? -ne 0
3817         then
3818                 with_libupsclient="no ($PKG_CONFIG failed)"
3819         fi
3820         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3821         if test $? -ne 0
3822         then
3823                 with_libupsclient="no ($PKG_CONFIG failed)"
3824         fi
3825 fi
3826 if test "x$with_libupsclient" = "xuse_pkgconfig"
3827 then
3828         with_libupsclient="yes"
3829 fi
3831 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3832 # the actual checks.
3833 if test "x$with_libupsclient" = "xyes"
3834 then
3835         SAVE_CPPFLAGS="$CPPFLAGS"
3836         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3838         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3840         CPPFLAGS="$SAVE_CPPFLAGS"
3841 fi
3842 if test "x$with_libupsclient" = "xyes"
3843 then
3844         SAVE_CPPFLAGS="$CPPFLAGS"
3845         SAVE_LDFLAGS="$LDFLAGS"
3847         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3848         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3850         AC_CHECK_LIB(upsclient, upscli_connect,
3851                      [with_libupsclient="yes"],
3852                      [with_libupsclient="no (symbol upscli_connect not found)"])
3854         CPPFLAGS="$SAVE_CPPFLAGS"
3855         LDFLAGS="$SAVE_LDFLAGS"
3856 fi
3857 if test "x$with_libupsclient" = "xyes"
3858 then
3859         SAVE_CPPFLAGS="$CPPFLAGS"
3860         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3862         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3863 [#include <stdlib.h>
3864 #include <stdio.h>
3865 #include <upsclient.h>])
3867         CPPFLAGS="$SAVE_CPPFLAGS"
3868 fi
3869 if test "x$with_libupsclient" = "xyes"
3870 then
3871         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3872         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3873         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3874         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3875 fi
3876 # }}}
3878 # --with-libxmms {{{
3879 with_xmms_config="xmms-config"
3880 with_xmms_cflags=""
3881 with_xmms_libs=""
3882 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3884         if test "x$withval" != "xno" \
3885                 && test "x$withval" != "xyes"
3886         then
3887                 if test -f "$withval" && test -x "$withval";
3888                 then
3889                         with_xmms_config="$withval"
3890                 else if test -x "$withval/bin/xmms-config"
3891                 then
3892                         with_xmms_config="$withval/bin/xmms-config"
3893                 fi; fi
3894                 with_libxmms="yes"
3895         else if test "x$withval" = "xno"
3896         then
3897                 with_libxmms="no"
3898         else
3899                 with_libxmms="yes"
3900         fi; fi
3901 ],
3903         with_libxmms="yes"
3904 ])
3905 if test "x$with_libxmms" = "xyes"
3906 then
3907         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3908         xmms_config_status=$?
3910         if test $xmms_config_status -ne 0
3911         then
3912                 with_libxmms="no"
3913         fi
3914 fi
3915 if test "x$with_libxmms" = "xyes"
3916 then
3917         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3918         xmms_config_status=$?
3920         if test $xmms_config_status -ne 0
3921         then
3922                 with_libxmms="no"
3923         fi
3924 fi
3925 if test "x$with_libxmms" = "xyes"
3926 then
3927         AC_CHECK_LIB(xmms, xmms_remote_get_info,
3928         [
3929                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3930                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3931                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3932                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3933         ],
3934         [
3935                 with_libxmms="no"
3936         ],
3937         [$with_xmms_libs])
3938 fi
3939 with_libxmms_numeric=0
3940 if test "x$with_libxmms" = "xyes"
3941 then
3942         with_libxmms_numeric=1
3943 fi
3944 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3945 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3946 # }}}
3948 # --with-libyajl {{{
3949 with_libyajl_cppflags=""
3950 with_libyajl_ldflags=""
3951 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3953         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3954         then
3955                 with_libyajl_cppflags="-I$withval/include"
3956                 with_libyajl_ldflags="-L$withval/lib"
3957                 with_libyajl="yes"
3958         else
3959                 with_libyajl="$withval"
3960         fi
3961 ],
3963         with_libyajl="yes"
3964 ])
3965 if test "x$with_libyajl" = "xyes"
3966 then
3967         SAVE_CPPFLAGS="$CPPFLAGS"
3968         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3970         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3971         AC_CHECK_HEADERS(yajl/yajl_version.h)
3973         CPPFLAGS="$SAVE_CPPFLAGS"
3974 fi
3975 if test "x$with_libyajl" = "xyes"
3976 then
3977         SAVE_CPPFLAGS="$CPPFLAGS"
3978         SAVE_LDFLAGS="$LDFLAGS"
3979         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3980         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3982         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3984         CPPFLAGS="$SAVE_CPPFLAGS"
3985         LDFLAGS="$SAVE_LDFLAGS"
3986 fi
3987 if test "x$with_libyajl" = "xyes"
3988 then
3989         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3990         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3991         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3992         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3993         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3994         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3995         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3996 fi
3997 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3998 # }}}
4000 # --with-libvarnish {{{
4001 with_libvarnish_cppflags=""
4002 with_libvarnish_cflags=""
4003 with_libvarnish_libs=""
4004 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4006         if test "x$withval" = "xno"
4007         then
4008                 with_libvarnish="no"
4009         else if test "x$withval" = "xyes"
4010         then
4011                 with_libvarnish="use_pkgconfig"
4012         else if test -d "$with_libvarnish/lib"
4013         then
4014                 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4015                 with_libvarnish_cflags="-I$withval/include"
4016                 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
4017                 with_libvarnish="yes"
4018         fi; fi; fi
4019 ],
4020 [with_libvarnish="use_pkgconfig"])
4022 # configure using pkg-config
4023 if test "x$with_libvarnish" = "xuse_pkgconfig"
4024 then
4025         if test "x$PKG_CONFIG" = "x"
4026         then
4027                 with_libvarnish="no (Don't have pkg-config)"
4028         fi
4029 fi
4030 if test "x$with_libvarnish" = "xuse_pkgconfig"
4031 then
4032         AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4033         $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4034         if test $? -ne 0
4035         then
4036                 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4037         fi
4038 fi
4039 if test "x$with_libvarnish" = "xuse_pkgconfig"
4040 then
4041         with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4042         if test $? -ne 0
4043         then
4044                 with_libvarnish="no ($PKG_CONFIG failed)"
4045         fi
4046         with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4047         if test $? -ne 0
4048         then
4049                 with_libvarnish="no ($PKG_CONFIG failed)"
4050         fi
4051 fi
4052 if test "x$with_libvarnish" = "xuse_pkgconfig"
4053 then
4054         with_libvarnish="yes"
4055 fi
4057 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4058 # the actual checks.
4059 if test "x$with_libvarnish" = "xyes"
4060 then
4061         SAVE_CPPFLAGS="$CPPFLAGS"
4062         CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4063         AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4065         CPPFLAGS="$SAVE_CPPFLAGS"
4066 fi
4067 if test "x$with_libvarnish" = "xyes"
4068 then
4069         SAVE_CPPFLAGS="$CPPFLAGS"
4070         #SAVE_LDFLAGS="$LDFLAGS"
4072         CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4073         #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4075         AC_CHECK_LIB(varnishapi, VSL_OpenStats,
4076                      [with_libvarnish="yes"],
4077                      [with_libvarnish="no (symbol VSL_OpenStats not found)"],
4078                      [$with_libvarnish_libs])
4080         CPPFLAGS="$SAVE_CPPFLAGS"
4081         #LDFLAGS="$SAVE_LDFLAGS"
4082 fi
4083 if test "x$with_libvarnish" = "xyes"
4084 then
4085         BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4086         BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4087         AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4088         AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4089 fi
4090 # }}}
4092 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4093 with_libxml2="no (pkg-config isn't available)"
4094 with_libxml2_cflags=""
4095 with_libxml2_ldflags=""
4096 with_libvirt="no (pkg-config isn't available)"
4097 with_libvirt_cflags=""
4098 with_libvirt_ldflags=""
4099 if test "x$PKG_CONFIG" != "x"
4100 then
4101         pkg-config --exists 'libxml-2.0' 2>/dev/null
4102         if test "$?" = "0"
4103         then
4104                 with_libxml2="yes"
4105         else
4106                 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4107         fi
4109         pkg-config --exists libvirt 2>/dev/null
4110         if test "$?" = "0"
4111         then
4112                 with_libvirt="yes"
4113         else
4114                 with_libvirt="no (pkg-config doesn't know libvirt)"
4115         fi
4116 fi
4117 if test "x$with_libxml2" = "xyes"
4118 then
4119         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4120         if test $? -ne 0
4121         then
4122                 with_libxml2="no"
4123         fi
4124         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4125         if test $? -ne 0
4126         then
4127                 with_libxml2="no"
4128         fi
4129 fi
4130 if test "x$with_libxml2" = "xyes"
4131 then
4132         SAVE_CPPFLAGS="$CPPFLAGS"
4133         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4135         AC_CHECK_HEADERS(libxml/parser.h, [],
4136                       [with_libxml2="no (libxml/parser.h not found)"])
4138         CPPFLAGS="$SAVE_CPPFLAGS"
4139 fi
4140 if test "x$with_libxml2" = "xyes"
4141 then
4142         SAVE_CFLAGS="$CFLAGS"
4143         SAVE_LDFLAGS="$LDFLAGS"
4145         CFLAGS="$CFLAGS $with_libxml2_cflags"
4146         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4148         AC_CHECK_LIB(xml2, xmlXPathEval,
4149                      [with_libxml2="yes"],
4150                      [with_libxml2="no (symbol xmlXPathEval not found)"])
4152         CFLAGS="$SAVE_CFLAGS"
4153         LDFLAGS="$SAVE_LDFLAGS"
4154 fi
4155 dnl Add the right compiler flags and libraries.
4156 if test "x$with_libxml2" = "xyes"; then
4157         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4158         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4159         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4160         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4161 fi
4162 if test "x$with_libvirt" = "xyes"
4163 then
4164         with_libvirt_cflags="`pkg-config --cflags libvirt`"
4165         if test $? -ne 0
4166         then
4167                 with_libvirt="no"
4168         fi
4169         with_libvirt_ldflags="`pkg-config --libs libvirt`"
4170         if test $? -ne 0
4171         then
4172                 with_libvirt="no"
4173         fi
4174 fi
4175 if test "x$with_libvirt" = "xyes"
4176 then
4177         SAVE_CPPFLAGS="$CPPFLAGS"
4178         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4180         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4181                       [with_libvirt="no (libvirt/libvirt.h not found)"])
4183         CPPFLAGS="$SAVE_CPPFLAGS"
4184 fi
4185 if test "x$with_libvirt" = "xyes"
4186 then
4187         SAVE_CFLAGS="$CFLAGS"
4188         SAVE_LDFLAGS="$LDFLAGS"
4190         CFLAGS="$CFLAGS $with_libvirt_cflags"
4191         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4193         AC_CHECK_LIB(virt, virDomainBlockStats,
4194                      [with_libvirt="yes"],
4195                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
4197         CFLAGS="$SAVE_CFLAGS"
4198         LDFLAGS="$SAVE_LDFLAGS"
4199 fi
4200 dnl Add the right compiler flags and libraries.
4201 if test "x$with_libvirt" = "xyes"; then
4202         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4203         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4204         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4205         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4206 fi
4207 # }}}
4209 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4210 with_libopenipmipthread="yes"
4211 with_libopenipmipthread_cflags=""
4212 with_libopenipmipthread_libs=""
4214 AC_MSG_CHECKING([for pkg-config])
4215 temp_result="no"
4216 if test "x$PKG_CONFIG" = "x"
4217 then
4218         with_libopenipmipthread="no"
4219         temp_result="no"
4220 else
4221         temp_result="$PKG_CONFIG"
4222 fi
4223 AC_MSG_RESULT([$temp_result])
4225 if test "x$with_libopenipmipthread" = "xyes"
4226 then
4227         AC_MSG_CHECKING([for libOpenIPMIpthread])
4228         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4229         if test "$?" != "0"
4230         then
4231                 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4232         fi
4233         AC_MSG_RESULT([$with_libopenipmipthread])
4234 fi
4236 if test "x$with_libopenipmipthread" = "xyes"
4237 then
4238         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4239         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4240         if test "$?" = "0"
4241         then
4242                 with_libopenipmipthread_cflags="$temp_result"
4243         else
4244                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4245                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4246         fi
4247         AC_MSG_RESULT([$temp_result])
4248 fi
4250 if test "x$with_libopenipmipthread" = "xyes"
4251 then
4252         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4253         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4254         if test "$?" = "0"
4255         then
4256                 with_libopenipmipthread_ldflags="$temp_result"
4257         else
4258                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4259                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4260         fi
4261         AC_MSG_RESULT([$temp_result])
4262 fi
4264 if test "x$with_libopenipmipthread" = "xyes"
4265 then
4266         SAVE_CPPFLAGS="$CPPFLAGS"
4267         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4269         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4270                          [with_libopenipmipthread="yes"],
4271                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4272 [#include <OpenIPMI/ipmiif.h>
4273 #include <OpenIPMI/ipmi_err.h>
4274 #include <OpenIPMI/ipmi_posix.h>
4275 #include <OpenIPMI/ipmi_conn.h>
4276 ])
4278         CPPFLAGS="$SAVE_CPPFLAGS"
4279 fi
4281 if test "x$with_libopenipmipthread" = "xyes"
4282 then
4283         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4284         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4285         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4286         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4287 fi
4288 # }}}
4290 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4291                 [with_libnotify="yes"],
4292                 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4293                          with_libnotify="no"
4294                  else
4295                          with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4296                  fi])
4298 # Check for enabled/disabled features
4301 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4302 # ------------------------------------------------------------
4303 dnl
4304 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4305 dnl
4306 AC_DEFUN(
4307         [AC_COLLECTD],
4308         [
4309         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4310         m4_if(
4311                 [$2],
4312                 [enable],
4313                 [dnl
4314                 m4_define([EnDis],[disabled])dnl
4315                 m4_define([YesNo],[no])dnl
4316                 ],dnl
4317                 [m4_if(
4318                         [$2],
4319                         [disable],
4320                         [dnl
4321                         m4_define([EnDis],[enabled])dnl
4322                         m4_define([YesNo],[yes])dnl
4323                         ],
4324                         [dnl
4325                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4326                         ]dnl
4327                 )]dnl
4328         )dnl
4329         m4_if([$3], [feature], [],
4330                 [m4_if(
4331                         [$3], [module], [],
4332                         [dnl
4333                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4334                         ]dnl
4335                 )]dnl
4336         )dnl
4337         AC_ARG_ENABLE(
4338                 [$1],
4339                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4340                 [],
4341                 enable_$1='[YesNo]'dnl
4342         )# AC_ARG_ENABLE
4343 if test "x$enable_$1" = "xno"
4344 then
4345         collectd_$1=0
4346 else
4347         if test "x$enable_$1" = "xyes"
4348         then
4349                 collectd_$1=1
4350         else
4351                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4352                 collectd_$1=1
4353                 enable_$1='yes'
4354         fi
4355 fi
4356         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4357         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4358         ]dnl
4359 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4361 # AC_PLUGIN(name, default, info)
4362 # ------------------------------------------------------------
4363 dnl
4364 AC_DEFUN(
4365   [AC_PLUGIN],
4366   [
4367     enable_plugin="no"
4368     force="no"
4369     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4370     [
4371      if test "x$enableval" = "xyes"
4372      then
4373              enable_plugin="yes"
4374      else if test "x$enableval" = "xforce"
4375      then
4376              enable_plugin="yes"
4377              force="yes"
4378      else
4379              enable_plugin="no (disabled on command line)"
4380      fi; fi
4381     ],
4382     [
4383          if test "x$enable_all_plugins" = "xauto"
4384          then
4385              if test "x$2" = "xyes"
4386              then
4387                      enable_plugin="yes"
4388              else
4389                      enable_plugin="no"
4390              fi
4391          else
4392              enable_plugin="$enable_all_plugins"
4393          fi
4394     ])
4395     if test "x$enable_plugin" = "xyes"
4396     then
4397             if test "x$2" = "xyes" || test "x$force" = "xyes"
4398             then
4399                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4400                     if test "x$2" != "xyes"
4401                     then
4402                             dependency_warning="yes"
4403                     fi
4404             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4405                     dependency_error="yes"
4406                     enable_plugin="no (dependency error)"
4407             fi
4408     fi
4409     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4410     enable_$1="$enable_plugin"
4411   ]
4412 )# AC_PLUGIN(name, default, info)
4414 m4_divert_once([HELP_ENABLE], [
4415 collectd features:])
4416 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4417 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
4418 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
4419 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
4421 dependency_warning="no"
4422 dependency_error="no"
4424 plugin_ascent="no"
4425 plugin_battery="no"
4426 plugin_bind="no"
4427 plugin_conntrack="no"
4428 plugin_contextswitch="no"
4429 plugin_cpu="no"
4430 plugin_cpufreq="no"
4431 plugin_curl_json="no"
4432 plugin_curl_xml="no"
4433 plugin_df="no"
4434 plugin_disk="no"
4435 plugin_entropy="no"
4436 plugin_interface="no"
4437 plugin_ipmi="no"
4438 plugin_ipvs="no"
4439 plugin_irq="no"
4440 plugin_libvirt="no"
4441 plugin_load="no"
4442 plugin_memory="no"
4443 plugin_multimeter="no"
4444 plugin_nfs="no"
4445 plugin_fscache="no"
4446 plugin_perl="no"
4447 plugin_processes="no"
4448 plugin_protocols="no"
4449 plugin_serial="no"
4450 plugin_swap="no"
4451 plugin_tape="no"
4452 plugin_tcpconns="no"
4453 plugin_ted="no"
4454 plugin_thermal="no"
4455 plugin_users="no"
4456 plugin_uptime="no"
4457 plugin_vmem="no"
4458 plugin_vserver="no"
4459 plugin_wireless="no"
4460 plugin_zfs_arc="no"
4462 # Linux
4463 if test "x$ac_system" = "xLinux"
4464 then
4465         plugin_battery="yes"
4466         plugin_conntrack="yes"
4467         plugin_contextswitch="yes"
4468         plugin_cpu="yes"
4469         plugin_cpufreq="yes"
4470         plugin_disk="yes"
4471         plugin_entropy="yes"
4472         plugin_interface="yes"
4473         plugin_irq="yes"
4474         plugin_load="yes"
4475         plugin_memory="yes"
4476         plugin_nfs="yes"
4477         plugin_fscache="yes"
4478         plugin_processes="yes"
4479         plugin_protocols="yes"
4480         plugin_serial="yes"
4481         plugin_swap="yes"
4482         plugin_tcpconns="yes"
4483         plugin_thermal="yes"
4484         plugin_uptime="yes"
4485         plugin_vmem="yes"
4486         plugin_vserver="yes"
4487         plugin_wireless="yes"
4489         if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4490         then
4491                 plugin_ipvs="yes"
4492         fi
4493 fi
4495 if test "x$ac_system" = "xOpenBSD"
4496 then
4497         plugin_tcpconns="yes"
4498 fi
4500 # Mac OS X devices
4501 if test "x$with_libiokit" = "xyes"
4502 then
4503         plugin_battery="yes"
4504         plugin_disk="yes"
4505 fi
4507 # AIX
4509 if test "x$ac_system" = "xAIX"
4510 then
4511         plugin_tcpconns="yes"
4512 fi
4514 if test "x$with_perfstat" = "xyes"
4515 then
4516         plugin_cpu="yes"
4517         plugin_disk="yes"
4518         plugin_memory="yes"
4519         plugin_swap="yes"
4520         plugin_interface="yes"
4521         plugin_load="yes"
4522 fi
4524 if test "x$with_procinfo" = "xyes"
4525 then
4526         plugin_processes="yes"
4527 fi
4529 # Solaris
4530 if test "x$with_kstat" = "xyes"
4531 then
4532         plugin_uptime="yes"
4533         plugin_zfs_arc="yes"
4534 fi
4536 if test "x$with_devinfo$with_kstat" = "xyesyes"
4537 then
4538         plugin_cpu="yes"
4539         plugin_disk="yes"
4540         plugin_interface="yes"
4541         plugin_memory="yes"
4542         plugin_tape="yes"
4543 fi
4545 # libstatgrab
4546 if test "x$with_libstatgrab" = "xyes"
4547 then
4548         plugin_cpu="yes"
4549         plugin_disk="yes"
4550         plugin_interface="yes"
4551         plugin_load="yes"
4552         plugin_memory="yes"
4553         plugin_swap="yes"
4554         plugin_users="yes"
4555 fi
4557 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4558 then
4559         plugin_ascent="yes"
4560         if test "x$have_strptime" = "xyes"
4561         then
4562                 plugin_bind="yes"
4563         fi
4564 fi
4566 if test "x$with_libopenipmipthread" = "xyes"
4567 then
4568         plugin_ipmi="yes"
4569 fi
4571 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4572 then
4573         plugin_curl_json="yes"
4574 fi
4576 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4577 then
4578         plugin_curl_xml="yes"
4579 fi
4581 if test "x$have_processor_info" = "xyes"
4582 then
4583         plugin_cpu="yes"
4584 fi
4585 if test "x$have_sysctl" = "xyes"
4586 then
4587         plugin_cpu="yes"
4588         plugin_memory="yes"
4589         plugin_uptime="yes"
4590         if test "x$ac_system" = "xDarwin"
4591         then
4592                 plugin_swap="yes"
4593         fi
4594 fi
4595 if test "x$have_sysctlbyname" = "xyes"
4596 then
4597         plugin_contextswitch="yes"
4598         plugin_cpu="yes"
4599         plugin_memory="yes"
4600         plugin_tcpconns="yes"
4601 fi
4603 # Df plugin: Check if we know how to determine mount points first.
4604 #if test "x$have_listmntent" = "xyes"; then
4605 #       plugin_df="yes"
4606 #fi
4607 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4608 then
4609         plugin_df="yes"
4610 fi
4611 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4612 then
4613         plugin_df="yes"
4614 fi
4615 #if test "x$have_getmntent" = "xseq"
4616 #then
4617 #       plugin_df="yes"
4618 #fi
4619 if test "x$c_cv_have_one_getmntent" = "xyes"
4620 then
4621         plugin_df="yes"
4622 fi
4624 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4625 if test "x$plugin_df" = "xyes"
4626 then
4627         plugin_df="no"
4628         if test "x$have_statfs" = "xyes"
4629         then
4630                 plugin_df="yes"
4631         fi
4632         if test "x$have_statvfs" = "xyes"
4633         then
4634                 plugin_df="yes"
4635         fi
4636 fi
4638 if test "x$have_getifaddrs" = "xyes"
4639 then
4640         plugin_interface="yes"
4641 fi
4643 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4644 then
4645         plugin_libvirt="yes"
4646 fi
4648 if test "x$have_getloadavg" = "xyes"
4649 then
4650         plugin_load="yes"
4651 fi
4653 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4654 then
4655         plugin_perl="yes"
4656 fi
4658 # Mac OS X memory interface
4659 if test "x$have_host_statistics" = "xyes"
4660 then
4661         plugin_memory="yes"
4662 fi
4664 if test "x$have_termios_h" = "xyes"
4665 then
4666         plugin_multimeter="yes"
4667         plugin_ted="yes"
4668 fi
4670 if test "x$have_thread_info" = "xyes"
4671 then
4672         plugin_processes="yes"
4673 fi
4675 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4676 then
4677         plugin_processes="yes"
4678 fi
4680 if test "x$with_kvm_getswapinfo" = "xyes"
4681 then
4682         plugin_swap="yes"
4683 fi
4685 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4686 then
4687         plugin_swap="yes"
4688 fi
4690 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4691 then
4692         plugin_tcpconns="yes"
4693 fi
4695 if test "x$have_getutent" = "xyes"
4696 then
4697         plugin_users="yes"
4698 fi
4699 if test "x$have_getutxent" = "xyes"
4700 then
4701         plugin_users="yes"
4702 fi
4704 m4_divert_once([HELP_ENABLE], [
4705 collectd plugins:])
4707 AC_ARG_ENABLE([all-plugins],
4708                 AC_HELP_STRING([--enable-all-plugins],
4709                                 [enable all plugins (auto by def)]),
4710                 [
4711                  if test "x$enableval" = "xyes"
4712                  then
4713                          enable_all_plugins="yes"
4714                  else if test "x$enableval" = "xauto"
4715                  then
4716                          enable_all_plugins="auto"
4717                  else
4718                          enable_all_plugins="no"
4719                  fi; fi
4720                 ],
4721                 [enable_all_plugins="auto"])
4723 m4_divert_once([HELP_ENABLE], [])
4725 AC_PLUGIN([amqp],        [$with_librabbitmq],  [AMQP output plugin])
4726 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
4727 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
4728 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
4729 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
4730 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
4731 AC_PLUGIN([bind],        [$plugin_bind],       [ISC Bind nameserver statistics])
4732 AC_PLUGIN([conntrack],   [$plugin_conntrack],  [nf_conntrack statistics])
4733 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4734 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
4735 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
4736 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
4737 AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
4738 AC_PLUGIN([curl_json],   [$plugin_curl_json],    [CouchDB statistics])
4739 AC_PLUGIN([curl_xml],   [$plugin_curl_xml],    [CURL generic xml statistics])
4740 AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
4741 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
4742 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
4743 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
4744 AC_PLUGIN([email],       [yes],                [EMail statistics])
4745 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
4746 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
4747 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
4748 AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
4749 AC_PLUGIN([gmond],       [$with_libganglia],   [Ganglia plugin])
4750 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
4751 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
4752 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
4753 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
4754 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
4755 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
4756 AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
4757 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
4758 AC_PLUGIN([load],        [$plugin_load],       [System load])
4759 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
4760 AC_PLUGIN([lpar],        [$with_perfstat],     [AIX logical partitions statistics])
4761 AC_PLUGIN([madwifi],     [$have_linux_wireless_h], [Madwifi wireless statistics])
4762 AC_PLUGIN([match_empty_counter], [yes],        [The empty counter match])
4763 AC_PLUGIN([match_hashed], [yes],               [The hashed match])
4764 AC_PLUGIN([match_regex], [yes],                [The regex match])
4765 AC_PLUGIN([match_timediff], [yes],             [The timediff match])
4766 AC_PLUGIN([match_value], [yes],                [The value match])
4767 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
4768 AC_PLUGIN([md],          [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4769 AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
4770 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
4771 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
4772 AC_PLUGIN([modbus],      [$with_libmodbus],    [Modbus plugin])
4773 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
4774 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
4775 AC_PLUGIN([netapp],      [$with_libnetapp],    [NetApp plugin])
4776 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
4777 AC_PLUGIN([network],     [yes],                [Network communication plugin])
4778 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
4779 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
4780 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4781 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
4782 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
4783 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
4784 AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
4785 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
4786 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
4787 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
4788 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
4789 # FIXME: Check for libevent, too.
4790 AC_PLUGIN([pinba],       [$have_protoc_c],     [Pinba statistics])
4791 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
4792 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
4793 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
4794 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
4795 AC_PLUGIN([protocols],   [$plugin_protocols],  [Protocol (IP, TCP, ...) statistics])
4796 AC_PLUGIN([python],      [$with_python],       [Embed a Python interpreter])
4797 AC_PLUGIN([redis],       [$with_libcredis],    [Redis plugin])
4798 AC_PLUGIN([routeros],    [$with_librouteros],  [RouterOS plugin])
4799 AC_PLUGIN([rrdcached],   [$librrd_rrdc_update], [RRDTool output plugin])
4800 AC_PLUGIN([rrdtool],     [$with_librrd],       [RRDTool output plugin])
4801 AC_PLUGIN([sensors],     [$with_libsensors],   [lm_sensors statistics])
4802 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
4803 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
4804 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
4805 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
4806 AC_PLUGIN([table],       [yes],                [Parsing of tabular data])
4807 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
4808 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
4809 AC_PLUGIN([target_notification], [yes],        [The notification target])
4810 AC_PLUGIN([target_replace], [yes],             [The replace target])
4811 AC_PLUGIN([target_scale],[yes],                [The scale target])
4812 AC_PLUGIN([target_set],  [yes],                [The set target])
4813 AC_PLUGIN([target_v5upgrade], [yes],           [The v5upgrade target])
4814 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
4815 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
4816 AC_PLUGIN([ted],         [$plugin_ted],        [Read The Energy Detective values])
4817 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
4818 AC_PLUGIN([threshold],   [yes],                [Threshold checking plugin])
4819 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant],  [TokyoTyrant database statistics])
4820 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
4821 AC_PLUGIN([uptime],      [$plugin_uptime],     [Uptime statistics])
4822 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
4823 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
4824 AC_PLUGIN([varnish],     [$with_libvarnish],   [Varnish cache statistics])
4825 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
4826 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
4827 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
4828 AC_PLUGIN([write_graphite], [yes],             [Graphite / Carbon output plugin])
4829 AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
4830 AC_PLUGIN([write_redis], [$with_libcredis],    [Redis output plugin])
4831 AC_PLUGIN([write_mongodb], [$with_libmongoc],  [MongoDB output plugin])
4832 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
4833 AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
4835 dnl Default configuration file
4836 # Load either syslog or logfile
4837 LOAD_PLUGIN_SYSLOG=""
4838 LOAD_PLUGIN_LOGFILE=""
4840 AC_MSG_CHECKING([which default log plugin to load])
4841 default_log_plugin="none"
4842 if test "x$enable_syslog" = "xyes"
4843 then
4844         default_log_plugin="syslog"
4845 else
4846         LOAD_PLUGIN_SYSLOG="##"
4847 fi
4849 if test "x$enable_logfile" = "xyes"
4850 then
4851         if test "x$default_log_plugin" = "xnone"
4852         then
4853                 default_log_plugin="logfile"
4854         else
4855                 LOAD_PLUGIN_LOGFILE="#"
4856         fi
4857 else
4858         LOAD_PLUGIN_LOGFILE="##"
4859 fi
4860 AC_MSG_RESULT([$default_log_plugin])
4862 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4863 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4865 DEFAULT_LOG_LEVEL="info"
4866 if test "x$enable_debug" = "xyes"
4867 then
4868         DEFAULT_LOG_LEVEL="debug"
4869 fi
4870 AC_SUBST(DEFAULT_LOG_LEVEL)
4872 # Load only one of rrdtool, network, csv in the default config.
4873 LOAD_PLUGIN_RRDTOOL=""
4874 LOAD_PLUGIN_NETWORK=""
4875 LOAD_PLUGIN_CSV=""
4877 AC_MSG_CHECKING([which default write plugin to load])
4878 default_write_plugin="none"
4879 if test "x$enable_rrdtool" = "xyes"
4880 then
4881         default_write_plugin="rrdtool"
4882 else
4883         LOAD_PLUGIN_RRDTOOL="##"
4884 fi
4886 if test "x$enable_network" = "xyes"
4887 then
4888         if test "x$default_write_plugin" = "xnone"
4889         then
4890                 default_write_plugin="network"
4891         else
4892                 LOAD_PLUGIN_NETWORK="#"
4893         fi
4894 else
4895         LOAD_PLUGIN_NETWORK="##"
4896 fi
4898 if test "x$enable_csv" = "xyes"
4899 then
4900         if test "x$default_write_plugin" = "xnone"
4901         then
4902                 default_write_plugin="csv"
4903         else
4904                 LOAD_PLUGIN_CSV="#"
4905         fi
4906 else
4907         LOAD_PLUGIN_CSV="##"
4908 fi
4909 AC_MSG_RESULT([$default_write_plugin])
4911 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4912 AC_SUBST(LOAD_PLUGIN_NETWORK)
4913 AC_SUBST(LOAD_PLUGIN_CSV)
4915 dnl ip_vs.h
4916 if test "x$ac_system" = "xLinux" \
4917         && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4918 then
4919         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4920 fi
4922 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4923 then
4924         enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4925 fi
4927 dnl Perl bindings
4928 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4930         if test "x$withval" != "xno" && test "x$withval" != "xyes"
4931         then
4932                 PERL_BINDINGS_OPTIONS="$withval"
4933                 with_perl_bindings="yes"
4934         else
4935                 PERL_BINDINGS_OPTIONS=""
4936                 with_perl_bindings="$withval"
4937         fi
4938 ],
4940         PERL_BINDINGS_OPTIONS=""
4941         if test -n "$perl_interpreter"
4942         then
4943                 with_perl_bindings="yes"
4944         else
4945                 with_perl_bindings="no (no perl interpreter found)"
4946         fi
4947 ])
4948 if test "x$with_perl_bindings" = "xyes"
4949 then
4950         PERL_BINDINGS="perl"
4951 else
4952         PERL_BINDINGS=""
4953 fi
4954 AC_SUBST(PERL_BINDINGS)
4955 AC_SUBST(PERL_BINDINGS_OPTIONS)
4957 dnl libcollectdclient
4958 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4959 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4960 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4962 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4964 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4966 AC_SUBST(LCC_VERSION_MAJOR)
4967 AC_SUBST(LCC_VERSION_MINOR)
4968 AC_SUBST(LCC_VERSION_PATCH)
4969 AC_SUBST(LCC_VERSION_EXTRA)
4970 AC_SUBST(LCC_VERSION_STRING)
4972 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4974 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4976 if test "x$with_librrd" = "xyes" \
4977         && test "x$librrd_threadsafe" != "xyes"
4978 then
4979         with_librrd="yes (warning: librrd is not thread-safe)"
4980 fi
4982 if test "x$with_libperl" = "xyes"
4983 then
4984         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4985 else
4986         enable_perl="no (needs libperl)"
4987 fi
4989 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4990 then
4991         enable_perl="no (libperl doesn't support ithreads)"
4992 fi
4994 if test "x$with_perl_bindings" = "xyes" \
4995         && test "x$PERL_BINDINGS_OPTIONS" != "x"
4996 then
4997         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4998 fi
5000 cat <<EOF;
5002 Configuration:
5003   Libraries:
5004     libcurl . . . . . . . $with_libcurl
5005     libdbi  . . . . . . . $with_libdbi
5006     libcredis . . . . . . $with_libcredis
5007     libesmtp  . . . . . . $with_libesmtp
5008     libganglia  . . . . . $with_libganglia
5009     libgcrypt . . . . . . $with_libgcrypt
5010     libiokit  . . . . . . $with_libiokit
5011     libiptc . . . . . . . $with_libiptc
5012     libjvm  . . . . . . . $with_java
5013     libkstat  . . . . . . $with_kstat
5014     libkvm  . . . . . . . $with_libkvm
5015     libmemcached  . . . . $with_libmemcached
5016     libmodbus . . . . . . $with_libmodbus
5017     libmysql  . . . . . . $with_libmysql
5018     libnetapp . . . . . . $with_libnetapp
5019     libnetlink  . . . . . $with_libnetlink
5020     libnetsnmp  . . . . . $with_libnetsnmp
5021     libnotify . . . . . . $with_libnotify
5022     liboconfig  . . . . . $with_liboconfig
5023     libopenipmi . . . . . $with_libopenipmipthread
5024     liboping  . . . . . . $with_liboping
5025     libpcap . . . . . . . $with_libpcap
5026     libperfstat . . . . . $with_perfstat
5027     libperl . . . . . . . $with_libperl
5028     libpq . . . . . . . . $with_libpq
5029     libpthread  . . . . . $with_libpthread
5030     librabbitmq . . . . . $with_librabbitmq
5031     librouteros . . . . . $with_librouteros
5032     librrd  . . . . . . . $with_librrd
5033     libsensors  . . . . . $with_libsensors
5034     libstatgrab . . . . . $with_libstatgrab
5035     libtokyotyrant  . . . $with_libtokyotyrant
5036     libupsclient  . . . . $with_libupsclient
5037     libvarnish  . . . . . $with_libvarnish
5038     libvirt . . . . . . . $with_libvirt
5039     libxml2 . . . . . . . $with_libxml2
5040     libxmms . . . . . . . $with_libxmms
5041     libyajl . . . . . . . $with_libyajl
5042     libevent  . . . . . . $with_libevent
5043     protobuf-c  . . . . . $have_protoc_c
5044     oracle  . . . . . . . $with_oracle
5045     python  . . . . . . . $with_python
5047   Features:
5048     daemon mode . . . . . $enable_daemon
5049     debug . . . . . . . . $enable_debug
5051   Bindings:
5052     perl  . . . . . . . . $with_perl_bindings
5054   Modules:
5055     amqp    . . . . . . . $enable_amqp
5056     apache  . . . . . . . $enable_apache
5057     apcups  . . . . . . . $enable_apcups
5058     apple_sensors . . . . $enable_apple_sensors
5059     ascent  . . . . . . . $enable_ascent
5060     battery . . . . . . . $enable_battery
5061     bind  . . . . . . . . $enable_bind
5062     conntrack . . . . . . $enable_conntrack
5063     contextswitch . . . . $enable_contextswitch
5064     cpu . . . . . . . . . $enable_cpu
5065     cpufreq . . . . . . . $enable_cpufreq
5066     csv . . . . . . . . . $enable_csv
5067     curl  . . . . . . . . $enable_curl
5068     curl_json . . . . . . $enable_curl_json
5069     curl_xml  . . . . . . $enable_curl_xml
5070     dbi . . . . . . . . . $enable_dbi
5071     df  . . . . . . . . . $enable_df
5072     disk  . . . . . . . . $enable_disk
5073     dns . . . . . . . . . $enable_dns
5074     email . . . . . . . . $enable_email
5075     entropy . . . . . . . $enable_entropy
5076     exec  . . . . . . . . $enable_exec
5077     filecount . . . . . . $enable_filecount
5078     fscache . . . . . . . $enable_fscache
5079     gmond . . . . . . . . $enable_gmond
5080     hddtemp . . . . . . . $enable_hddtemp
5081     interface . . . . . . $enable_interface
5082     ipmi  . . . . . . . . $enable_ipmi
5083     iptables  . . . . . . $enable_iptables
5084     ipvs  . . . . . . . . $enable_ipvs
5085     irq . . . . . . . . . $enable_irq
5086     java  . . . . . . . . $enable_java
5087     libvirt . . . . . . . $enable_libvirt
5088     load  . . . . . . . . $enable_load
5089     logfile . . . . . . . $enable_logfile
5090     lpar... . . . . . . . $enable_lpar
5091     madwifi . . . . . . . $enable_madwifi
5092     match_empty_counter . $enable_match_empty_counter
5093     match_hashed  . . . . $enable_match_hashed
5094     match_regex . . . . . $enable_match_regex
5095     match_timediff  . . . $enable_match_timediff
5096     match_value . . . . . $enable_match_value
5097     mbmon . . . . . . . . $enable_mbmon
5098     md  . . . . . . . . . $enable_md
5099     memcachec . . . . . . $enable_memcachec
5100     memcached . . . . . . $enable_memcached
5101     memory  . . . . . . . $enable_memory
5102     modbus  . . . . . . . $enable_modbus
5103     multimeter  . . . . . $enable_multimeter
5104     mysql . . . . . . . . $enable_mysql
5105     netapp  . . . . . . . $enable_netapp
5106     netlink . . . . . . . $enable_netlink
5107     network . . . . . . . $enable_network
5108     nfs . . . . . . . . . $enable_nfs
5109     nginx . . . . . . . . $enable_nginx
5110     notify_desktop  . . . $enable_notify_desktop
5111     notify_email  . . . . $enable_notify_email
5112     ntpd  . . . . . . . . $enable_ntpd
5113     nut . . . . . . . . . $enable_nut
5114     olsrd . . . . . . . . $enable_olsrd
5115     onewire . . . . . . . $enable_onewire
5116     openvpn . . . . . . . $enable_openvpn
5117     oracle  . . . . . . . $enable_oracle
5118     perl  . . . . . . . . $enable_perl
5119     pinba . . . . . . . . $enable_pinba
5120     ping  . . . . . . . . $enable_ping
5121     postgresql  . . . . . $enable_postgresql
5122     powerdns  . . . . . . $enable_powerdns
5123     processes . . . . . . $enable_processes
5124     protocols . . . . . . $enable_protocols
5125     python  . . . . . . . $enable_python
5126     redis . . . . . . . . $enable_redis
5127     routeros  . . . . . . $enable_routeros
5128     rrdcached . . . . . . $enable_rrdcached
5129     rrdtool . . . . . . . $enable_rrdtool
5130     sensors . . . . . . . $enable_sensors
5131     serial  . . . . . . . $enable_serial
5132     snmp  . . . . . . . . $enable_snmp
5133     swap  . . . . . . . . $enable_swap
5134     syslog  . . . . . . . $enable_syslog
5135     table . . . . . . . . $enable_table
5136     tail  . . . . . . . . $enable_tail
5137     tape  . . . . . . . . $enable_tape
5138     target_notification . $enable_target_notification
5139     target_replace  . . . $enable_target_replace
5140     target_scale  . . . . $enable_target_scale
5141     target_set  . . . . . $enable_target_set
5142     target_v5upgrade  . . $enable_target_v5upgrade
5143     tcpconns  . . . . . . $enable_tcpconns
5144     teamspeak2  . . . . . $enable_teamspeak2
5145     ted . . . . . . . . . $enable_ted
5146     thermal . . . . . . . $enable_thermal
5147     threshold . . . . . . $enable_threshold
5148     tokyotyrant . . . . . $enable_tokyotyrant
5149     unixsock  . . . . . . $enable_unixsock
5150     uptime  . . . . . . . $enable_uptime
5151     users . . . . . . . . $enable_users
5152     uuid  . . . . . . . . $enable_uuid
5153     varnish . . . . . . . $enable_varnish
5154     vmem  . . . . . . . . $enable_vmem
5155     vserver . . . . . . . $enable_vserver
5156     wireless  . . . . . . $enable_wireless
5157     write_graphite  . . . $enable_write_graphite
5158     write_http  . . . . . $enable_write_http
5159     write_redis . . . . . $enable_write_redis
5160     write_mongodb . . . . $enable_write_mongodb
5161     xmms  . . . . . . . . $enable_xmms
5162     zfs_arc . . . . . . . $enable_zfs_arc
5164 EOF
5166 if test "x$dependency_error" = "xyes"; then
5167         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5168 fi
5170 if test "x$dependency_warning" = "xyes"; then
5171         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5172 fi
5174 # vim: set fdm=marker :