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