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