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