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 JAR="$JAR"
1615 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1616 [
1617 if test "x$withval" = "xno"
1618 then
1619 with_java="no"
1620 else if test "x$withval" = "xyes"
1621 then
1622 with_java="yes"
1623 else
1624 with_java_home="$withval"
1625 with_java="yes"
1626 fi; fi
1627 ],
1628 [with_java="yes"])
1629 if test "x$with_java" = "xyes"
1630 then
1631 if test -d "$with_java_home"
1632 then
1633 AC_MSG_CHECKING([for jni.h])
1634 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1635 if test "x$TMPDIR" != "x"
1636 then
1637 AC_MSG_RESULT([found in $TMPDIR])
1638 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1639 else
1640 AC_MSG_RESULT([not found])
1641 fi
1643 AC_MSG_CHECKING([for jni_md.h])
1644 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1645 if test "x$TMPDIR" != "x"
1646 then
1647 AC_MSG_RESULT([found in $TMPDIR])
1648 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1649 else
1650 AC_MSG_RESULT([not found])
1651 fi
1653 AC_MSG_CHECKING([for libjvm.so])
1654 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1655 if test "x$TMPDIR" != "x"
1656 then
1657 AC_MSG_RESULT([found in $TMPDIR])
1658 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1659 else
1660 AC_MSG_RESULT([not found])
1661 fi
1663 if test "x$JAVAC" = "x"
1664 then
1665 AC_MSG_CHECKING([for javac])
1666 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1667 if test "x$TMPDIR" != "x"
1668 then
1669 JAVAC="$TMPDIR"
1670 AC_MSG_RESULT([$JAVAC])
1671 else
1672 AC_MSG_RESULT([not found])
1673 fi
1674 fi
1675 if test "x$JAR" = "x"
1676 then
1677 AC_MSG_CHECKING([for jar])
1678 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1679 if test "x$TMPDIR" != "x"
1680 then
1681 JAR="$TMPDIR"
1682 AC_MSG_RESULT([$JAR])
1683 else
1684 AC_MSG_RESULT([not found])
1685 fi
1686 fi
1687 else if test "x$with_java_home" != "x"
1688 then
1689 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1690 fi; fi
1691 fi
1693 if test "x$JAVA_CPPFLAGS" != "x"
1694 then
1695 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1696 fi
1697 if test "x$JAVA_CFLAGS" != "x"
1698 then
1699 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1700 fi
1701 if test "x$JAVA_LDFLAGS" != "x"
1702 then
1703 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1704 fi
1705 if test "x$JAVAC" = "x"
1706 then
1707 with_javac_path="$PATH"
1708 if test "x$with_java_home" != "x"
1709 then
1710 with_javac_path="$with_java_home:with_javac_path"
1711 if test -d "$with_java_home/bin"
1712 then
1713 with_javac_path="$with_java_home/bin:with_javac_path"
1714 fi
1715 fi
1717 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1718 fi
1719 if test "x$JAVAC" = "x"
1720 then
1721 with_java="no (javac not found)"
1722 fi
1723 if test "x$JAR" = "x"
1724 then
1725 with_jar_path="$PATH"
1726 if test "x$with_java_home" != "x"
1727 then
1728 with_jar_path="$with_java_home:$with_jar_path"
1729 if test -d "$with_java_home/bin"
1730 then
1731 with_jar_path="$with_java_home/bin:$with_jar_path"
1732 fi
1733 fi
1735 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1736 fi
1737 if test "x$JAR" = "x"
1738 then
1739 with_java="no (jar not found)"
1740 fi
1742 SAVE_CPPFLAGS="$CPPFLAGS"
1743 SAVE_CFLAGS="$CFLAGS"
1744 SAVE_LDFLAGS="$LDFLAGS"
1745 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1746 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1747 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1749 if test "x$with_java" = "xyes"
1750 then
1751 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1752 fi
1753 if test "x$with_java" = "xyes"
1754 then
1755 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1756 [with_java="yes"],
1757 [with_java="no (libjvm not found)"],
1758 [$JAVA_LIBS])
1759 fi
1760 if test "x$with_java" = "xyes"
1761 then
1762 JAVA_LIBS="$JAVA_LIBS -ljvm"
1763 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1764 fi
1766 CPPFLAGS="$SAVE_CPPFLAGS"
1767 CFLAGS="$SAVE_CFLAGS"
1768 LDFLAGS="$SAVE_LDFLAGS"
1770 AC_SUBST(JAVA_CPPFLAGS)
1771 AC_SUBST(JAVA_CFLAGS)
1772 AC_SUBST(JAVA_LDFLAGS)
1773 AC_SUBST(JAVA_LIBS)
1774 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1775 # }}}
1777 # --with-libmemcached {{{
1778 with_libmemcached_cppflags=""
1779 with_libmemcached_ldflags=""
1780 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1781 [
1782 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1783 then
1784 with_libmemcached_cppflags="-I$withval/include"
1785 with_libmemcached_ldflags="-L$withval/lib"
1786 with_libmemcached="yes"
1787 else
1788 with_libmemcached="$withval"
1789 fi
1790 ],
1791 [
1792 with_libmemcached="yes"
1793 ])
1794 if test "x$with_libmemcached" = "xyes"
1795 then
1796 SAVE_CPPFLAGS="$CPPFLAGS"
1797 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1799 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1801 CPPFLAGS="$SAVE_CPPFLAGS"
1802 fi
1803 if test "x$with_libmemcached" = "xyes"
1804 then
1805 SAVE_CPPFLAGS="$CPPFLAGS"
1806 SAVE_LDFLAGS="$LDFLAGS"
1807 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1808 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1810 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1812 CPPFLAGS="$SAVE_CPPFLAGS"
1813 LDFLAGS="$SAVE_LDFLAGS"
1814 fi
1815 if test "x$with_libmemcached" = "xyes"
1816 then
1817 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1818 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1819 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1820 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1821 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1822 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1823 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1824 fi
1825 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1826 # }}}
1828 # --with-libmysql {{{
1829 with_mysql_config="mysql_config"
1830 with_mysql_cflags=""
1831 with_mysql_libs=""
1832 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1833 [
1834 if test "x$withval" = "xno"
1835 then
1836 with_libmysql="no"
1837 else if test "x$withval" = "xyes"
1838 then
1839 with_libmysql="yes"
1840 else
1841 if test -f "$withval" && test -x "$withval";
1842 then
1843 with_mysql_config="$withval"
1844 else if test -x "$withval/bin/mysql_config"
1845 then
1846 with_mysql_config="$withval/bin/mysql_config"
1847 fi; fi
1848 with_libmysql="yes"
1849 fi; fi
1850 ],
1851 [
1852 with_libmysql="yes"
1853 ])
1854 if test "x$with_libmysql" = "xyes"
1855 then
1856 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1857 mysql_config_status=$?
1859 if test $mysql_config_status -ne 0
1860 then
1861 with_libmysql="no ($with_mysql_config failed)"
1862 else
1863 SAVE_CPPFLAGS="$CPPFLAGS"
1864 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1866 have_mysql_h="no"
1867 have_mysql_mysql_h="no"
1868 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1870 if test "x$have_mysql_h" = "xno"
1871 then
1872 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1873 fi
1875 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1876 then
1877 with_libmysql="no (mysql.h not found)"
1878 fi
1880 CPPFLAGS="$SAVE_CPPFLAGS"
1881 fi
1882 fi
1883 if test "x$with_libmysql" = "xyes"
1884 then
1885 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1886 mysql_config_status=$?
1888 if test $mysql_config_status -ne 0
1889 then
1890 with_libmysql="no ($with_mysql_config failed)"
1891 else
1892 AC_CHECK_LIB(mysqlclient, mysql_init,
1893 [with_libmysql="yes"],
1894 [with_libmysql="no (symbol 'mysql_init' not found)"],
1895 [$with_mysql_libs])
1897 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1898 [with_libmysql="yes"],
1899 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1900 [$with_mysql_libs])
1901 fi
1902 fi
1903 if test "x$with_libmysql" = "xyes"
1904 then
1905 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1906 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1907 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1908 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1909 fi
1910 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1911 # }}}
1913 # --with-libnetlink {{{
1914 with_libnetlink_cflags=""
1915 with_libnetlink_libs="-lnetlink"
1916 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1917 [
1918 echo "libnetlink: withval = $withval"
1919 if test "x$withval" = "xyes"
1920 then
1921 with_libnetlink="yes"
1922 else if test "x$withval" = "xno"
1923 then
1924 with_libnetlink="no"
1925 else
1926 if test -d "$withval/include"
1927 then
1928 with_libnetlink_cflags="-I$withval/include"
1929 with_libnetlink_libs="-L$withval/lib -lnetlink"
1930 with_libnetlink="yes"
1931 else
1932 AC_MSG_ERROR("no such directory: $withval/include")
1933 fi
1934 fi; fi
1935 ],
1936 [
1937 if test "x$ac_system" = "xLinux"
1938 then
1939 with_libnetlink="yes"
1940 else
1941 with_libnetlink="no (Linux only library)"
1942 fi
1943 ])
1944 if test "x$with_libnetlink" = "xyes"
1945 then
1946 SAVE_CFLAGS="$CFLAGS"
1947 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1949 with_libnetlink="no (libnetlink.h not found)"
1951 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1952 [
1953 with_libnetlink="yes"
1954 break
1955 ], [],
1956 [#include <stdio.h>
1957 #include <sys/types.h>
1958 #include <asm/types.h>
1959 #include <sys/socket.h>
1960 #include <linux/netlink.h>
1961 #include <linux/rtnetlink.h>])
1962 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1963 [#include <stdio.h>
1964 #include <sys/types.h>
1965 #include <asm/types.h>
1966 #include <sys/socket.h>])
1968 AC_COMPILE_IFELSE(
1969 [#include <stdio.h>
1970 #include <sys/types.h>
1971 #include <asm/types.h>
1972 #include <sys/socket.h>
1973 #include <linux/netlink.h>
1974 #include <linux/rtnetlink.h>
1976 int main (void)
1977 {
1978 int retval = TCA_STATS2;
1979 return (retval);
1980 }],
1981 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1982 []);
1984 AC_COMPILE_IFELSE(
1985 [#include <stdio.h>
1986 #include <sys/types.h>
1987 #include <asm/types.h>
1988 #include <sys/socket.h>
1989 #include <linux/netlink.h>
1990 #include <linux/rtnetlink.h>
1992 int main (void)
1993 {
1994 int retval = TCA_STATS;
1995 return (retval);
1996 }],
1997 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1998 []);
2000 CFLAGS="$SAVE_CFLAGS"
2001 fi
2002 if test "x$with_libnetlink" = "xyes"
2003 then
2004 AC_CHECK_LIB(netlink, rtnl_open,
2005 [with_libnetlink="yes"],
2006 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2007 [$with_libnetlink_libs])
2008 fi
2009 if test "x$with_libnetlink" = "xyes"
2010 then
2011 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2012 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2013 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2014 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2015 fi
2016 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2017 # }}}
2019 # --with-libnetapp {{{
2020 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2021 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2022 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2023 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2024 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2025 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2026 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2027 [
2028 if test -d "$withval"
2029 then
2030 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2031 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2032 with_libnetapp="yes"
2033 else
2034 with_libnetapp="$withval"
2035 fi
2036 ],
2037 [
2038 with_libnetapp="yes"
2039 ])
2041 SAVE_CPPFLAGS="$CPPFLAGS"
2042 SAVE_LDFLAGS="$LDFLAGS"
2043 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2044 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2046 if test "x$with_libnetapp" = "xyes"
2047 then
2048 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2049 then
2050 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2051 fi
2052 AC_CHECK_HEADERS(netapp_api.h,
2053 [with_libnetapp="yes"],
2054 [with_libnetapp="no (netapp_api.h not found)"])
2055 fi
2057 if test "x$with_libnetapp" = "xyes"
2058 then
2059 if test "x$LIBNETAPP_LDFLAGS" != "x"
2060 then
2061 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2062 fi
2064 if test "x$LIBNETAPP_LIBS" = "x"
2065 then
2066 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2067 fi
2068 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2070 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2071 [with_libnetapp="yes"],
2072 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2073 [$LIBNETAPP_LIBS])
2074 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2075 fi
2077 CPPFLAGS="$SAVE_CPPFLAGS"
2078 LDFLAGS="$SAVE_LDFLAGS"
2080 if test "x$with_libnetapp" = "xyes"
2081 then
2082 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2083 fi
2085 AC_SUBST(LIBNETAPP_CPPFLAGS)
2086 AC_SUBST(LIBNETAPP_LDFLAGS)
2087 AC_SUBST(LIBNETAPP_LIBS)
2088 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2089 # }}}
2091 # --with-libnetsnmp {{{
2092 with_snmp_config="net-snmp-config"
2093 with_snmp_cflags=""
2094 with_snmp_libs=""
2095 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2096 [
2097 if test "x$withval" = "xno"
2098 then
2099 with_libnetsnmp="no"
2100 else if test "x$withval" = "xyes"
2101 then
2102 with_libnetsnmp="yes"
2103 else
2104 if test -x "$withval"
2105 then
2106 with_snmp_config="$withval"
2107 with_libnetsnmp="yes"
2108 else
2109 with_snmp_config="$withval/bin/net-snmp-config"
2110 with_libnetsnmp="yes"
2111 fi
2112 fi; fi
2113 ],
2114 [with_libnetsnmp="yes"])
2115 if test "x$with_libnetsnmp" = "xyes"
2116 then
2117 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2118 snmp_config_status=$?
2120 if test $snmp_config_status -ne 0
2121 then
2122 with_libnetsnmp="no ($with_snmp_config failed)"
2123 else
2124 SAVE_CPPFLAGS="$CPPFLAGS"
2125 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2127 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2129 CPPFLAGS="$SAVE_CPPFLAGS"
2130 fi
2131 fi
2132 if test "x$with_libnetsnmp" = "xyes"
2133 then
2134 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2135 snmp_config_status=$?
2137 if test $snmp_config_status -ne 0
2138 then
2139 with_libnetsnmp="no ($with_snmp_config failed)"
2140 else
2141 AC_CHECK_LIB(netsnmp, init_snmp,
2142 [with_libnetsnmp="yes"],
2143 [with_libnetsnmp="no (libnetsnmp not found)"],
2144 [$with_snmp_libs])
2145 fi
2146 fi
2147 if test "x$with_libnetsnmp" = "xyes"
2148 then
2149 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2150 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2151 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2152 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2153 fi
2154 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2155 # }}}
2157 # --with-liboconfig {{{
2158 with_own_liboconfig="no"
2159 liboconfig_LDFLAGS="$LDFLAGS"
2160 liboconfig_CPPFLAGS="$CPPFLAGS"
2161 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2162 [
2163 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2164 then
2165 if test -d "$withval/lib"
2166 then
2167 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2168 fi
2169 if test -d "$withval/include"
2170 then
2171 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2172 fi
2173 fi
2174 if test "x$withval" = "xno"
2175 then
2176 AC_MSG_ERROR("liboconfig is required")
2177 fi
2178 ],
2179 [
2180 with_liboconfig="yes"
2181 ])
2183 save_LDFLAGS="$LDFLAGS"
2184 save_CPPFLAGS="$CPPFLAGS"
2185 LDFLAGS="$liboconfig_LDFLAGS"
2186 CPPFLAGS="$liboconfig_CPPFLAGS"
2187 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2188 [
2189 with_liboconfig="yes"
2190 with_own_liboconfig="no"
2191 ],
2192 [
2193 with_liboconfig="yes"
2194 with_own_liboconfig="yes"
2195 LDFLAGS="$save_LDFLAGS"
2196 CPPFLAGS="$save_CPPFLAGS"
2197 ])
2199 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2200 if test "x$with_own_liboconfig" = "xyes"
2201 then
2202 with_liboconfig="yes (shipped version)"
2203 fi
2204 # }}}
2206 # --with-liboping {{{
2207 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2208 [
2209 if test "x$withval" = "xyes"
2210 then
2211 with_liboping="yes"
2212 else if test "x$withval" = "xno"
2213 then
2214 with_liboping="no"
2215 else
2216 with_liboping="yes"
2217 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2218 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2219 fi; fi
2220 ],
2221 [with_liboping="yes"])
2223 SAVE_CPPFLAGS="$CPPFLAGS"
2224 SAVE_LDFLAGS="$LDFLAGS"
2226 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2227 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2229 if test "x$with_liboping" = "xyes"
2230 then
2231 if test "x$LIBOPING_CPPFLAGS" != "x"
2232 then
2233 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2234 fi
2235 AC_CHECK_HEADERS(oping.h,
2236 [with_liboping="yes"],
2237 [with_liboping="no ('oping.h' not found)"])
2238 fi
2239 if test "x$with_liboping" = "xyes"
2240 then
2241 if test "x$LIBOPING_LDFLAGS" != "x"
2242 then
2243 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2244 fi
2245 AC_CHECK_LIB(oping, ping_construct,
2246 [with_liboping="yes"],
2247 [with_liboping="no (symbol 'ping_construct' not found)"])
2248 fi
2250 CPPFLAGS="$SAVE_CPPFLAGS"
2251 LDFLAGS="$SAVE_LDFLAGS"
2253 if test "x$with_liboping" = "xyes"
2254 then
2255 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2256 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2257 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2258 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2259 fi
2260 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2261 # }}}
2263 # --with-oracle {{{
2264 with_oracle_cppflags=""
2265 with_oracle_libs=""
2266 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2267 [
2268 if test "x$withval" = "xyes"
2269 then
2270 if test "x$ORACLE_HOME" = "x"
2271 then
2272 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2273 fi
2274 with_oracle="yes"
2275 else if test "x$withval" = "xno"
2276 then
2277 with_oracle="no"
2278 else
2279 with_oracle="yes"
2280 ORACLE_HOME="$withval"
2281 fi; fi
2282 ],
2283 [
2284 if test "x$ORACLE_HOME" = "x"
2285 then
2286 with_oracle="no (ORACLE_HOME is not set)"
2287 else
2288 with_oracle="yes"
2289 fi
2290 ])
2291 if test "x$ORACLE_HOME" != "x"
2292 then
2293 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2295 if test -e "$ORACLE_HOME/lib/ldflags"
2296 then
2297 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2298 fi
2299 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2300 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2301 fi
2302 if test "x$with_oracle" = "xyes"
2303 then
2304 SAVE_CPPFLAGS="$CPPFLAGS"
2305 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2307 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2309 CPPFLAGS="$SAVE_CPPFLAGS"
2310 fi
2311 if test "x$with_oracle" = "xyes"
2312 then
2313 SAVE_CPPFLAGS="$CPPFLAGS"
2314 SAVE_LDFLAGS="$LDFLAGS"
2315 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2316 LDFLAGS="$LDFLAGS $with_oracle_libs"
2318 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2320 CPPFLAGS="$SAVE_CPPFLAGS"
2321 LDFLAGS="$SAVE_LDFLAGS"
2322 fi
2323 if test "x$with_oracle" = "xyes"
2324 then
2325 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2326 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2327 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2328 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2329 fi
2330 # }}}
2332 # --with-libowcapi {{{
2333 with_libowcapi_cppflags=""
2334 with_libowcapi_libs="-lowcapi"
2335 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2336 [
2337 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2338 then
2339 with_libowcapi_cppflags="-I$withval/include"
2340 with_libowcapi_libs="-L$withval/lib -lowcapi"
2341 with_libowcapi="yes"
2342 else
2343 with_libowcapi="$withval"
2344 fi
2345 ],
2346 [
2347 with_libowcapi="yes"
2348 ])
2349 if test "x$with_libowcapi" = "xyes"
2350 then
2351 SAVE_CPPFLAGS="$CPPFLAGS"
2352 CPPFLAGS="$with_libowcapi_cppflags"
2354 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2356 CPPFLAGS="$SAVE_CPPFLAGS"
2357 fi
2358 if test "x$with_libowcapi" = "xyes"
2359 then
2360 SAVE_LDFLAGS="$LDFLAGS"
2361 SAVE_CPPFLAGS="$CPPFLAGS"
2362 LDFLAGS="$with_libowcapi_libs"
2363 CPPFLAGS="$with_libowcapi_cppflags"
2365 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2367 LDFLAGS="$SAVE_LDFLAGS"
2368 CPPFLAGS="$SAVE_CPPFLAGS"
2369 fi
2370 if test "x$with_libowcapi" = "xyes"
2371 then
2372 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2373 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2374 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2375 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2376 fi
2377 # }}}
2379 # --with-libpcap {{{
2380 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2381 [
2382 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2383 then
2384 LDFLAGS="$LDFLAGS -L$withval/lib"
2385 CPPFLAGS="$CPPFLAGS -I$withval/include"
2386 with_libpcap="yes"
2387 else
2388 with_libpcap="$withval"
2389 fi
2390 ],
2391 [
2392 with_libpcap="yes"
2393 ])
2394 if test "x$with_libpcap" = "xyes"
2395 then
2396 AC_CHECK_LIB(pcap, pcap_open_live,
2397 [
2398 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2399 ], [with_libpcap="no (libpcap not found)"])
2400 fi
2401 if test "x$with_libpcap" = "xyes"
2402 then
2403 AC_CHECK_HEADERS(pcap.h,
2404 [
2405 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2406 ], [with_libpcap="no (pcap.h not found)"])
2407 fi
2408 if test "x$with_libpcap" = "xyes"
2409 then
2410 collect_libpcap=1
2411 else
2412 collect_libpcap=0
2413 fi
2414 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2415 [Wether or not to use the pcap library])
2416 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2417 # }}}
2419 # --with-libperl {{{
2420 perl_interpreter="perl"
2421 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2422 [
2423 if test -x "$withval"
2424 then
2425 perl_interpreter="$withval"
2426 with_libperl="yes"
2427 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2428 then
2429 LDFLAGS="$LDFLAGS -L$withval/lib"
2430 CPPFLAGS="$CPPFLAGS -I$withval/include"
2431 perl_interpreter="$withval/bin/perl"
2432 with_libperl="yes"
2433 else
2434 with_libperl="$withval"
2435 fi; fi
2436 ],
2437 [
2438 with_libperl="yes"
2439 ])
2441 AC_MSG_CHECKING([for perl])
2442 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2443 if test -x "$perl_interpreter"
2444 then
2445 AC_MSG_RESULT([yes ($perl_interpreter)])
2446 else
2447 perl_interpreter=""
2448 AC_MSG_RESULT([no])
2449 fi
2451 AC_SUBST(PERL, "$perl_interpreter")
2453 if test "x$with_libperl" = "xyes" \
2454 && test -n "$perl_interpreter"
2455 then
2456 SAVE_CFLAGS="$CFLAGS"
2457 SAVE_LDFLAGS="$LDFLAGS"
2458 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2459 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2460 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2461 CFLAGS="$CFLAGS $PERL_CFLAGS"
2462 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2464 AC_CACHE_CHECK([for libperl],
2465 [c_cv_have_libperl],
2466 AC_LINK_IFELSE(
2467 AC_LANG_PROGRAM(
2468 [[
2469 #define PERL_NO_GET_CONTEXT
2470 #include <EXTERN.h>
2471 #include <perl.h>
2472 #include <XSUB.h>
2473 ]],
2474 [[
2475 dTHX;
2476 load_module (PERL_LOADMOD_NOIMPORT,
2477 newSVpv ("Collectd::Plugin::FooBar", 24),
2478 Nullsv);
2479 ]]),
2480 [c_cv_have_libperl="yes"],
2481 [c_cv_have_libperl="no"]
2482 )
2483 )
2485 if test "x$c_cv_have_libperl" = "xyes"
2486 then
2487 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2488 AC_SUBST(PERL_CFLAGS)
2489 AC_SUBST(PERL_LDFLAGS)
2490 else
2491 with_libperl="no"
2492 fi
2494 CFLAGS="$SAVE_CFLAGS"
2495 LDFLAGS="$SAVE_LDFLAGS"
2496 else if test -z "$perl_interpreter"; then
2497 with_libperl="no (no perl interpreter found)"
2498 c_cv_have_libperl="no"
2499 fi; fi
2500 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2502 if test "x$with_libperl" = "xyes"
2503 then
2504 SAVE_CFLAGS="$CFLAGS"
2505 SAVE_LDFLAGS="$LDFLAGS"
2506 CFLAGS="$CFLAGS $PERL_CFLAGS"
2507 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2509 AC_CACHE_CHECK([if perl supports ithreads],
2510 [c_cv_have_perl_ithreads],
2511 AC_LINK_IFELSE(
2512 AC_LANG_PROGRAM(
2513 [[
2514 #include <EXTERN.h>
2515 #include <perl.h>
2516 #include <XSUB.h>
2518 #if !defined(USE_ITHREADS)
2519 # error "Perl does not support ithreads!"
2520 #endif /* !defined(USE_ITHREADS) */
2521 ]],
2522 [[ ]]),
2523 [c_cv_have_perl_ithreads="yes"],
2524 [c_cv_have_perl_ithreads="no"]
2525 )
2526 )
2528 if test "x$c_cv_have_perl_ithreads" = "xyes"
2529 then
2530 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2531 fi
2533 CFLAGS="$SAVE_CFLAGS"
2534 LDFLAGS="$SAVE_LDFLAGS"
2535 fi
2537 if test "x$with_libperl" = "xyes"
2538 then
2539 SAVE_CFLAGS="$CFLAGS"
2540 SAVE_LDFLAGS="$LDFLAGS"
2541 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2542 # (see issues #41 and #42)
2543 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2544 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2546 AC_CACHE_CHECK([for broken Perl_load_module()],
2547 [c_cv_have_broken_perl_load_module],
2548 AC_LINK_IFELSE(
2549 AC_LANG_PROGRAM(
2550 [[
2551 #define PERL_NO_GET_CONTEXT
2552 #include <EXTERN.h>
2553 #include <perl.h>
2554 #include <XSUB.h>
2555 ]],
2556 [[
2557 dTHX;
2558 load_module (PERL_LOADMOD_NOIMPORT,
2559 newSVpv ("Collectd::Plugin::FooBar", 24),
2560 Nullsv);
2561 ]]),
2562 [c_cv_have_broken_perl_load_module="no"],
2563 [c_cv_have_broken_perl_load_module="yes"]
2564 )
2565 )
2567 CFLAGS="$SAVE_CFLAGS"
2568 LDFLAGS="$SAVE_LDFLAGS"
2569 fi
2570 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2571 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2573 if test "x$with_libperl" = "xyes"
2574 then
2575 SAVE_CFLAGS="$CFLAGS"
2576 SAVE_LDFLAGS="$LDFLAGS"
2577 CFLAGS="$CFLAGS $PERL_CFLAGS"
2578 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2580 AC_CHECK_MEMBER(
2581 [struct mgvtbl.svt_local],
2582 [have_struct_mgvtbl_svt_local="yes"],
2583 [have_struct_mgvtbl_svt_local="no"],
2584 [
2585 #include <EXTERN.h>
2586 #include <perl.h>
2587 #include <XSUB.h>
2588 ])
2590 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2591 then
2592 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2593 [Define if Perl's struct mgvtbl has member svt_local.])
2594 fi
2596 CFLAGS="$SAVE_CFLAGS"
2597 LDFLAGS="$SAVE_LDFLAGS"
2598 fi
2599 # }}}
2601 # --with-libpq {{{
2602 with_pg_config="pg_config"
2603 with_libpq_includedir=""
2604 with_libpq_libdir=""
2605 with_libpq_cppflags=""
2606 with_libpq_ldflags=""
2607 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2608 [Path to libpq.])],
2609 [
2610 if test "x$withval" = "xno"
2611 then
2612 with_libpq="no"
2613 else if test "x$withval" = "xyes"
2614 then
2615 with_libpq="yes"
2616 else
2617 if test -f "$withval" && test -x "$withval";
2618 then
2619 with_pg_config="$withval"
2620 else if test -x "$withval/bin/pg_config"
2621 then
2622 with_pg_config="$withval/bin/pg_config"
2623 fi; fi
2624 with_libpq="yes"
2625 fi; fi
2626 ],
2627 [
2628 with_libpq="yes"
2629 ])
2630 if test "x$with_libpq" = "xyes"
2631 then
2632 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2633 pg_config_status=$?
2635 if test $pg_config_status -eq 0
2636 then
2637 if test -n "$with_libpq_includedir"; then
2638 for dir in $with_libpq_includedir; do
2639 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2640 done
2641 fi
2642 else
2643 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2644 fi
2646 SAVE_CPPFLAGS="$CPPFLAGS"
2647 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2649 AC_CHECK_HEADERS(libpq-fe.h, [],
2650 [with_libpq="no (libpq-fe.h not found)"], [])
2652 CPPFLAGS="$SAVE_CPPFLAGS"
2653 fi
2654 if test "x$with_libpq" = "xyes"
2655 then
2656 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2657 pg_config_status=$?
2659 if test $pg_config_status -eq 0
2660 then
2661 if test -n "$with_libpq_libdir"; then
2662 for dir in $with_libpq_libdir; do
2663 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2664 done
2665 fi
2666 else
2667 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2668 fi
2670 SAVE_LDFLAGS="$LDFLAGS"
2671 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2673 AC_CHECK_LIB(pq, PQconnectdb,
2674 [with_libpq="yes"],
2675 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2677 AC_CHECK_LIB(pq, PQserverVersion,
2678 [with_libpq="yes"],
2679 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2681 LDFLAGS="$SAVE_LDFLAGS"
2682 fi
2683 if test "x$with_libpq" = "xyes"
2684 then
2685 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2686 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2687 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2688 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2689 fi
2690 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2691 # }}}
2693 # --with-libpthread {{{
2694 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2695 [ if test "x$withval" != "xno" \
2696 && test "x$withval" != "xyes"
2697 then
2698 LDFLAGS="$LDFLAGS -L$withval/lib"
2699 CPPFLAGS="$CPPFLAGS -I$withval/include"
2700 with_libpthread="yes"
2701 else
2702 if test "x$withval" = "xno"
2703 then
2704 with_libpthread="no (disabled)"
2705 fi
2706 fi
2707 ], [with_libpthread="yes"])
2708 if test "x$with_libpthread" = "xyes"
2709 then
2710 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2711 fi
2713 if test "x$with_libpthread" = "xyes"
2714 then
2715 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2716 fi
2717 if test "x$with_libpthread" = "xyes"
2718 then
2719 collect_pthread=1
2720 else
2721 collect_pthread=0
2722 fi
2723 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2724 [Wether or not to use pthread (POSIX threads) library])
2725 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2726 # }}}
2728 # --with-python {{{
2729 with_python_prog=""
2730 with_python_path="$PATH"
2731 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2732 [
2733 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2734 then
2735 with_python="$withval"
2736 else if test -x "$withval"
2737 then
2738 with_python_prog="$withval"
2739 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2740 with_python="yes"
2741 else if test -d "$withval"
2742 then
2743 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2744 with_python="yes"
2745 else
2746 AC_MSG_WARN([Argument not recognized: $withval])
2747 fi; fi; fi
2748 ], [with_python="yes"])
2750 SAVE_PATH="$PATH"
2751 SAVE_CPPFLAGS="$CPPFLAGS"
2752 SAVE_LDFLAGS="$LDFLAGS"
2753 SAVE_LIBS="$LIBS"
2755 PATH="$with_python_path"
2757 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2758 then
2759 AC_MSG_CHECKING([for python])
2760 with_python_prog="`which python 2>/dev/null`"
2761 if test "x$with_python_prog" = "x"
2762 then
2763 AC_MSG_RESULT([not found])
2764 with_python="no (interpreter not found)"
2765 else
2766 AC_MSG_RESULT([$with_python_prog])
2767 fi
2768 fi
2770 if test "x$with_python" = "xyes"
2771 then
2772 AC_MSG_CHECKING([for Python CPPFLAGS])
2773 python_include_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_python_inc()" | "$with_python_prog" 2>&1`
2774 python_config_status=$?
2776 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2777 then
2778 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2779 with_python="no"
2780 else
2781 AC_MSG_RESULT([$python_include_path])
2782 fi
2783 fi
2785 if test "x$with_python" = "xyes"
2786 then
2787 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2788 AC_CHECK_HEADERS(Python.h,
2789 [with_python="yes"],
2790 [with_python="no ('Python.h' not found)"])
2791 fi
2793 if test "x$with_python" = "xyes"
2794 then
2795 AC_MSG_CHECKING([for Python LDFLAGS])
2796 python_library_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0)" | "$with_python_prog" 2>&1`
2797 python_config_status=$?
2799 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2800 then
2801 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2802 with_python="no"
2803 else
2804 AC_MSG_RESULT([$python_library_path])
2805 fi
2806 fi
2808 if test "x$with_python" = "xyes"
2809 then
2810 AC_MSG_CHECKING([for Python LIBS])
2811 python_library_flags=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0)" | "$with_python_prog" 2>&1`
2812 python_config_status=$?
2814 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2815 then
2816 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2817 with_python="no"
2818 else
2819 AC_MSG_RESULT([$python_library_flags])
2820 fi
2821 fi
2823 if test "x$with_python" = "xyes"
2824 then
2825 LDFLAGS="-L$python_library_path $LDFLAGS"
2826 LIBS="$python_library_flags $LIBS"
2828 AC_CHECK_FUNC(PyObject_CallFunction,
2829 [with_python="yes"],
2830 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
2831 fi
2833 PATH="$SAVE_PATH"
2834 CPPFLAGS="$SAVE_CPPFLAGS"
2835 LDFLAGS="$SAVE_LDFLAGS"
2836 LIBS="$SAVE_LIBS"
2838 if test "x$with_python" = "xyes"
2839 then
2840 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
2841 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
2842 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
2843 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
2844 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
2845 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
2846 fi
2847 # }}} --with-python
2849 # --with-librouteros {{{
2850 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
2851 [
2852 if test "x$withval" = "xyes"
2853 then
2854 with_librouteros="yes"
2855 else if test "x$withval" = "xno"
2856 then
2857 with_librouteros="no"
2858 else
2859 with_librouteros="yes"
2860 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
2861 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
2862 fi; fi
2863 ],
2864 [with_librouteros="yes"])
2866 SAVE_CPPFLAGS="$CPPFLAGS"
2867 SAVE_LDFLAGS="$LDFLAGS"
2869 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
2870 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
2872 if test "x$with_librouteros" = "xyes"
2873 then
2874 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
2875 then
2876 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
2877 fi
2878 AC_CHECK_HEADERS(routeros_api.h,
2879 [with_librouteros="yes"],
2880 [with_librouteros="no ('routeros_api.h' not found)"])
2881 fi
2882 if test "x$with_librouteros" = "xyes"
2883 then
2884 if test "x$LIBROUTEROS_LDFLAGS" != "x"
2885 then
2886 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
2887 fi
2888 AC_CHECK_LIB(routeros, ros_interface,
2889 [with_librouteros="yes"],
2890 [with_librouteros="no (symbol 'ros_interface' not found)"])
2891 fi
2893 CPPFLAGS="$SAVE_CPPFLAGS"
2894 LDFLAGS="$SAVE_LDFLAGS"
2896 if test "x$with_librouteros" = "xyes"
2897 then
2898 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
2899 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
2900 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
2901 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
2902 fi
2903 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
2904 # }}}
2906 # --with-librrd {{{
2907 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2908 librrd_cflags=""
2909 librrd_ldflags=""
2910 librrd_threadsafe="yes"
2911 librrd_rrdc_update="no"
2912 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2913 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2914 then
2915 librrd_cflags="-I$withval/include"
2916 librrd_ldflags="-L$withval/lib"
2917 with_librrd="yes"
2918 else
2919 with_librrd="$withval"
2920 fi
2921 ], [with_librrd="yes"])
2922 if test "x$with_librrd" = "xyes"
2923 then
2924 SAVE_CPPFLAGS="$CPPFLAGS"
2925 SAVE_LDFLAGS="$LDFLAGS"
2927 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2928 LDFLAGS="$LDFLAGS $librrd_ldflags"
2930 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2932 CPPFLAGS="$SAVE_CPPFLAGS"
2933 LDFLAGS="$SAVE_LDFLAGS"
2934 fi
2935 if test "x$with_librrd" = "xyes"
2936 then
2937 SAVE_CPPFLAGS="$CPPFLAGS"
2938 SAVE_LDFLAGS="$LDFLAGS"
2940 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2941 LDFLAGS="$LDFLAGS $librrd_ldflags"
2943 AC_CHECK_LIB(rrd_th, rrd_update_r,
2944 [with_librrd="yes"
2945 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2946 ],
2947 [librrd_threadsafe="no"
2948 AC_CHECK_LIB(rrd, rrd_update,
2949 [with_librrd="yes"
2950 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2951 ],
2952 [with_librrd="no (symbol 'rrd_update' not found)"],
2953 [-lm])
2954 ],
2955 [-lm])
2957 if test "x$librrd_threadsafe" = "xyes"
2958 then
2959 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2960 else
2961 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2962 fi
2964 CPPFLAGS="$SAVE_CPPFLAGS"
2965 LDFLAGS="$SAVE_LDFLAGS"
2966 fi
2967 if test "x$with_librrd" = "xyes"
2968 then
2969 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2970 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2971 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2972 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2973 fi
2974 if test "x$librrd_threadsafe" = "xyes"
2975 then
2976 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2977 fi
2978 # }}}
2980 # --with-libsensors {{{
2981 with_sensors_cflags=""
2982 with_sensors_ldflags=""
2983 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2984 [
2985 if test "x$withval" = "xno"
2986 then
2987 with_libsensors="no"
2988 else
2989 with_libsensors="yes"
2990 if test "x$withval" != "xyes"
2991 then
2992 with_sensors_cflags="-I$withval/include"
2993 with_sensors_ldflags="-L$withval/lib"
2994 with_libsensors="yes"
2995 fi
2996 fi
2997 ],
2998 [
2999 if test "x$ac_system" = "xLinux"
3000 then
3001 with_libsensors="yes"
3002 else
3003 with_libsensors="no (Linux only library)"
3004 fi
3005 ])
3006 if test "x$with_libsensors" = "xyes"
3007 then
3008 SAVE_CPPFLAGS="$CPPFLAGS"
3009 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3011 # AC_CHECK_HEADERS(sensors/sensors.h,
3012 # [
3013 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3014 # ],
3015 # [with_libsensors="no (sensors/sensors.h not found)"])
3016 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3018 CPPFLAGS="$SAVE_CPPFLAGS"
3019 fi
3020 if test "x$with_libsensors" = "xyes"
3021 then
3022 SAVE_CPPFLAGS="$CPPFLAGS"
3023 SAVE_LDFLAGS="$LDFLAGS"
3024 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3025 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3027 AC_CHECK_LIB(sensors, sensors_init,
3028 [
3029 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3030 ],
3031 [with_libsensors="no (libsensors not found)"])
3033 CPPFLAGS="$SAVE_CPPFLAGS"
3034 LDFLAGS="$SAVE_LDFLAGS"
3035 fi
3036 if test "x$with_libsensors" = "xyes"
3037 then
3038 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3039 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3040 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3041 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3042 fi
3043 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3044 # }}}
3046 # --with-libstatgrab {{{
3047 with_libstatgrab_cflags=""
3048 with_libstatgrab_ldflags=""
3049 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3050 [
3051 if test "x$withval" != "xno" \
3052 && test "x$withval" != "xyes"
3053 then
3054 with_libstatgrab_cflags="-I$withval/include"
3055 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3056 with_libstatgrab="yes"
3057 with_libstatgrab_pkg_config="no"
3058 else
3059 with_libstatgrab="$withval"
3060 with_libstatgrab_pkg_config="yes"
3061 fi
3062 ],
3063 [
3064 with_libstatgrab="yes"
3065 with_libstatgrab_pkg_config="yes"
3066 ])
3068 if test "x$with_libstatgrab" = "xyes" \
3069 && test "x$with_libstatgrab_pkg_config" = "xyes"
3070 then
3071 if test "x$PKG_CONFIG" != "x"
3072 then
3073 AC_MSG_CHECKING([pkg-config for libstatgrab])
3074 temp_result="found"
3075 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3076 if test "$?" != "0"
3077 then
3078 with_libstatgrab_pkg_config="no"
3079 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3080 temp_result="not found"
3081 fi
3082 AC_MSG_RESULT([$temp_result])
3083 else
3084 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3085 with_libstatgrab_pkg_config="no"
3086 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3087 fi
3088 fi
3090 if test "x$with_libstatgrab" = "xyes" \
3091 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3092 && test "x$with_libstatgrab_cflags" = "x"
3093 then
3094 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3095 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3096 if test "$?" = "0"
3097 then
3098 with_libstatgrab_cflags="$temp_result"
3099 else
3100 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3101 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3102 fi
3103 AC_MSG_RESULT([$temp_result])
3104 fi
3106 if test "x$with_libstatgrab" = "xyes" \
3107 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3108 && test "x$with_libstatgrab_ldflags" = "x"
3109 then
3110 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3111 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3112 if test "$?" = "0"
3113 then
3114 with_libstatgrab_ldflags="$temp_result"
3115 else
3116 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3117 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3118 fi
3119 AC_MSG_RESULT([$temp_result])
3120 fi
3122 if test "x$with_libstatgrab" = "xyes"
3123 then
3124 SAVE_CPPFLAGS="$CPPFLAGS"
3125 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3127 AC_CHECK_HEADERS(statgrab.h,
3128 [with_libstatgrab="yes"],
3129 [with_libstatgrab="no (statgrab.h not found)"])
3131 CPPFLAGS="$SAVE_CPPFLAGS"
3132 fi
3134 if test "x$with_libstatgrab" = "xyes"
3135 then
3136 SAVE_CFLAGS="$CFLAGS"
3137 SAVE_LDFLAGS="$LDFLAGS"
3139 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3140 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3142 AC_CHECK_LIB(statgrab, sg_init,
3143 [with_libstatgrab="yes"],
3144 [with_libstatgrab="no (symbol sg_init not found)"])
3146 CFLAGS="$SAVE_CFLAGS"
3147 LDFLAGS="$SAVE_LDFLAGS"
3148 fi
3150 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3151 if test "x$with_libstatgrab" = "xyes"
3152 then
3153 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3154 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3155 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3156 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3157 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3158 fi
3159 # }}}
3161 # --with-libtokyotyrant {{{
3162 with_libtokyotyrant_cppflags=""
3163 with_libtokyotyrant_ldflags=""
3164 with_libtokyotyrant_libs=""
3165 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3166 [
3167 if test "x$withval" = "xno"
3168 then
3169 with_libtokyotyrant="no"
3170 else if test "x$withval" = "xyes"
3171 then
3172 with_libtokyotyrant="yes"
3173 else
3174 with_libtokyotyrant_cppflags="-I$withval/include"
3175 with_libtokyotyrant_ldflags="-L$withval/include"
3176 with_libtokyotyrant_libs="-ltokyotyrant"
3177 with_libtokyotyrant="yes"
3178 fi; fi
3179 ],
3180 [
3181 with_libtokyotyrant="yes"
3182 ])
3184 if test "x$with_libtokyotyrant" = "xyes"
3185 then
3186 if $PKG_CONFIG --exists tokyotyrant
3187 then
3188 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3189 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3190 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3191 fi
3192 fi
3194 SAVE_CPPFLAGS="$CPPFLAGS"
3195 SAVE_LDFLAGS="$LDFLAGS"
3196 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3197 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3199 if test "x$with_libtokyotyrant" = "xyes"
3200 then
3201 AC_CHECK_HEADERS(tcrdb.h,
3202 [
3203 AC_DEFINE(HAVE_TCRDB_H, 1,
3204 [Define to 1 if you have the <tcrdb.h> header file.])
3205 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3206 fi
3208 if test "x$with_libtokyotyrant" = "xyes"
3209 then
3210 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3211 [
3212 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3213 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3214 ],
3215 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3216 [$with_libtokyotyrant_libs])
3217 fi
3219 CPPFLAGS="$SAVE_CPPFLAGS"
3220 LDFLAGS="$SAVE_LDFLAGS"
3222 if test "x$with_libtokyotyrant" = "xyes"
3223 then
3224 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3225 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3226 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3227 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3228 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3229 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3230 fi
3231 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3232 # }}}
3234 # --with-libupsclient {{{
3235 with_libupsclient_config=""
3236 with_libupsclient_cflags=""
3237 with_libupsclient_libs=""
3238 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3239 [
3240 if test "x$withval" = "xno"
3241 then
3242 with_libupsclient="no"
3243 else if test "x$withval" = "xyes"
3244 then
3245 with_libupsclient="use_pkgconfig"
3246 else
3247 if test -x "$withval"
3248 then
3249 with_libupsclient_config="$withval"
3250 with_libupsclient="use_libupsclient_config"
3251 else if test -x "$withval/bin/libupsclient-config"
3252 then
3253 with_libupsclient_config="$withval/bin/libupsclient-config"
3254 with_libupsclient="use_libupsclient_config"
3255 else
3256 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3257 with_libupsclient_cflags="-I$withval/include"
3258 with_libupsclient_libs="-L$withval/lib -lupsclient"
3259 with_libupsclient="yes"
3260 fi; fi
3261 fi; fi
3262 ],
3263 [with_libupsclient="use_pkgconfig"])
3265 # configure using libupsclient-config
3266 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3267 then
3268 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3269 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3270 if test $? -ne 0
3271 then
3272 with_libupsclient="no ($with_libupsclient_config failed)"
3273 fi
3274 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3275 if test $? -ne 0
3276 then
3277 with_libupsclient="no ($with_libupsclient_config failed)"
3278 fi
3279 fi
3280 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3281 then
3282 with_libupsclient="yes"
3283 fi
3285 # configure using pkg-config
3286 if test "x$with_libupsclient" = "xuse_pkgconfig"
3287 then
3288 if test "x$PKG_CONFIG" = "x"
3289 then
3290 with_libupsclient="no (Don't have pkg-config)"
3291 fi
3292 fi
3293 if test "x$with_libupsclient" = "xuse_pkgconfig"
3294 then
3295 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3296 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3297 if test $? -ne 0
3298 then
3299 with_libupsclient="no (pkg-config doesn't know library)"
3300 fi
3301 fi
3302 if test "x$with_libupsclient" = "xuse_pkgconfig"
3303 then
3304 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3305 if test $? -ne 0
3306 then
3307 with_libupsclient="no ($PKG_CONFIG failed)"
3308 fi
3309 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3310 if test $? -ne 0
3311 then
3312 with_libupsclient="no ($PKG_CONFIG failed)"
3313 fi
3314 fi
3315 if test "x$with_libupsclient" = "xuse_pkgconfig"
3316 then
3317 with_libupsclient="yes"
3318 fi
3320 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3321 # the actual checks.
3322 if test "x$with_libupsclient" = "xyes"
3323 then
3324 SAVE_CPPFLAGS="$CPPFLAGS"
3325 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3327 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3329 CPPFLAGS="$SAVE_CPPFLAGS"
3330 fi
3331 if test "x$with_libupsclient" = "xyes"
3332 then
3333 SAVE_CPPFLAGS="$CPPFLAGS"
3334 SAVE_LDFLAGS="$LDFLAGS"
3336 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3337 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3339 AC_CHECK_LIB(upsclient, upscli_connect,
3340 [with_libupsclient="yes"],
3341 [with_libupsclient="no (symbol upscli_connect not found)"])
3343 CPPFLAGS="$SAVE_CPPFLAGS"
3344 LDFLAGS="$SAVE_LDFLAGS"
3345 fi
3346 if test "x$with_libupsclient" = "xyes"
3347 then
3348 SAVE_CPPFLAGS="$CPPFLAGS"
3349 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3351 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3352 [#include <stdlib.h>
3353 #include <stdio.h>
3354 #include <upsclient.h>])
3356 CPPFLAGS="$SAVE_CPPFLAGS"
3357 fi
3358 if test "x$with_libupsclient" = "xyes"
3359 then
3360 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3361 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3362 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3363 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3364 fi
3365 # }}}
3367 # --with-libxmms {{{
3368 with_xmms_config="xmms-config"
3369 with_xmms_cflags=""
3370 with_xmms_libs=""
3371 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3372 [
3373 if test "x$withval" != "xno" \
3374 && test "x$withval" != "xyes"
3375 then
3376 if test -f "$withval" && test -x "$withval";
3377 then
3378 with_xmms_config="$withval"
3379 else if test -x "$withval/bin/xmms-config"
3380 then
3381 with_xmms_config="$withval/bin/xmms-config"
3382 fi; fi
3383 with_libxmms="yes"
3384 else if test "x$withval" = "xno"
3385 then
3386 with_libxmms="no"
3387 else
3388 with_libxmms="yes"
3389 fi; fi
3390 ],
3391 [
3392 with_libxmms="yes"
3393 ])
3394 if test "x$with_libxmms" = "xyes"
3395 then
3396 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3397 xmms_config_status=$?
3399 if test $xmms_config_status -ne 0
3400 then
3401 with_libxmms="no"
3402 fi
3403 fi
3404 if test "x$with_libxmms" = "xyes"
3405 then
3406 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3407 xmms_config_status=$?
3409 if test $xmms_config_status -ne 0
3410 then
3411 with_libxmms="no"
3412 fi
3413 fi
3414 if test "x$with_libxmms" = "xyes"
3415 then
3416 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3417 [
3418 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3419 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3420 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3421 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3422 ],
3423 [
3424 with_libxmms="no"
3425 ],
3426 [$with_xmms_libs])
3427 fi
3428 with_libxmms_numeric=0
3429 if test "x$with_libxmms" = "xyes"
3430 then
3431 with_libxmms_numeric=1
3432 fi
3433 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3434 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3435 # }}}
3437 # --with-libyajl {{{
3438 with_libyajl_cppflags=""
3439 with_libyajl_ldflags=""
3440 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3441 [
3442 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3443 then
3444 with_libyajl_cppflags="-I$withval/include"
3445 with_libyajl_ldflags="-L$withval/lib"
3446 with_libyajl="yes"
3447 else
3448 with_libyajl="$withval"
3449 fi
3450 ],
3451 [
3452 with_libyajl="yes"
3453 ])
3454 if test "x$with_libyajl" = "xyes"
3455 then
3456 SAVE_CPPFLAGS="$CPPFLAGS"
3457 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3459 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3461 CPPFLAGS="$SAVE_CPPFLAGS"
3462 fi
3463 if test "x$with_libyajl" = "xyes"
3464 then
3465 SAVE_CPPFLAGS="$CPPFLAGS"
3466 SAVE_LDFLAGS="$LDFLAGS"
3467 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3468 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3470 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3472 CPPFLAGS="$SAVE_CPPFLAGS"
3473 LDFLAGS="$SAVE_LDFLAGS"
3474 fi
3475 if test "x$with_libyajl" = "xyes"
3476 then
3477 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3478 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3479 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3480 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3481 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3482 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3483 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3484 fi
3485 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3486 # }}}
3488 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3489 with_libxml2="no (pkg-config isn't available)"
3490 with_libxml2_cflags=""
3491 with_libxml2_ldflags=""
3492 with_libvirt="no (pkg-config isn't available)"
3493 with_libvirt_cflags=""
3494 with_libvirt_ldflags=""
3495 if test "x$PKG_CONFIG" != "x"
3496 then
3497 pkg-config --exists 'libxml-2.0' 2>/dev/null
3498 if test "$?" = "0"
3499 then
3500 with_libxml2="yes"
3501 else
3502 with_libxml2="no (pkg-config doesn't know library)"
3503 fi
3505 pkg-config --exists libvirt 2>/dev/null
3506 if test "$?" = "0"
3507 then
3508 with_libvirt="yes"
3509 else
3510 with_libvirt="no (pkg-config doesn't know library)"
3511 fi
3512 fi
3513 if test "x$with_libxml2" = "xyes"
3514 then
3515 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3516 if test $? -ne 0
3517 then
3518 with_libxml2="no"
3519 fi
3520 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3521 if test $? -ne 0
3522 then
3523 with_libxml2="no"
3524 fi
3525 fi
3526 if test "x$with_libxml2" = "xyes"
3527 then
3528 SAVE_CPPFLAGS="$CPPFLAGS"
3529 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3531 AC_CHECK_HEADERS(libxml/parser.h, [],
3532 [with_libxml2="no (libxml/parser.h not found)"])
3534 CPPFLAGS="$SAVE_CPPFLAGS"
3535 fi
3536 if test "x$with_libxml2" = "xyes"
3537 then
3538 SAVE_CFLAGS="$CFLAGS"
3539 SAVE_LDFLAGS="$LDFLAGS"
3541 CFLAGS="$CFLAGS $with_libxml2_cflags"
3542 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3544 AC_CHECK_LIB(xml2, xmlXPathEval,
3545 [with_libxml2="yes"],
3546 [with_libxml2="no (symbol xmlXPathEval not found)"])
3548 CFLAGS="$SAVE_CFLAGS"
3549 LDFLAGS="$SAVE_LDFLAGS"
3550 fi
3551 dnl Add the right compiler flags and libraries.
3552 if test "x$with_libxml2" = "xyes"; then
3553 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3554 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3555 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3556 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3557 fi
3558 if test "x$with_libvirt" = "xyes"
3559 then
3560 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3561 if test $? -ne 0
3562 then
3563 with_libvirt="no"
3564 fi
3565 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3566 if test $? -ne 0
3567 then
3568 with_libvirt="no"
3569 fi
3570 fi
3571 if test "x$with_libvirt" = "xyes"
3572 then
3573 SAVE_CPPFLAGS="$CPPFLAGS"
3574 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3576 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3577 [with_libvirt="no (libvirt/libvirt.h not found)"])
3579 CPPFLAGS="$SAVE_CPPFLAGS"
3580 fi
3581 if test "x$with_libvirt" = "xyes"
3582 then
3583 SAVE_CFLAGS="$CFLAGS"
3584 SAVE_LDFLAGS="$LDFLAGS"
3586 CFLAGS="$CFLAGS $with_libvirt_cflags"
3587 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3589 AC_CHECK_LIB(virt, virDomainBlockStats,
3590 [with_libvirt="yes"],
3591 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3593 CFLAGS="$SAVE_CFLAGS"
3594 LDFLAGS="$SAVE_LDFLAGS"
3595 fi
3596 dnl Add the right compiler flags and libraries.
3597 if test "x$with_libvirt" = "xyes"; then
3598 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3599 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3600 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3601 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3602 fi
3603 # }}}
3605 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3606 with_libopenipmipthread="yes"
3607 with_libopenipmipthread_cflags=""
3608 with_libopenipmipthread_libs=""
3610 AC_MSG_CHECKING([for pkg-config])
3611 temp_result="no"
3612 if test "x$PKG_CONFIG" = "x"
3613 then
3614 with_libopenipmipthread="no"
3615 temp_result="no"
3616 else
3617 temp_result="$PKG_CONFIG"
3618 fi
3619 AC_MSG_RESULT([$temp_result])
3621 if test "x$with_libopenipmipthread" = "xyes"
3622 then
3623 AC_MSG_CHECKING([for libOpenIPMIpthread])
3624 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3625 if test "$?" != "0"
3626 then
3627 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3628 fi
3629 AC_MSG_RESULT([$with_libopenipmipthread])
3630 fi
3632 if test "x$with_libopenipmipthread" = "xyes"
3633 then
3634 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3635 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3636 if test "$?" = "0"
3637 then
3638 with_libopenipmipthread_cflags="$temp_result"
3639 else
3640 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3641 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3642 fi
3643 AC_MSG_RESULT([$temp_result])
3644 fi
3646 if test "x$with_libopenipmipthread" = "xyes"
3647 then
3648 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3649 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3650 if test "$?" = "0"
3651 then
3652 with_libopenipmipthread_ldflags="$temp_result"
3653 else
3654 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3655 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3656 fi
3657 AC_MSG_RESULT([$temp_result])
3658 fi
3660 if test "x$with_libopenipmipthread" = "xyes"
3661 then
3662 SAVE_CPPFLAGS="$CPPFLAGS"
3663 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3665 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3666 [with_libopenipmipthread="yes"],
3667 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3668 [#include <OpenIPMI/ipmiif.h>
3669 #include <OpenIPMI/ipmi_err.h>
3670 #include <OpenIPMI/ipmi_posix.h>
3671 #include <OpenIPMI/ipmi_conn.h>
3672 ])
3674 CPPFLAGS="$SAVE_CPPFLAGS"
3675 fi
3677 if test "x$with_libopenipmipthread" = "xyes"
3678 then
3679 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3680 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3681 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3682 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3683 fi
3684 # }}}
3686 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3687 [with_libnotify="yes"],
3688 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3690 # Check for enabled/disabled features
3691 #
3693 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3694 # ------------------------------------------------------------
3695 dnl
3696 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3697 dnl
3698 AC_DEFUN(
3699 [AC_COLLECTD],
3700 [
3701 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3702 m4_if(
3703 [$2],
3704 [enable],
3705 [dnl
3706 m4_define([EnDis],[disabled])dnl
3707 m4_define([YesNo],[no])dnl
3708 ],dnl
3709 [m4_if(
3710 [$2],
3711 [disable],
3712 [dnl
3713 m4_define([EnDis],[enabled])dnl
3714 m4_define([YesNo],[yes])dnl
3715 ],
3716 [dnl
3717 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3718 ]dnl
3719 )]dnl
3720 )dnl
3721 m4_if([$3], [feature], [],
3722 [m4_if(
3723 [$3], [module], [],
3724 [dnl
3725 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3726 ]dnl
3727 )]dnl
3728 )dnl
3729 AC_ARG_ENABLE(
3730 [$1],
3731 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3732 [],
3733 enable_$1='[YesNo]'dnl
3734 )# AC_ARG_ENABLE
3735 if test "x$enable_$1" = "xno"
3736 then
3737 collectd_$1=0
3738 else
3739 if test "x$enable_$1" = "xyes"
3740 then
3741 collectd_$1=1
3742 else
3743 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3744 collectd_$1=1
3745 enable_$1='yes'
3746 fi
3747 fi
3748 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3749 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3750 ]dnl
3751 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3753 # AC_PLUGIN(name, default, info)
3754 # ------------------------------------------------------------
3755 dnl
3756 AC_DEFUN(
3757 [AC_PLUGIN],
3758 [
3759 enable_plugin="no"
3760 force="no"
3761 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3762 [
3763 if test "x$enableval" = "xyes"
3764 then
3765 enable_plugin="yes"
3766 else if test "x$enableval" = "xforce"
3767 then
3768 enable_plugin="yes"
3769 force="yes"
3770 else
3771 enable_plugin="no"
3772 fi; fi
3773 ],
3774 [
3775 if test "x$enable_all_plugins" = "xauto"
3776 then
3777 if test "x$2" = "xyes"
3778 then
3779 enable_plugin="yes"
3780 else
3781 enable_plugin="no"
3782 fi
3783 else
3784 enable_plugin="$enable_all_plugins"
3785 fi
3786 ])
3787 if test "x$enable_plugin" = "xyes"
3788 then
3789 if test "x$2" = "xyes" || test "x$force" = "xyes"
3790 then
3791 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3792 if test "x$2" != "xyes"
3793 then
3794 dependency_warning="yes"
3795 fi
3796 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3797 dependency_error="yes"
3798 enable_plugin="no (dependency error)"
3799 fi
3800 fi
3801 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3802 enable_$1="$enable_plugin"
3803 ]
3804 )# AC_PLUGIN(name, default, info)
3806 m4_divert_once([HELP_ENABLE], [
3807 collectd features:])
3808 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3809 AC_COLLECTD([debug], [enable], [feature], [debugging])
3810 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3811 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3813 dependency_warning="no"
3814 dependency_error="no"
3816 plugin_ascent="no"
3817 plugin_battery="no"
3818 plugin_bind="no"
3819 plugin_conntrack="no"
3820 plugin_contextswitch="no"
3821 plugin_cpu="no"
3822 plugin_cpufreq="no"
3823 plugin_curl_json="no"
3824 plugin_df="no"
3825 plugin_disk="no"
3826 plugin_entropy="no"
3827 plugin_interface="no"
3828 plugin_ipmi="no"
3829 plugin_ipvs="no"
3830 plugin_irq="no"
3831 plugin_libvirt="no"
3832 plugin_load="no"
3833 plugin_memory="no"
3834 plugin_multimeter="no"
3835 plugin_nfs="no"
3836 plugin_fscache="no"
3837 plugin_perl="no"
3838 plugin_processes="no"
3839 plugin_protocols="no"
3840 plugin_serial="no"
3841 plugin_swap="no"
3842 plugin_tape="no"
3843 plugin_tcpconns="no"
3844 plugin_ted="no"
3845 plugin_thermal="no"
3846 plugin_users="no"
3847 plugin_uptime="no"
3848 plugin_vmem="no"
3849 plugin_vserver="no"
3850 plugin_wireless="no"
3851 plugin_zfs_arc="no"
3853 # Linux
3854 if test "x$ac_system" = "xLinux"
3855 then
3856 plugin_battery="yes"
3857 plugin_conntrack="yes"
3858 plugin_contextswitch="yes"
3859 plugin_cpu="yes"
3860 plugin_cpufreq="yes"
3861 plugin_disk="yes"
3862 plugin_entropy="yes"
3863 plugin_interface="yes"
3864 plugin_irq="yes"
3865 plugin_load="yes"
3866 plugin_memory="yes"
3867 plugin_nfs="yes"
3868 plugin_fscache="yes"
3869 plugin_processes="yes"
3870 plugin_protocols="yes"
3871 plugin_serial="yes"
3872 plugin_swap="yes"
3873 plugin_tcpconns="yes"
3874 plugin_thermal="yes"
3875 plugin_uptime="yes"
3876 plugin_vmem="yes"
3877 plugin_vserver="yes"
3878 plugin_wireless="yes"
3880 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3881 then
3882 plugin_ipvs="yes"
3883 fi
3884 fi
3886 if test "x$ac_system" = "xOpenBSD"
3887 then
3888 plugin_tcpconns="yes"
3889 fi
3891 # Mac OS X devices
3892 if test "x$with_libiokit" = "xyes"
3893 then
3894 plugin_battery="yes"
3895 plugin_disk="yes"
3896 fi
3898 # AIX
3899 if test "x$with_perfstat" = "xyes"
3900 then
3901 plugin_cpu="yes"
3902 plugin_disk="yes"
3903 plugin_memory="yes"
3904 plugin_swap="yes"
3905 plugin_interface="yes"
3906 plugin_load="yes"
3907 fi
3909 if test "x$with_procinfo" = "xyes"
3910 then
3911 plugin_processes="yes"
3912 fi
3914 # Solaris
3915 if test "x$with_kstat" = "xyes"
3916 then
3917 plugin_uptime="yes"
3918 plugin_zfs_arc="yes"
3919 fi
3921 if test "x$with_devinfo$with_kstat" = "xyesyes"
3922 then
3923 plugin_cpu="yes"
3924 plugin_disk="yes"
3925 plugin_interface="yes"
3926 plugin_memory="yes"
3927 plugin_tape="yes"
3928 fi
3930 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3931 then
3932 plugin_swap="yes"
3933 fi
3935 # libstatgrab
3936 if test "x$with_libstatgrab" = "xyes"
3937 then
3938 plugin_cpu="yes"
3939 plugin_disk="yes"
3940 plugin_interface="yes"
3941 plugin_load="yes"
3942 plugin_memory="yes"
3943 plugin_swap="yes"
3944 plugin_users="yes"
3945 fi
3947 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3948 then
3949 plugin_ascent="yes"
3950 plugin_bind="yes"
3951 fi
3953 if test "x$with_libopenipmipthread" = "xyes"
3954 then
3955 plugin_ipmi="yes"
3956 fi
3958 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
3959 then
3960 plugin_curl_json="yes"
3961 fi
3963 if test "x$have_processor_info" = "xyes"
3964 then
3965 plugin_cpu="yes"
3966 fi
3967 if test "x$have_sysctl" = "xyes"
3968 then
3969 plugin_cpu="yes"
3970 plugin_memory="yes"
3971 plugin_swap="yes"
3972 plugin_uptime="yes"
3973 fi
3974 if test "x$have_sysctlbyname" = "xyes"
3975 then
3976 plugin_cpu="yes"
3977 plugin_memory="yes"
3978 plugin_tcpconns="yes"
3979 fi
3981 # Df plugin: Check if we know how to determine mount points first.
3982 #if test "x$have_listmntent" = "xyes"; then
3983 # plugin_df="yes"
3984 #fi
3985 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3986 then
3987 plugin_df="yes"
3988 fi
3989 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3990 then
3991 plugin_df="yes"
3992 fi
3993 #if test "x$have_getmntent" = "xseq"
3994 #then
3995 # plugin_df="yes"
3996 #fi
3997 if test "x$c_cv_have_one_getmntent" = "xyes"
3998 then
3999 plugin_df="yes"
4000 fi
4002 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4003 if test "x$plugin_df" = "xyes"
4004 then
4005 plugin_df="no"
4006 if test "x$have_statfs" = "xyes"
4007 then
4008 plugin_df="yes"
4009 fi
4010 if test "x$have_statvfs" = "xyes"
4011 then
4012 plugin_df="yes"
4013 fi
4014 fi
4016 if test "x$have_getifaddrs" = "xyes"
4017 then
4018 plugin_interface="yes"
4019 fi
4021 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4022 then
4023 plugin_libvirt="yes"
4024 fi
4026 if test "x$have_getloadavg" = "xyes"
4027 then
4028 plugin_load="yes"
4029 fi
4031 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4032 then
4033 plugin_perl="yes"
4034 fi
4036 # Mac OS X memory interface
4037 if test "x$have_host_statistics" = "xyes"
4038 then
4039 plugin_memory="yes"
4040 fi
4042 if test "x$have_termios_h" = "xyes"
4043 then
4044 plugin_multimeter="yes"
4045 plugin_ted="yes"
4046 fi
4048 if test "x$have_thread_info" = "xyes"
4049 then
4050 plugin_processes="yes"
4051 fi
4053 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4054 then
4055 plugin_processes="yes"
4056 fi
4058 if test "x$with_kvm_getswapinfo" = "xyes"
4059 then
4060 plugin_swap="yes"
4061 fi
4063 if test "x$have_swapctl" = "xyes"
4064 then
4065 plugin_swap="yes"
4066 fi
4068 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4069 then
4070 plugin_tcpconns="yes"
4071 fi
4073 if test "x$have_getutent" = "xyes"
4074 then
4075 plugin_users="yes"
4076 fi
4077 if test "x$have_getutxent" = "xyes"
4078 then
4079 plugin_users="yes"
4080 fi
4082 m4_divert_once([HELP_ENABLE], [
4083 collectd plugins:])
4085 AC_ARG_ENABLE([all-plugins],
4086 AC_HELP_STRING([--enable-all-plugins],
4087 [enable all plugins (auto by def)]),
4088 [
4089 if test "x$enableval" = "xyes"
4090 then
4091 enable_all_plugins="yes"
4092 else if test "x$enableval" = "xauto"
4093 then
4094 enable_all_plugins="auto"
4095 else
4096 enable_all_plugins="no"
4097 fi; fi
4098 ],
4099 [enable_all_plugins="auto"])
4101 m4_divert_once([HELP_ENABLE], [])
4103 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4104 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4105 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4106 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4107 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4108 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4109 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4110 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4111 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4112 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4113 AC_PLUGIN([csv], [yes], [CSV output plugin])
4114 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4115 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4116 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4117 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4118 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4119 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4120 AC_PLUGIN([email], [yes], [EMail statistics])
4121 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4122 AC_PLUGIN([exec], [yes], [Execution of external programs])
4123 AC_PLUGIN([filecount], [yes], [Count files in directories])
4124 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4125 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4126 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4127 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4128 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4129 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4130 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4131 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4132 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4133 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4134 AC_PLUGIN([load], [$plugin_load], [System load])
4135 AC_PLUGIN([logfile], [yes], [File logging plugin])
4136 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4137 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4138 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4139 AC_PLUGIN([match_regex], [yes], [The regex match])
4140 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4141 AC_PLUGIN([match_value], [yes], [The value match])
4142 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4143 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4144 AC_PLUGIN([memcached], [yes], [memcached statistics])
4145 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4146 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4147 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4148 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4149 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4150 AC_PLUGIN([network], [yes], [Network communication plugin])
4151 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4152 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4153 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4154 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4155 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4156 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4157 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4158 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4159 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4160 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4161 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4162 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4163 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4164 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4165 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4166 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4167 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4168 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4169 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4170 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4171 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4172 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4173 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4174 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4175 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4176 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4177 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4178 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4179 AC_PLUGIN([target_notification], [yes], [The notification target])
4180 AC_PLUGIN([target_replace], [yes], [The replace target])
4181 AC_PLUGIN([target_scale],[yes], [The scale target])
4182 AC_PLUGIN([target_set], [yes], [The set target])
4183 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4184 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4185 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4186 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4187 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4188 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4189 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4190 AC_PLUGIN([users], [$plugin_users], [User statistics])
4191 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4192 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4193 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4194 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4195 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4196 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4197 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4199 dnl Default configuration file
4200 # Load either syslog or logfile
4201 LOAD_PLUGIN_SYSLOG=""
4202 LOAD_PLUGIN_LOGFILE=""
4204 AC_MSG_CHECKING([which default log plugin to load])
4205 default_log_plugin="none"
4206 if test "x$enable_syslog" = "xyes"
4207 then
4208 default_log_plugin="syslog"
4209 else
4210 LOAD_PLUGIN_SYSLOG="##"
4211 fi
4213 if test "x$enable_logfile" = "xyes"
4214 then
4215 if test "x$default_log_plugin" = "xnone"
4216 then
4217 default_log_plugin="logfile"
4218 else
4219 LOAD_PLUGIN_LOGFILE="#"
4220 fi
4221 else
4222 LOAD_PLUGIN_LOGFILE="##"
4223 fi
4224 AC_MSG_RESULT([$default_log_plugin])
4226 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4227 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4229 DEFAULT_LOG_LEVEL="info"
4230 if test "x$enable_debug" = "xyes"
4231 then
4232 DEFAULT_LOG_LEVEL="debug"
4233 fi
4234 AC_SUBST(DEFAULT_LOG_LEVEL)
4236 # Load only one of rrdtool, network, csv in the default config.
4237 LOAD_PLUGIN_RRDTOOL=""
4238 LOAD_PLUGIN_NETWORK=""
4239 LOAD_PLUGIN_CSV=""
4241 AC_MSG_CHECKING([which default write plugin to load])
4242 default_write_plugin="none"
4243 if test "x$enable_rrdtool" = "xyes"
4244 then
4245 default_write_plugin="rrdtool"
4246 else
4247 LOAD_PLUGIN_RRDTOOL="##"
4248 fi
4250 if test "x$enable_network" = "xyes"
4251 then
4252 if test "x$default_write_plugin" = "xnone"
4253 then
4254 default_write_plugin="network"
4255 else
4256 LOAD_PLUGIN_NETWORK="#"
4257 fi
4258 else
4259 LOAD_PLUGIN_NETWORK="##"
4260 fi
4262 if test "x$enable_csv" = "xyes"
4263 then
4264 if test "x$default_write_plugin" = "xnone"
4265 then
4266 default_write_plugin="csv"
4267 else
4268 LOAD_PLUGIN_CSV="#"
4269 fi
4270 else
4271 LOAD_PLUGIN_CSV="##"
4272 fi
4273 AC_MSG_RESULT([$default_write_plugin])
4275 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4276 AC_SUBST(LOAD_PLUGIN_NETWORK)
4277 AC_SUBST(LOAD_PLUGIN_CSV)
4279 dnl ip_vs.h
4280 if test "x$ac_system" = "xLinux" \
4281 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4282 then
4283 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4284 fi
4286 dnl Perl bindings
4287 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4288 [
4289 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4290 then
4291 PERL_BINDINGS_OPTIONS="$withval"
4292 with_perl_bindings="yes"
4293 else
4294 PERL_BINDINGS_OPTIONS=""
4295 with_perl_bindings="$withval"
4296 fi
4297 ],
4298 [
4299 PERL_BINDINGS_OPTIONS=""
4300 if test -n "$perl_interpreter"
4301 then
4302 with_perl_bindings="yes"
4303 else
4304 with_perl_bindings="no (no perl interpreter found)"
4305 fi
4306 ])
4307 if test "x$with_perl_bindings" = "xyes"
4308 then
4309 PERL_BINDINGS="perl"
4310 else
4311 PERL_BINDINGS=""
4312 fi
4313 AC_SUBST(PERL_BINDINGS)
4314 AC_SUBST(PERL_BINDINGS_OPTIONS)
4316 dnl libcollectdclient
4317 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4318 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4319 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4321 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4323 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4325 AC_SUBST(LCC_VERSION_MAJOR)
4326 AC_SUBST(LCC_VERSION_MINOR)
4327 AC_SUBST(LCC_VERSION_PATCH)
4328 AC_SUBST(LCC_VERSION_EXTRA)
4329 AC_SUBST(LCC_VERSION_STRING)
4331 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4333 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)
4335 if test "x$with_librrd" = "xyes" \
4336 && test "x$librrd_threadsafe" != "xyes"
4337 then
4338 with_librrd="yes (warning: librrd is not thread-safe)"
4339 fi
4341 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
4342 then
4343 with_libiptc="yes (shipped version)"
4344 fi
4346 if test "x$with_libperl" = "xyes"
4347 then
4348 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4349 else
4350 enable_perl="no (needs libperl)"
4351 fi
4353 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4354 then
4355 enable_perl="no (libperl doesn't support ithreads)"
4356 fi
4358 if test "x$with_perl_bindings" = "xyes" \
4359 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4360 then
4361 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4362 fi
4364 cat <<EOF;
4366 Configuration:
4367 Libraries:
4368 libcurl . . . . . . . $with_libcurl
4369 libdbi . . . . . . . $with_libdbi
4370 libesmtp . . . . . . $with_libesmtp
4371 libganglia . . . . . $with_libganglia
4372 libgcrypt . . . . . . $with_libgcrypt
4373 libiokit . . . . . . $with_libiokit
4374 libiptc . . . . . . . $with_libiptc
4375 libjvm . . . . . . . $with_java
4376 libkstat . . . . . . $with_kstat
4377 libkvm . . . . . . . $with_libkvm
4378 libmemcached . . . . $with_libmemcached
4379 libmysql . . . . . . $with_libmysql
4380 libnetapp . . . . . . $with_libnetapp
4381 libnetlink . . . . . $with_libnetlink
4382 libnetsnmp . . . . . $with_libnetsnmp
4383 libnotify . . . . . . $with_libnotify
4384 liboconfig . . . . . $with_liboconfig
4385 libopenipmi . . . . . $with_libopenipmipthread
4386 liboping . . . . . . $with_liboping
4387 libpcap . . . . . . . $with_libpcap
4388 libperfstat . . . . . $with_perfstat
4389 libperl . . . . . . . $with_libperl
4390 libpq . . . . . . . . $with_libpq
4391 libpthread . . . . . $with_libpthread
4392 librouteros . . . . . $with_librouteros
4393 librrd . . . . . . . $with_librrd
4394 libsensors . . . . . $with_libsensors
4395 libstatgrab . . . . . $with_libstatgrab
4396 libtokyotyrant . . . $with_libtokyotyrant
4397 libupsclient . . . . $with_libupsclient
4398 libvirt . . . . . . . $with_libvirt
4399 libxml2 . . . . . . . $with_libxml2
4400 libxmms . . . . . . . $with_libxmms
4401 libyajl . . . . . . . $with_libyajl
4402 oracle . . . . . . . $with_oracle
4403 python . . . . . . . $with_python
4405 Features:
4406 daemon mode . . . . . $enable_daemon
4407 debug . . . . . . . . $enable_debug
4409 Bindings:
4410 perl . . . . . . . . $with_perl_bindings
4412 Modules:
4413 apache . . . . . . . $enable_apache
4414 apcups . . . . . . . $enable_apcups
4415 apple_sensors . . . . $enable_apple_sensors
4416 ascent . . . . . . . $enable_ascent
4417 battery . . . . . . . $enable_battery
4418 bind . . . . . . . . $enable_bind
4419 conntrack . . . . . . $enable_conntrack
4420 contextswitch . . . . $enable_contextswitch
4421 cpu . . . . . . . . . $enable_cpu
4422 cpufreq . . . . . . . $enable_cpufreq
4423 csv . . . . . . . . . $enable_csv
4424 curl . . . . . . . . $enable_curl
4425 curl_json . . . . . . $enable_curl_json
4426 dbi . . . . . . . . . $enable_dbi
4427 df . . . . . . . . . $enable_df
4428 disk . . . . . . . . $enable_disk
4429 dns . . . . . . . . . $enable_dns
4430 email . . . . . . . . $enable_email
4431 entropy . . . . . . . $enable_entropy
4432 exec . . . . . . . . $enable_exec
4433 filecount . . . . . . $enable_filecount
4434 fscache . . . . . . . $enable_fscache
4435 gmond . . . . . . . . $enable_gmond
4436 hddtemp . . . . . . . $enable_hddtemp
4437 interface . . . . . . $enable_interface
4438 ipmi . . . . . . . . $enable_ipmi
4439 iptables . . . . . . $enable_iptables
4440 ipvs . . . . . . . . $enable_ipvs
4441 irq . . . . . . . . . $enable_irq
4442 java . . . . . . . . $enable_java
4443 libvirt . . . . . . . $enable_libvirt
4444 load . . . . . . . . $enable_load
4445 logfile . . . . . . . $enable_logfile
4446 madwifi . . . . . . . $enable_madwifi
4447 match_empty_counter . $enable_match_empty_counter
4448 match_hashed . . . . $enable_match_hashed
4449 match_regex . . . . . $enable_match_regex
4450 match_timediff . . . $enable_match_timediff
4451 match_value . . . . . $enable_match_value
4452 mbmon . . . . . . . . $enable_mbmon
4453 memcachec . . . . . . $enable_memcachec
4454 memcached . . . . . . $enable_memcached
4455 memory . . . . . . . $enable_memory
4456 multimeter . . . . . $enable_multimeter
4457 mysql . . . . . . . . $enable_mysql
4458 netapp . . . . . . . $enable_netapp
4459 netlink . . . . . . . $enable_netlink
4460 network . . . . . . . $enable_network
4461 nfs . . . . . . . . . $enable_nfs
4462 nginx . . . . . . . . $enable_nginx
4463 notify_desktop . . . $enable_notify_desktop
4464 notify_email . . . . $enable_notify_email
4465 ntpd . . . . . . . . $enable_ntpd
4466 nut . . . . . . . . . $enable_nut
4467 olsrd . . . . . . . . $enable_olsrd
4468 onewire . . . . . . . $enable_onewire
4469 openvpn . . . . . . . $enable_openvpn
4470 oracle . . . . . . . $enable_oracle
4471 perl . . . . . . . . $enable_perl
4472 ping . . . . . . . . $enable_ping
4473 postgresql . . . . . $enable_postgresql
4474 powerdns . . . . . . $enable_powerdns
4475 processes . . . . . . $enable_processes
4476 protocols . . . . . . $enable_protocols
4477 python . . . . . . . $enable_python
4478 routeros . . . . . . $enable_routeros
4479 rrdcached . . . . . . $enable_rrdcached
4480 rrdtool . . . . . . . $enable_rrdtool
4481 sensors . . . . . . . $enable_sensors
4482 serial . . . . . . . $enable_serial
4483 snmp . . . . . . . . $enable_snmp
4484 swap . . . . . . . . $enable_swap
4485 syslog . . . . . . . $enable_syslog
4486 table . . . . . . . . $enable_table
4487 tail . . . . . . . . $enable_tail
4488 tape . . . . . . . . $enable_tape
4489 target_notification . $enable_target_notification
4490 target_replace . . . $enable_target_replace
4491 target_scale . . . . $enable_target_scale
4492 target_set . . . . . $enable_target_set
4493 tcpconns . . . . . . $enable_tcpconns
4494 teamspeak2 . . . . . $enable_teamspeak2
4495 ted . . . . . . . . . $enable_ted
4496 thermal . . . . . . . $enable_thermal
4497 tokyotyrant . . . . . $enable_tokyotyrant
4498 unixsock . . . . . . $enable_unixsock
4499 uptime . . . . . . . $enable_uptime
4500 users . . . . . . . . $enable_users
4501 uuid . . . . . . . . $enable_uuid
4502 vmem . . . . . . . . $enable_vmem
4503 vserver . . . . . . . $enable_vserver
4504 wireless . . . . . . $enable_wireless
4505 write_http . . . . . $enable_write_http
4506 xmms . . . . . . . . $enable_xmms
4507 zfs_arc . . . . . . . $enable_zfs_arc
4509 EOF
4511 if test "x$dependency_error" = "xyes"; then
4512 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4513 fi
4515 if test "x$dependency_warning" = "xyes"; then
4516 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4517 fi
4519 # vim: set fdm=marker :