Code

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