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