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