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