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