1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
6 m4_ifdef([LT_PACKAGE_VERSION],
7 # libtool >= 2.2
8 [
9 LT_CONFIG_LTDL_DIR([libltdl])
10 LT_INIT([dlopen])
11 LTDL_INIT([convenience])
12 ]
13 ,
14 # libtool <= 1.5
15 [
16 AC_LIBLTDL_CONVENIENCE
17 AC_SUBST(LTDLINCL)
18 AC_SUBST(LIBLTDL)
19 AC_LIBTOOL_DLOPEN
20 AC_CONFIG_SUBDIRS(libltdl)
21 ]
22 )
24 AM_INIT_AUTOMAKE(dist-bzip2)
25 AC_LANG(C)
27 AC_PREFIX_DEFAULT("/opt/collectd")
29 AC_SYS_LARGEFILE
31 #
32 # Checks for programs.
33 #
34 AC_PROG_CC
35 AC_PROG_CPP
36 AC_PROG_INSTALL
37 AC_PROG_LN_S
38 AC_PROG_MAKE_SET
39 AM_PROG_CC_C_O
40 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
42 AC_DISABLE_STATIC
43 AC_PROG_LIBTOOL
44 AC_PROG_LEX
45 AC_PROG_YACC
46 PKG_PROG_PKG_CONFIG
48 AC_MSG_CHECKING([for kernel type ($host_os)])
49 case $host_os in
50 *linux*)
51 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
52 ac_system="Linux"
53 ;;
54 *solaris*)
55 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
56 ac_system="Solaris"
57 ;;
58 *darwin*)
59 ac_system="Darwin"
60 ;;
61 *openbsd*)
62 ac_system="OpenBSD"
63 ;;
64 *)
65 ac_system="unknown"
66 esac
67 AC_MSG_RESULT([$ac_system])
69 if test "x$ac_system" = "xLinux"
70 then
71 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
72 if test -z "$KERNEL_DIR"
73 then
74 KERNEL_DIR="/lib/modules/`uname -r`/source"
75 fi
77 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
78 AC_SUBST(KERNEL_CFLAGS)
79 fi
81 if test "x$ac_system" = "xSolaris"
82 then
83 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
84 fi
86 # Where to install .pc files.
87 pkgconfigdir="${libdir}/pkgconfig"
88 AC_SUBST(pkgconfigdir)
90 #
91 # Checks for header files.
92 #
93 AC_HEADER_STDC
94 AC_HEADER_SYS_WAIT
95 AC_HEADER_DIRENT
96 AC_HEADER_STDBOOL
98 AC_CHECK_HEADERS(stdio.h stdint.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
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 vm/anon.h, [], [have_sys_swap_h="no"],
268 [
269 #undef _FILE_OFFSET_BITS
270 #undef _LARGEFILE64_SOURCE
271 #if HAVE_SYS_TYPES_H
272 # include <sys/types.h>
273 #endif
274 #if HAVE_SYS_PARAM_H
275 # include <sys/param.h>
276 #endif
277 ])
279 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
280 then
281 hint_64=""
282 if test "x$GCC" = "xyes"
283 then
284 hint_64="CFLAGS='-m64'"
285 else
286 hint_64="CFLAGS='-xarch=v9'"
287 fi
288 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
289 fi
291 # For load module
292 # For the processes plugin
293 # For users module
294 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
296 # For interface plugin
297 AC_CHECK_HEADERS(ifaddrs.h)
298 AC_CHECK_HEADERS(net/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/if.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 ])
316 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
317 [
318 #if HAVE_SYS_TYPES_H
319 # include <sys/types.h>
320 #endif
321 #if HAVE_SYS_SOCKET_H
322 # include <sys/socket.h>
323 #endif
324 #if HAVE_LINUX_IF_H
325 # include <linux/if.h>
326 #endif
327 ])
329 # For ipvs module
330 have_net_ip_vs_h="no"
331 have_ip_vs_h="no"
332 if test "x$ac_system" = "xLinux"
333 then
334 SAVE_CFLAGS=$CFLAGS
335 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
337 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
338 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
340 CFLAGS=$SAVE_CFLAGS
341 fi
343 # For quota module
344 AC_CHECK_HEADERS(sys/ucred.h, [], [],
345 [
346 #if HAVE_SYS_TYPES_H
347 # include <sys/types.h>
348 #endif
349 #if HAVE_SYS_PARAM_H
350 # include <sys/param.h>
351 #endif
352 ])
354 # For mount interface
355 AC_CHECK_HEADERS(sys/mount.h, [], [],
356 [
357 #if HAVE_SYS_TYPES_H
358 # include <sys/types.h>
359 #endif
360 #if HAVE_SYS_PARAM_H
361 # include <sys/param.h>
362 #endif
363 ])
365 # For the email plugin
366 AC_CHECK_HEADERS(linux/un.h, [], [],
367 [
368 #if HAVE_SYS_SOCKET_H
369 # include <sys/socket.h>
370 #endif
371 ])
373 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.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)
375 # For the dns plugin
376 AC_CHECK_HEADERS(arpa/nameser.h)
377 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
378 [
379 #if HAVE_ARPA_NAMESER_H
380 # include <arpa/nameser.h>
381 #endif
382 ])
384 AC_CHECK_HEADERS(net/if_arp.h, [], [],
385 [#if HAVE_SYS_SOCKET_H
386 # include <sys/socket.h>
387 #endif
388 ])
389 AC_CHECK_HEADERS(net/ppp_defs.h)
390 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
391 [#if HAVE_NET_PPP_DEFS_H
392 # include <net/ppp_defs.h>
393 #endif
394 ])
395 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
396 [#if HAVE_STDINT_H
397 # include <stdint.h>
398 #endif
399 #if HAVE_SYS_TYPES_H
400 # include <sys/types.h>
401 #endif
402 #if HAVE_SYS_SOCKET_H
403 # include <sys/socket.h>
404 #endif
405 #if HAVE_NET_IF_H
406 # include <net/if.h>
407 #endif
408 #if HAVE_NETINET_IN_H
409 # include <netinet/in.h>
410 #endif
411 ])
413 # For the multimeter plugin
414 have_termios_h="no"
415 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
417 #
418 # Checks for typedefs, structures, and compiler characteristics.
419 #
420 AC_C_CONST
421 AC_TYPE_PID_T
422 AC_TYPE_SIZE_T
423 AC_TYPE_UID_T
424 AC_HEADER_TIME
426 #
427 # Checks for library functions.
428 #
429 AC_PROG_GCC_TRADITIONAL
430 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf)
432 AC_FUNC_STRERROR_R
434 AC_CACHE_CHECK([for strtok_r],
435 [c_cv_have_strtok_r_default],
436 AC_LINK_IFELSE(
437 AC_LANG_PROGRAM(
438 [[[[
439 #include <stdlib.h>
440 #include <stdio.h>
441 #include <string.h>
442 ]]]],
443 [[[[
444 char buffer[] = "foo,bar,baz";
445 char *token;
446 char *dummy;
447 char *saveptr;
449 dummy = buffer;
450 saveptr = NULL;
451 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
452 {
453 dummy = NULL;
454 printf ("token = %s;\n", token);
455 }
456 ]]]]),
457 [c_cv_have_strtok_r_default="yes"],
458 [c_cv_have_strtok_r_default="no"]
459 )
460 )
462 if test "x$c_cv_have_strtok_r_default" = "xno"
463 then
464 SAVE_CFLAGS="$CFLAGS"
465 CFLAGS="$CFLAGS -D_REENTRANT=1"
467 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
468 [c_cv_have_strtok_r_reentrant],
469 AC_LINK_IFELSE(
470 AC_LANG_PROGRAM(
471 [[[[
472 #include <stdlib.h>
473 #include <stdio.h>
474 #include <string.h>
475 ]]]],
476 [[[[
477 char buffer[] = "foo,bar,baz";
478 char *token;
479 char *dummy;
480 char *saveptr;
482 dummy = buffer;
483 saveptr = NULL;
484 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
485 {
486 dummy = NULL;
487 printf ("token = %s;\n", token);
488 }
489 ]]]]),
490 [c_cv_have_strtok_r_reentrant="yes"],
491 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
492 )
493 )
494 fi
496 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
498 socket_needs_socket="no"
499 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
500 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
502 nanosleep_needs_rt="no"
503 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
504 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
506 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
507 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
508 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
509 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
510 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
511 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
512 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
513 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
514 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
515 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
516 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
517 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
519 # For load module
520 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
522 # Check for NAN
523 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
524 [
525 if test "x$withval" = "xno"; then
526 nan_type="none"
527 else if test "x$withval" = "xyes"; then
528 nan_type="zero"
529 else
530 nan_type="$withval"
531 fi; fi
532 ],
533 [nan_type="none"])
534 if test "x$nan_type" = "xnone"; then
535 AC_CACHE_CHECK([whether NAN is defined by default],
536 [c_cv_have_nan_default],
537 AC_COMPILE_IFELSE(
538 AC_LANG_PROGRAM(
539 [[
540 #include <stdlib.h>
541 #include <math.h>
542 static float foo = NAN;
543 ]],
544 [[
545 if (isnan (foo))
546 return 0;
547 else
548 return 1;
549 ]]),
550 [c_cv_have_nan_default="yes"],
551 [c_cv_have_nan_default="no"]
552 )
553 )
554 if test "x$c_cv_have_nan_default" = "xyes"
555 then
556 nan_type="default"
557 fi
558 fi
559 if test "x$nan_type" = "xnone"; then
560 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
561 [c_cv_have_nan_isoc],
562 AC_COMPILE_IFELSE(
563 AC_LANG_PROGRAM(
564 [[
565 #include <stdlib.h>
566 #define __USE_ISOC99 1
567 #include <math.h>
568 static float foo = NAN;
569 ]],
570 [[
571 if (isnan (foo))
572 return 0;
573 else
574 return 1;
575 ]]),
576 [c_cv_have_nan_isoc="yes"],
577 [c_cv_have_nan_isoc="no"]
578 )
579 )
580 if test "x$c_cv_have_nan_isoc" = "xyes"
581 then
582 nan_type="isoc99"
583 fi
584 fi
585 if test "x$nan_type" = "xnone"; then
586 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
587 [c_cv_have_nan_zero],
588 AC_RUN_IFELSE(
589 AC_LANG_PROGRAM(
590 [[
591 #include <stdlib.h>
592 #include <math.h>
593 #ifdef NAN
594 # undef NAN
595 #endif
596 #define NAN (0.0 / 0.0)
597 #ifndef isnan
598 # define isnan(f) ((f) != (f))
599 #endif
600 static float foo = NAN;
601 ]],
602 [[
603 if (isnan (foo))
604 return 0;
605 else
606 return 1;
607 ]]),
608 [c_cv_have_nan_zero="yes"],
609 [c_cv_have_nan_zero="no"]
610 )
611 )
612 if test "x$c_cv_have_nan_zero" = "xyes"
613 then
614 nan_type="zero"
615 fi
616 fi
618 if test "x$nan_type" = "xdefault"; then
619 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
620 [Define if NAN is defined by default and can initialize static variables.])
621 else if test "x$nan_type" = "xisoc99"; then
622 AC_DEFINE(NAN_STATIC_ISOC, 1,
623 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
624 else if test "x$nan_type" = "xzero"; then
625 AC_DEFINE(NAN_ZERO_ZERO, 1,
626 [Define if NAN can be defined as (0.0 / 0.0)])
627 else
628 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
629 fi; fi; fi
631 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
632 [
633 if test "x$withval" = "xnothing"; then
634 fp_layout_type="nothing"
635 else if test "x$withval" = "xendianflip"; then
636 fp_layout_type="endianflip"
637 else if test "x$withval" = "xintswap"; then
638 fp_layout_type="intswap"
639 else
640 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
641 fi; fi; fi
642 ],
643 [fp_layout_type="unknown"])
645 if test "x$fp_layout_type" = "xunknown"; then
646 AC_CACHE_CHECK([if doubles are stored in x86 representation],
647 [c_cv_fp_layout_need_nothing],
648 AC_RUN_IFELSE(
649 AC_LANG_PROGRAM(
650 [[[[
651 #include <stdlib.h>
652 #include <stdio.h>
653 #include <string.h>
654 #if HAVE_STDINT_H
655 # include <stdint.h>
656 #endif
657 #if HAVE_STDBOOL_H
658 # include <stdbool.h>
659 #endif
660 ]]]],
661 [[[[
662 uint64_t i0;
663 uint64_t i1;
664 uint8_t c[8];
665 double d;
667 d = 8.642135e130;
668 memcpy ((void *) &i0, (void *) &d, 8);
670 i1 = i0;
671 memcpy ((void *) c, (void *) &i1, 8);
673 if ((c[0] == 0x2f) && (c[1] == 0x25)
674 && (c[2] == 0xc0) && (c[3] == 0xc7)
675 && (c[4] == 0x43) && (c[5] == 0x2b)
676 && (c[6] == 0x1f) && (c[7] == 0x5b))
677 return (0);
678 else
679 return (1);
680 ]]]]),
681 [c_cv_fp_layout_need_nothing="yes"],
682 [c_cv_fp_layout_need_nothing="no"]
683 )
684 )
685 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
686 fp_layout_type="nothing"
687 fi
688 fi
689 if test "x$fp_layout_type" = "xunknown"; then
690 AC_CACHE_CHECK([if endianflip converts to x86 representation],
691 [c_cv_fp_layout_need_endianflip],
692 AC_RUN_IFELSE(
693 AC_LANG_PROGRAM(
694 [[[[
695 #include <stdlib.h>
696 #include <stdio.h>
697 #include <string.h>
698 #if HAVE_STDINT_H
699 # include <stdint.h>
700 #endif
701 #if HAVE_STDBOOL_H
702 # include <stdbool.h>
703 #endif
704 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
705 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
706 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
707 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
708 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
709 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
710 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
711 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
712 ]]]],
713 [[[[
714 uint64_t i0;
715 uint64_t i1;
716 uint8_t c[8];
717 double d;
719 d = 8.642135e130;
720 memcpy ((void *) &i0, (void *) &d, 8);
722 i1 = endianflip (i0);
723 memcpy ((void *) c, (void *) &i1, 8);
725 if ((c[0] == 0x2f) && (c[1] == 0x25)
726 && (c[2] == 0xc0) && (c[3] == 0xc7)
727 && (c[4] == 0x43) && (c[5] == 0x2b)
728 && (c[6] == 0x1f) && (c[7] == 0x5b))
729 return (0);
730 else
731 return (1);
732 ]]]]),
733 [c_cv_fp_layout_need_endianflip="yes"],
734 [c_cv_fp_layout_need_endianflip="no"]
735 )
736 )
737 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
738 fp_layout_type="endianflip"
739 fi
740 fi
741 if test "x$fp_layout_type" = "xunknown"; then
742 AC_CACHE_CHECK([if intswap converts to x86 representation],
743 [c_cv_fp_layout_need_intswap],
744 AC_RUN_IFELSE(
745 AC_LANG_PROGRAM(
746 [[[[
747 #include <stdlib.h>
748 #include <stdio.h>
749 #include <string.h>
750 #if HAVE_STDINT_H
751 # include <stdint.h>
752 #endif
753 #if HAVE_STDBOOL_H
754 # include <stdbool.h>
755 #endif
756 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
757 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
758 ]]]],
759 [[[[
760 uint64_t i0;
761 uint64_t i1;
762 uint8_t c[8];
763 double d;
765 d = 8.642135e130;
766 memcpy ((void *) &i0, (void *) &d, 8);
768 i1 = intswap (i0);
769 memcpy ((void *) c, (void *) &i1, 8);
771 if ((c[0] == 0x2f) && (c[1] == 0x25)
772 && (c[2] == 0xc0) && (c[3] == 0xc7)
773 && (c[4] == 0x43) && (c[5] == 0x2b)
774 && (c[6] == 0x1f) && (c[7] == 0x5b))
775 return (0);
776 else
777 return (1);
778 ]]]]),
779 [c_cv_fp_layout_need_intswap="yes"],
780 [c_cv_fp_layout_need_intswap="no"]
781 )
782 )
783 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
784 fp_layout_type="intswap"
785 fi
786 fi
788 if test "x$fp_layout_type" = "xnothing"; then
789 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
790 [Define if doubles are stored in x86 representation.])
791 else if test "x$fp_layout_type" = "xendianflip"; then
792 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
793 [Define if endianflip is needed to convert to x86 representation.])
794 else if test "x$fp_layout_type" = "xintswap"; then
795 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
796 [Define if intswap is needed to convert to x86 representation.])
797 else
798 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
799 fi; fi; fi
801 have_getfsstat="no"
802 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
803 have_getvfsstat="no"
804 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
805 have_listmntent="no"
806 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
808 have_getmntent="no"
809 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
810 if test "x$have_getmntent" = "xno"; then
811 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
812 fi
813 if test "x$have_getmntent" = "xno"; then
814 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
815 fi
816 if test "x$have_getmntent" = "xno"; then
817 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
818 fi
820 if test "x$have_getmntent" = "xc"; then
821 AC_CACHE_CHECK([whether getmntent takes one argument],
822 [c_cv_have_one_getmntent],
823 AC_COMPILE_IFELSE(
824 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
825 #include "$srcdir/src/utils_mount.h"]],
826 [[
827 FILE *fh;
828 struct mntent *me;
829 fh = setmntent ("/etc/mtab", "r");
830 me = getmntent (fh);
831 ]]
832 ),
833 [c_cv_have_one_getmntent="yes"],
834 [c_cv_have_one_getmntent="no"]
835 )
836 )
837 AC_CACHE_CHECK([whether getmntent takes two arguments],
838 [c_cv_have_two_getmntent],
839 AC_COMPILE_IFELSE(
840 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
841 #include "$srcdir/src/utils_mount.h"]],
842 [[
843 FILE *fh;
844 struct mnttab mt;
845 int status;
846 fh = fopen ("/etc/mnttab", "r");
847 status = getmntent (fh, &mt);
848 ]]
849 ),
850 [c_cv_have_two_getmntent="yes"],
851 [c_cv_have_two_getmntent="no"]
852 )
853 )
854 fi
856 # Check for different versions of `getmntent' here..
858 if test "x$have_getmntent" = "xc"; then
859 if test "x$c_cv_have_one_getmntent" = "xyes"; then
860 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
861 [Define if the function getmntent exists and takes one argument.])
862 fi
863 if test "x$c_cv_have_two_getmntent" = "xyes"; then
864 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
865 [Define if the function getmntent exists and takes two arguments.])
866 fi
867 fi
868 if test "x$have_getmntent" = "xsun"; then
869 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
870 [Define if the function getmntent exists. It's the version from libsun.])
871 fi
872 if test "x$have_getmntent" = "xseq"; then
873 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
874 [Define if the function getmntent exists. It's the version from libseq.])
875 fi
876 if test "x$have_getmntent" = "xgen"; then
877 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
878 [Define if the function getmntent exists. It's the version from libgen.])
879 fi
881 # Check for structures
882 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
883 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
884 [],
885 [
886 #include <sys/types.h>
887 #include <sys/socket.h>
888 #include <net/if.h>
889 ])
890 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
891 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
892 [],
893 [
894 #include <sys/types.h>
895 #include <sys/socket.h>
896 #include <linux/if.h>
897 #include <linux/netdevice.h>
898 ])
900 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
901 [
902 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
903 [Define if struct kinfo_proc exists in the FreeBSD variant.])
904 have_struct_kinfo_proc_freebsd="yes"
905 ],
906 [
907 have_struct_kinfo_proc_freebsd="no"
908 ],
909 [
910 #include <kvm.h>
911 #include <sys/param.h>
912 #include <sys/sysctl.h>
913 #include <sys/user.h>
914 ])
916 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
917 [
918 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
919 [Define if struct kinfo_proc exists in the OpenBSD variant.])
920 have_struct_kinfo_proc_openbsd="yes"
921 ],
922 [
923 have_struct_kinfo_proc_openbsd="no"
924 ],
925 [
926 #include <sys/param.h>
927 #include <sys/sysctl.h>
928 #include <kvm.h>
929 ])
931 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
932 [#if HAVE_STDINT_H
933 # include <stdint.h>
934 #endif
935 #if HAVE_SYS_TYPES_H
936 # include <sys/types.h>
937 #endif
938 #if HAVE_NETINET_IN_SYSTM_H
939 # include <netinet/in_systm.h>
940 #endif
941 #if HAVE_NETINET_IN_H
942 # include <netinet/in.h>
943 #endif
944 #if HAVE_NETINET_IP_H
945 # include <netinet/ip.h>
946 #endif
947 #if HAVE_NETINET_UDP_H
948 # include <netinet/udp.h>
949 #endif
950 ])
951 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
952 [#if HAVE_STDINT_H
953 # include <stdint.h>
954 #endif
955 #if HAVE_SYS_TYPES_H
956 # include <sys/types.h>
957 #endif
958 #if HAVE_NETINET_IN_SYSTM_H
959 # include <netinet/in_systm.h>
960 #endif
961 #if HAVE_NETINET_IN_H
962 # include <netinet/in.h>
963 #endif
964 #if HAVE_NETINET_IP_H
965 # include <netinet/ip.h>
966 #endif
967 #if HAVE_NETINET_UDP_H
968 # include <netinet/udp.h>
969 #endif
970 ])
972 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
973 [],
974 [],
975 [
976 #if HAVE_KSTAT_H
977 # include <kstat.h>
978 #endif
979 ])
981 #
982 # Checks for libraries begin here
983 #
984 with_libresolv="yes"
985 AC_CHECK_LIB(resolv, res_search,
986 [
987 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
988 ],
989 [with_libresolv="no"])
990 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
992 dnl Check for HAL (hardware abstraction library)
993 with_libhal="yes"
994 AC_CHECK_LIB(hal,libhal_device_property_exists,
995 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
996 [with_libhal="no"])
997 if test "x$with_libhal" = "xyes"; then
998 if test "x$PKG_CONFIG" != "x"; then
999 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1000 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1001 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1002 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1003 fi
1004 fi
1006 m4_divert_once([HELP_WITH], [
1007 collectd additional packages:])
1009 if test "x$ac_system" = "xSolaris"
1010 then
1011 with_kstat="yes"
1012 with_devinfo="yes"
1013 else
1014 with_kstat="no (Solaris only)"
1015 with_devinfo="no (Solaris only)"
1016 fi
1018 if test "x$with_kstat" = "xyes"
1019 then
1020 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1021 fi
1022 if test "x$with_kstat" = "xyes"
1023 then
1024 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1025 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1026 fi
1027 if test "x$with_kstat" = "xyes"
1028 then
1029 AC_DEFINE(HAVE_LIBKSTAT, 1,
1030 [Define to 1 if you have the 'kstat' library (-lkstat)])
1031 fi
1032 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1033 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1035 with_libiokit="no"
1036 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1037 [
1038 with_libiokit="yes"
1039 ],
1040 [
1041 with_libiokit="no"
1042 ])
1043 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1045 with_libkvm="no"
1046 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1047 if test "x$with_kvm_getprocs" = "xyes"
1048 then
1049 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1050 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1051 with_libkvm="yes"
1052 fi
1053 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1055 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1056 if test "x$with_kvm_getswapinfo" = "xyes"
1057 then
1058 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1059 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1060 with_libkvm="yes"
1061 fi
1062 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1064 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1065 if test "x$with_kvm_nlist" = "xyes"
1066 then
1067 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1068 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1069 with_libkvm="yes"
1070 fi
1071 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1073 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1074 if test "x$with_kvm_openfiles" = "xyes"
1075 then
1076 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1077 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1078 with_libkvm="yes"
1079 fi
1080 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1082 # --with-libcurl {{{
1083 with_curl_config="curl-config"
1084 with_curl_cflags=""
1085 with_curl_libs=""
1086 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1087 [
1088 if test "x$withval" = "xno"
1089 then
1090 with_libcurl="no"
1091 else if test "x$withval" = "xyes"
1092 then
1093 with_libcurl="yes"
1094 else
1095 if test -f "$withval" && test -x "$withval"
1096 then
1097 with_curl_config="$withval"
1098 with_libcurl="yes"
1099 else if test -x "$withval/bin/curl-config"
1100 then
1101 with_curl_config="$withval/bin/curl-config"
1102 with_libcurl="yes"
1103 fi; fi
1104 with_libcurl="yes"
1105 fi; fi
1106 ],
1107 [
1108 with_libcurl="yes"
1109 ])
1110 if test "x$with_libcurl" = "xyes"
1111 then
1112 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1113 curl_config_status=$?
1115 if test $curl_config_status -ne 0
1116 then
1117 with_libcurl="no ($with_curl_config failed)"
1118 else
1119 SAVE_CPPFLAGS="$CPPFLAGS"
1120 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1122 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1124 CPPFLAGS="$SAVE_CPPFLAGS"
1125 fi
1126 fi
1127 if test "x$with_libcurl" = "xyes"
1128 then
1129 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1130 curl_config_status=$?
1132 if test $curl_config_status -ne 0
1133 then
1134 with_libcurl="no ($with_curl_config failed)"
1135 else
1136 AC_CHECK_LIB(curl, curl_easy_init,
1137 [with_libcurl="yes"],
1138 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1139 [$with_curl_libs])
1140 fi
1141 fi
1142 if test "x$with_libcurl" = "xyes"
1143 then
1144 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1145 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1146 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1147 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1148 fi
1149 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1150 # }}}
1152 # --with-libdbi {{{
1153 with_libdbi_cppflags=""
1154 with_libdbi_ldflags=""
1155 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1156 [
1157 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1158 then
1159 with_libdbi_cppflags="-I$withval/include"
1160 with_libdbi_ldflags="-L$withval/lib"
1161 with_libdbi="yes"
1162 else
1163 with_libdbi="$withval"
1164 fi
1165 ],
1166 [
1167 with_libdbi="yes"
1168 ])
1169 if test "x$with_libdbi" = "xyes"
1170 then
1171 SAVE_CPPFLAGS="$CPPFLAGS"
1172 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1174 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1176 CPPFLAGS="$SAVE_CPPFLAGS"
1177 fi
1178 if test "x$with_libdbi" = "xyes"
1179 then
1180 SAVE_CPPFLAGS="$CPPFLAGS"
1181 SAVE_LDFLAGS="$LDFLAGS"
1182 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1183 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1185 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1187 CPPFLAGS="$SAVE_CPPFLAGS"
1188 LDFLAGS="$SAVE_LDFLAGS"
1189 fi
1190 if test "x$with_libdbi" = "xyes"
1191 then
1192 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1193 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1194 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1195 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1196 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1197 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1198 fi
1199 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1200 # }}}
1202 # --with-libesmtp {{{
1203 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1204 [
1205 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1206 then
1207 LDFLAGS="$LDFLAGS -L$withval/lib"
1208 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1209 with_libesmtp="yes"
1210 else
1211 with_libesmtp="$withval"
1212 fi
1213 ],
1214 [
1215 with_libesmtp="yes"
1216 ])
1217 if test "x$with_libesmtp" = "xyes"
1218 then
1219 AC_CHECK_LIB(esmtp, smtp_create_session,
1220 [
1221 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1222 ], [with_libesmtp="no (libesmtp not found)"])
1223 fi
1224 if test "x$with_libesmtp" = "xyes"
1225 then
1226 AC_CHECK_HEADERS(libesmtp.h,
1227 [
1228 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1229 ], [with_libesmtp="no (libesmtp.h not found)"])
1230 fi
1231 if test "x$with_libesmtp" = "xyes"
1232 then
1233 collect_libesmtp=1
1234 else
1235 collect_libesmtp=0
1236 fi
1237 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1238 [Wether or not to use the esmtp library])
1239 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1240 # }}}
1242 # --with-libiptc {{{
1243 with_own_libiptc="no"
1244 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1245 [
1246 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1247 then
1248 LDFLAGS="$LDFLAGS -L$withval/lib"
1249 CPPFLAGS="$CPPFLAGS -I$withval/include"
1250 with_libiptc="yes"
1251 else
1252 with_libiptc="$withval"
1253 fi
1254 ],
1255 [
1256 if test "x$ac_system" = "xLinux"
1257 then
1258 with_libiptc="yes"
1259 else
1260 with_libiptc="no (Linux only)"
1261 fi
1262 ])
1263 if test "x$with_libiptc" = "xyes"
1264 then
1265 AC_CHECK_LIB(iptc, iptc_init,
1266 [
1267 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1268 ],
1269 [
1270 with_libiptc="yes"
1271 with_own_libiptc="yes"
1272 ])
1273 fi
1274 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1275 then
1276 AC_CHECK_HEADERS(libiptc/libiptc.h,
1277 [
1278 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1279 ],
1280 [
1281 with_libiptc="yes"
1282 with_own_libiptc="yes"
1283 ])
1284 fi
1285 if test "x$with_libiptc" = "xyes"
1286 then
1287 SAVE_CFLAGS=$CFLAGS
1288 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1290 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1291 [
1292 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1293 with_own_libiptc="no"
1294 ],
1295 [
1296 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1297 ])
1299 CFLAGS=$SAVE_CFLAGS
1300 fi
1301 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1302 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1303 if test "x$with_own_libiptc" = "xyes"
1304 then
1305 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1306 fi
1307 # }}}
1309 # --with-libmysql {{{
1310 with_mysql_config="mysql_config"
1311 with_mysql_cflags=""
1312 with_mysql_libs=""
1313 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1314 [
1315 if test "x$withval" = "xno"
1316 then
1317 with_libmysql="no"
1318 else if test "x$withval" = "xyes"
1319 then
1320 with_libmysql="yes"
1321 else
1322 if test -f "$withval" && test -x "$withval";
1323 then
1324 with_mysql_config="$withval"
1325 else if test -x "$withval/bin/mysql_config"
1326 then
1327 with_mysql_config="$withval/bin/mysql_config"
1328 fi; fi
1329 with_libmysql="yes"
1330 fi; fi
1331 ],
1332 [
1333 with_libmysql="yes"
1334 ])
1335 if test "x$with_libmysql" = "xyes"
1336 then
1337 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1338 mysql_config_status=$?
1340 if test $mysql_config_status -ne 0
1341 then
1342 with_libmysql="no ($with_mysql_config failed)"
1343 else
1344 SAVE_CPPFLAGS="$CPPFLAGS"
1345 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1347 have_mysql_h="no"
1348 have_mysql_mysql_h="no"
1349 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1351 if test "x$have_mysql_h" = "xno"
1352 then
1353 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1354 fi
1356 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1357 then
1358 with_libmysql="no (mysql.h not found)"
1359 fi
1361 CPPFLAGS="$SAVE_CPPFLAGS"
1362 fi
1363 fi
1364 if test "x$with_libmysql" = "xyes"
1365 then
1366 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1367 mysql_config_status=$?
1369 if test $mysql_config_status -ne 0
1370 then
1371 with_libmysql="no ($with_mysql_config failed)"
1372 else
1373 AC_CHECK_LIB(mysqlclient, mysql_init,
1374 [with_libmysql="yes"],
1375 [with_libmysql="no (symbol 'mysql_init' not found)"],
1376 [$with_mysql_libs])
1378 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1379 [with_libmysql="yes"],
1380 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1381 [$with_mysql_libs])
1382 fi
1383 fi
1384 if test "x$with_libmysql" = "xyes"
1385 then
1386 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1387 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1388 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1389 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1390 fi
1391 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1392 # }}}
1394 # --with-libnetlink {{{
1395 with_libnetlink_cflags=""
1396 with_libnetlink_libs="-lnetlink"
1397 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1398 [
1399 echo "libnetlink: withval = $withval"
1400 if test "x$withval" = "xyes"
1401 then
1402 with_libnetlink="yes"
1403 else if test "x$withval" = "xno"
1404 then
1405 with_libnetlink="no"
1406 else
1407 if test -d "$withval/include"
1408 then
1409 with_libnetlink_cflags="-I$withval/include"
1410 with_libnetlink_libs="-L$withval/lib -lnetlink"
1411 with_libnetlink="yes"
1412 else
1413 AC_MSG_ERROR("no such directory: $withval/include")
1414 fi
1415 fi; fi
1416 ],
1417 [
1418 if test "x$ac_system" = "xLinux"
1419 then
1420 with_libnetlink="yes"
1421 else
1422 with_libnetlink="no (Linux only library)"
1423 fi
1424 ])
1425 if test "x$with_libnetlink" = "xyes"
1426 then
1427 SAVE_CFLAGS=$CFLAGS
1428 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1430 with_libnetlink="no (libnetlink.h not found)"
1432 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1433 [
1434 with_libnetlink="yes"
1435 break
1436 ], [],
1437 [#include <stdio.h>
1438 #include <sys/types.h>
1439 #include <asm/types.h>
1440 #include <sys/socket.h>
1441 #include <linux/netlink.h>
1442 #include <linux/rtnetlink.h>])
1443 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1444 [#include <stdio.h>
1445 #include <sys/types.h>
1446 #include <asm/types.h>
1447 #include <sys/socket.h>])
1449 AC_COMPILE_IFELSE(
1450 [#include <stdio.h>
1451 #include <sys/types.h>
1452 #include <asm/types.h>
1453 #include <sys/socket.h>
1454 #include <linux/netlink.h>
1455 #include <linux/rtnetlink.h>
1457 int main (void)
1458 {
1459 int retval = TCA_STATS2;
1460 return (retval);
1461 }],
1462 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1463 []);
1465 AC_COMPILE_IFELSE(
1466 [#include <stdio.h>
1467 #include <sys/types.h>
1468 #include <asm/types.h>
1469 #include <sys/socket.h>
1470 #include <linux/netlink.h>
1471 #include <linux/rtnetlink.h>
1473 int main (void)
1474 {
1475 int retval = TCA_STATS;
1476 return (retval);
1477 }],
1478 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1479 []);
1481 CFLAGS="$SAVE_CFLAGS"
1482 fi
1483 if test "x$with_libnetlink" = "xyes"
1484 then
1485 AC_CHECK_LIB(netlink, rtnl_open,
1486 [with_libnetlink="yes"],
1487 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1488 [$with_libnetlink_libs])
1489 fi
1490 if test "x$with_libnetlink" = "xyes"
1491 then
1492 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1493 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1494 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1495 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1496 fi
1497 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1498 # }}}
1500 # --with-libnetsnmp {{{
1501 with_snmp_config="net-snmp-config"
1502 with_snmp_cflags=""
1503 with_snmp_libs=""
1504 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1505 [
1506 if test "x$withval" = "xno"
1507 then
1508 with_libnetsnmp="no"
1509 else if test "x$withval" = "xyes"
1510 then
1511 with_libnetsnmp="yes"
1512 else
1513 if test -x "$withval"
1514 then
1515 with_snmp_config="$withval"
1516 with_libnetsnmp="yes"
1517 else
1518 with_snmp_config="$withval/bin/net-snmp-config"
1519 with_libnetsnmp="yes"
1520 fi
1521 fi; fi
1522 ],
1523 [with_libnetsnmp="yes"])
1524 if test "x$with_libnetsnmp" = "xyes"
1525 then
1526 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1527 snmp_config_status=$?
1529 if test $snmp_config_status -ne 0
1530 then
1531 with_libnetsnmp="no ($with_snmp_config failed)"
1532 else
1533 SAVE_CPPFLAGS="$CPPFLAGS"
1534 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1536 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1538 CPPFLAGS="$SAVE_CPPFLAGS"
1539 fi
1540 fi
1541 if test "x$with_libnetsnmp" = "xyes"
1542 then
1543 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1544 snmp_config_status=$?
1546 if test $snmp_config_status -ne 0
1547 then
1548 with_libnetsnmp="no ($with_snmp_config failed)"
1549 else
1550 AC_CHECK_LIB(netsnmp, init_snmp,
1551 [with_libnetsnmp="yes"],
1552 [with_libnetsnmp="no (libnetsnmp not found)"],
1553 [$with_snmp_libs])
1554 fi
1555 fi
1556 if test "x$with_libnetsnmp" = "xyes"
1557 then
1558 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1559 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1560 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1561 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1562 fi
1563 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1564 # }}}
1566 # --with-liboconfig {{{
1567 with_own_liboconfig="no"
1568 liboconfig_LDFLAGS="$LDFLAGS"
1569 liboconfig_CPPFLAGS="$CPPFLAGS"
1570 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1571 [
1572 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1573 then
1574 if test -d "$withval/lib"
1575 then
1576 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1577 fi
1578 if test -d "$withval/include"
1579 then
1580 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1581 fi
1582 fi
1583 if test "x$withval" = "xno"
1584 then
1585 AC_MSG_ERROR("liboconfig is required")
1586 fi
1587 ],
1588 [
1589 with_liboconfig="yes"
1590 ])
1592 save_LDFLAGS="$LDFLAGS"
1593 save_CPPFLAGS="$CPPFLAGS"
1594 LDFLAGS="$liboconfig_LDFLAGS"
1595 CPPFLAGS="$liboconfig_CPPFLAGS"
1596 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1597 [
1598 with_liboconfig="yes"
1599 with_own_liboconfig="no"
1600 ],
1601 [
1602 with_liboconfig="yes"
1603 with_own_liboconfig="yes"
1604 LDFLAGS="$save_LDFLAGS"
1605 CPPFLAGS="$save_CPPFLAGS"
1606 ])
1608 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1609 if test "x$with_own_liboconfig" = "xyes"
1610 then
1611 with_liboconfig="yes (shipped version)"
1612 fi
1613 # }}}
1615 # --with-liboping {{{
1616 with_own_liboping="no"
1617 liboping_LDFLAGS="$LDFLAGS"
1618 liboping_CPPFLAGS="$CPPFLAGS"
1619 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1620 [
1621 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1622 then
1623 if test -d "$withval/lib"
1624 then
1625 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1626 fi
1627 if test -d "$withval/include"
1628 then
1629 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1630 fi
1631 fi
1632 if test "x$withval" = "xno"
1633 then
1634 with_liboping="no"
1635 with_own_liboping="no"
1636 else if test "x$withval" = "xyes"
1637 then
1638 with_liboping="yes"
1639 fi; fi
1640 ],
1641 [
1642 with_liboping="yes"
1643 ])
1645 if test "x$with_liboping" = "xyes"
1646 then
1647 save_LDFLAGS="$LDFLAGS"
1648 save_CPPFLAGS="$CPPFLAGS"
1649 LDFLAGS="$liboping_LDFLAGS"
1650 CPPFLAGS="$liboping_CPPFLAGS"
1651 AC_CHECK_LIB(oping, ping_construct,
1652 [
1653 with_liboping="yes"
1654 with_own_liboping="no"
1655 ],
1656 [
1657 with_liboping="yes"
1658 with_own_liboping="yes"
1659 LDFLAGS="$save_LDFLAGS"
1660 CPPFLAGS="$save_CPPFLAGS"
1661 ])
1662 fi
1663 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1664 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1665 # }}}
1667 # --with-oracle {{{
1668 with_oracle_cppflags=""
1669 with_oracle_libs=""
1670 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
1671 [
1672 if test "x$withval" = "xyes"
1673 then
1674 if test "x$ORACLE_HOME" = "x"
1675 then
1676 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
1677 fi
1678 with_oracle="yes"
1679 else if test "x$withval" = "xno"
1680 then
1681 with_oracle="no"
1682 else
1683 with_oracle="yes"
1684 ORACLE_HOME="$withval"
1685 fi; fi
1686 ],
1687 [
1688 if test "x$ORACLE_HOME" = "x"
1689 then
1690 with_oracle="no (ORACLE_HOME is not set)"
1691 else
1692 with_oracle="yes"
1693 fi
1694 ])
1695 if test "x$ORACLE_HOME" != "x"
1696 then
1697 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
1699 if test -e "$ORACLE_HOME/lib/ldflags"
1700 then
1701 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
1702 fi
1703 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
1704 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
1705 fi
1706 if test "x$with_oracle" = "xyes"
1707 then
1708 SAVE_CPPFLAGS="$CPPFLAGS"
1709 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1711 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
1713 CPPFLAGS="$SAVE_CPPFLAGS"
1714 fi
1715 if test "x$with_oracle" = "xyes"
1716 then
1717 SAVE_CPPFLAGS="$CPPFLAGS"
1718 SAVE_LDFLAGS="$LDFLAGS"
1719 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1720 LDFLAGS="$LDFLAGS $with_oracle_libs"
1722 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
1724 CPPFLAGS="$SAVE_CPPFLAGS"
1725 LDFLAGS="$SAVE_LDFLAGS"
1726 fi
1727 if test "x$with_oracle" = "xyes"
1728 then
1729 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
1730 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
1731 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
1732 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
1733 fi
1734 # }}}
1736 # --with-libowcapi {{{
1737 with_libowcapi_cppflags=""
1738 with_libowcapi_libs="-lowcapi"
1739 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1740 [
1741 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1742 then
1743 with_libowcapi_cppflags="-I$withval/include"
1744 with_libowcapi_libs="-L$withval/lib -lowcapi"
1745 with_libowcapi="yes"
1746 else
1747 with_libowcapi="$withval"
1748 fi
1749 ],
1750 [
1751 with_libowcapi="yes"
1752 ])
1753 if test "x$with_libowcapi" = "xyes"
1754 then
1755 SAVE_CPPFLAGS="$CPPFLAGS"
1756 CPPFLAGS="$with_libowcapi_cppflags"
1758 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1760 CPPFLAGS="$SAVE_CPPFLAGS"
1761 fi
1762 if test "x$with_libowcapi" = "xyes"
1763 then
1764 SAVE_LDFLAGS="$LDFLAGS"
1765 SAVE_CPPFLAGS="$CPPFLAGS"
1766 LDFLAGS="$with_libowcapi_libs"
1767 CPPFLAGS="$with_libowcapi_cppflags"
1769 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1771 LDFLAGS="$SAVE_LDFLAGS"
1772 CPPFLAGS="$SAVE_CPPFLAGS"
1773 fi
1774 if test "x$with_libowcapi" = "xyes"
1775 then
1776 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1777 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1778 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1779 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1780 fi
1781 # }}}
1783 # --with-libpcap {{{
1784 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1785 [
1786 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1787 then
1788 LDFLAGS="$LDFLAGS -L$withval/lib"
1789 CPPFLAGS="$CPPFLAGS -I$withval/include"
1790 with_libpcap="yes"
1791 else
1792 with_libpcap="$withval"
1793 fi
1794 ],
1795 [
1796 with_libpcap="yes"
1797 ])
1798 if test "x$with_libpcap" = "xyes"
1799 then
1800 AC_CHECK_LIB(pcap, pcap_open_live,
1801 [
1802 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1803 ], [with_libpcap="no (libpcap not found)"])
1804 fi
1805 if test "x$with_libpcap" = "xyes"
1806 then
1807 AC_CHECK_HEADERS(pcap.h,
1808 [
1809 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1810 ], [with_libpcap="no (pcap.h not found)"])
1811 fi
1812 if test "x$with_libpcap" = "xyes"
1813 then
1814 collect_libpcap=1
1815 else
1816 collect_libpcap=0
1817 fi
1818 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1819 [Wether or not to use the pcap library])
1820 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1821 # }}}
1823 # --with-libperl {{{
1824 perl_interpreter="perl"
1825 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1826 [
1827 if test -x "$withval"
1828 then
1829 perl_interpreter="$withval"
1830 with_libperl="yes"
1831 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1832 then
1833 LDFLAGS="$LDFLAGS -L$withval/lib"
1834 CPPFLAGS="$CPPFLAGS -I$withval/include"
1835 perl_interpreter="$withval/bin/perl"
1836 with_libperl="yes"
1837 else
1838 with_libperl="$withval"
1839 fi; fi
1840 ],
1841 [
1842 with_libperl="yes"
1843 ])
1845 AC_MSG_CHECKING([for perl])
1846 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1847 if test -x "$perl_interpreter"
1848 then
1849 AC_MSG_RESULT([yes ($perl_interpreter)])
1850 else
1851 perl_interpreter=""
1852 AC_MSG_RESULT([no])
1853 fi
1855 AC_SUBST(PERL, "$perl_interpreter")
1857 if test "x$with_libperl" = "xyes" \
1858 && test -n "$perl_interpreter"
1859 then
1860 SAVE_CFLAGS=$CFLAGS
1861 SAVE_LDFLAGS=$LDFLAGS
1862 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
1863 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
1864 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
1865 CFLAGS="$CFLAGS $PERL_CFLAGS"
1866 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1868 AC_CACHE_CHECK([for libperl],
1869 [c_cv_have_libperl],
1870 AC_LINK_IFELSE(
1871 AC_LANG_PROGRAM(
1872 [[
1873 #define PERL_NO_GET_CONTEXT
1874 #include <EXTERN.h>
1875 #include <perl.h>
1876 #include <XSUB.h>
1877 ]],
1878 [[
1879 dTHX;
1880 load_module (PERL_LOADMOD_NOIMPORT,
1881 newSVpv ("Collectd::Plugin::FooBar", 24),
1882 Nullsv);
1883 ]]),
1884 [c_cv_have_libperl="yes"],
1885 [c_cv_have_libperl="no"]
1886 )
1887 )
1889 if test "x$c_cv_have_libperl" = "xyes"
1890 then
1891 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1892 AC_SUBST(PERL_CFLAGS)
1893 AC_SUBST(PERL_LDFLAGS)
1894 else
1895 with_libperl="no"
1896 fi
1898 CFLAGS=$SAVE_CFLAGS
1899 LDFLAGS=$SAVE_LDFLAGS
1900 else if test -z "$perl_interpreter"; then
1901 with_libperl="no (no perl interpreter found)"
1902 c_cv_have_libperl="no"
1903 fi; fi
1904 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1906 if test "x$with_libperl" = "xyes"
1907 then
1908 SAVE_CFLAGS=$CFLAGS
1909 SAVE_LDFLAGS=$LDFLAGS
1910 CFLAGS="$CFLAGS $PERL_CFLAGS"
1911 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1913 AC_CACHE_CHECK([if perl supports ithreads],
1914 [c_cv_have_perl_ithreads],
1915 AC_LINK_IFELSE(
1916 AC_LANG_PROGRAM(
1917 [[
1918 #include <EXTERN.h>
1919 #include <perl.h>
1920 #include <XSUB.h>
1922 #if !defined(USE_ITHREADS)
1923 # error "Perl does not support ithreads!"
1924 #endif /* !defined(USE_ITHREADS) */
1925 ]],
1926 [[ ]]),
1927 [c_cv_have_perl_ithreads="yes"],
1928 [c_cv_have_perl_ithreads="no"]
1929 )
1930 )
1932 if test "x$c_cv_have_perl_ithreads" = "xyes"
1933 then
1934 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1935 fi
1937 CFLAGS=$SAVE_CFLAGS
1938 LDFLAGS=$SAVE_LDFLAGS
1939 fi
1941 c_cv_have_broken_perl_load_module="no"
1942 if test "x$with_libperl" = "xyes"
1943 then
1944 SAVE_CFLAGS=$CFLAGS
1945 SAVE_LDFLAGS=$LDFLAGS
1946 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
1947 # (see issues #41 and #42)
1948 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
1949 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1951 AC_CACHE_CHECK([for broken Perl_load_module()],
1952 [c_cv_have_broken_perl_load_module],
1953 AC_LINK_IFELSE(
1954 AC_LANG_PROGRAM(
1955 [[
1956 #define PERL_NO_GET_CONTEXT
1957 #include <EXTERN.h>
1958 #include <perl.h>
1959 #include <XSUB.h>
1960 ]],
1961 [[
1962 dTHX;
1963 load_module (PERL_LOADMOD_NOIMPORT,
1964 newSVpv ("Collectd::Plugin::FooBar", 24),
1965 Nullsv);
1966 ]]),
1967 [c_cv_have_broken_perl_load_module="no"],
1968 [c_cv_have_broken_perl_load_module="yes"]
1969 )
1970 )
1972 CFLAGS=$SAVE_CFLAGS
1973 LDFLAGS=$SAVE_LDFLAGS
1974 fi
1975 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
1976 test "x$c_cv_have_broken_perl_load_module" = "xyes")
1978 if test "x$with_libperl" = "xyes"
1979 then
1980 SAVE_CFLAGS=$CFLAGS
1981 SAVE_LDFLAGS=$LDFLAGS
1982 CFLAGS="$CFLAGS $PERL_CFLAGS"
1983 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1985 AC_CHECK_MEMBER(
1986 [struct mgvtbl.svt_local],
1987 [have_struct_mgvtbl_svt_local="yes"],
1988 [have_struct_mgvtbl_svt_local="no"],
1989 [
1990 #include <EXTERN.h>
1991 #include <perl.h>
1992 #include <XSUB.h>
1993 ])
1995 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
1996 then
1997 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
1998 [Define if Perl's struct mgvtbl has member svt_local.])
1999 fi
2001 CFLAGS=$SAVE_CFLAGS
2002 LDFLAGS=$SAVE_LDFLAGS
2003 fi
2004 # }}}
2006 # --with-libpq {{{
2007 with_pg_config="pg_config"
2008 with_libpq_includedir=""
2009 with_libpq_libdir=""
2010 with_libpq_cppflags=""
2011 with_libpq_ldflags=""
2012 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2013 [Path to libpq.])],
2014 [
2015 if test "x$withval" = "xno"
2016 then
2017 with_libpq="no"
2018 else if test "x$withval" = "xyes"
2019 then
2020 with_libpq="yes"
2021 else
2022 if test -f "$withval" && test -x "$withval";
2023 then
2024 with_pg_config="$withval"
2025 else if test -x "$withval/bin/pg_config"
2026 then
2027 with_pg_config="$withval/bin/pg_config"
2028 fi; fi
2029 with_libpq="yes"
2030 fi; fi
2031 ],
2032 [
2033 with_libpq="yes"
2034 ])
2035 if test "x$with_libpq" = "xyes"
2036 then
2037 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2038 pg_config_status=$?
2040 if test $pg_config_status -eq 0
2041 then
2042 if test -n "$with_libpq_includedir"; then
2043 for dir in $with_libpq_includedir; do
2044 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2045 done
2046 fi
2047 else
2048 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2049 fi
2051 SAVE_CPPFLAGS="$CPPFLAGS"
2052 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2054 AC_CHECK_HEADERS(libpq-fe.h, [],
2055 [with_libpq="no (libpq-fe.h not found)"], [])
2057 CPPFLAGS="$SAVE_CPPFLAGS"
2058 fi
2059 if test "x$with_libpq" = "xyes"
2060 then
2061 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2062 pg_config_status=$?
2064 if test $pg_config_status -eq 0
2065 then
2066 if test -n "$with_libpq_libdir"; then
2067 for dir in $with_libpq_libdir; do
2068 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2069 done
2070 fi
2071 else
2072 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2073 fi
2075 SAVE_LDFLAGS="$LDFLAGS"
2076 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2078 AC_CHECK_LIB(pq, PQconnectdb,
2079 [with_libpq="yes"],
2080 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2082 LDFLAGS="$SAVE_LDFLAGS"
2083 fi
2084 if test "x$with_libpq" = "xyes"
2085 then
2086 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2087 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2088 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2089 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2090 fi
2091 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2092 # }}}
2094 # --with-libpthread {{{
2095 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2096 [ if test "x$withval" != "xno" \
2097 && test "x$withval" != "xyes"
2098 then
2099 LDFLAGS="$LDFLAGS -L$withval/lib"
2100 CPPFLAGS="$CPPFLAGS -I$withval/include"
2101 with_libpthread="yes"
2102 else
2103 if test "x$withval" = "xno"
2104 then
2105 with_libpthread="no (disabled)"
2106 fi
2107 fi
2108 ], [with_libpthread="yes"])
2109 if test "x$with_libpthread" = "xyes"
2110 then
2111 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2112 fi
2114 if test "x$with_libpthread" = "xyes"
2115 then
2116 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2117 fi
2118 if test "x$with_libpthread" = "xyes"
2119 then
2120 collect_pthread=1
2121 else
2122 collect_pthread=0
2123 fi
2124 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2125 [Wether or not to use pthread (POSIX threads) library])
2126 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2127 # }}}
2129 # --with-librrd {{{
2130 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2131 librrd_cflags=""
2132 librrd_ldflags=""
2133 librrd_threadsafe="yes"
2134 librrd_rrdc_update="no"
2135 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2136 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2137 then
2138 librrd_cflags="-I$withval/include"
2139 librrd_ldflags="-L$withval/lib"
2140 with_librrd="yes"
2141 else
2142 with_librrd="$withval"
2143 fi
2144 ], [with_librrd="yes"])
2145 if test "x$with_librrd" = "xyes"
2146 then
2147 SAVE_CPPFLAGS="$CPPFLAGS"
2148 SAVE_LDFLAGS="$LDFLAGS"
2150 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2151 LDFLAGS="$LDFLAGS $librrd_ldflags"
2153 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2155 CPPFLAGS="$SAVE_CPPFLAGS"
2156 LDFLAGS="$SAVE_LDFLAGS"
2157 fi
2158 if test "x$with_librrd" = "xyes"
2159 then
2160 SAVE_CPPFLAGS="$CPPFLAGS"
2161 SAVE_LDFLAGS="$LDFLAGS"
2163 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2164 LDFLAGS="$LDFLAGS $librrd_ldflags"
2166 AC_CHECK_LIB(rrd_th, rrd_update_r,
2167 [with_librrd="yes"
2168 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2169 ],
2170 [librrd_threadsafe="no"
2171 AC_CHECK_LIB(rrd, rrd_update,
2172 [with_librrd="yes"
2173 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2174 ],
2175 [with_librrd="no (symbol 'rrd_update' not found)"],
2176 [-lm])
2177 ],
2178 [-lm])
2180 if test "x$librrd_threadsafe" = "xyes"
2181 then
2182 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2183 else
2184 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2185 fi
2187 CPPFLAGS="$SAVE_CPPFLAGS"
2188 LDFLAGS="$SAVE_LDFLAGS"
2189 fi
2190 if test "x$with_librrd" = "xyes"
2191 then
2192 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2193 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2194 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2195 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2196 fi
2197 if test "x$librrd_threadsafe" = "xyes"
2198 then
2199 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2200 fi
2201 # }}}
2203 # --with-libsensors {{{
2204 with_sensors_cflags=""
2205 with_sensors_ldflags=""
2206 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2207 [
2208 if test "x$withval" = "xno"
2209 then
2210 with_libsensors="no"
2211 else
2212 with_libsensors="yes"
2213 if test "x$withval" != "xyes"
2214 then
2215 with_sensors_cflags="-I$withval/include"
2216 with_sensors_ldflags="-L$withval/lib"
2217 with_libsensors="yes"
2218 fi
2219 fi
2220 ],
2221 [
2222 if test "x$ac_system" = "xLinux"
2223 then
2224 with_libsensors="yes"
2225 else
2226 with_libsensors="no (Linux only library)"
2227 fi
2228 ])
2229 if test "x$with_libsensors" = "xyes"
2230 then
2231 SAVE_CPPFLAGS="$CPPFLAGS"
2232 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2234 # AC_CHECK_HEADERS(sensors/sensors.h,
2235 # [
2236 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2237 # ],
2238 # [with_libsensors="no (sensors/sensors.h not found)"])
2239 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2241 CPPFLAGS="$SAVE_CPPFLAGS"
2242 fi
2243 if test "x$with_libsensors" = "xyes"
2244 then
2245 SAVE_CPPFLAGS="$CPPFLAGS"
2246 SAVE_LDFLAGS="$LDFLAGS"
2247 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2248 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2250 AC_CHECK_LIB(sensors, sensors_init,
2251 [
2252 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2253 ],
2254 [with_libsensors="no (libsensors not found)"])
2256 CPPFLAGS="$SAVE_CPPFLAGS"
2257 LDFLAGS="$SAVE_LDFLAGS"
2258 fi
2259 if test "x$with_libsensors" = "xyes"
2260 then
2261 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2262 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2263 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2264 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2265 fi
2266 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2267 # }}}
2269 # --with-libstatgrab {{{
2270 with_libstatgrab_cflags=""
2271 with_libstatgrab_ldflags=""
2272 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2273 [
2274 if test "x$withval" != "xno" \
2275 && test "x$withval" != "xyes"
2276 then
2277 with_libstatgrab_cflags="-I$withval/include"
2278 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2279 with_libstatgrab="yes"
2280 with_libstatgrab_pkg_config="no"
2281 else
2282 with_libstatgrab="$withval"
2283 with_libstatgrab_pkg_config="yes"
2284 fi
2285 ],
2286 [
2287 with_libstatgrab="yes"
2288 with_libstatgrab_pkg_config="yes"
2289 ])
2291 if test "x$with_libstatgrab" = "xyes" \
2292 && test "x$with_libstatgrab_pkg_config" = "xyes"
2293 then
2294 if test "x$PKG_CONFIG" != "x"
2295 then
2296 AC_MSG_CHECKING([pkg-config for libstatgrab])
2297 temp_result="found"
2298 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2299 if test "$?" != "0"
2300 then
2301 with_libstatgrab_pkg_config="no"
2302 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2303 temp_result="not found"
2304 fi
2305 AC_MSG_RESULT([$temp_result])
2306 else
2307 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2308 with_libstatgrab_pkg_config="no"
2309 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2310 fi
2311 fi
2313 if test "x$with_libstatgrab" = "xyes" \
2314 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2315 && test "x$with_libstatgrab_cflags" = "x"
2316 then
2317 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2318 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2319 if test "$?" = "0"
2320 then
2321 with_libstatgrab_cflags="$temp_result"
2322 else
2323 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2324 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2325 fi
2326 AC_MSG_RESULT([$temp_result])
2327 fi
2329 if test "x$with_libstatgrab" = "xyes" \
2330 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2331 && test "x$with_libstatgrab_ldflags" = "x"
2332 then
2333 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2334 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2335 if test "$?" = "0"
2336 then
2337 with_libstatgrab_ldflags="$temp_result"
2338 else
2339 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2340 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2341 fi
2342 AC_MSG_RESULT([$temp_result])
2343 fi
2345 if test "x$with_libstatgrab" = "xyes"
2346 then
2347 SAVE_CPPFLAGS="$CPPFLAGS"
2348 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2350 AC_CHECK_HEADERS(statgrab.h,
2351 [with_libstatgrab="yes"],
2352 [with_libstatgrab="no (statgrab.h not found)"])
2354 CPPFLAGS="$SAVE_CPPFLAGS"
2355 fi
2357 if test "x$with_libstatgrab" = "xyes"
2358 then
2359 SAVE_CFLAGS="$CFLAGS"
2360 SAVE_LDFLAGS="$LDFLAGS"
2362 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2363 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2365 AC_CHECK_LIB(statgrab, sg_init,
2366 [with_libstatgrab="yes"],
2367 [with_libstatgrab="no (symbol sg_init not found)"])
2369 CFLAGS="$SAVE_CFLAGS"
2370 LDFLAGS="$SAVE_LDFLAGS"
2371 fi
2373 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2374 if test "x$with_libstatgrab" = "xyes"
2375 then
2376 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2377 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2378 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2379 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2380 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2381 fi
2382 # }}}
2384 # --with-libupsclient {{{
2385 with_libupsclient_config=""
2386 with_libupsclient_cflags=""
2387 with_libupsclient_libs=""
2388 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2389 [
2390 if test "x$withval" = "xno"
2391 then
2392 with_libupsclient="no"
2393 else if test "x$withval" = "xyes"
2394 then
2395 with_libupsclient="use_pkgconfig"
2396 else
2397 if test -x "$withval"
2398 then
2399 with_libupsclient_config="$withval"
2400 with_libupsclient="use_libupsclient_config"
2401 else if test -x "$withval/bin/libupsclient-config"
2402 then
2403 with_libupsclient_config="$withval/bin/net-snmp-config"
2404 with_libupsclient="use_libupsclient_config"
2405 else
2406 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2407 with_libupsclient_cflags="-I$withval/include"
2408 with_libupsclient_libs="-L$withval/lib -lupsclient"
2409 with_libupsclient="yes"
2410 fi; fi
2411 fi; fi
2412 ],
2413 [with_libupsclient="use_pkgconfig"])
2415 # configure using libupsclient-config
2416 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2417 then
2418 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2419 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2420 if test $? -ne 0
2421 then
2422 with_libupsclient="no ($with_libupsclient_config failed)"
2423 fi
2424 with_libupsclient_libs="`$with_libupsclient_config --libs`"
2425 if test $? -ne 0
2426 then
2427 with_libupsclient="no ($with_libupsclient_config failed)"
2428 fi
2429 fi
2430 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2431 then
2432 with_libupsclient="yes"
2433 fi
2435 # configure using pkg-config
2436 if test "x$with_libupsclient" = "xuse_pkgconfig"
2437 then
2438 if test "x$PKG_CONFIG" = "x"
2439 then
2440 with_libupsclient="no (Don't have pkg-config)"
2441 fi
2442 fi
2443 if test "x$with_libupsclient" = "xuse_pkgconfig"
2444 then
2445 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2446 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2447 if test $? -ne 0
2448 then
2449 with_libupsclient="no (pkg-config doesn't know library)"
2450 fi
2451 fi
2452 if test "x$with_libupsclient" = "xuse_pkgconfig"
2453 then
2454 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2455 if test $? -ne 0
2456 then
2457 with_libupsclient="no ($PKG_CONFIG failed)"
2458 fi
2459 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2460 if test $? -ne 0
2461 then
2462 with_libupsclient="no ($PKG_CONFIG failed)"
2463 fi
2464 fi
2465 if test "x$with_libupsclient" = "xuse_pkgconfig"
2466 then
2467 with_libupsclient="yes"
2468 fi
2470 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2471 # the actual checks.
2472 if test "x$with_libupsclient" = "xyes"
2473 then
2474 SAVE_CPPFLAGS="$CPPFLAGS"
2475 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2477 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2479 CPPFLAGS="$SAVE_CPPFLAGS"
2480 fi
2481 if test "x$with_libupsclient" = "xyes"
2482 then
2483 SAVE_CPPFLAGS="$CPPFLAGS"
2484 SAVE_LDFLAGS="$LDFLAGS"
2486 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2487 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2489 AC_CHECK_LIB(upsclient, upscli_connect,
2490 [with_libupsclient="yes"],
2491 [with_libupsclient="no (symbol upscli_connect not found)"])
2493 CPPFLAGS="$SAVE_CPPFLAGS"
2494 LDFLAGS="$SAVE_LDFLAGS"
2495 fi
2496 if test "x$with_libupsclient" = "xyes"
2497 then
2498 SAVE_CPPFLAGS="$CPPFLAGS"
2499 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2501 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2502 [#include <stdlib.h>
2503 #include <stdio.h>
2504 #include <upsclient.h>])
2506 CPPFLAGS="$SAVE_CPPFLAGS"
2507 fi
2508 if test "x$with_libupsclient" = "xyes"
2509 then
2510 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2511 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2512 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2513 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2514 fi
2515 # }}}
2517 # --with-libxmms {{{
2518 with_xmms_config="xmms-config"
2519 with_xmms_cflags=""
2520 with_xmms_libs=""
2521 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2522 [
2523 if test "x$withval" != "xno" \
2524 && test "x$withval" != "xyes"
2525 then
2526 if test -f "$withval" && test -x "$withval";
2527 then
2528 with_xmms_config="$withval"
2529 else if test -x "$withval/bin/xmms-config"
2530 then
2531 with_xmms_config="$withval/bin/xmms-config"
2532 fi; fi
2533 with_libxmms="yes"
2534 else if test "x$withval" = "xno"
2535 then
2536 with_libxmms="no"
2537 else
2538 with_libxmms="yes"
2539 fi; fi
2540 ],
2541 [
2542 with_libxmms="yes"
2543 ])
2544 if test "x$with_libxmms" = "xyes"
2545 then
2546 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2547 xmms_config_status=$?
2549 if test $xmms_config_status -ne 0
2550 then
2551 with_libxmms="no"
2552 fi
2553 fi
2554 if test "x$with_libxmms" = "xyes"
2555 then
2556 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2557 xmms_config_status=$?
2559 if test $xmms_config_status -ne 0
2560 then
2561 with_libxmms="no"
2562 fi
2563 fi
2564 if test "x$with_libxmms" = "xyes"
2565 then
2566 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2567 [
2568 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2569 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2570 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2571 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2572 ],
2573 [
2574 with_libxmms="no"
2575 ],
2576 [$with_xmms_libs])
2577 fi
2578 with_libxmms_numeric=0
2579 if test "x$with_libxmms" = "xyes"
2580 then
2581 with_libxmms_numeric=1
2582 fi
2583 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2584 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2585 # }}}
2587 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2588 with_libxml2="no (pkg-config isn't available)"
2589 with_libxml2_cflags=""
2590 with_libxml2_ldflags=""
2591 with_libvirt="no (pkg-config isn't available)"
2592 with_libvirt_cflags=""
2593 with_libvirt_ldflags=""
2594 if test "x$PKG_CONFIG" != "x"
2595 then
2596 pkg-config --exists 'libxml-2.0' 2>/dev/null
2597 if test "$?" = "0"
2598 then
2599 with_libxml2="yes"
2600 else
2601 with_libxml2="no (pkg-config doesn't know library)"
2602 fi
2604 pkg-config --exists libvirt 2>/dev/null
2605 if test "$?" = "0"
2606 then
2607 with_libvirt="yes"
2608 else
2609 with_libvirt="no (pkg-config doesn't know library)"
2610 fi
2611 fi
2612 if test "x$with_libxml2" = "xyes"
2613 then
2614 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2615 if test $? -ne 0
2616 then
2617 with_libxml2="no"
2618 fi
2619 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2620 if test $? -ne 0
2621 then
2622 with_libxml2="no"
2623 fi
2624 fi
2625 if test "x$with_libxml2" = "xyes"
2626 then
2627 SAVE_CPPFLAGS="$CPPFLAGS"
2628 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2630 AC_CHECK_HEADERS(libxml/parser.h, [],
2631 [with_libxml2="no (libxml/parser.h not found)"])
2633 CPPFLAGS="$SAVE_CPPFLAGS"
2634 fi
2635 if test "x$with_libxml2" = "xyes"
2636 then
2637 SAVE_CFLAGS="$CFLAGS"
2638 SAVE_LDFLAGS="$LDFLAGS"
2640 CFLAGS="$CFLAGS $with_libxml2_cflags"
2641 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2643 AC_CHECK_LIB(xml2, xmlXPathEval,
2644 [with_libxml2="yes"],
2645 [with_libxml2="no (symbol xmlXPathEval not found)"])
2647 CFLAGS="$SAVE_CFLAGS"
2648 LDFLAGS="$SAVE_LDFLAGS"
2649 fi
2650 dnl Add the right compiler flags and libraries.
2651 if test "x$with_libxml2" = "xyes"; then
2652 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2653 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2654 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2655 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2656 fi
2657 if test "x$with_libvirt" = "xyes"
2658 then
2659 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2660 if test $? -ne 0
2661 then
2662 with_libvirt="no"
2663 fi
2664 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2665 if test $? -ne 0
2666 then
2667 with_libvirt="no"
2668 fi
2669 fi
2670 if test "x$with_libvirt" = "xyes"
2671 then
2672 SAVE_CPPFLAGS="$CPPFLAGS"
2673 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2675 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2676 [with_libvirt="no (libvirt/libvirt.h not found)"])
2678 CPPFLAGS="$SAVE_CPPFLAGS"
2679 fi
2680 if test "x$with_libvirt" = "xyes"
2681 then
2682 SAVE_CFLAGS="$CFLAGS"
2683 SAVE_LDFLAGS="$LDFLAGS"
2685 CFLAGS="$CFLAGS $with_libvirt_cflags"
2686 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2688 AC_CHECK_LIB(virt, virDomainBlockStats,
2689 [with_libvirt="yes"],
2690 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2692 CFLAGS="$SAVE_CFLAGS"
2693 LDFLAGS="$SAVE_LDFLAGS"
2694 fi
2695 dnl Add the right compiler flags and libraries.
2696 if test "x$with_libvirt" = "xyes"; then
2697 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2698 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2699 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2700 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2701 fi
2702 # }}}
2704 # $PKG_CONFIG --exists OpenIPMIpthread {{{
2705 with_libopenipmipthread="yes"
2706 with_libopenipmipthread_cflags=""
2707 with_libopenipmipthread_libs=""
2709 AC_MSG_CHECKING([for pkg-config])
2710 temp_result="no"
2711 if test "x$PKG_CONFIG" = "x"
2712 then
2713 with_libopenipmipthread="no"
2714 temp_result="no"
2715 else
2716 temp_result="$PKG_CONFIG"
2717 fi
2718 AC_MSG_RESULT([$temp_result])
2720 if test "x$with_libopenipmipthread" = "xyes"
2721 then
2722 AC_MSG_CHECKING([for libOpenIPMIpthread])
2723 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2724 if test "$?" != "0"
2725 then
2726 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2727 fi
2728 AC_MSG_RESULT([$with_libopenipmipthread])
2729 fi
2731 if test "x$with_libopenipmipthread" = "xyes"
2732 then
2733 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2734 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2735 if test "$?" = "0"
2736 then
2737 with_libopenipmipthread_cflags="$temp_result"
2738 else
2739 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2740 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2741 fi
2742 AC_MSG_RESULT([$temp_result])
2743 fi
2745 if test "x$with_libopenipmipthread" = "xyes"
2746 then
2747 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2748 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2749 if test "$?" = "0"
2750 then
2751 with_libopenipmipthread_ldflags="$temp_result"
2752 else
2753 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2754 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2755 fi
2756 AC_MSG_RESULT([$temp_result])
2757 fi
2759 if test "x$with_libopenipmipthread" = "xyes"
2760 then
2761 SAVE_CPPFLAGS="$CPPFLAGS"
2762 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2764 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2765 [with_libopenipmipthread="yes"],
2766 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2767 [#include <OpenIPMI/ipmiif.h>
2768 #include <OpenIPMI/ipmi_err.h>
2769 #include <OpenIPMI/ipmi_posix.h>
2770 #include <OpenIPMI/ipmi_conn.h>
2771 ])
2773 CPPFLAGS="$SAVE_CPPFLAGS"
2774 fi
2776 if test "x$with_libopenipmipthread" = "xyes"
2777 then
2778 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2779 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2780 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2781 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2782 fi
2783 # }}}
2785 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
2786 [with_libnotify="yes"],
2787 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
2789 # Check for enabled/disabled features
2790 #
2792 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2793 # ------------------------------------------------------------
2794 dnl
2795 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2796 dnl
2797 AC_DEFUN(
2798 [AC_COLLECTD],
2799 [
2800 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2801 m4_if(
2802 [$2],
2803 [enable],
2804 [dnl
2805 m4_define([EnDis],[disabled])dnl
2806 m4_define([YesNo],[no])dnl
2807 ],dnl
2808 [m4_if(
2809 [$2],
2810 [disable],
2811 [dnl
2812 m4_define([EnDis],[enabled])dnl
2813 m4_define([YesNo],[yes])dnl
2814 ],
2815 [dnl
2816 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2817 ]dnl
2818 )]dnl
2819 )dnl
2820 m4_if([$3], [feature], [],
2821 [m4_if(
2822 [$3], [module], [],
2823 [dnl
2824 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2825 ]dnl
2826 )]dnl
2827 )dnl
2828 AC_ARG_ENABLE(
2829 [$1],
2830 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2831 [],
2832 enable_$1='[YesNo]'dnl
2833 )# AC_ARG_ENABLE
2834 if test "x$enable_$1" = "xno"
2835 then
2836 collectd_$1=0
2837 else
2838 if test "x$enable_$1" = "xyes"
2839 then
2840 collectd_$1=1
2841 else
2842 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2843 collectd_$1=1
2844 enable_$1='yes'
2845 fi
2846 fi
2847 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2848 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2849 ]dnl
2850 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2852 # AC_PLUGIN(name, default, info)
2853 # ------------------------------------------------------------
2854 dnl
2855 AC_DEFUN(
2856 [AC_PLUGIN],
2857 [
2858 enable_plugin="no"
2859 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2860 [
2861 if test "x$enableval" = "xyes"
2862 then
2863 enable_plugin="yes"
2864 else
2865 enable_plugin="no"
2866 fi
2867 ],
2868 [
2869 if test "x$2" = "xyes"
2870 then
2871 enable_plugin="yes"
2872 else
2873 enable_plugin="no"
2874 fi
2875 ])
2876 if test "x$enable_plugin" = "xyes"
2877 then
2878 if test "x$2" = "xyes"
2879 then
2880 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2881 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2882 dependency_error="yes"
2883 enable_plugin="no (dependency error)"
2884 fi
2885 fi
2886 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2887 enable_$1="$enable_plugin"
2888 ]
2889 )# AC_PLUGIN(name, default, info)
2891 m4_divert_once([HELP_ENABLE], [
2892 collectd features:])
2893 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2894 AC_COLLECTD([debug], [enable], [feature], [debugging])
2895 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2896 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2898 dependency_error="no"
2899 plugin_ascent="no"
2900 plugin_battery="no"
2901 plugin_bind="no"
2902 plugin_cpu="no"
2903 plugin_cpufreq="no"
2904 plugin_df="no"
2905 plugin_disk="no"
2906 plugin_entropy="no"
2907 plugin_interface="no"
2908 plugin_ipmi="no"
2909 plugin_ipvs="no"
2910 plugin_irq="no"
2911 plugin_libvirt="no"
2912 plugin_load="no"
2913 plugin_memory="no"
2914 plugin_multimeter="no"
2915 plugin_nfs="no"
2916 plugin_perl="no"
2917 plugin_processes="no"
2918 plugin_serial="no"
2919 plugin_swap="no"
2920 plugin_tape="no"
2921 plugin_tcpconns="no"
2922 plugin_thermal="no"
2923 plugin_users="no"
2924 plugin_vmem="no"
2925 plugin_vserver="no"
2926 plugin_wireless="no"
2928 # Linux
2929 if test "x$ac_system" = "xLinux"
2930 then
2931 plugin_battery="yes"
2932 plugin_cpu="yes"
2933 plugin_cpufreq="yes"
2934 plugin_disk="yes"
2935 plugin_entropy="yes"
2936 plugin_interface="yes"
2937 plugin_irq="yes"
2938 plugin_load="yes"
2939 plugin_memory="yes"
2940 plugin_nfs="yes"
2941 plugin_processes="yes"
2942 plugin_serial="yes"
2943 plugin_swap="yes"
2944 plugin_tcpconns="yes"
2945 plugin_thermal="yes"
2946 plugin_vmem="yes"
2947 plugin_vserver="yes"
2948 plugin_wireless="yes"
2950 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2951 then
2952 plugin_ipvs="yes"
2953 fi
2954 fi
2956 if test "x$ac_system" = "xOpenBSD"
2957 then
2958 plugin_tcpconns="yes"
2959 fi
2961 # Mac OS X devices
2962 if test "x$with_libiokit" = "xyes"
2963 then
2964 plugin_battery="yes"
2965 plugin_disk="yes"
2966 fi
2968 # Solaris
2969 if test "x$with_devinfo$with_kstat" = "xyesyes"
2970 then
2971 plugin_cpu="yes"
2972 plugin_disk="yes"
2973 plugin_interface="yes"
2974 plugin_memory="yes"
2975 plugin_tape="yes"
2976 fi
2978 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
2979 then
2980 plugin_swap="yes"
2981 fi
2983 # libstatgrab
2984 if test "x$with_libstatgrab" = "xyes"
2985 then
2986 plugin_cpu="yes"
2987 plugin_disk="yes"
2988 plugin_interface="yes"
2989 plugin_load="yes"
2990 plugin_memory="yes"
2991 plugin_swap="yes"
2992 plugin_users="yes"
2993 fi
2995 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2996 then
2997 plugin_ascent="yes"
2998 plugin_bind="yes"
2999 fi
3001 if test "x$with_libopenipmipthread" = "xyes"
3002 then
3003 plugin_ipmi="yes"
3004 fi
3006 if test "x$have_processor_info" = "xyes"
3007 then
3008 plugin_cpu="yes"
3009 fi
3010 if test "x$have_sysctl" = "xyes"
3011 then
3012 plugin_cpu="yes"
3013 plugin_swap="yes"
3014 fi
3015 if test "x$have_sysctlbyname" = "xyes"
3016 then
3017 plugin_cpu="yes"
3018 plugin_memory="yes"
3019 plugin_tcpconns="yes"
3020 fi
3022 # Df plugin: Check if we know how to determine mount points first.
3023 #if test "x$have_listmntent" = "xyes"; then
3024 # plugin_df="yes"
3025 #fi
3026 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3027 then
3028 plugin_df="yes"
3029 fi
3030 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3031 then
3032 plugin_df="yes"
3033 fi
3034 #if test "x$have_getmntent" = "xseq"
3035 #then
3036 # plugin_df="yes"
3037 #fi
3038 if test "x$c_cv_have_one_getmntent" = "xyes"
3039 then
3040 plugin_df="yes"
3041 fi
3043 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3044 if test "x$plugin_df" = "xyes"
3045 then
3046 plugin_df="no"
3047 if test "x$have_statfs" = "xyes"
3048 then
3049 plugin_df="yes"
3050 fi
3051 if test "x$have_statvfs" = "xyes"
3052 then
3053 plugin_df="yes"
3054 fi
3055 fi
3057 if test "x$have_getifaddrs" = "xyes"
3058 then
3059 plugin_interface="yes"
3060 fi
3062 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3063 then
3064 plugin_libvirt="yes"
3065 fi
3067 if test "x$have_getloadavg" = "xyes"
3068 then
3069 plugin_load="yes"
3070 fi
3072 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3073 then
3074 plugin_perl="yes"
3075 fi
3077 # Mac OS X memory interface
3078 if test "x$have_host_statistics" = "xyes"
3079 then
3080 plugin_memory="yes"
3081 fi
3083 if test "x$have_termios_h" = "xyes"
3084 then
3085 plugin_multimeter="yes"
3086 fi
3088 if test "x$have_thread_info" = "xyes"
3089 then
3090 plugin_processes="yes"
3091 fi
3093 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3094 then
3095 plugin_processes="yes"
3096 fi
3098 if test "x$with_kvm_getswapinfo" = "xyes"
3099 then
3100 plugin_swap="yes"
3101 fi
3103 if test "x$have_swapctl" = "xyes"
3104 then
3105 plugin_swap="yes"
3106 fi
3108 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3109 then
3110 plugin_tcpconns="yes"
3111 fi
3113 if test "x$have_getutent" = "xyes"
3114 then
3115 plugin_users="yes"
3116 fi
3117 if test "x$have_getutxent" = "xyes"
3118 then
3119 plugin_users="yes"
3120 fi
3122 m4_divert_once([HELP_ENABLE], [
3123 collectd plugins:])
3125 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
3126 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
3127 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
3128 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
3129 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
3130 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
3131 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
3132 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
3133 AC_PLUGIN([csv], [yes], [CSV output plugin])
3134 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
3135 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
3136 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
3137 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
3138 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
3139 AC_PLUGIN([email], [yes], [EMail statistics])
3140 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
3141 AC_PLUGIN([exec], [yes], [Execution of external programs])
3142 AC_PLUGIN([filecount], [yes], [Count files in directories])
3143 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
3144 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
3145 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
3146 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
3147 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3148 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
3149 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
3150 AC_PLUGIN([load], [$plugin_load], [System load])
3151 AC_PLUGIN([logfile], [yes], [File logging plugin])
3152 AC_PLUGIN([match_regex], [yes], [The regex match])
3153 AC_PLUGIN([match_timediff], [yes], [The timediff match])
3154 AC_PLUGIN([match_value], [yes], [The value match])
3155 AC_PLUGIN([mbmon], [yes], [Query mbmond])
3156 AC_PLUGIN([memcached], [yes], [memcached statistics])
3157 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
3158 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
3159 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
3160 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3161 AC_PLUGIN([network], [yes], [Network communication plugin])
3162 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
3163 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3164 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3165 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
3166 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
3167 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3168 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
3169 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
3170 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
3171 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
3172 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
3173 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
3174 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
3175 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
3176 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
3177 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
3178 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
3179 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
3180 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
3181 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
3182 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
3183 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3184 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3185 AC_PLUGIN([target_notification], [yes], [The notification target])
3186 AC_PLUGIN([target_replace], [yes], [The replace target])
3187 AC_PLUGIN([target_set], [yes], [The set target])
3188 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3189 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3190 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3191 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3192 AC_PLUGIN([users], [$plugin_users], [User statistics])
3193 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3194 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3195 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3196 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3197 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3199 dnl ip_vs.h
3200 if test "x$ac_system" = "xLinux" \
3201 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3202 then
3203 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3204 fi
3206 dnl Perl bindings
3207 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3208 [
3209 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3210 then
3211 PERL_BINDINGS_OPTIONS="$withval"
3212 with_perl_bindings="yes"
3213 else
3214 PERL_BINDINGS_OPTIONS=""
3215 with_perl_bindings="$withval"
3216 fi
3217 ],
3218 [
3219 PERL_BINDINGS_OPTIONS=""
3220 if test -n "$perl_interpreter"
3221 then
3222 with_perl_bindings="yes"
3223 else
3224 with_perl_bindings="no (no perl interpreter found)"
3225 fi
3226 ])
3227 if test "x$with_perl_bindings" = "xyes"
3228 then
3229 PERL_BINDINGS="perl"
3230 else
3231 PERL_BINDINGS=""
3232 fi
3233 AC_SUBST(PERL_BINDINGS)
3234 AC_SUBST(PERL_BINDINGS_OPTIONS)
3236 dnl libcollectdclient
3237 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3238 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3239 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3241 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3243 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3245 AC_SUBST(LCC_VERSION_MAJOR)
3246 AC_SUBST(LCC_VERSION_MINOR)
3247 AC_SUBST(LCC_VERSION_PATCH)
3248 AC_SUBST(LCC_VERSION_EXTRA)
3249 AC_SUBST(LCC_VERSION_STRING)
3251 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3253 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
3255 if test "x$with_librrd" = "xyes" \
3256 && test "x$librrd_threadsafe" != "xyes"
3257 then
3258 with_librrd="yes (warning: librrd is not thread-safe)"
3259 fi
3261 if test "x$with_liboping" = "xyes" \
3262 && test "x$with_own_liboping" = "xyes"
3263 then
3264 with_liboping="yes (shipped version)"
3265 fi
3267 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3268 then
3269 with_libiptc="yes (shipped version)"
3270 fi
3272 if test "x$with_libperl" = "xyes"
3273 then
3274 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3275 else
3276 enable_perl="no (needs libperl)"
3277 fi
3279 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
3280 then
3281 enable_perl="no (libperl doesn't support ithreads)"
3282 fi
3284 if test "x$with_perl_bindings" = "xyes" \
3285 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3286 then
3287 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3288 fi
3290 cat <<EOF;
3292 Configuration:
3293 Libraries:
3294 libcurl . . . . . . . $with_libcurl
3295 libdbi . . . . . . . $with_libdbi
3296 libesmtp . . . . . . $with_libesmtp
3297 libiokit . . . . . . $with_libiokit
3298 libiptc . . . . . . . $with_libiptc
3299 libkstat . . . . . . $with_kstat
3300 libkvm . . . . . . . $with_libkvm
3301 libmysql . . . . . . $with_libmysql
3302 libnetlink . . . . . $with_libnetlink
3303 libnetsnmp . . . . . $with_libnetsnmp
3304 libnotify . . . . . . $with_libnotify
3305 liboconfig . . . . . $with_liboconfig
3306 libopenipmi . . . . . $with_libopenipmipthread
3307 liboping . . . . . . $with_liboping
3308 libpcap . . . . . . . $with_libpcap
3309 libperl . . . . . . . $with_libperl
3310 libpq . . . . . . . . $with_libpq
3311 libpthread . . . . . $with_libpthread
3312 librrd . . . . . . . $with_librrd
3313 libsensors . . . . . $with_libsensors
3314 libstatgrab . . . . . $with_libstatgrab
3315 libupsclient . . . . $with_libupsclient
3316 libvirt . . . . . . . $with_libvirt
3317 libxml2 . . . . . . . $with_libxml2
3318 libxmms . . . . . . . $with_libxmms
3319 oracle . . . . . . . $with_oracle
3321 Features:
3322 daemon mode . . . . . $enable_daemon
3323 debug . . . . . . . . $enable_debug
3325 Bindings:
3326 perl . . . . . . . . $with_perl_bindings
3328 Modules:
3329 apache . . . . . . . $enable_apache
3330 apcups . . . . . . . $enable_apcups
3331 apple_sensors . . . . $enable_apple_sensors
3332 ascent . . . . . . . $enable_ascent
3333 battery . . . . . . . $enable_battery
3334 bind . . . . . . . . $enable_bind
3335 cpu . . . . . . . . . $enable_cpu
3336 cpufreq . . . . . . . $enable_cpufreq
3337 csv . . . . . . . . . $enable_csv
3338 curl . . . . . . . . $enable_curl
3339 dbi . . . . . . . . . $enable_dbi
3340 df . . . . . . . . . $enable_df
3341 disk . . . . . . . . $enable_disk
3342 dns . . . . . . . . . $enable_dns
3343 email . . . . . . . . $enable_email
3344 entropy . . . . . . . $enable_entropy
3345 exec . . . . . . . . $enable_exec
3346 filecount . . . . . . $enable_filecount
3347 hddtemp . . . . . . . $enable_hddtemp
3348 interface . . . . . . $enable_interface
3349 ipmi . . . . . . . . $enable_ipmi
3350 iptables . . . . . . $enable_iptables
3351 ipvs . . . . . . . . $enable_ipvs
3352 irq . . . . . . . . . $enable_irq
3353 libvirt . . . . . . . $enable_libvirt
3354 load . . . . . . . . $enable_load
3355 logfile . . . . . . . $enable_logfile
3356 match_regex . . . . . $enable_match_regex
3357 match_timediff . . . $enable_match_timediff
3358 match_value . . . . . $enable_match_value
3359 mbmon . . . . . . . . $enable_mbmon
3360 memcached . . . . . . $enable_memcached
3361 memory . . . . . . . $enable_memory
3362 multimeter . . . . . $enable_multimeter
3363 mysql . . . . . . . . $enable_mysql
3364 netlink . . . . . . . $enable_netlink
3365 network . . . . . . . $enable_network
3366 nfs . . . . . . . . . $enable_nfs
3367 nginx . . . . . . . . $enable_nginx
3368 notify_desktop . . . $enable_notify_desktop
3369 notify_email . . . . $enable_notify_email
3370 ntpd . . . . . . . . $enable_ntpd
3371 nut . . . . . . . . . $enable_nut
3372 onewire . . . . . . . $enable_onewire
3373 openvpn . . . . . . . $enable_openvpn
3374 oracle . . . . . . . $enable_oracle
3375 perl . . . . . . . . $enable_perl
3376 ping . . . . . . . . $enable_ping
3377 postgresql . . . . . $enable_postgresql
3378 powerdns . . . . . . $enable_powerdns
3379 processes . . . . . . $enable_processes
3380 rrdcached . . . . . . $enable_rrdcached
3381 rrdtool . . . . . . . $enable_rrdtool
3382 sensors . . . . . . . $enable_sensors
3383 serial . . . . . . . $enable_serial
3384 snmp . . . . . . . . $enable_snmp
3385 swap . . . . . . . . $enable_swap
3386 syslog . . . . . . . $enable_syslog
3387 tail . . . . . . . . $enable_tail
3388 tape . . . . . . . . $enable_tape
3389 target_notification . $enable_target_notification
3390 target_replace . . . $enable_target_replace
3391 target_set . . . . . $enable_target_set
3392 tcpconns . . . . . . $enable_tcpconns
3393 teamspeak2 . . . . . $enable_teamspeak2
3394 thermal . . . . . . . $enable_thermal
3395 unixsock . . . . . . $enable_unixsock
3396 users . . . . . . . . $enable_users
3397 uuid . . . . . . . . $enable_uuid
3398 vmem . . . . . . . . $enable_vmem
3399 vserver . . . . . . . $enable_vserver
3400 wireless . . . . . . $enable_wireless
3401 xmms . . . . . . . . $enable_xmms
3403 EOF
3405 if test "x$dependency_error" = "xyes"; then
3406 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3407 fi
3409 # vim: set fdm=marker :