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