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