Code

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