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