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