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