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)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
8 # libtool >= 2.2
9 [
10 LT_CONFIG_LTDL_DIR([libltdl])
11 LT_INIT([dlopen])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
14 ]
15 ,
16 # libtool <= 1.5
17 [
18 AC_LIBLTDL_CONVENIENCE
19 AC_SUBST(LTDLINCL)
20 AC_SUBST(LIBLTDL)
21 AC_LIBTOOL_DLOPEN
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
24 ]
25 )
27 AM_INIT_AUTOMAKE(dist-bzip2)
28 AC_LANG(C)
30 AC_PREFIX_DEFAULT("/opt/collectd")
32 AC_SYS_LARGEFILE
34 #
35 # Checks for programs.
36 #
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_MAKE_SET
42 AM_PROG_CC_C_O
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
45 AC_DISABLE_STATIC
46 AC_PROG_LIBTOOL
47 AC_PROG_LEX
48 AC_PROG_YACC
49 PKG_PROG_PKG_CONFIG
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
55 case $host_os in
56 *linux*)
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
58 ac_system="Linux"
59 ;;
60 *solaris*)
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
62 ac_system="Solaris"
63 ;;
64 *darwin*)
65 ac_system="Darwin"
66 ;;
67 *openbsd*)
68 ac_system="OpenBSD"
69 ;;
70 *aix*)
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
72 ac_system="AIX"
73 ;;
74 *)
75 ac_system="unknown"
76 esac
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
80 then
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
83 then
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
85 fi
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
89 fi
91 if test "x$ac_system" = "xSolaris"
92 then
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 fi
95 if test "x$ac_system" = "xAIX"
96 then
97 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
98 fi
100 # Where to install .pc files.
101 pkgconfigdir="${libdir}/pkgconfig"
102 AC_SUBST(pkgconfigdir)
104 # Check for standards compliance mode
105 AC_ARG_ENABLE(standards,
106 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
107 [enable_standards="$enableval"],
108 [enable_standards="no"])
109 if test "x$enable_standards" = "xyes"
110 then
111 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
112 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
113 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
114 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
115 if test "x$GCC" = "xyes"
116 then
117 CFLAGS="$CFLAGS -std=c99"
118 fi
119 fi
120 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
122 #
123 # Checks for header files.
124 #
125 AC_HEADER_STDC
126 AC_HEADER_SYS_WAIT
127 AC_HEADER_DIRENT
128 AC_HEADER_STDBOOL
130 AC_CHECK_HEADERS(stdio.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)
132 # For ping library
133 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
134 [#if HAVE_STDINT_H
135 # include <stdint.h>
136 #endif
137 #if HAVE_SYS_TYPES_H
138 # include <sys/types.h>
139 #endif
140 ])
141 AC_CHECK_HEADERS(netinet/in.h, [], [],
142 [#if HAVE_STDINT_H
143 # include <stdint.h>
144 #endif
145 #if HAVE_SYS_TYPES_H
146 # include <sys/types.h>
147 #endif
148 #if HAVE_NETINET_IN_SYSTM_H
149 # include <netinet/in_systm.h>
150 #endif
151 ])
152 AC_CHECK_HEADERS(netinet/ip.h, [], [],
153 [#if HAVE_STDINT_H
154 # include <stdint.h>
155 #endif
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 ])
166 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
167 [#if HAVE_STDINT_H
168 # include <stdint.h>
169 #endif
170 #if HAVE_SYS_TYPES_H
171 # include <sys/types.h>
172 #endif
173 #if HAVE_NETINET_IN_SYSTM_H
174 # include <netinet/in_systm.h>
175 #endif
176 #if HAVE_NETINET_IN_H
177 # include <netinet/in.h>
178 #endif
179 #if HAVE_NETINET_IP_H
180 # include <netinet/ip.h>
181 #endif
182 ])
183 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
184 [#if HAVE_STDINT_H
185 # include <stdint.h>
186 #endif
187 #if HAVE_SYS_TYPES_H
188 # include <sys/types.h>
189 #endif
190 #if HAVE_NETINET_IN_SYSTM_H
191 # include <netinet/in_systm.h>
192 #endif
193 #if HAVE_NETINET_IN_H
194 # include <netinet/in.h>
195 #endif
196 #if HAVE_NETINET_IP_H
197 # include <netinet/ip.h>
198 #endif
199 ])
200 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
201 [#if HAVE_STDINT_H
202 # include <stdint.h>
203 #endif
204 #if HAVE_SYS_TYPES_H
205 # include <sys/types.h>
206 #endif
207 #if HAVE_NETINET_IN_SYSTM_H
208 # include <netinet/in_systm.h>
209 #endif
210 #if HAVE_NETINET_IN_H
211 # include <netinet/in.h>
212 #endif
213 ])
214 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
215 [#if HAVE_STDINT_H
216 # include <stdint.h>
217 #endif
218 #if HAVE_SYS_TYPES_H
219 # include <sys/types.h>
220 #endif
221 #if HAVE_NETINET_IN_SYSTM_H
222 # include <netinet/in_systm.h>
223 #endif
224 #if HAVE_NETINET_IN_H
225 # include <netinet/in.h>
226 #endif
227 #if HAVE_NETINET_IP6_H
228 # include <netinet/ip6.h>
229 #endif
230 ])
231 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
232 [#if HAVE_STDINT_H
233 # include <stdint.h>
234 #endif
235 #if HAVE_SYS_TYPES_H
236 # include <sys/types.h>
237 #endif
238 #if HAVE_NETINET_IN_SYSTM_H
239 # include <netinet/in_systm.h>
240 #endif
241 #if HAVE_NETINET_IN_H
242 # include <netinet/in.h>
243 #endif
244 #if HAVE_NETINET_IP_H
245 # include <netinet/ip.h>
246 #endif
247 ])
248 AC_CHECK_HEADERS(netinet/udp.h, [], [],
249 [#if HAVE_STDINT_H
250 # include <stdint.h>
251 #endif
252 #if HAVE_SYS_TYPES_H
253 # include <sys/types.h>
254 #endif
255 #if HAVE_NETINET_IN_SYSTM_H
256 # include <netinet/in_systm.h>
257 #endif
258 #if HAVE_NETINET_IN_H
259 # include <netinet/in.h>
260 #endif
261 #if HAVE_NETINET_IP_H
262 # include <netinet/ip.h>
263 #endif
264 ])
266 # For cpu modules
267 AC_CHECK_HEADERS(sys/dkstat.h)
268 if test "x$ac_system" = "xDarwin"
269 then
270 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)
271 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
272 fi
273 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
274 [
275 #if HAVE_SYS_TYPES_H
276 # include <sys/types.h>
277 #endif
278 #if HAVE_SYS_PARAM_H
279 # include <sys/param.h>
280 #endif
281 ])
283 AC_MSG_CHECKING([for sysctl kern.cp_times])
284 if test -x /sbin/sysctl
285 then
286 /sbin/sysctl kern.cp_times 2>/dev/null
287 if test $? -eq 0
288 then
289 AC_MSG_RESULT([yes])
290 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
291 [Define if sysctl supports kern.cp_times])
292 else
293 AC_MSG_RESULT([no])
294 fi
295 else
296 AC_MSG_RESULT([no])
297 fi
299 # For hddtemp module
300 AC_CHECK_HEADERS(linux/major.h libgen.h)
302 # For the battery plugin
303 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
304 [
305 #if HAVE_IOKIT_IOKITLIB_H
306 # include <IOKit/IOKitLib.h>
307 #endif
308 #if HAVE_IOKIT_IOTYPES_H
309 # include <IOKit/IOTypes.h>
310 #endif
311 ])
313 # For the swap module
314 have_linux_wireless_h="no"
315 if test "x$ac_system" = "xLinux"
316 then
317 AC_CHECK_HEADERS(linux/wireless.h,
318 [have_linux_wireless_h="yes"],
319 [have_linux_wireless_h="no"],
320 [
321 #include <dirent.h>
322 #include <sys/ioctl.h>
323 #include <sys/socket.h>
324 ])
325 fi
327 # For the swap module
328 have_sys_swap_h="yes"
329 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
330 [
331 #undef _FILE_OFFSET_BITS
332 #undef _LARGEFILE64_SOURCE
333 #if HAVE_SYS_TYPES_H
334 # include <sys/types.h>
335 #endif
336 #if HAVE_SYS_PARAM_H
337 # include <sys/param.h>
338 #endif
339 ])
341 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
342 then
343 hint_64=""
344 if test "x$GCC" = "xyes"
345 then
346 hint_64="CFLAGS='-m64'"
347 else
348 hint_64="CFLAGS='-xarch=v9'"
349 fi
350 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
351 fi
353 # For load module
354 # For the processes plugin
355 # For users module
356 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
358 # For interface plugin
359 AC_CHECK_HEADERS(ifaddrs.h)
360 AC_CHECK_HEADERS(net/if.h, [], [],
361 [
362 #if HAVE_SYS_TYPES_H
363 # include <sys/types.h>
364 #endif
365 #if HAVE_SYS_SOCKET_H
366 # include <sys/socket.h>
367 #endif
368 ])
369 AC_CHECK_HEADERS(linux/if.h, [], [],
370 [
371 #if HAVE_SYS_TYPES_H
372 # include <sys/types.h>
373 #endif
374 #if HAVE_SYS_SOCKET_H
375 # include <sys/socket.h>
376 #endif
377 ])
378 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
379 [
380 #if HAVE_SYS_TYPES_H
381 # include <sys/types.h>
382 #endif
383 #if HAVE_SYS_SOCKET_H
384 # include <sys/socket.h>
385 #endif
386 #if HAVE_LINUX_IF_H
387 # include <linux/if.h>
388 #endif
389 ])
391 # For ipvs module
392 have_linux_ip_vs_h="no"
393 have_net_ip_vs_h="no"
394 have_ip_vs_h="no"
395 ip_vs_h_needs_kernel_cflags="no"
396 if test "x$ac_system" = "xLinux"
397 then
398 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
399 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
400 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
402 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
403 then
404 SAVE_CFLAGS="$CFLAGS"
405 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
407 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
409 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
410 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
411 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
413 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
414 then
415 ip_vs_h_needs_kernel_cflags="yes"
416 fi
418 CFLAGS="$SAVE_CFLAGS"
419 fi
420 fi
421 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
423 # For quota module
424 AC_CHECK_HEADERS(sys/ucred.h, [], [],
425 [
426 #if HAVE_SYS_TYPES_H
427 # include <sys/types.h>
428 #endif
429 #if HAVE_SYS_PARAM_H
430 # include <sys/param.h>
431 #endif
432 ])
434 # For mount interface
435 AC_CHECK_HEADERS(sys/mount.h, [], [],
436 [
437 #if HAVE_SYS_TYPES_H
438 # include <sys/types.h>
439 #endif
440 #if HAVE_SYS_PARAM_H
441 # include <sys/param.h>
442 #endif
443 ])
445 # For the email plugin
446 AC_CHECK_HEADERS(linux/un.h, [], [],
447 [
448 #if HAVE_SYS_SOCKET_H
449 # include <sys/socket.h>
450 #endif
451 ])
453 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)
455 # For the dns plugin
456 AC_CHECK_HEADERS(arpa/nameser.h)
457 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
458 [
459 #if HAVE_ARPA_NAMESER_H
460 # include <arpa/nameser.h>
461 #endif
462 ])
464 AC_CHECK_HEADERS(net/if_arp.h, [], [],
465 [#if HAVE_SYS_SOCKET_H
466 # include <sys/socket.h>
467 #endif
468 ])
469 AC_CHECK_HEADERS(net/ppp_defs.h)
470 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
471 [#if HAVE_NET_PPP_DEFS_H
472 # include <net/ppp_defs.h>
473 #endif
474 ])
475 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
476 [#if HAVE_STDINT_H
477 # include <stdint.h>
478 #endif
479 #if HAVE_SYS_TYPES_H
480 # include <sys/types.h>
481 #endif
482 #if HAVE_SYS_SOCKET_H
483 # include <sys/socket.h>
484 #endif
485 #if HAVE_NET_IF_H
486 # include <net/if.h>
487 #endif
488 #if HAVE_NETINET_IN_H
489 # include <netinet/in.h>
490 #endif
491 ])
493 # For the multimeter plugin
494 have_termios_h="no"
495 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
497 #
498 # Checks for typedefs, structures, and compiler characteristics.
499 #
500 AC_C_CONST
501 AC_TYPE_PID_T
502 AC_TYPE_SIZE_T
503 AC_TYPE_UID_T
504 AC_HEADER_TIME
506 #
507 # Checks for library functions.
508 #
509 AC_PROG_GCC_TRADITIONAL
510 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
512 AC_FUNC_STRERROR_R
514 SAVE_CFLAGS="$CFLAGS"
515 # Emulate behavior of src/Makefile.am
516 if test "x$GCC" = "xyes"
517 then
518 CFLAGS="$CFLAGS -Wall -Werror"
519 fi
521 AC_CACHE_CHECK([for strtok_r],
522 [c_cv_have_strtok_r_default],
523 AC_LINK_IFELSE(
524 AC_LANG_PROGRAM(
525 [[[[
526 #include <stdlib.h>
527 #include <stdio.h>
528 #include <string.h>
529 ]]]],
530 [[[[
531 char buffer[] = "foo,bar,baz";
532 char *token;
533 char *dummy;
534 char *saveptr;
536 dummy = buffer;
537 saveptr = NULL;
538 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
539 {
540 dummy = NULL;
541 printf ("token = %s;\n", token);
542 }
543 ]]]]),
544 [c_cv_have_strtok_r_default="yes"],
545 [c_cv_have_strtok_r_default="no"]
546 )
547 )
549 if test "x$c_cv_have_strtok_r_default" = "xno"
550 then
551 CFLAGS="$CFLAGS -D_REENTRANT=1"
553 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
554 [c_cv_have_strtok_r_reentrant],
555 AC_LINK_IFELSE(
556 AC_LANG_PROGRAM(
557 [[[[
558 #include <stdlib.h>
559 #include <stdio.h>
560 #include <string.h>
561 ]]]],
562 [[[[
563 char buffer[] = "foo,bar,baz";
564 char *token;
565 char *dummy;
566 char *saveptr;
568 dummy = buffer;
569 saveptr = NULL;
570 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
571 {
572 dummy = NULL;
573 printf ("token = %s;\n", token);
574 }
575 ]]]]),
576 [c_cv_have_strtok_r_reentrant="yes"],
577 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
578 )
579 )
580 fi
582 CFLAGS="$SAVE_CFLAGS"
583 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
584 then
585 CFLAGS="$CFLAGS -D_REENTRANT=1"
586 fi
588 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
590 socket_needs_socket="no"
591 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
592 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
594 clock_gettime_needs_rt="no"
595 clock_gettime_needs_posix4="no"
596 have_clock_gettime="no"
597 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
598 if test "x$have_clock_gettime" = "xno"
599 then
600 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
601 have_clock_gettime="yes"])
602 fi
603 if test "x$have_clock_gettime" = "xno"
604 then
605 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
606 have_clock_gettime="yes"])
607 fi
608 if test "x$have_clock_gettime" = "xyes"
609 then
610 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
611 else
612 AC_MSG_WARN(cannot find clock_gettime)
613 fi
615 nanosleep_needs_rt="no"
616 nanosleep_needs_posix4="no"
617 AC_CHECK_FUNCS(nanosleep,
618 [],
619 AC_CHECK_LIB(rt, nanosleep,
620 [nanosleep_needs_rt="yes"],
621 AC_CHECK_LIB(posix4, nanosleep,
622 [nanosleep_needs_posix4="yes"],
623 AC_MSG_ERROR(cannot find nanosleep))))
625 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
626 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
628 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
629 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
630 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
631 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
632 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
633 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
634 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
635 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
636 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
637 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
638 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
639 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
641 # Check for strptime {{{
642 if test "x$GCC" = "xyes"
643 then
644 SAVE_CFLAGS="$CFLAGS"
645 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
646 fi
648 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
649 if test "x$have_strptime" = "xyes"
650 then
651 AC_CACHE_CHECK([whether strptime is exported by default],
652 [c_cv_have_strptime_default],
653 AC_COMPILE_IFELSE(
654 AC_LANG_PROGRAM(
655 [[
656 AC_INCLUDES_DEFAULT
657 #include <time.h>
658 ]],
659 [[
660 struct tm stm;
661 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
662 ]]),
663 [c_cv_have_strptime_default="yes"],
664 [c_cv_have_strptime_default="no"]))
665 fi
666 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
667 then
668 AC_CACHE_CHECK([whether strptime needs standards mode],
669 [c_cv_have_strptime_standards],
670 AC_COMPILE_IFELSE(
671 AC_LANG_PROGRAM(
672 [[
673 #ifndef _ISOC99_SOURCE
674 # define _ISOC99_SOURCE 1
675 #endif
676 #ifndef _POSIX_C_SOURCE
677 # define _POSIX_C_SOURCE 200112L
678 #endif
679 #ifndef _XOPEN_SOURCE
680 # define _XOPEN_SOURCE 500
681 #endif
682 AC_INCLUDES_DEFAULT
683 #include <time.h>
684 ]],
685 [[
686 struct tm stm;
687 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
688 ]]),
689 [c_cv_have_strptime_standards="yes"],
690 [c_cv_have_strptime_standards="no"]))
692 if test "x$c_cv_have_strptime_standards" = "xyes"
693 then
694 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
695 else
696 have_strptime="no"
697 fi
698 fi
700 if test "x$GCC" = "xyes"
701 then
702 CFLAGS="$SAVE_CFLAGS"
703 fi
705 # }}} Check for strptime
707 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
708 if test "x$have_swapctl" = "xyes"; then
709 AC_CACHE_CHECK([whether swapctl takes two arguments],
710 [c_cv_have_swapctl_two_args],
711 AC_COMPILE_IFELSE(
712 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
713 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
714 # undef _FILE_OFFSET_BITS
715 # undef _LARGEFILE64_SOURCE
716 #endif
717 #include <sys/stat.h>
718 #include <sys/swap.h>]],
719 [[
720 int num = swapctl(0, NULL);
721 ]]
722 ),
723 [c_cv_have_swapctl_two_args="yes"],
724 [c_cv_have_swapctl_two_args="no"]
725 )
726 )
727 AC_CACHE_CHECK([whether swapctl takes three arguments],
728 [c_cv_have_swapctl_three_args],
729 AC_COMPILE_IFELSE(
730 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
731 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
732 # undef _FILE_OFFSET_BITS
733 # undef _LARGEFILE64_SOURCE
734 #endif
735 #include <sys/stat.h>
736 #include <sys/swap.h>]],
737 [[
738 int num = swapctl(0, NULL,0);
739 ]]
740 ),
741 [c_cv_have_swapctl_three_args="yes"],
742 [c_cv_have_swapctl_three_args="no"]
743 )
744 )
745 fi
746 # Check for different versions of `swapctl' here..
747 if test "x$have_swapctl" = "xyes"; then
748 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
749 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
750 [Define if the function swapctl exists and takes two arguments.])
751 fi
752 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
753 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
754 [Define if the function swapctl exists and takes three arguments.])
755 fi
756 fi
758 # Check for NAN
759 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
760 [
761 if test "x$withval" = "xno"; then
762 nan_type="none"
763 else if test "x$withval" = "xyes"; then
764 nan_type="zero"
765 else
766 nan_type="$withval"
767 fi; fi
768 ],
769 [nan_type="none"])
770 if test "x$nan_type" = "xnone"; then
771 AC_CACHE_CHECK([whether NAN is defined by default],
772 [c_cv_have_nan_default],
773 AC_COMPILE_IFELSE(
774 AC_LANG_PROGRAM(
775 [[
776 #include <stdlib.h>
777 #include <math.h>
778 static double foo = NAN;
779 ]],
780 [[
781 if (isnan (foo))
782 return 0;
783 else
784 return 1;
785 ]]),
786 [c_cv_have_nan_default="yes"],
787 [c_cv_have_nan_default="no"]
788 )
789 )
790 if test "x$c_cv_have_nan_default" = "xyes"
791 then
792 nan_type="default"
793 fi
794 fi
795 if test "x$nan_type" = "xnone"; then
796 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
797 [c_cv_have_nan_isoc],
798 AC_COMPILE_IFELSE(
799 AC_LANG_PROGRAM(
800 [[
801 #include <stdlib.h>
802 #define __USE_ISOC99 1
803 #include <math.h>
804 static double foo = NAN;
805 ]],
806 [[
807 if (isnan (foo))
808 return 0;
809 else
810 return 1;
811 ]]),
812 [c_cv_have_nan_isoc="yes"],
813 [c_cv_have_nan_isoc="no"]
814 )
815 )
816 if test "x$c_cv_have_nan_isoc" = "xyes"
817 then
818 nan_type="isoc99"
819 fi
820 fi
821 if test "x$nan_type" = "xnone"; then
822 SAVE_LDFLAGS=$LDFLAGS
823 LDFLAGS="$LDFLAGS -lm"
824 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
825 [c_cv_have_nan_zero],
826 AC_RUN_IFELSE(
827 AC_LANG_PROGRAM(
828 [[
829 #include <stdlib.h>
830 #include <math.h>
831 #ifdef NAN
832 # undef NAN
833 #endif
834 #define NAN (0.0 / 0.0)
835 #ifndef isnan
836 # define isnan(f) ((f) != (f))
837 #endif
838 static double foo = NAN;
839 ]],
840 [[
841 if (isnan (foo))
842 return 0;
843 else
844 return 1;
845 ]]),
846 [c_cv_have_nan_zero="yes"],
847 [c_cv_have_nan_zero="no"]
848 )
849 )
850 LDFLAGS=$SAVE_LDFLAGS
851 if test "x$c_cv_have_nan_zero" = "xyes"
852 then
853 nan_type="zero"
854 fi
855 fi
857 if test "x$nan_type" = "xdefault"; then
858 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
859 [Define if NAN is defined by default and can initialize static variables.])
860 else if test "x$nan_type" = "xisoc99"; then
861 AC_DEFINE(NAN_STATIC_ISOC, 1,
862 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
863 else if test "x$nan_type" = "xzero"; then
864 AC_DEFINE(NAN_ZERO_ZERO, 1,
865 [Define if NAN can be defined as (0.0 / 0.0)])
866 else
867 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
868 fi; fi; fi
870 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
871 [
872 if test "x$withval" = "xnothing"; then
873 fp_layout_type="nothing"
874 else if test "x$withval" = "xendianflip"; then
875 fp_layout_type="endianflip"
876 else if test "x$withval" = "xintswap"; then
877 fp_layout_type="intswap"
878 else
879 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
880 fi; fi; fi
881 ],
882 [fp_layout_type="unknown"])
884 if test "x$fp_layout_type" = "xunknown"; then
885 AC_CACHE_CHECK([if doubles are stored in x86 representation],
886 [c_cv_fp_layout_need_nothing],
887 AC_RUN_IFELSE(
888 AC_LANG_PROGRAM(
889 [[[[
890 #include <stdlib.h>
891 #include <stdio.h>
892 #include <string.h>
893 #if HAVE_STDINT_H
894 # include <stdint.h>
895 #endif
896 #if HAVE_INTTYPES_H
897 # include <inttypes.h>
898 #endif
899 #if HAVE_STDBOOL_H
900 # include <stdbool.h>
901 #endif
902 ]]]],
903 [[[[
904 uint64_t i0;
905 uint64_t i1;
906 uint8_t c[8];
907 double d;
909 d = 8.642135e130;
910 memcpy ((void *) &i0, (void *) &d, 8);
912 i1 = i0;
913 memcpy ((void *) c, (void *) &i1, 8);
915 if ((c[0] == 0x2f) && (c[1] == 0x25)
916 && (c[2] == 0xc0) && (c[3] == 0xc7)
917 && (c[4] == 0x43) && (c[5] == 0x2b)
918 && (c[6] == 0x1f) && (c[7] == 0x5b))
919 return (0);
920 else
921 return (1);
922 ]]]]),
923 [c_cv_fp_layout_need_nothing="yes"],
924 [c_cv_fp_layout_need_nothing="no"]
925 )
926 )
927 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
928 fp_layout_type="nothing"
929 fi
930 fi
931 if test "x$fp_layout_type" = "xunknown"; then
932 AC_CACHE_CHECK([if endianflip converts to x86 representation],
933 [c_cv_fp_layout_need_endianflip],
934 AC_RUN_IFELSE(
935 AC_LANG_PROGRAM(
936 [[[[
937 #include <stdlib.h>
938 #include <stdio.h>
939 #include <string.h>
940 #if HAVE_STDINT_H
941 # include <stdint.h>
942 #endif
943 #if HAVE_INTTYPES_H
944 # include <inttypes.h>
945 #endif
946 #if HAVE_STDBOOL_H
947 # include <stdbool.h>
948 #endif
949 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
950 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
951 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
952 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
953 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
954 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
955 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
956 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
957 ]]]],
958 [[[[
959 uint64_t i0;
960 uint64_t i1;
961 uint8_t c[8];
962 double d;
964 d = 8.642135e130;
965 memcpy ((void *) &i0, (void *) &d, 8);
967 i1 = endianflip (i0);
968 memcpy ((void *) c, (void *) &i1, 8);
970 if ((c[0] == 0x2f) && (c[1] == 0x25)
971 && (c[2] == 0xc0) && (c[3] == 0xc7)
972 && (c[4] == 0x43) && (c[5] == 0x2b)
973 && (c[6] == 0x1f) && (c[7] == 0x5b))
974 return (0);
975 else
976 return (1);
977 ]]]]),
978 [c_cv_fp_layout_need_endianflip="yes"],
979 [c_cv_fp_layout_need_endianflip="no"]
980 )
981 )
982 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
983 fp_layout_type="endianflip"
984 fi
985 fi
986 if test "x$fp_layout_type" = "xunknown"; then
987 AC_CACHE_CHECK([if intswap converts to x86 representation],
988 [c_cv_fp_layout_need_intswap],
989 AC_RUN_IFELSE(
990 AC_LANG_PROGRAM(
991 [[[[
992 #include <stdlib.h>
993 #include <stdio.h>
994 #include <string.h>
995 #if HAVE_STDINT_H
996 # include <stdint.h>
997 #endif
998 #if HAVE_INTTYPES_H
999 # include <inttypes.h>
1000 #endif
1001 #if HAVE_STDBOOL_H
1002 # include <stdbool.h>
1003 #endif
1004 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1005 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1006 ]]]],
1007 [[[[
1008 uint64_t i0;
1009 uint64_t i1;
1010 uint8_t c[8];
1011 double d;
1013 d = 8.642135e130;
1014 memcpy ((void *) &i0, (void *) &d, 8);
1016 i1 = intswap (i0);
1017 memcpy ((void *) c, (void *) &i1, 8);
1019 if ((c[0] == 0x2f) && (c[1] == 0x25)
1020 && (c[2] == 0xc0) && (c[3] == 0xc7)
1021 && (c[4] == 0x43) && (c[5] == 0x2b)
1022 && (c[6] == 0x1f) && (c[7] == 0x5b))
1023 return (0);
1024 else
1025 return (1);
1026 ]]]]),
1027 [c_cv_fp_layout_need_intswap="yes"],
1028 [c_cv_fp_layout_need_intswap="no"]
1029 )
1030 )
1031 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1032 fp_layout_type="intswap"
1033 fi
1034 fi
1036 if test "x$fp_layout_type" = "xnothing"; then
1037 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1038 [Define if doubles are stored in x86 representation.])
1039 else if test "x$fp_layout_type" = "xendianflip"; then
1040 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1041 [Define if endianflip is needed to convert to x86 representation.])
1042 else if test "x$fp_layout_type" = "xintswap"; then
1043 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1044 [Define if intswap is needed to convert to x86 representation.])
1045 else
1046 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1047 fi; fi; fi
1049 have_getfsstat="no"
1050 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1051 have_getvfsstat="no"
1052 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1053 have_listmntent="no"
1054 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1056 have_getmntent="no"
1057 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1058 if test "x$have_getmntent" = "xno"; then
1059 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1060 fi
1061 if test "x$have_getmntent" = "xno"; then
1062 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1063 fi
1064 if test "x$have_getmntent" = "xno"; then
1065 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1066 fi
1068 if test "x$have_getmntent" = "xc"; then
1069 AC_CACHE_CHECK([whether getmntent takes one argument],
1070 [c_cv_have_one_getmntent],
1071 AC_COMPILE_IFELSE(
1072 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1073 #include "$srcdir/src/utils_mount.h"]],
1074 [[
1075 FILE *fh;
1076 struct mntent *me;
1077 fh = setmntent ("/etc/mtab", "r");
1078 me = getmntent (fh);
1079 ]]
1080 ),
1081 [c_cv_have_one_getmntent="yes"],
1082 [c_cv_have_one_getmntent="no"]
1083 )
1084 )
1085 AC_CACHE_CHECK([whether getmntent takes two arguments],
1086 [c_cv_have_two_getmntent],
1087 AC_COMPILE_IFELSE(
1088 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1089 #include "$srcdir/src/utils_mount.h"]],
1090 [[
1091 FILE *fh;
1092 struct mnttab mt;
1093 int status;
1094 fh = fopen ("/etc/mnttab", "r");
1095 status = getmntent (fh, &mt);
1096 ]]
1097 ),
1098 [c_cv_have_two_getmntent="yes"],
1099 [c_cv_have_two_getmntent="no"]
1100 )
1101 )
1102 fi
1104 # Check for different versions of `getmntent' here..
1106 if test "x$have_getmntent" = "xc"; then
1107 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1108 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1109 [Define if the function getmntent exists and takes one argument.])
1110 fi
1111 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1112 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1113 [Define if the function getmntent exists and takes two arguments.])
1114 fi
1115 fi
1116 if test "x$have_getmntent" = "xsun"; then
1117 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1118 [Define if the function getmntent exists. It's the version from libsun.])
1119 fi
1120 if test "x$have_getmntent" = "xseq"; then
1121 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1122 [Define if the function getmntent exists. It's the version from libseq.])
1123 fi
1124 if test "x$have_getmntent" = "xgen"; then
1125 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1126 [Define if the function getmntent exists. It's the version from libgen.])
1127 fi
1129 # Check for htonll
1130 AC_MSG_CHECKING([if have htonll defined])
1132 have_htonll="no"
1133 AC_LINK_IFELSE([
1134 AC_LANG_PROGRAM([
1135 #include <sys/types.h>
1136 #include <netinet/in.h>
1137 #if HAVE_INTTYPES_H
1138 # include <inttypes.h>
1139 #endif
1140 ], [
1141 return htonll(0);
1142 ])
1143 ], [
1144 have_htonll="yes"
1145 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1146 ])
1148 AC_MSG_RESULT([$have_htonll])
1150 # Check for structures
1151 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1152 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1153 [],
1154 [
1155 #include <sys/types.h>
1156 #include <sys/socket.h>
1157 #include <net/if.h>
1158 ])
1159 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1160 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1161 [],
1162 [
1163 #include <sys/types.h>
1164 #include <sys/socket.h>
1165 #include <linux/if.h>
1166 #include <linux/netdevice.h>
1167 ])
1169 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1170 [],
1171 [
1172 #include <netinet/in.h>
1173 #include <net/if.h>
1174 ])
1176 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1177 [
1178 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1179 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1180 have_struct_kinfo_proc_freebsd="yes"
1181 ],
1182 [
1183 have_struct_kinfo_proc_freebsd="no"
1184 ],
1185 [
1186 #include <kvm.h>
1187 #include <sys/param.h>
1188 #include <sys/sysctl.h>
1189 #include <sys/user.h>
1190 ])
1192 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1193 [
1194 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1195 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1196 have_struct_kinfo_proc_openbsd="yes"
1197 ],
1198 [
1199 have_struct_kinfo_proc_openbsd="no"
1200 ],
1201 [
1202 #include <sys/param.h>
1203 #include <sys/sysctl.h>
1204 #include <kvm.h>
1205 ])
1207 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1208 [#define _BSD_SOURCE
1209 #if HAVE_STDINT_H
1210 # include <stdint.h>
1211 #endif
1212 #if HAVE_SYS_TYPES_H
1213 # include <sys/types.h>
1214 #endif
1215 #if HAVE_NETINET_IN_SYSTM_H
1216 # include <netinet/in_systm.h>
1217 #endif
1218 #if HAVE_NETINET_IN_H
1219 # include <netinet/in.h>
1220 #endif
1221 #if HAVE_NETINET_IP_H
1222 # include <netinet/ip.h>
1223 #endif
1224 #if HAVE_NETINET_UDP_H
1225 # include <netinet/udp.h>
1226 #endif
1227 ])
1228 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1229 [#define _BSD_SOURCE
1230 #if HAVE_STDINT_H
1231 # include <stdint.h>
1232 #endif
1233 #if HAVE_SYS_TYPES_H
1234 # include <sys/types.h>
1235 #endif
1236 #if HAVE_NETINET_IN_SYSTM_H
1237 # include <netinet/in_systm.h>
1238 #endif
1239 #if HAVE_NETINET_IN_H
1240 # include <netinet/in.h>
1241 #endif
1242 #if HAVE_NETINET_IP_H
1243 # include <netinet/ip.h>
1244 #endif
1245 #if HAVE_NETINET_UDP_H
1246 # include <netinet/udp.h>
1247 #endif
1248 ])
1250 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1251 [],
1252 [],
1253 [
1254 #if HAVE_KSTAT_H
1255 # include <kstat.h>
1256 #endif
1257 ])
1259 #
1260 # Checks for libraries begin here
1261 #
1263 with_libresolv="yes"
1264 AC_CHECK_LIB(resolv, res_search,
1265 [
1266 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1267 ],
1268 [with_libresolv="no"])
1269 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1271 dnl Check for HAL (hardware abstraction library)
1272 with_libhal="yes"
1273 AC_CHECK_LIB(hal,libhal_device_property_exists,
1274 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1275 [with_libhal="no"])
1276 if test "x$with_libhal" = "xyes"; then
1277 if test "x$PKG_CONFIG" != "x"; then
1278 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1279 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1280 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1281 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1282 fi
1283 fi
1285 m4_divert_once([HELP_WITH], [
1286 collectd additional packages:])
1288 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1290 if test "x$ac_system" = "xAIX"
1291 then
1292 with_perfstat="yes"
1293 with_procinfo="yes"
1294 else
1295 with_perfstat="no (AIX only)"
1296 with_procinfo="no (AIX only)"
1297 fi
1299 if test "x$with_perfstat" = "xyes"
1300 then
1301 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1302 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1303 fi
1304 if test "x$with_perfstat" = "xyes"
1305 then
1306 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1307 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1308 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1309 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1310 then
1311 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1312 fi
1313 fi
1314 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1316 # Processes plugin under AIX.
1317 if test "x$with_procinfo" = "xyes"
1318 then
1319 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1320 fi
1321 if test "x$with_procinfo" = "xyes"
1322 then
1323 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1324 fi
1326 if test "x$ac_system" = "xSolaris"
1327 then
1328 with_kstat="yes"
1329 with_devinfo="yes"
1330 else
1331 with_kstat="no (Solaris only)"
1332 with_devinfo="no (Solaris only)"
1333 fi
1335 if test "x$with_kstat" = "xyes"
1336 then
1337 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1338 fi
1339 if test "x$with_kstat" = "xyes"
1340 then
1341 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1342 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1343 fi
1344 if test "x$with_kstat" = "xyes"
1345 then
1346 AC_DEFINE(HAVE_LIBKSTAT, 1,
1347 [Define to 1 if you have the 'kstat' library (-lkstat)])
1348 fi
1349 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1350 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1352 with_libiokit="no"
1353 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1354 [
1355 with_libiokit="yes"
1356 ],
1357 [
1358 with_libiokit="no"
1359 ])
1360 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1362 with_libkvm="no"
1363 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1364 if test "x$with_kvm_getprocs" = "xyes"
1365 then
1366 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1367 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1368 with_libkvm="yes"
1369 fi
1370 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1372 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1373 if test "x$with_kvm_getswapinfo" = "xyes"
1374 then
1375 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1376 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1377 with_libkvm="yes"
1378 fi
1379 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1381 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1382 if test "x$with_kvm_nlist" = "xyes"
1383 then
1384 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1385 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1386 with_libkvm="yes"
1387 fi
1388 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1390 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1391 if test "x$with_kvm_openfiles" = "xyes"
1392 then
1393 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1394 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1395 with_libkvm="yes"
1396 fi
1397 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1399 # --with-libcredis {{{
1400 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1401 [
1402 if test "x$withval" = "xyes"
1403 then
1404 with_libcredis="yes"
1405 else if test "x$withval" = "xno"
1406 then
1407 with_libcredis="no"
1408 else
1409 with_libcredis="yes"
1410 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1411 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1412 fi; fi
1413 ],
1414 [with_libcredis="yes"])
1416 SAVE_CPPFLAGS="$CPPFLAGS"
1417 SAVE_LDFLAGS="$LDFLAGS"
1419 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1420 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1422 if test "x$with_libcredis" = "xyes"
1423 then
1424 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1425 then
1426 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1427 fi
1428 AC_CHECK_HEADERS(credis.h,
1429 [with_libcredis="yes"],
1430 [with_libcredis="no (credis.h not found)"])
1431 fi
1432 if test "x$with_libcredis" = "xyes"
1433 then
1434 if test "x$LIBCREDIS_LDFLAGS" != "x"
1435 then
1436 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1437 fi
1438 AC_CHECK_LIB(credis, credis_info,
1439 [with_libcredis="yes"],
1440 [with_libcredis="no (symbol 'credis_info' not found)"])
1442 fi
1444 CPPFLAGS="$SAVE_CPPFLAGS"
1445 LDFLAGS="$SAVE_LDFLAGS"
1447 if test "x$with_libcredis" = "xyes"
1448 then
1449 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1450 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1451 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1452 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1453 fi
1454 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1455 # }}}
1457 # --with-libcurl {{{
1458 with_curl_config="curl-config"
1459 with_curl_cflags=""
1460 with_curl_libs=""
1461 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1462 [
1463 if test "x$withval" = "xno"
1464 then
1465 with_libcurl="no"
1466 else if test "x$withval" = "xyes"
1467 then
1468 with_libcurl="yes"
1469 else
1470 if test -f "$withval" && test -x "$withval"
1471 then
1472 with_curl_config="$withval"
1473 with_libcurl="yes"
1474 else if test -x "$withval/bin/curl-config"
1475 then
1476 with_curl_config="$withval/bin/curl-config"
1477 with_libcurl="yes"
1478 fi; fi
1479 with_libcurl="yes"
1480 fi; fi
1481 ],
1482 [
1483 with_libcurl="yes"
1484 ])
1485 if test "x$with_libcurl" = "xyes"
1486 then
1487 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1488 curl_config_status=$?
1490 if test $curl_config_status -ne 0
1491 then
1492 with_libcurl="no ($with_curl_config failed)"
1493 else
1494 SAVE_CPPFLAGS="$CPPFLAGS"
1495 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1497 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1499 CPPFLAGS="$SAVE_CPPFLAGS"
1500 fi
1501 fi
1502 if test "x$with_libcurl" = "xyes"
1503 then
1504 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1505 curl_config_status=$?
1507 if test $curl_config_status -ne 0
1508 then
1509 with_libcurl="no ($with_curl_config failed)"
1510 else
1511 AC_CHECK_LIB(curl, curl_easy_init,
1512 [with_libcurl="yes"],
1513 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1514 [$with_curl_libs])
1515 fi
1516 fi
1517 if test "x$with_libcurl" = "xyes"
1518 then
1519 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1520 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1521 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1522 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1523 fi
1524 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1525 # }}}
1527 # --with-libdbi {{{
1528 with_libdbi_cppflags=""
1529 with_libdbi_ldflags=""
1530 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1531 [
1532 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1533 then
1534 with_libdbi_cppflags="-I$withval/include"
1535 with_libdbi_ldflags="-L$withval/lib"
1536 with_libdbi="yes"
1537 else
1538 with_libdbi="$withval"
1539 fi
1540 ],
1541 [
1542 with_libdbi="yes"
1543 ])
1544 if test "x$with_libdbi" = "xyes"
1545 then
1546 SAVE_CPPFLAGS="$CPPFLAGS"
1547 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1549 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1551 CPPFLAGS="$SAVE_CPPFLAGS"
1552 fi
1553 if test "x$with_libdbi" = "xyes"
1554 then
1555 SAVE_CPPFLAGS="$CPPFLAGS"
1556 SAVE_LDFLAGS="$LDFLAGS"
1557 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1558 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1560 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1562 CPPFLAGS="$SAVE_CPPFLAGS"
1563 LDFLAGS="$SAVE_LDFLAGS"
1564 fi
1565 if test "x$with_libdbi" = "xyes"
1566 then
1567 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1568 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1569 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1570 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1571 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1572 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1573 fi
1574 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1575 # }}}
1577 # --with-libesmtp {{{
1578 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1579 [
1580 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1581 then
1582 LDFLAGS="$LDFLAGS -L$withval/lib"
1583 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1584 with_libesmtp="yes"
1585 else
1586 with_libesmtp="$withval"
1587 fi
1588 ],
1589 [
1590 with_libesmtp="yes"
1591 ])
1592 if test "x$with_libesmtp" = "xyes"
1593 then
1594 AC_CHECK_LIB(esmtp, smtp_create_session,
1595 [
1596 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1597 ], [with_libesmtp="no (libesmtp not found)"])
1598 fi
1599 if test "x$with_libesmtp" = "xyes"
1600 then
1601 AC_CHECK_HEADERS(libesmtp.h,
1602 [
1603 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1604 ], [with_libesmtp="no (libesmtp.h not found)"])
1605 fi
1606 if test "x$with_libesmtp" = "xyes"
1607 then
1608 collect_libesmtp=1
1609 else
1610 collect_libesmtp=0
1611 fi
1612 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1613 [Wether or not to use the esmtp library])
1614 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1615 # }}}
1617 # --with-libganglia {{{
1618 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1619 [
1620 if test -f "$withval" && test -x "$withval"
1621 then
1622 with_libganglia_config="$withval"
1623 with_libganglia="yes"
1624 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1625 then
1626 with_libganglia_config="$withval/bin/ganglia-config"
1627 with_libganglia="yes"
1628 else if test -d "$withval"
1629 then
1630 GANGLIA_CPPFLAGS="-I$withval/include"
1631 GANGLIA_LDFLAGS="-L$withval/lib"
1632 with_libganglia="yes"
1633 else
1634 with_libganglia_config="ganglia-config"
1635 with_libganglia="$withval"
1636 fi; fi; fi
1637 ],
1638 [
1639 with_libganglia_config="ganglia-config"
1640 with_libganglia="yes"
1641 ])
1643 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1644 then
1645 if test "x$GANGLIA_CPPFLAGS" = "x"
1646 then
1647 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1648 fi
1650 if test "x$GANGLIA_LDFLAGS" = "x"
1651 then
1652 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1653 fi
1655 if test "x$GANGLIA_LIBS" = "x"
1656 then
1657 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1658 fi
1659 fi
1661 SAVE_CPPFLAGS="$CPPFLAGS"
1662 SAVE_LDFLAGS="$LDFLAGS"
1663 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1664 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1666 if test "x$with_libganglia" = "xyes"
1667 then
1668 AC_CHECK_HEADERS(gm_protocol.h,
1669 [
1670 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1671 [Define to 1 if you have the <gm_protocol.h> header file.])
1672 ], [with_libganglia="no (gm_protocol.h not found)"])
1673 fi
1675 if test "x$with_libganglia" = "xyes"
1676 then
1677 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1678 [
1679 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1680 [Define to 1 if you have the ganglia library (-lganglia).])
1681 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1682 fi
1684 CPPFLAGS="$SAVE_CPPFLAGS"
1685 LDFLAGS="$SAVE_LDFLAGS"
1687 AC_SUBST(GANGLIA_CPPFLAGS)
1688 AC_SUBST(GANGLIA_LDFLAGS)
1689 AC_SUBST(GANGLIA_LIBS)
1690 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1691 # }}}
1693 # --with-libgcrypt {{{
1694 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1695 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1696 GCRYPT_LIBS="$GCRYPT_LIBS"
1697 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1698 [
1699 if test -f "$withval" && test -x "$withval"
1700 then
1701 with_libgcrypt_config="$withval"
1702 with_libgcrypt="yes"
1703 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1704 then
1705 with_libgcrypt_config="$withval/bin/gcrypt-config"
1706 with_libgcrypt="yes"
1707 else if test -d "$withval"
1708 then
1709 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1710 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1711 with_libgcrypt="yes"
1712 else
1713 with_libgcrypt_config="gcrypt-config"
1714 with_libgcrypt="$withval"
1715 fi; fi; fi
1716 ],
1717 [
1718 with_libgcrypt_config="libgcrypt-config"
1719 with_libgcrypt="yes"
1720 ])
1722 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1723 then
1724 if test "x$GCRYPT_CPPFLAGS" = "x"
1725 then
1726 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1727 fi
1729 if test "x$GCRYPT_LDFLAGS" = "x"
1730 then
1731 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1732 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1733 fi
1735 if test "x$GCRYPT_LIBS" = "x"
1736 then
1737 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1738 fi
1739 fi
1741 SAVE_CPPFLAGS="$CPPFLAGS"
1742 SAVE_LDFLAGS="$LDFLAGS"
1743 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1744 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1746 if test "x$with_libgcrypt" = "xyes"
1747 then
1748 if test "x$GCRYPT_CPPFLAGS" != "x"
1749 then
1750 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1751 fi
1752 AC_CHECK_HEADERS(gcrypt.h,
1753 [with_libgcrypt="yes"],
1754 [with_libgcrypt="no (gcrypt.h not found)"])
1755 fi
1757 if test "x$with_libgcrypt" = "xyes"
1758 then
1759 if test "x$GCRYPT_LDFLAGS" != "x"
1760 then
1761 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1762 fi
1763 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1764 [with_libgcrypt="yes"],
1765 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1767 if test "$with_libgcrypt" != "no"; then
1768 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1769 fi
1770 fi
1772 CPPFLAGS="$SAVE_CPPFLAGS"
1773 LDFLAGS="$SAVE_LDFLAGS"
1775 if test "x$with_libgcrypt" = "xyes"
1776 then
1777 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1778 fi
1780 AC_SUBST(GCRYPT_CPPFLAGS)
1781 AC_SUBST(GCRYPT_LDFLAGS)
1782 AC_SUBST(GCRYPT_LIBS)
1783 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1784 # }}}
1786 # --with-libiptc {{{
1787 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1788 [
1789 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1790 then
1791 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1792 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1793 with_libiptc="yes"
1794 else
1795 with_libiptc="$withval"
1796 fi
1797 ],
1798 [
1799 if test "x$ac_system" = "xLinux"
1800 then
1801 with_libiptc="yes"
1802 else
1803 with_libiptc="no (Linux only)"
1804 fi
1805 ])
1806 SAVE_CPPFLAGS="$CPPFLAGS"
1807 SAVE_LDFLAGS="$LDFLAGS"
1808 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1809 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1810 # check whether the header file for libiptc is available.
1811 if test "x$with_libiptc" = "xyes"
1812 then
1813 AC_CHECK_HEADERS(libiptc/libiptc.h,
1814 [with_libiptc="yes"],
1815 [with_libiptc="no (libiptc/libiptc.h not found)"])
1816 fi
1817 if test "x$with_libiptc" = "xyes"
1818 then
1819 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1820 [with_libiptc="yes"],
1821 [with_libiptc="no (libiptc/libip6tc.h not found)"])
1822 fi
1823 # If the header file is available, check for the required type declaractions.
1824 # They may be missing in old versions of libiptc. In that case, they will be
1825 # declared in the iptables plugin.
1826 if test "x$with_libiptc" = "xyes"
1827 then
1828 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1829 [
1830 #include <libiptc/libiptc.h>
1831 #include <libiptc/libip6tc.h>
1832 ])
1833 fi
1834 # Check for the iptc_init symbol in the library.
1835 if test "x$with_libiptc" = "xyes"
1836 then
1837 AC_CHECK_LIB(iptc, iptc_init,
1838 [with_libiptc="yes"],
1839 [with_libiptc="no (symbol 'iptc_init' not found)"])
1840 fi
1841 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1842 if test "x$with_libiptc" = "xyes"
1843 then
1844 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1845 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1846 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1847 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1848 fi
1849 CPPFLAGS="$SAVE_CPPFLAGS"
1850 LDFLAGS="$SAVE_LDFLAGS"
1851 # }}}
1853 # --with-java {{{
1854 with_java_home="$JAVA_HOME"
1855 with_java_vmtype="client"
1856 with_java_cflags=""
1857 with_java_libs=""
1858 JAVAC="$JAVAC"
1859 JAR="$JAR"
1860 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1861 [
1862 if test "x$withval" = "xno"
1863 then
1864 with_java="no"
1865 else if test "x$withval" = "xyes"
1866 then
1867 with_java="yes"
1868 else
1869 with_java_home="$withval"
1870 with_java="yes"
1871 fi; fi
1872 ],
1873 [with_java="yes"])
1874 if test "x$with_java" = "xyes"
1875 then
1876 if test -d "$with_java_home"
1877 then
1878 AC_MSG_CHECKING([for jni.h])
1879 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1880 if test "x$TMPDIR" != "x"
1881 then
1882 AC_MSG_RESULT([found in $TMPDIR])
1883 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1884 else
1885 AC_MSG_RESULT([not found])
1886 fi
1888 AC_MSG_CHECKING([for jni_md.h])
1889 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1890 if test "x$TMPDIR" != "x"
1891 then
1892 AC_MSG_RESULT([found in $TMPDIR])
1893 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1894 else
1895 AC_MSG_RESULT([not found])
1896 fi
1898 AC_MSG_CHECKING([for libjvm.so])
1899 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1900 if test "x$TMPDIR" != "x"
1901 then
1902 AC_MSG_RESULT([found in $TMPDIR])
1903 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1904 else
1905 AC_MSG_RESULT([not found])
1906 fi
1908 if test "x$JAVAC" = "x"
1909 then
1910 AC_MSG_CHECKING([for javac])
1911 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1912 if test "x$TMPDIR" != "x"
1913 then
1914 JAVAC="$TMPDIR"
1915 AC_MSG_RESULT([$JAVAC])
1916 else
1917 AC_MSG_RESULT([not found])
1918 fi
1919 fi
1920 if test "x$JAR" = "x"
1921 then
1922 AC_MSG_CHECKING([for jar])
1923 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1924 if test "x$TMPDIR" != "x"
1925 then
1926 JAR="$TMPDIR"
1927 AC_MSG_RESULT([$JAR])
1928 else
1929 AC_MSG_RESULT([not found])
1930 fi
1931 fi
1932 else if test "x$with_java_home" != "x"
1933 then
1934 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1935 fi; fi
1936 fi
1938 if test "x$JAVA_CPPFLAGS" != "x"
1939 then
1940 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1941 fi
1942 if test "x$JAVA_CFLAGS" != "x"
1943 then
1944 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1945 fi
1946 if test "x$JAVA_LDFLAGS" != "x"
1947 then
1948 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1949 fi
1950 if test "x$JAVAC" = "x"
1951 then
1952 with_javac_path="$PATH"
1953 if test "x$with_java_home" != "x"
1954 then
1955 with_javac_path="$with_java_home:with_javac_path"
1956 if test -d "$with_java_home/bin"
1957 then
1958 with_javac_path="$with_java_home/bin:with_javac_path"
1959 fi
1960 fi
1962 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1963 fi
1964 if test "x$JAVAC" = "x"
1965 then
1966 with_java="no (javac not found)"
1967 fi
1968 if test "x$JAR" = "x"
1969 then
1970 with_jar_path="$PATH"
1971 if test "x$with_java_home" != "x"
1972 then
1973 with_jar_path="$with_java_home:$with_jar_path"
1974 if test -d "$with_java_home/bin"
1975 then
1976 with_jar_path="$with_java_home/bin:$with_jar_path"
1977 fi
1978 fi
1980 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1981 fi
1982 if test "x$JAR" = "x"
1983 then
1984 with_java="no (jar not found)"
1985 fi
1987 SAVE_CPPFLAGS="$CPPFLAGS"
1988 SAVE_CFLAGS="$CFLAGS"
1989 SAVE_LDFLAGS="$LDFLAGS"
1990 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1991 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1992 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1994 if test "x$with_java" = "xyes"
1995 then
1996 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1997 fi
1998 if test "x$with_java" = "xyes"
1999 then
2000 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2001 [with_java="yes"],
2002 [with_java="no (libjvm not found)"],
2003 [$JAVA_LIBS])
2004 fi
2005 if test "x$with_java" = "xyes"
2006 then
2007 JAVA_LIBS="$JAVA_LIBS -ljvm"
2008 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2009 fi
2011 CPPFLAGS="$SAVE_CPPFLAGS"
2012 CFLAGS="$SAVE_CFLAGS"
2013 LDFLAGS="$SAVE_LDFLAGS"
2015 AC_SUBST(JAVA_CPPFLAGS)
2016 AC_SUBST(JAVA_CFLAGS)
2017 AC_SUBST(JAVA_LDFLAGS)
2018 AC_SUBST(JAVA_LIBS)
2019 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2020 # }}}
2022 # --with-libmemcached {{{
2023 with_libmemcached_cppflags=""
2024 with_libmemcached_ldflags=""
2025 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2026 [
2027 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2028 then
2029 with_libmemcached_cppflags="-I$withval/include"
2030 with_libmemcached_ldflags="-L$withval/lib"
2031 with_libmemcached="yes"
2032 else
2033 with_libmemcached="$withval"
2034 fi
2035 ],
2036 [
2037 with_libmemcached="yes"
2038 ])
2039 if test "x$with_libmemcached" = "xyes"
2040 then
2041 SAVE_CPPFLAGS="$CPPFLAGS"
2042 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2044 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2046 CPPFLAGS="$SAVE_CPPFLAGS"
2047 fi
2048 if test "x$with_libmemcached" = "xyes"
2049 then
2050 SAVE_CPPFLAGS="$CPPFLAGS"
2051 SAVE_LDFLAGS="$LDFLAGS"
2052 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2053 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2055 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2057 CPPFLAGS="$SAVE_CPPFLAGS"
2058 LDFLAGS="$SAVE_LDFLAGS"
2059 fi
2060 if test "x$with_libmemcached" = "xyes"
2061 then
2062 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2063 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2064 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2065 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2066 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2067 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2068 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2069 fi
2070 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2071 # }}}
2073 # --with-libmodbus {{{
2074 with_libmodbus_config=""
2075 with_libmodbus_cflags=""
2076 with_libmodbus_libs=""
2077 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2078 [
2079 if test "x$withval" = "xno"
2080 then
2081 with_libmodbus="no"
2082 else if test "x$withval" = "xyes"
2083 then
2084 with_libmodbus="use_pkgconfig"
2085 else if test -d "$with_libmodbus/lib"
2086 then
2087 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2088 with_libmodbus_cflags="-I$withval/include"
2089 with_libmodbus_libs="-L$withval/lib -lmodbus"
2090 with_libmodbus="yes"
2091 fi; fi; fi
2092 ],
2093 [with_libmodbus="use_pkgconfig"])
2095 # configure using pkg-config
2096 if test "x$with_libmodbus" = "xuse_pkgconfig"
2097 then
2098 if test "x$PKG_CONFIG" = "x"
2099 then
2100 with_libmodbus="no (Don't have pkg-config)"
2101 fi
2102 fi
2103 if test "x$with_libmodbus" = "xuse_pkgconfig"
2104 then
2105 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2106 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2107 if test $? -ne 0
2108 then
2109 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2110 fi
2111 fi
2112 if test "x$with_libmodbus" = "xuse_pkgconfig"
2113 then
2114 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2115 if test $? -ne 0
2116 then
2117 with_libmodbus="no ($PKG_CONFIG failed)"
2118 fi
2119 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2120 if test $? -ne 0
2121 then
2122 with_libmodbus="no ($PKG_CONFIG failed)"
2123 fi
2124 fi
2125 if test "x$with_libmodbus" = "xuse_pkgconfig"
2126 then
2127 with_libmodbus="yes"
2128 fi
2130 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2131 # the actual checks.
2132 if test "x$with_libmodbus" = "xyes"
2133 then
2134 SAVE_CPPFLAGS="$CPPFLAGS"
2135 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2137 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2139 CPPFLAGS="$SAVE_CPPFLAGS"
2140 fi
2141 if test "x$with_libmodbus" = "xyes"
2142 then
2143 SAVE_CPPFLAGS="$CPPFLAGS"
2144 SAVE_LDFLAGS="$LDFLAGS"
2146 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2147 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2149 AC_CHECK_LIB(modbus, modbus_connect,
2150 [with_libmodbus="yes"],
2151 [with_libmodbus="no (symbol modbus_connect not found)"])
2153 CPPFLAGS="$SAVE_CPPFLAGS"
2154 LDFLAGS="$SAVE_LDFLAGS"
2155 fi
2156 if test "x$with_libmodbus" = "xyes"
2157 then
2158 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2159 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2160 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2161 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2162 fi
2163 # }}}
2165 # --with-libmongoc {{{
2166 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2167 [
2168 if test "x$withval" = "xyes"
2169 then
2170 with_libmongoc="yes"
2171 else if test "x$withval" = "xno"
2172 then
2173 with_libmongoc="no"
2174 else
2175 with_libmongoc="yes"
2176 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2177 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2178 fi; fi
2179 ],
2180 [with_libmongoc="yes"])
2182 SAVE_CPPFLAGS="$CPPFLAGS"
2183 SAVE_LDFLAGS="$LDFLAGS"
2185 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2186 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2188 if test "x$with_libmongoc" = "xyes"
2189 then
2190 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2191 then
2192 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2193 fi
2194 AC_CHECK_HEADERS(mongo.h,
2195 [with_libmongoc="yes"],
2196 [with_libmongoc="no ('mongo.h' not found)"],
2197 [#if HAVE_STDINT_H
2198 # define MONGO_HAVE_STDINT 1
2199 #else
2200 # define MONGO_USE_LONG_LONG_INT 1
2201 #endif
2202 ])
2203 fi
2204 if test "x$with_libmongoc" = "xyes"
2205 then
2206 if test "x$LIBMONGOC_LDFLAGS" != "x"
2207 then
2208 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2209 fi
2210 AC_CHECK_LIB(mongoc, mongo_run_command,
2211 [with_libmongoc="yes"],
2212 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2213 fi
2215 CPPFLAGS="$SAVE_CPPFLAGS"
2216 LDFLAGS="$SAVE_LDFLAGS"
2218 if test "x$with_libmongoc" = "xyes"
2219 then
2220 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2221 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2222 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2223 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2224 fi
2225 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2226 # }}}
2228 # --with-libmysql {{{
2229 with_mysql_config="mysql_config"
2230 with_mysql_cflags=""
2231 with_mysql_libs=""
2232 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2233 [
2234 if test "x$withval" = "xno"
2235 then
2236 with_libmysql="no"
2237 else if test "x$withval" = "xyes"
2238 then
2239 with_libmysql="yes"
2240 else
2241 if test -f "$withval" && test -x "$withval";
2242 then
2243 with_mysql_config="$withval"
2244 else if test -x "$withval/bin/mysql_config"
2245 then
2246 with_mysql_config="$withval/bin/mysql_config"
2247 fi; fi
2248 with_libmysql="yes"
2249 fi; fi
2250 ],
2251 [
2252 with_libmysql="yes"
2253 ])
2254 if test "x$with_libmysql" = "xyes"
2255 then
2256 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2257 mysql_config_status=$?
2259 if test $mysql_config_status -ne 0
2260 then
2261 with_libmysql="no ($with_mysql_config failed)"
2262 else
2263 SAVE_CPPFLAGS="$CPPFLAGS"
2264 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2266 have_mysql_h="no"
2267 have_mysql_mysql_h="no"
2268 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2270 if test "x$have_mysql_h" = "xno"
2271 then
2272 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2273 fi
2275 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2276 then
2277 with_libmysql="no (mysql.h not found)"
2278 fi
2280 CPPFLAGS="$SAVE_CPPFLAGS"
2281 fi
2282 fi
2283 if test "x$with_libmysql" = "xyes"
2284 then
2285 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2286 mysql_config_status=$?
2288 if test $mysql_config_status -ne 0
2289 then
2290 with_libmysql="no ($with_mysql_config failed)"
2291 else
2292 AC_CHECK_LIB(mysqlclient, mysql_init,
2293 [with_libmysql="yes"],
2294 [with_libmysql="no (symbol 'mysql_init' not found)"],
2295 [$with_mysql_libs])
2297 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2298 [with_libmysql="yes"],
2299 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2300 [$with_mysql_libs])
2301 fi
2302 fi
2303 if test "x$with_libmysql" = "xyes"
2304 then
2305 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2306 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2307 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2308 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2309 fi
2310 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2311 # }}}
2313 # --with-libnetlink {{{
2314 with_libnetlink_cflags=""
2315 with_libnetlink_libs="-lnetlink"
2316 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2317 [
2318 echo "libnetlink: withval = $withval"
2319 if test "x$withval" = "xyes"
2320 then
2321 with_libnetlink="yes"
2322 else if test "x$withval" = "xno"
2323 then
2324 with_libnetlink="no"
2325 else
2326 if test -d "$withval/include"
2327 then
2328 with_libnetlink_cflags="-I$withval/include"
2329 with_libnetlink_libs="-L$withval/lib -lnetlink"
2330 with_libnetlink="yes"
2331 else
2332 AC_MSG_ERROR("no such directory: $withval/include")
2333 fi
2334 fi; fi
2335 ],
2336 [
2337 if test "x$ac_system" = "xLinux"
2338 then
2339 with_libnetlink="yes"
2340 else
2341 with_libnetlink="no (Linux only library)"
2342 fi
2343 ])
2344 if test "x$with_libnetlink" = "xyes"
2345 then
2346 SAVE_CFLAGS="$CFLAGS"
2347 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2349 with_libnetlink="no (libnetlink.h not found)"
2351 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2352 [
2353 with_libnetlink="yes"
2354 break
2355 ], [],
2356 [#include <stdio.h>
2357 #include <sys/types.h>
2358 #include <asm/types.h>
2359 #include <sys/socket.h>
2360 #include <linux/netlink.h>
2361 #include <linux/rtnetlink.h>])
2362 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2363 [#include <stdio.h>
2364 #include <sys/types.h>
2365 #include <asm/types.h>
2366 #include <sys/socket.h>])
2368 AC_COMPILE_IFELSE(
2369 [#include <stdio.h>
2370 #include <sys/types.h>
2371 #include <asm/types.h>
2372 #include <sys/socket.h>
2373 #include <linux/netlink.h>
2374 #include <linux/rtnetlink.h>
2376 int main (void)
2377 {
2378 int retval = TCA_STATS2;
2379 return (retval);
2380 }],
2381 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2382 []);
2384 AC_COMPILE_IFELSE(
2385 [#include <stdio.h>
2386 #include <sys/types.h>
2387 #include <asm/types.h>
2388 #include <sys/socket.h>
2389 #include <linux/netlink.h>
2390 #include <linux/rtnetlink.h>
2392 int main (void)
2393 {
2394 int retval = TCA_STATS;
2395 return (retval);
2396 }],
2397 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2398 []);
2400 CFLAGS="$SAVE_CFLAGS"
2401 fi
2402 if test "x$with_libnetlink" = "xyes"
2403 then
2404 AC_CHECK_LIB(netlink, rtnl_open,
2405 [with_libnetlink="yes"],
2406 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2407 [$with_libnetlink_libs])
2408 fi
2409 if test "x$with_libnetlink" = "xyes"
2410 then
2411 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2412 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2413 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2414 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2415 fi
2416 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2417 # }}}
2419 # --with-libnetapp {{{
2420 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2421 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2422 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2423 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2424 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2425 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2426 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2427 [
2428 if test -d "$withval"
2429 then
2430 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2431 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2432 with_libnetapp="yes"
2433 else
2434 with_libnetapp="$withval"
2435 fi
2436 ],
2437 [
2438 with_libnetapp="yes"
2439 ])
2441 SAVE_CPPFLAGS="$CPPFLAGS"
2442 SAVE_LDFLAGS="$LDFLAGS"
2443 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2444 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2446 if test "x$with_libnetapp" = "xyes"
2447 then
2448 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2449 then
2450 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2451 fi
2452 AC_CHECK_HEADERS(netapp_api.h,
2453 [with_libnetapp="yes"],
2454 [with_libnetapp="no (netapp_api.h not found)"])
2455 fi
2457 if test "x$with_libnetapp" = "xyes"
2458 then
2459 if test "x$LIBNETAPP_LDFLAGS" != "x"
2460 then
2461 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2462 fi
2464 if test "x$LIBNETAPP_LIBS" = "x"
2465 then
2466 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2467 fi
2468 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2470 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2471 [with_libnetapp="yes"],
2472 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2473 [$LIBNETAPP_LIBS])
2474 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2475 fi
2477 CPPFLAGS="$SAVE_CPPFLAGS"
2478 LDFLAGS="$SAVE_LDFLAGS"
2480 if test "x$with_libnetapp" = "xyes"
2481 then
2482 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2483 fi
2485 AC_SUBST(LIBNETAPP_CPPFLAGS)
2486 AC_SUBST(LIBNETAPP_LDFLAGS)
2487 AC_SUBST(LIBNETAPP_LIBS)
2488 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2489 # }}}
2491 # --with-libnetsnmp {{{
2492 with_snmp_config="net-snmp-config"
2493 with_snmp_cflags=""
2494 with_snmp_libs=""
2495 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2496 [
2497 if test "x$withval" = "xno"
2498 then
2499 with_libnetsnmp="no"
2500 else if test "x$withval" = "xyes"
2501 then
2502 with_libnetsnmp="yes"
2503 else
2504 if test -x "$withval"
2505 then
2506 with_snmp_config="$withval"
2507 with_libnetsnmp="yes"
2508 else
2509 with_snmp_config="$withval/bin/net-snmp-config"
2510 with_libnetsnmp="yes"
2511 fi
2512 fi; fi
2513 ],
2514 [with_libnetsnmp="yes"])
2515 if test "x$with_libnetsnmp" = "xyes"
2516 then
2517 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2518 snmp_config_status=$?
2520 if test $snmp_config_status -ne 0
2521 then
2522 with_libnetsnmp="no ($with_snmp_config failed)"
2523 else
2524 SAVE_CPPFLAGS="$CPPFLAGS"
2525 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2527 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2529 CPPFLAGS="$SAVE_CPPFLAGS"
2530 fi
2531 fi
2532 if test "x$with_libnetsnmp" = "xyes"
2533 then
2534 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2535 snmp_config_status=$?
2537 if test $snmp_config_status -ne 0
2538 then
2539 with_libnetsnmp="no ($with_snmp_config failed)"
2540 else
2541 AC_CHECK_LIB(netsnmp, init_snmp,
2542 [with_libnetsnmp="yes"],
2543 [with_libnetsnmp="no (libnetsnmp not found)"],
2544 [$with_snmp_libs])
2545 fi
2546 fi
2547 if test "x$with_libnetsnmp" = "xyes"
2548 then
2549 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2550 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2551 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2552 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2553 fi
2554 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2555 # }}}
2557 # --with-liboconfig {{{
2558 with_own_liboconfig="no"
2559 liboconfig_LDFLAGS="$LDFLAGS"
2560 liboconfig_CPPFLAGS="$CPPFLAGS"
2561 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2562 [
2563 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2564 then
2565 if test -d "$withval/lib"
2566 then
2567 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2568 fi
2569 if test -d "$withval/include"
2570 then
2571 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2572 fi
2573 fi
2574 if test "x$withval" = "xno"
2575 then
2576 AC_MSG_ERROR("liboconfig is required")
2577 fi
2578 ],
2579 [
2580 with_liboconfig="yes"
2581 ])
2583 save_LDFLAGS="$LDFLAGS"
2584 save_CPPFLAGS="$CPPFLAGS"
2585 LDFLAGS="$liboconfig_LDFLAGS"
2586 CPPFLAGS="$liboconfig_CPPFLAGS"
2587 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2588 [
2589 with_liboconfig="yes"
2590 with_own_liboconfig="no"
2591 ],
2592 [
2593 with_liboconfig="yes"
2594 with_own_liboconfig="yes"
2595 LDFLAGS="$save_LDFLAGS"
2596 CPPFLAGS="$save_CPPFLAGS"
2597 ])
2599 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2600 if test "x$with_own_liboconfig" = "xyes"
2601 then
2602 with_liboconfig="yes (shipped version)"
2603 fi
2604 # }}}
2606 # --with-liboping {{{
2607 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2608 [
2609 if test "x$withval" = "xyes"
2610 then
2611 with_liboping="yes"
2612 else if test "x$withval" = "xno"
2613 then
2614 with_liboping="no"
2615 else
2616 with_liboping="yes"
2617 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2618 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2619 fi; fi
2620 ],
2621 [with_liboping="yes"])
2623 SAVE_CPPFLAGS="$CPPFLAGS"
2624 SAVE_LDFLAGS="$LDFLAGS"
2626 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2627 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2629 if test "x$with_liboping" = "xyes"
2630 then
2631 if test "x$LIBOPING_CPPFLAGS" != "x"
2632 then
2633 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2634 fi
2635 AC_CHECK_HEADERS(oping.h,
2636 [with_liboping="yes"],
2637 [with_liboping="no (oping.h not found)"])
2638 fi
2639 if test "x$with_liboping" = "xyes"
2640 then
2641 if test "x$LIBOPING_LDFLAGS" != "x"
2642 then
2643 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2644 fi
2645 AC_CHECK_LIB(oping, ping_construct,
2646 [with_liboping="yes"],
2647 [with_liboping="no (symbol 'ping_construct' not found)"])
2648 fi
2650 CPPFLAGS="$SAVE_CPPFLAGS"
2651 LDFLAGS="$SAVE_LDFLAGS"
2653 if test "x$with_liboping" = "xyes"
2654 then
2655 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2656 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2657 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2658 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2659 fi
2660 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2661 # }}}
2663 # --with-oracle {{{
2664 with_oracle_cppflags=""
2665 with_oracle_libs=""
2666 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2667 [
2668 if test "x$withval" = "xyes"
2669 then
2670 if test "x$ORACLE_HOME" = "x"
2671 then
2672 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2673 fi
2674 with_oracle="yes"
2675 else if test "x$withval" = "xno"
2676 then
2677 with_oracle="no"
2678 else
2679 with_oracle="yes"
2680 ORACLE_HOME="$withval"
2681 fi; fi
2682 ],
2683 [
2684 if test "x$ORACLE_HOME" = "x"
2685 then
2686 with_oracle="no (ORACLE_HOME is not set)"
2687 else
2688 with_oracle="yes"
2689 fi
2690 ])
2691 if test "x$ORACLE_HOME" != "x"
2692 then
2693 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2695 if test -e "$ORACLE_HOME/lib/ldflags"
2696 then
2697 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2698 fi
2699 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2700 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2701 fi
2702 if test "x$with_oracle" = "xyes"
2703 then
2704 SAVE_CPPFLAGS="$CPPFLAGS"
2705 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2707 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2709 CPPFLAGS="$SAVE_CPPFLAGS"
2710 fi
2711 if test "x$with_oracle" = "xyes"
2712 then
2713 SAVE_CPPFLAGS="$CPPFLAGS"
2714 SAVE_LDFLAGS="$LDFLAGS"
2715 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2716 LDFLAGS="$LDFLAGS $with_oracle_libs"
2718 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2720 CPPFLAGS="$SAVE_CPPFLAGS"
2721 LDFLAGS="$SAVE_LDFLAGS"
2722 fi
2723 if test "x$with_oracle" = "xyes"
2724 then
2725 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2726 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2727 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2728 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2729 fi
2730 # }}}
2732 # --with-libowcapi {{{
2733 with_libowcapi_cppflags=""
2734 with_libowcapi_libs="-lowcapi"
2735 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2736 [
2737 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2738 then
2739 with_libowcapi_cppflags="-I$withval/include"
2740 with_libowcapi_libs="-L$withval/lib -lowcapi"
2741 with_libowcapi="yes"
2742 else
2743 with_libowcapi="$withval"
2744 fi
2745 ],
2746 [
2747 with_libowcapi="yes"
2748 ])
2749 if test "x$with_libowcapi" = "xyes"
2750 then
2751 SAVE_CPPFLAGS="$CPPFLAGS"
2752 CPPFLAGS="$with_libowcapi_cppflags"
2754 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2756 CPPFLAGS="$SAVE_CPPFLAGS"
2757 fi
2758 if test "x$with_libowcapi" = "xyes"
2759 then
2760 SAVE_LDFLAGS="$LDFLAGS"
2761 SAVE_CPPFLAGS="$CPPFLAGS"
2762 LDFLAGS="$with_libowcapi_libs"
2763 CPPFLAGS="$with_libowcapi_cppflags"
2765 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2767 LDFLAGS="$SAVE_LDFLAGS"
2768 CPPFLAGS="$SAVE_CPPFLAGS"
2769 fi
2770 if test "x$with_libowcapi" = "xyes"
2771 then
2772 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2773 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2774 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2775 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2776 fi
2777 # }}}
2779 # --with-libpcap {{{
2780 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2781 [
2782 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2783 then
2784 LDFLAGS="$LDFLAGS -L$withval/lib"
2785 CPPFLAGS="$CPPFLAGS -I$withval/include"
2786 with_libpcap="yes"
2787 else
2788 with_libpcap="$withval"
2789 fi
2790 ],
2791 [
2792 with_libpcap="yes"
2793 ])
2794 if test "x$with_libpcap" = "xyes"
2795 then
2796 AC_CHECK_LIB(pcap, pcap_open_live,
2797 [
2798 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2799 ], [with_libpcap="no (libpcap not found)"])
2800 fi
2801 if test "x$with_libpcap" = "xyes"
2802 then
2803 AC_CHECK_HEADERS(pcap.h,,
2804 [with_libpcap="no (pcap.h not found)"])
2805 fi
2806 if test "x$with_libpcap" = "xyes"
2807 then
2808 AC_CHECK_HEADERS(pcap-bpf.h,,
2809 [with_libpcap="no (pcap-bpf.h not found)"])
2810 fi
2811 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2812 # }}}
2814 # --with-libperl {{{
2815 perl_interpreter="perl"
2816 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2817 [
2818 if test -x "$withval"
2819 then
2820 perl_interpreter="$withval"
2821 with_libperl="yes"
2822 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2823 then
2824 LDFLAGS="$LDFLAGS -L$withval/lib"
2825 CPPFLAGS="$CPPFLAGS -I$withval/include"
2826 perl_interpreter="$withval/bin/perl"
2827 with_libperl="yes"
2828 else
2829 with_libperl="$withval"
2830 fi; fi
2831 ],
2832 [
2833 with_libperl="yes"
2834 ])
2836 AC_MSG_CHECKING([for perl])
2837 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2838 if test -x "$perl_interpreter"
2839 then
2840 AC_MSG_RESULT([yes ($perl_interpreter)])
2841 else
2842 perl_interpreter=""
2843 AC_MSG_RESULT([no])
2844 fi
2846 AC_SUBST(PERL, "$perl_interpreter")
2848 if test "x$with_libperl" = "xyes" \
2849 && test -n "$perl_interpreter"
2850 then
2851 SAVE_CFLAGS="$CFLAGS"
2852 SAVE_LDFLAGS="$LDFLAGS"
2853 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2854 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2855 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2856 CFLAGS="$CFLAGS $PERL_CFLAGS"
2857 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2859 AC_CACHE_CHECK([for libperl],
2860 [c_cv_have_libperl],
2861 AC_LINK_IFELSE(
2862 AC_LANG_PROGRAM(
2863 [[
2864 #define PERL_NO_GET_CONTEXT
2865 #include <EXTERN.h>
2866 #include <perl.h>
2867 #include <XSUB.h>
2868 ]],
2869 [[
2870 dTHX;
2871 load_module (PERL_LOADMOD_NOIMPORT,
2872 newSVpv ("Collectd::Plugin::FooBar", 24),
2873 Nullsv);
2874 ]]),
2875 [c_cv_have_libperl="yes"],
2876 [c_cv_have_libperl="no"]
2877 )
2878 )
2880 if test "x$c_cv_have_libperl" = "xyes"
2881 then
2882 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2883 AC_SUBST(PERL_CFLAGS)
2884 AC_SUBST(PERL_LDFLAGS)
2885 else
2886 with_libperl="no"
2887 fi
2889 CFLAGS="$SAVE_CFLAGS"
2890 LDFLAGS="$SAVE_LDFLAGS"
2891 else if test -z "$perl_interpreter"; then
2892 with_libperl="no (no perl interpreter found)"
2893 c_cv_have_libperl="no"
2894 fi; fi
2895 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2897 if test "x$with_libperl" = "xyes"
2898 then
2899 SAVE_CFLAGS="$CFLAGS"
2900 SAVE_LDFLAGS="$LDFLAGS"
2901 CFLAGS="$CFLAGS $PERL_CFLAGS"
2902 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2904 AC_CACHE_CHECK([if perl supports ithreads],
2905 [c_cv_have_perl_ithreads],
2906 AC_LINK_IFELSE(
2907 AC_LANG_PROGRAM(
2908 [[
2909 #include <EXTERN.h>
2910 #include <perl.h>
2911 #include <XSUB.h>
2913 #if !defined(USE_ITHREADS)
2914 # error "Perl does not support ithreads!"
2915 #endif /* !defined(USE_ITHREADS) */
2916 ]],
2917 [[ ]]),
2918 [c_cv_have_perl_ithreads="yes"],
2919 [c_cv_have_perl_ithreads="no"]
2920 )
2921 )
2923 if test "x$c_cv_have_perl_ithreads" = "xyes"
2924 then
2925 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2926 fi
2928 CFLAGS="$SAVE_CFLAGS"
2929 LDFLAGS="$SAVE_LDFLAGS"
2930 fi
2932 if test "x$with_libperl" = "xyes"
2933 then
2934 SAVE_CFLAGS="$CFLAGS"
2935 SAVE_LDFLAGS="$LDFLAGS"
2936 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2937 # (see issues #41 and #42)
2938 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2939 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2941 AC_CACHE_CHECK([for broken Perl_load_module()],
2942 [c_cv_have_broken_perl_load_module],
2943 AC_LINK_IFELSE(
2944 AC_LANG_PROGRAM(
2945 [[
2946 #define PERL_NO_GET_CONTEXT
2947 #include <EXTERN.h>
2948 #include <perl.h>
2949 #include <XSUB.h>
2950 ]],
2951 [[
2952 dTHX;
2953 load_module (PERL_LOADMOD_NOIMPORT,
2954 newSVpv ("Collectd::Plugin::FooBar", 24),
2955 Nullsv);
2956 ]]),
2957 [c_cv_have_broken_perl_load_module="no"],
2958 [c_cv_have_broken_perl_load_module="yes"]
2959 )
2960 )
2962 CFLAGS="$SAVE_CFLAGS"
2963 LDFLAGS="$SAVE_LDFLAGS"
2964 fi
2965 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2966 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2968 if test "x$with_libperl" = "xyes"
2969 then
2970 SAVE_CFLAGS="$CFLAGS"
2971 SAVE_LDFLAGS="$LDFLAGS"
2972 CFLAGS="$CFLAGS $PERL_CFLAGS"
2973 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2975 AC_CHECK_MEMBER(
2976 [struct mgvtbl.svt_local],
2977 [have_struct_mgvtbl_svt_local="yes"],
2978 [have_struct_mgvtbl_svt_local="no"],
2979 [
2980 #include <EXTERN.h>
2981 #include <perl.h>
2982 #include <XSUB.h>
2983 ])
2985 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2986 then
2987 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2988 [Define if Perl's struct mgvtbl has member svt_local.])
2989 fi
2991 CFLAGS="$SAVE_CFLAGS"
2992 LDFLAGS="$SAVE_LDFLAGS"
2993 fi
2994 # }}}
2996 # --with-libpq {{{
2997 with_pg_config="pg_config"
2998 with_libpq_includedir=""
2999 with_libpq_libdir=""
3000 with_libpq_cppflags=""
3001 with_libpq_ldflags=""
3002 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3003 [Path to libpq.])],
3004 [
3005 if test "x$withval" = "xno"
3006 then
3007 with_libpq="no"
3008 else if test "x$withval" = "xyes"
3009 then
3010 with_libpq="yes"
3011 else
3012 if test -f "$withval" && test -x "$withval";
3013 then
3014 with_pg_config="$withval"
3015 else if test -x "$withval/bin/pg_config"
3016 then
3017 with_pg_config="$withval/bin/pg_config"
3018 fi; fi
3019 with_libpq="yes"
3020 fi; fi
3021 ],
3022 [
3023 with_libpq="yes"
3024 ])
3025 if test "x$with_libpq" = "xyes"
3026 then
3027 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3028 pg_config_status=$?
3030 if test $pg_config_status -eq 0
3031 then
3032 if test -n "$with_libpq_includedir"; then
3033 for dir in $with_libpq_includedir; do
3034 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3035 done
3036 fi
3037 else
3038 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3039 fi
3041 SAVE_CPPFLAGS="$CPPFLAGS"
3042 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3044 AC_CHECK_HEADERS(libpq-fe.h, [],
3045 [with_libpq="no (libpq-fe.h not found)"], [])
3047 CPPFLAGS="$SAVE_CPPFLAGS"
3048 fi
3049 if test "x$with_libpq" = "xyes"
3050 then
3051 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3052 pg_config_status=$?
3054 if test $pg_config_status -eq 0
3055 then
3056 if test -n "$with_libpq_libdir"; then
3057 for dir in $with_libpq_libdir; do
3058 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3059 done
3060 fi
3061 else
3062 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3063 fi
3065 SAVE_LDFLAGS="$LDFLAGS"
3066 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3068 AC_CHECK_LIB(pq, PQconnectdb,
3069 [with_libpq="yes"],
3070 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3072 AC_CHECK_LIB(pq, PQserverVersion,
3073 [with_libpq="yes"],
3074 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3076 LDFLAGS="$SAVE_LDFLAGS"
3077 fi
3078 if test "x$with_libpq" = "xyes"
3079 then
3080 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3081 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3082 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3083 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3084 fi
3085 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3086 # }}}
3088 # --with-libpthread {{{
3089 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3090 [ if test "x$withval" != "xno" \
3091 && test "x$withval" != "xyes"
3092 then
3093 LDFLAGS="$LDFLAGS -L$withval/lib"
3094 CPPFLAGS="$CPPFLAGS -I$withval/include"
3095 with_libpthread="yes"
3096 else
3097 if test "x$withval" = "xno"
3098 then
3099 with_libpthread="no (disabled)"
3100 fi
3101 fi
3102 ], [with_libpthread="yes"])
3103 if test "x$with_libpthread" = "xyes"
3104 then
3105 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3106 fi
3108 if test "x$with_libpthread" = "xyes"
3109 then
3110 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3111 fi
3112 if test "x$with_libpthread" = "xyes"
3113 then
3114 collect_pthread=1
3115 else
3116 collect_pthread=0
3117 fi
3118 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3119 [Wether or not to use pthread (POSIX threads) library])
3120 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3121 # }}}
3123 # --with-python {{{
3124 with_python_prog=""
3125 with_python_path="$PATH"
3126 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3127 [
3128 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3129 then
3130 with_python="$withval"
3131 else if test -x "$withval"
3132 then
3133 with_python_prog="$withval"
3134 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3135 with_python="yes"
3136 else if test -d "$withval"
3137 then
3138 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3139 with_python="yes"
3140 else
3141 AC_MSG_WARN([Argument not recognized: $withval])
3142 fi; fi; fi
3143 ], [with_python="yes"])
3145 SAVE_PATH="$PATH"
3146 SAVE_CPPFLAGS="$CPPFLAGS"
3147 SAVE_LDFLAGS="$LDFLAGS"
3148 SAVE_LIBS="$LIBS"
3150 PATH="$with_python_path"
3152 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3153 then
3154 AC_MSG_CHECKING([for python])
3155 with_python_prog="`which python 2>/dev/null`"
3156 if test "x$with_python_prog" = "x"
3157 then
3158 AC_MSG_RESULT([not found])
3159 with_python="no (interpreter not found)"
3160 else
3161 AC_MSG_RESULT([$with_python_prog])
3162 fi
3163 fi
3165 if test "x$with_python" = "xyes"
3166 then
3167 AC_MSG_CHECKING([for Python CPPFLAGS])
3168 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3169 python_config_status=$?
3171 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3172 then
3173 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3174 with_python="no"
3175 else
3176 AC_MSG_RESULT([$python_include_path])
3177 fi
3178 fi
3180 if test "x$with_python" = "xyes"
3181 then
3182 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3183 AC_CHECK_HEADERS(Python.h,
3184 [with_python="yes"],
3185 [with_python="no ('Python.h' not found)"])
3186 fi
3188 if test "x$with_python" = "xyes"
3189 then
3190 AC_MSG_CHECKING([for Python LDFLAGS])
3191 python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
3192 python_config_status=$?
3194 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3195 then
3196 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3197 with_python="no"
3198 else
3199 AC_MSG_RESULT([$python_library_path])
3200 fi
3201 fi
3203 if test "x$with_python" = "xyes"
3204 then
3205 AC_MSG_CHECKING([for Python LIBS])
3206 python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3207 python_config_status=$?
3209 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3210 then
3211 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3212 with_python="no"
3213 else
3214 AC_MSG_RESULT([$python_library_flags])
3215 fi
3216 fi
3218 if test "x$with_python" = "xyes"
3219 then
3220 LDFLAGS="-L$python_library_path $LDFLAGS"
3221 LIBS="$python_library_flags $LIBS"
3223 AC_CHECK_FUNC(PyObject_CallFunction,
3224 [with_python="yes"],
3225 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3226 fi
3228 PATH="$SAVE_PATH"
3229 CPPFLAGS="$SAVE_CPPFLAGS"
3230 LDFLAGS="$SAVE_LDFLAGS"
3231 LIBS="$SAVE_LIBS"
3233 if test "x$with_python" = "xyes"
3234 then
3235 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3236 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3237 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3238 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3239 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3240 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3241 fi
3242 # }}} --with-python
3244 # --with-librabbitmq {{{
3245 with_librabbitmq_cppflags=""
3246 with_librabbitmq_ldflags=""
3247 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3248 [
3249 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3250 then
3251 with_librabbitmq_cppflags="-I$withval/include"
3252 with_librabbitmq_ldflags="-L$withval/lib"
3253 with_librabbitmq="yes"
3254 else
3255 with_librabbitmq="$withval"
3256 fi
3257 ],
3258 [
3259 with_librabbitmq="yes"
3260 ])
3261 if test "x$with_librabbitmq" = "xyes"
3262 then
3263 SAVE_CPPFLAGS="$CPPFLAGS"
3264 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3266 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3268 CPPFLAGS="$SAVE_CPPFLAGS"
3269 fi
3270 if test "x$with_librabbitmq" = "xyes"
3271 then
3272 SAVE_CPPFLAGS="$CPPFLAGS"
3273 SAVE_LDFLAGS="$LDFLAGS"
3274 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3275 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3277 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3279 CPPFLAGS="$SAVE_CPPFLAGS"
3280 LDFLAGS="$SAVE_LDFLAGS"
3281 fi
3282 if test "x$with_librabbitmq" = "xyes"
3283 then
3284 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3285 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3286 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3287 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3288 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3289 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3290 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3291 fi
3292 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3293 # }}}
3295 # --with-librouteros {{{
3296 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3297 [
3298 if test "x$withval" = "xyes"
3299 then
3300 with_librouteros="yes"
3301 else if test "x$withval" = "xno"
3302 then
3303 with_librouteros="no"
3304 else
3305 with_librouteros="yes"
3306 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3307 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3308 fi; fi
3309 ],
3310 [with_librouteros="yes"])
3312 SAVE_CPPFLAGS="$CPPFLAGS"
3313 SAVE_LDFLAGS="$LDFLAGS"
3315 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3316 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3318 if test "x$with_librouteros" = "xyes"
3319 then
3320 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3321 then
3322 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3323 fi
3324 AC_CHECK_HEADERS(routeros_api.h,
3325 [with_librouteros="yes"],
3326 [with_librouteros="no (routeros_api.h not found)"])
3327 fi
3328 if test "x$with_librouteros" = "xyes"
3329 then
3330 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3331 then
3332 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3333 fi
3334 AC_CHECK_LIB(routeros, ros_interface,
3335 [with_librouteros="yes"],
3336 [with_librouteros="no (symbol 'ros_interface' not found)"])
3337 fi
3339 CPPFLAGS="$SAVE_CPPFLAGS"
3340 LDFLAGS="$SAVE_LDFLAGS"
3342 if test "x$with_librouteros" = "xyes"
3343 then
3344 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3345 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3346 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3347 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3348 fi
3349 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3350 # }}}
3352 # --with-librrd {{{
3353 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3354 librrd_cflags=""
3355 librrd_ldflags=""
3356 librrd_threadsafe="yes"
3357 librrd_rrdc_update="no"
3358 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3359 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3360 then
3361 librrd_cflags="-I$withval/include"
3362 librrd_ldflags="-L$withval/lib"
3363 with_librrd="yes"
3364 else
3365 with_librrd="$withval"
3366 fi
3367 ], [with_librrd="yes"])
3368 if test "x$with_librrd" = "xyes"
3369 then
3370 SAVE_CPPFLAGS="$CPPFLAGS"
3371 SAVE_LDFLAGS="$LDFLAGS"
3373 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3374 LDFLAGS="$LDFLAGS $librrd_ldflags"
3376 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3378 CPPFLAGS="$SAVE_CPPFLAGS"
3379 LDFLAGS="$SAVE_LDFLAGS"
3380 fi
3381 if test "x$with_librrd" = "xyes"
3382 then
3383 SAVE_CPPFLAGS="$CPPFLAGS"
3384 SAVE_LDFLAGS="$LDFLAGS"
3386 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3387 LDFLAGS="$LDFLAGS $librrd_ldflags"
3389 AC_CHECK_LIB(rrd_th, rrd_update_r,
3390 [with_librrd="yes"
3391 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3392 ],
3393 [librrd_threadsafe="no"
3394 AC_CHECK_LIB(rrd, rrd_update,
3395 [with_librrd="yes"
3396 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3397 ],
3398 [with_librrd="no (symbol 'rrd_update' not found)"],
3399 [-lm])
3400 ],
3401 [-lm])
3403 if test "x$librrd_threadsafe" = "xyes"
3404 then
3405 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3406 else
3407 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3408 fi
3410 CPPFLAGS="$SAVE_CPPFLAGS"
3411 LDFLAGS="$SAVE_LDFLAGS"
3412 fi
3413 if test "x$with_librrd" = "xyes"
3414 then
3415 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3416 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3417 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3418 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3419 fi
3420 if test "x$librrd_threadsafe" = "xyes"
3421 then
3422 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3423 fi
3424 # }}}
3426 # --with-libsensors {{{
3427 with_sensors_cflags=""
3428 with_sensors_ldflags=""
3429 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3430 [
3431 if test "x$withval" = "xno"
3432 then
3433 with_libsensors="no"
3434 else
3435 with_libsensors="yes"
3436 if test "x$withval" != "xyes"
3437 then
3438 with_sensors_cflags="-I$withval/include"
3439 with_sensors_ldflags="-L$withval/lib"
3440 with_libsensors="yes"
3441 fi
3442 fi
3443 ],
3444 [
3445 if test "x$ac_system" = "xLinux"
3446 then
3447 with_libsensors="yes"
3448 else
3449 with_libsensors="no (Linux only library)"
3450 fi
3451 ])
3452 if test "x$with_libsensors" = "xyes"
3453 then
3454 SAVE_CPPFLAGS="$CPPFLAGS"
3455 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3457 # AC_CHECK_HEADERS(sensors/sensors.h,
3458 # [
3459 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3460 # ],
3461 # [with_libsensors="no (sensors/sensors.h not found)"])
3462 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3464 CPPFLAGS="$SAVE_CPPFLAGS"
3465 fi
3466 if test "x$with_libsensors" = "xyes"
3467 then
3468 SAVE_CPPFLAGS="$CPPFLAGS"
3469 SAVE_LDFLAGS="$LDFLAGS"
3470 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3471 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3473 AC_CHECK_LIB(sensors, sensors_init,
3474 [
3475 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3476 ],
3477 [with_libsensors="no (libsensors not found)"])
3479 CPPFLAGS="$SAVE_CPPFLAGS"
3480 LDFLAGS="$SAVE_LDFLAGS"
3481 fi
3482 if test "x$with_libsensors" = "xyes"
3483 then
3484 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3485 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3486 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3487 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3488 fi
3489 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3490 # }}}
3492 # --with-libstatgrab {{{
3493 with_libstatgrab_cflags=""
3494 with_libstatgrab_ldflags=""
3495 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3496 [
3497 if test "x$withval" != "xno" \
3498 && test "x$withval" != "xyes"
3499 then
3500 with_libstatgrab_cflags="-I$withval/include"
3501 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3502 with_libstatgrab="yes"
3503 with_libstatgrab_pkg_config="no"
3504 else
3505 with_libstatgrab="$withval"
3506 with_libstatgrab_pkg_config="yes"
3507 fi
3508 ],
3509 [
3510 with_libstatgrab="yes"
3511 with_libstatgrab_pkg_config="yes"
3512 ])
3514 if test "x$with_libstatgrab" = "xyes" \
3515 && test "x$with_libstatgrab_pkg_config" = "xyes"
3516 then
3517 if test "x$PKG_CONFIG" != "x"
3518 then
3519 AC_MSG_CHECKING([pkg-config for libstatgrab])
3520 temp_result="found"
3521 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3522 if test "$?" != "0"
3523 then
3524 with_libstatgrab_pkg_config="no"
3525 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3526 temp_result="not found"
3527 fi
3528 AC_MSG_RESULT([$temp_result])
3529 else
3530 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3531 with_libstatgrab_pkg_config="no"
3532 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3533 fi
3534 fi
3536 if test "x$with_libstatgrab" = "xyes" \
3537 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3538 && test "x$with_libstatgrab_cflags" = "x"
3539 then
3540 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3541 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3542 if test "$?" = "0"
3543 then
3544 with_libstatgrab_cflags="$temp_result"
3545 else
3546 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3547 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3548 fi
3549 AC_MSG_RESULT([$temp_result])
3550 fi
3552 if test "x$with_libstatgrab" = "xyes" \
3553 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3554 && test "x$with_libstatgrab_ldflags" = "x"
3555 then
3556 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3557 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3558 if test "$?" = "0"
3559 then
3560 with_libstatgrab_ldflags="$temp_result"
3561 else
3562 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3563 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3564 fi
3565 AC_MSG_RESULT([$temp_result])
3566 fi
3568 if test "x$with_libstatgrab" = "xyes"
3569 then
3570 SAVE_CPPFLAGS="$CPPFLAGS"
3571 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3573 AC_CHECK_HEADERS(statgrab.h,
3574 [with_libstatgrab="yes"],
3575 [with_libstatgrab="no (statgrab.h not found)"])
3577 CPPFLAGS="$SAVE_CPPFLAGS"
3578 fi
3580 if test "x$with_libstatgrab" = "xyes"
3581 then
3582 SAVE_CFLAGS="$CFLAGS"
3583 SAVE_LDFLAGS="$LDFLAGS"
3585 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3586 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3588 AC_CHECK_LIB(statgrab, sg_init,
3589 [with_libstatgrab="yes"],
3590 [with_libstatgrab="no (symbol sg_init not found)"])
3592 CFLAGS="$SAVE_CFLAGS"
3593 LDFLAGS="$SAVE_LDFLAGS"
3594 fi
3596 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3597 if test "x$with_libstatgrab" = "xyes"
3598 then
3599 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3600 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3601 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3602 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3603 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3604 fi
3605 # }}}
3607 # --with-libtokyotyrant {{{
3608 with_libtokyotyrant_cppflags=""
3609 with_libtokyotyrant_ldflags=""
3610 with_libtokyotyrant_libs=""
3611 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3612 [
3613 if test "x$withval" = "xno"
3614 then
3615 with_libtokyotyrant="no"
3616 else if test "x$withval" = "xyes"
3617 then
3618 with_libtokyotyrant="yes"
3619 else
3620 with_libtokyotyrant_cppflags="-I$withval/include"
3621 with_libtokyotyrant_ldflags="-L$withval/include"
3622 with_libtokyotyrant_libs="-ltokyotyrant"
3623 with_libtokyotyrant="yes"
3624 fi; fi
3625 ],
3626 [
3627 with_libtokyotyrant="yes"
3628 ])
3630 if test "x$with_libtokyotyrant" = "xyes"
3631 then
3632 if $PKG_CONFIG --exists tokyotyrant
3633 then
3634 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3635 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3636 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3637 fi
3638 fi
3640 SAVE_CPPFLAGS="$CPPFLAGS"
3641 SAVE_LDFLAGS="$LDFLAGS"
3642 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3643 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3645 if test "x$with_libtokyotyrant" = "xyes"
3646 then
3647 AC_CHECK_HEADERS(tcrdb.h,
3648 [
3649 AC_DEFINE(HAVE_TCRDB_H, 1,
3650 [Define to 1 if you have the <tcrdb.h> header file.])
3651 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3652 fi
3654 if test "x$with_libtokyotyrant" = "xyes"
3655 then
3656 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3657 [
3658 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3659 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3660 ],
3661 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3662 [$with_libtokyotyrant_libs])
3663 fi
3665 CPPFLAGS="$SAVE_CPPFLAGS"
3666 LDFLAGS="$SAVE_LDFLAGS"
3668 if test "x$with_libtokyotyrant" = "xyes"
3669 then
3670 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3671 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3672 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3673 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3674 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3675 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3676 fi
3677 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3678 # }}}
3680 # --with-libupsclient {{{
3681 with_libupsclient_config=""
3682 with_libupsclient_cflags=""
3683 with_libupsclient_libs=""
3684 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3685 [
3686 if test "x$withval" = "xno"
3687 then
3688 with_libupsclient="no"
3689 else if test "x$withval" = "xyes"
3690 then
3691 with_libupsclient="use_pkgconfig"
3692 else
3693 if test -x "$withval"
3694 then
3695 with_libupsclient_config="$withval"
3696 with_libupsclient="use_libupsclient_config"
3697 else if test -x "$withval/bin/libupsclient-config"
3698 then
3699 with_libupsclient_config="$withval/bin/libupsclient-config"
3700 with_libupsclient="use_libupsclient_config"
3701 else
3702 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3703 with_libupsclient_cflags="-I$withval/include"
3704 with_libupsclient_libs="-L$withval/lib -lupsclient"
3705 with_libupsclient="yes"
3706 fi; fi
3707 fi; fi
3708 ],
3709 [with_libupsclient="use_pkgconfig"])
3711 # configure using libupsclient-config
3712 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3713 then
3714 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3715 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3716 if test $? -ne 0
3717 then
3718 with_libupsclient="no ($with_libupsclient_config failed)"
3719 fi
3720 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3721 if test $? -ne 0
3722 then
3723 with_libupsclient="no ($with_libupsclient_config failed)"
3724 fi
3725 fi
3726 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3727 then
3728 with_libupsclient="yes"
3729 fi
3731 # configure using pkg-config
3732 if test "x$with_libupsclient" = "xuse_pkgconfig"
3733 then
3734 if test "x$PKG_CONFIG" = "x"
3735 then
3736 with_libupsclient="no (Don't have pkg-config)"
3737 fi
3738 fi
3739 if test "x$with_libupsclient" = "xuse_pkgconfig"
3740 then
3741 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3742 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3743 if test $? -ne 0
3744 then
3745 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3746 fi
3747 fi
3748 if test "x$with_libupsclient" = "xuse_pkgconfig"
3749 then
3750 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3751 if test $? -ne 0
3752 then
3753 with_libupsclient="no ($PKG_CONFIG failed)"
3754 fi
3755 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3756 if test $? -ne 0
3757 then
3758 with_libupsclient="no ($PKG_CONFIG failed)"
3759 fi
3760 fi
3761 if test "x$with_libupsclient" = "xuse_pkgconfig"
3762 then
3763 with_libupsclient="yes"
3764 fi
3766 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3767 # the actual checks.
3768 if test "x$with_libupsclient" = "xyes"
3769 then
3770 SAVE_CPPFLAGS="$CPPFLAGS"
3771 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3773 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3775 CPPFLAGS="$SAVE_CPPFLAGS"
3776 fi
3777 if test "x$with_libupsclient" = "xyes"
3778 then
3779 SAVE_CPPFLAGS="$CPPFLAGS"
3780 SAVE_LDFLAGS="$LDFLAGS"
3782 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3783 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3785 AC_CHECK_LIB(upsclient, upscli_connect,
3786 [with_libupsclient="yes"],
3787 [with_libupsclient="no (symbol upscli_connect not found)"])
3789 CPPFLAGS="$SAVE_CPPFLAGS"
3790 LDFLAGS="$SAVE_LDFLAGS"
3791 fi
3792 if test "x$with_libupsclient" = "xyes"
3793 then
3794 SAVE_CPPFLAGS="$CPPFLAGS"
3795 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3797 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3798 [#include <stdlib.h>
3799 #include <stdio.h>
3800 #include <upsclient.h>])
3802 CPPFLAGS="$SAVE_CPPFLAGS"
3803 fi
3804 if test "x$with_libupsclient" = "xyes"
3805 then
3806 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3807 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3808 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3809 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3810 fi
3811 # }}}
3813 # --with-libxmms {{{
3814 with_xmms_config="xmms-config"
3815 with_xmms_cflags=""
3816 with_xmms_libs=""
3817 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3818 [
3819 if test "x$withval" != "xno" \
3820 && test "x$withval" != "xyes"
3821 then
3822 if test -f "$withval" && test -x "$withval";
3823 then
3824 with_xmms_config="$withval"
3825 else if test -x "$withval/bin/xmms-config"
3826 then
3827 with_xmms_config="$withval/bin/xmms-config"
3828 fi; fi
3829 with_libxmms="yes"
3830 else if test "x$withval" = "xno"
3831 then
3832 with_libxmms="no"
3833 else
3834 with_libxmms="yes"
3835 fi; fi
3836 ],
3837 [
3838 with_libxmms="yes"
3839 ])
3840 if test "x$with_libxmms" = "xyes"
3841 then
3842 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3843 xmms_config_status=$?
3845 if test $xmms_config_status -ne 0
3846 then
3847 with_libxmms="no"
3848 fi
3849 fi
3850 if test "x$with_libxmms" = "xyes"
3851 then
3852 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3853 xmms_config_status=$?
3855 if test $xmms_config_status -ne 0
3856 then
3857 with_libxmms="no"
3858 fi
3859 fi
3860 if test "x$with_libxmms" = "xyes"
3861 then
3862 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3863 [
3864 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3865 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3866 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3867 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3868 ],
3869 [
3870 with_libxmms="no"
3871 ],
3872 [$with_xmms_libs])
3873 fi
3874 with_libxmms_numeric=0
3875 if test "x$with_libxmms" = "xyes"
3876 then
3877 with_libxmms_numeric=1
3878 fi
3879 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3880 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3881 # }}}
3883 # --with-libyajl {{{
3884 with_libyajl_cppflags=""
3885 with_libyajl_ldflags=""
3886 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3887 [
3888 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3889 then
3890 with_libyajl_cppflags="-I$withval/include"
3891 with_libyajl_ldflags="-L$withval/lib"
3892 with_libyajl="yes"
3893 else
3894 with_libyajl="$withval"
3895 fi
3896 ],
3897 [
3898 with_libyajl="yes"
3899 ])
3900 if test "x$with_libyajl" = "xyes"
3901 then
3902 SAVE_CPPFLAGS="$CPPFLAGS"
3903 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3905 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3906 AC_CHECK_HEADERS(yajl/yajl_version.h)
3908 CPPFLAGS="$SAVE_CPPFLAGS"
3909 fi
3910 if test "x$with_libyajl" = "xyes"
3911 then
3912 SAVE_CPPFLAGS="$CPPFLAGS"
3913 SAVE_LDFLAGS="$LDFLAGS"
3914 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3915 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3917 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3919 CPPFLAGS="$SAVE_CPPFLAGS"
3920 LDFLAGS="$SAVE_LDFLAGS"
3921 fi
3922 if test "x$with_libyajl" = "xyes"
3923 then
3924 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3925 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3926 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3927 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3928 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3929 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3930 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3931 fi
3932 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3933 # }}}
3935 # --with-libvarnish {{{
3936 with_libvarnish_cppflags=""
3937 with_libvarnish_cflags=""
3938 with_libvarnish_libs=""
3939 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
3940 [
3941 if test "x$withval" = "xno"
3942 then
3943 with_libvarnish="no"
3944 else if test "x$withval" = "xyes"
3945 then
3946 with_libvarnish="use_pkgconfig"
3947 else if test -d "$with_libvarnish/lib"
3948 then
3949 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
3950 with_libvarnish_cflags="-I$withval/include"
3951 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
3952 with_libvarnish="yes"
3953 fi; fi; fi
3954 ],
3955 [with_libvarnish="use_pkgconfig"])
3957 # configure using pkg-config
3958 if test "x$with_libvarnish" = "xuse_pkgconfig"
3959 then
3960 if test "x$PKG_CONFIG" = "x"
3961 then
3962 with_libvarnish="no (Don't have pkg-config)"
3963 fi
3964 fi
3965 if test "x$with_libvarnish" = "xuse_pkgconfig"
3966 then
3967 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
3968 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
3969 if test $? -ne 0
3970 then
3971 with_libvarnish="no (pkg-config doesn't know varnishapi)"
3972 fi
3973 fi
3974 if test "x$with_libvarnish" = "xuse_pkgconfig"
3975 then
3976 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
3977 if test $? -ne 0
3978 then
3979 with_libvarnish="no ($PKG_CONFIG failed)"
3980 fi
3981 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
3982 if test $? -ne 0
3983 then
3984 with_libvarnish="no ($PKG_CONFIG failed)"
3985 fi
3986 fi
3987 if test "x$with_libvarnish" = "xuse_pkgconfig"
3988 then
3989 with_libvarnish="yes"
3990 fi
3992 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
3993 # the actual checks.
3994 if test "x$with_libvarnish" = "xyes"
3995 then
3996 SAVE_CPPFLAGS="$CPPFLAGS"
3997 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3998 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4000 CPPFLAGS="$SAVE_CPPFLAGS"
4001 fi
4002 if test "x$with_libvarnish" = "xyes"
4003 then
4004 SAVE_CPPFLAGS="$CPPFLAGS"
4005 #SAVE_LDFLAGS="$LDFLAGS"
4007 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4008 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4010 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
4011 [with_libvarnish="yes"],
4012 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
4013 [$with_libvarnish_libs])
4015 CPPFLAGS="$SAVE_CPPFLAGS"
4016 #LDFLAGS="$SAVE_LDFLAGS"
4017 fi
4018 if test "x$with_libvarnish" = "xyes"
4019 then
4020 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4021 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4022 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4023 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4024 fi
4025 # }}}
4027 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4028 with_libxml2="no (pkg-config isn't available)"
4029 with_libxml2_cflags=""
4030 with_libxml2_ldflags=""
4031 with_libvirt="no (pkg-config isn't available)"
4032 with_libvirt_cflags=""
4033 with_libvirt_ldflags=""
4034 if test "x$PKG_CONFIG" != "x"
4035 then
4036 pkg-config --exists 'libxml-2.0' 2>/dev/null
4037 if test "$?" = "0"
4038 then
4039 with_libxml2="yes"
4040 else
4041 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4042 fi
4044 pkg-config --exists libvirt 2>/dev/null
4045 if test "$?" = "0"
4046 then
4047 with_libvirt="yes"
4048 else
4049 with_libvirt="no (pkg-config doesn't know libvirt)"
4050 fi
4051 fi
4052 if test "x$with_libxml2" = "xyes"
4053 then
4054 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4055 if test $? -ne 0
4056 then
4057 with_libxml2="no"
4058 fi
4059 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4060 if test $? -ne 0
4061 then
4062 with_libxml2="no"
4063 fi
4064 fi
4065 if test "x$with_libxml2" = "xyes"
4066 then
4067 SAVE_CPPFLAGS="$CPPFLAGS"
4068 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4070 AC_CHECK_HEADERS(libxml/parser.h, [],
4071 [with_libxml2="no (libxml/parser.h not found)"])
4073 CPPFLAGS="$SAVE_CPPFLAGS"
4074 fi
4075 if test "x$with_libxml2" = "xyes"
4076 then
4077 SAVE_CFLAGS="$CFLAGS"
4078 SAVE_LDFLAGS="$LDFLAGS"
4080 CFLAGS="$CFLAGS $with_libxml2_cflags"
4081 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4083 AC_CHECK_LIB(xml2, xmlXPathEval,
4084 [with_libxml2="yes"],
4085 [with_libxml2="no (symbol xmlXPathEval not found)"])
4087 CFLAGS="$SAVE_CFLAGS"
4088 LDFLAGS="$SAVE_LDFLAGS"
4089 fi
4090 dnl Add the right compiler flags and libraries.
4091 if test "x$with_libxml2" = "xyes"; then
4092 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4093 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4094 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4095 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4096 fi
4097 if test "x$with_libvirt" = "xyes"
4098 then
4099 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4100 if test $? -ne 0
4101 then
4102 with_libvirt="no"
4103 fi
4104 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4105 if test $? -ne 0
4106 then
4107 with_libvirt="no"
4108 fi
4109 fi
4110 if test "x$with_libvirt" = "xyes"
4111 then
4112 SAVE_CPPFLAGS="$CPPFLAGS"
4113 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4115 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4116 [with_libvirt="no (libvirt/libvirt.h not found)"])
4118 CPPFLAGS="$SAVE_CPPFLAGS"
4119 fi
4120 if test "x$with_libvirt" = "xyes"
4121 then
4122 SAVE_CFLAGS="$CFLAGS"
4123 SAVE_LDFLAGS="$LDFLAGS"
4125 CFLAGS="$CFLAGS $with_libvirt_cflags"
4126 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4128 AC_CHECK_LIB(virt, virDomainBlockStats,
4129 [with_libvirt="yes"],
4130 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4132 CFLAGS="$SAVE_CFLAGS"
4133 LDFLAGS="$SAVE_LDFLAGS"
4134 fi
4135 dnl Add the right compiler flags and libraries.
4136 if test "x$with_libvirt" = "xyes"; then
4137 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4138 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4139 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4140 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4141 fi
4142 # }}}
4144 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4145 with_libopenipmipthread="yes"
4146 with_libopenipmipthread_cflags=""
4147 with_libopenipmipthread_libs=""
4149 AC_MSG_CHECKING([for pkg-config])
4150 temp_result="no"
4151 if test "x$PKG_CONFIG" = "x"
4152 then
4153 with_libopenipmipthread="no"
4154 temp_result="no"
4155 else
4156 temp_result="$PKG_CONFIG"
4157 fi
4158 AC_MSG_RESULT([$temp_result])
4160 if test "x$with_libopenipmipthread" = "xyes"
4161 then
4162 AC_MSG_CHECKING([for libOpenIPMIpthread])
4163 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4164 if test "$?" != "0"
4165 then
4166 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4167 fi
4168 AC_MSG_RESULT([$with_libopenipmipthread])
4169 fi
4171 if test "x$with_libopenipmipthread" = "xyes"
4172 then
4173 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4174 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4175 if test "$?" = "0"
4176 then
4177 with_libopenipmipthread_cflags="$temp_result"
4178 else
4179 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4180 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4181 fi
4182 AC_MSG_RESULT([$temp_result])
4183 fi
4185 if test "x$with_libopenipmipthread" = "xyes"
4186 then
4187 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4188 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4189 if test "$?" = "0"
4190 then
4191 with_libopenipmipthread_ldflags="$temp_result"
4192 else
4193 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4194 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4195 fi
4196 AC_MSG_RESULT([$temp_result])
4197 fi
4199 if test "x$with_libopenipmipthread" = "xyes"
4200 then
4201 SAVE_CPPFLAGS="$CPPFLAGS"
4202 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4204 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4205 [with_libopenipmipthread="yes"],
4206 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4207 [#include <OpenIPMI/ipmiif.h>
4208 #include <OpenIPMI/ipmi_err.h>
4209 #include <OpenIPMI/ipmi_posix.h>
4210 #include <OpenIPMI/ipmi_conn.h>
4211 ])
4213 CPPFLAGS="$SAVE_CPPFLAGS"
4214 fi
4216 if test "x$with_libopenipmipthread" = "xyes"
4217 then
4218 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4219 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4220 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4221 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4222 fi
4223 # }}}
4225 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4226 [with_libnotify="yes"],
4227 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4228 with_libnotify="no"
4229 else
4230 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4231 fi])
4233 # Check for enabled/disabled features
4234 #
4236 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4237 # ------------------------------------------------------------
4238 dnl
4239 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4240 dnl
4241 AC_DEFUN(
4242 [AC_COLLECTD],
4243 [
4244 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4245 m4_if(
4246 [$2],
4247 [enable],
4248 [dnl
4249 m4_define([EnDis],[disabled])dnl
4250 m4_define([YesNo],[no])dnl
4251 ],dnl
4252 [m4_if(
4253 [$2],
4254 [disable],
4255 [dnl
4256 m4_define([EnDis],[enabled])dnl
4257 m4_define([YesNo],[yes])dnl
4258 ],
4259 [dnl
4260 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4261 ]dnl
4262 )]dnl
4263 )dnl
4264 m4_if([$3], [feature], [],
4265 [m4_if(
4266 [$3], [module], [],
4267 [dnl
4268 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4269 ]dnl
4270 )]dnl
4271 )dnl
4272 AC_ARG_ENABLE(
4273 [$1],
4274 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4275 [],
4276 enable_$1='[YesNo]'dnl
4277 )# AC_ARG_ENABLE
4278 if test "x$enable_$1" = "xno"
4279 then
4280 collectd_$1=0
4281 else
4282 if test "x$enable_$1" = "xyes"
4283 then
4284 collectd_$1=1
4285 else
4286 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4287 collectd_$1=1
4288 enable_$1='yes'
4289 fi
4290 fi
4291 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4292 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4293 ]dnl
4294 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4296 # AC_PLUGIN(name, default, info)
4297 # ------------------------------------------------------------
4298 dnl
4299 AC_DEFUN(
4300 [AC_PLUGIN],
4301 [
4302 enable_plugin="no"
4303 force="no"
4304 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4305 [
4306 if test "x$enableval" = "xyes"
4307 then
4308 enable_plugin="yes"
4309 else if test "x$enableval" = "xforce"
4310 then
4311 enable_plugin="yes"
4312 force="yes"
4313 else
4314 enable_plugin="no (disabled on command line)"
4315 fi; fi
4316 ],
4317 [
4318 if test "x$enable_all_plugins" = "xauto"
4319 then
4320 if test "x$2" = "xyes"
4321 then
4322 enable_plugin="yes"
4323 else
4324 enable_plugin="no"
4325 fi
4326 else
4327 enable_plugin="$enable_all_plugins"
4328 fi
4329 ])
4330 if test "x$enable_plugin" = "xyes"
4331 then
4332 if test "x$2" = "xyes" || test "x$force" = "xyes"
4333 then
4334 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4335 if test "x$2" != "xyes"
4336 then
4337 dependency_warning="yes"
4338 fi
4339 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4340 dependency_error="yes"
4341 enable_plugin="no (dependency error)"
4342 fi
4343 fi
4344 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4345 enable_$1="$enable_plugin"
4346 ]
4347 )# AC_PLUGIN(name, default, info)
4349 m4_divert_once([HELP_ENABLE], [
4350 collectd features:])
4351 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4352 AC_COLLECTD([debug], [enable], [feature], [debugging])
4353 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4354 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4356 dependency_warning="no"
4357 dependency_error="no"
4359 plugin_ascent="no"
4360 plugin_battery="no"
4361 plugin_bind="no"
4362 plugin_conntrack="no"
4363 plugin_contextswitch="no"
4364 plugin_cpu="no"
4365 plugin_cpufreq="no"
4366 plugin_curl_json="no"
4367 plugin_curl_xml="no"
4368 plugin_df="no"
4369 plugin_disk="no"
4370 plugin_entropy="no"
4371 plugin_interface="no"
4372 plugin_ipmi="no"
4373 plugin_ipvs="no"
4374 plugin_irq="no"
4375 plugin_libvirt="no"
4376 plugin_load="no"
4377 plugin_memory="no"
4378 plugin_multimeter="no"
4379 plugin_nfs="no"
4380 plugin_fscache="no"
4381 plugin_perl="no"
4382 plugin_processes="no"
4383 plugin_protocols="no"
4384 plugin_serial="no"
4385 plugin_swap="no"
4386 plugin_tape="no"
4387 plugin_tcpconns="no"
4388 plugin_ted="no"
4389 plugin_thermal="no"
4390 plugin_users="no"
4391 plugin_uptime="no"
4392 plugin_vmem="no"
4393 plugin_vserver="no"
4394 plugin_wireless="no"
4395 plugin_zfs_arc="no"
4397 # Linux
4398 if test "x$ac_system" = "xLinux"
4399 then
4400 plugin_battery="yes"
4401 plugin_conntrack="yes"
4402 plugin_contextswitch="yes"
4403 plugin_cpu="yes"
4404 plugin_cpufreq="yes"
4405 plugin_disk="yes"
4406 plugin_entropy="yes"
4407 plugin_interface="yes"
4408 plugin_irq="yes"
4409 plugin_load="yes"
4410 plugin_memory="yes"
4411 plugin_nfs="yes"
4412 plugin_fscache="yes"
4413 plugin_processes="yes"
4414 plugin_protocols="yes"
4415 plugin_serial="yes"
4416 plugin_swap="yes"
4417 plugin_tcpconns="yes"
4418 plugin_thermal="yes"
4419 plugin_uptime="yes"
4420 plugin_vmem="yes"
4421 plugin_vserver="yes"
4422 plugin_wireless="yes"
4424 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4425 then
4426 plugin_ipvs="yes"
4427 fi
4428 fi
4430 if test "x$ac_system" = "xOpenBSD"
4431 then
4432 plugin_tcpconns="yes"
4433 fi
4435 # Mac OS X devices
4436 if test "x$with_libiokit" = "xyes"
4437 then
4438 plugin_battery="yes"
4439 plugin_disk="yes"
4440 fi
4442 # AIX
4444 if test "x$ac_system" = "xAIX"
4445 then
4446 plugin_tcpconns="yes"
4447 fi
4449 if test "x$with_perfstat" = "xyes"
4450 then
4451 plugin_cpu="yes"
4452 plugin_disk="yes"
4453 plugin_memory="yes"
4454 plugin_swap="yes"
4455 plugin_interface="yes"
4456 plugin_load="yes"
4457 fi
4459 if test "x$with_procinfo" = "xyes"
4460 then
4461 plugin_processes="yes"
4462 fi
4464 # Solaris
4465 if test "x$with_kstat" = "xyes"
4466 then
4467 plugin_uptime="yes"
4468 plugin_zfs_arc="yes"
4469 fi
4471 if test "x$with_devinfo$with_kstat" = "xyesyes"
4472 then
4473 plugin_cpu="yes"
4474 plugin_disk="yes"
4475 plugin_interface="yes"
4476 plugin_memory="yes"
4477 plugin_tape="yes"
4478 fi
4480 # libstatgrab
4481 if test "x$with_libstatgrab" = "xyes"
4482 then
4483 plugin_cpu="yes"
4484 plugin_disk="yes"
4485 plugin_interface="yes"
4486 plugin_load="yes"
4487 plugin_memory="yes"
4488 plugin_swap="yes"
4489 plugin_users="yes"
4490 fi
4492 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4493 then
4494 plugin_ascent="yes"
4495 if test "x$have_strptime" = "xyes"
4496 then
4497 plugin_bind="yes"
4498 fi
4499 fi
4501 if test "x$with_libopenipmipthread" = "xyes"
4502 then
4503 plugin_ipmi="yes"
4504 fi
4506 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4507 then
4508 plugin_curl_json="yes"
4509 fi
4511 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4512 then
4513 plugin_curl_xml="yes"
4514 fi
4516 if test "x$have_processor_info" = "xyes"
4517 then
4518 plugin_cpu="yes"
4519 fi
4520 if test "x$have_sysctl" = "xyes"
4521 then
4522 plugin_cpu="yes"
4523 plugin_memory="yes"
4524 plugin_uptime="yes"
4525 if test "x$ac_system" = "xDarwin"
4526 then
4527 plugin_swap="yes"
4528 fi
4529 fi
4530 if test "x$have_sysctlbyname" = "xyes"
4531 then
4532 plugin_contextswitch="yes"
4533 plugin_cpu="yes"
4534 plugin_memory="yes"
4535 plugin_tcpconns="yes"
4536 fi
4538 # Df plugin: Check if we know how to determine mount points first.
4539 #if test "x$have_listmntent" = "xyes"; then
4540 # plugin_df="yes"
4541 #fi
4542 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4543 then
4544 plugin_df="yes"
4545 fi
4546 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4547 then
4548 plugin_df="yes"
4549 fi
4550 #if test "x$have_getmntent" = "xseq"
4551 #then
4552 # plugin_df="yes"
4553 #fi
4554 if test "x$c_cv_have_one_getmntent" = "xyes"
4555 then
4556 plugin_df="yes"
4557 fi
4559 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4560 if test "x$plugin_df" = "xyes"
4561 then
4562 plugin_df="no"
4563 if test "x$have_statfs" = "xyes"
4564 then
4565 plugin_df="yes"
4566 fi
4567 if test "x$have_statvfs" = "xyes"
4568 then
4569 plugin_df="yes"
4570 fi
4571 fi
4573 if test "x$have_getifaddrs" = "xyes"
4574 then
4575 plugin_interface="yes"
4576 fi
4578 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4579 then
4580 plugin_libvirt="yes"
4581 fi
4583 if test "x$have_getloadavg" = "xyes"
4584 then
4585 plugin_load="yes"
4586 fi
4588 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4589 then
4590 plugin_perl="yes"
4591 fi
4593 # Mac OS X memory interface
4594 if test "x$have_host_statistics" = "xyes"
4595 then
4596 plugin_memory="yes"
4597 fi
4599 if test "x$have_termios_h" = "xyes"
4600 then
4601 plugin_multimeter="yes"
4602 plugin_ted="yes"
4603 fi
4605 if test "x$have_thread_info" = "xyes"
4606 then
4607 plugin_processes="yes"
4608 fi
4610 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4611 then
4612 plugin_processes="yes"
4613 fi
4615 if test "x$with_kvm_getswapinfo" = "xyes"
4616 then
4617 plugin_swap="yes"
4618 fi
4620 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4621 then
4622 plugin_swap="yes"
4623 fi
4625 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4626 then
4627 plugin_tcpconns="yes"
4628 fi
4630 if test "x$have_getutent" = "xyes"
4631 then
4632 plugin_users="yes"
4633 fi
4634 if test "x$have_getutxent" = "xyes"
4635 then
4636 plugin_users="yes"
4637 fi
4639 m4_divert_once([HELP_ENABLE], [
4640 collectd plugins:])
4642 AC_ARG_ENABLE([all-plugins],
4643 AC_HELP_STRING([--enable-all-plugins],
4644 [enable all plugins (auto by def)]),
4645 [
4646 if test "x$enableval" = "xyes"
4647 then
4648 enable_all_plugins="yes"
4649 else if test "x$enableval" = "xauto"
4650 then
4651 enable_all_plugins="auto"
4652 else
4653 enable_all_plugins="no"
4654 fi; fi
4655 ],
4656 [enable_all_plugins="auto"])
4658 m4_divert_once([HELP_ENABLE], [])
4660 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4661 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4662 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4663 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4664 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4665 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4666 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4667 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4668 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4669 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4670 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4671 AC_PLUGIN([csv], [yes], [CSV output plugin])
4672 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4673 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4674 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4675 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4676 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4677 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4678 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4679 AC_PLUGIN([email], [yes], [EMail statistics])
4680 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4681 AC_PLUGIN([exec], [yes], [Execution of external programs])
4682 AC_PLUGIN([filecount], [yes], [Count files in directories])
4683 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4684 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4685 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4686 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4687 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4688 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4689 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4690 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4691 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4692 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4693 AC_PLUGIN([load], [$plugin_load], [System load])
4694 AC_PLUGIN([logfile], [yes], [File logging plugin])
4695 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4696 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4697 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4698 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4699 AC_PLUGIN([match_regex], [yes], [The regex match])
4700 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4701 AC_PLUGIN([match_value], [yes], [The value match])
4702 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4703 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4704 AC_PLUGIN([memcached], [yes], [memcached statistics])
4705 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4706 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4707 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4708 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4709 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4710 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4711 AC_PLUGIN([network], [yes], [Network communication plugin])
4712 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4713 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4714 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4715 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4716 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4717 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4718 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4719 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4720 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4721 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4722 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4723 # FIXME: Check for libevent, too.
4724 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4725 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4726 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4727 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4728 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4729 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4730 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4731 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4732 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4733 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4734 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4735 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4736 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4737 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4738 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4739 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4740 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4741 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4742 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4743 AC_PLUGIN([target_notification], [yes], [The notification target])
4744 AC_PLUGIN([target_replace], [yes], [The replace target])
4745 AC_PLUGIN([target_scale],[yes], [The scale target])
4746 AC_PLUGIN([target_set], [yes], [The set target])
4747 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4748 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4749 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4750 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4751 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4752 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4753 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4754 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4755 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4756 AC_PLUGIN([users], [$plugin_users], [User statistics])
4757 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4758 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4759 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4760 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4761 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4762 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
4763 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4764 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4765 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
4766 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4767 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4769 dnl Default configuration file
4770 # Load either syslog or logfile
4771 LOAD_PLUGIN_SYSLOG=""
4772 LOAD_PLUGIN_LOGFILE=""
4774 AC_MSG_CHECKING([which default log plugin to load])
4775 default_log_plugin="none"
4776 if test "x$enable_syslog" = "xyes"
4777 then
4778 default_log_plugin="syslog"
4779 else
4780 LOAD_PLUGIN_SYSLOG="##"
4781 fi
4783 if test "x$enable_logfile" = "xyes"
4784 then
4785 if test "x$default_log_plugin" = "xnone"
4786 then
4787 default_log_plugin="logfile"
4788 else
4789 LOAD_PLUGIN_LOGFILE="#"
4790 fi
4791 else
4792 LOAD_PLUGIN_LOGFILE="##"
4793 fi
4794 AC_MSG_RESULT([$default_log_plugin])
4796 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4797 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4799 DEFAULT_LOG_LEVEL="info"
4800 if test "x$enable_debug" = "xyes"
4801 then
4802 DEFAULT_LOG_LEVEL="debug"
4803 fi
4804 AC_SUBST(DEFAULT_LOG_LEVEL)
4806 # Load only one of rrdtool, network, csv in the default config.
4807 LOAD_PLUGIN_RRDTOOL=""
4808 LOAD_PLUGIN_NETWORK=""
4809 LOAD_PLUGIN_CSV=""
4811 AC_MSG_CHECKING([which default write plugin to load])
4812 default_write_plugin="none"
4813 if test "x$enable_rrdtool" = "xyes"
4814 then
4815 default_write_plugin="rrdtool"
4816 else
4817 LOAD_PLUGIN_RRDTOOL="##"
4818 fi
4820 if test "x$enable_network" = "xyes"
4821 then
4822 if test "x$default_write_plugin" = "xnone"
4823 then
4824 default_write_plugin="network"
4825 else
4826 LOAD_PLUGIN_NETWORK="#"
4827 fi
4828 else
4829 LOAD_PLUGIN_NETWORK="##"
4830 fi
4832 if test "x$enable_csv" = "xyes"
4833 then
4834 if test "x$default_write_plugin" = "xnone"
4835 then
4836 default_write_plugin="csv"
4837 else
4838 LOAD_PLUGIN_CSV="#"
4839 fi
4840 else
4841 LOAD_PLUGIN_CSV="##"
4842 fi
4843 AC_MSG_RESULT([$default_write_plugin])
4845 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4846 AC_SUBST(LOAD_PLUGIN_NETWORK)
4847 AC_SUBST(LOAD_PLUGIN_CSV)
4849 dnl ip_vs.h
4850 if test "x$ac_system" = "xLinux" \
4851 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4852 then
4853 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4854 fi
4856 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4857 then
4858 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4859 fi
4861 dnl Perl bindings
4862 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4863 [
4864 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4865 then
4866 PERL_BINDINGS_OPTIONS="$withval"
4867 with_perl_bindings="yes"
4868 else
4869 PERL_BINDINGS_OPTIONS=""
4870 with_perl_bindings="$withval"
4871 fi
4872 ],
4873 [
4874 PERL_BINDINGS_OPTIONS=""
4875 if test -n "$perl_interpreter"
4876 then
4877 with_perl_bindings="yes"
4878 else
4879 with_perl_bindings="no (no perl interpreter found)"
4880 fi
4881 ])
4882 if test "x$with_perl_bindings" = "xyes"
4883 then
4884 PERL_BINDINGS="perl"
4885 else
4886 PERL_BINDINGS=""
4887 fi
4888 AC_SUBST(PERL_BINDINGS)
4889 AC_SUBST(PERL_BINDINGS_OPTIONS)
4891 dnl libcollectdclient
4892 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4893 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4894 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4896 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4898 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4900 AC_SUBST(LCC_VERSION_MAJOR)
4901 AC_SUBST(LCC_VERSION_MINOR)
4902 AC_SUBST(LCC_VERSION_PATCH)
4903 AC_SUBST(LCC_VERSION_EXTRA)
4904 AC_SUBST(LCC_VERSION_STRING)
4906 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4908 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4910 if test "x$with_librrd" = "xyes" \
4911 && test "x$librrd_threadsafe" != "xyes"
4912 then
4913 with_librrd="yes (warning: librrd is not thread-safe)"
4914 fi
4916 if test "x$with_libperl" = "xyes"
4917 then
4918 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4919 else
4920 enable_perl="no (needs libperl)"
4921 fi
4923 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4924 then
4925 enable_perl="no (libperl doesn't support ithreads)"
4926 fi
4928 if test "x$with_perl_bindings" = "xyes" \
4929 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4930 then
4931 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4932 fi
4934 cat <<EOF;
4936 Configuration:
4937 Libraries:
4938 libcurl . . . . . . . $with_libcurl
4939 libdbi . . . . . . . $with_libdbi
4940 libcredis . . . . . . $with_libcredis
4941 libesmtp . . . . . . $with_libesmtp
4942 libganglia . . . . . $with_libganglia
4943 libgcrypt . . . . . . $with_libgcrypt
4944 libiokit . . . . . . $with_libiokit
4945 libiptc . . . . . . . $with_libiptc
4946 libjvm . . . . . . . $with_java
4947 libkstat . . . . . . $with_kstat
4948 libkvm . . . . . . . $with_libkvm
4949 libmemcached . . . . $with_libmemcached
4950 libmodbus . . . . . . $with_libmodbus
4951 libmysql . . . . . . $with_libmysql
4952 libnetapp . . . . . . $with_libnetapp
4953 libnetlink . . . . . $with_libnetlink
4954 libnetsnmp . . . . . $with_libnetsnmp
4955 libnotify . . . . . . $with_libnotify
4956 liboconfig . . . . . $with_liboconfig
4957 libopenipmi . . . . . $with_libopenipmipthread
4958 liboping . . . . . . $with_liboping
4959 libpcap . . . . . . . $with_libpcap
4960 libperfstat . . . . . $with_perfstat
4961 libperl . . . . . . . $with_libperl
4962 libpq . . . . . . . . $with_libpq
4963 libpthread . . . . . $with_libpthread
4964 librabbitmq . . . . . $with_librabbitmq
4965 librouteros . . . . . $with_librouteros
4966 librrd . . . . . . . $with_librrd
4967 libsensors . . . . . $with_libsensors
4968 libstatgrab . . . . . $with_libstatgrab
4969 libtokyotyrant . . . $with_libtokyotyrant
4970 libupsclient . . . . $with_libupsclient
4971 libvarnish . . . . . $with_libvarnish
4972 libvirt . . . . . . . $with_libvirt
4973 libxml2 . . . . . . . $with_libxml2
4974 libxmms . . . . . . . $with_libxmms
4975 libyajl . . . . . . . $with_libyajl
4976 libevent . . . . . . $with_libevent
4977 protobuf-c . . . . . $have_protoc_c
4978 oracle . . . . . . . $with_oracle
4979 python . . . . . . . $with_python
4981 Features:
4982 daemon mode . . . . . $enable_daemon
4983 debug . . . . . . . . $enable_debug
4985 Bindings:
4986 perl . . . . . . . . $with_perl_bindings
4988 Modules:
4989 amqp . . . . . . . $enable_amqp
4990 apache . . . . . . . $enable_apache
4991 apcups . . . . . . . $enable_apcups
4992 apple_sensors . . . . $enable_apple_sensors
4993 ascent . . . . . . . $enable_ascent
4994 battery . . . . . . . $enable_battery
4995 bind . . . . . . . . $enable_bind
4996 conntrack . . . . . . $enable_conntrack
4997 contextswitch . . . . $enable_contextswitch
4998 cpu . . . . . . . . . $enable_cpu
4999 cpufreq . . . . . . . $enable_cpufreq
5000 csv . . . . . . . . . $enable_csv
5001 curl . . . . . . . . $enable_curl
5002 curl_json . . . . . . $enable_curl_json
5003 curl_xml . . . . . . $enable_curl_xml
5004 dbi . . . . . . . . . $enable_dbi
5005 df . . . . . . . . . $enable_df
5006 disk . . . . . . . . $enable_disk
5007 dns . . . . . . . . . $enable_dns
5008 email . . . . . . . . $enable_email
5009 entropy . . . . . . . $enable_entropy
5010 exec . . . . . . . . $enable_exec
5011 filecount . . . . . . $enable_filecount
5012 fscache . . . . . . . $enable_fscache
5013 gmond . . . . . . . . $enable_gmond
5014 hddtemp . . . . . . . $enable_hddtemp
5015 interface . . . . . . $enable_interface
5016 ipmi . . . . . . . . $enable_ipmi
5017 iptables . . . . . . $enable_iptables
5018 ipvs . . . . . . . . $enable_ipvs
5019 irq . . . . . . . . . $enable_irq
5020 java . . . . . . . . $enable_java
5021 libvirt . . . . . . . $enable_libvirt
5022 load . . . . . . . . $enable_load
5023 logfile . . . . . . . $enable_logfile
5024 lpar... . . . . . . . $enable_lpar
5025 madwifi . . . . . . . $enable_madwifi
5026 match_empty_counter . $enable_match_empty_counter
5027 match_hashed . . . . $enable_match_hashed
5028 match_regex . . . . . $enable_match_regex
5029 match_timediff . . . $enable_match_timediff
5030 match_value . . . . . $enable_match_value
5031 mbmon . . . . . . . . $enable_mbmon
5032 memcachec . . . . . . $enable_memcachec
5033 memcached . . . . . . $enable_memcached
5034 memory . . . . . . . $enable_memory
5035 modbus . . . . . . . $enable_modbus
5036 multimeter . . . . . $enable_multimeter
5037 mysql . . . . . . . . $enable_mysql
5038 netapp . . . . . . . $enable_netapp
5039 netlink . . . . . . . $enable_netlink
5040 network . . . . . . . $enable_network
5041 nfs . . . . . . . . . $enable_nfs
5042 nginx . . . . . . . . $enable_nginx
5043 notify_desktop . . . $enable_notify_desktop
5044 notify_email . . . . $enable_notify_email
5045 ntpd . . . . . . . . $enable_ntpd
5046 nut . . . . . . . . . $enable_nut
5047 olsrd . . . . . . . . $enable_olsrd
5048 onewire . . . . . . . $enable_onewire
5049 openvpn . . . . . . . $enable_openvpn
5050 oracle . . . . . . . $enable_oracle
5051 perl . . . . . . . . $enable_perl
5052 pinba . . . . . . . . $enable_pinba
5053 ping . . . . . . . . $enable_ping
5054 postgresql . . . . . $enable_postgresql
5055 powerdns . . . . . . $enable_powerdns
5056 processes . . . . . . $enable_processes
5057 protocols . . . . . . $enable_protocols
5058 python . . . . . . . $enable_python
5059 redis . . . . . . . . $enable_redis
5060 routeros . . . . . . $enable_routeros
5061 rrdcached . . . . . . $enable_rrdcached
5062 rrdtool . . . . . . . $enable_rrdtool
5063 sensors . . . . . . . $enable_sensors
5064 serial . . . . . . . $enable_serial
5065 snmp . . . . . . . . $enable_snmp
5066 swap . . . . . . . . $enable_swap
5067 syslog . . . . . . . $enable_syslog
5068 table . . . . . . . . $enable_table
5069 tail . . . . . . . . $enable_tail
5070 tape . . . . . . . . $enable_tape
5071 target_notification . $enable_target_notification
5072 target_replace . . . $enable_target_replace
5073 target_scale . . . . $enable_target_scale
5074 target_set . . . . . $enable_target_set
5075 target_v5upgrade . . $enable_target_v5upgrade
5076 tcpconns . . . . . . $enable_tcpconns
5077 teamspeak2 . . . . . $enable_teamspeak2
5078 ted . . . . . . . . . $enable_ted
5079 thermal . . . . . . . $enable_thermal
5080 threshold . . . . . . $enable_threshold
5081 tokyotyrant . . . . . $enable_tokyotyrant
5082 unixsock . . . . . . $enable_unixsock
5083 uptime . . . . . . . $enable_uptime
5084 users . . . . . . . . $enable_users
5085 uuid . . . . . . . . $enable_uuid
5086 varnish . . . . . . . $enable_varnish
5087 vmem . . . . . . . . $enable_vmem
5088 vserver . . . . . . . $enable_vserver
5089 wireless . . . . . . $enable_wireless
5090 write_graphite . . . $enable_write_graphite
5091 write_http . . . . . $enable_write_http
5092 write_redis . . . . . $enable_write_redis
5093 write_mongodb . . . . $enable_write_mongodb
5094 xmms . . . . . . . . $enable_xmms
5095 zfs_arc . . . . . . . $enable_zfs_arc
5097 EOF
5099 if test "x$dependency_error" = "xyes"; then
5100 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5101 fi
5103 if test "x$dependency_warning" = "xyes"; then
5104 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5105 fi
5107 # vim: set fdm=marker :