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