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