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