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