e37a8ab2be64e8487e29bda1be404de299016cd8
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 JAVAC="$JAVAC"
1485 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1486 [
1487 if test "x$withval" = "xno"
1488 then
1489 with_java="no"
1490 else if test "x$withval" = "xyes"
1491 then
1492 with_java="yes"
1493 else
1494 with_java_home="$withval"
1495 with_java="yes"
1496 fi; fi
1497 ],
1498 [with_java="yes"])
1499 if test "x$with_java" = "xyes"
1500 then
1501 if test -d "$with_java_home"
1502 then
1503 AC_MSG_CHECKING([for jni.h])
1504 TMPDIR=`find -L "$with_java_home" -name jni.h -exec 'dirname' '{}' ';' | head -n 1`
1505 if test "x$TMPDIR" != "x"
1506 then
1507 AC_MSG_RESULT([found in $TMPDIR])
1508 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1509 else
1510 AC_MSG_RESULT([not found])
1511 fi
1513 AC_MSG_CHECKING([for jni_md.h])
1514 TMPDIR=`find -L "$with_java_home" -name jni_md.h -exec 'dirname' '{}' ';' | head -n 1`
1515 if test "x$TMPDIR" != "x"
1516 then
1517 AC_MSG_RESULT([found in $TMPDIR])
1518 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1519 else
1520 AC_MSG_RESULT([not found])
1521 fi
1523 AC_MSG_CHECKING([for libjvm.so])
1524 TMPDIR=`find -L "$with_java_home" -name libjvm.so -exec 'dirname' '{}' ';' | head -n 1`
1525 if test "x$TMPDIR" != "x"
1526 then
1527 AC_MSG_RESULT([found in $TMPDIR])
1528 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR"
1529 else
1530 AC_MSG_RESULT([not found])
1531 fi
1533 if test "x$JAVAC" = "x"
1534 then
1535 AC_MSG_CHECKING([for javac])
1536 TMPDIR=`find -L "$with_java_home" -name javac | head -n 1`
1537 if test "x$TMPDIR" != "x"
1538 then
1539 JAVAC="$TMPDIR"
1540 AC_MSG_RESULT([$JAVAC])
1541 else
1542 AC_MSG_RESULT([not found])
1543 fi
1544 fi
1545 else if test "x$with_java_home" != "x"
1546 then
1547 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1548 fi; fi
1549 fi
1551 if test "x$JAVA_CPPFLAGS" != "x"
1552 then
1553 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1554 fi
1555 if test "x$JAVA_CFLAGS" != "x"
1556 then
1557 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1558 fi
1559 if test "x$JAVA_LDFLAGS" != "x"
1560 then
1561 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1562 fi
1563 if test "x$JAVAC" = "x"
1564 then
1565 with_javac_path="$PATH"
1566 if test "x$with_java_home" != "x"
1567 then
1568 with_javac_path="$with_java_home:with_javac_path"
1569 if test -d "$with_java_home/bin"
1570 then
1571 with_javac_path="$with_java_home/bin:with_javac_path"
1572 fi
1573 fi
1575 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1576 fi
1577 if test "x$JAVAC" = "x"
1578 then
1579 with_java="no (javac not found)"
1580 fi
1582 SAVE_CPPFLAGS="$CPPFLAGS"
1583 SAVE_CFLAGS="$CFLAGS"
1584 SAVE_LDFLAGS="$LDFLAGS"
1585 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1586 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1587 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1589 if test "x$with_java" = "xyes"
1590 then
1591 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1592 fi
1593 if test "x$with_java" = "xyes"
1594 then
1595 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1596 [with_java="yes"],
1597 [with_java="no (libjvm not found)"],
1598 [$JAVA_LIBS])
1599 fi
1600 if test "x$with_java" = "xyes"
1601 then
1602 JAVA_LIBS="$JAVA_LIBS -ljvm"
1603 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1604 fi
1606 CPPFLAGS="$SAVE_CPPFLAGS"
1607 CFLAGS="$SAVE_CFLAGS"
1608 LDFLAGS="$SAVE_LDFLAGS"
1610 AC_SUBST(JAVA_CPPFLAGS)
1611 AC_SUBST(JAVA_CFLAGS)
1612 AC_SUBST(JAVA_LDFLAGS)
1613 AC_SUBST(JAVA_LIBS)
1614 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1615 # }}}
1617 # --with-libmemcached {{{
1618 with_libmemcached_cppflags=""
1619 with_libmemcached_ldflags=""
1620 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1621 [
1622 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1623 then
1624 with_libmemcached_cppflags="-I$withval/include"
1625 with_libmemcached_ldflags="-L$withval/lib"
1626 with_libmemcached="yes"
1627 else
1628 with_libmemcached="$withval"
1629 fi
1630 ],
1631 [
1632 with_libmemcached="yes"
1633 ])
1634 if test "x$with_libmemcached" = "xyes"
1635 then
1636 SAVE_CPPFLAGS="$CPPFLAGS"
1637 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1639 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1641 CPPFLAGS="$SAVE_CPPFLAGS"
1642 fi
1643 if test "x$with_libmemcached" = "xyes"
1644 then
1645 SAVE_CPPFLAGS="$CPPFLAGS"
1646 SAVE_LDFLAGS="$LDFLAGS"
1647 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1648 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1650 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1652 CPPFLAGS="$SAVE_CPPFLAGS"
1653 LDFLAGS="$SAVE_LDFLAGS"
1654 fi
1655 if test "x$with_libmemcached" = "xyes"
1656 then
1657 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1658 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1659 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1660 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1661 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1662 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1663 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1664 fi
1665 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1666 # }}}
1668 # --with-libmysql {{{
1669 with_mysql_config="mysql_config"
1670 with_mysql_cflags=""
1671 with_mysql_libs=""
1672 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1673 [
1674 if test "x$withval" = "xno"
1675 then
1676 with_libmysql="no"
1677 else if test "x$withval" = "xyes"
1678 then
1679 with_libmysql="yes"
1680 else
1681 if test -f "$withval" && test -x "$withval";
1682 then
1683 with_mysql_config="$withval"
1684 else if test -x "$withval/bin/mysql_config"
1685 then
1686 with_mysql_config="$withval/bin/mysql_config"
1687 fi; fi
1688 with_libmysql="yes"
1689 fi; fi
1690 ],
1691 [
1692 with_libmysql="yes"
1693 ])
1694 if test "x$with_libmysql" = "xyes"
1695 then
1696 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1697 mysql_config_status=$?
1699 if test $mysql_config_status -ne 0
1700 then
1701 with_libmysql="no ($with_mysql_config failed)"
1702 else
1703 SAVE_CPPFLAGS="$CPPFLAGS"
1704 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1706 have_mysql_h="no"
1707 have_mysql_mysql_h="no"
1708 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1710 if test "x$have_mysql_h" = "xno"
1711 then
1712 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1713 fi
1715 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1716 then
1717 with_libmysql="no (mysql.h not found)"
1718 fi
1720 CPPFLAGS="$SAVE_CPPFLAGS"
1721 fi
1722 fi
1723 if test "x$with_libmysql" = "xyes"
1724 then
1725 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1726 mysql_config_status=$?
1728 if test $mysql_config_status -ne 0
1729 then
1730 with_libmysql="no ($with_mysql_config failed)"
1731 else
1732 AC_CHECK_LIB(mysqlclient, mysql_init,
1733 [with_libmysql="yes"],
1734 [with_libmysql="no (symbol 'mysql_init' not found)"],
1735 [$with_mysql_libs])
1737 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1738 [with_libmysql="yes"],
1739 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1740 [$with_mysql_libs])
1741 fi
1742 fi
1743 if test "x$with_libmysql" = "xyes"
1744 then
1745 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1746 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1747 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1748 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1749 fi
1750 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1751 # }}}
1753 # --with-libnetlink {{{
1754 with_libnetlink_cflags=""
1755 with_libnetlink_libs="-lnetlink"
1756 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1757 [
1758 echo "libnetlink: withval = $withval"
1759 if test "x$withval" = "xyes"
1760 then
1761 with_libnetlink="yes"
1762 else if test "x$withval" = "xno"
1763 then
1764 with_libnetlink="no"
1765 else
1766 if test -d "$withval/include"
1767 then
1768 with_libnetlink_cflags="-I$withval/include"
1769 with_libnetlink_libs="-L$withval/lib -lnetlink"
1770 with_libnetlink="yes"
1771 else
1772 AC_MSG_ERROR("no such directory: $withval/include")
1773 fi
1774 fi; fi
1775 ],
1776 [
1777 if test "x$ac_system" = "xLinux"
1778 then
1779 with_libnetlink="yes"
1780 else
1781 with_libnetlink="no (Linux only library)"
1782 fi
1783 ])
1784 if test "x$with_libnetlink" = "xyes"
1785 then
1786 SAVE_CFLAGS=$CFLAGS
1787 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1789 with_libnetlink="no (libnetlink.h not found)"
1791 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1792 [
1793 with_libnetlink="yes"
1794 break
1795 ], [],
1796 [#include <stdio.h>
1797 #include <sys/types.h>
1798 #include <asm/types.h>
1799 #include <sys/socket.h>
1800 #include <linux/netlink.h>
1801 #include <linux/rtnetlink.h>])
1802 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1803 [#include <stdio.h>
1804 #include <sys/types.h>
1805 #include <asm/types.h>
1806 #include <sys/socket.h>])
1808 AC_COMPILE_IFELSE(
1809 [#include <stdio.h>
1810 #include <sys/types.h>
1811 #include <asm/types.h>
1812 #include <sys/socket.h>
1813 #include <linux/netlink.h>
1814 #include <linux/rtnetlink.h>
1816 int main (void)
1817 {
1818 int retval = TCA_STATS2;
1819 return (retval);
1820 }],
1821 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1822 []);
1824 AC_COMPILE_IFELSE(
1825 [#include <stdio.h>
1826 #include <sys/types.h>
1827 #include <asm/types.h>
1828 #include <sys/socket.h>
1829 #include <linux/netlink.h>
1830 #include <linux/rtnetlink.h>
1832 int main (void)
1833 {
1834 int retval = TCA_STATS;
1835 return (retval);
1836 }],
1837 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1838 []);
1840 CFLAGS="$SAVE_CFLAGS"
1841 fi
1842 if test "x$with_libnetlink" = "xyes"
1843 then
1844 AC_CHECK_LIB(netlink, rtnl_open,
1845 [with_libnetlink="yes"],
1846 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1847 [$with_libnetlink_libs])
1848 fi
1849 if test "x$with_libnetlink" = "xyes"
1850 then
1851 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1852 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1853 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1854 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1855 fi
1856 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1857 # }}}
1859 # --with-libnetsnmp {{{
1860 with_snmp_config="net-snmp-config"
1861 with_snmp_cflags=""
1862 with_snmp_libs=""
1863 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1864 [
1865 if test "x$withval" = "xno"
1866 then
1867 with_libnetsnmp="no"
1868 else if test "x$withval" = "xyes"
1869 then
1870 with_libnetsnmp="yes"
1871 else
1872 if test -x "$withval"
1873 then
1874 with_snmp_config="$withval"
1875 with_libnetsnmp="yes"
1876 else
1877 with_snmp_config="$withval/bin/net-snmp-config"
1878 with_libnetsnmp="yes"
1879 fi
1880 fi; fi
1881 ],
1882 [with_libnetsnmp="yes"])
1883 if test "x$with_libnetsnmp" = "xyes"
1884 then
1885 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1886 snmp_config_status=$?
1888 if test $snmp_config_status -ne 0
1889 then
1890 with_libnetsnmp="no ($with_snmp_config failed)"
1891 else
1892 SAVE_CPPFLAGS="$CPPFLAGS"
1893 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1895 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1897 CPPFLAGS="$SAVE_CPPFLAGS"
1898 fi
1899 fi
1900 if test "x$with_libnetsnmp" = "xyes"
1901 then
1902 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1903 snmp_config_status=$?
1905 if test $snmp_config_status -ne 0
1906 then
1907 with_libnetsnmp="no ($with_snmp_config failed)"
1908 else
1909 AC_CHECK_LIB(netsnmp, init_snmp,
1910 [with_libnetsnmp="yes"],
1911 [with_libnetsnmp="no (libnetsnmp not found)"],
1912 [$with_snmp_libs])
1913 fi
1914 fi
1915 if test "x$with_libnetsnmp" = "xyes"
1916 then
1917 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1918 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1919 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1920 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1921 fi
1922 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1923 # }}}
1925 # --with-liboconfig {{{
1926 with_own_liboconfig="no"
1927 liboconfig_LDFLAGS="$LDFLAGS"
1928 liboconfig_CPPFLAGS="$CPPFLAGS"
1929 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1930 [
1931 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1932 then
1933 if test -d "$withval/lib"
1934 then
1935 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1936 fi
1937 if test -d "$withval/include"
1938 then
1939 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1940 fi
1941 fi
1942 if test "x$withval" = "xno"
1943 then
1944 AC_MSG_ERROR("liboconfig is required")
1945 fi
1946 ],
1947 [
1948 with_liboconfig="yes"
1949 ])
1951 save_LDFLAGS="$LDFLAGS"
1952 save_CPPFLAGS="$CPPFLAGS"
1953 LDFLAGS="$liboconfig_LDFLAGS"
1954 CPPFLAGS="$liboconfig_CPPFLAGS"
1955 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1956 [
1957 with_liboconfig="yes"
1958 with_own_liboconfig="no"
1959 ],
1960 [
1961 with_liboconfig="yes"
1962 with_own_liboconfig="yes"
1963 LDFLAGS="$save_LDFLAGS"
1964 CPPFLAGS="$save_CPPFLAGS"
1965 ])
1967 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1968 if test "x$with_own_liboconfig" = "xyes"
1969 then
1970 with_liboconfig="yes (shipped version)"
1971 fi
1972 # }}}
1974 # --with-liboping {{{
1975 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1976 [
1977 if test "x$withval" = "xyes"
1978 then
1979 with_liboping="yes"
1980 else if test "x$withval" = "xno"
1981 then
1982 with_liboping="no"
1983 else
1984 with_liboping="yes"
1985 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
1986 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
1987 fi; fi
1988 ],
1989 [with_liboping="yes"])
1991 SAVE_CPPFLAGS="$CPPFLAGS"
1992 SAVE_LDFLAGS="$LDFLAGS"
1994 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
1995 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
1997 if test "x$with_liboping" = "xyes"
1998 then
1999 if test "x$LIBOPING_CPPFLAGS" != "x"
2000 then
2001 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2002 fi
2003 AC_CHECK_HEADERS(oping.h,
2004 [with_liboping="yes"],
2005 [with_liboping="no ('oping.h' not found)"])
2006 fi
2007 if test "x$with_liboping" = "xyes"
2008 then
2009 if test "x$LIBOPING_LDFLAGS" != "x"
2010 then
2011 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2012 fi
2013 AC_CHECK_LIB(oping, ping_construct,
2014 [with_liboping="yes"],
2015 [with_liboping="no (symbol 'ping_construct' not found)"])
2016 fi
2018 CPPFLAGS="$SAVE_CPPFLAGS"
2019 LDFLAGS="$SAVE_LDFLAGS"
2021 if test "x$with_liboping" = "xyes"
2022 then
2023 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2024 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2025 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2026 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2027 fi
2028 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2029 # }}}
2031 # --with-oracle {{{
2032 with_oracle_cppflags=""
2033 with_oracle_libs=""
2034 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2035 [
2036 if test "x$withval" = "xyes"
2037 then
2038 if test "x$ORACLE_HOME" = "x"
2039 then
2040 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2041 fi
2042 with_oracle="yes"
2043 else if test "x$withval" = "xno"
2044 then
2045 with_oracle="no"
2046 else
2047 with_oracle="yes"
2048 ORACLE_HOME="$withval"
2049 fi; fi
2050 ],
2051 [
2052 if test "x$ORACLE_HOME" = "x"
2053 then
2054 with_oracle="no (ORACLE_HOME is not set)"
2055 else
2056 with_oracle="yes"
2057 fi
2058 ])
2059 if test "x$ORACLE_HOME" != "x"
2060 then
2061 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2063 if test -e "$ORACLE_HOME/lib/ldflags"
2064 then
2065 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2066 fi
2067 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2068 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2069 fi
2070 if test "x$with_oracle" = "xyes"
2071 then
2072 SAVE_CPPFLAGS="$CPPFLAGS"
2073 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2075 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2077 CPPFLAGS="$SAVE_CPPFLAGS"
2078 fi
2079 if test "x$with_oracle" = "xyes"
2080 then
2081 SAVE_CPPFLAGS="$CPPFLAGS"
2082 SAVE_LDFLAGS="$LDFLAGS"
2083 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2084 LDFLAGS="$LDFLAGS $with_oracle_libs"
2086 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2088 CPPFLAGS="$SAVE_CPPFLAGS"
2089 LDFLAGS="$SAVE_LDFLAGS"
2090 fi
2091 if test "x$with_oracle" = "xyes"
2092 then
2093 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2094 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2095 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2096 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2097 fi
2098 # }}}
2100 # --with-libowcapi {{{
2101 with_libowcapi_cppflags=""
2102 with_libowcapi_libs="-lowcapi"
2103 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2104 [
2105 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2106 then
2107 with_libowcapi_cppflags="-I$withval/include"
2108 with_libowcapi_libs="-L$withval/lib -lowcapi"
2109 with_libowcapi="yes"
2110 else
2111 with_libowcapi="$withval"
2112 fi
2113 ],
2114 [
2115 with_libowcapi="yes"
2116 ])
2117 if test "x$with_libowcapi" = "xyes"
2118 then
2119 SAVE_CPPFLAGS="$CPPFLAGS"
2120 CPPFLAGS="$with_libowcapi_cppflags"
2122 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2124 CPPFLAGS="$SAVE_CPPFLAGS"
2125 fi
2126 if test "x$with_libowcapi" = "xyes"
2127 then
2128 SAVE_LDFLAGS="$LDFLAGS"
2129 SAVE_CPPFLAGS="$CPPFLAGS"
2130 LDFLAGS="$with_libowcapi_libs"
2131 CPPFLAGS="$with_libowcapi_cppflags"
2133 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2135 LDFLAGS="$SAVE_LDFLAGS"
2136 CPPFLAGS="$SAVE_CPPFLAGS"
2137 fi
2138 if test "x$with_libowcapi" = "xyes"
2139 then
2140 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2141 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2142 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2143 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2144 fi
2145 # }}}
2147 # --with-libpcap {{{
2148 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2149 [
2150 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2151 then
2152 LDFLAGS="$LDFLAGS -L$withval/lib"
2153 CPPFLAGS="$CPPFLAGS -I$withval/include"
2154 with_libpcap="yes"
2155 else
2156 with_libpcap="$withval"
2157 fi
2158 ],
2159 [
2160 with_libpcap="yes"
2161 ])
2162 if test "x$with_libpcap" = "xyes"
2163 then
2164 AC_CHECK_LIB(pcap, pcap_open_live,
2165 [
2166 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2167 ], [with_libpcap="no (libpcap not found)"])
2168 fi
2169 if test "x$with_libpcap" = "xyes"
2170 then
2171 AC_CHECK_HEADERS(pcap.h,
2172 [
2173 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2174 ], [with_libpcap="no (pcap.h not found)"])
2175 fi
2176 if test "x$with_libpcap" = "xyes"
2177 then
2178 collect_libpcap=1
2179 else
2180 collect_libpcap=0
2181 fi
2182 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2183 [Wether or not to use the pcap library])
2184 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2185 # }}}
2187 # --with-libperl {{{
2188 perl_interpreter="perl"
2189 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2190 [
2191 if test -x "$withval"
2192 then
2193 perl_interpreter="$withval"
2194 with_libperl="yes"
2195 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2196 then
2197 LDFLAGS="$LDFLAGS -L$withval/lib"
2198 CPPFLAGS="$CPPFLAGS -I$withval/include"
2199 perl_interpreter="$withval/bin/perl"
2200 with_libperl="yes"
2201 else
2202 with_libperl="$withval"
2203 fi; fi
2204 ],
2205 [
2206 with_libperl="yes"
2207 ])
2209 AC_MSG_CHECKING([for perl])
2210 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2211 if test -x "$perl_interpreter"
2212 then
2213 AC_MSG_RESULT([yes ($perl_interpreter)])
2214 else
2215 perl_interpreter=""
2216 AC_MSG_RESULT([no])
2217 fi
2219 AC_SUBST(PERL, "$perl_interpreter")
2221 if test "x$with_libperl" = "xyes" \
2222 && test -n "$perl_interpreter"
2223 then
2224 SAVE_CFLAGS=$CFLAGS
2225 SAVE_LDFLAGS=$LDFLAGS
2226 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2227 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2228 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2229 CFLAGS="$CFLAGS $PERL_CFLAGS"
2230 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2232 AC_CACHE_CHECK([for libperl],
2233 [c_cv_have_libperl],
2234 AC_LINK_IFELSE(
2235 AC_LANG_PROGRAM(
2236 [[
2237 #define PERL_NO_GET_CONTEXT
2238 #include <EXTERN.h>
2239 #include <perl.h>
2240 #include <XSUB.h>
2241 ]],
2242 [[
2243 dTHX;
2244 load_module (PERL_LOADMOD_NOIMPORT,
2245 newSVpv ("Collectd::Plugin::FooBar", 24),
2246 Nullsv);
2247 ]]),
2248 [c_cv_have_libperl="yes"],
2249 [c_cv_have_libperl="no"]
2250 )
2251 )
2253 if test "x$c_cv_have_libperl" = "xyes"
2254 then
2255 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2256 AC_SUBST(PERL_CFLAGS)
2257 AC_SUBST(PERL_LDFLAGS)
2258 else
2259 with_libperl="no"
2260 fi
2262 CFLAGS=$SAVE_CFLAGS
2263 LDFLAGS=$SAVE_LDFLAGS
2264 else if test -z "$perl_interpreter"; then
2265 with_libperl="no (no perl interpreter found)"
2266 c_cv_have_libperl="no"
2267 fi; fi
2268 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2270 if test "x$with_libperl" = "xyes"
2271 then
2272 SAVE_CFLAGS=$CFLAGS
2273 SAVE_LDFLAGS=$LDFLAGS
2274 CFLAGS="$CFLAGS $PERL_CFLAGS"
2275 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2277 AC_CACHE_CHECK([if perl supports ithreads],
2278 [c_cv_have_perl_ithreads],
2279 AC_LINK_IFELSE(
2280 AC_LANG_PROGRAM(
2281 [[
2282 #include <EXTERN.h>
2283 #include <perl.h>
2284 #include <XSUB.h>
2286 #if !defined(USE_ITHREADS)
2287 # error "Perl does not support ithreads!"
2288 #endif /* !defined(USE_ITHREADS) */
2289 ]],
2290 [[ ]]),
2291 [c_cv_have_perl_ithreads="yes"],
2292 [c_cv_have_perl_ithreads="no"]
2293 )
2294 )
2296 if test "x$c_cv_have_perl_ithreads" = "xyes"
2297 then
2298 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2299 fi
2301 CFLAGS=$SAVE_CFLAGS
2302 LDFLAGS=$SAVE_LDFLAGS
2303 fi
2305 if test "x$with_libperl" = "xyes"
2306 then
2307 SAVE_CFLAGS=$CFLAGS
2308 SAVE_LDFLAGS=$LDFLAGS
2309 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2310 # (see issues #41 and #42)
2311 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2312 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2314 AC_CACHE_CHECK([for broken Perl_load_module()],
2315 [c_cv_have_broken_perl_load_module],
2316 AC_LINK_IFELSE(
2317 AC_LANG_PROGRAM(
2318 [[
2319 #define PERL_NO_GET_CONTEXT
2320 #include <EXTERN.h>
2321 #include <perl.h>
2322 #include <XSUB.h>
2323 ]],
2324 [[
2325 dTHX;
2326 load_module (PERL_LOADMOD_NOIMPORT,
2327 newSVpv ("Collectd::Plugin::FooBar", 24),
2328 Nullsv);
2329 ]]),
2330 [c_cv_have_broken_perl_load_module="no"],
2331 [c_cv_have_broken_perl_load_module="yes"]
2332 )
2333 )
2335 CFLAGS=$SAVE_CFLAGS
2336 LDFLAGS=$SAVE_LDFLAGS
2337 fi
2338 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2339 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2341 if test "x$with_libperl" = "xyes"
2342 then
2343 SAVE_CFLAGS=$CFLAGS
2344 SAVE_LDFLAGS=$LDFLAGS
2345 CFLAGS="$CFLAGS $PERL_CFLAGS"
2346 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2348 AC_CHECK_MEMBER(
2349 [struct mgvtbl.svt_local],
2350 [have_struct_mgvtbl_svt_local="yes"],
2351 [have_struct_mgvtbl_svt_local="no"],
2352 [
2353 #include <EXTERN.h>
2354 #include <perl.h>
2355 #include <XSUB.h>
2356 ])
2358 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2359 then
2360 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2361 [Define if Perl's struct mgvtbl has member svt_local.])
2362 fi
2364 CFLAGS=$SAVE_CFLAGS
2365 LDFLAGS=$SAVE_LDFLAGS
2366 fi
2367 # }}}
2369 # --with-libpq {{{
2370 with_pg_config="pg_config"
2371 with_libpq_includedir=""
2372 with_libpq_libdir=""
2373 with_libpq_cppflags=""
2374 with_libpq_ldflags=""
2375 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2376 [Path to libpq.])],
2377 [
2378 if test "x$withval" = "xno"
2379 then
2380 with_libpq="no"
2381 else if test "x$withval" = "xyes"
2382 then
2383 with_libpq="yes"
2384 else
2385 if test -f "$withval" && test -x "$withval";
2386 then
2387 with_pg_config="$withval"
2388 else if test -x "$withval/bin/pg_config"
2389 then
2390 with_pg_config="$withval/bin/pg_config"
2391 fi; fi
2392 with_libpq="yes"
2393 fi; fi
2394 ],
2395 [
2396 with_libpq="yes"
2397 ])
2398 if test "x$with_libpq" = "xyes"
2399 then
2400 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2401 pg_config_status=$?
2403 if test $pg_config_status -eq 0
2404 then
2405 if test -n "$with_libpq_includedir"; then
2406 for dir in $with_libpq_includedir; do
2407 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2408 done
2409 fi
2410 else
2411 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2412 fi
2414 SAVE_CPPFLAGS="$CPPFLAGS"
2415 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2417 AC_CHECK_HEADERS(libpq-fe.h, [],
2418 [with_libpq="no (libpq-fe.h not found)"], [])
2420 CPPFLAGS="$SAVE_CPPFLAGS"
2421 fi
2422 if test "x$with_libpq" = "xyes"
2423 then
2424 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2425 pg_config_status=$?
2427 if test $pg_config_status -eq 0
2428 then
2429 if test -n "$with_libpq_libdir"; then
2430 for dir in $with_libpq_libdir; do
2431 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2432 done
2433 fi
2434 else
2435 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2436 fi
2438 SAVE_LDFLAGS="$LDFLAGS"
2439 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2441 AC_CHECK_LIB(pq, PQconnectdb,
2442 [with_libpq="yes"],
2443 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2445 AC_CHECK_LIB(pq, PQserverVersion,
2446 [with_libpq="yes"],
2447 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2449 LDFLAGS="$SAVE_LDFLAGS"
2450 fi
2451 if test "x$with_libpq" = "xyes"
2452 then
2453 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2454 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2455 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2456 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2457 fi
2458 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2459 # }}}
2461 # --with-libpthread {{{
2462 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2463 [ if test "x$withval" != "xno" \
2464 && test "x$withval" != "xyes"
2465 then
2466 LDFLAGS="$LDFLAGS -L$withval/lib"
2467 CPPFLAGS="$CPPFLAGS -I$withval/include"
2468 with_libpthread="yes"
2469 else
2470 if test "x$withval" = "xno"
2471 then
2472 with_libpthread="no (disabled)"
2473 fi
2474 fi
2475 ], [with_libpthread="yes"])
2476 if test "x$with_libpthread" = "xyes"
2477 then
2478 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2479 fi
2481 if test "x$with_libpthread" = "xyes"
2482 then
2483 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2484 fi
2485 if test "x$with_libpthread" = "xyes"
2486 then
2487 collect_pthread=1
2488 else
2489 collect_pthread=0
2490 fi
2491 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2492 [Wether or not to use pthread (POSIX threads) library])
2493 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2494 # }}}
2496 # --with-librrd {{{
2497 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2498 librrd_cflags=""
2499 librrd_ldflags=""
2500 librrd_threadsafe="yes"
2501 librrd_rrdc_update="no"
2502 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2503 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2504 then
2505 librrd_cflags="-I$withval/include"
2506 librrd_ldflags="-L$withval/lib"
2507 with_librrd="yes"
2508 else
2509 with_librrd="$withval"
2510 fi
2511 ], [with_librrd="yes"])
2512 if test "x$with_librrd" = "xyes"
2513 then
2514 SAVE_CPPFLAGS="$CPPFLAGS"
2515 SAVE_LDFLAGS="$LDFLAGS"
2517 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2518 LDFLAGS="$LDFLAGS $librrd_ldflags"
2520 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2522 CPPFLAGS="$SAVE_CPPFLAGS"
2523 LDFLAGS="$SAVE_LDFLAGS"
2524 fi
2525 if test "x$with_librrd" = "xyes"
2526 then
2527 SAVE_CPPFLAGS="$CPPFLAGS"
2528 SAVE_LDFLAGS="$LDFLAGS"
2530 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2531 LDFLAGS="$LDFLAGS $librrd_ldflags"
2533 AC_CHECK_LIB(rrd_th, rrd_update_r,
2534 [with_librrd="yes"
2535 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2536 ],
2537 [librrd_threadsafe="no"
2538 AC_CHECK_LIB(rrd, rrd_update,
2539 [with_librrd="yes"
2540 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2541 ],
2542 [with_librrd="no (symbol 'rrd_update' not found)"],
2543 [-lm])
2544 ],
2545 [-lm])
2547 if test "x$librrd_threadsafe" = "xyes"
2548 then
2549 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2550 else
2551 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2552 fi
2554 CPPFLAGS="$SAVE_CPPFLAGS"
2555 LDFLAGS="$SAVE_LDFLAGS"
2556 fi
2557 if test "x$with_librrd" = "xyes"
2558 then
2559 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2560 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2561 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2562 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2563 fi
2564 if test "x$librrd_threadsafe" = "xyes"
2565 then
2566 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2567 fi
2568 # }}}
2570 # --with-libsensors {{{
2571 with_sensors_cflags=""
2572 with_sensors_ldflags=""
2573 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2574 [
2575 if test "x$withval" = "xno"
2576 then
2577 with_libsensors="no"
2578 else
2579 with_libsensors="yes"
2580 if test "x$withval" != "xyes"
2581 then
2582 with_sensors_cflags="-I$withval/include"
2583 with_sensors_ldflags="-L$withval/lib"
2584 with_libsensors="yes"
2585 fi
2586 fi
2587 ],
2588 [
2589 if test "x$ac_system" = "xLinux"
2590 then
2591 with_libsensors="yes"
2592 else
2593 with_libsensors="no (Linux only library)"
2594 fi
2595 ])
2596 if test "x$with_libsensors" = "xyes"
2597 then
2598 SAVE_CPPFLAGS="$CPPFLAGS"
2599 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2601 # AC_CHECK_HEADERS(sensors/sensors.h,
2602 # [
2603 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2604 # ],
2605 # [with_libsensors="no (sensors/sensors.h not found)"])
2606 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2608 CPPFLAGS="$SAVE_CPPFLAGS"
2609 fi
2610 if test "x$with_libsensors" = "xyes"
2611 then
2612 SAVE_CPPFLAGS="$CPPFLAGS"
2613 SAVE_LDFLAGS="$LDFLAGS"
2614 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2615 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2617 AC_CHECK_LIB(sensors, sensors_init,
2618 [
2619 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2620 ],
2621 [with_libsensors="no (libsensors not found)"])
2623 CPPFLAGS="$SAVE_CPPFLAGS"
2624 LDFLAGS="$SAVE_LDFLAGS"
2625 fi
2626 if test "x$with_libsensors" = "xyes"
2627 then
2628 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2629 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2630 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2631 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2632 fi
2633 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2634 # }}}
2636 # --with-libstatgrab {{{
2637 with_libstatgrab_cflags=""
2638 with_libstatgrab_ldflags=""
2639 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2640 [
2641 if test "x$withval" != "xno" \
2642 && test "x$withval" != "xyes"
2643 then
2644 with_libstatgrab_cflags="-I$withval/include"
2645 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2646 with_libstatgrab="yes"
2647 with_libstatgrab_pkg_config="no"
2648 else
2649 with_libstatgrab="$withval"
2650 with_libstatgrab_pkg_config="yes"
2651 fi
2652 ],
2653 [
2654 with_libstatgrab="yes"
2655 with_libstatgrab_pkg_config="yes"
2656 ])
2658 if test "x$with_libstatgrab" = "xyes" \
2659 && test "x$with_libstatgrab_pkg_config" = "xyes"
2660 then
2661 if test "x$PKG_CONFIG" != "x"
2662 then
2663 AC_MSG_CHECKING([pkg-config for libstatgrab])
2664 temp_result="found"
2665 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2666 if test "$?" != "0"
2667 then
2668 with_libstatgrab_pkg_config="no"
2669 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2670 temp_result="not found"
2671 fi
2672 AC_MSG_RESULT([$temp_result])
2673 else
2674 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2675 with_libstatgrab_pkg_config="no"
2676 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2677 fi
2678 fi
2680 if test "x$with_libstatgrab" = "xyes" \
2681 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2682 && test "x$with_libstatgrab_cflags" = "x"
2683 then
2684 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2685 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2686 if test "$?" = "0"
2687 then
2688 with_libstatgrab_cflags="$temp_result"
2689 else
2690 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2691 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2692 fi
2693 AC_MSG_RESULT([$temp_result])
2694 fi
2696 if test "x$with_libstatgrab" = "xyes" \
2697 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2698 && test "x$with_libstatgrab_ldflags" = "x"
2699 then
2700 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2701 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2702 if test "$?" = "0"
2703 then
2704 with_libstatgrab_ldflags="$temp_result"
2705 else
2706 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2707 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2708 fi
2709 AC_MSG_RESULT([$temp_result])
2710 fi
2712 if test "x$with_libstatgrab" = "xyes"
2713 then
2714 SAVE_CPPFLAGS="$CPPFLAGS"
2715 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2717 AC_CHECK_HEADERS(statgrab.h,
2718 [with_libstatgrab="yes"],
2719 [with_libstatgrab="no (statgrab.h not found)"])
2721 CPPFLAGS="$SAVE_CPPFLAGS"
2722 fi
2724 if test "x$with_libstatgrab" = "xyes"
2725 then
2726 SAVE_CFLAGS="$CFLAGS"
2727 SAVE_LDFLAGS="$LDFLAGS"
2729 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2730 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2732 AC_CHECK_LIB(statgrab, sg_init,
2733 [with_libstatgrab="yes"],
2734 [with_libstatgrab="no (symbol sg_init not found)"])
2736 CFLAGS="$SAVE_CFLAGS"
2737 LDFLAGS="$SAVE_LDFLAGS"
2738 fi
2740 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2741 if test "x$with_libstatgrab" = "xyes"
2742 then
2743 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2744 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2745 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2746 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2747 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2748 fi
2749 # }}}
2751 # --with-libupsclient {{{
2752 with_libupsclient_config=""
2753 with_libupsclient_cflags=""
2754 with_libupsclient_libs=""
2755 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2756 [
2757 if test "x$withval" = "xno"
2758 then
2759 with_libupsclient="no"
2760 else if test "x$withval" = "xyes"
2761 then
2762 with_libupsclient="use_pkgconfig"
2763 else
2764 if test -x "$withval"
2765 then
2766 with_libupsclient_config="$withval"
2767 with_libupsclient="use_libupsclient_config"
2768 else if test -x "$withval/bin/libupsclient-config"
2769 then
2770 with_libupsclient_config="$withval/bin/net-snmp-config"
2771 with_libupsclient="use_libupsclient_config"
2772 else
2773 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2774 with_libupsclient_cflags="-I$withval/include"
2775 with_libupsclient_libs="-L$withval/lib -lupsclient"
2776 with_libupsclient="yes"
2777 fi; fi
2778 fi; fi
2779 ],
2780 [with_libupsclient="use_pkgconfig"])
2782 # configure using libupsclient-config
2783 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2784 then
2785 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2786 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2787 if test $? -ne 0
2788 then
2789 with_libupsclient="no ($with_libupsclient_config failed)"
2790 fi
2791 with_libupsclient_libs="`$with_libupsclient_config --libs`"
2792 if test $? -ne 0
2793 then
2794 with_libupsclient="no ($with_libupsclient_config failed)"
2795 fi
2796 fi
2797 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2798 then
2799 with_libupsclient="yes"
2800 fi
2802 # configure using pkg-config
2803 if test "x$with_libupsclient" = "xuse_pkgconfig"
2804 then
2805 if test "x$PKG_CONFIG" = "x"
2806 then
2807 with_libupsclient="no (Don't have pkg-config)"
2808 fi
2809 fi
2810 if test "x$with_libupsclient" = "xuse_pkgconfig"
2811 then
2812 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2813 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2814 if test $? -ne 0
2815 then
2816 with_libupsclient="no (pkg-config doesn't know library)"
2817 fi
2818 fi
2819 if test "x$with_libupsclient" = "xuse_pkgconfig"
2820 then
2821 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2822 if test $? -ne 0
2823 then
2824 with_libupsclient="no ($PKG_CONFIG failed)"
2825 fi
2826 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2827 if test $? -ne 0
2828 then
2829 with_libupsclient="no ($PKG_CONFIG failed)"
2830 fi
2831 fi
2832 if test "x$with_libupsclient" = "xuse_pkgconfig"
2833 then
2834 with_libupsclient="yes"
2835 fi
2837 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2838 # the actual checks.
2839 if test "x$with_libupsclient" = "xyes"
2840 then
2841 SAVE_CPPFLAGS="$CPPFLAGS"
2842 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2844 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2846 CPPFLAGS="$SAVE_CPPFLAGS"
2847 fi
2848 if test "x$with_libupsclient" = "xyes"
2849 then
2850 SAVE_CPPFLAGS="$CPPFLAGS"
2851 SAVE_LDFLAGS="$LDFLAGS"
2853 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2854 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2856 AC_CHECK_LIB(upsclient, upscli_connect,
2857 [with_libupsclient="yes"],
2858 [with_libupsclient="no (symbol upscli_connect not found)"])
2860 CPPFLAGS="$SAVE_CPPFLAGS"
2861 LDFLAGS="$SAVE_LDFLAGS"
2862 fi
2863 if test "x$with_libupsclient" = "xyes"
2864 then
2865 SAVE_CPPFLAGS="$CPPFLAGS"
2866 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2868 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2869 [#include <stdlib.h>
2870 #include <stdio.h>
2871 #include <upsclient.h>])
2873 CPPFLAGS="$SAVE_CPPFLAGS"
2874 fi
2875 if test "x$with_libupsclient" = "xyes"
2876 then
2877 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2878 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2879 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2880 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2881 fi
2882 # }}}
2884 # --with-libxmms {{{
2885 with_xmms_config="xmms-config"
2886 with_xmms_cflags=""
2887 with_xmms_libs=""
2888 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2889 [
2890 if test "x$withval" != "xno" \
2891 && test "x$withval" != "xyes"
2892 then
2893 if test -f "$withval" && test -x "$withval";
2894 then
2895 with_xmms_config="$withval"
2896 else if test -x "$withval/bin/xmms-config"
2897 then
2898 with_xmms_config="$withval/bin/xmms-config"
2899 fi; fi
2900 with_libxmms="yes"
2901 else if test "x$withval" = "xno"
2902 then
2903 with_libxmms="no"
2904 else
2905 with_libxmms="yes"
2906 fi; fi
2907 ],
2908 [
2909 with_libxmms="yes"
2910 ])
2911 if test "x$with_libxmms" = "xyes"
2912 then
2913 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2914 xmms_config_status=$?
2916 if test $xmms_config_status -ne 0
2917 then
2918 with_libxmms="no"
2919 fi
2920 fi
2921 if test "x$with_libxmms" = "xyes"
2922 then
2923 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2924 xmms_config_status=$?
2926 if test $xmms_config_status -ne 0
2927 then
2928 with_libxmms="no"
2929 fi
2930 fi
2931 if test "x$with_libxmms" = "xyes"
2932 then
2933 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2934 [
2935 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2936 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2937 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2938 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2939 ],
2940 [
2941 with_libxmms="no"
2942 ],
2943 [$with_xmms_libs])
2944 fi
2945 with_libxmms_numeric=0
2946 if test "x$with_libxmms" = "xyes"
2947 then
2948 with_libxmms_numeric=1
2949 fi
2950 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2951 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2952 # }}}
2954 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2955 with_libxml2="no (pkg-config isn't available)"
2956 with_libxml2_cflags=""
2957 with_libxml2_ldflags=""
2958 with_libvirt="no (pkg-config isn't available)"
2959 with_libvirt_cflags=""
2960 with_libvirt_ldflags=""
2961 if test "x$PKG_CONFIG" != "x"
2962 then
2963 pkg-config --exists 'libxml-2.0' 2>/dev/null
2964 if test "$?" = "0"
2965 then
2966 with_libxml2="yes"
2967 else
2968 with_libxml2="no (pkg-config doesn't know library)"
2969 fi
2971 pkg-config --exists libvirt 2>/dev/null
2972 if test "$?" = "0"
2973 then
2974 with_libvirt="yes"
2975 else
2976 with_libvirt="no (pkg-config doesn't know library)"
2977 fi
2978 fi
2979 if test "x$with_libxml2" = "xyes"
2980 then
2981 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2982 if test $? -ne 0
2983 then
2984 with_libxml2="no"
2985 fi
2986 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2987 if test $? -ne 0
2988 then
2989 with_libxml2="no"
2990 fi
2991 fi
2992 if test "x$with_libxml2" = "xyes"
2993 then
2994 SAVE_CPPFLAGS="$CPPFLAGS"
2995 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2997 AC_CHECK_HEADERS(libxml/parser.h, [],
2998 [with_libxml2="no (libxml/parser.h not found)"])
3000 CPPFLAGS="$SAVE_CPPFLAGS"
3001 fi
3002 if test "x$with_libxml2" = "xyes"
3003 then
3004 SAVE_CFLAGS="$CFLAGS"
3005 SAVE_LDFLAGS="$LDFLAGS"
3007 CFLAGS="$CFLAGS $with_libxml2_cflags"
3008 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3010 AC_CHECK_LIB(xml2, xmlXPathEval,
3011 [with_libxml2="yes"],
3012 [with_libxml2="no (symbol xmlXPathEval not found)"])
3014 CFLAGS="$SAVE_CFLAGS"
3015 LDFLAGS="$SAVE_LDFLAGS"
3016 fi
3017 dnl Add the right compiler flags and libraries.
3018 if test "x$with_libxml2" = "xyes"; then
3019 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3020 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3021 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3022 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3023 fi
3024 if test "x$with_libvirt" = "xyes"
3025 then
3026 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3027 if test $? -ne 0
3028 then
3029 with_libvirt="no"
3030 fi
3031 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3032 if test $? -ne 0
3033 then
3034 with_libvirt="no"
3035 fi
3036 fi
3037 if test "x$with_libvirt" = "xyes"
3038 then
3039 SAVE_CPPFLAGS="$CPPFLAGS"
3040 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3042 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3043 [with_libvirt="no (libvirt/libvirt.h not found)"])
3045 CPPFLAGS="$SAVE_CPPFLAGS"
3046 fi
3047 if test "x$with_libvirt" = "xyes"
3048 then
3049 SAVE_CFLAGS="$CFLAGS"
3050 SAVE_LDFLAGS="$LDFLAGS"
3052 CFLAGS="$CFLAGS $with_libvirt_cflags"
3053 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3055 AC_CHECK_LIB(virt, virDomainBlockStats,
3056 [with_libvirt="yes"],
3057 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3059 CFLAGS="$SAVE_CFLAGS"
3060 LDFLAGS="$SAVE_LDFLAGS"
3061 fi
3062 dnl Add the right compiler flags and libraries.
3063 if test "x$with_libvirt" = "xyes"; then
3064 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3065 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3066 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3067 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3068 fi
3069 # }}}
3071 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3072 with_libopenipmipthread="yes"
3073 with_libopenipmipthread_cflags=""
3074 with_libopenipmipthread_libs=""
3076 AC_MSG_CHECKING([for pkg-config])
3077 temp_result="no"
3078 if test "x$PKG_CONFIG" = "x"
3079 then
3080 with_libopenipmipthread="no"
3081 temp_result="no"
3082 else
3083 temp_result="$PKG_CONFIG"
3084 fi
3085 AC_MSG_RESULT([$temp_result])
3087 if test "x$with_libopenipmipthread" = "xyes"
3088 then
3089 AC_MSG_CHECKING([for libOpenIPMIpthread])
3090 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3091 if test "$?" != "0"
3092 then
3093 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3094 fi
3095 AC_MSG_RESULT([$with_libopenipmipthread])
3096 fi
3098 if test "x$with_libopenipmipthread" = "xyes"
3099 then
3100 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3101 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3102 if test "$?" = "0"
3103 then
3104 with_libopenipmipthread_cflags="$temp_result"
3105 else
3106 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3107 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3108 fi
3109 AC_MSG_RESULT([$temp_result])
3110 fi
3112 if test "x$with_libopenipmipthread" = "xyes"
3113 then
3114 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3115 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3116 if test "$?" = "0"
3117 then
3118 with_libopenipmipthread_ldflags="$temp_result"
3119 else
3120 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3121 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3122 fi
3123 AC_MSG_RESULT([$temp_result])
3124 fi
3126 if test "x$with_libopenipmipthread" = "xyes"
3127 then
3128 SAVE_CPPFLAGS="$CPPFLAGS"
3129 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3131 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3132 [with_libopenipmipthread="yes"],
3133 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3134 [#include <OpenIPMI/ipmiif.h>
3135 #include <OpenIPMI/ipmi_err.h>
3136 #include <OpenIPMI/ipmi_posix.h>
3137 #include <OpenIPMI/ipmi_conn.h>
3138 ])
3140 CPPFLAGS="$SAVE_CPPFLAGS"
3141 fi
3143 if test "x$with_libopenipmipthread" = "xyes"
3144 then
3145 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3146 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3147 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3148 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3149 fi
3150 # }}}
3152 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3153 [with_libnotify="yes"],
3154 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3156 # Check for enabled/disabled features
3157 #
3159 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3160 # ------------------------------------------------------------
3161 dnl
3162 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3163 dnl
3164 AC_DEFUN(
3165 [AC_COLLECTD],
3166 [
3167 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3168 m4_if(
3169 [$2],
3170 [enable],
3171 [dnl
3172 m4_define([EnDis],[disabled])dnl
3173 m4_define([YesNo],[no])dnl
3174 ],dnl
3175 [m4_if(
3176 [$2],
3177 [disable],
3178 [dnl
3179 m4_define([EnDis],[enabled])dnl
3180 m4_define([YesNo],[yes])dnl
3181 ],
3182 [dnl
3183 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3184 ]dnl
3185 )]dnl
3186 )dnl
3187 m4_if([$3], [feature], [],
3188 [m4_if(
3189 [$3], [module], [],
3190 [dnl
3191 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3192 ]dnl
3193 )]dnl
3194 )dnl
3195 AC_ARG_ENABLE(
3196 [$1],
3197 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3198 [],
3199 enable_$1='[YesNo]'dnl
3200 )# AC_ARG_ENABLE
3201 if test "x$enable_$1" = "xno"
3202 then
3203 collectd_$1=0
3204 else
3205 if test "x$enable_$1" = "xyes"
3206 then
3207 collectd_$1=1
3208 else
3209 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3210 collectd_$1=1
3211 enable_$1='yes'
3212 fi
3213 fi
3214 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3215 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3216 ]dnl
3217 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3219 # AC_PLUGIN(name, default, info)
3220 # ------------------------------------------------------------
3221 dnl
3222 AC_DEFUN(
3223 [AC_PLUGIN],
3224 [
3225 enable_plugin="no"
3226 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3227 [
3228 if test "x$enableval" = "xyes"
3229 then
3230 enable_plugin="yes"
3231 else
3232 enable_plugin="no"
3233 fi
3234 ],
3235 [
3236 if test "x$2" = "xyes"
3237 then
3238 enable_plugin="yes"
3239 else
3240 enable_plugin="no"
3241 fi
3242 ])
3243 if test "x$enable_plugin" = "xyes"
3244 then
3245 if test "x$2" = "xyes"
3246 then
3247 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3248 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3249 dependency_error="yes"
3250 enable_plugin="no (dependency error)"
3251 fi
3252 fi
3253 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3254 enable_$1="$enable_plugin"
3255 ]
3256 )# AC_PLUGIN(name, default, info)
3258 m4_divert_once([HELP_ENABLE], [
3259 collectd features:])
3260 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3261 AC_COLLECTD([debug], [enable], [feature], [debugging])
3262 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3263 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3265 dependency_error="no"
3266 plugin_ascent="no"
3267 plugin_battery="no"
3268 plugin_bind="no"
3269 plugin_conntrack="no"
3270 plugin_cpu="no"
3271 plugin_cpufreq="no"
3272 plugin_df="no"
3273 plugin_disk="no"
3274 plugin_entropy="no"
3275 plugin_interface="no"
3276 plugin_ipmi="no"
3277 plugin_ipvs="no"
3278 plugin_irq="no"
3279 plugin_libvirt="no"
3280 plugin_load="no"
3281 plugin_memory="no"
3282 plugin_multimeter="no"
3283 plugin_nfs="no"
3284 plugin_fscache="no"
3285 plugin_perl="no"
3286 plugin_processes="no"
3287 plugin_protocols="no"
3288 plugin_serial="no"
3289 plugin_swap="no"
3290 plugin_tape="no"
3291 plugin_tcpconns="no"
3292 plugin_ted="no"
3293 plugin_thermal="no"
3294 plugin_users="no"
3295 plugin_uptime="no"
3296 plugin_vmem="no"
3297 plugin_vserver="no"
3298 plugin_wireless="no"
3300 # Linux
3301 if test "x$ac_system" = "xLinux"
3302 then
3303 plugin_battery="yes"
3304 plugin_conntrack="yes"
3305 plugin_cpu="yes"
3306 plugin_cpufreq="yes"
3307 plugin_disk="yes"
3308 plugin_entropy="yes"
3309 plugin_interface="yes"
3310 plugin_irq="yes"
3311 plugin_load="yes"
3312 plugin_memory="yes"
3313 plugin_nfs="yes"
3314 plugin_fscache="yes"
3315 plugin_processes="yes"
3316 plugin_protocols="yes"
3317 plugin_serial="yes"
3318 plugin_swap="yes"
3319 plugin_tcpconns="yes"
3320 plugin_thermal="yes"
3321 plugin_uptime="yes"
3322 plugin_vmem="yes"
3323 plugin_vserver="yes"
3324 plugin_wireless="yes"
3326 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3327 then
3328 plugin_ipvs="yes"
3329 fi
3330 fi
3332 if test "x$ac_system" = "xOpenBSD"
3333 then
3334 plugin_tcpconns="yes"
3335 fi
3337 # Mac OS X devices
3338 if test "x$with_libiokit" = "xyes"
3339 then
3340 plugin_battery="yes"
3341 plugin_disk="yes"
3342 fi
3344 # Solaris
3345 if test "x$with_kstat" = "xyes"
3346 then
3347 plugin_uptime="yes"
3348 fi
3350 if test "x$with_devinfo$with_kstat" = "xyesyes"
3351 then
3352 plugin_cpu="yes"
3353 plugin_disk="yes"
3354 plugin_interface="yes"
3355 plugin_memory="yes"
3356 plugin_tape="yes"
3357 fi
3359 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3360 then
3361 plugin_swap="yes"
3362 fi
3364 # libstatgrab
3365 if test "x$with_libstatgrab" = "xyes"
3366 then
3367 plugin_cpu="yes"
3368 plugin_disk="yes"
3369 plugin_interface="yes"
3370 plugin_load="yes"
3371 plugin_memory="yes"
3372 plugin_swap="yes"
3373 plugin_users="yes"
3374 fi
3376 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3377 then
3378 plugin_ascent="yes"
3379 plugin_bind="yes"
3380 fi
3382 if test "x$with_libopenipmipthread" = "xyes"
3383 then
3384 plugin_ipmi="yes"
3385 fi
3387 if test "x$have_processor_info" = "xyes"
3388 then
3389 plugin_cpu="yes"
3390 fi
3391 if test "x$have_sysctl" = "xyes"
3392 then
3393 plugin_cpu="yes"
3394 plugin_memory="yes"
3395 plugin_swap="yes"
3396 plugin_uptime="yes"
3397 fi
3398 if test "x$have_sysctlbyname" = "xyes"
3399 then
3400 plugin_cpu="yes"
3401 plugin_memory="yes"
3402 plugin_tcpconns="yes"
3403 fi
3405 # Df plugin: Check if we know how to determine mount points first.
3406 #if test "x$have_listmntent" = "xyes"; then
3407 # plugin_df="yes"
3408 #fi
3409 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3410 then
3411 plugin_df="yes"
3412 fi
3413 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3414 then
3415 plugin_df="yes"
3416 fi
3417 #if test "x$have_getmntent" = "xseq"
3418 #then
3419 # plugin_df="yes"
3420 #fi
3421 if test "x$c_cv_have_one_getmntent" = "xyes"
3422 then
3423 plugin_df="yes"
3424 fi
3426 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3427 if test "x$plugin_df" = "xyes"
3428 then
3429 plugin_df="no"
3430 if test "x$have_statfs" = "xyes"
3431 then
3432 plugin_df="yes"
3433 fi
3434 if test "x$have_statvfs" = "xyes"
3435 then
3436 plugin_df="yes"
3437 fi
3438 fi
3440 if test "x$have_getifaddrs" = "xyes"
3441 then
3442 plugin_interface="yes"
3443 fi
3445 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3446 then
3447 plugin_libvirt="yes"
3448 fi
3450 if test "x$have_getloadavg" = "xyes"
3451 then
3452 plugin_load="yes"
3453 fi
3455 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3456 then
3457 plugin_perl="yes"
3458 fi
3460 # Mac OS X memory interface
3461 if test "x$have_host_statistics" = "xyes"
3462 then
3463 plugin_memory="yes"
3464 fi
3466 if test "x$have_termios_h" = "xyes"
3467 then
3468 plugin_multimeter="yes"
3469 plugin_ted="yes"
3470 fi
3472 if test "x$have_thread_info" = "xyes"
3473 then
3474 plugin_processes="yes"
3475 fi
3477 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3478 then
3479 plugin_processes="yes"
3480 fi
3482 if test "x$with_kvm_getswapinfo" = "xyes"
3483 then
3484 plugin_swap="yes"
3485 fi
3487 if test "x$have_swapctl" = "xyes"
3488 then
3489 plugin_swap="yes"
3490 fi
3492 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3493 then
3494 plugin_tcpconns="yes"
3495 fi
3497 if test "x$have_getutent" = "xyes"
3498 then
3499 plugin_users="yes"
3500 fi
3501 if test "x$have_getutxent" = "xyes"
3502 then
3503 plugin_users="yes"
3504 fi
3506 m4_divert_once([HELP_ENABLE], [
3507 collectd plugins:])
3509 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
3510 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
3511 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
3512 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
3513 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
3514 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
3515 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
3516 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
3517 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
3518 AC_PLUGIN([csv], [yes], [CSV output plugin])
3519 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
3520 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
3521 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
3522 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
3523 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
3524 AC_PLUGIN([email], [yes], [EMail statistics])
3525 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
3526 AC_PLUGIN([exec], [yes], [Execution of external programs])
3527 AC_PLUGIN([filecount], [yes], [Count files in directories])
3528 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
3529 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
3530 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
3531 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
3532 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
3533 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
3534 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3535 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
3536 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
3537 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
3538 AC_PLUGIN([load], [$plugin_load], [System load])
3539 AC_PLUGIN([logfile], [yes], [File logging plugin])
3540 AC_PLUGIN([match_regex], [yes], [The regex match])
3541 AC_PLUGIN([match_timediff], [yes], [The timediff match])
3542 AC_PLUGIN([match_value], [yes], [The value match])
3543 AC_PLUGIN([mbmon], [yes], [Query mbmond])
3544 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
3545 AC_PLUGIN([memcached], [yes], [memcached statistics])
3546 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
3547 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
3548 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
3549 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3550 AC_PLUGIN([network], [yes], [Network communication plugin])
3551 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
3552 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3553 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3554 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
3555 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
3556 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3557 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
3558 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
3559 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
3560 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
3561 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
3562 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
3563 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
3564 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
3565 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
3566 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
3567 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
3568 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
3569 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
3570 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
3571 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
3572 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
3573 AC_PLUGIN([table], [yes], [Parsing of tabular data])
3574 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3575 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3576 AC_PLUGIN([target_notification], [yes], [The notification target])
3577 AC_PLUGIN([target_replace], [yes], [The replace target])
3578 AC_PLUGIN([target_set], [yes], [The set target])
3579 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3580 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3581 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
3582 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3583 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3584 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
3585 AC_PLUGIN([users], [$plugin_users], [User statistics])
3586 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3587 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3588 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3589 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3590 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3592 dnl Default configuration file
3593 # Load either syslog or logfile
3594 LOAD_PLUGIN_SYSLOG=""
3595 LOAD_PLUGIN_LOGFILE=""
3597 AC_MSG_CHECKING([which default log plugin to load])
3598 default_log_plugin="none"
3599 if test "x$enable_syslog" = "xyes"
3600 then
3601 default_log_plugin="syslog"
3602 else
3603 LOAD_PLUGIN_SYSLOG="##"
3604 fi
3606 if test "x$enable_logfile" = "xyes"
3607 then
3608 if test "x$default_log_plugin" = "xnone"
3609 then
3610 default_log_plugin="logfile"
3611 else
3612 LOAD_PLUGIN_LOGFILE="#"
3613 fi
3614 else
3615 LOAD_PLUGIN_LOGFILE="##"
3616 fi
3617 AC_MSG_RESULT([$default_log_plugin])
3619 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3620 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3622 DEFAULT_LOG_LEVEL="info"
3623 if test "x$enable_debug" = "xyes"
3624 then
3625 DEFAULT_LOG_LEVEL="debug"
3626 fi
3627 AC_SUBST(DEFAULT_LOG_LEVEL)
3629 # Load only one of rrdtool, network, csv in the default config.
3630 LOAD_PLUGIN_RRDTOOL=""
3631 LOAD_PLUGIN_NETWORK=""
3632 LOAD_PLUGIN_CSV=""
3634 AC_MSG_CHECKING([which default write plugin to load])
3635 default_write_plugin="none"
3636 if test "x$enable_rrdtool" = "xyes"
3637 then
3638 default_write_plugin="rrdtool"
3639 else
3640 LOAD_PLUGIN_RRDTOOL="##"
3641 fi
3643 if test "x$enable_network" = "xyes"
3644 then
3645 if test "x$default_write_plugin" = "xnone"
3646 then
3647 default_write_plugin="network"
3648 else
3649 LOAD_PLUGIN_NETWORK="#"
3650 fi
3651 else
3652 LOAD_PLUGIN_NETWORK="##"
3653 fi
3655 if test "x$enable_csv" = "xyes"
3656 then
3657 if test "x$default_write_plugin" = "xnone"
3658 then
3659 default_write_plugin="csv"
3660 else
3661 LOAD_PLUGIN_CSV="#"
3662 fi
3663 else
3664 LOAD_PLUGIN_CSV="##"
3665 fi
3666 AC_MSG_RESULT([$default_write_plugin])
3668 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3669 AC_SUBST(LOAD_PLUGIN_NETWORK)
3670 AC_SUBST(LOAD_PLUGIN_CSV)
3672 dnl ip_vs.h
3673 if test "x$ac_system" = "xLinux" \
3674 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3675 then
3676 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3677 fi
3679 dnl Perl bindings
3680 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3681 [
3682 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3683 then
3684 PERL_BINDINGS_OPTIONS="$withval"
3685 with_perl_bindings="yes"
3686 else
3687 PERL_BINDINGS_OPTIONS=""
3688 with_perl_bindings="$withval"
3689 fi
3690 ],
3691 [
3692 PERL_BINDINGS_OPTIONS=""
3693 if test -n "$perl_interpreter"
3694 then
3695 with_perl_bindings="yes"
3696 else
3697 with_perl_bindings="no (no perl interpreter found)"
3698 fi
3699 ])
3700 if test "x$with_perl_bindings" = "xyes"
3701 then
3702 PERL_BINDINGS="perl"
3703 else
3704 PERL_BINDINGS=""
3705 fi
3706 AC_SUBST(PERL_BINDINGS)
3707 AC_SUBST(PERL_BINDINGS_OPTIONS)
3709 dnl libcollectdclient
3710 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3711 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3712 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3714 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3716 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3718 AC_SUBST(LCC_VERSION_MAJOR)
3719 AC_SUBST(LCC_VERSION_MINOR)
3720 AC_SUBST(LCC_VERSION_PATCH)
3721 AC_SUBST(LCC_VERSION_EXTRA)
3722 AC_SUBST(LCC_VERSION_STRING)
3724 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3726 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
3728 if test "x$with_librrd" = "xyes" \
3729 && test "x$librrd_threadsafe" != "xyes"
3730 then
3731 with_librrd="yes (warning: librrd is not thread-safe)"
3732 fi
3734 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3735 then
3736 with_libiptc="yes (shipped version)"
3737 fi
3739 if test "x$with_libperl" = "xyes"
3740 then
3741 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3742 else
3743 enable_perl="no (needs libperl)"
3744 fi
3746 if test "x$with_perl_bindings" = "xyes" \
3747 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3748 then
3749 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3750 fi
3752 cat <<EOF;
3754 Configuration:
3755 Libraries:
3756 libcurl . . . . . . . $with_libcurl
3757 libdbi . . . . . . . $with_libdbi
3758 libesmtp . . . . . . $with_libesmtp
3759 libgcrypt . . . . . . $with_libgcrypt
3760 libiokit . . . . . . $with_libiokit
3761 libiptc . . . . . . . $with_libiptc
3762 libjvm . . . . . . . $with_java
3763 libkstat . . . . . . $with_kstat
3764 libkvm . . . . . . . $with_libkvm
3765 libmysql . . . . . . $with_libmysql
3766 libnetlink . . . . . $with_libnetlink
3767 libnetsnmp . . . . . $with_libnetsnmp
3768 libnotify . . . . . . $with_libnotify
3769 liboconfig . . . . . $with_liboconfig
3770 libopenipmi . . . . . $with_libopenipmipthread
3771 liboping . . . . . . $with_liboping
3772 libpcap . . . . . . . $with_libpcap
3773 libperl . . . . . . . $with_libperl
3774 libpq . . . . . . . . $with_libpq
3775 libpthread . . . . . $with_libpthread
3776 librrd . . . . . . . $with_librrd
3777 libsensors . . . . . $with_libsensors
3778 libstatgrab . . . . . $with_libstatgrab
3779 libupsclient . . . . $with_libupsclient
3780 libvirt . . . . . . . $with_libvirt
3781 libxml2 . . . . . . . $with_libxml2
3782 libxmms . . . . . . . $with_libxmms
3783 oracle . . . . . . . $with_oracle
3785 Features:
3786 daemon mode . . . . . $enable_daemon
3787 debug . . . . . . . . $enable_debug
3789 Bindings:
3790 perl . . . . . . . . $with_perl_bindings
3792 Modules:
3793 apache . . . . . . . $enable_apache
3794 apcups . . . . . . . $enable_apcups
3795 apple_sensors . . . . $enable_apple_sensors
3796 ascent . . . . . . . $enable_ascent
3797 battery . . . . . . . $enable_battery
3798 bind . . . . . . . . $enable_bind
3799 conntrack . . . . . . $enable_conntrack
3800 cpu . . . . . . . . . $enable_cpu
3801 cpufreq . . . . . . . $enable_cpufreq
3802 csv . . . . . . . . . $enable_csv
3803 curl . . . . . . . . $enable_curl
3804 dbi . . . . . . . . . $enable_dbi
3805 df . . . . . . . . . $enable_df
3806 disk . . . . . . . . $enable_disk
3807 dns . . . . . . . . . $enable_dns
3808 email . . . . . . . . $enable_email
3809 entropy . . . . . . . $enable_entropy
3810 exec . . . . . . . . $enable_exec
3811 filecount . . . . . . $enable_filecount
3812 fscache . . . . . . . $enable_fscache
3813 gmond . . . . . . . . $enable_gmond
3814 hddtemp . . . . . . . $enable_hddtemp
3815 interface . . . . . . $enable_interface
3816 ipmi . . . . . . . . $enable_ipmi
3817 iptables . . . . . . $enable_iptables
3818 ipvs . . . . . . . . $enable_ipvs
3819 irq . . . . . . . . . $enable_irq
3820 java . . . . . . . . $enable_java
3821 libvirt . . . . . . . $enable_libvirt
3822 load . . . . . . . . $enable_load
3823 logfile . . . . . . . $enable_logfile
3824 match_regex . . . . . $enable_match_regex
3825 match_timediff . . . $enable_match_timediff
3826 match_value . . . . . $enable_match_value
3827 mbmon . . . . . . . . $enable_mbmon
3828 memcachec . . . . . . $enable_memcachec
3829 memcached . . . . . . $enable_memcached
3830 memory . . . . . . . $enable_memory
3831 multimeter . . . . . $enable_multimeter
3832 mysql . . . . . . . . $enable_mysql
3833 netlink . . . . . . . $enable_netlink
3834 network . . . . . . . $enable_network
3835 nfs . . . . . . . . . $enable_nfs
3836 nginx . . . . . . . . $enable_nginx
3837 notify_desktop . . . $enable_notify_desktop
3838 notify_email . . . . $enable_notify_email
3839 ntpd . . . . . . . . $enable_ntpd
3840 nut . . . . . . . . . $enable_nut
3841 onewire . . . . . . . $enable_onewire
3842 openvpn . . . . . . . $enable_openvpn
3843 oracle . . . . . . . $enable_oracle
3844 perl . . . . . . . . $enable_perl
3845 ping . . . . . . . . $enable_ping
3846 postgresql . . . . . $enable_postgresql
3847 powerdns . . . . . . $enable_powerdns
3848 processes . . . . . . $enable_processes
3849 protocols . . . . . . $enable_protocols
3850 rrdcached . . . . . . $enable_rrdcached
3851 rrdtool . . . . . . . $enable_rrdtool
3852 sensors . . . . . . . $enable_sensors
3853 serial . . . . . . . $enable_serial
3854 snmp . . . . . . . . $enable_snmp
3855 swap . . . . . . . . $enable_swap
3856 syslog . . . . . . . $enable_syslog
3857 table . . . . . . . . $enable_table
3858 tail . . . . . . . . $enable_tail
3859 tape . . . . . . . . $enable_tape
3860 target_notification . $enable_target_notification
3861 target_replace . . . $enable_target_replace
3862 target_set . . . . . $enable_target_set
3863 tcpconns . . . . . . $enable_tcpconns
3864 teamspeak2 . . . . . $enable_teamspeak2
3865 ted . . . . . . . . . $enable_ted
3866 thermal . . . . . . . $enable_thermal
3867 unixsock . . . . . . $enable_unixsock
3868 uptime . . . . . . . $enable_uptime
3869 users . . . . . . . . $enable_users
3870 uuid . . . . . . . . $enable_uuid
3871 vmem . . . . . . . . $enable_vmem
3872 vserver . . . . . . . $enable_vserver
3873 wireless . . . . . . $enable_wireless
3874 xmms . . . . . . . . $enable_xmms
3876 EOF
3878 if test "x$dependency_error" = "xyes"; then
3879 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3880 fi
3882 # vim: set fdm=marker :