265d503d5128b6cbe66f1682f2df994341149077
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 #
1262 with_libresolv="yes"
1263 AC_CHECK_LIB(resolv, res_search,
1264 [
1265 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1266 ],
1267 [with_libresolv="no"])
1268 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1270 dnl Check for HAL (hardware abstraction library)
1271 with_libhal="yes"
1272 AC_CHECK_LIB(hal,libhal_device_property_exists,
1273 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1274 [with_libhal="no"])
1275 if test "x$with_libhal" = "xyes"; then
1276 if test "x$PKG_CONFIG" != "x"; then
1277 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1278 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1279 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1280 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1281 fi
1282 fi
1284 m4_divert_once([HELP_WITH], [
1285 collectd additional packages:])
1287 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1289 if test "x$ac_system" = "xAIX"
1290 then
1291 with_perfstat="yes"
1292 with_procinfo="yes"
1293 else
1294 with_perfstat="no (AIX only)"
1295 with_procinfo="no (AIX only)"
1296 fi
1298 if test "x$with_perfstat" = "xyes"
1299 then
1300 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1301 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1302 fi
1303 if test "x$with_perfstat" = "xyes"
1304 then
1305 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1306 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1307 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1308 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1309 then
1310 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1311 fi
1312 fi
1313 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1315 # Processes plugin under AIX.
1316 if test "x$with_procinfo" = "xyes"
1317 then
1318 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1319 fi
1320 if test "x$with_procinfo" = "xyes"
1321 then
1322 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1323 fi
1325 if test "x$ac_system" = "xSolaris"
1326 then
1327 with_kstat="yes"
1328 with_devinfo="yes"
1329 else
1330 with_kstat="no (Solaris only)"
1331 with_devinfo="no (Solaris only)"
1332 fi
1334 if test "x$with_kstat" = "xyes"
1335 then
1336 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1337 fi
1338 if test "x$with_kstat" = "xyes"
1339 then
1340 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1341 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1342 fi
1343 if test "x$with_kstat" = "xyes"
1344 then
1345 AC_DEFINE(HAVE_LIBKSTAT, 1,
1346 [Define to 1 if you have the 'kstat' library (-lkstat)])
1347 fi
1348 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1349 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1351 with_libiokit="no"
1352 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1353 [
1354 with_libiokit="yes"
1355 ],
1356 [
1357 with_libiokit="no"
1358 ])
1359 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1361 with_libkvm="no"
1362 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1363 if test "x$with_kvm_getprocs" = "xyes"
1364 then
1365 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1366 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1367 with_libkvm="yes"
1368 fi
1369 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1371 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1372 if test "x$with_kvm_getswapinfo" = "xyes"
1373 then
1374 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1375 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1376 with_libkvm="yes"
1377 fi
1378 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1380 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1381 if test "x$with_kvm_nlist" = "xyes"
1382 then
1383 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1384 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1385 with_libkvm="yes"
1386 fi
1387 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1389 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1390 if test "x$with_kvm_openfiles" = "xyes"
1391 then
1392 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1393 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1394 with_libkvm="yes"
1395 fi
1396 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1398 # --with-libcredis {{{
1399 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1400 [
1401 if test "x$withval" = "xyes"
1402 then
1403 with_libcredis="yes"
1404 else if test "x$withval" = "xno"
1405 then
1406 with_libcredis="no"
1407 else
1408 with_libcredis="yes"
1409 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1410 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1411 fi; fi
1412 ],
1413 [with_libcredis="yes"])
1415 SAVE_CPPFLAGS="$CPPFLAGS"
1416 SAVE_LDFLAGS="$LDFLAGS"
1418 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1419 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1421 if test "x$with_libcredis" = "xyes"
1422 then
1423 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1424 then
1425 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1426 fi
1427 AC_CHECK_HEADERS(credis.h,
1428 [with_libcredis="yes"],
1429 [with_libcredis="no (credis.h not found)"])
1430 fi
1431 if test "x$with_libcredis" = "xyes"
1432 then
1433 if test "x$LIBCREDIS_LDFLAGS" != "x"
1434 then
1435 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1436 fi
1437 AC_CHECK_LIB(credis, credis_info,
1438 [with_libcredis="yes"],
1439 [with_libcredis="no (symbol 'credis_info' not found)"])
1441 fi
1443 CPPFLAGS="$SAVE_CPPFLAGS"
1444 LDFLAGS="$SAVE_LDFLAGS"
1446 if test "x$with_libcredis" = "xyes"
1447 then
1448 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1449 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1450 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1451 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1452 fi
1453 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1454 # }}}
1456 # --with-libcurl {{{
1457 with_curl_config="curl-config"
1458 with_curl_cflags=""
1459 with_curl_libs=""
1460 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1461 [
1462 if test "x$withval" = "xno"
1463 then
1464 with_libcurl="no"
1465 else if test "x$withval" = "xyes"
1466 then
1467 with_libcurl="yes"
1468 else
1469 if test -f "$withval" && test -x "$withval"
1470 then
1471 with_curl_config="$withval"
1472 with_libcurl="yes"
1473 else if test -x "$withval/bin/curl-config"
1474 then
1475 with_curl_config="$withval/bin/curl-config"
1476 with_libcurl="yes"
1477 fi; fi
1478 with_libcurl="yes"
1479 fi; fi
1480 ],
1481 [
1482 with_libcurl="yes"
1483 ])
1484 if test "x$with_libcurl" = "xyes"
1485 then
1486 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1487 curl_config_status=$?
1489 if test $curl_config_status -ne 0
1490 then
1491 with_libcurl="no ($with_curl_config failed)"
1492 else
1493 SAVE_CPPFLAGS="$CPPFLAGS"
1494 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1496 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1498 CPPFLAGS="$SAVE_CPPFLAGS"
1499 fi
1500 fi
1501 if test "x$with_libcurl" = "xyes"
1502 then
1503 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1504 curl_config_status=$?
1506 if test $curl_config_status -ne 0
1507 then
1508 with_libcurl="no ($with_curl_config failed)"
1509 else
1510 AC_CHECK_LIB(curl, curl_easy_init,
1511 [with_libcurl="yes"],
1512 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1513 [$with_curl_libs])
1514 fi
1515 fi
1516 if test "x$with_libcurl" = "xyes"
1517 then
1518 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1519 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1520 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1521 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1522 fi
1523 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1524 # }}}
1526 # --with-libdbi {{{
1527 with_libdbi_cppflags=""
1528 with_libdbi_ldflags=""
1529 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1530 [
1531 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1532 then
1533 with_libdbi_cppflags="-I$withval/include"
1534 with_libdbi_ldflags="-L$withval/lib"
1535 with_libdbi="yes"
1536 else
1537 with_libdbi="$withval"
1538 fi
1539 ],
1540 [
1541 with_libdbi="yes"
1542 ])
1543 if test "x$with_libdbi" = "xyes"
1544 then
1545 SAVE_CPPFLAGS="$CPPFLAGS"
1546 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1548 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1550 CPPFLAGS="$SAVE_CPPFLAGS"
1551 fi
1552 if test "x$with_libdbi" = "xyes"
1553 then
1554 SAVE_CPPFLAGS="$CPPFLAGS"
1555 SAVE_LDFLAGS="$LDFLAGS"
1556 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1557 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1559 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1561 CPPFLAGS="$SAVE_CPPFLAGS"
1562 LDFLAGS="$SAVE_LDFLAGS"
1563 fi
1564 if test "x$with_libdbi" = "xyes"
1565 then
1566 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1567 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1568 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1569 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1570 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1571 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1572 fi
1573 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1574 # }}}
1576 # --with-libesmtp {{{
1577 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1578 [
1579 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1580 then
1581 LDFLAGS="$LDFLAGS -L$withval/lib"
1582 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1583 with_libesmtp="yes"
1584 else
1585 with_libesmtp="$withval"
1586 fi
1587 ],
1588 [
1589 with_libesmtp="yes"
1590 ])
1591 if test "x$with_libesmtp" = "xyes"
1592 then
1593 AC_CHECK_LIB(esmtp, smtp_create_session,
1594 [
1595 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1596 ], [with_libesmtp="no (libesmtp not found)"])
1597 fi
1598 if test "x$with_libesmtp" = "xyes"
1599 then
1600 AC_CHECK_HEADERS(libesmtp.h,
1601 [
1602 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1603 ], [with_libesmtp="no (libesmtp.h not found)"])
1604 fi
1605 if test "x$with_libesmtp" = "xyes"
1606 then
1607 collect_libesmtp=1
1608 else
1609 collect_libesmtp=0
1610 fi
1611 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1612 [Wether or not to use the esmtp library])
1613 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1614 # }}}
1616 # --with-libganglia {{{
1617 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1618 [
1619 if test -f "$withval" && test -x "$withval"
1620 then
1621 with_libganglia_config="$withval"
1622 with_libganglia="yes"
1623 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1624 then
1625 with_libganglia_config="$withval/bin/ganglia-config"
1626 with_libganglia="yes"
1627 else if test -d "$withval"
1628 then
1629 GANGLIA_CPPFLAGS="-I$withval/include"
1630 GANGLIA_LDFLAGS="-L$withval/lib"
1631 with_libganglia="yes"
1632 else
1633 with_libganglia_config="ganglia-config"
1634 with_libganglia="$withval"
1635 fi; fi; fi
1636 ],
1637 [
1638 with_libganglia_config="ganglia-config"
1639 with_libganglia="yes"
1640 ])
1642 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1643 then
1644 if test "x$GANGLIA_CPPFLAGS" = "x"
1645 then
1646 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1647 fi
1649 if test "x$GANGLIA_LDFLAGS" = "x"
1650 then
1651 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1652 fi
1654 if test "x$GANGLIA_LIBS" = "x"
1655 then
1656 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1657 fi
1658 fi
1660 SAVE_CPPFLAGS="$CPPFLAGS"
1661 SAVE_LDFLAGS="$LDFLAGS"
1662 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1663 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1665 if test "x$with_libganglia" = "xyes"
1666 then
1667 AC_CHECK_HEADERS(gm_protocol.h,
1668 [
1669 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1670 [Define to 1 if you have the <gm_protocol.h> header file.])
1671 ], [with_libganglia="no (gm_protocol.h not found)"])
1672 fi
1674 if test "x$with_libganglia" = "xyes"
1675 then
1676 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1677 [
1678 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1679 [Define to 1 if you have the ganglia library (-lganglia).])
1680 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1681 fi
1683 CPPFLAGS="$SAVE_CPPFLAGS"
1684 LDFLAGS="$SAVE_LDFLAGS"
1686 AC_SUBST(GANGLIA_CPPFLAGS)
1687 AC_SUBST(GANGLIA_LDFLAGS)
1688 AC_SUBST(GANGLIA_LIBS)
1689 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1690 # }}}
1692 # --with-libgcrypt {{{
1693 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1694 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1695 GCRYPT_LIBS="$GCRYPT_LIBS"
1696 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1697 [
1698 if test -f "$withval" && test -x "$withval"
1699 then
1700 with_libgcrypt_config="$withval"
1701 with_libgcrypt="yes"
1702 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1703 then
1704 with_libgcrypt_config="$withval/bin/gcrypt-config"
1705 with_libgcrypt="yes"
1706 else if test -d "$withval"
1707 then
1708 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1709 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1710 with_libgcrypt="yes"
1711 else
1712 with_libgcrypt_config="gcrypt-config"
1713 with_libgcrypt="$withval"
1714 fi; fi; fi
1715 ],
1716 [
1717 with_libgcrypt_config="libgcrypt-config"
1718 with_libgcrypt="yes"
1719 ])
1721 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1722 then
1723 if test "x$GCRYPT_CPPFLAGS" = "x"
1724 then
1725 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1726 fi
1728 if test "x$GCRYPT_LDFLAGS" = "x"
1729 then
1730 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1731 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1732 fi
1734 if test "x$GCRYPT_LIBS" = "x"
1735 then
1736 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1737 fi
1738 fi
1740 SAVE_CPPFLAGS="$CPPFLAGS"
1741 SAVE_LDFLAGS="$LDFLAGS"
1742 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1743 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1745 if test "x$with_libgcrypt" = "xyes"
1746 then
1747 if test "x$GCRYPT_CPPFLAGS" != "x"
1748 then
1749 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1750 fi
1751 AC_CHECK_HEADERS(gcrypt.h,
1752 [with_libgcrypt="yes"],
1753 [with_libgcrypt="no (gcrypt.h not found)"])
1754 fi
1756 if test "x$with_libgcrypt" = "xyes"
1757 then
1758 if test "x$GCRYPT_LDFLAGS" != "x"
1759 then
1760 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1761 fi
1762 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1763 [with_libgcrypt="yes"],
1764 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1766 if test "$with_libgcrypt" != "no"; then
1767 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1768 fi
1769 fi
1771 CPPFLAGS="$SAVE_CPPFLAGS"
1772 LDFLAGS="$SAVE_LDFLAGS"
1774 if test "x$with_libgcrypt" = "xyes"
1775 then
1776 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1777 fi
1779 AC_SUBST(GCRYPT_CPPFLAGS)
1780 AC_SUBST(GCRYPT_LDFLAGS)
1781 AC_SUBST(GCRYPT_LIBS)
1782 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1783 # }}}
1785 # --with-libiptc {{{
1786 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1787 [
1788 if test "x$withval" = "xshipped"
1789 then
1790 with_libiptc="own"
1791 else if test "x$withval" = "xyes"
1792 then
1793 with_libiptc="pkgconfig"
1794 else if test "x$withval" = "xno"
1795 then
1796 with_libiptc="no"
1797 else
1798 with_libiptc="yes"
1799 with_libiptc_cflags="-I$withval/include"
1800 with_libiptc_libs="-L$withval/lib"
1801 fi; fi; fi
1802 ],
1803 [
1804 if test "x$ac_system" = "xLinux"
1805 then
1806 with_libiptc="pkgconfig"
1807 else
1808 with_libiptc="no (Linux only)"
1809 fi
1810 ])
1812 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1813 then
1814 with_libiptc="no (Don't have pkg-config)"
1815 fi
1817 if test "x$with_libiptc" = "xpkgconfig"
1818 then
1819 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1820 if test $? -ne 0
1821 then
1822 with_libiptc="no (pkg-config doesn't know libiptc)"
1823 fi
1824 fi
1825 if test "x$with_libiptc" = "xpkgconfig"
1826 then
1827 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1828 if test $? -ne 0
1829 then
1830 with_libiptc="no ($PKG_CONFIG failed)"
1831 fi
1832 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1833 if test $? -ne 0
1834 then
1835 with_libiptc="no ($PKG_CONFIG failed)"
1836 fi
1837 fi
1839 SAVE_CPPFLAGS="$CPPFLAGS"
1840 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1842 # check whether the header file for libiptc is available.
1843 if test "x$with_libiptc" = "xpkgconfig"
1844 then
1845 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1846 [with_libiptc="no (header file missing)"])
1847 fi
1848 # If the header file is available, check for the required type declaractions.
1849 # They may be missing in old versions of libiptc. In that case, they will be
1850 # declared in the iptables plugin.
1851 if test "x$with_libiptc" = "xpkgconfig"
1852 then
1853 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1854 fi
1855 # Check for the iptc_init symbol in the library.
1856 if test "x$with_libiptc" = "xpkgconfig"
1857 then
1858 AC_CHECK_LIB(iptc, iptc_init,
1859 [with_libiptc="pkgconfig"],
1860 [with_libiptc="no"],
1861 [$with_libiptc_libs])
1862 fi
1863 if test "x$with_libiptc" = "xpkgconfig"
1864 then
1865 with_libiptc="yes"
1866 fi
1868 CPPFLAGS="$SAVE_CPPFLAGS"
1870 if test "x$with_libiptc" = "xown"
1871 then
1872 with_libiptc_cflags=""
1873 with_libiptc_libs=""
1874 fi
1875 if test "x$with_libiptc" = "xown"
1876 then
1877 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1878 [
1879 with_libiptc="no (Linux iptables headers not found)"
1880 ],
1881 [
1882 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1883 ])
1884 fi
1885 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1886 if test "x$with_libiptc" = "xown"
1887 then
1888 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1889 with_libiptc="yes"
1890 fi
1892 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1893 if test "x$with_libiptc" = "xyes"
1894 then
1895 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1896 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1897 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1898 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1899 fi
1900 # }}}
1902 # --with-java {{{
1903 with_java_home="$JAVA_HOME"
1904 with_java_vmtype="client"
1905 with_java_cflags=""
1906 with_java_libs=""
1907 JAVAC="$JAVAC"
1908 JAR="$JAR"
1909 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1910 [
1911 if test "x$withval" = "xno"
1912 then
1913 with_java="no"
1914 else if test "x$withval" = "xyes"
1915 then
1916 with_java="yes"
1917 else
1918 with_java_home="$withval"
1919 with_java="yes"
1920 fi; fi
1921 ],
1922 [with_java="yes"])
1923 if test "x$with_java" = "xyes"
1924 then
1925 if test -d "$with_java_home"
1926 then
1927 AC_MSG_CHECKING([for jni.h])
1928 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1929 if test "x$TMPDIR" != "x"
1930 then
1931 AC_MSG_RESULT([found in $TMPDIR])
1932 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1933 else
1934 AC_MSG_RESULT([not found])
1935 fi
1937 AC_MSG_CHECKING([for jni_md.h])
1938 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1939 if test "x$TMPDIR" != "x"
1940 then
1941 AC_MSG_RESULT([found in $TMPDIR])
1942 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1943 else
1944 AC_MSG_RESULT([not found])
1945 fi
1947 AC_MSG_CHECKING([for libjvm.so])
1948 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1949 if test "x$TMPDIR" != "x"
1950 then
1951 AC_MSG_RESULT([found in $TMPDIR])
1952 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1953 else
1954 AC_MSG_RESULT([not found])
1955 fi
1957 if test "x$JAVAC" = "x"
1958 then
1959 AC_MSG_CHECKING([for javac])
1960 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1961 if test "x$TMPDIR" != "x"
1962 then
1963 JAVAC="$TMPDIR"
1964 AC_MSG_RESULT([$JAVAC])
1965 else
1966 AC_MSG_RESULT([not found])
1967 fi
1968 fi
1969 if test "x$JAR" = "x"
1970 then
1971 AC_MSG_CHECKING([for jar])
1972 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1973 if test "x$TMPDIR" != "x"
1974 then
1975 JAR="$TMPDIR"
1976 AC_MSG_RESULT([$JAR])
1977 else
1978 AC_MSG_RESULT([not found])
1979 fi
1980 fi
1981 else if test "x$with_java_home" != "x"
1982 then
1983 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1984 fi; fi
1985 fi
1987 if test "x$JAVA_CPPFLAGS" != "x"
1988 then
1989 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1990 fi
1991 if test "x$JAVA_CFLAGS" != "x"
1992 then
1993 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1994 fi
1995 if test "x$JAVA_LDFLAGS" != "x"
1996 then
1997 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1998 fi
1999 if test "x$JAVAC" = "x"
2000 then
2001 with_javac_path="$PATH"
2002 if test "x$with_java_home" != "x"
2003 then
2004 with_javac_path="$with_java_home:with_javac_path"
2005 if test -d "$with_java_home/bin"
2006 then
2007 with_javac_path="$with_java_home/bin:with_javac_path"
2008 fi
2009 fi
2011 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2012 fi
2013 if test "x$JAVAC" = "x"
2014 then
2015 with_java="no (javac not found)"
2016 fi
2017 if test "x$JAR" = "x"
2018 then
2019 with_jar_path="$PATH"
2020 if test "x$with_java_home" != "x"
2021 then
2022 with_jar_path="$with_java_home:$with_jar_path"
2023 if test -d "$with_java_home/bin"
2024 then
2025 with_jar_path="$with_java_home/bin:$with_jar_path"
2026 fi
2027 fi
2029 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2030 fi
2031 if test "x$JAR" = "x"
2032 then
2033 with_java="no (jar not found)"
2034 fi
2036 SAVE_CPPFLAGS="$CPPFLAGS"
2037 SAVE_CFLAGS="$CFLAGS"
2038 SAVE_LDFLAGS="$LDFLAGS"
2039 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2040 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2041 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2043 if test "x$with_java" = "xyes"
2044 then
2045 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2046 fi
2047 if test "x$with_java" = "xyes"
2048 then
2049 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2050 [with_java="yes"],
2051 [with_java="no (libjvm not found)"],
2052 [$JAVA_LIBS])
2053 fi
2054 if test "x$with_java" = "xyes"
2055 then
2056 JAVA_LIBS="$JAVA_LIBS -ljvm"
2057 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2058 fi
2060 CPPFLAGS="$SAVE_CPPFLAGS"
2061 CFLAGS="$SAVE_CFLAGS"
2062 LDFLAGS="$SAVE_LDFLAGS"
2064 AC_SUBST(JAVA_CPPFLAGS)
2065 AC_SUBST(JAVA_CFLAGS)
2066 AC_SUBST(JAVA_LDFLAGS)
2067 AC_SUBST(JAVA_LIBS)
2068 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2069 # }}}
2071 # --with-libmemcached {{{
2072 with_libmemcached_cppflags=""
2073 with_libmemcached_ldflags=""
2074 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2075 [
2076 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2077 then
2078 with_libmemcached_cppflags="-I$withval/include"
2079 with_libmemcached_ldflags="-L$withval/lib"
2080 with_libmemcached="yes"
2081 else
2082 with_libmemcached="$withval"
2083 fi
2084 ],
2085 [
2086 with_libmemcached="yes"
2087 ])
2088 if test "x$with_libmemcached" = "xyes"
2089 then
2090 SAVE_CPPFLAGS="$CPPFLAGS"
2091 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2093 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2095 CPPFLAGS="$SAVE_CPPFLAGS"
2096 fi
2097 if test "x$with_libmemcached" = "xyes"
2098 then
2099 SAVE_CPPFLAGS="$CPPFLAGS"
2100 SAVE_LDFLAGS="$LDFLAGS"
2101 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2102 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2104 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2106 CPPFLAGS="$SAVE_CPPFLAGS"
2107 LDFLAGS="$SAVE_LDFLAGS"
2108 fi
2109 if test "x$with_libmemcached" = "xyes"
2110 then
2111 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2112 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2113 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2114 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2115 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2116 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2117 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2118 fi
2119 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2120 # }}}
2122 # --with-libmodbus {{{
2123 with_libmodbus_config=""
2124 with_libmodbus_cflags=""
2125 with_libmodbus_libs=""
2126 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2127 [
2128 if test "x$withval" = "xno"
2129 then
2130 with_libmodbus="no"
2131 else if test "x$withval" = "xyes"
2132 then
2133 with_libmodbus="use_pkgconfig"
2134 else if test -d "$with_libmodbus/lib"
2135 then
2136 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2137 with_libmodbus_cflags="-I$withval/include"
2138 with_libmodbus_libs="-L$withval/lib -lmodbus"
2139 with_libmodbus="yes"
2140 fi; fi; fi
2141 ],
2142 [with_libmodbus="use_pkgconfig"])
2144 # configure using pkg-config
2145 if test "x$with_libmodbus" = "xuse_pkgconfig"
2146 then
2147 if test "x$PKG_CONFIG" = "x"
2148 then
2149 with_libmodbus="no (Don't have pkg-config)"
2150 fi
2151 fi
2152 if test "x$with_libmodbus" = "xuse_pkgconfig"
2153 then
2154 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
2155 $PKG_CONFIG --exists 'modbus' 2>/dev/null
2156 if test $? -ne 0
2157 then
2158 with_libmodbus="no (pkg-config doesn't know modbus)"
2159 fi
2160 fi
2161 if test "x$with_libmodbus" = "xuse_pkgconfig"
2162 then
2163 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
2164 if test $? -ne 0
2165 then
2166 with_libmodbus="no ($PKG_CONFIG failed)"
2167 fi
2168 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
2169 if test $? -ne 0
2170 then
2171 with_libmodbus="no ($PKG_CONFIG failed)"
2172 fi
2173 fi
2174 if test "x$with_libmodbus" = "xuse_pkgconfig"
2175 then
2176 with_libmodbus="yes"
2177 fi
2179 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2180 # the actual checks.
2181 if test "x$with_libmodbus" = "xyes"
2182 then
2183 SAVE_CPPFLAGS="$CPPFLAGS"
2184 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2186 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2188 CPPFLAGS="$SAVE_CPPFLAGS"
2189 fi
2190 if test "x$with_libmodbus" = "xyes"
2191 then
2192 SAVE_CPPFLAGS="$CPPFLAGS"
2193 SAVE_LDFLAGS="$LDFLAGS"
2195 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2196 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2198 AC_CHECK_LIB(modbus, modbus_connect,
2199 [with_libmodbus="yes"],
2200 [with_libmodbus="no (symbol modbus_connect not found)"])
2202 CPPFLAGS="$SAVE_CPPFLAGS"
2203 LDFLAGS="$SAVE_LDFLAGS"
2204 fi
2205 if test "x$with_libmodbus" = "xyes"
2206 then
2207 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2208 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2209 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2210 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2211 fi
2212 # }}}
2214 # --with-libmysql {{{
2215 with_mysql_config="mysql_config"
2216 with_mysql_cflags=""
2217 with_mysql_libs=""
2218 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2219 [
2220 if test "x$withval" = "xno"
2221 then
2222 with_libmysql="no"
2223 else if test "x$withval" = "xyes"
2224 then
2225 with_libmysql="yes"
2226 else
2227 if test -f "$withval" && test -x "$withval";
2228 then
2229 with_mysql_config="$withval"
2230 else if test -x "$withval/bin/mysql_config"
2231 then
2232 with_mysql_config="$withval/bin/mysql_config"
2233 fi; fi
2234 with_libmysql="yes"
2235 fi; fi
2236 ],
2237 [
2238 with_libmysql="yes"
2239 ])
2240 if test "x$with_libmysql" = "xyes"
2241 then
2242 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2243 mysql_config_status=$?
2245 if test $mysql_config_status -ne 0
2246 then
2247 with_libmysql="no ($with_mysql_config failed)"
2248 else
2249 SAVE_CPPFLAGS="$CPPFLAGS"
2250 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2252 have_mysql_h="no"
2253 have_mysql_mysql_h="no"
2254 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2256 if test "x$have_mysql_h" = "xno"
2257 then
2258 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2259 fi
2261 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2262 then
2263 with_libmysql="no (mysql.h not found)"
2264 fi
2266 CPPFLAGS="$SAVE_CPPFLAGS"
2267 fi
2268 fi
2269 if test "x$with_libmysql" = "xyes"
2270 then
2271 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2272 mysql_config_status=$?
2274 if test $mysql_config_status -ne 0
2275 then
2276 with_libmysql="no ($with_mysql_config failed)"
2277 else
2278 AC_CHECK_LIB(mysqlclient, mysql_init,
2279 [with_libmysql="yes"],
2280 [with_libmysql="no (symbol 'mysql_init' not found)"],
2281 [$with_mysql_libs])
2283 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2284 [with_libmysql="yes"],
2285 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2286 [$with_mysql_libs])
2287 fi
2288 fi
2289 if test "x$with_libmysql" = "xyes"
2290 then
2291 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2292 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2293 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2294 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2295 fi
2296 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2297 # }}}
2299 # --with-libnetlink {{{
2300 with_libnetlink_cflags=""
2301 with_libnetlink_libs="-lnetlink"
2302 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2303 [
2304 echo "libnetlink: withval = $withval"
2305 if test "x$withval" = "xyes"
2306 then
2307 with_libnetlink="yes"
2308 else if test "x$withval" = "xno"
2309 then
2310 with_libnetlink="no"
2311 else
2312 if test -d "$withval/include"
2313 then
2314 with_libnetlink_cflags="-I$withval/include"
2315 with_libnetlink_libs="-L$withval/lib -lnetlink"
2316 with_libnetlink="yes"
2317 else
2318 AC_MSG_ERROR("no such directory: $withval/include")
2319 fi
2320 fi; fi
2321 ],
2322 [
2323 if test "x$ac_system" = "xLinux"
2324 then
2325 with_libnetlink="yes"
2326 else
2327 with_libnetlink="no (Linux only library)"
2328 fi
2329 ])
2330 if test "x$with_libnetlink" = "xyes"
2331 then
2332 SAVE_CFLAGS="$CFLAGS"
2333 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2335 with_libnetlink="no (libnetlink.h not found)"
2337 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2338 [
2339 with_libnetlink="yes"
2340 break
2341 ], [],
2342 [#include <stdio.h>
2343 #include <sys/types.h>
2344 #include <asm/types.h>
2345 #include <sys/socket.h>
2346 #include <linux/netlink.h>
2347 #include <linux/rtnetlink.h>])
2348 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2349 [#include <stdio.h>
2350 #include <sys/types.h>
2351 #include <asm/types.h>
2352 #include <sys/socket.h>])
2354 AC_COMPILE_IFELSE(
2355 [#include <stdio.h>
2356 #include <sys/types.h>
2357 #include <asm/types.h>
2358 #include <sys/socket.h>
2359 #include <linux/netlink.h>
2360 #include <linux/rtnetlink.h>
2362 int main (void)
2363 {
2364 int retval = TCA_STATS2;
2365 return (retval);
2366 }],
2367 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2368 []);
2370 AC_COMPILE_IFELSE(
2371 [#include <stdio.h>
2372 #include <sys/types.h>
2373 #include <asm/types.h>
2374 #include <sys/socket.h>
2375 #include <linux/netlink.h>
2376 #include <linux/rtnetlink.h>
2378 int main (void)
2379 {
2380 int retval = TCA_STATS;
2381 return (retval);
2382 }],
2383 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2384 []);
2386 CFLAGS="$SAVE_CFLAGS"
2387 fi
2388 if test "x$with_libnetlink" = "xyes"
2389 then
2390 AC_CHECK_LIB(netlink, rtnl_open,
2391 [with_libnetlink="yes"],
2392 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2393 [$with_libnetlink_libs])
2394 fi
2395 if test "x$with_libnetlink" = "xyes"
2396 then
2397 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2398 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2399 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2400 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2401 fi
2402 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2403 # }}}
2405 # --with-libnetapp {{{
2406 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2407 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2408 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2409 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2410 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2411 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2412 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2413 [
2414 if test -d "$withval"
2415 then
2416 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2417 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2418 with_libnetapp="yes"
2419 else
2420 with_libnetapp="$withval"
2421 fi
2422 ],
2423 [
2424 with_libnetapp="yes"
2425 ])
2427 SAVE_CPPFLAGS="$CPPFLAGS"
2428 SAVE_LDFLAGS="$LDFLAGS"
2429 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2430 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2432 if test "x$with_libnetapp" = "xyes"
2433 then
2434 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2435 then
2436 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2437 fi
2438 AC_CHECK_HEADERS(netapp_api.h,
2439 [with_libnetapp="yes"],
2440 [with_libnetapp="no (netapp_api.h not found)"])
2441 fi
2443 if test "x$with_libnetapp" = "xyes"
2444 then
2445 if test "x$LIBNETAPP_LDFLAGS" != "x"
2446 then
2447 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2448 fi
2450 if test "x$LIBNETAPP_LIBS" = "x"
2451 then
2452 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2453 fi
2454 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2456 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2457 [with_libnetapp="yes"],
2458 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2459 [$LIBNETAPP_LIBS])
2460 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2461 fi
2463 CPPFLAGS="$SAVE_CPPFLAGS"
2464 LDFLAGS="$SAVE_LDFLAGS"
2466 if test "x$with_libnetapp" = "xyes"
2467 then
2468 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2469 fi
2471 AC_SUBST(LIBNETAPP_CPPFLAGS)
2472 AC_SUBST(LIBNETAPP_LDFLAGS)
2473 AC_SUBST(LIBNETAPP_LIBS)
2474 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2475 # }}}
2477 # --with-libnetsnmp {{{
2478 with_snmp_config="net-snmp-config"
2479 with_snmp_cflags=""
2480 with_snmp_libs=""
2481 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2482 [
2483 if test "x$withval" = "xno"
2484 then
2485 with_libnetsnmp="no"
2486 else if test "x$withval" = "xyes"
2487 then
2488 with_libnetsnmp="yes"
2489 else
2490 if test -x "$withval"
2491 then
2492 with_snmp_config="$withval"
2493 with_libnetsnmp="yes"
2494 else
2495 with_snmp_config="$withval/bin/net-snmp-config"
2496 with_libnetsnmp="yes"
2497 fi
2498 fi; fi
2499 ],
2500 [with_libnetsnmp="yes"])
2501 if test "x$with_libnetsnmp" = "xyes"
2502 then
2503 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2504 snmp_config_status=$?
2506 if test $snmp_config_status -ne 0
2507 then
2508 with_libnetsnmp="no ($with_snmp_config failed)"
2509 else
2510 SAVE_CPPFLAGS="$CPPFLAGS"
2511 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2513 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2515 CPPFLAGS="$SAVE_CPPFLAGS"
2516 fi
2517 fi
2518 if test "x$with_libnetsnmp" = "xyes"
2519 then
2520 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2521 snmp_config_status=$?
2523 if test $snmp_config_status -ne 0
2524 then
2525 with_libnetsnmp="no ($with_snmp_config failed)"
2526 else
2527 AC_CHECK_LIB(netsnmp, init_snmp,
2528 [with_libnetsnmp="yes"],
2529 [with_libnetsnmp="no (libnetsnmp not found)"],
2530 [$with_snmp_libs])
2531 fi
2532 fi
2533 if test "x$with_libnetsnmp" = "xyes"
2534 then
2535 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2536 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2537 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2538 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2539 fi
2540 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2541 # }}}
2543 # --with-liboconfig {{{
2544 with_own_liboconfig="no"
2545 liboconfig_LDFLAGS="$LDFLAGS"
2546 liboconfig_CPPFLAGS="$CPPFLAGS"
2547 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2548 [
2549 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2550 then
2551 if test -d "$withval/lib"
2552 then
2553 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2554 fi
2555 if test -d "$withval/include"
2556 then
2557 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2558 fi
2559 fi
2560 if test "x$withval" = "xno"
2561 then
2562 AC_MSG_ERROR("liboconfig is required")
2563 fi
2564 ],
2565 [
2566 with_liboconfig="yes"
2567 ])
2569 save_LDFLAGS="$LDFLAGS"
2570 save_CPPFLAGS="$CPPFLAGS"
2571 LDFLAGS="$liboconfig_LDFLAGS"
2572 CPPFLAGS="$liboconfig_CPPFLAGS"
2573 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2574 [
2575 with_liboconfig="yes"
2576 with_own_liboconfig="no"
2577 ],
2578 [
2579 with_liboconfig="yes"
2580 with_own_liboconfig="yes"
2581 LDFLAGS="$save_LDFLAGS"
2582 CPPFLAGS="$save_CPPFLAGS"
2583 ])
2585 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2586 if test "x$with_own_liboconfig" = "xyes"
2587 then
2588 with_liboconfig="yes (shipped version)"
2589 fi
2590 # }}}
2592 # --with-liboping {{{
2593 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2594 [
2595 if test "x$withval" = "xyes"
2596 then
2597 with_liboping="yes"
2598 else if test "x$withval" = "xno"
2599 then
2600 with_liboping="no"
2601 else
2602 with_liboping="yes"
2603 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2604 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2605 fi; fi
2606 ],
2607 [with_liboping="yes"])
2609 SAVE_CPPFLAGS="$CPPFLAGS"
2610 SAVE_LDFLAGS="$LDFLAGS"
2612 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2613 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2615 if test "x$with_liboping" = "xyes"
2616 then
2617 if test "x$LIBOPING_CPPFLAGS" != "x"
2618 then
2619 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2620 fi
2621 AC_CHECK_HEADERS(oping.h,
2622 [with_liboping="yes"],
2623 [with_liboping="no (oping.h not found)"])
2624 fi
2625 if test "x$with_liboping" = "xyes"
2626 then
2627 if test "x$LIBOPING_LDFLAGS" != "x"
2628 then
2629 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2630 fi
2631 AC_CHECK_LIB(oping, ping_construct,
2632 [with_liboping="yes"],
2633 [with_liboping="no (symbol 'ping_construct' not found)"])
2634 fi
2636 CPPFLAGS="$SAVE_CPPFLAGS"
2637 LDFLAGS="$SAVE_LDFLAGS"
2639 if test "x$with_liboping" = "xyes"
2640 then
2641 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2642 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2643 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2644 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2645 fi
2646 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2647 # }}}
2649 # --with-oracle {{{
2650 with_oracle_cppflags=""
2651 with_oracle_libs=""
2652 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2653 [
2654 if test "x$withval" = "xyes"
2655 then
2656 if test "x$ORACLE_HOME" = "x"
2657 then
2658 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2659 fi
2660 with_oracle="yes"
2661 else if test "x$withval" = "xno"
2662 then
2663 with_oracle="no"
2664 else
2665 with_oracle="yes"
2666 ORACLE_HOME="$withval"
2667 fi; fi
2668 ],
2669 [
2670 if test "x$ORACLE_HOME" = "x"
2671 then
2672 with_oracle="no (ORACLE_HOME is not set)"
2673 else
2674 with_oracle="yes"
2675 fi
2676 ])
2677 if test "x$ORACLE_HOME" != "x"
2678 then
2679 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2681 if test -e "$ORACLE_HOME/lib/ldflags"
2682 then
2683 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2684 fi
2685 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2686 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2687 fi
2688 if test "x$with_oracle" = "xyes"
2689 then
2690 SAVE_CPPFLAGS="$CPPFLAGS"
2691 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2693 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2695 CPPFLAGS="$SAVE_CPPFLAGS"
2696 fi
2697 if test "x$with_oracle" = "xyes"
2698 then
2699 SAVE_CPPFLAGS="$CPPFLAGS"
2700 SAVE_LDFLAGS="$LDFLAGS"
2701 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2702 LDFLAGS="$LDFLAGS $with_oracle_libs"
2704 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2706 CPPFLAGS="$SAVE_CPPFLAGS"
2707 LDFLAGS="$SAVE_LDFLAGS"
2708 fi
2709 if test "x$with_oracle" = "xyes"
2710 then
2711 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2712 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2713 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2714 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2715 fi
2716 # }}}
2718 # --with-libowcapi {{{
2719 with_libowcapi_cppflags=""
2720 with_libowcapi_libs="-lowcapi"
2721 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2722 [
2723 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2724 then
2725 with_libowcapi_cppflags="-I$withval/include"
2726 with_libowcapi_libs="-L$withval/lib -lowcapi"
2727 with_libowcapi="yes"
2728 else
2729 with_libowcapi="$withval"
2730 fi
2731 ],
2732 [
2733 with_libowcapi="yes"
2734 ])
2735 if test "x$with_libowcapi" = "xyes"
2736 then
2737 SAVE_CPPFLAGS="$CPPFLAGS"
2738 CPPFLAGS="$with_libowcapi_cppflags"
2740 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2742 CPPFLAGS="$SAVE_CPPFLAGS"
2743 fi
2744 if test "x$with_libowcapi" = "xyes"
2745 then
2746 SAVE_LDFLAGS="$LDFLAGS"
2747 SAVE_CPPFLAGS="$CPPFLAGS"
2748 LDFLAGS="$with_libowcapi_libs"
2749 CPPFLAGS="$with_libowcapi_cppflags"
2751 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2753 LDFLAGS="$SAVE_LDFLAGS"
2754 CPPFLAGS="$SAVE_CPPFLAGS"
2755 fi
2756 if test "x$with_libowcapi" = "xyes"
2757 then
2758 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2759 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2760 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2761 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2762 fi
2763 # }}}
2765 # --with-libpcap {{{
2766 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2767 [
2768 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2769 then
2770 LDFLAGS="$LDFLAGS -L$withval/lib"
2771 CPPFLAGS="$CPPFLAGS -I$withval/include"
2772 with_libpcap="yes"
2773 else
2774 with_libpcap="$withval"
2775 fi
2776 ],
2777 [
2778 with_libpcap="yes"
2779 ])
2780 if test "x$with_libpcap" = "xyes"
2781 then
2782 AC_CHECK_LIB(pcap, pcap_open_live,
2783 [
2784 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2785 ], [with_libpcap="no (libpcap not found)"])
2786 fi
2787 if test "x$with_libpcap" = "xyes"
2788 then
2789 AC_CHECK_HEADERS(pcap.h,,
2790 [with_libpcap="no (pcap.h not found)"])
2791 fi
2792 if test "x$with_libpcap" = "xyes"
2793 then
2794 AC_CHECK_HEADERS(pcap-bpf.h,,
2795 [with_libpcap="no (pcap-bpf.h not found)"])
2796 fi
2797 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2798 # }}}
2800 # --with-libperl {{{
2801 perl_interpreter="perl"
2802 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2803 [
2804 if test -x "$withval"
2805 then
2806 perl_interpreter="$withval"
2807 with_libperl="yes"
2808 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2809 then
2810 LDFLAGS="$LDFLAGS -L$withval/lib"
2811 CPPFLAGS="$CPPFLAGS -I$withval/include"
2812 perl_interpreter="$withval/bin/perl"
2813 with_libperl="yes"
2814 else
2815 with_libperl="$withval"
2816 fi; fi
2817 ],
2818 [
2819 with_libperl="yes"
2820 ])
2822 AC_MSG_CHECKING([for perl])
2823 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2824 if test -x "$perl_interpreter"
2825 then
2826 AC_MSG_RESULT([yes ($perl_interpreter)])
2827 else
2828 perl_interpreter=""
2829 AC_MSG_RESULT([no])
2830 fi
2832 AC_SUBST(PERL, "$perl_interpreter")
2834 if test "x$with_libperl" = "xyes" \
2835 && test -n "$perl_interpreter"
2836 then
2837 SAVE_CFLAGS="$CFLAGS"
2838 SAVE_LDFLAGS="$LDFLAGS"
2839 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2840 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2841 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2842 CFLAGS="$CFLAGS $PERL_CFLAGS"
2843 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2845 AC_CACHE_CHECK([for libperl],
2846 [c_cv_have_libperl],
2847 AC_LINK_IFELSE(
2848 AC_LANG_PROGRAM(
2849 [[
2850 #define PERL_NO_GET_CONTEXT
2851 #include <EXTERN.h>
2852 #include <perl.h>
2853 #include <XSUB.h>
2854 ]],
2855 [[
2856 dTHX;
2857 load_module (PERL_LOADMOD_NOIMPORT,
2858 newSVpv ("Collectd::Plugin::FooBar", 24),
2859 Nullsv);
2860 ]]),
2861 [c_cv_have_libperl="yes"],
2862 [c_cv_have_libperl="no"]
2863 )
2864 )
2866 if test "x$c_cv_have_libperl" = "xyes"
2867 then
2868 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2869 AC_SUBST(PERL_CFLAGS)
2870 AC_SUBST(PERL_LDFLAGS)
2871 else
2872 with_libperl="no"
2873 fi
2875 CFLAGS="$SAVE_CFLAGS"
2876 LDFLAGS="$SAVE_LDFLAGS"
2877 else if test -z "$perl_interpreter"; then
2878 with_libperl="no (no perl interpreter found)"
2879 c_cv_have_libperl="no"
2880 fi; fi
2881 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2883 if test "x$with_libperl" = "xyes"
2884 then
2885 SAVE_CFLAGS="$CFLAGS"
2886 SAVE_LDFLAGS="$LDFLAGS"
2887 CFLAGS="$CFLAGS $PERL_CFLAGS"
2888 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2890 AC_CACHE_CHECK([if perl supports ithreads],
2891 [c_cv_have_perl_ithreads],
2892 AC_LINK_IFELSE(
2893 AC_LANG_PROGRAM(
2894 [[
2895 #include <EXTERN.h>
2896 #include <perl.h>
2897 #include <XSUB.h>
2899 #if !defined(USE_ITHREADS)
2900 # error "Perl does not support ithreads!"
2901 #endif /* !defined(USE_ITHREADS) */
2902 ]],
2903 [[ ]]),
2904 [c_cv_have_perl_ithreads="yes"],
2905 [c_cv_have_perl_ithreads="no"]
2906 )
2907 )
2909 if test "x$c_cv_have_perl_ithreads" = "xyes"
2910 then
2911 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2912 fi
2914 CFLAGS="$SAVE_CFLAGS"
2915 LDFLAGS="$SAVE_LDFLAGS"
2916 fi
2918 if test "x$with_libperl" = "xyes"
2919 then
2920 SAVE_CFLAGS="$CFLAGS"
2921 SAVE_LDFLAGS="$LDFLAGS"
2922 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2923 # (see issues #41 and #42)
2924 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2925 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2927 AC_CACHE_CHECK([for broken Perl_load_module()],
2928 [c_cv_have_broken_perl_load_module],
2929 AC_LINK_IFELSE(
2930 AC_LANG_PROGRAM(
2931 [[
2932 #define PERL_NO_GET_CONTEXT
2933 #include <EXTERN.h>
2934 #include <perl.h>
2935 #include <XSUB.h>
2936 ]],
2937 [[
2938 dTHX;
2939 load_module (PERL_LOADMOD_NOIMPORT,
2940 newSVpv ("Collectd::Plugin::FooBar", 24),
2941 Nullsv);
2942 ]]),
2943 [c_cv_have_broken_perl_load_module="no"],
2944 [c_cv_have_broken_perl_load_module="yes"]
2945 )
2946 )
2948 CFLAGS="$SAVE_CFLAGS"
2949 LDFLAGS="$SAVE_LDFLAGS"
2950 fi
2951 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2952 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2954 if test "x$with_libperl" = "xyes"
2955 then
2956 SAVE_CFLAGS="$CFLAGS"
2957 SAVE_LDFLAGS="$LDFLAGS"
2958 CFLAGS="$CFLAGS $PERL_CFLAGS"
2959 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2961 AC_CHECK_MEMBER(
2962 [struct mgvtbl.svt_local],
2963 [have_struct_mgvtbl_svt_local="yes"],
2964 [have_struct_mgvtbl_svt_local="no"],
2965 [
2966 #include <EXTERN.h>
2967 #include <perl.h>
2968 #include <XSUB.h>
2969 ])
2971 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2972 then
2973 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2974 [Define if Perl's struct mgvtbl has member svt_local.])
2975 fi
2977 CFLAGS="$SAVE_CFLAGS"
2978 LDFLAGS="$SAVE_LDFLAGS"
2979 fi
2980 # }}}
2982 # --with-libpq {{{
2983 with_pg_config="pg_config"
2984 with_libpq_includedir=""
2985 with_libpq_libdir=""
2986 with_libpq_cppflags=""
2987 with_libpq_ldflags=""
2988 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2989 [Path to libpq.])],
2990 [
2991 if test "x$withval" = "xno"
2992 then
2993 with_libpq="no"
2994 else if test "x$withval" = "xyes"
2995 then
2996 with_libpq="yes"
2997 else
2998 if test -f "$withval" && test -x "$withval";
2999 then
3000 with_pg_config="$withval"
3001 else if test -x "$withval/bin/pg_config"
3002 then
3003 with_pg_config="$withval/bin/pg_config"
3004 fi; fi
3005 with_libpq="yes"
3006 fi; fi
3007 ],
3008 [
3009 with_libpq="yes"
3010 ])
3011 if test "x$with_libpq" = "xyes"
3012 then
3013 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3014 pg_config_status=$?
3016 if test $pg_config_status -eq 0
3017 then
3018 if test -n "$with_libpq_includedir"; then
3019 for dir in $with_libpq_includedir; do
3020 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3021 done
3022 fi
3023 else
3024 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3025 fi
3027 SAVE_CPPFLAGS="$CPPFLAGS"
3028 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3030 AC_CHECK_HEADERS(libpq-fe.h, [],
3031 [with_libpq="no (libpq-fe.h not found)"], [])
3033 CPPFLAGS="$SAVE_CPPFLAGS"
3034 fi
3035 if test "x$with_libpq" = "xyes"
3036 then
3037 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3038 pg_config_status=$?
3040 if test $pg_config_status -eq 0
3041 then
3042 if test -n "$with_libpq_libdir"; then
3043 for dir in $with_libpq_libdir; do
3044 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3045 done
3046 fi
3047 else
3048 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3049 fi
3051 SAVE_LDFLAGS="$LDFLAGS"
3052 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3054 AC_CHECK_LIB(pq, PQconnectdb,
3055 [with_libpq="yes"],
3056 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3058 AC_CHECK_LIB(pq, PQserverVersion,
3059 [with_libpq="yes"],
3060 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3062 LDFLAGS="$SAVE_LDFLAGS"
3063 fi
3064 if test "x$with_libpq" = "xyes"
3065 then
3066 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3067 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3068 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3069 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3070 fi
3071 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3072 # }}}
3074 # --with-libpthread {{{
3075 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3076 [ if test "x$withval" != "xno" \
3077 && test "x$withval" != "xyes"
3078 then
3079 LDFLAGS="$LDFLAGS -L$withval/lib"
3080 CPPFLAGS="$CPPFLAGS -I$withval/include"
3081 with_libpthread="yes"
3082 else
3083 if test "x$withval" = "xno"
3084 then
3085 with_libpthread="no (disabled)"
3086 fi
3087 fi
3088 ], [with_libpthread="yes"])
3089 if test "x$with_libpthread" = "xyes"
3090 then
3091 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3092 fi
3094 if test "x$with_libpthread" = "xyes"
3095 then
3096 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3097 fi
3098 if test "x$with_libpthread" = "xyes"
3099 then
3100 collect_pthread=1
3101 else
3102 collect_pthread=0
3103 fi
3104 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3105 [Wether or not to use pthread (POSIX threads) library])
3106 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3107 # }}}
3109 # --with-python {{{
3110 with_python_prog=""
3111 with_python_path="$PATH"
3112 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3113 [
3114 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3115 then
3116 with_python="$withval"
3117 else if test -x "$withval"
3118 then
3119 with_python_prog="$withval"
3120 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3121 with_python="yes"
3122 else if test -d "$withval"
3123 then
3124 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3125 with_python="yes"
3126 else
3127 AC_MSG_WARN([Argument not recognized: $withval])
3128 fi; fi; fi
3129 ], [with_python="yes"])
3131 SAVE_PATH="$PATH"
3132 SAVE_CPPFLAGS="$CPPFLAGS"
3133 SAVE_LDFLAGS="$LDFLAGS"
3134 SAVE_LIBS="$LIBS"
3136 PATH="$with_python_path"
3138 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3139 then
3140 AC_MSG_CHECKING([for python])
3141 with_python_prog="`which python 2>/dev/null`"
3142 if test "x$with_python_prog" = "x"
3143 then
3144 AC_MSG_RESULT([not found])
3145 with_python="no (interpreter not found)"
3146 else
3147 AC_MSG_RESULT([$with_python_prog])
3148 fi
3149 fi
3151 if test "x$with_python" = "xyes"
3152 then
3153 AC_MSG_CHECKING([for Python CPPFLAGS])
3154 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3155 python_config_status=$?
3157 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3158 then
3159 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3160 with_python="no"
3161 else
3162 AC_MSG_RESULT([$python_include_path])
3163 fi
3164 fi
3166 if test "x$with_python" = "xyes"
3167 then
3168 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3169 AC_CHECK_HEADERS(Python.h,
3170 [with_python="yes"],
3171 [with_python="no ('Python.h' not found)"])
3172 fi
3174 if test "x$with_python" = "xyes"
3175 then
3176 AC_MSG_CHECKING([for Python LDFLAGS])
3177 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`
3178 python_config_status=$?
3180 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3181 then
3182 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3183 with_python="no"
3184 else
3185 AC_MSG_RESULT([$python_library_path])
3186 fi
3187 fi
3189 if test "x$with_python" = "xyes"
3190 then
3191 AC_MSG_CHECKING([for Python LIBS])
3192 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`
3193 python_config_status=$?
3195 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3196 then
3197 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3198 with_python="no"
3199 else
3200 AC_MSG_RESULT([$python_library_flags])
3201 fi
3202 fi
3204 if test "x$with_python" = "xyes"
3205 then
3206 LDFLAGS="-L$python_library_path $LDFLAGS"
3207 LIBS="$python_library_flags $LIBS"
3209 AC_CHECK_FUNC(PyObject_CallFunction,
3210 [with_python="yes"],
3211 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3212 fi
3214 PATH="$SAVE_PATH"
3215 CPPFLAGS="$SAVE_CPPFLAGS"
3216 LDFLAGS="$SAVE_LDFLAGS"
3217 LIBS="$SAVE_LIBS"
3219 if test "x$with_python" = "xyes"
3220 then
3221 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3222 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3223 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3224 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3225 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3226 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3227 fi
3228 # }}} --with-python
3230 # --with-librabbitmq {{{
3231 with_librabbitmq_cppflags=""
3232 with_librabbitmq_ldflags=""
3233 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3234 [
3235 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3236 then
3237 with_librabbitmq_cppflags="-I$withval/include"
3238 with_librabbitmq_ldflags="-L$withval/lib"
3239 with_librabbitmq="yes"
3240 else
3241 with_librabbitmq="$withval"
3242 fi
3243 ],
3244 [
3245 with_librabbitmq="yes"
3246 ])
3247 if test "x$with_librabbitmq" = "xyes"
3248 then
3249 SAVE_CPPFLAGS="$CPPFLAGS"
3250 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3252 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3254 CPPFLAGS="$SAVE_CPPFLAGS"
3255 fi
3256 if test "x$with_librabbitmq" = "xyes"
3257 then
3258 SAVE_CPPFLAGS="$CPPFLAGS"
3259 SAVE_LDFLAGS="$LDFLAGS"
3260 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3261 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3263 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3265 CPPFLAGS="$SAVE_CPPFLAGS"
3266 LDFLAGS="$SAVE_LDFLAGS"
3267 fi
3268 if test "x$with_librabbitmq" = "xyes"
3269 then
3270 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3271 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3272 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3273 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3274 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3275 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3276 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3277 fi
3278 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3279 # }}}
3281 # --with-librouteros {{{
3282 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3283 [
3284 if test "x$withval" = "xyes"
3285 then
3286 with_librouteros="yes"
3287 else if test "x$withval" = "xno"
3288 then
3289 with_librouteros="no"
3290 else
3291 with_librouteros="yes"
3292 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3293 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3294 fi; fi
3295 ],
3296 [with_librouteros="yes"])
3298 SAVE_CPPFLAGS="$CPPFLAGS"
3299 SAVE_LDFLAGS="$LDFLAGS"
3301 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3302 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3304 if test "x$with_librouteros" = "xyes"
3305 then
3306 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3307 then
3308 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3309 fi
3310 AC_CHECK_HEADERS(routeros_api.h,
3311 [with_librouteros="yes"],
3312 [with_librouteros="no (routeros_api.h not found)"])
3313 fi
3314 if test "x$with_librouteros" = "xyes"
3315 then
3316 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3317 then
3318 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3319 fi
3320 AC_CHECK_LIB(routeros, ros_interface,
3321 [with_librouteros="yes"],
3322 [with_librouteros="no (symbol 'ros_interface' not found)"])
3323 fi
3325 CPPFLAGS="$SAVE_CPPFLAGS"
3326 LDFLAGS="$SAVE_LDFLAGS"
3328 if test "x$with_librouteros" = "xyes"
3329 then
3330 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3331 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3332 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3333 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3334 fi
3335 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3336 # }}}
3338 # --with-librrd {{{
3339 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3340 librrd_cflags=""
3341 librrd_ldflags=""
3342 librrd_threadsafe="yes"
3343 librrd_rrdc_update="no"
3344 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3345 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3346 then
3347 librrd_cflags="-I$withval/include"
3348 librrd_ldflags="-L$withval/lib"
3349 with_librrd="yes"
3350 else
3351 with_librrd="$withval"
3352 fi
3353 ], [with_librrd="yes"])
3354 if test "x$with_librrd" = "xyes"
3355 then
3356 SAVE_CPPFLAGS="$CPPFLAGS"
3357 SAVE_LDFLAGS="$LDFLAGS"
3359 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3360 LDFLAGS="$LDFLAGS $librrd_ldflags"
3362 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3364 CPPFLAGS="$SAVE_CPPFLAGS"
3365 LDFLAGS="$SAVE_LDFLAGS"
3366 fi
3367 if test "x$with_librrd" = "xyes"
3368 then
3369 SAVE_CPPFLAGS="$CPPFLAGS"
3370 SAVE_LDFLAGS="$LDFLAGS"
3372 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3373 LDFLAGS="$LDFLAGS $librrd_ldflags"
3375 AC_CHECK_LIB(rrd_th, rrd_update_r,
3376 [with_librrd="yes"
3377 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3378 ],
3379 [librrd_threadsafe="no"
3380 AC_CHECK_LIB(rrd, rrd_update,
3381 [with_librrd="yes"
3382 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3383 ],
3384 [with_librrd="no (symbol 'rrd_update' not found)"],
3385 [-lm])
3386 ],
3387 [-lm])
3389 if test "x$librrd_threadsafe" = "xyes"
3390 then
3391 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3392 else
3393 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3394 fi
3396 CPPFLAGS="$SAVE_CPPFLAGS"
3397 LDFLAGS="$SAVE_LDFLAGS"
3398 fi
3399 if test "x$with_librrd" = "xyes"
3400 then
3401 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3402 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3403 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3404 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3405 fi
3406 if test "x$librrd_threadsafe" = "xyes"
3407 then
3408 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3409 fi
3410 # }}}
3412 # --with-libsensors {{{
3413 with_sensors_cflags=""
3414 with_sensors_ldflags=""
3415 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3416 [
3417 if test "x$withval" = "xno"
3418 then
3419 with_libsensors="no"
3420 else
3421 with_libsensors="yes"
3422 if test "x$withval" != "xyes"
3423 then
3424 with_sensors_cflags="-I$withval/include"
3425 with_sensors_ldflags="-L$withval/lib"
3426 with_libsensors="yes"
3427 fi
3428 fi
3429 ],
3430 [
3431 if test "x$ac_system" = "xLinux"
3432 then
3433 with_libsensors="yes"
3434 else
3435 with_libsensors="no (Linux only library)"
3436 fi
3437 ])
3438 if test "x$with_libsensors" = "xyes"
3439 then
3440 SAVE_CPPFLAGS="$CPPFLAGS"
3441 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3443 # AC_CHECK_HEADERS(sensors/sensors.h,
3444 # [
3445 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3446 # ],
3447 # [with_libsensors="no (sensors/sensors.h not found)"])
3448 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3450 CPPFLAGS="$SAVE_CPPFLAGS"
3451 fi
3452 if test "x$with_libsensors" = "xyes"
3453 then
3454 SAVE_CPPFLAGS="$CPPFLAGS"
3455 SAVE_LDFLAGS="$LDFLAGS"
3456 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3457 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3459 AC_CHECK_LIB(sensors, sensors_init,
3460 [
3461 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3462 ],
3463 [with_libsensors="no (libsensors not found)"])
3465 CPPFLAGS="$SAVE_CPPFLAGS"
3466 LDFLAGS="$SAVE_LDFLAGS"
3467 fi
3468 if test "x$with_libsensors" = "xyes"
3469 then
3470 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3471 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3472 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3473 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3474 fi
3475 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3476 # }}}
3478 # --with-libstatgrab {{{
3479 with_libstatgrab_cflags=""
3480 with_libstatgrab_ldflags=""
3481 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3482 [
3483 if test "x$withval" != "xno" \
3484 && test "x$withval" != "xyes"
3485 then
3486 with_libstatgrab_cflags="-I$withval/include"
3487 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3488 with_libstatgrab="yes"
3489 with_libstatgrab_pkg_config="no"
3490 else
3491 with_libstatgrab="$withval"
3492 with_libstatgrab_pkg_config="yes"
3493 fi
3494 ],
3495 [
3496 with_libstatgrab="yes"
3497 with_libstatgrab_pkg_config="yes"
3498 ])
3500 if test "x$with_libstatgrab" = "xyes" \
3501 && test "x$with_libstatgrab_pkg_config" = "xyes"
3502 then
3503 if test "x$PKG_CONFIG" != "x"
3504 then
3505 AC_MSG_CHECKING([pkg-config for libstatgrab])
3506 temp_result="found"
3507 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3508 if test "$?" != "0"
3509 then
3510 with_libstatgrab_pkg_config="no"
3511 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3512 temp_result="not found"
3513 fi
3514 AC_MSG_RESULT([$temp_result])
3515 else
3516 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3517 with_libstatgrab_pkg_config="no"
3518 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3519 fi
3520 fi
3522 if test "x$with_libstatgrab" = "xyes" \
3523 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3524 && test "x$with_libstatgrab_cflags" = "x"
3525 then
3526 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3527 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3528 if test "$?" = "0"
3529 then
3530 with_libstatgrab_cflags="$temp_result"
3531 else
3532 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3533 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3534 fi
3535 AC_MSG_RESULT([$temp_result])
3536 fi
3538 if test "x$with_libstatgrab" = "xyes" \
3539 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3540 && test "x$with_libstatgrab_ldflags" = "x"
3541 then
3542 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3543 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3544 if test "$?" = "0"
3545 then
3546 with_libstatgrab_ldflags="$temp_result"
3547 else
3548 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3549 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3550 fi
3551 AC_MSG_RESULT([$temp_result])
3552 fi
3554 if test "x$with_libstatgrab" = "xyes"
3555 then
3556 SAVE_CPPFLAGS="$CPPFLAGS"
3557 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3559 AC_CHECK_HEADERS(statgrab.h,
3560 [with_libstatgrab="yes"],
3561 [with_libstatgrab="no (statgrab.h not found)"])
3563 CPPFLAGS="$SAVE_CPPFLAGS"
3564 fi
3566 if test "x$with_libstatgrab" = "xyes"
3567 then
3568 SAVE_CFLAGS="$CFLAGS"
3569 SAVE_LDFLAGS="$LDFLAGS"
3571 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3572 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3574 AC_CHECK_LIB(statgrab, sg_init,
3575 [with_libstatgrab="yes"],
3576 [with_libstatgrab="no (symbol sg_init not found)"])
3578 CFLAGS="$SAVE_CFLAGS"
3579 LDFLAGS="$SAVE_LDFLAGS"
3580 fi
3582 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3583 if test "x$with_libstatgrab" = "xyes"
3584 then
3585 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3586 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3587 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3588 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3589 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3590 fi
3591 # }}}
3593 # --with-libtokyotyrant {{{
3594 with_libtokyotyrant_cppflags=""
3595 with_libtokyotyrant_ldflags=""
3596 with_libtokyotyrant_libs=""
3597 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3598 [
3599 if test "x$withval" = "xno"
3600 then
3601 with_libtokyotyrant="no"
3602 else if test "x$withval" = "xyes"
3603 then
3604 with_libtokyotyrant="yes"
3605 else
3606 with_libtokyotyrant_cppflags="-I$withval/include"
3607 with_libtokyotyrant_ldflags="-L$withval/include"
3608 with_libtokyotyrant_libs="-ltokyotyrant"
3609 with_libtokyotyrant="yes"
3610 fi; fi
3611 ],
3612 [
3613 with_libtokyotyrant="yes"
3614 ])
3616 if test "x$with_libtokyotyrant" = "xyes"
3617 then
3618 if $PKG_CONFIG --exists tokyotyrant
3619 then
3620 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3621 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3622 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3623 fi
3624 fi
3626 SAVE_CPPFLAGS="$CPPFLAGS"
3627 SAVE_LDFLAGS="$LDFLAGS"
3628 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3629 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3631 if test "x$with_libtokyotyrant" = "xyes"
3632 then
3633 AC_CHECK_HEADERS(tcrdb.h,
3634 [
3635 AC_DEFINE(HAVE_TCRDB_H, 1,
3636 [Define to 1 if you have the <tcrdb.h> header file.])
3637 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3638 fi
3640 if test "x$with_libtokyotyrant" = "xyes"
3641 then
3642 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3643 [
3644 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3645 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3646 ],
3647 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3648 [$with_libtokyotyrant_libs])
3649 fi
3651 CPPFLAGS="$SAVE_CPPFLAGS"
3652 LDFLAGS="$SAVE_LDFLAGS"
3654 if test "x$with_libtokyotyrant" = "xyes"
3655 then
3656 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3657 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3658 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3659 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3660 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3661 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3662 fi
3663 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3664 # }}}
3666 # --with-libupsclient {{{
3667 with_libupsclient_config=""
3668 with_libupsclient_cflags=""
3669 with_libupsclient_libs=""
3670 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3671 [
3672 if test "x$withval" = "xno"
3673 then
3674 with_libupsclient="no"
3675 else if test "x$withval" = "xyes"
3676 then
3677 with_libupsclient="use_pkgconfig"
3678 else
3679 if test -x "$withval"
3680 then
3681 with_libupsclient_config="$withval"
3682 with_libupsclient="use_libupsclient_config"
3683 else if test -x "$withval/bin/libupsclient-config"
3684 then
3685 with_libupsclient_config="$withval/bin/libupsclient-config"
3686 with_libupsclient="use_libupsclient_config"
3687 else
3688 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3689 with_libupsclient_cflags="-I$withval/include"
3690 with_libupsclient_libs="-L$withval/lib -lupsclient"
3691 with_libupsclient="yes"
3692 fi; fi
3693 fi; fi
3694 ],
3695 [with_libupsclient="use_pkgconfig"])
3697 # configure using libupsclient-config
3698 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3699 then
3700 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3701 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3702 if test $? -ne 0
3703 then
3704 with_libupsclient="no ($with_libupsclient_config failed)"
3705 fi
3706 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3707 if test $? -ne 0
3708 then
3709 with_libupsclient="no ($with_libupsclient_config failed)"
3710 fi
3711 fi
3712 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3713 then
3714 with_libupsclient="yes"
3715 fi
3717 # configure using pkg-config
3718 if test "x$with_libupsclient" = "xuse_pkgconfig"
3719 then
3720 if test "x$PKG_CONFIG" = "x"
3721 then
3722 with_libupsclient="no (Don't have pkg-config)"
3723 fi
3724 fi
3725 if test "x$with_libupsclient" = "xuse_pkgconfig"
3726 then
3727 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3728 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3729 if test $? -ne 0
3730 then
3731 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3732 fi
3733 fi
3734 if test "x$with_libupsclient" = "xuse_pkgconfig"
3735 then
3736 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3737 if test $? -ne 0
3738 then
3739 with_libupsclient="no ($PKG_CONFIG failed)"
3740 fi
3741 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3742 if test $? -ne 0
3743 then
3744 with_libupsclient="no ($PKG_CONFIG failed)"
3745 fi
3746 fi
3747 if test "x$with_libupsclient" = "xuse_pkgconfig"
3748 then
3749 with_libupsclient="yes"
3750 fi
3752 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3753 # the actual checks.
3754 if test "x$with_libupsclient" = "xyes"
3755 then
3756 SAVE_CPPFLAGS="$CPPFLAGS"
3757 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3759 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3761 CPPFLAGS="$SAVE_CPPFLAGS"
3762 fi
3763 if test "x$with_libupsclient" = "xyes"
3764 then
3765 SAVE_CPPFLAGS="$CPPFLAGS"
3766 SAVE_LDFLAGS="$LDFLAGS"
3768 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3769 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3771 AC_CHECK_LIB(upsclient, upscli_connect,
3772 [with_libupsclient="yes"],
3773 [with_libupsclient="no (symbol upscli_connect not found)"])
3775 CPPFLAGS="$SAVE_CPPFLAGS"
3776 LDFLAGS="$SAVE_LDFLAGS"
3777 fi
3778 if test "x$with_libupsclient" = "xyes"
3779 then
3780 SAVE_CPPFLAGS="$CPPFLAGS"
3781 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3783 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3784 [#include <stdlib.h>
3785 #include <stdio.h>
3786 #include <upsclient.h>])
3788 CPPFLAGS="$SAVE_CPPFLAGS"
3789 fi
3790 if test "x$with_libupsclient" = "xyes"
3791 then
3792 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3793 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3794 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3795 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3796 fi
3797 # }}}
3799 # --with-libxmms {{{
3800 with_xmms_config="xmms-config"
3801 with_xmms_cflags=""
3802 with_xmms_libs=""
3803 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3804 [
3805 if test "x$withval" != "xno" \
3806 && test "x$withval" != "xyes"
3807 then
3808 if test -f "$withval" && test -x "$withval";
3809 then
3810 with_xmms_config="$withval"
3811 else if test -x "$withval/bin/xmms-config"
3812 then
3813 with_xmms_config="$withval/bin/xmms-config"
3814 fi; fi
3815 with_libxmms="yes"
3816 else if test "x$withval" = "xno"
3817 then
3818 with_libxmms="no"
3819 else
3820 with_libxmms="yes"
3821 fi; fi
3822 ],
3823 [
3824 with_libxmms="yes"
3825 ])
3826 if test "x$with_libxmms" = "xyes"
3827 then
3828 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3829 xmms_config_status=$?
3831 if test $xmms_config_status -ne 0
3832 then
3833 with_libxmms="no"
3834 fi
3835 fi
3836 if test "x$with_libxmms" = "xyes"
3837 then
3838 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3839 xmms_config_status=$?
3841 if test $xmms_config_status -ne 0
3842 then
3843 with_libxmms="no"
3844 fi
3845 fi
3846 if test "x$with_libxmms" = "xyes"
3847 then
3848 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3849 [
3850 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3851 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3852 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3853 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3854 ],
3855 [
3856 with_libxmms="no"
3857 ],
3858 [$with_xmms_libs])
3859 fi
3860 with_libxmms_numeric=0
3861 if test "x$with_libxmms" = "xyes"
3862 then
3863 with_libxmms_numeric=1
3864 fi
3865 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3866 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3867 # }}}
3869 # --with-libyajl {{{
3870 with_libyajl_cppflags=""
3871 with_libyajl_ldflags=""
3872 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3873 [
3874 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3875 then
3876 with_libyajl_cppflags="-I$withval/include"
3877 with_libyajl_ldflags="-L$withval/lib"
3878 with_libyajl="yes"
3879 else
3880 with_libyajl="$withval"
3881 fi
3882 ],
3883 [
3884 with_libyajl="yes"
3885 ])
3886 if test "x$with_libyajl" = "xyes"
3887 then
3888 SAVE_CPPFLAGS="$CPPFLAGS"
3889 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3891 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3892 AC_CHECK_HEADERS(yajl/yajl_version.h)
3894 CPPFLAGS="$SAVE_CPPFLAGS"
3895 fi
3896 if test "x$with_libyajl" = "xyes"
3897 then
3898 SAVE_CPPFLAGS="$CPPFLAGS"
3899 SAVE_LDFLAGS="$LDFLAGS"
3900 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3901 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3903 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3905 CPPFLAGS="$SAVE_CPPFLAGS"
3906 LDFLAGS="$SAVE_LDFLAGS"
3907 fi
3908 if test "x$with_libyajl" = "xyes"
3909 then
3910 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3911 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3912 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3913 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3914 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3915 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3916 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3917 fi
3918 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3919 # }}}
3921 # --with-libvarnish {{{
3922 with_libvarnish_cppflags=""
3923 with_libvarnish_cflags=""
3924 with_libvarnish_libs=""
3925 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
3926 [
3927 if test "x$withval" = "xno"
3928 then
3929 with_libvarnish="no"
3930 else if test "x$withval" = "xyes"
3931 then
3932 with_libvarnish="use_pkgconfig"
3933 else if test -d "$with_libvarnish/lib"
3934 then
3935 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
3936 with_libvarnish_cflags="-I$withval/include"
3937 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
3938 with_libvarnish="yes"
3939 fi; fi; fi
3940 ],
3941 [with_libvarnish="use_pkgconfig"])
3943 # configure using pkg-config
3944 if test "x$with_libvarnish" = "xuse_pkgconfig"
3945 then
3946 if test "x$PKG_CONFIG" = "x"
3947 then
3948 with_libvarnish="no (Don't have pkg-config)"
3949 fi
3950 fi
3951 if test "x$with_libvarnish" = "xuse_pkgconfig"
3952 then
3953 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
3954 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
3955 if test $? -ne 0
3956 then
3957 with_libvarnish="no (pkg-config doesn't know varnishapi)"
3958 fi
3959 fi
3960 if test "x$with_libvarnish" = "xuse_pkgconfig"
3961 then
3962 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
3963 if test $? -ne 0
3964 then
3965 with_libvarnish="no ($PKG_CONFIG failed)"
3966 fi
3967 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
3968 if test $? -ne 0
3969 then
3970 with_libvarnish="no ($PKG_CONFIG failed)"
3971 fi
3972 fi
3973 if test "x$with_libvarnish" = "xuse_pkgconfig"
3974 then
3975 with_libvarnish="yes"
3976 fi
3978 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
3979 # the actual checks.
3980 if test "x$with_libvarnish" = "xyes"
3981 then
3982 SAVE_CPPFLAGS="$CPPFLAGS"
3983 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3984 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
3986 CPPFLAGS="$SAVE_CPPFLAGS"
3987 fi
3988 if test "x$with_libvarnish" = "xyes"
3989 then
3990 SAVE_CPPFLAGS="$CPPFLAGS"
3991 #SAVE_LDFLAGS="$LDFLAGS"
3993 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3994 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
3996 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
3997 [with_libvarnish="yes"],
3998 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
3999 [$with_libvarnish_libs])
4001 CPPFLAGS="$SAVE_CPPFLAGS"
4002 #LDFLAGS="$SAVE_LDFLAGS"
4003 fi
4004 if test "x$with_libvarnish" = "xyes"
4005 then
4006 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4007 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4008 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4009 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4010 fi
4011 # }}}
4013 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4014 with_libxml2="no (pkg-config isn't available)"
4015 with_libxml2_cflags=""
4016 with_libxml2_ldflags=""
4017 with_libvirt="no (pkg-config isn't available)"
4018 with_libvirt_cflags=""
4019 with_libvirt_ldflags=""
4020 if test "x$PKG_CONFIG" != "x"
4021 then
4022 pkg-config --exists 'libxml-2.0' 2>/dev/null
4023 if test "$?" = "0"
4024 then
4025 with_libxml2="yes"
4026 else
4027 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4028 fi
4030 pkg-config --exists libvirt 2>/dev/null
4031 if test "$?" = "0"
4032 then
4033 with_libvirt="yes"
4034 else
4035 with_libvirt="no (pkg-config doesn't know libvirt)"
4036 fi
4037 fi
4038 if test "x$with_libxml2" = "xyes"
4039 then
4040 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4041 if test $? -ne 0
4042 then
4043 with_libxml2="no"
4044 fi
4045 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4046 if test $? -ne 0
4047 then
4048 with_libxml2="no"
4049 fi
4050 fi
4051 if test "x$with_libxml2" = "xyes"
4052 then
4053 SAVE_CPPFLAGS="$CPPFLAGS"
4054 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4056 AC_CHECK_HEADERS(libxml/parser.h, [],
4057 [with_libxml2="no (libxml/parser.h not found)"])
4059 CPPFLAGS="$SAVE_CPPFLAGS"
4060 fi
4061 if test "x$with_libxml2" = "xyes"
4062 then
4063 SAVE_CFLAGS="$CFLAGS"
4064 SAVE_LDFLAGS="$LDFLAGS"
4066 CFLAGS="$CFLAGS $with_libxml2_cflags"
4067 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4069 AC_CHECK_LIB(xml2, xmlXPathEval,
4070 [with_libxml2="yes"],
4071 [with_libxml2="no (symbol xmlXPathEval not found)"])
4073 CFLAGS="$SAVE_CFLAGS"
4074 LDFLAGS="$SAVE_LDFLAGS"
4075 fi
4076 dnl Add the right compiler flags and libraries.
4077 if test "x$with_libxml2" = "xyes"; then
4078 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4079 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4080 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4081 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4082 fi
4083 if test "x$with_libvirt" = "xyes"
4084 then
4085 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4086 if test $? -ne 0
4087 then
4088 with_libvirt="no"
4089 fi
4090 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4091 if test $? -ne 0
4092 then
4093 with_libvirt="no"
4094 fi
4095 fi
4096 if test "x$with_libvirt" = "xyes"
4097 then
4098 SAVE_CPPFLAGS="$CPPFLAGS"
4099 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4101 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4102 [with_libvirt="no (libvirt/libvirt.h not found)"])
4104 CPPFLAGS="$SAVE_CPPFLAGS"
4105 fi
4106 if test "x$with_libvirt" = "xyes"
4107 then
4108 SAVE_CFLAGS="$CFLAGS"
4109 SAVE_LDFLAGS="$LDFLAGS"
4111 CFLAGS="$CFLAGS $with_libvirt_cflags"
4112 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4114 AC_CHECK_LIB(virt, virDomainBlockStats,
4115 [with_libvirt="yes"],
4116 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4118 CFLAGS="$SAVE_CFLAGS"
4119 LDFLAGS="$SAVE_LDFLAGS"
4120 fi
4121 dnl Add the right compiler flags and libraries.
4122 if test "x$with_libvirt" = "xyes"; then
4123 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4124 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4125 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4126 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4127 fi
4128 # }}}
4130 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4131 with_libopenipmipthread="yes"
4132 with_libopenipmipthread_cflags=""
4133 with_libopenipmipthread_libs=""
4135 AC_MSG_CHECKING([for pkg-config])
4136 temp_result="no"
4137 if test "x$PKG_CONFIG" = "x"
4138 then
4139 with_libopenipmipthread="no"
4140 temp_result="no"
4141 else
4142 temp_result="$PKG_CONFIG"
4143 fi
4144 AC_MSG_RESULT([$temp_result])
4146 if test "x$with_libopenipmipthread" = "xyes"
4147 then
4148 AC_MSG_CHECKING([for libOpenIPMIpthread])
4149 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4150 if test "$?" != "0"
4151 then
4152 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4153 fi
4154 AC_MSG_RESULT([$with_libopenipmipthread])
4155 fi
4157 if test "x$with_libopenipmipthread" = "xyes"
4158 then
4159 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4160 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4161 if test "$?" = "0"
4162 then
4163 with_libopenipmipthread_cflags="$temp_result"
4164 else
4165 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4166 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4167 fi
4168 AC_MSG_RESULT([$temp_result])
4169 fi
4171 if test "x$with_libopenipmipthread" = "xyes"
4172 then
4173 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4174 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4175 if test "$?" = "0"
4176 then
4177 with_libopenipmipthread_ldflags="$temp_result"
4178 else
4179 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4180 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4181 fi
4182 AC_MSG_RESULT([$temp_result])
4183 fi
4185 if test "x$with_libopenipmipthread" = "xyes"
4186 then
4187 SAVE_CPPFLAGS="$CPPFLAGS"
4188 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4190 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4191 [with_libopenipmipthread="yes"],
4192 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4193 [#include <OpenIPMI/ipmiif.h>
4194 #include <OpenIPMI/ipmi_err.h>
4195 #include <OpenIPMI/ipmi_posix.h>
4196 #include <OpenIPMI/ipmi_conn.h>
4197 ])
4199 CPPFLAGS="$SAVE_CPPFLAGS"
4200 fi
4202 if test "x$with_libopenipmipthread" = "xyes"
4203 then
4204 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4205 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4206 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4207 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4208 fi
4209 # }}}
4211 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4212 [with_libnotify="yes"],
4213 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4214 with_libnotify="no"
4215 else
4216 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4217 fi])
4219 # Check for enabled/disabled features
4220 #
4222 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4223 # ------------------------------------------------------------
4224 dnl
4225 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4226 dnl
4227 AC_DEFUN(
4228 [AC_COLLECTD],
4229 [
4230 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4231 m4_if(
4232 [$2],
4233 [enable],
4234 [dnl
4235 m4_define([EnDis],[disabled])dnl
4236 m4_define([YesNo],[no])dnl
4237 ],dnl
4238 [m4_if(
4239 [$2],
4240 [disable],
4241 [dnl
4242 m4_define([EnDis],[enabled])dnl
4243 m4_define([YesNo],[yes])dnl
4244 ],
4245 [dnl
4246 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4247 ]dnl
4248 )]dnl
4249 )dnl
4250 m4_if([$3], [feature], [],
4251 [m4_if(
4252 [$3], [module], [],
4253 [dnl
4254 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4255 ]dnl
4256 )]dnl
4257 )dnl
4258 AC_ARG_ENABLE(
4259 [$1],
4260 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4261 [],
4262 enable_$1='[YesNo]'dnl
4263 )# AC_ARG_ENABLE
4264 if test "x$enable_$1" = "xno"
4265 then
4266 collectd_$1=0
4267 else
4268 if test "x$enable_$1" = "xyes"
4269 then
4270 collectd_$1=1
4271 else
4272 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4273 collectd_$1=1
4274 enable_$1='yes'
4275 fi
4276 fi
4277 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4278 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4279 ]dnl
4280 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4282 # AC_PLUGIN(name, default, info)
4283 # ------------------------------------------------------------
4284 dnl
4285 AC_DEFUN(
4286 [AC_PLUGIN],
4287 [
4288 enable_plugin="no"
4289 force="no"
4290 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4291 [
4292 if test "x$enableval" = "xyes"
4293 then
4294 enable_plugin="yes"
4295 else if test "x$enableval" = "xforce"
4296 then
4297 enable_plugin="yes"
4298 force="yes"
4299 else
4300 enable_plugin="no (disabled on command line)"
4301 fi; fi
4302 ],
4303 [
4304 if test "x$enable_all_plugins" = "xauto"
4305 then
4306 if test "x$2" = "xyes"
4307 then
4308 enable_plugin="yes"
4309 else
4310 enable_plugin="no"
4311 fi
4312 else
4313 enable_plugin="$enable_all_plugins"
4314 fi
4315 ])
4316 if test "x$enable_plugin" = "xyes"
4317 then
4318 if test "x$2" = "xyes" || test "x$force" = "xyes"
4319 then
4320 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4321 if test "x$2" != "xyes"
4322 then
4323 dependency_warning="yes"
4324 fi
4325 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4326 dependency_error="yes"
4327 enable_plugin="no (dependency error)"
4328 fi
4329 fi
4330 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4331 enable_$1="$enable_plugin"
4332 ]
4333 )# AC_PLUGIN(name, default, info)
4335 m4_divert_once([HELP_ENABLE], [
4336 collectd features:])
4337 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4338 AC_COLLECTD([debug], [enable], [feature], [debugging])
4339 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4340 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4342 dependency_warning="no"
4343 dependency_error="no"
4345 plugin_ascent="no"
4346 plugin_battery="no"
4347 plugin_bind="no"
4348 plugin_conntrack="no"
4349 plugin_contextswitch="no"
4350 plugin_cpu="no"
4351 plugin_cpufreq="no"
4352 plugin_curl_json="no"
4353 plugin_curl_xml="no"
4354 plugin_df="no"
4355 plugin_disk="no"
4356 plugin_entropy="no"
4357 plugin_interface="no"
4358 plugin_ipmi="no"
4359 plugin_ipvs="no"
4360 plugin_irq="no"
4361 plugin_libvirt="no"
4362 plugin_load="no"
4363 plugin_memory="no"
4364 plugin_multimeter="no"
4365 plugin_nfs="no"
4366 plugin_fscache="no"
4367 plugin_perl="no"
4368 plugin_processes="no"
4369 plugin_protocols="no"
4370 plugin_serial="no"
4371 plugin_swap="no"
4372 plugin_tape="no"
4373 plugin_tcpconns="no"
4374 plugin_ted="no"
4375 plugin_thermal="no"
4376 plugin_users="no"
4377 plugin_uptime="no"
4378 plugin_vmem="no"
4379 plugin_vserver="no"
4380 plugin_wireless="no"
4381 plugin_zfs_arc="no"
4383 # Linux
4384 if test "x$ac_system" = "xLinux"
4385 then
4386 plugin_battery="yes"
4387 plugin_conntrack="yes"
4388 plugin_contextswitch="yes"
4389 plugin_cpu="yes"
4390 plugin_cpufreq="yes"
4391 plugin_disk="yes"
4392 plugin_entropy="yes"
4393 plugin_interface="yes"
4394 plugin_irq="yes"
4395 plugin_load="yes"
4396 plugin_memory="yes"
4397 plugin_nfs="yes"
4398 plugin_fscache="yes"
4399 plugin_processes="yes"
4400 plugin_protocols="yes"
4401 plugin_serial="yes"
4402 plugin_swap="yes"
4403 plugin_tcpconns="yes"
4404 plugin_thermal="yes"
4405 plugin_uptime="yes"
4406 plugin_vmem="yes"
4407 plugin_vserver="yes"
4408 plugin_wireless="yes"
4410 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4411 then
4412 plugin_ipvs="yes"
4413 fi
4414 fi
4416 if test "x$ac_system" = "xOpenBSD"
4417 then
4418 plugin_tcpconns="yes"
4419 fi
4421 # Mac OS X devices
4422 if test "x$with_libiokit" = "xyes"
4423 then
4424 plugin_battery="yes"
4425 plugin_disk="yes"
4426 fi
4428 # AIX
4429 if test "x$with_perfstat" = "xyes"
4430 then
4431 plugin_cpu="yes"
4432 plugin_disk="yes"
4433 plugin_memory="yes"
4434 plugin_swap="yes"
4435 plugin_interface="yes"
4436 plugin_load="yes"
4437 fi
4439 if test "x$with_procinfo" = "xyes"
4440 then
4441 plugin_processes="yes"
4442 fi
4444 # Solaris
4445 if test "x$with_kstat" = "xyes"
4446 then
4447 plugin_uptime="yes"
4448 plugin_zfs_arc="yes"
4449 fi
4451 if test "x$with_devinfo$with_kstat" = "xyesyes"
4452 then
4453 plugin_cpu="yes"
4454 plugin_disk="yes"
4455 plugin_interface="yes"
4456 plugin_memory="yes"
4457 plugin_tape="yes"
4458 fi
4460 # libstatgrab
4461 if test "x$with_libstatgrab" = "xyes"
4462 then
4463 plugin_cpu="yes"
4464 plugin_disk="yes"
4465 plugin_interface="yes"
4466 plugin_load="yes"
4467 plugin_memory="yes"
4468 plugin_swap="yes"
4469 plugin_users="yes"
4470 fi
4472 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4473 then
4474 plugin_ascent="yes"
4475 if test "x$have_strptime" = "xyes"
4476 then
4477 plugin_bind="yes"
4478 fi
4479 fi
4481 if test "x$with_libopenipmipthread" = "xyes"
4482 then
4483 plugin_ipmi="yes"
4484 fi
4486 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4487 then
4488 plugin_curl_json="yes"
4489 fi
4491 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4492 then
4493 plugin_curl_xml="yes"
4494 fi
4496 if test "x$have_processor_info" = "xyes"
4497 then
4498 plugin_cpu="yes"
4499 fi
4500 if test "x$have_sysctl" = "xyes"
4501 then
4502 plugin_cpu="yes"
4503 plugin_memory="yes"
4504 plugin_uptime="yes"
4505 if test "x$ac_system" = "xDarwin"
4506 then
4507 plugin_swap="yes"
4508 fi
4509 fi
4510 if test "x$have_sysctlbyname" = "xyes"
4511 then
4512 plugin_contextswitch="yes"
4513 plugin_cpu="yes"
4514 plugin_memory="yes"
4515 plugin_tcpconns="yes"
4516 fi
4518 # Df plugin: Check if we know how to determine mount points first.
4519 #if test "x$have_listmntent" = "xyes"; then
4520 # plugin_df="yes"
4521 #fi
4522 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4523 then
4524 plugin_df="yes"
4525 fi
4526 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4527 then
4528 plugin_df="yes"
4529 fi
4530 #if test "x$have_getmntent" = "xseq"
4531 #then
4532 # plugin_df="yes"
4533 #fi
4534 if test "x$c_cv_have_one_getmntent" = "xyes"
4535 then
4536 plugin_df="yes"
4537 fi
4539 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4540 if test "x$plugin_df" = "xyes"
4541 then
4542 plugin_df="no"
4543 if test "x$have_statfs" = "xyes"
4544 then
4545 plugin_df="yes"
4546 fi
4547 if test "x$have_statvfs" = "xyes"
4548 then
4549 plugin_df="yes"
4550 fi
4551 fi
4553 if test "x$have_getifaddrs" = "xyes"
4554 then
4555 plugin_interface="yes"
4556 fi
4558 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4559 then
4560 plugin_libvirt="yes"
4561 fi
4563 if test "x$have_getloadavg" = "xyes"
4564 then
4565 plugin_load="yes"
4566 fi
4568 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4569 then
4570 plugin_perl="yes"
4571 fi
4573 # Mac OS X memory interface
4574 if test "x$have_host_statistics" = "xyes"
4575 then
4576 plugin_memory="yes"
4577 fi
4579 if test "x$have_termios_h" = "xyes"
4580 then
4581 plugin_multimeter="yes"
4582 plugin_ted="yes"
4583 fi
4585 if test "x$have_thread_info" = "xyes"
4586 then
4587 plugin_processes="yes"
4588 fi
4590 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4591 then
4592 plugin_processes="yes"
4593 fi
4595 if test "x$with_kvm_getswapinfo" = "xyes"
4596 then
4597 plugin_swap="yes"
4598 fi
4600 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4601 then
4602 plugin_swap="yes"
4603 fi
4605 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4606 then
4607 plugin_tcpconns="yes"
4608 fi
4610 if test "x$have_getutent" = "xyes"
4611 then
4612 plugin_users="yes"
4613 fi
4614 if test "x$have_getutxent" = "xyes"
4615 then
4616 plugin_users="yes"
4617 fi
4619 m4_divert_once([HELP_ENABLE], [
4620 collectd plugins:])
4622 AC_ARG_ENABLE([all-plugins],
4623 AC_HELP_STRING([--enable-all-plugins],
4624 [enable all plugins (auto by def)]),
4625 [
4626 if test "x$enableval" = "xyes"
4627 then
4628 enable_all_plugins="yes"
4629 else if test "x$enableval" = "xauto"
4630 then
4631 enable_all_plugins="auto"
4632 else
4633 enable_all_plugins="no"
4634 fi; fi
4635 ],
4636 [enable_all_plugins="auto"])
4638 m4_divert_once([HELP_ENABLE], [])
4640 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4641 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4642 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4643 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4644 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4645 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4646 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4647 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4648 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4649 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4650 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4651 AC_PLUGIN([csv], [yes], [CSV output plugin])
4652 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4653 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4654 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4655 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4656 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4657 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4658 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4659 AC_PLUGIN([email], [yes], [EMail statistics])
4660 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4661 AC_PLUGIN([exec], [yes], [Execution of external programs])
4662 AC_PLUGIN([filecount], [yes], [Count files in directories])
4663 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4664 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4665 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4666 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4667 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4668 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4669 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4670 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4671 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4672 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4673 AC_PLUGIN([load], [$plugin_load], [System load])
4674 AC_PLUGIN([logfile], [yes], [File logging plugin])
4675 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4676 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4677 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4678 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4679 AC_PLUGIN([match_regex], [yes], [The regex match])
4680 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4681 AC_PLUGIN([match_value], [yes], [The value match])
4682 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4683 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4684 AC_PLUGIN([memcached], [yes], [memcached statistics])
4685 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4686 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4687 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4688 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4689 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4690 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4691 AC_PLUGIN([network], [yes], [Network communication plugin])
4692 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4693 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4694 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4695 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4696 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4697 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4698 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4699 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4700 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4701 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4702 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4703 # FIXME: Check for libevent, too.
4704 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4705 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4706 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4707 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4708 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4709 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4710 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4711 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4712 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4713 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4714 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4715 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4716 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4717 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4718 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4719 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4720 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4721 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4722 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4723 AC_PLUGIN([target_notification], [yes], [The notification target])
4724 AC_PLUGIN([target_replace], [yes], [The replace target])
4725 AC_PLUGIN([target_scale],[yes], [The scale target])
4726 AC_PLUGIN([target_set], [yes], [The set target])
4727 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4728 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4729 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4730 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4731 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4732 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4733 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4734 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4735 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4736 AC_PLUGIN([users], [$plugin_users], [User statistics])
4737 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4738 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4739 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4740 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4741 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4742 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4743 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4744 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4745 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4747 dnl Default configuration file
4748 # Load either syslog or logfile
4749 LOAD_PLUGIN_SYSLOG=""
4750 LOAD_PLUGIN_LOGFILE=""
4752 AC_MSG_CHECKING([which default log plugin to load])
4753 default_log_plugin="none"
4754 if test "x$enable_syslog" = "xyes"
4755 then
4756 default_log_plugin="syslog"
4757 else
4758 LOAD_PLUGIN_SYSLOG="##"
4759 fi
4761 if test "x$enable_logfile" = "xyes"
4762 then
4763 if test "x$default_log_plugin" = "xnone"
4764 then
4765 default_log_plugin="logfile"
4766 else
4767 LOAD_PLUGIN_LOGFILE="#"
4768 fi
4769 else
4770 LOAD_PLUGIN_LOGFILE="##"
4771 fi
4772 AC_MSG_RESULT([$default_log_plugin])
4774 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4775 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4777 DEFAULT_LOG_LEVEL="info"
4778 if test "x$enable_debug" = "xyes"
4779 then
4780 DEFAULT_LOG_LEVEL="debug"
4781 fi
4782 AC_SUBST(DEFAULT_LOG_LEVEL)
4784 # Load only one of rrdtool, network, csv in the default config.
4785 LOAD_PLUGIN_RRDTOOL=""
4786 LOAD_PLUGIN_NETWORK=""
4787 LOAD_PLUGIN_CSV=""
4789 AC_MSG_CHECKING([which default write plugin to load])
4790 default_write_plugin="none"
4791 if test "x$enable_rrdtool" = "xyes"
4792 then
4793 default_write_plugin="rrdtool"
4794 else
4795 LOAD_PLUGIN_RRDTOOL="##"
4796 fi
4798 if test "x$enable_network" = "xyes"
4799 then
4800 if test "x$default_write_plugin" = "xnone"
4801 then
4802 default_write_plugin="network"
4803 else
4804 LOAD_PLUGIN_NETWORK="#"
4805 fi
4806 else
4807 LOAD_PLUGIN_NETWORK="##"
4808 fi
4810 if test "x$enable_csv" = "xyes"
4811 then
4812 if test "x$default_write_plugin" = "xnone"
4813 then
4814 default_write_plugin="csv"
4815 else
4816 LOAD_PLUGIN_CSV="#"
4817 fi
4818 else
4819 LOAD_PLUGIN_CSV="##"
4820 fi
4821 AC_MSG_RESULT([$default_write_plugin])
4823 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4824 AC_SUBST(LOAD_PLUGIN_NETWORK)
4825 AC_SUBST(LOAD_PLUGIN_CSV)
4827 dnl ip_vs.h
4828 if test "x$ac_system" = "xLinux" \
4829 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4830 then
4831 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4832 fi
4834 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4835 then
4836 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4837 fi
4839 dnl Perl bindings
4840 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4841 [
4842 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4843 then
4844 PERL_BINDINGS_OPTIONS="$withval"
4845 with_perl_bindings="yes"
4846 else
4847 PERL_BINDINGS_OPTIONS=""
4848 with_perl_bindings="$withval"
4849 fi
4850 ],
4851 [
4852 PERL_BINDINGS_OPTIONS=""
4853 if test -n "$perl_interpreter"
4854 then
4855 with_perl_bindings="yes"
4856 else
4857 with_perl_bindings="no (no perl interpreter found)"
4858 fi
4859 ])
4860 if test "x$with_perl_bindings" = "xyes"
4861 then
4862 PERL_BINDINGS="perl"
4863 else
4864 PERL_BINDINGS=""
4865 fi
4866 AC_SUBST(PERL_BINDINGS)
4867 AC_SUBST(PERL_BINDINGS_OPTIONS)
4869 dnl libcollectdclient
4870 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4871 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4872 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4874 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4876 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4878 AC_SUBST(LCC_VERSION_MAJOR)
4879 AC_SUBST(LCC_VERSION_MINOR)
4880 AC_SUBST(LCC_VERSION_PATCH)
4881 AC_SUBST(LCC_VERSION_EXTRA)
4882 AC_SUBST(LCC_VERSION_STRING)
4884 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4886 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4888 if test "x$with_librrd" = "xyes" \
4889 && test "x$librrd_threadsafe" != "xyes"
4890 then
4891 with_librrd="yes (warning: librrd is not thread-safe)"
4892 fi
4894 if test "x$with_libperl" = "xyes"
4895 then
4896 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4897 else
4898 enable_perl="no (needs libperl)"
4899 fi
4901 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4902 then
4903 enable_perl="no (libperl doesn't support ithreads)"
4904 fi
4906 if test "x$with_perl_bindings" = "xyes" \
4907 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4908 then
4909 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4910 fi
4912 cat <<EOF;
4914 Configuration:
4915 Libraries:
4916 libcurl . . . . . . . $with_libcurl
4917 libdbi . . . . . . . $with_libdbi
4918 libcredis . . . . . . $with_libcredis
4919 libesmtp . . . . . . $with_libesmtp
4920 libganglia . . . . . $with_libganglia
4921 libgcrypt . . . . . . $with_libgcrypt
4922 libiokit . . . . . . $with_libiokit
4923 libiptc . . . . . . . $with_libiptc
4924 libjvm . . . . . . . $with_java
4925 libkstat . . . . . . $with_kstat
4926 libkvm . . . . . . . $with_libkvm
4927 libmemcached . . . . $with_libmemcached
4928 libmodbus . . . . . . $with_libmodbus
4929 libmysql . . . . . . $with_libmysql
4930 libnetapp . . . . . . $with_libnetapp
4931 libnetlink . . . . . $with_libnetlink
4932 libnetsnmp . . . . . $with_libnetsnmp
4933 libnotify . . . . . . $with_libnotify
4934 liboconfig . . . . . $with_liboconfig
4935 libopenipmi . . . . . $with_libopenipmipthread
4936 liboping . . . . . . $with_liboping
4937 libpcap . . . . . . . $with_libpcap
4938 libperfstat . . . . . $with_perfstat
4939 libperl . . . . . . . $with_libperl
4940 libpq . . . . . . . . $with_libpq
4941 libpthread . . . . . $with_libpthread
4942 librabbitmq . . . . . $with_librabbitmq
4943 librouteros . . . . . $with_librouteros
4944 librrd . . . . . . . $with_librrd
4945 libsensors . . . . . $with_libsensors
4946 libstatgrab . . . . . $with_libstatgrab
4947 libtokyotyrant . . . $with_libtokyotyrant
4948 libupsclient . . . . $with_libupsclient
4949 libvarnish . . . . . $with_libvarnish
4950 libvirt . . . . . . . $with_libvirt
4951 libxml2 . . . . . . . $with_libxml2
4952 libxmms . . . . . . . $with_libxmms
4953 libyajl . . . . . . . $with_libyajl
4954 libevent . . . . . . $with_libevent
4955 protobuf-c . . . . . $have_protoc_c
4956 oracle . . . . . . . $with_oracle
4957 python . . . . . . . $with_python
4959 Features:
4960 daemon mode . . . . . $enable_daemon
4961 debug . . . . . . . . $enable_debug
4963 Bindings:
4964 perl . . . . . . . . $with_perl_bindings
4966 Modules:
4967 amqp . . . . . . . $enable_amqp
4968 apache . . . . . . . $enable_apache
4969 apcups . . . . . . . $enable_apcups
4970 apple_sensors . . . . $enable_apple_sensors
4971 ascent . . . . . . . $enable_ascent
4972 battery . . . . . . . $enable_battery
4973 bind . . . . . . . . $enable_bind
4974 conntrack . . . . . . $enable_conntrack
4975 contextswitch . . . . $enable_contextswitch
4976 cpu . . . . . . . . . $enable_cpu
4977 cpufreq . . . . . . . $enable_cpufreq
4978 csv . . . . . . . . . $enable_csv
4979 curl . . . . . . . . $enable_curl
4980 curl_json . . . . . . $enable_curl_json
4981 curl_xml . . . . . . $enable_curl_xml
4982 dbi . . . . . . . . . $enable_dbi
4983 df . . . . . . . . . $enable_df
4984 disk . . . . . . . . $enable_disk
4985 dns . . . . . . . . . $enable_dns
4986 email . . . . . . . . $enable_email
4987 entropy . . . . . . . $enable_entropy
4988 exec . . . . . . . . $enable_exec
4989 filecount . . . . . . $enable_filecount
4990 fscache . . . . . . . $enable_fscache
4991 gmond . . . . . . . . $enable_gmond
4992 hddtemp . . . . . . . $enable_hddtemp
4993 interface . . . . . . $enable_interface
4994 ipmi . . . . . . . . $enable_ipmi
4995 iptables . . . . . . $enable_iptables
4996 ipvs . . . . . . . . $enable_ipvs
4997 irq . . . . . . . . . $enable_irq
4998 java . . . . . . . . $enable_java
4999 libvirt . . . . . . . $enable_libvirt
5000 load . . . . . . . . $enable_load
5001 logfile . . . . . . . $enable_logfile
5002 lpar... . . . . . . . $enable_lpar
5003 madwifi . . . . . . . $enable_madwifi
5004 match_empty_counter . $enable_match_empty_counter
5005 match_hashed . . . . $enable_match_hashed
5006 match_regex . . . . . $enable_match_regex
5007 match_timediff . . . $enable_match_timediff
5008 match_value . . . . . $enable_match_value
5009 mbmon . . . . . . . . $enable_mbmon
5010 memcachec . . . . . . $enable_memcachec
5011 memcached . . . . . . $enable_memcached
5012 memory . . . . . . . $enable_memory
5013 modbus . . . . . . . $enable_modbus
5014 multimeter . . . . . $enable_multimeter
5015 mysql . . . . . . . . $enable_mysql
5016 netapp . . . . . . . $enable_netapp
5017 netlink . . . . . . . $enable_netlink
5018 network . . . . . . . $enable_network
5019 nfs . . . . . . . . . $enable_nfs
5020 nginx . . . . . . . . $enable_nginx
5021 notify_desktop . . . $enable_notify_desktop
5022 notify_email . . . . $enable_notify_email
5023 ntpd . . . . . . . . $enable_ntpd
5024 nut . . . . . . . . . $enable_nut
5025 olsrd . . . . . . . . $enable_olsrd
5026 onewire . . . . . . . $enable_onewire
5027 openvpn . . . . . . . $enable_openvpn
5028 oracle . . . . . . . $enable_oracle
5029 perl . . . . . . . . $enable_perl
5030 pinba . . . . . . . . $enable_pinba
5031 ping . . . . . . . . $enable_ping
5032 postgresql . . . . . $enable_postgresql
5033 powerdns . . . . . . $enable_powerdns
5034 processes . . . . . . $enable_processes
5035 protocols . . . . . . $enable_protocols
5036 python . . . . . . . $enable_python
5037 redis . . . . . . . . $enable_redis
5038 routeros . . . . . . $enable_routeros
5039 rrdcached . . . . . . $enable_rrdcached
5040 rrdtool . . . . . . . $enable_rrdtool
5041 sensors . . . . . . . $enable_sensors
5042 serial . . . . . . . $enable_serial
5043 snmp . . . . . . . . $enable_snmp
5044 swap . . . . . . . . $enable_swap
5045 syslog . . . . . . . $enable_syslog
5046 table . . . . . . . . $enable_table
5047 tail . . . . . . . . $enable_tail
5048 tape . . . . . . . . $enable_tape
5049 target_notification . $enable_target_notification
5050 target_replace . . . $enable_target_replace
5051 target_scale . . . . $enable_target_scale
5052 target_set . . . . . $enable_target_set
5053 target_v5upgrade . . $enable_target_v5upgrade
5054 tcpconns . . . . . . $enable_tcpconns
5055 teamspeak2 . . . . . $enable_teamspeak2
5056 ted . . . . . . . . . $enable_ted
5057 thermal . . . . . . . $enable_thermal
5058 threshold . . . . . . $enable_threshold
5059 tokyotyrant . . . . . $enable_tokyotyrant
5060 unixsock . . . . . . $enable_unixsock
5061 uptime . . . . . . . $enable_uptime
5062 users . . . . . . . . $enable_users
5063 uuid . . . . . . . . $enable_uuid
5064 varnish . . . . . . . $enable_varnish
5065 vmem . . . . . . . . $enable_vmem
5066 vserver . . . . . . . $enable_vserver
5067 wireless . . . . . . $enable_wireless
5068 write_http . . . . . $enable_write_http
5069 write_redis . . . . . $enable_write_redis
5070 xmms . . . . . . . . $enable_xmms
5071 zfs_arc . . . . . . . $enable_zfs_arc
5073 EOF
5075 if test "x$dependency_error" = "xyes"; then
5076 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5077 fi
5079 if test "x$dependency_warning" = "xyes"; then
5080 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5081 fi
5083 # vim: set fdm=marker :