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