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)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_PROG_CC_C_O
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
23 dnl configure libtool
24 AC_DISABLE_STATIC
25 AC_LIBLTDL_CONVENIENCE
26 AC_SUBST(LTDLINCL)
27 AC_SUBST(LIBLTDL)
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_LEX
31 AC_PROG_YACC
32 PKG_PROG_PKG_CONFIG
33 AC_CONFIG_SUBDIRS(libltdl)
35 AC_MSG_CHECKING([for kernel type ($host_os)])
36 case $host_os in
37 *linux*)
38 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
39 ac_system="Linux"
40 ;;
41 *solaris*)
42 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
43 ac_system="Solaris"
44 ;;
45 *darwin*)
46 ac_system="Darwin"
47 ;;
48 *openbsd*)
49 ac_system="OpenBSD"
50 ;;
51 *)
52 ac_system="unknown"
53 esac
54 AC_MSG_RESULT([$ac_system])
56 if test "x$ac_system" = "xLinux"
57 then
58 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
59 if test -z "$KERNEL_DIR"
60 then
61 KERNEL_DIR="/lib/modules/`uname -r`/source"
62 fi
64 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
65 AC_SUBST(KERNEL_CFLAGS)
66 fi
68 if test "x$ac_system" = "xSolaris"
69 then
70 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
71 fi
73 # Where to install .pc files.
74 pkgconfigdir="${libdir}/pkgconfig"
75 AC_SUBST(pkgconfigdir)
77 # Check for standards compliance mode
78 AC_ARG_ENABLE(standards,
79 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
80 [enable_standards="$enableval"],
81 [enable_standards="no"])
82 if test "x$enable_standards" = "xyes"
83 then
84 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
85 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
86 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
87 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
88 fi
89 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
91 #
92 # Checks for header files.
93 #
94 AC_HEADER_STDC
95 AC_HEADER_SYS_WAIT
96 AC_HEADER_DIRENT
97 AC_HEADER_STDBOOL
99 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)
101 # For ping library
102 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
103 [#if HAVE_STDINT_H
104 # include <stdint.h>
105 #endif
106 #if HAVE_SYS_TYPES_H
107 # include <sys/types.h>
108 #endif
109 ])
110 AC_CHECK_HEADERS(netinet/in.h, [], [],
111 [#if HAVE_STDINT_H
112 # include <stdint.h>
113 #endif
114 #if HAVE_SYS_TYPES_H
115 # include <sys/types.h>
116 #endif
117 #if HAVE_NETINET_IN_SYSTM_H
118 # include <netinet/in_systm.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_NETINET_IN_SYSTM_H
129 # include <netinet/in_systm.h>
130 #endif
131 #if HAVE_NETINET_IN_H
132 # include <netinet/in.h>
133 #endif
134 ])
135 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
136 [#if HAVE_STDINT_H
137 # include <stdint.h>
138 #endif
139 #if HAVE_SYS_TYPES_H
140 # include <sys/types.h>
141 #endif
142 #if HAVE_NETINET_IN_SYSTM_H
143 # include <netinet/in_systm.h>
144 #endif
145 #if HAVE_NETINET_IN_H
146 # include <netinet/in.h>
147 #endif
148 #if HAVE_NETINET_IP_H
149 # include <netinet/ip.h>
150 #endif
151 ])
152 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
153 [#if HAVE_STDINT_H
154 # include <stdint.h>
155 #endif
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 #if HAVE_NETINET_IP_H
166 # include <netinet/ip.h>
167 #endif
168 ])
169 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
170 [#if HAVE_STDINT_H
171 # include <stdint.h>
172 #endif
173 #if HAVE_SYS_TYPES_H
174 # include <sys/types.h>
175 #endif
176 #if HAVE_NETINET_IN_SYSTM_H
177 # include <netinet/in_systm.h>
178 #endif
179 #if HAVE_NETINET_IN_H
180 # include <netinet/in.h>
181 #endif
182 ])
183 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
184 [#if HAVE_STDINT_H
185 # include <stdint.h>
186 #endif
187 #if HAVE_SYS_TYPES_H
188 # include <sys/types.h>
189 #endif
190 #if HAVE_NETINET_IN_SYSTM_H
191 # include <netinet/in_systm.h>
192 #endif
193 #if HAVE_NETINET_IN_H
194 # include <netinet/in.h>
195 #endif
196 #if HAVE_NETINET_IP6_H
197 # include <netinet/ip6.h>
198 #endif
199 ])
200 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
201 [#if HAVE_STDINT_H
202 # include <stdint.h>
203 #endif
204 #if HAVE_SYS_TYPES_H
205 # include <sys/types.h>
206 #endif
207 #if HAVE_NETINET_IN_SYSTM_H
208 # include <netinet/in_systm.h>
209 #endif
210 #if HAVE_NETINET_IN_H
211 # include <netinet/in.h>
212 #endif
213 #if HAVE_NETINET_IP_H
214 # include <netinet/ip.h>
215 #endif
216 ])
217 AC_CHECK_HEADERS(netinet/udp.h, [], [],
218 [#if HAVE_STDINT_H
219 # include <stdint.h>
220 #endif
221 #if HAVE_SYS_TYPES_H
222 # include <sys/types.h>
223 #endif
224 #if HAVE_NETINET_IN_SYSTM_H
225 # include <netinet/in_systm.h>
226 #endif
227 #if HAVE_NETINET_IN_H
228 # include <netinet/in.h>
229 #endif
230 #if HAVE_NETINET_IP_H
231 # include <netinet/ip.h>
232 #endif
233 ])
235 # For cpu modules
236 AC_CHECK_HEADERS(sys/dkstat.h)
237 if test "x$ac_system" = "xDarwin"
238 then
239 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)
240 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
241 fi
242 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
243 [
244 #if HAVE_SYS_TYPES_H
245 # include <sys/types.h>
246 #endif
247 #if HAVE_SYS_PARAM_H
248 # include <sys/param.h>
249 #endif
250 ])
252 # For hddtemp module
253 AC_CHECK_HEADERS(linux/major.h libgen.h)
255 # For the battery plugin
256 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
257 [
258 #if HAVE_IOKIT_IOKITLIB_H
259 # include <IOKit/IOKitLib.h>
260 #endif
261 #if HAVE_IOKIT_IOTYPES_H
262 # include <IOKit/IOTypes.h>
263 #endif
264 ])
266 # For the swap module
267 have_sys_swap_h="yes"
268 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
269 [
270 #if HAVE_SYS_TYPES_H
271 # include <sys/types.h>
272 #endif
273 #if HAVE_SYS_PARAM_H
274 # include <sys/param.h>
275 #endif
276 ])
278 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
279 then
280 hint_64=""
281 if test "x$GCC" = "xyes"
282 then
283 hint_64="CFLAGS='-m64'"
284 else
285 hint_64="CFLAGS='-xarch=v9'"
286 fi
287 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
288 fi
290 # For load module
291 # For the processes plugin
292 # For users module
293 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
295 # For interface plugin
296 AC_CHECK_HEADERS(ifaddrs.h)
297 AC_CHECK_HEADERS(net/if.h, [], [],
298 [
299 #if HAVE_SYS_TYPES_H
300 # include <sys/types.h>
301 #endif
302 #if HAVE_SYS_SOCKET_H
303 # include <sys/socket.h>
304 #endif
305 ])
306 AC_CHECK_HEADERS(linux/if.h, [], [],
307 [
308 #if HAVE_SYS_TYPES_H
309 # include <sys/types.h>
310 #endif
311 #if HAVE_SYS_SOCKET_H
312 # include <sys/socket.h>
313 #endif
314 ])
315 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
316 [
317 #if HAVE_SYS_TYPES_H
318 # include <sys/types.h>
319 #endif
320 #if HAVE_SYS_SOCKET_H
321 # include <sys/socket.h>
322 #endif
323 #if HAVE_LINUX_IF_H
324 # include <linux/if.h>
325 #endif
326 ])
328 # For ipvs module
329 have_net_ip_vs_h="no"
330 have_ip_vs_h="no"
331 if test "x$ac_system" = "xLinux"
332 then
333 SAVE_CFLAGS=$CFLAGS
334 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
336 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
337 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
339 CFLAGS=$SAVE_CFLAGS
340 fi
342 # For quota module
343 AC_CHECK_HEADERS(sys/ucred.h, [], [],
344 [
345 #if HAVE_SYS_TYPES_H
346 # include <sys/types.h>
347 #endif
348 #if HAVE_SYS_PARAM_H
349 # include <sys/param.h>
350 #endif
351 ])
353 # For mount interface
354 AC_CHECK_HEADERS(sys/mount.h, [], [],
355 [
356 #if HAVE_SYS_TYPES_H
357 # include <sys/types.h>
358 #endif
359 #if HAVE_SYS_PARAM_H
360 # include <sys/param.h>
361 #endif
362 ])
364 # For the email plugin
365 AC_CHECK_HEADERS(linux/un.h, [], [],
366 [
367 #if HAVE_SYS_SOCKET_H
368 # include <sys/socket.h>
369 #endif
370 ])
372 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)
374 # For the dns plugin
375 AC_CHECK_HEADERS(arpa/nameser.h)
376 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
377 [
378 #if HAVE_ARPA_NAMESER_H
379 # include <arpa/nameser.h>
380 #endif
381 ])
383 AC_CHECK_HEADERS(net/if_arp.h, [], [],
384 [#if HAVE_SYS_SOCKET_H
385 # include <sys/socket.h>
386 #endif
387 ])
388 AC_CHECK_HEADERS(net/ppp_defs.h)
389 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
390 [#if HAVE_NET_PPP_DEFS_H
391 # include <net/ppp_defs.h>
392 #endif
393 ])
394 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
395 [#if HAVE_STDINT_H
396 # include <stdint.h>
397 #endif
398 #if HAVE_SYS_TYPES_H
399 # include <sys/types.h>
400 #endif
401 #if HAVE_SYS_SOCKET_H
402 # include <sys/socket.h>
403 #endif
404 #if HAVE_NET_IF_H
405 # include <net/if.h>
406 #endif
407 #if HAVE_NETINET_IN_H
408 # include <netinet/in.h>
409 #endif
410 ])
412 # For the multimeter plugin
413 have_termios_h="no"
414 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
416 #
417 # Checks for typedefs, structures, and compiler characteristics.
418 #
419 AC_C_CONST
420 AC_TYPE_PID_T
421 AC_TYPE_SIZE_T
422 AC_TYPE_UID_T
423 AC_HEADER_TIME
425 #
426 # Checks for library functions.
427 #
428 AC_PROG_GCC_TRADITIONAL
429 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf)
431 AC_FUNC_STRERROR_R
433 AC_CACHE_CHECK([for strtok_r],
434 [c_cv_have_strtok_r_default],
435 AC_LINK_IFELSE(
436 AC_LANG_PROGRAM(
437 [[[[
438 #include <stdlib.h>
439 #include <stdio.h>
440 #include <string.h>
441 ]]]],
442 [[[[
443 char buffer[] = "foo,bar,baz";
444 char *token;
445 char *dummy;
446 char *saveptr;
448 dummy = buffer;
449 saveptr = NULL;
450 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
451 {
452 dummy = NULL;
453 printf ("token = %s;\n", token);
454 }
455 ]]]]),
456 [c_cv_have_strtok_r_default="yes"],
457 [c_cv_have_strtok_r_default="no"]
458 )
459 )
461 if test "x$c_cv_have_strtok_r_default" = "xno"
462 then
463 SAVE_CFLAGS="$CFLAGS"
464 CFLAGS="$CFLAGS -D_REENTRANT=1"
466 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
467 [c_cv_have_strtok_r_reentrant],
468 AC_LINK_IFELSE(
469 AC_LANG_PROGRAM(
470 [[[[
471 #include <stdlib.h>
472 #include <stdio.h>
473 #include <string.h>
474 ]]]],
475 [[[[
476 char buffer[] = "foo,bar,baz";
477 char *token;
478 char *dummy;
479 char *saveptr;
481 dummy = buffer;
482 saveptr = NULL;
483 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
484 {
485 dummy = NULL;
486 printf ("token = %s;\n", token);
487 }
488 ]]]]),
489 [c_cv_have_strtok_r_reentrant="yes"],
490 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
491 )
492 )
493 fi
495 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
497 socket_needs_socket="no"
498 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
499 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
501 nanosleep_needs_rt="no"
502 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
503 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
505 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
506 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
507 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
508 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
509 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
510 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
511 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
512 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
513 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
514 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
515 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
516 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
518 # For load module
519 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
521 # Check for NAN
522 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
523 [
524 if test "x$withval" = "xno"; then
525 nan_type="none"
526 else if test "x$withval" = "xyes"; then
527 nan_type="zero"
528 else
529 nan_type="$withval"
530 fi; fi
531 ],
532 [nan_type="none"])
533 if test "x$nan_type" = "xnone"; then
534 AC_CACHE_CHECK([whether NAN is defined by default],
535 [c_cv_have_nan_default],
536 AC_COMPILE_IFELSE(
537 AC_LANG_PROGRAM(
538 [[
539 #include <stdlib.h>
540 #include <math.h>
541 static float foo = NAN;
542 ]],
543 [[
544 if (isnan (foo))
545 return 0;
546 else
547 return 1;
548 ]]),
549 [c_cv_have_nan_default="yes"],
550 [c_cv_have_nan_default="no"]
551 )
552 )
553 if test "x$c_cv_have_nan_default" = "xyes"
554 then
555 nan_type="default"
556 fi
557 fi
558 if test "x$nan_type" = "xnone"; then
559 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
560 [c_cv_have_nan_isoc],
561 AC_COMPILE_IFELSE(
562 AC_LANG_PROGRAM(
563 [[
564 #include <stdlib.h>
565 #define __USE_ISOC99 1
566 #include <math.h>
567 static float foo = NAN;
568 ]],
569 [[
570 if (isnan (foo))
571 return 0;
572 else
573 return 1;
574 ]]),
575 [c_cv_have_nan_isoc="yes"],
576 [c_cv_have_nan_isoc="no"]
577 )
578 )
579 if test "x$c_cv_have_nan_isoc" = "xyes"
580 then
581 nan_type="isoc99"
582 fi
583 fi
584 if test "x$nan_type" = "xnone"; then
585 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
586 [c_cv_have_nan_zero],
587 AC_RUN_IFELSE(
588 AC_LANG_PROGRAM(
589 [[
590 #include <stdlib.h>
591 #include <math.h>
592 #ifdef NAN
593 # undef NAN
594 #endif
595 #define NAN (0.0 / 0.0)
596 #ifndef isnan
597 # define isnan(f) ((f) != (f))
598 #endif
599 static float foo = NAN;
600 ]],
601 [[
602 if (isnan (foo))
603 return 0;
604 else
605 return 1;
606 ]]),
607 [c_cv_have_nan_zero="yes"],
608 [c_cv_have_nan_zero="no"]
609 )
610 )
611 if test "x$c_cv_have_nan_zero" = "xyes"
612 then
613 nan_type="zero"
614 fi
615 fi
617 if test "x$nan_type" = "xdefault"; then
618 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
619 [Define if NAN is defined by default and can initialize static variables.])
620 else if test "x$nan_type" = "xisoc99"; then
621 AC_DEFINE(NAN_STATIC_ISOC, 1,
622 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
623 else if test "x$nan_type" = "xzero"; then
624 AC_DEFINE(NAN_ZERO_ZERO, 1,
625 [Define if NAN can be defined as (0.0 / 0.0)])
626 else
627 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
628 fi; fi; fi
630 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
631 [
632 if test "x$withval" = "xnothing"; then
633 fp_layout_type="nothing"
634 else if test "x$withval" = "xendianflip"; then
635 fp_layout_type="endianflip"
636 else if test "x$withval" = "xintswap"; then
637 fp_layout_type="intswap"
638 else
639 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
640 fi; fi; fi
641 ],
642 [fp_layout_type="unknown"])
644 if test "x$fp_layout_type" = "xunknown"; then
645 AC_CACHE_CHECK([if doubles are stored in x86 representation],
646 [c_cv_fp_layout_need_nothing],
647 AC_RUN_IFELSE(
648 AC_LANG_PROGRAM(
649 [[[[
650 #include <stdlib.h>
651 #include <stdio.h>
652 #include <string.h>
653 #if HAVE_STDINT_H
654 # include <stdint.h>
655 #endif
656 #if HAVE_STDBOOL_H
657 # include <stdbool.h>
658 #endif
659 ]]]],
660 [[[[
661 uint64_t i0;
662 uint64_t i1;
663 uint8_t c[8];
664 double d;
666 d = 8.642135e130;
667 memcpy ((void *) &i0, (void *) &d, 8);
669 i1 = i0;
670 memcpy ((void *) c, (void *) &i1, 8);
672 if ((c[0] == 0x2f) && (c[1] == 0x25)
673 && (c[2] == 0xc0) && (c[3] == 0xc7)
674 && (c[4] == 0x43) && (c[5] == 0x2b)
675 && (c[6] == 0x1f) && (c[7] == 0x5b))
676 return (0);
677 else
678 return (1);
679 ]]]]),
680 [c_cv_fp_layout_need_nothing="yes"],
681 [c_cv_fp_layout_need_nothing="no"]
682 )
683 )
684 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
685 fp_layout_type="nothing"
686 fi
687 fi
688 if test "x$fp_layout_type" = "xunknown"; then
689 AC_CACHE_CHECK([if endianflip converts to x86 representation],
690 [c_cv_fp_layout_need_endianflip],
691 AC_RUN_IFELSE(
692 AC_LANG_PROGRAM(
693 [[[[
694 #include <stdlib.h>
695 #include <stdio.h>
696 #include <string.h>
697 #if HAVE_STDINT_H
698 # include <stdint.h>
699 #endif
700 #if HAVE_STDBOOL_H
701 # include <stdbool.h>
702 #endif
703 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
704 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
705 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
706 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
707 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
708 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
709 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
710 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
711 ]]]],
712 [[[[
713 uint64_t i0;
714 uint64_t i1;
715 uint8_t c[8];
716 double d;
718 d = 8.642135e130;
719 memcpy ((void *) &i0, (void *) &d, 8);
721 i1 = endianflip (i0);
722 memcpy ((void *) c, (void *) &i1, 8);
724 if ((c[0] == 0x2f) && (c[1] == 0x25)
725 && (c[2] == 0xc0) && (c[3] == 0xc7)
726 && (c[4] == 0x43) && (c[5] == 0x2b)
727 && (c[6] == 0x1f) && (c[7] == 0x5b))
728 return (0);
729 else
730 return (1);
731 ]]]]),
732 [c_cv_fp_layout_need_endianflip="yes"],
733 [c_cv_fp_layout_need_endianflip="no"]
734 )
735 )
736 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
737 fp_layout_type="endianflip"
738 fi
739 fi
740 if test "x$fp_layout_type" = "xunknown"; then
741 AC_CACHE_CHECK([if intswap converts to x86 representation],
742 [c_cv_fp_layout_need_intswap],
743 AC_RUN_IFELSE(
744 AC_LANG_PROGRAM(
745 [[[[
746 #include <stdlib.h>
747 #include <stdio.h>
748 #include <string.h>
749 #if HAVE_STDINT_H
750 # include <stdint.h>
751 #endif
752 #if HAVE_STDBOOL_H
753 # include <stdbool.h>
754 #endif
755 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
756 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
757 ]]]],
758 [[[[
759 uint64_t i0;
760 uint64_t i1;
761 uint8_t c[8];
762 double d;
764 d = 8.642135e130;
765 memcpy ((void *) &i0, (void *) &d, 8);
767 i1 = intswap (i0);
768 memcpy ((void *) c, (void *) &i1, 8);
770 if ((c[0] == 0x2f) && (c[1] == 0x25)
771 && (c[2] == 0xc0) && (c[3] == 0xc7)
772 && (c[4] == 0x43) && (c[5] == 0x2b)
773 && (c[6] == 0x1f) && (c[7] == 0x5b))
774 return (0);
775 else
776 return (1);
777 ]]]]),
778 [c_cv_fp_layout_need_intswap="yes"],
779 [c_cv_fp_layout_need_intswap="no"]
780 )
781 )
782 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
783 fp_layout_type="intswap"
784 fi
785 fi
787 if test "x$fp_layout_type" = "xnothing"; then
788 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
789 [Define if doubles are stored in x86 representation.])
790 else if test "x$fp_layout_type" = "xendianflip"; then
791 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
792 [Define if endianflip is needed to convert to x86 representation.])
793 else if test "x$fp_layout_type" = "xintswap"; then
794 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
795 [Define if intswap is needed to convert to x86 representation.])
796 else
797 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
798 fi; fi; fi
800 have_getfsstat="no"
801 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
802 have_getvfsstat="no"
803 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
804 have_listmntent="no"
805 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
807 have_getmntent="no"
808 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
809 if test "x$have_getmntent" = "xno"; then
810 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
811 fi
812 if test "x$have_getmntent" = "xno"; then
813 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
814 fi
815 if test "x$have_getmntent" = "xno"; then
816 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
817 fi
819 if test "x$have_getmntent" = "xc"; then
820 AC_CACHE_CHECK([whether getmntent takes one argument],
821 [c_cv_have_one_getmntent],
822 AC_COMPILE_IFELSE(
823 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
824 #include "$srcdir/src/utils_mount.h"]],
825 [[
826 FILE *fh;
827 struct mntent *me;
828 fh = setmntent ("/etc/mtab", "r");
829 me = getmntent (fh);
830 ]]
831 ),
832 [c_cv_have_one_getmntent="yes"],
833 [c_cv_have_one_getmntent="no"]
834 )
835 )
836 AC_CACHE_CHECK([whether getmntent takes two arguments],
837 [c_cv_have_two_getmntent],
838 AC_COMPILE_IFELSE(
839 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
840 #include "$srcdir/src/utils_mount.h"]],
841 [[
842 FILE *fh;
843 struct mnttab mt;
844 int status;
845 fh = fopen ("/etc/mnttab", "r");
846 status = getmntent (fh, &mt);
847 ]]
848 ),
849 [c_cv_have_two_getmntent="yes"],
850 [c_cv_have_two_getmntent="no"]
851 )
852 )
853 fi
855 # Check for different versions of `getmntent' here..
857 if test "x$have_getmntent" = "xc"; then
858 if test "x$c_cv_have_one_getmntent" = "xyes"; then
859 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
860 [Define if the function getmntent exists and takes one argument.])
861 fi
862 if test "x$c_cv_have_two_getmntent" = "xyes"; then
863 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
864 [Define if the function getmntent exists and takes two arguments.])
865 fi
866 fi
867 if test "x$have_getmntent" = "xsun"; then
868 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
869 [Define if the function getmntent exists. It's the version from libsun.])
870 fi
871 if test "x$have_getmntent" = "xseq"; then
872 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
873 [Define if the function getmntent exists. It's the version from libseq.])
874 fi
875 if test "x$have_getmntent" = "xgen"; then
876 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
877 [Define if the function getmntent exists. It's the version from libgen.])
878 fi
880 # Check for structures
881 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
882 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
883 [],
884 [
885 #include <sys/types.h>
886 #include <sys/socket.h>
887 #include <net/if.h>
888 ])
889 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
890 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
891 [],
892 [
893 #include <sys/types.h>
894 #include <sys/socket.h>
895 #include <linux/if.h>
896 #include <linux/netdevice.h>
897 ])
899 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
900 [
901 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
902 [Define if struct kinfo_proc exists in the FreeBSD variant.])
903 have_struct_kinfo_proc_freebsd="yes"
904 ],
905 [
906 have_struct_kinfo_proc_freebsd="no"
907 ],
908 [
909 #include <kvm.h>
910 #include <sys/param.h>
911 #include <sys/sysctl.h>
912 #include <sys/user.h>
913 ])
915 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
916 [
917 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
918 [Define if struct kinfo_proc exists in the OpenBSD variant.])
919 have_struct_kinfo_proc_openbsd="yes"
920 ],
921 [
922 have_struct_kinfo_proc_openbsd="no"
923 ],
924 [
925 #include <sys/param.h>
926 #include <sys/sysctl.h>
927 #include <kvm.h>
928 ])
930 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
931 [#define _BSD_SOURCE
932 #if HAVE_STDINT_H
933 # include <stdint.h>
934 #endif
935 #if HAVE_SYS_TYPES_H
936 # include <sys/types.h>
937 #endif
938 #if HAVE_NETINET_IN_SYSTM_H
939 # include <netinet/in_systm.h>
940 #endif
941 #if HAVE_NETINET_IN_H
942 # include <netinet/in.h>
943 #endif
944 #if HAVE_NETINET_IP_H
945 # include <netinet/ip.h>
946 #endif
947 #if HAVE_NETINET_UDP_H
948 # include <netinet/udp.h>
949 #endif
950 ])
951 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
952 [#define _BSD_SOURCE
953 #if HAVE_STDINT_H
954 # include <stdint.h>
955 #endif
956 #if HAVE_SYS_TYPES_H
957 # include <sys/types.h>
958 #endif
959 #if HAVE_NETINET_IN_SYSTM_H
960 # include <netinet/in_systm.h>
961 #endif
962 #if HAVE_NETINET_IN_H
963 # include <netinet/in.h>
964 #endif
965 #if HAVE_NETINET_IP_H
966 # include <netinet/ip.h>
967 #endif
968 #if HAVE_NETINET_UDP_H
969 # include <netinet/udp.h>
970 #endif
971 ])
973 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
974 [],
975 [],
976 [
977 #if HAVE_KSTAT_H
978 # include <kstat.h>
979 #endif
980 ])
982 #
983 # Checks for libraries begin here
984 #
985 with_libresolv="yes"
986 AC_CHECK_LIB(resolv, res_search,
987 [
988 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
989 ],
990 [with_libresolv="no"])
991 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
993 dnl Check for HAL (hardware abstraction library)
994 with_libhal="yes"
995 AC_CHECK_LIB(hal,libhal_device_property_exists,
996 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
997 [with_libhal="no"])
998 if test "x$with_libhal" = "xyes"; then
999 if test "x$PKG_CONFIG" != "x"; then
1000 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1001 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1002 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1003 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1004 fi
1005 fi
1007 m4_divert_once([HELP_WITH], [
1008 collectd additional packages:])
1010 if test "x$ac_system" = "xSolaris"
1011 then
1012 with_kstat="yes"
1013 with_devinfo="yes"
1014 else
1015 with_kstat="no (Solaris only)"
1016 with_devinfo="no (Solaris only)"
1017 fi
1019 if test "x$with_kstat" = "xyes"
1020 then
1021 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1022 fi
1023 if test "x$with_kstat" = "xyes"
1024 then
1025 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1026 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1027 fi
1028 if test "x$with_kstat" = "xyes"
1029 then
1030 AC_DEFINE(HAVE_LIBKSTAT, 1,
1031 [Define to 1 if you have the 'kstat' library (-lkstat)])
1032 fi
1033 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1034 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1036 with_libiokit="no"
1037 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1038 [
1039 with_libiokit="yes"
1040 ],
1041 [
1042 with_libiokit="no"
1043 ])
1044 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1046 with_libkvm="no"
1047 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1048 if test "x$with_kvm_getprocs" = "xyes"
1049 then
1050 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1051 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1052 with_libkvm="yes"
1053 fi
1054 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1056 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1057 if test "x$with_kvm_getswapinfo" = "xyes"
1058 then
1059 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1060 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1061 with_libkvm="yes"
1062 fi
1063 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1065 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1066 if test "x$with_kvm_nlist" = "xyes"
1067 then
1068 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1069 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1070 with_libkvm="yes"
1071 fi
1072 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1074 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1075 if test "x$with_kvm_openfiles" = "xyes"
1076 then
1077 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1078 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1079 with_libkvm="yes"
1080 fi
1081 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1083 # --with-libcurl {{{
1084 with_curl_config="curl-config"
1085 with_curl_cflags=""
1086 with_curl_libs=""
1087 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1088 [
1089 if test "x$withval" = "xno"
1090 then
1091 with_libcurl="no"
1092 else if test "x$withval" = "xyes"
1093 then
1094 with_libcurl="yes"
1095 else
1096 if test -f "$withval" && test -x "$withval"
1097 then
1098 with_curl_config="$withval"
1099 with_libcurl="yes"
1100 else if test -x "$withval/bin/curl-config"
1101 then
1102 with_curl_config="$withval/bin/curl-config"
1103 with_libcurl="yes"
1104 fi; fi
1105 with_libcurl="yes"
1106 fi; fi
1107 ],
1108 [
1109 with_libcurl="yes"
1110 ])
1111 if test "x$with_libcurl" = "xyes"
1112 then
1113 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1114 curl_config_status=$?
1116 if test $curl_config_status -ne 0
1117 then
1118 with_libcurl="no ($with_curl_config failed)"
1119 else
1120 SAVE_CPPFLAGS="$CPPFLAGS"
1121 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1123 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1125 CPPFLAGS="$SAVE_CPPFLAGS"
1126 fi
1127 fi
1128 if test "x$with_libcurl" = "xyes"
1129 then
1130 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1131 curl_config_status=$?
1133 if test $curl_config_status -ne 0
1134 then
1135 with_libcurl="no ($with_curl_config failed)"
1136 else
1137 AC_CHECK_LIB(curl, curl_easy_init,
1138 [with_libcurl="yes"],
1139 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1140 [$with_curl_libs])
1141 fi
1142 fi
1143 if test "x$with_libcurl" = "xyes"
1144 then
1145 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1146 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1147 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1148 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1149 fi
1150 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1151 # }}}
1153 # --with-libdbi {{{
1154 with_libdbi_cppflags=""
1155 with_libdbi_ldflags=""
1156 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1157 [
1158 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1159 then
1160 with_libdbi_cppflags="-I$withval/include"
1161 with_libdbi_ldflags="-L$withval/lib"
1162 with_libdbi="yes"
1163 else
1164 with_libdbi="$withval"
1165 fi
1166 ],
1167 [
1168 with_libdbi="yes"
1169 ])
1170 if test "x$with_libdbi" = "xyes"
1171 then
1172 SAVE_CPPFLAGS="$CPPFLAGS"
1173 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1175 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1177 CPPFLAGS="$SAVE_CPPFLAGS"
1178 fi
1179 if test "x$with_libdbi" = "xyes"
1180 then
1181 SAVE_CPPFLAGS="$CPPFLAGS"
1182 SAVE_LDFLAGS="$LDFLAGS"
1183 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1184 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1186 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1188 CPPFLAGS="$SAVE_CPPFLAGS"
1189 LDFLAGS="$SAVE_LDFLAGS"
1190 fi
1191 if test "x$with_libdbi" = "xyes"
1192 then
1193 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1194 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1195 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1196 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1197 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1198 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1199 fi
1200 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1201 # }}}
1203 # --with-libesmtp {{{
1204 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1205 [
1206 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1207 then
1208 LDFLAGS="$LDFLAGS -L$withval/lib"
1209 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1210 with_libesmtp="yes"
1211 else
1212 with_libesmtp="$withval"
1213 fi
1214 ],
1215 [
1216 with_libesmtp="yes"
1217 ])
1218 if test "x$with_libesmtp" = "xyes"
1219 then
1220 AC_CHECK_LIB(esmtp, smtp_create_session,
1221 [
1222 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1223 ], [with_libesmtp="no (libesmtp not found)"])
1224 fi
1225 if test "x$with_libesmtp" = "xyes"
1226 then
1227 AC_CHECK_HEADERS(libesmtp.h,
1228 [
1229 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1230 ], [with_libesmtp="no (libesmtp.h not found)"])
1231 fi
1232 if test "x$with_libesmtp" = "xyes"
1233 then
1234 collect_libesmtp=1
1235 else
1236 collect_libesmtp=0
1237 fi
1238 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1239 [Wether or not to use the esmtp library])
1240 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1241 # }}}
1243 # --with-libganglia {{{
1244 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1245 [
1246 if test -f "$withval" && test -x "$withval"
1247 then
1248 with_libganglia_config="$withval"
1249 with_libganglia="yes"
1250 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1251 then
1252 with_libganglia_config="$withval/bin/ganglia-config"
1253 with_libganglia="yes"
1254 else if test -d "$withval"
1255 then
1256 GANGLIA_CPPFLAGS="-I$withval/include"
1257 GANGLIA_LDFLAGS="-L$withval/lib"
1258 with_libganglia="yes"
1259 else
1260 with_libganglia_config="ganglia-config"
1261 with_libganglia="$withval"
1262 fi; fi; fi
1263 ],
1264 [
1265 with_libganglia_config="ganglia-config"
1266 with_libganglia="yes"
1267 ])
1269 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1270 then
1271 if test "x$GANGLIA_CPPFLAGS" = "x"
1272 then
1273 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1274 fi
1276 if test "x$GANGLIA_LDFLAGS" = "x"
1277 then
1278 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1279 fi
1281 if test "x$GANGLIA_LIBS" = "x"
1282 then
1283 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1284 fi
1285 fi
1287 SAVE_CPPFLAGS="$CPPFLAGS"
1288 SAVE_LDFLAGS="$LDFLAGS"
1289 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1290 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1292 if test "x$with_libganglia" = "xyes"
1293 then
1294 AC_CHECK_HEADERS(gm_protocol.h,
1295 [
1296 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1297 [Define to 1 if you have the <gm_protocol.h> header file.])
1298 ], [with_libganglia="no (gm_protocol.h not found)"])
1299 fi
1301 if test "x$with_libganglia" = "xyes"
1302 then
1303 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1304 [
1305 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1306 [Define to 1 if you have the ganglia library (-lganglia).])
1307 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1308 fi
1310 CPPFLAGS="$SAVE_CPPFLAGS"
1311 LDFLAGS="$SAVE_LDFLAGS"
1313 AC_SUBST(GANGLIA_CPPFLAGS)
1314 AC_SUBST(GANGLIA_LDFLAGS)
1315 AC_SUBST(GANGLIA_LIBS)
1316 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1317 # }}}
1319 # --with-libgcrypt {{{
1320 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1321 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1322 GCRYPT_LIBS="$GCRYPT_LIBS"
1323 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1324 [
1325 if test -f "$withval" && test -x "$withval"
1326 then
1327 with_libgcrypt_config="$withval"
1328 with_libgcrypt="yes"
1329 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1330 then
1331 with_libgcrypt_config="$withval/bin/gcrypt-config"
1332 with_libgcrypt="yes"
1333 else if test -d "$withval"
1334 then
1335 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1336 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1337 with_libgcrypt="yes"
1338 else
1339 with_libgcrypt_config="gcrypt-config"
1340 with_libgcrypt="$withval"
1341 fi; fi; fi
1342 ],
1343 [
1344 with_libgcrypt_config="libgcrypt-config"
1345 with_libgcrypt="yes"
1346 ])
1348 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1349 then
1350 if test "x$GCRYPT_CPPFLAGS" = "x"
1351 then
1352 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1353 fi
1355 if test "x$GCRYPT_LDFLAGS" = "x"
1356 then
1357 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1358 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1359 fi
1361 if test "x$GCRYPT_LIBS" = "x"
1362 then
1363 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1364 fi
1365 fi
1367 SAVE_CPPFLAGS="$CPPFLAGS"
1368 SAVE_LDFLAGS="$LDFLAGS"
1369 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1370 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1372 if test "x$with_libgcrypt" = "xyes"
1373 then
1374 if test "x$GCRYPT_CPPFLAGS" != "x"
1375 then
1376 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1377 fi
1378 AC_CHECK_HEADERS(gcrypt.h,
1379 [with_libgcrypt="yes"],
1380 [with_libgcrypt="no (gcrypt.h not found)"])
1381 fi
1383 if test "x$with_libgcrypt" = "xyes"
1384 then
1385 if test "x$GCRYPT_LDFLAGS" != "x"
1386 then
1387 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1388 fi
1389 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1390 [with_libgcrypt="yes"],
1391 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1393 if test "$with_libgcrypt" != "no"; then
1394 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1395 fi
1396 fi
1398 CPPFLAGS="$SAVE_CPPFLAGS"
1399 LDFLAGS="$SAVE_LDFLAGS"
1401 if test "x$with_libgcrypt" = "xyes"
1402 then
1403 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1404 fi
1406 AC_SUBST(GCRYPT_CPPFLAGS)
1407 AC_SUBST(GCRYPT_LDFLAGS)
1408 AC_SUBST(GCRYPT_LIBS)
1409 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1410 # }}}
1412 # --with-libiptc {{{
1413 with_own_libiptc="no"
1414 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1415 [
1416 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1417 then
1418 LDFLAGS="$LDFLAGS -L$withval/lib"
1419 CPPFLAGS="$CPPFLAGS -I$withval/include"
1420 with_libiptc="yes"
1421 else
1422 with_libiptc="$withval"
1423 fi
1424 ],
1425 [
1426 if test "x$ac_system" = "xLinux"
1427 then
1428 with_libiptc="yes"
1429 else
1430 with_libiptc="no (Linux only)"
1431 fi
1432 ])
1433 if test "x$with_libiptc" = "xyes"
1434 then
1435 AC_CHECK_LIB(iptc, iptc_init,
1436 [
1437 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1438 ],
1439 [
1440 with_libiptc="yes"
1441 with_own_libiptc="yes"
1442 ])
1443 fi
1444 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1445 then
1446 AC_CHECK_HEADERS(libiptc/libiptc.h,
1447 [
1448 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1449 ],
1450 [
1451 with_libiptc="yes"
1452 with_own_libiptc="yes"
1453 ])
1454 fi
1455 if test "x$with_libiptc" = "xyes"
1456 then
1457 SAVE_CFLAGS=$CFLAGS
1458 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1460 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1461 [
1462 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1463 with_own_libiptc="no"
1464 ],
1465 [
1466 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1467 ])
1469 CFLAGS=$SAVE_CFLAGS
1470 fi
1471 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1472 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1473 if test "x$with_own_libiptc" = "xyes"
1474 then
1475 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1476 fi
1477 # }}}
1479 # --with-java {{{
1480 with_java_home="$JAVA_HOME"
1481 with_java_vmtype="client"
1482 with_java_cflags=""
1483 with_java_libs=""
1484 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1485 [
1486 if test "x$withval" = "xno"
1487 then
1488 with_java="no"
1489 else if test "x$withval" = "xyes"
1490 then
1491 with_java="yes"
1492 else
1493 with_java_home="$withval"
1494 with_java="yes"
1495 fi; fi
1496 ],
1497 [with_java="yes"])
1498 if test "x$with_java" = "xyes"
1499 then
1500 if test -d "$with_java_home"
1501 then
1502 AC_MSG_CHECKING([for jni.h])
1503 TMPDIR=`find -L "$with_java_home" -name jni.h -exec 'dirname' '{}' ';' | head -n 1`
1504 if test "x$TMPDIR" != "x"
1505 then
1506 AC_MSG_RESULT([found in $TMPDIR])
1507 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1508 else
1509 AC_MSG_RESULT([not found])
1510 fi
1512 AC_MSG_CHECKING([for jni_md.h])
1513 TMPDIR=`find -L "$with_java_home" -name jni_md.h -exec 'dirname' '{}' ';' | head -n 1`
1514 if test "x$TMPDIR" != "x"
1515 then
1516 AC_MSG_RESULT([found in $TMPDIR])
1517 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1518 else
1519 AC_MSG_RESULT([not found])
1520 fi
1522 AC_MSG_CHECKING([for libjvm.so])
1523 TMPDIR=`find -L "$with_java_home" -name libjvm.so -exec 'dirname' '{}' ';' | head -n 1`
1524 if test "x$TMPDIR" != "x"
1525 then
1526 AC_MSG_RESULT([found in $TMPDIR])
1527 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR"
1528 else
1529 AC_MSG_RESULT([not found])
1530 fi
1531 else if test "x$with_java_home" != "x"
1532 then
1533 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1534 fi; fi
1535 fi
1537 if test "x$JAVA_CPPFLAGS" != "x"
1538 then
1539 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1540 fi
1541 if test "x$JAVA_CFLAGS" != "x"
1542 then
1543 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1544 fi
1545 if test "x$JAVA_LDFLAGS" != "x"
1546 then
1547 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1548 fi
1550 SAVE_CPPFLAGS="$CPPFLAGS"
1551 SAVE_CFLAGS="$CFLAGS"
1552 SAVE_LDFLAGS="$LDFLAGS"
1553 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1554 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1555 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1557 if test "x$with_java" = "xyes"
1558 then
1559 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1560 fi
1561 if test "x$with_java" = "xyes"
1562 then
1563 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1564 [with_java="yes"],
1565 [with_java="no (libjvm not found)"],
1566 [$JAVA_LIBS])
1567 fi
1568 if test "x$with_java" = "xyes"
1569 then
1570 JAVA_LIBS="$JAVA_LIBS -ljvm"
1571 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1572 fi
1574 CPPFLAGS="$SAVE_CPPFLAGS"
1575 CFLAGS="$SAVE_CFLAGS"
1576 LDFLAGS="$SAVE_LDFLAGS"
1578 AC_SUBST(JAVA_CPPFLAGS)
1579 AC_SUBST(JAVA_CFLAGS)
1580 AC_SUBST(JAVA_LDFLAGS)
1581 AC_SUBST(JAVA_LIBS)
1582 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1583 # }}}
1585 # --with-libmemcached {{{
1586 with_libmemcached_cppflags=""
1587 with_libmemcached_ldflags=""
1588 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1589 [
1590 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1591 then
1592 with_libmemcached_cppflags="-I$withval/include"
1593 with_libmemcached_ldflags="-L$withval/lib"
1594 with_libmemcached="yes"
1595 else
1596 with_libmemcached="$withval"
1597 fi
1598 ],
1599 [
1600 with_libmemcached="yes"
1601 ])
1602 if test "x$with_libmemcached" = "xyes"
1603 then
1604 SAVE_CPPFLAGS="$CPPFLAGS"
1605 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1607 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1609 CPPFLAGS="$SAVE_CPPFLAGS"
1610 fi
1611 if test "x$with_libmemcached" = "xyes"
1612 then
1613 SAVE_CPPFLAGS="$CPPFLAGS"
1614 SAVE_LDFLAGS="$LDFLAGS"
1615 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1616 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1618 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1620 CPPFLAGS="$SAVE_CPPFLAGS"
1621 LDFLAGS="$SAVE_LDFLAGS"
1622 fi
1623 if test "x$with_libmemcached" = "xyes"
1624 then
1625 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1626 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1627 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1628 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1629 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1630 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1631 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1632 fi
1633 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1634 # }}}
1636 # --with-libmysql {{{
1637 with_mysql_config="mysql_config"
1638 with_mysql_cflags=""
1639 with_mysql_libs=""
1640 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1641 [
1642 if test "x$withval" = "xno"
1643 then
1644 with_libmysql="no"
1645 else if test "x$withval" = "xyes"
1646 then
1647 with_libmysql="yes"
1648 else
1649 if test -f "$withval" && test -x "$withval";
1650 then
1651 with_mysql_config="$withval"
1652 else if test -x "$withval/bin/mysql_config"
1653 then
1654 with_mysql_config="$withval/bin/mysql_config"
1655 fi; fi
1656 with_libmysql="yes"
1657 fi; fi
1658 ],
1659 [
1660 with_libmysql="yes"
1661 ])
1662 if test "x$with_libmysql" = "xyes"
1663 then
1664 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1665 mysql_config_status=$?
1667 if test $mysql_config_status -ne 0
1668 then
1669 with_libmysql="no ($with_mysql_config failed)"
1670 else
1671 SAVE_CPPFLAGS="$CPPFLAGS"
1672 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1674 have_mysql_h="no"
1675 have_mysql_mysql_h="no"
1676 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1678 if test "x$have_mysql_h" = "xno"
1679 then
1680 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1681 fi
1683 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1684 then
1685 with_libmysql="no (mysql.h not found)"
1686 fi
1688 CPPFLAGS="$SAVE_CPPFLAGS"
1689 fi
1690 fi
1691 if test "x$with_libmysql" = "xyes"
1692 then
1693 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1694 mysql_config_status=$?
1696 if test $mysql_config_status -ne 0
1697 then
1698 with_libmysql="no ($with_mysql_config failed)"
1699 else
1700 AC_CHECK_LIB(mysqlclient, mysql_init,
1701 [with_libmysql="yes"],
1702 [with_libmysql="no (symbol 'mysql_init' not found)"],
1703 [$with_mysql_libs])
1705 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1706 [with_libmysql="yes"],
1707 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1708 [$with_mysql_libs])
1709 fi
1710 fi
1711 if test "x$with_libmysql" = "xyes"
1712 then
1713 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1714 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1715 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1716 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1717 fi
1718 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1719 # }}}
1721 # --with-libnetlink {{{
1722 with_libnetlink_cflags=""
1723 with_libnetlink_libs="-lnetlink"
1724 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1725 [
1726 echo "libnetlink: withval = $withval"
1727 if test "x$withval" = "xyes"
1728 then
1729 with_libnetlink="yes"
1730 else if test "x$withval" = "xno"
1731 then
1732 with_libnetlink="no"
1733 else
1734 if test -d "$withval/include"
1735 then
1736 with_libnetlink_cflags="-I$withval/include"
1737 with_libnetlink_libs="-L$withval/lib -lnetlink"
1738 with_libnetlink="yes"
1739 else
1740 AC_MSG_ERROR("no such directory: $withval/include")
1741 fi
1742 fi; fi
1743 ],
1744 [
1745 if test "x$ac_system" = "xLinux"
1746 then
1747 with_libnetlink="yes"
1748 else
1749 with_libnetlink="no (Linux only library)"
1750 fi
1751 ])
1752 if test "x$with_libnetlink" = "xyes"
1753 then
1754 SAVE_CFLAGS=$CFLAGS
1755 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1757 with_libnetlink="no (libnetlink.h not found)"
1759 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1760 [
1761 with_libnetlink="yes"
1762 break
1763 ], [],
1764 [#include <stdio.h>
1765 #include <sys/types.h>
1766 #include <asm/types.h>
1767 #include <sys/socket.h>
1768 #include <linux/netlink.h>
1769 #include <linux/rtnetlink.h>])
1770 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1771 [#include <stdio.h>
1772 #include <sys/types.h>
1773 #include <asm/types.h>
1774 #include <sys/socket.h>])
1776 AC_COMPILE_IFELSE(
1777 [#include <stdio.h>
1778 #include <sys/types.h>
1779 #include <asm/types.h>
1780 #include <sys/socket.h>
1781 #include <linux/netlink.h>
1782 #include <linux/rtnetlink.h>
1784 int main (void)
1785 {
1786 int retval = TCA_STATS2;
1787 return (retval);
1788 }],
1789 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1790 []);
1792 AC_COMPILE_IFELSE(
1793 [#include <stdio.h>
1794 #include <sys/types.h>
1795 #include <asm/types.h>
1796 #include <sys/socket.h>
1797 #include <linux/netlink.h>
1798 #include <linux/rtnetlink.h>
1800 int main (void)
1801 {
1802 int retval = TCA_STATS;
1803 return (retval);
1804 }],
1805 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1806 []);
1808 CFLAGS="$SAVE_CFLAGS"
1809 fi
1810 if test "x$with_libnetlink" = "xyes"
1811 then
1812 AC_CHECK_LIB(netlink, rtnl_open,
1813 [with_libnetlink="yes"],
1814 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1815 [$with_libnetlink_libs])
1816 fi
1817 if test "x$with_libnetlink" = "xyes"
1818 then
1819 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1820 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1821 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1822 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1823 fi
1824 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1825 # }}}
1827 # --with-libnetsnmp {{{
1828 with_snmp_config="net-snmp-config"
1829 with_snmp_cflags=""
1830 with_snmp_libs=""
1831 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1832 [
1833 if test "x$withval" = "xno"
1834 then
1835 with_libnetsnmp="no"
1836 else if test "x$withval" = "xyes"
1837 then
1838 with_libnetsnmp="yes"
1839 else
1840 if test -x "$withval"
1841 then
1842 with_snmp_config="$withval"
1843 with_libnetsnmp="yes"
1844 else
1845 with_snmp_config="$withval/bin/net-snmp-config"
1846 with_libnetsnmp="yes"
1847 fi
1848 fi; fi
1849 ],
1850 [with_libnetsnmp="yes"])
1851 if test "x$with_libnetsnmp" = "xyes"
1852 then
1853 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1854 snmp_config_status=$?
1856 if test $snmp_config_status -ne 0
1857 then
1858 with_libnetsnmp="no ($with_snmp_config failed)"
1859 else
1860 SAVE_CPPFLAGS="$CPPFLAGS"
1861 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1863 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1865 CPPFLAGS="$SAVE_CPPFLAGS"
1866 fi
1867 fi
1868 if test "x$with_libnetsnmp" = "xyes"
1869 then
1870 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1871 snmp_config_status=$?
1873 if test $snmp_config_status -ne 0
1874 then
1875 with_libnetsnmp="no ($with_snmp_config failed)"
1876 else
1877 AC_CHECK_LIB(netsnmp, init_snmp,
1878 [with_libnetsnmp="yes"],
1879 [with_libnetsnmp="no (libnetsnmp not found)"],
1880 [$with_snmp_libs])
1881 fi
1882 fi
1883 if test "x$with_libnetsnmp" = "xyes"
1884 then
1885 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1886 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1887 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1888 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1889 fi
1890 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1891 # }}}
1893 # --with-liboconfig {{{
1894 with_own_liboconfig="no"
1895 liboconfig_LDFLAGS="$LDFLAGS"
1896 liboconfig_CPPFLAGS="$CPPFLAGS"
1897 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1898 [
1899 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1900 then
1901 if test -d "$withval/lib"
1902 then
1903 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1904 fi
1905 if test -d "$withval/include"
1906 then
1907 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1908 fi
1909 fi
1910 if test "x$withval" = "xno"
1911 then
1912 AC_MSG_ERROR("liboconfig is required")
1913 fi
1914 ],
1915 [
1916 with_liboconfig="yes"
1917 ])
1919 save_LDFLAGS="$LDFLAGS"
1920 save_CPPFLAGS="$CPPFLAGS"
1921 LDFLAGS="$liboconfig_LDFLAGS"
1922 CPPFLAGS="$liboconfig_CPPFLAGS"
1923 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1924 [
1925 with_liboconfig="yes"
1926 with_own_liboconfig="no"
1927 ],
1928 [
1929 with_liboconfig="yes"
1930 with_own_liboconfig="yes"
1931 LDFLAGS="$save_LDFLAGS"
1932 CPPFLAGS="$save_CPPFLAGS"
1933 ])
1935 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1936 if test "x$with_own_liboconfig" = "xyes"
1937 then
1938 with_liboconfig="yes (shipped version)"
1939 fi
1940 # }}}
1942 # --with-liboping {{{
1943 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1944 [
1945 if test "x$withval" = "xyes"
1946 then
1947 with_liboping="yes"
1948 else if test "x$withval" = "xno"
1949 then
1950 with_liboping="no"
1951 else
1952 with_liboping="yes"
1953 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
1954 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
1955 fi; fi
1956 ],
1957 [with_liboping="yes"])
1959 SAVE_CPPFLAGS="$CPPFLAGS"
1960 SAVE_LDFLAGS="$LDFLAGS"
1962 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
1963 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
1965 if test "x$with_liboping" = "xyes"
1966 then
1967 if test "x$LIBOPING_CPPFLAGS" != "x"
1968 then
1969 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
1970 fi
1971 AC_CHECK_HEADERS(oping.h,
1972 [with_liboping="yes"],
1973 [with_liboping="no ('oping.h' not found)"])
1974 fi
1975 if test "x$with_liboping" = "xyes"
1976 then
1977 if test "x$LIBOPING_LDFLAGS" != "x"
1978 then
1979 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
1980 fi
1981 AC_CHECK_LIB(oping, ping_construct,
1982 [with_liboping="yes"],
1983 [with_liboping="no (symbol 'ping_construct' not found)"])
1984 fi
1986 CPPFLAGS="$SAVE_CPPFLAGS"
1987 LDFLAGS="$SAVE_LDFLAGS"
1989 if test "x$with_liboping" = "xyes"
1990 then
1991 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
1992 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
1993 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
1994 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
1995 fi
1996 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1997 # }}}
1999 # --with-oracle {{{
2000 with_oracle_cppflags=""
2001 with_oracle_libs=""
2002 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2003 [
2004 if test "x$withval" = "xyes"
2005 then
2006 if test "x$ORACLE_HOME" = "x"
2007 then
2008 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2009 fi
2010 with_oracle="yes"
2011 else if test "x$withval" = "xno"
2012 then
2013 with_oracle="no"
2014 else
2015 with_oracle="yes"
2016 ORACLE_HOME="$withval"
2017 fi; fi
2018 ],
2019 [
2020 if test "x$ORACLE_HOME" = "x"
2021 then
2022 with_oracle="no (ORACLE_HOME is not set)"
2023 else
2024 with_oracle="yes"
2025 fi
2026 ])
2027 if test "x$ORACLE_HOME" != "x"
2028 then
2029 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2031 if test -e "$ORACLE_HOME/lib/ldflags"
2032 then
2033 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2034 fi
2035 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2036 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2037 fi
2038 if test "x$with_oracle" = "xyes"
2039 then
2040 SAVE_CPPFLAGS="$CPPFLAGS"
2041 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2043 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2045 CPPFLAGS="$SAVE_CPPFLAGS"
2046 fi
2047 if test "x$with_oracle" = "xyes"
2048 then
2049 SAVE_CPPFLAGS="$CPPFLAGS"
2050 SAVE_LDFLAGS="$LDFLAGS"
2051 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2052 LDFLAGS="$LDFLAGS $with_oracle_libs"
2054 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2056 CPPFLAGS="$SAVE_CPPFLAGS"
2057 LDFLAGS="$SAVE_LDFLAGS"
2058 fi
2059 if test "x$with_oracle" = "xyes"
2060 then
2061 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2062 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2063 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2064 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2065 fi
2066 # }}}
2068 # --with-libowcapi {{{
2069 with_libowcapi_cppflags=""
2070 with_libowcapi_libs="-lowcapi"
2071 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2072 [
2073 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2074 then
2075 with_libowcapi_cppflags="-I$withval/include"
2076 with_libowcapi_libs="-L$withval/lib -lowcapi"
2077 with_libowcapi="yes"
2078 else
2079 with_libowcapi="$withval"
2080 fi
2081 ],
2082 [
2083 with_libowcapi="yes"
2084 ])
2085 if test "x$with_libowcapi" = "xyes"
2086 then
2087 SAVE_CPPFLAGS="$CPPFLAGS"
2088 CPPFLAGS="$with_libowcapi_cppflags"
2090 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2092 CPPFLAGS="$SAVE_CPPFLAGS"
2093 fi
2094 if test "x$with_libowcapi" = "xyes"
2095 then
2096 SAVE_LDFLAGS="$LDFLAGS"
2097 SAVE_CPPFLAGS="$CPPFLAGS"
2098 LDFLAGS="$with_libowcapi_libs"
2099 CPPFLAGS="$with_libowcapi_cppflags"
2101 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2103 LDFLAGS="$SAVE_LDFLAGS"
2104 CPPFLAGS="$SAVE_CPPFLAGS"
2105 fi
2106 if test "x$with_libowcapi" = "xyes"
2107 then
2108 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2109 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2110 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2111 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2112 fi
2113 # }}}
2115 # --with-libpcap {{{
2116 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2117 [
2118 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2119 then
2120 LDFLAGS="$LDFLAGS -L$withval/lib"
2121 CPPFLAGS="$CPPFLAGS -I$withval/include"
2122 with_libpcap="yes"
2123 else
2124 with_libpcap="$withval"
2125 fi
2126 ],
2127 [
2128 with_libpcap="yes"
2129 ])
2130 if test "x$with_libpcap" = "xyes"
2131 then
2132 AC_CHECK_LIB(pcap, pcap_open_live,
2133 [
2134 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2135 ], [with_libpcap="no (libpcap not found)"])
2136 fi
2137 if test "x$with_libpcap" = "xyes"
2138 then
2139 AC_CHECK_HEADERS(pcap.h,
2140 [
2141 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2142 ], [with_libpcap="no (pcap.h not found)"])
2143 fi
2144 if test "x$with_libpcap" = "xyes"
2145 then
2146 collect_libpcap=1
2147 else
2148 collect_libpcap=0
2149 fi
2150 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2151 [Wether or not to use the pcap library])
2152 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2153 # }}}
2155 # --with-libperl {{{
2156 perl_interpreter="perl"
2157 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2158 [
2159 if test -x "$withval"
2160 then
2161 perl_interpreter="$withval"
2162 with_libperl="yes"
2163 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2164 then
2165 LDFLAGS="$LDFLAGS -L$withval/lib"
2166 CPPFLAGS="$CPPFLAGS -I$withval/include"
2167 perl_interpreter="$withval/bin/perl"
2168 with_libperl="yes"
2169 else
2170 with_libperl="$withval"
2171 fi; fi
2172 ],
2173 [
2174 with_libperl="yes"
2175 ])
2177 AC_MSG_CHECKING([for perl])
2178 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2179 if test -x "$perl_interpreter"
2180 then
2181 AC_MSG_RESULT([yes ($perl_interpreter)])
2182 else
2183 perl_interpreter=""
2184 AC_MSG_RESULT([no])
2185 fi
2187 AC_SUBST(PERL, "$perl_interpreter")
2189 if test "x$with_libperl" = "xyes" \
2190 && test -n "$perl_interpreter"
2191 then
2192 SAVE_CFLAGS=$CFLAGS
2193 SAVE_LDFLAGS=$LDFLAGS
2194 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2195 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2196 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2197 CFLAGS="$CFLAGS $PERL_CFLAGS"
2198 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2200 AC_CACHE_CHECK([for libperl],
2201 [c_cv_have_libperl],
2202 AC_LINK_IFELSE(
2203 AC_LANG_PROGRAM(
2204 [[
2205 #define PERL_NO_GET_CONTEXT
2206 #include <EXTERN.h>
2207 #include <perl.h>
2208 #include <XSUB.h>
2209 ]],
2210 [[
2211 dTHX;
2212 load_module (PERL_LOADMOD_NOIMPORT,
2213 newSVpv ("Collectd::Plugin::FooBar", 24),
2214 Nullsv);
2215 ]]),
2216 [c_cv_have_libperl="yes"],
2217 [c_cv_have_libperl="no"]
2218 )
2219 )
2221 if test "x$c_cv_have_libperl" = "xyes"
2222 then
2223 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2224 AC_SUBST(PERL_CFLAGS)
2225 AC_SUBST(PERL_LDFLAGS)
2226 else
2227 with_libperl="no"
2228 fi
2230 CFLAGS=$SAVE_CFLAGS
2231 LDFLAGS=$SAVE_LDFLAGS
2232 else if test -z "$perl_interpreter"; then
2233 with_libperl="no (no perl interpreter found)"
2234 c_cv_have_libperl="no"
2235 fi; fi
2236 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2238 if test "x$with_libperl" = "xyes"
2239 then
2240 SAVE_CFLAGS=$CFLAGS
2241 SAVE_LDFLAGS=$LDFLAGS
2242 CFLAGS="$CFLAGS $PERL_CFLAGS"
2243 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2245 AC_CACHE_CHECK([if perl supports ithreads],
2246 [c_cv_have_perl_ithreads],
2247 AC_LINK_IFELSE(
2248 AC_LANG_PROGRAM(
2249 [[
2250 #include <EXTERN.h>
2251 #include <perl.h>
2252 #include <XSUB.h>
2254 #if !defined(USE_ITHREADS)
2255 # error "Perl does not support ithreads!"
2256 #endif /* !defined(USE_ITHREADS) */
2257 ]],
2258 [[ ]]),
2259 [c_cv_have_perl_ithreads="yes"],
2260 [c_cv_have_perl_ithreads="no"]
2261 )
2262 )
2264 if test "x$c_cv_have_perl_ithreads" = "xyes"
2265 then
2266 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2267 fi
2269 CFLAGS=$SAVE_CFLAGS
2270 LDFLAGS=$SAVE_LDFLAGS
2271 fi
2273 if test "x$with_libperl" = "xyes"
2274 then
2275 SAVE_CFLAGS=$CFLAGS
2276 SAVE_LDFLAGS=$LDFLAGS
2277 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2278 # (see issues #41 and #42)
2279 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2280 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2282 AC_CACHE_CHECK([for broken Perl_load_module()],
2283 [c_cv_have_broken_perl_load_module],
2284 AC_LINK_IFELSE(
2285 AC_LANG_PROGRAM(
2286 [[
2287 #define PERL_NO_GET_CONTEXT
2288 #include <EXTERN.h>
2289 #include <perl.h>
2290 #include <XSUB.h>
2291 ]],
2292 [[
2293 dTHX;
2294 load_module (PERL_LOADMOD_NOIMPORT,
2295 newSVpv ("Collectd::Plugin::FooBar", 24),
2296 Nullsv);
2297 ]]),
2298 [c_cv_have_broken_perl_load_module="no"],
2299 [c_cv_have_broken_perl_load_module="yes"]
2300 )
2301 )
2303 CFLAGS=$SAVE_CFLAGS
2304 LDFLAGS=$SAVE_LDFLAGS
2305 fi
2306 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2307 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2309 if test "x$with_libperl" = "xyes"
2310 then
2311 SAVE_CFLAGS=$CFLAGS
2312 SAVE_LDFLAGS=$LDFLAGS
2313 CFLAGS="$CFLAGS $PERL_CFLAGS"
2314 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2316 AC_CHECK_MEMBER(
2317 [struct mgvtbl.svt_local],
2318 [have_struct_mgvtbl_svt_local="yes"],
2319 [have_struct_mgvtbl_svt_local="no"],
2320 [
2321 #include <EXTERN.h>
2322 #include <perl.h>
2323 #include <XSUB.h>
2324 ])
2326 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2327 then
2328 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2329 [Define if Perl's struct mgvtbl has member svt_local.])
2330 fi
2332 CFLAGS=$SAVE_CFLAGS
2333 LDFLAGS=$SAVE_LDFLAGS
2334 fi
2335 # }}}
2337 # --with-libpq {{{
2338 with_pg_config="pg_config"
2339 with_libpq_includedir=""
2340 with_libpq_libdir=""
2341 with_libpq_cppflags=""
2342 with_libpq_ldflags=""
2343 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2344 [Path to libpq.])],
2345 [
2346 if test "x$withval" = "xno"
2347 then
2348 with_libpq="no"
2349 else if test "x$withval" = "xyes"
2350 then
2351 with_libpq="yes"
2352 else
2353 if test -f "$withval" && test -x "$withval";
2354 then
2355 with_pg_config="$withval"
2356 else if test -x "$withval/bin/pg_config"
2357 then
2358 with_pg_config="$withval/bin/pg_config"
2359 fi; fi
2360 with_libpq="yes"
2361 fi; fi
2362 ],
2363 [
2364 with_libpq="yes"
2365 ])
2366 if test "x$with_libpq" = "xyes"
2367 then
2368 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2369 pg_config_status=$?
2371 if test $pg_config_status -eq 0
2372 then
2373 if test -n "$with_libpq_includedir"; then
2374 for dir in $with_libpq_includedir; do
2375 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2376 done
2377 fi
2378 else
2379 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2380 fi
2382 SAVE_CPPFLAGS="$CPPFLAGS"
2383 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2385 AC_CHECK_HEADERS(libpq-fe.h, [],
2386 [with_libpq="no (libpq-fe.h not found)"], [])
2388 CPPFLAGS="$SAVE_CPPFLAGS"
2389 fi
2390 if test "x$with_libpq" = "xyes"
2391 then
2392 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2393 pg_config_status=$?
2395 if test $pg_config_status -eq 0
2396 then
2397 if test -n "$with_libpq_libdir"; then
2398 for dir in $with_libpq_libdir; do
2399 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2400 done
2401 fi
2402 else
2403 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2404 fi
2406 SAVE_LDFLAGS="$LDFLAGS"
2407 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2409 AC_CHECK_LIB(pq, PQconnectdb,
2410 [with_libpq="yes"],
2411 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2413 AC_CHECK_LIB(pq, PQserverVersion,
2414 [with_libpq="yes"],
2415 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2417 LDFLAGS="$SAVE_LDFLAGS"
2418 fi
2419 if test "x$with_libpq" = "xyes"
2420 then
2421 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2422 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2423 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2424 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2425 fi
2426 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2427 # }}}
2429 # --with-libpthread {{{
2430 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2431 [ if test "x$withval" != "xno" \
2432 && test "x$withval" != "xyes"
2433 then
2434 LDFLAGS="$LDFLAGS -L$withval/lib"
2435 CPPFLAGS="$CPPFLAGS -I$withval/include"
2436 with_libpthread="yes"
2437 else
2438 if test "x$withval" = "xno"
2439 then
2440 with_libpthread="no (disabled)"
2441 fi
2442 fi
2443 ], [with_libpthread="yes"])
2444 if test "x$with_libpthread" = "xyes"
2445 then
2446 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2447 fi
2449 if test "x$with_libpthread" = "xyes"
2450 then
2451 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2452 fi
2453 if test "x$with_libpthread" = "xyes"
2454 then
2455 collect_pthread=1
2456 else
2457 collect_pthread=0
2458 fi
2459 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2460 [Wether or not to use pthread (POSIX threads) library])
2461 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2462 # }}}
2464 # --with-librrd {{{
2465 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2466 librrd_cflags=""
2467 librrd_ldflags=""
2468 librrd_threadsafe="yes"
2469 librrd_rrdc_update="no"
2470 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2471 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2472 then
2473 librrd_cflags="-I$withval/include"
2474 librrd_ldflags="-L$withval/lib"
2475 with_librrd="yes"
2476 else
2477 with_librrd="$withval"
2478 fi
2479 ], [with_librrd="yes"])
2480 if test "x$with_librrd" = "xyes"
2481 then
2482 SAVE_CPPFLAGS="$CPPFLAGS"
2483 SAVE_LDFLAGS="$LDFLAGS"
2485 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2486 LDFLAGS="$LDFLAGS $librrd_ldflags"
2488 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2490 CPPFLAGS="$SAVE_CPPFLAGS"
2491 LDFLAGS="$SAVE_LDFLAGS"
2492 fi
2493 if test "x$with_librrd" = "xyes"
2494 then
2495 SAVE_CPPFLAGS="$CPPFLAGS"
2496 SAVE_LDFLAGS="$LDFLAGS"
2498 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2499 LDFLAGS="$LDFLAGS $librrd_ldflags"
2501 AC_CHECK_LIB(rrd_th, rrd_update_r,
2502 [with_librrd="yes"
2503 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2504 ],
2505 [librrd_threadsafe="no"
2506 AC_CHECK_LIB(rrd, rrd_update,
2507 [with_librrd="yes"
2508 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2509 ],
2510 [with_librrd="no (symbol 'rrd_update' not found)"],
2511 [-lm])
2512 ],
2513 [-lm])
2515 if test "x$librrd_threadsafe" = "xyes"
2516 then
2517 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2518 else
2519 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2520 fi
2522 CPPFLAGS="$SAVE_CPPFLAGS"
2523 LDFLAGS="$SAVE_LDFLAGS"
2524 fi
2525 if test "x$with_librrd" = "xyes"
2526 then
2527 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2528 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2529 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2530 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2531 fi
2532 if test "x$librrd_threadsafe" = "xyes"
2533 then
2534 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2535 fi
2536 # }}}
2538 # --with-libsensors {{{
2539 with_sensors_cflags=""
2540 with_sensors_ldflags=""
2541 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2542 [
2543 if test "x$withval" = "xno"
2544 then
2545 with_libsensors="no"
2546 else
2547 with_libsensors="yes"
2548 if test "x$withval" != "xyes"
2549 then
2550 with_sensors_cflags="-I$withval/include"
2551 with_sensors_ldflags="-L$withval/lib"
2552 with_libsensors="yes"
2553 fi
2554 fi
2555 ],
2556 [
2557 if test "x$ac_system" = "xLinux"
2558 then
2559 with_libsensors="yes"
2560 else
2561 with_libsensors="no (Linux only library)"
2562 fi
2563 ])
2564 if test "x$with_libsensors" = "xyes"
2565 then
2566 SAVE_CPPFLAGS="$CPPFLAGS"
2567 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2569 # AC_CHECK_HEADERS(sensors/sensors.h,
2570 # [
2571 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2572 # ],
2573 # [with_libsensors="no (sensors/sensors.h not found)"])
2574 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2576 CPPFLAGS="$SAVE_CPPFLAGS"
2577 fi
2578 if test "x$with_libsensors" = "xyes"
2579 then
2580 SAVE_CPPFLAGS="$CPPFLAGS"
2581 SAVE_LDFLAGS="$LDFLAGS"
2582 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2583 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2585 AC_CHECK_LIB(sensors, sensors_init,
2586 [
2587 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2588 ],
2589 [with_libsensors="no (libsensors not found)"])
2591 CPPFLAGS="$SAVE_CPPFLAGS"
2592 LDFLAGS="$SAVE_LDFLAGS"
2593 fi
2594 if test "x$with_libsensors" = "xyes"
2595 then
2596 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2597 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2598 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2599 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2600 fi
2601 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2602 # }}}
2604 # --with-libstatgrab {{{
2605 with_libstatgrab_cflags=""
2606 with_libstatgrab_ldflags=""
2607 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2608 [
2609 if test "x$withval" != "xno" \
2610 && test "x$withval" != "xyes"
2611 then
2612 with_libstatgrab_cflags="-I$withval/include"
2613 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2614 with_libstatgrab="yes"
2615 with_libstatgrab_pkg_config="no"
2616 else
2617 with_libstatgrab="$withval"
2618 with_libstatgrab_pkg_config="yes"
2619 fi
2620 ],
2621 [
2622 with_libstatgrab="yes"
2623 with_libstatgrab_pkg_config="yes"
2624 ])
2626 if test "x$with_libstatgrab" = "xyes" \
2627 && test "x$with_libstatgrab_pkg_config" = "xyes"
2628 then
2629 if test "x$PKG_CONFIG" != "x"
2630 then
2631 AC_MSG_CHECKING([pkg-config for libstatgrab])
2632 temp_result="found"
2633 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2634 if test "$?" != "0"
2635 then
2636 with_libstatgrab_pkg_config="no"
2637 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2638 temp_result="not found"
2639 fi
2640 AC_MSG_RESULT([$temp_result])
2641 else
2642 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2643 with_libstatgrab_pkg_config="no"
2644 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2645 fi
2646 fi
2648 if test "x$with_libstatgrab" = "xyes" \
2649 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2650 && test "x$with_libstatgrab_cflags" = "x"
2651 then
2652 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2653 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2654 if test "$?" = "0"
2655 then
2656 with_libstatgrab_cflags="$temp_result"
2657 else
2658 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2659 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2660 fi
2661 AC_MSG_RESULT([$temp_result])
2662 fi
2664 if test "x$with_libstatgrab" = "xyes" \
2665 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2666 && test "x$with_libstatgrab_ldflags" = "x"
2667 then
2668 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2669 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2670 if test "$?" = "0"
2671 then
2672 with_libstatgrab_ldflags="$temp_result"
2673 else
2674 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2675 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2676 fi
2677 AC_MSG_RESULT([$temp_result])
2678 fi
2680 if test "x$with_libstatgrab" = "xyes"
2681 then
2682 SAVE_CPPFLAGS="$CPPFLAGS"
2683 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2685 AC_CHECK_HEADERS(statgrab.h,
2686 [with_libstatgrab="yes"],
2687 [with_libstatgrab="no (statgrab.h not found)"])
2689 CPPFLAGS="$SAVE_CPPFLAGS"
2690 fi
2692 if test "x$with_libstatgrab" = "xyes"
2693 then
2694 SAVE_CFLAGS="$CFLAGS"
2695 SAVE_LDFLAGS="$LDFLAGS"
2697 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2698 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2700 AC_CHECK_LIB(statgrab, sg_init,
2701 [with_libstatgrab="yes"],
2702 [with_libstatgrab="no (symbol sg_init not found)"])
2704 CFLAGS="$SAVE_CFLAGS"
2705 LDFLAGS="$SAVE_LDFLAGS"
2706 fi
2708 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2709 if test "x$with_libstatgrab" = "xyes"
2710 then
2711 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2712 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2713 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2714 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2715 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2716 fi
2717 # }}}
2719 # --with-libupsclient {{{
2720 with_libupsclient_config=""
2721 with_libupsclient_cflags=""
2722 with_libupsclient_libs=""
2723 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2724 [
2725 if test "x$withval" = "xno"
2726 then
2727 with_libupsclient="no"
2728 else if test "x$withval" = "xyes"
2729 then
2730 with_libupsclient="use_pkgconfig"
2731 else
2732 if test -x "$withval"
2733 then
2734 with_libupsclient_config="$withval"
2735 with_libupsclient="use_libupsclient_config"
2736 else if test -x "$withval/bin/libupsclient-config"
2737 then
2738 with_libupsclient_config="$withval/bin/net-snmp-config"
2739 with_libupsclient="use_libupsclient_config"
2740 else
2741 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2742 with_libupsclient_cflags="-I$withval/include"
2743 with_libupsclient_libs="-L$withval/lib -lupsclient"
2744 with_libupsclient="yes"
2745 fi; fi
2746 fi; fi
2747 ],
2748 [with_libupsclient="use_pkgconfig"])
2750 # configure using libupsclient-config
2751 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2752 then
2753 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2754 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2755 if test $? -ne 0
2756 then
2757 with_libupsclient="no ($with_libupsclient_config failed)"
2758 fi
2759 with_libupsclient_libs="`$with_libupsclient_config --libs`"
2760 if test $? -ne 0
2761 then
2762 with_libupsclient="no ($with_libupsclient_config failed)"
2763 fi
2764 fi
2765 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2766 then
2767 with_libupsclient="yes"
2768 fi
2770 # configure using pkg-config
2771 if test "x$with_libupsclient" = "xuse_pkgconfig"
2772 then
2773 if test "x$PKG_CONFIG" = "x"
2774 then
2775 with_libupsclient="no (Don't have pkg-config)"
2776 fi
2777 fi
2778 if test "x$with_libupsclient" = "xuse_pkgconfig"
2779 then
2780 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2781 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2782 if test $? -ne 0
2783 then
2784 with_libupsclient="no (pkg-config doesn't know library)"
2785 fi
2786 fi
2787 if test "x$with_libupsclient" = "xuse_pkgconfig"
2788 then
2789 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2790 if test $? -ne 0
2791 then
2792 with_libupsclient="no ($PKG_CONFIG failed)"
2793 fi
2794 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2795 if test $? -ne 0
2796 then
2797 with_libupsclient="no ($PKG_CONFIG failed)"
2798 fi
2799 fi
2800 if test "x$with_libupsclient" = "xuse_pkgconfig"
2801 then
2802 with_libupsclient="yes"
2803 fi
2805 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2806 # the actual checks.
2807 if test "x$with_libupsclient" = "xyes"
2808 then
2809 SAVE_CPPFLAGS="$CPPFLAGS"
2810 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2812 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2814 CPPFLAGS="$SAVE_CPPFLAGS"
2815 fi
2816 if test "x$with_libupsclient" = "xyes"
2817 then
2818 SAVE_CPPFLAGS="$CPPFLAGS"
2819 SAVE_LDFLAGS="$LDFLAGS"
2821 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2822 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2824 AC_CHECK_LIB(upsclient, upscli_connect,
2825 [with_libupsclient="yes"],
2826 [with_libupsclient="no (symbol upscli_connect not found)"])
2828 CPPFLAGS="$SAVE_CPPFLAGS"
2829 LDFLAGS="$SAVE_LDFLAGS"
2830 fi
2831 if test "x$with_libupsclient" = "xyes"
2832 then
2833 SAVE_CPPFLAGS="$CPPFLAGS"
2834 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2836 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2837 [#include <stdlib.h>
2838 #include <stdio.h>
2839 #include <upsclient.h>])
2841 CPPFLAGS="$SAVE_CPPFLAGS"
2842 fi
2843 if test "x$with_libupsclient" = "xyes"
2844 then
2845 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2846 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2847 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2848 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2849 fi
2850 # }}}
2852 # --with-libxmms {{{
2853 with_xmms_config="xmms-config"
2854 with_xmms_cflags=""
2855 with_xmms_libs=""
2856 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2857 [
2858 if test "x$withval" != "xno" \
2859 && test "x$withval" != "xyes"
2860 then
2861 if test -f "$withval" && test -x "$withval";
2862 then
2863 with_xmms_config="$withval"
2864 else if test -x "$withval/bin/xmms-config"
2865 then
2866 with_xmms_config="$withval/bin/xmms-config"
2867 fi; fi
2868 with_libxmms="yes"
2869 else if test "x$withval" = "xno"
2870 then
2871 with_libxmms="no"
2872 else
2873 with_libxmms="yes"
2874 fi; fi
2875 ],
2876 [
2877 with_libxmms="yes"
2878 ])
2879 if test "x$with_libxmms" = "xyes"
2880 then
2881 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2882 xmms_config_status=$?
2884 if test $xmms_config_status -ne 0
2885 then
2886 with_libxmms="no"
2887 fi
2888 fi
2889 if test "x$with_libxmms" = "xyes"
2890 then
2891 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2892 xmms_config_status=$?
2894 if test $xmms_config_status -ne 0
2895 then
2896 with_libxmms="no"
2897 fi
2898 fi
2899 if test "x$with_libxmms" = "xyes"
2900 then
2901 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2902 [
2903 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2904 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2905 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2906 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2907 ],
2908 [
2909 with_libxmms="no"
2910 ],
2911 [$with_xmms_libs])
2912 fi
2913 with_libxmms_numeric=0
2914 if test "x$with_libxmms" = "xyes"
2915 then
2916 with_libxmms_numeric=1
2917 fi
2918 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2919 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2920 # }}}
2922 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2923 with_libxml2="no (pkg-config isn't available)"
2924 with_libxml2_cflags=""
2925 with_libxml2_ldflags=""
2926 with_libvirt="no (pkg-config isn't available)"
2927 with_libvirt_cflags=""
2928 with_libvirt_ldflags=""
2929 if test "x$PKG_CONFIG" != "x"
2930 then
2931 pkg-config --exists 'libxml-2.0' 2>/dev/null
2932 if test "$?" = "0"
2933 then
2934 with_libxml2="yes"
2935 else
2936 with_libxml2="no (pkg-config doesn't know library)"
2937 fi
2939 pkg-config --exists libvirt 2>/dev/null
2940 if test "$?" = "0"
2941 then
2942 with_libvirt="yes"
2943 else
2944 with_libvirt="no (pkg-config doesn't know library)"
2945 fi
2946 fi
2947 if test "x$with_libxml2" = "xyes"
2948 then
2949 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2950 if test $? -ne 0
2951 then
2952 with_libxml2="no"
2953 fi
2954 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2955 if test $? -ne 0
2956 then
2957 with_libxml2="no"
2958 fi
2959 fi
2960 if test "x$with_libxml2" = "xyes"
2961 then
2962 SAVE_CPPFLAGS="$CPPFLAGS"
2963 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2965 AC_CHECK_HEADERS(libxml/parser.h, [],
2966 [with_libxml2="no (libxml/parser.h not found)"])
2968 CPPFLAGS="$SAVE_CPPFLAGS"
2969 fi
2970 if test "x$with_libxml2" = "xyes"
2971 then
2972 SAVE_CFLAGS="$CFLAGS"
2973 SAVE_LDFLAGS="$LDFLAGS"
2975 CFLAGS="$CFLAGS $with_libxml2_cflags"
2976 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2978 AC_CHECK_LIB(xml2, xmlXPathEval,
2979 [with_libxml2="yes"],
2980 [with_libxml2="no (symbol xmlXPathEval not found)"])
2982 CFLAGS="$SAVE_CFLAGS"
2983 LDFLAGS="$SAVE_LDFLAGS"
2984 fi
2985 dnl Add the right compiler flags and libraries.
2986 if test "x$with_libxml2" = "xyes"; then
2987 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2988 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2989 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2990 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2991 fi
2992 if test "x$with_libvirt" = "xyes"
2993 then
2994 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2995 if test $? -ne 0
2996 then
2997 with_libvirt="no"
2998 fi
2999 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3000 if test $? -ne 0
3001 then
3002 with_libvirt="no"
3003 fi
3004 fi
3005 if test "x$with_libvirt" = "xyes"
3006 then
3007 SAVE_CPPFLAGS="$CPPFLAGS"
3008 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3010 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3011 [with_libvirt="no (libvirt/libvirt.h not found)"])
3013 CPPFLAGS="$SAVE_CPPFLAGS"
3014 fi
3015 if test "x$with_libvirt" = "xyes"
3016 then
3017 SAVE_CFLAGS="$CFLAGS"
3018 SAVE_LDFLAGS="$LDFLAGS"
3020 CFLAGS="$CFLAGS $with_libvirt_cflags"
3021 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3023 AC_CHECK_LIB(virt, virDomainBlockStats,
3024 [with_libvirt="yes"],
3025 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3027 CFLAGS="$SAVE_CFLAGS"
3028 LDFLAGS="$SAVE_LDFLAGS"
3029 fi
3030 dnl Add the right compiler flags and libraries.
3031 if test "x$with_libvirt" = "xyes"; then
3032 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3033 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3034 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3035 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3036 fi
3037 # }}}
3039 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3040 with_libopenipmipthread="yes"
3041 with_libopenipmipthread_cflags=""
3042 with_libopenipmipthread_libs=""
3044 AC_MSG_CHECKING([for pkg-config])
3045 temp_result="no"
3046 if test "x$PKG_CONFIG" = "x"
3047 then
3048 with_libopenipmipthread="no"
3049 temp_result="no"
3050 else
3051 temp_result="$PKG_CONFIG"
3052 fi
3053 AC_MSG_RESULT([$temp_result])
3055 if test "x$with_libopenipmipthread" = "xyes"
3056 then
3057 AC_MSG_CHECKING([for libOpenIPMIpthread])
3058 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3059 if test "$?" != "0"
3060 then
3061 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3062 fi
3063 AC_MSG_RESULT([$with_libopenipmipthread])
3064 fi
3066 if test "x$with_libopenipmipthread" = "xyes"
3067 then
3068 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3069 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3070 if test "$?" = "0"
3071 then
3072 with_libopenipmipthread_cflags="$temp_result"
3073 else
3074 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3075 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3076 fi
3077 AC_MSG_RESULT([$temp_result])
3078 fi
3080 if test "x$with_libopenipmipthread" = "xyes"
3081 then
3082 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3083 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3084 if test "$?" = "0"
3085 then
3086 with_libopenipmipthread_ldflags="$temp_result"
3087 else
3088 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3089 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3090 fi
3091 AC_MSG_RESULT([$temp_result])
3092 fi
3094 if test "x$with_libopenipmipthread" = "xyes"
3095 then
3096 SAVE_CPPFLAGS="$CPPFLAGS"
3097 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3099 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3100 [with_libopenipmipthread="yes"],
3101 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3102 [#include <OpenIPMI/ipmiif.h>
3103 #include <OpenIPMI/ipmi_err.h>
3104 #include <OpenIPMI/ipmi_posix.h>
3105 #include <OpenIPMI/ipmi_conn.h>
3106 ])
3108 CPPFLAGS="$SAVE_CPPFLAGS"
3109 fi
3111 if test "x$with_libopenipmipthread" = "xyes"
3112 then
3113 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3114 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3115 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3116 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3117 fi
3118 # }}}
3120 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3121 [with_libnotify="yes"],
3122 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3124 # Check for enabled/disabled features
3125 #
3127 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3128 # ------------------------------------------------------------
3129 dnl
3130 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3131 dnl
3132 AC_DEFUN(
3133 [AC_COLLECTD],
3134 [
3135 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3136 m4_if(
3137 [$2],
3138 [enable],
3139 [dnl
3140 m4_define([EnDis],[disabled])dnl
3141 m4_define([YesNo],[no])dnl
3142 ],dnl
3143 [m4_if(
3144 [$2],
3145 [disable],
3146 [dnl
3147 m4_define([EnDis],[enabled])dnl
3148 m4_define([YesNo],[yes])dnl
3149 ],
3150 [dnl
3151 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3152 ]dnl
3153 )]dnl
3154 )dnl
3155 m4_if([$3], [feature], [],
3156 [m4_if(
3157 [$3], [module], [],
3158 [dnl
3159 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3160 ]dnl
3161 )]dnl
3162 )dnl
3163 AC_ARG_ENABLE(
3164 [$1],
3165 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3166 [],
3167 enable_$1='[YesNo]'dnl
3168 )# AC_ARG_ENABLE
3169 if test "x$enable_$1" = "xno"
3170 then
3171 collectd_$1=0
3172 else
3173 if test "x$enable_$1" = "xyes"
3174 then
3175 collectd_$1=1
3176 else
3177 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3178 collectd_$1=1
3179 enable_$1='yes'
3180 fi
3181 fi
3182 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3183 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3184 ]dnl
3185 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3187 # AC_PLUGIN(name, default, info)
3188 # ------------------------------------------------------------
3189 dnl
3190 AC_DEFUN(
3191 [AC_PLUGIN],
3192 [
3193 enable_plugin="no"
3194 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3195 [
3196 if test "x$enableval" = "xyes"
3197 then
3198 enable_plugin="yes"
3199 else
3200 enable_plugin="no"
3201 fi
3202 ],
3203 [
3204 if test "x$2" = "xyes"
3205 then
3206 enable_plugin="yes"
3207 else
3208 enable_plugin="no"
3209 fi
3210 ])
3211 if test "x$enable_plugin" = "xyes"
3212 then
3213 if test "x$2" = "xyes"
3214 then
3215 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3216 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3217 dependency_error="yes"
3218 enable_plugin="no (dependency error)"
3219 fi
3220 fi
3221 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3222 enable_$1="$enable_plugin"
3223 ]
3224 )# AC_PLUGIN(name, default, info)
3226 m4_divert_once([HELP_ENABLE], [
3227 collectd features:])
3228 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3229 AC_COLLECTD([debug], [enable], [feature], [debugging])
3230 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3231 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3233 dependency_error="no"
3234 plugin_ascent="no"
3235 plugin_battery="no"
3236 plugin_bind="no"
3237 plugin_conntrack="no"
3238 plugin_cpu="no"
3239 plugin_cpufreq="no"
3240 plugin_df="no"
3241 plugin_disk="no"
3242 plugin_entropy="no"
3243 plugin_interface="no"
3244 plugin_ipmi="no"
3245 plugin_ipvs="no"
3246 plugin_irq="no"
3247 plugin_libvirt="no"
3248 plugin_load="no"
3249 plugin_memory="no"
3250 plugin_multimeter="no"
3251 plugin_nfs="no"
3252 plugin_fscache="no"
3253 plugin_perl="no"
3254 plugin_processes="no"
3255 plugin_protocols="no"
3256 plugin_serial="no"
3257 plugin_swap="no"
3258 plugin_tape="no"
3259 plugin_tcpconns="no"
3260 plugin_ted="no"
3261 plugin_thermal="no"
3262 plugin_users="no"
3263 plugin_uptime="no"
3264 plugin_vmem="no"
3265 plugin_vserver="no"
3266 plugin_wireless="no"
3268 # Linux
3269 if test "x$ac_system" = "xLinux"
3270 then
3271 plugin_battery="yes"
3272 plugin_conntrack="yes"
3273 plugin_cpu="yes"
3274 plugin_cpufreq="yes"
3275 plugin_disk="yes"
3276 plugin_entropy="yes"
3277 plugin_interface="yes"
3278 plugin_irq="yes"
3279 plugin_load="yes"
3280 plugin_memory="yes"
3281 plugin_nfs="yes"
3282 plugin_fscache="yes"
3283 plugin_processes="yes"
3284 plugin_protocols="yes"
3285 plugin_serial="yes"
3286 plugin_swap="yes"
3287 plugin_tcpconns="yes"
3288 plugin_thermal="yes"
3289 plugin_uptime="yes"
3290 plugin_vmem="yes"
3291 plugin_vserver="yes"
3292 plugin_wireless="yes"
3294 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3295 then
3296 plugin_ipvs="yes"
3297 fi
3298 fi
3300 if test "x$ac_system" = "xOpenBSD"
3301 then
3302 plugin_tcpconns="yes"
3303 fi
3305 # Mac OS X devices
3306 if test "x$with_libiokit" = "xyes"
3307 then
3308 plugin_battery="yes"
3309 plugin_disk="yes"
3310 fi
3312 # Solaris
3313 if test "x$with_kstat" = "xyes"
3314 then
3315 plugin_uptime="yes"
3316 fi
3318 if test "x$with_devinfo$with_kstat" = "xyesyes"
3319 then
3320 plugin_cpu="yes"
3321 plugin_disk="yes"
3322 plugin_interface="yes"
3323 plugin_memory="yes"
3324 plugin_tape="yes"
3325 fi
3327 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3328 then
3329 plugin_swap="yes"
3330 fi
3332 # libstatgrab
3333 if test "x$with_libstatgrab" = "xyes"
3334 then
3335 plugin_cpu="yes"
3336 plugin_disk="yes"
3337 plugin_interface="yes"
3338 plugin_load="yes"
3339 plugin_memory="yes"
3340 plugin_swap="yes"
3341 plugin_users="yes"
3342 fi
3344 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3345 then
3346 plugin_ascent="yes"
3347 plugin_bind="yes"
3348 fi
3350 if test "x$with_libopenipmipthread" = "xyes"
3351 then
3352 plugin_ipmi="yes"
3353 fi
3355 if test "x$have_processor_info" = "xyes"
3356 then
3357 plugin_cpu="yes"
3358 fi
3359 if test "x$have_sysctl" = "xyes"
3360 then
3361 plugin_cpu="yes"
3362 plugin_memory="yes"
3363 plugin_swap="yes"
3364 plugin_uptime="yes"
3365 fi
3366 if test "x$have_sysctlbyname" = "xyes"
3367 then
3368 plugin_cpu="yes"
3369 plugin_memory="yes"
3370 plugin_tcpconns="yes"
3371 fi
3373 # Df plugin: Check if we know how to determine mount points first.
3374 #if test "x$have_listmntent" = "xyes"; then
3375 # plugin_df="yes"
3376 #fi
3377 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3378 then
3379 plugin_df="yes"
3380 fi
3381 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3382 then
3383 plugin_df="yes"
3384 fi
3385 #if test "x$have_getmntent" = "xseq"
3386 #then
3387 # plugin_df="yes"
3388 #fi
3389 if test "x$c_cv_have_one_getmntent" = "xyes"
3390 then
3391 plugin_df="yes"
3392 fi
3394 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3395 if test "x$plugin_df" = "xyes"
3396 then
3397 plugin_df="no"
3398 if test "x$have_statfs" = "xyes"
3399 then
3400 plugin_df="yes"
3401 fi
3402 if test "x$have_statvfs" = "xyes"
3403 then
3404 plugin_df="yes"
3405 fi
3406 fi
3408 if test "x$have_getifaddrs" = "xyes"
3409 then
3410 plugin_interface="yes"
3411 fi
3413 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3414 then
3415 plugin_libvirt="yes"
3416 fi
3418 if test "x$have_getloadavg" = "xyes"
3419 then
3420 plugin_load="yes"
3421 fi
3423 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3424 then
3425 plugin_perl="yes"
3426 fi
3428 # Mac OS X memory interface
3429 if test "x$have_host_statistics" = "xyes"
3430 then
3431 plugin_memory="yes"
3432 fi
3434 if test "x$have_termios_h" = "xyes"
3435 then
3436 plugin_multimeter="yes"
3437 plugin_ted="yes"
3438 fi
3440 if test "x$have_thread_info" = "xyes"
3441 then
3442 plugin_processes="yes"
3443 fi
3445 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3446 then
3447 plugin_processes="yes"
3448 fi
3450 if test "x$with_kvm_getswapinfo" = "xyes"
3451 then
3452 plugin_swap="yes"
3453 fi
3455 if test "x$have_swapctl" = "xyes"
3456 then
3457 plugin_swap="yes"
3458 fi
3460 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3461 then
3462 plugin_tcpconns="yes"
3463 fi
3465 if test "x$have_getutent" = "xyes"
3466 then
3467 plugin_users="yes"
3468 fi
3469 if test "x$have_getutxent" = "xyes"
3470 then
3471 plugin_users="yes"
3472 fi
3474 m4_divert_once([HELP_ENABLE], [
3475 collectd plugins:])
3477 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
3478 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
3479 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
3480 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
3481 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
3482 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
3483 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
3484 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
3485 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
3486 AC_PLUGIN([csv], [yes], [CSV output plugin])
3487 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
3488 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
3489 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
3490 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
3491 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
3492 AC_PLUGIN([email], [yes], [EMail statistics])
3493 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
3494 AC_PLUGIN([exec], [yes], [Execution of external programs])
3495 AC_PLUGIN([filecount], [yes], [Count files in directories])
3496 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
3497 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
3498 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
3499 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
3500 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
3501 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
3502 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3503 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
3504 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
3505 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
3506 AC_PLUGIN([load], [$plugin_load], [System load])
3507 AC_PLUGIN([logfile], [yes], [File logging plugin])
3508 AC_PLUGIN([match_regex], [yes], [The regex match])
3509 AC_PLUGIN([match_timediff], [yes], [The timediff match])
3510 AC_PLUGIN([match_value], [yes], [The value match])
3511 AC_PLUGIN([mbmon], [yes], [Query mbmond])
3512 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
3513 AC_PLUGIN([memcached], [yes], [memcached statistics])
3514 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
3515 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
3516 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
3517 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3518 AC_PLUGIN([network], [yes], [Network communication plugin])
3519 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
3520 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3521 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3522 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
3523 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
3524 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3525 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
3526 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
3527 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
3528 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
3529 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
3530 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
3531 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
3532 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
3533 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
3534 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
3535 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
3536 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
3537 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
3538 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
3539 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
3540 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
3541 AC_PLUGIN([table], [yes], [Parsing of tabular data])
3542 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3543 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3544 AC_PLUGIN([target_notification], [yes], [The notification target])
3545 AC_PLUGIN([target_replace], [yes], [The replace target])
3546 AC_PLUGIN([target_set], [yes], [The set target])
3547 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3548 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3549 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
3550 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3551 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3552 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
3553 AC_PLUGIN([users], [$plugin_users], [User statistics])
3554 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3555 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3556 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3557 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3558 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3560 dnl Default configuration file
3561 # Load either syslog or logfile
3562 LOAD_PLUGIN_SYSLOG=""
3563 LOAD_PLUGIN_LOGFILE=""
3565 AC_MSG_CHECKING([which default log plugin to load])
3566 default_log_plugin="none"
3567 if test "x$enable_syslog" = "xyes"
3568 then
3569 default_log_plugin="syslog"
3570 else
3571 LOAD_PLUGIN_SYSLOG="##"
3572 fi
3574 if test "x$enable_logfile" = "xyes"
3575 then
3576 if test "x$default_log_plugin" = "xnone"
3577 then
3578 default_log_plugin="logfile"
3579 else
3580 LOAD_PLUGIN_LOGFILE="#"
3581 fi
3582 else
3583 LOAD_PLUGIN_LOGFILE="##"
3584 fi
3585 AC_MSG_RESULT([$default_log_plugin])
3587 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3588 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3590 DEFAULT_LOG_LEVEL="info"
3591 if test "x$enable_debug" = "xyes"
3592 then
3593 DEFAULT_LOG_LEVEL="debug"
3594 fi
3595 AC_SUBST(DEFAULT_LOG_LEVEL)
3597 # Load only one of rrdtool, network, csv in the default config.
3598 LOAD_PLUGIN_RRDTOOL=""
3599 LOAD_PLUGIN_NETWORK=""
3600 LOAD_PLUGIN_CSV=""
3602 AC_MSG_CHECKING([which default write plugin to load])
3603 default_write_plugin="none"
3604 if test "x$enable_rrdtool" = "xyes"
3605 then
3606 default_write_plugin="rrdtool"
3607 else
3608 LOAD_PLUGIN_RRDTOOL="##"
3609 fi
3611 if test "x$enable_network" = "xyes"
3612 then
3613 if test "x$default_write_plugin" = "xnone"
3614 then
3615 default_write_plugin="network"
3616 else
3617 LOAD_PLUGIN_NETWORK="#"
3618 fi
3619 else
3620 LOAD_PLUGIN_NETWORK="##"
3621 fi
3623 if test "x$enable_csv" = "xyes"
3624 then
3625 if test "x$default_write_plugin" = "xnone"
3626 then
3627 default_write_plugin="csv"
3628 else
3629 LOAD_PLUGIN_CSV="#"
3630 fi
3631 else
3632 LOAD_PLUGIN_CSV="##"
3633 fi
3634 AC_MSG_RESULT([$default_write_plugin])
3636 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3637 AC_SUBST(LOAD_PLUGIN_NETWORK)
3638 AC_SUBST(LOAD_PLUGIN_CSV)
3640 dnl ip_vs.h
3641 if test "x$ac_system" = "xLinux" \
3642 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3643 then
3644 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3645 fi
3647 dnl Perl bindings
3648 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3649 [
3650 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3651 then
3652 PERL_BINDINGS_OPTIONS="$withval"
3653 with_perl_bindings="yes"
3654 else
3655 PERL_BINDINGS_OPTIONS=""
3656 with_perl_bindings="$withval"
3657 fi
3658 ],
3659 [
3660 PERL_BINDINGS_OPTIONS=""
3661 if test -n "$perl_interpreter"
3662 then
3663 with_perl_bindings="yes"
3664 else
3665 with_perl_bindings="no (no perl interpreter found)"
3666 fi
3667 ])
3668 if test "x$with_perl_bindings" = "xyes"
3669 then
3670 PERL_BINDINGS="perl"
3671 else
3672 PERL_BINDINGS=""
3673 fi
3674 AC_SUBST(PERL_BINDINGS)
3675 AC_SUBST(PERL_BINDINGS_OPTIONS)
3677 dnl libcollectdclient
3678 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3679 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3680 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3682 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3684 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3686 AC_SUBST(LCC_VERSION_MAJOR)
3687 AC_SUBST(LCC_VERSION_MINOR)
3688 AC_SUBST(LCC_VERSION_PATCH)
3689 AC_SUBST(LCC_VERSION_EXTRA)
3690 AC_SUBST(LCC_VERSION_STRING)
3692 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3694 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile)
3696 if test "x$with_librrd" = "xyes" \
3697 && test "x$librrd_threadsafe" != "xyes"
3698 then
3699 with_librrd="yes (warning: librrd is not thread-safe)"
3700 fi
3702 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3703 then
3704 with_libiptc="yes (shipped version)"
3705 fi
3707 if test "x$with_libperl" = "xyes"
3708 then
3709 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3710 else
3711 enable_perl="no (needs libperl)"
3712 fi
3714 if test "x$with_perl_bindings" = "xyes" \
3715 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3716 then
3717 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3718 fi
3720 cat <<EOF;
3722 Configuration:
3723 Libraries:
3724 libcurl . . . . . . . $with_libcurl
3725 libdbi . . . . . . . $with_libdbi
3726 libesmtp . . . . . . $with_libesmtp
3727 libgcrypt . . . . . . $with_libgcrypt
3728 libiokit . . . . . . $with_libiokit
3729 libiptc . . . . . . . $with_libiptc
3730 libjvm . . . . . . . $with_java
3731 libkstat . . . . . . $with_kstat
3732 libkvm . . . . . . . $with_libkvm
3733 libmysql . . . . . . $with_libmysql
3734 libnetlink . . . . . $with_libnetlink
3735 libnetsnmp . . . . . $with_libnetsnmp
3736 libnotify . . . . . . $with_libnotify
3737 liboconfig . . . . . $with_liboconfig
3738 libopenipmi . . . . . $with_libopenipmipthread
3739 liboping . . . . . . $with_liboping
3740 libpcap . . . . . . . $with_libpcap
3741 libperl . . . . . . . $with_libperl
3742 libpq . . . . . . . . $with_libpq
3743 libpthread . . . . . $with_libpthread
3744 librrd . . . . . . . $with_librrd
3745 libsensors . . . . . $with_libsensors
3746 libstatgrab . . . . . $with_libstatgrab
3747 libupsclient . . . . $with_libupsclient
3748 libvirt . . . . . . . $with_libvirt
3749 libxml2 . . . . . . . $with_libxml2
3750 libxmms . . . . . . . $with_libxmms
3751 oracle . . . . . . . $with_oracle
3753 Features:
3754 daemon mode . . . . . $enable_daemon
3755 debug . . . . . . . . $enable_debug
3757 Bindings:
3758 perl . . . . . . . . $with_perl_bindings
3760 Modules:
3761 apache . . . . . . . $enable_apache
3762 apcups . . . . . . . $enable_apcups
3763 apple_sensors . . . . $enable_apple_sensors
3764 ascent . . . . . . . $enable_ascent
3765 battery . . . . . . . $enable_battery
3766 bind . . . . . . . . $enable_bind
3767 conntrack . . . . . . $enable_conntrack
3768 cpu . . . . . . . . . $enable_cpu
3769 cpufreq . . . . . . . $enable_cpufreq
3770 csv . . . . . . . . . $enable_csv
3771 curl . . . . . . . . $enable_curl
3772 dbi . . . . . . . . . $enable_dbi
3773 df . . . . . . . . . $enable_df
3774 disk . . . . . . . . $enable_disk
3775 dns . . . . . . . . . $enable_dns
3776 email . . . . . . . . $enable_email
3777 entropy . . . . . . . $enable_entropy
3778 exec . . . . . . . . $enable_exec
3779 filecount . . . . . . $enable_filecount
3780 fscache . . . . . . . $enable_fscache
3781 gmond . . . . . . . . $enable_gmond
3782 hddtemp . . . . . . . $enable_hddtemp
3783 interface . . . . . . $enable_interface
3784 ipmi . . . . . . . . $enable_ipmi
3785 iptables . . . . . . $enable_iptables
3786 ipvs . . . . . . . . $enable_ipvs
3787 irq . . . . . . . . . $enable_irq
3788 java . . . . . . . . $enable_java
3789 libvirt . . . . . . . $enable_libvirt
3790 load . . . . . . . . $enable_load
3791 logfile . . . . . . . $enable_logfile
3792 match_regex . . . . . $enable_match_regex
3793 match_timediff . . . $enable_match_timediff
3794 match_value . . . . . $enable_match_value
3795 mbmon . . . . . . . . $enable_mbmon
3796 memcachec . . . . . . $enable_memcachec
3797 memcached . . . . . . $enable_memcached
3798 memory . . . . . . . $enable_memory
3799 multimeter . . . . . $enable_multimeter
3800 mysql . . . . . . . . $enable_mysql
3801 netlink . . . . . . . $enable_netlink
3802 network . . . . . . . $enable_network
3803 nfs . . . . . . . . . $enable_nfs
3804 nginx . . . . . . . . $enable_nginx
3805 notify_desktop . . . $enable_notify_desktop
3806 notify_email . . . . $enable_notify_email
3807 ntpd . . . . . . . . $enable_ntpd
3808 nut . . . . . . . . . $enable_nut
3809 onewire . . . . . . . $enable_onewire
3810 openvpn . . . . . . . $enable_openvpn
3811 oracle . . . . . . . $enable_oracle
3812 perl . . . . . . . . $enable_perl
3813 ping . . . . . . . . $enable_ping
3814 postgresql . . . . . $enable_postgresql
3815 powerdns . . . . . . $enable_powerdns
3816 processes . . . . . . $enable_processes
3817 protocols . . . . . . $enable_protocols
3818 rrdcached . . . . . . $enable_rrdcached
3819 rrdtool . . . . . . . $enable_rrdtool
3820 sensors . . . . . . . $enable_sensors
3821 serial . . . . . . . $enable_serial
3822 snmp . . . . . . . . $enable_snmp
3823 swap . . . . . . . . $enable_swap
3824 syslog . . . . . . . $enable_syslog
3825 table . . . . . . . . $enable_table
3826 tail . . . . . . . . $enable_tail
3827 tape . . . . . . . . $enable_tape
3828 target_notification . $enable_target_notification
3829 target_replace . . . $enable_target_replace
3830 target_set . . . . . $enable_target_set
3831 tcpconns . . . . . . $enable_tcpconns
3832 teamspeak2 . . . . . $enable_teamspeak2
3833 ted . . . . . . . . . $enable_ted
3834 thermal . . . . . . . $enable_thermal
3835 unixsock . . . . . . $enable_unixsock
3836 uptime . . . . . . . $enable_uptime
3837 users . . . . . . . . $enable_users
3838 uuid . . . . . . . . $enable_uuid
3839 vmem . . . . . . . . $enable_vmem
3840 vserver . . . . . . . $enable_vserver
3841 wireless . . . . . . $enable_wireless
3842 xmms . . . . . . . . $enable_xmms
3844 EOF
3846 if test "x$dependency_error" = "xyes"; then
3847 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3848 fi
3850 # vim: set fdm=marker :