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