Code

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