Code

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