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 SAVE_CPPFLAGS="$CPPFLAGS"
3248 SAVE_LDFLAGS="$LDFLAGS"
3249 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3250 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3251 if test "x$with_librabbitmq" = "xyes"
3252 then
3253 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3254 fi
3255 if test "x$with_librabbitmq" = "xyes"
3256 then
3257 # librabbitmq up to version 0.9.1 provides "library_errno", later
3258 # versions use "library_error". The library does not provide a version
3259 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3260 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3261 [
3262 #if HAVE_STDLIB_H
3263 # include <stdlib.h>
3264 #endif
3265 #if HAVE_STDIO_H
3266 # include <stdio.h>
3267 #endif
3268 #if HAVE_STDINT_H
3269 # include <stdint.h>
3270 #endif
3271 #if HAVE_INTTYPES_H
3272 # include <inttypes.h>
3273 #endif
3274 #include <amqp.h>
3275 ])
3276 fi
3277 if test "x$with_librabbitmq" = "xyes"
3278 then
3279 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3280 fi
3281 if test "x$with_librabbitmq" = "xyes"
3282 then
3283 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3284 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3285 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3286 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3287 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3288 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3289 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3290 fi
3291 CPPFLAGS="$SAVE_CPPFLAGS"
3292 LDFLAGS="$SAVE_LDFLAGS"
3293 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3294 # }}}
3296 # --with-librouteros {{{
3297 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3298 [
3299 if test "x$withval" = "xyes"
3300 then
3301 with_librouteros="yes"
3302 else if test "x$withval" = "xno"
3303 then
3304 with_librouteros="no"
3305 else
3306 with_librouteros="yes"
3307 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3308 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3309 fi; fi
3310 ],
3311 [with_librouteros="yes"])
3313 SAVE_CPPFLAGS="$CPPFLAGS"
3314 SAVE_LDFLAGS="$LDFLAGS"
3316 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3317 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3319 if test "x$with_librouteros" = "xyes"
3320 then
3321 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3322 then
3323 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3324 fi
3325 AC_CHECK_HEADERS(routeros_api.h,
3326 [with_librouteros="yes"],
3327 [with_librouteros="no (routeros_api.h not found)"])
3328 fi
3329 if test "x$with_librouteros" = "xyes"
3330 then
3331 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3332 then
3333 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3334 fi
3335 AC_CHECK_LIB(routeros, ros_interface,
3336 [with_librouteros="yes"],
3337 [with_librouteros="no (symbol 'ros_interface' not found)"])
3338 fi
3340 CPPFLAGS="$SAVE_CPPFLAGS"
3341 LDFLAGS="$SAVE_LDFLAGS"
3343 if test "x$with_librouteros" = "xyes"
3344 then
3345 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3346 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3347 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3348 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3349 fi
3350 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3351 # }}}
3353 # --with-librrd {{{
3354 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3355 librrd_cflags=""
3356 librrd_ldflags=""
3357 librrd_threadsafe="yes"
3358 librrd_rrdc_update="no"
3359 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3360 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3361 then
3362 librrd_cflags="-I$withval/include"
3363 librrd_ldflags="-L$withval/lib"
3364 with_librrd="yes"
3365 else
3366 with_librrd="$withval"
3367 fi
3368 ], [with_librrd="yes"])
3369 if test "x$with_librrd" = "xyes"
3370 then
3371 SAVE_CPPFLAGS="$CPPFLAGS"
3372 SAVE_LDFLAGS="$LDFLAGS"
3374 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3375 LDFLAGS="$LDFLAGS $librrd_ldflags"
3377 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3379 CPPFLAGS="$SAVE_CPPFLAGS"
3380 LDFLAGS="$SAVE_LDFLAGS"
3381 fi
3382 if test "x$with_librrd" = "xyes"
3383 then
3384 SAVE_CPPFLAGS="$CPPFLAGS"
3385 SAVE_LDFLAGS="$LDFLAGS"
3387 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3388 LDFLAGS="$LDFLAGS $librrd_ldflags"
3390 AC_CHECK_LIB(rrd_th, rrd_update_r,
3391 [with_librrd="yes"
3392 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3393 ],
3394 [librrd_threadsafe="no"
3395 AC_CHECK_LIB(rrd, rrd_update,
3396 [with_librrd="yes"
3397 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3398 ],
3399 [with_librrd="no (symbol 'rrd_update' not found)"],
3400 [-lm])
3401 ],
3402 [-lm])
3404 if test "x$librrd_threadsafe" = "xyes"
3405 then
3406 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3407 else
3408 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3409 fi
3411 CPPFLAGS="$SAVE_CPPFLAGS"
3412 LDFLAGS="$SAVE_LDFLAGS"
3413 fi
3414 if test "x$with_librrd" = "xyes"
3415 then
3416 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3417 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3418 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3419 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3420 fi
3421 if test "x$librrd_threadsafe" = "xyes"
3422 then
3423 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3424 fi
3425 # }}}
3427 # --with-libsensors {{{
3428 with_sensors_cflags=""
3429 with_sensors_ldflags=""
3430 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3431 [
3432 if test "x$withval" = "xno"
3433 then
3434 with_libsensors="no"
3435 else
3436 with_libsensors="yes"
3437 if test "x$withval" != "xyes"
3438 then
3439 with_sensors_cflags="-I$withval/include"
3440 with_sensors_ldflags="-L$withval/lib"
3441 with_libsensors="yes"
3442 fi
3443 fi
3444 ],
3445 [
3446 if test "x$ac_system" = "xLinux"
3447 then
3448 with_libsensors="yes"
3449 else
3450 with_libsensors="no (Linux only library)"
3451 fi
3452 ])
3453 if test "x$with_libsensors" = "xyes"
3454 then
3455 SAVE_CPPFLAGS="$CPPFLAGS"
3456 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3458 # AC_CHECK_HEADERS(sensors/sensors.h,
3459 # [
3460 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3461 # ],
3462 # [with_libsensors="no (sensors/sensors.h not found)"])
3463 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3465 CPPFLAGS="$SAVE_CPPFLAGS"
3466 fi
3467 if test "x$with_libsensors" = "xyes"
3468 then
3469 SAVE_CPPFLAGS="$CPPFLAGS"
3470 SAVE_LDFLAGS="$LDFLAGS"
3471 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3472 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3474 AC_CHECK_LIB(sensors, sensors_init,
3475 [
3476 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3477 ],
3478 [with_libsensors="no (libsensors not found)"])
3480 CPPFLAGS="$SAVE_CPPFLAGS"
3481 LDFLAGS="$SAVE_LDFLAGS"
3482 fi
3483 if test "x$with_libsensors" = "xyes"
3484 then
3485 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3486 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3487 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3488 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3489 fi
3490 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3491 # }}}
3493 # --with-libstatgrab {{{
3494 with_libstatgrab_cflags=""
3495 with_libstatgrab_ldflags=""
3496 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3497 [
3498 if test "x$withval" != "xno" \
3499 && test "x$withval" != "xyes"
3500 then
3501 with_libstatgrab_cflags="-I$withval/include"
3502 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3503 with_libstatgrab="yes"
3504 with_libstatgrab_pkg_config="no"
3505 else
3506 with_libstatgrab="$withval"
3507 with_libstatgrab_pkg_config="yes"
3508 fi
3509 ],
3510 [
3511 with_libstatgrab="yes"
3512 with_libstatgrab_pkg_config="yes"
3513 ])
3515 if test "x$with_libstatgrab" = "xyes" \
3516 && test "x$with_libstatgrab_pkg_config" = "xyes"
3517 then
3518 if test "x$PKG_CONFIG" != "x"
3519 then
3520 AC_MSG_CHECKING([pkg-config for libstatgrab])
3521 temp_result="found"
3522 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3523 if test "$?" != "0"
3524 then
3525 with_libstatgrab_pkg_config="no"
3526 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3527 temp_result="not found"
3528 fi
3529 AC_MSG_RESULT([$temp_result])
3530 else
3531 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3532 with_libstatgrab_pkg_config="no"
3533 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3534 fi
3535 fi
3537 if test "x$with_libstatgrab" = "xyes" \
3538 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3539 && test "x$with_libstatgrab_cflags" = "x"
3540 then
3541 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3542 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3543 if test "$?" = "0"
3544 then
3545 with_libstatgrab_cflags="$temp_result"
3546 else
3547 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3548 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3549 fi
3550 AC_MSG_RESULT([$temp_result])
3551 fi
3553 if test "x$with_libstatgrab" = "xyes" \
3554 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3555 && test "x$with_libstatgrab_ldflags" = "x"
3556 then
3557 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3558 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3559 if test "$?" = "0"
3560 then
3561 with_libstatgrab_ldflags="$temp_result"
3562 else
3563 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3564 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3565 fi
3566 AC_MSG_RESULT([$temp_result])
3567 fi
3569 if test "x$with_libstatgrab" = "xyes"
3570 then
3571 SAVE_CPPFLAGS="$CPPFLAGS"
3572 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3574 AC_CHECK_HEADERS(statgrab.h,
3575 [with_libstatgrab="yes"],
3576 [with_libstatgrab="no (statgrab.h not found)"])
3578 CPPFLAGS="$SAVE_CPPFLAGS"
3579 fi
3581 if test "x$with_libstatgrab" = "xyes"
3582 then
3583 SAVE_CFLAGS="$CFLAGS"
3584 SAVE_LDFLAGS="$LDFLAGS"
3586 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3587 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3589 AC_CHECK_LIB(statgrab, sg_init,
3590 [with_libstatgrab="yes"],
3591 [with_libstatgrab="no (symbol sg_init not found)"])
3593 CFLAGS="$SAVE_CFLAGS"
3594 LDFLAGS="$SAVE_LDFLAGS"
3595 fi
3597 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3598 if test "x$with_libstatgrab" = "xyes"
3599 then
3600 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3601 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3602 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3603 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3604 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3605 fi
3606 # }}}
3608 # --with-libtokyotyrant {{{
3609 with_libtokyotyrant_cppflags=""
3610 with_libtokyotyrant_ldflags=""
3611 with_libtokyotyrant_libs=""
3612 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3613 [
3614 if test "x$withval" = "xno"
3615 then
3616 with_libtokyotyrant="no"
3617 else if test "x$withval" = "xyes"
3618 then
3619 with_libtokyotyrant="yes"
3620 else
3621 with_libtokyotyrant_cppflags="-I$withval/include"
3622 with_libtokyotyrant_ldflags="-L$withval/include"
3623 with_libtokyotyrant_libs="-ltokyotyrant"
3624 with_libtokyotyrant="yes"
3625 fi; fi
3626 ],
3627 [
3628 with_libtokyotyrant="yes"
3629 ])
3631 if test "x$with_libtokyotyrant" = "xyes"
3632 then
3633 if $PKG_CONFIG --exists tokyotyrant
3634 then
3635 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3636 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3637 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3638 fi
3639 fi
3641 SAVE_CPPFLAGS="$CPPFLAGS"
3642 SAVE_LDFLAGS="$LDFLAGS"
3643 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3644 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3646 if test "x$with_libtokyotyrant" = "xyes"
3647 then
3648 AC_CHECK_HEADERS(tcrdb.h,
3649 [
3650 AC_DEFINE(HAVE_TCRDB_H, 1,
3651 [Define to 1 if you have the <tcrdb.h> header file.])
3652 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3653 fi
3655 if test "x$with_libtokyotyrant" = "xyes"
3656 then
3657 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3658 [
3659 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3660 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3661 ],
3662 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3663 [$with_libtokyotyrant_libs])
3664 fi
3666 CPPFLAGS="$SAVE_CPPFLAGS"
3667 LDFLAGS="$SAVE_LDFLAGS"
3669 if test "x$with_libtokyotyrant" = "xyes"
3670 then
3671 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3672 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3673 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3674 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3675 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3676 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3677 fi
3678 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3679 # }}}
3681 # --with-libupsclient {{{
3682 with_libupsclient_config=""
3683 with_libupsclient_cflags=""
3684 with_libupsclient_libs=""
3685 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3686 [
3687 if test "x$withval" = "xno"
3688 then
3689 with_libupsclient="no"
3690 else if test "x$withval" = "xyes"
3691 then
3692 with_libupsclient="use_pkgconfig"
3693 else
3694 if test -x "$withval"
3695 then
3696 with_libupsclient_config="$withval"
3697 with_libupsclient="use_libupsclient_config"
3698 else if test -x "$withval/bin/libupsclient-config"
3699 then
3700 with_libupsclient_config="$withval/bin/libupsclient-config"
3701 with_libupsclient="use_libupsclient_config"
3702 else
3703 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3704 with_libupsclient_cflags="-I$withval/include"
3705 with_libupsclient_libs="-L$withval/lib -lupsclient"
3706 with_libupsclient="yes"
3707 fi; fi
3708 fi; fi
3709 ],
3710 [with_libupsclient="use_pkgconfig"])
3712 # configure using libupsclient-config
3713 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3714 then
3715 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3716 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3717 if test $? -ne 0
3718 then
3719 with_libupsclient="no ($with_libupsclient_config failed)"
3720 fi
3721 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3722 if test $? -ne 0
3723 then
3724 with_libupsclient="no ($with_libupsclient_config failed)"
3725 fi
3726 fi
3727 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3728 then
3729 with_libupsclient="yes"
3730 fi
3732 # configure using pkg-config
3733 if test "x$with_libupsclient" = "xuse_pkgconfig"
3734 then
3735 if test "x$PKG_CONFIG" = "x"
3736 then
3737 with_libupsclient="no (Don't have pkg-config)"
3738 fi
3739 fi
3740 if test "x$with_libupsclient" = "xuse_pkgconfig"
3741 then
3742 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3743 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3744 if test $? -ne 0
3745 then
3746 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3747 fi
3748 fi
3749 if test "x$with_libupsclient" = "xuse_pkgconfig"
3750 then
3751 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3752 if test $? -ne 0
3753 then
3754 with_libupsclient="no ($PKG_CONFIG failed)"
3755 fi
3756 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3757 if test $? -ne 0
3758 then
3759 with_libupsclient="no ($PKG_CONFIG failed)"
3760 fi
3761 fi
3762 if test "x$with_libupsclient" = "xuse_pkgconfig"
3763 then
3764 with_libupsclient="yes"
3765 fi
3767 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3768 # the actual checks.
3769 if test "x$with_libupsclient" = "xyes"
3770 then
3771 SAVE_CPPFLAGS="$CPPFLAGS"
3772 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3774 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3776 CPPFLAGS="$SAVE_CPPFLAGS"
3777 fi
3778 if test "x$with_libupsclient" = "xyes"
3779 then
3780 SAVE_CPPFLAGS="$CPPFLAGS"
3781 SAVE_LDFLAGS="$LDFLAGS"
3783 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3784 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3786 AC_CHECK_LIB(upsclient, upscli_connect,
3787 [with_libupsclient="yes"],
3788 [with_libupsclient="no (symbol upscli_connect not found)"])
3790 CPPFLAGS="$SAVE_CPPFLAGS"
3791 LDFLAGS="$SAVE_LDFLAGS"
3792 fi
3793 if test "x$with_libupsclient" = "xyes"
3794 then
3795 SAVE_CPPFLAGS="$CPPFLAGS"
3796 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3798 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3799 [#include <stdlib.h>
3800 #include <stdio.h>
3801 #include <upsclient.h>])
3803 CPPFLAGS="$SAVE_CPPFLAGS"
3804 fi
3805 if test "x$with_libupsclient" = "xyes"
3806 then
3807 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3808 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3809 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3810 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3811 fi
3812 # }}}
3814 # --with-libxmms {{{
3815 with_xmms_config="xmms-config"
3816 with_xmms_cflags=""
3817 with_xmms_libs=""
3818 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3819 [
3820 if test "x$withval" != "xno" \
3821 && test "x$withval" != "xyes"
3822 then
3823 if test -f "$withval" && test -x "$withval";
3824 then
3825 with_xmms_config="$withval"
3826 else if test -x "$withval/bin/xmms-config"
3827 then
3828 with_xmms_config="$withval/bin/xmms-config"
3829 fi; fi
3830 with_libxmms="yes"
3831 else if test "x$withval" = "xno"
3832 then
3833 with_libxmms="no"
3834 else
3835 with_libxmms="yes"
3836 fi; fi
3837 ],
3838 [
3839 with_libxmms="yes"
3840 ])
3841 if test "x$with_libxmms" = "xyes"
3842 then
3843 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3844 xmms_config_status=$?
3846 if test $xmms_config_status -ne 0
3847 then
3848 with_libxmms="no"
3849 fi
3850 fi
3851 if test "x$with_libxmms" = "xyes"
3852 then
3853 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3854 xmms_config_status=$?
3856 if test $xmms_config_status -ne 0
3857 then
3858 with_libxmms="no"
3859 fi
3860 fi
3861 if test "x$with_libxmms" = "xyes"
3862 then
3863 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3864 [
3865 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3866 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3867 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3868 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3869 ],
3870 [
3871 with_libxmms="no"
3872 ],
3873 [$with_xmms_libs])
3874 fi
3875 with_libxmms_numeric=0
3876 if test "x$with_libxmms" = "xyes"
3877 then
3878 with_libxmms_numeric=1
3879 fi
3880 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3881 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3882 # }}}
3884 # --with-libyajl {{{
3885 with_libyajl_cppflags=""
3886 with_libyajl_ldflags=""
3887 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3888 [
3889 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3890 then
3891 with_libyajl_cppflags="-I$withval/include"
3892 with_libyajl_ldflags="-L$withval/lib"
3893 with_libyajl="yes"
3894 else
3895 with_libyajl="$withval"
3896 fi
3897 ],
3898 [
3899 with_libyajl="yes"
3900 ])
3901 if test "x$with_libyajl" = "xyes"
3902 then
3903 SAVE_CPPFLAGS="$CPPFLAGS"
3904 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3906 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3907 AC_CHECK_HEADERS(yajl/yajl_version.h)
3909 CPPFLAGS="$SAVE_CPPFLAGS"
3910 fi
3911 if test "x$with_libyajl" = "xyes"
3912 then
3913 SAVE_CPPFLAGS="$CPPFLAGS"
3914 SAVE_LDFLAGS="$LDFLAGS"
3915 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3916 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3918 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3920 CPPFLAGS="$SAVE_CPPFLAGS"
3921 LDFLAGS="$SAVE_LDFLAGS"
3922 fi
3923 if test "x$with_libyajl" = "xyes"
3924 then
3925 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3926 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3927 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3928 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3929 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3930 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3931 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3932 fi
3933 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3934 # }}}
3936 # --with-libvarnish {{{
3937 with_libvarnish_cppflags=""
3938 with_libvarnish_cflags=""
3939 with_libvarnish_libs=""
3940 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
3941 [
3942 if test "x$withval" = "xno"
3943 then
3944 with_libvarnish="no"
3945 else if test "x$withval" = "xyes"
3946 then
3947 with_libvarnish="use_pkgconfig"
3948 else if test -d "$with_libvarnish/lib"
3949 then
3950 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
3951 with_libvarnish_cflags="-I$withval/include"
3952 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
3953 with_libvarnish="yes"
3954 fi; fi; fi
3955 ],
3956 [with_libvarnish="use_pkgconfig"])
3958 # configure using pkg-config
3959 if test "x$with_libvarnish" = "xuse_pkgconfig"
3960 then
3961 if test "x$PKG_CONFIG" = "x"
3962 then
3963 with_libvarnish="no (Don't have pkg-config)"
3964 fi
3965 fi
3966 if test "x$with_libvarnish" = "xuse_pkgconfig"
3967 then
3968 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
3969 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
3970 if test $? -ne 0
3971 then
3972 with_libvarnish="no (pkg-config doesn't know varnishapi)"
3973 fi
3974 fi
3975 if test "x$with_libvarnish" = "xuse_pkgconfig"
3976 then
3977 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
3978 if test $? -ne 0
3979 then
3980 with_libvarnish="no ($PKG_CONFIG failed)"
3981 fi
3982 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
3983 if test $? -ne 0
3984 then
3985 with_libvarnish="no ($PKG_CONFIG failed)"
3986 fi
3987 fi
3988 if test "x$with_libvarnish" = "xuse_pkgconfig"
3989 then
3990 with_libvarnish="yes"
3991 fi
3993 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
3994 # the actual checks.
3995 if test "x$with_libvarnish" = "xyes"
3996 then
3997 SAVE_CPPFLAGS="$CPPFLAGS"
3998 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3999 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4001 CPPFLAGS="$SAVE_CPPFLAGS"
4002 fi
4003 if test "x$with_libvarnish" = "xyes"
4004 then
4005 SAVE_CPPFLAGS="$CPPFLAGS"
4006 #SAVE_LDFLAGS="$LDFLAGS"
4008 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4009 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4011 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
4012 [with_libvarnish="yes"],
4013 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
4014 [$with_libvarnish_libs])
4016 CPPFLAGS="$SAVE_CPPFLAGS"
4017 #LDFLAGS="$SAVE_LDFLAGS"
4018 fi
4019 if test "x$with_libvarnish" = "xyes"
4020 then
4021 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4022 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4023 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4024 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4025 fi
4026 # }}}
4028 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4029 with_libxml2="no (pkg-config isn't available)"
4030 with_libxml2_cflags=""
4031 with_libxml2_ldflags=""
4032 with_libvirt="no (pkg-config isn't available)"
4033 with_libvirt_cflags=""
4034 with_libvirt_ldflags=""
4035 if test "x$PKG_CONFIG" != "x"
4036 then
4037 pkg-config --exists 'libxml-2.0' 2>/dev/null
4038 if test "$?" = "0"
4039 then
4040 with_libxml2="yes"
4041 else
4042 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4043 fi
4045 pkg-config --exists libvirt 2>/dev/null
4046 if test "$?" = "0"
4047 then
4048 with_libvirt="yes"
4049 else
4050 with_libvirt="no (pkg-config doesn't know libvirt)"
4051 fi
4052 fi
4053 if test "x$with_libxml2" = "xyes"
4054 then
4055 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4056 if test $? -ne 0
4057 then
4058 with_libxml2="no"
4059 fi
4060 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4061 if test $? -ne 0
4062 then
4063 with_libxml2="no"
4064 fi
4065 fi
4066 if test "x$with_libxml2" = "xyes"
4067 then
4068 SAVE_CPPFLAGS="$CPPFLAGS"
4069 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4071 AC_CHECK_HEADERS(libxml/parser.h, [],
4072 [with_libxml2="no (libxml/parser.h not found)"])
4074 CPPFLAGS="$SAVE_CPPFLAGS"
4075 fi
4076 if test "x$with_libxml2" = "xyes"
4077 then
4078 SAVE_CFLAGS="$CFLAGS"
4079 SAVE_LDFLAGS="$LDFLAGS"
4081 CFLAGS="$CFLAGS $with_libxml2_cflags"
4082 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4084 AC_CHECK_LIB(xml2, xmlXPathEval,
4085 [with_libxml2="yes"],
4086 [with_libxml2="no (symbol xmlXPathEval not found)"])
4088 CFLAGS="$SAVE_CFLAGS"
4089 LDFLAGS="$SAVE_LDFLAGS"
4090 fi
4091 dnl Add the right compiler flags and libraries.
4092 if test "x$with_libxml2" = "xyes"; then
4093 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4094 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4095 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4096 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4097 fi
4098 if test "x$with_libvirt" = "xyes"
4099 then
4100 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4101 if test $? -ne 0
4102 then
4103 with_libvirt="no"
4104 fi
4105 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4106 if test $? -ne 0
4107 then
4108 with_libvirt="no"
4109 fi
4110 fi
4111 if test "x$with_libvirt" = "xyes"
4112 then
4113 SAVE_CPPFLAGS="$CPPFLAGS"
4114 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4116 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4117 [with_libvirt="no (libvirt/libvirt.h not found)"])
4119 CPPFLAGS="$SAVE_CPPFLAGS"
4120 fi
4121 if test "x$with_libvirt" = "xyes"
4122 then
4123 SAVE_CFLAGS="$CFLAGS"
4124 SAVE_LDFLAGS="$LDFLAGS"
4126 CFLAGS="$CFLAGS $with_libvirt_cflags"
4127 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4129 AC_CHECK_LIB(virt, virDomainBlockStats,
4130 [with_libvirt="yes"],
4131 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4133 CFLAGS="$SAVE_CFLAGS"
4134 LDFLAGS="$SAVE_LDFLAGS"
4135 fi
4136 dnl Add the right compiler flags and libraries.
4137 if test "x$with_libvirt" = "xyes"; then
4138 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4139 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4140 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4141 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4142 fi
4143 # }}}
4145 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4146 with_libopenipmipthread="yes"
4147 with_libopenipmipthread_cflags=""
4148 with_libopenipmipthread_libs=""
4150 AC_MSG_CHECKING([for pkg-config])
4151 temp_result="no"
4152 if test "x$PKG_CONFIG" = "x"
4153 then
4154 with_libopenipmipthread="no"
4155 temp_result="no"
4156 else
4157 temp_result="$PKG_CONFIG"
4158 fi
4159 AC_MSG_RESULT([$temp_result])
4161 if test "x$with_libopenipmipthread" = "xyes"
4162 then
4163 AC_MSG_CHECKING([for libOpenIPMIpthread])
4164 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4165 if test "$?" != "0"
4166 then
4167 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4168 fi
4169 AC_MSG_RESULT([$with_libopenipmipthread])
4170 fi
4172 if test "x$with_libopenipmipthread" = "xyes"
4173 then
4174 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4175 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4176 if test "$?" = "0"
4177 then
4178 with_libopenipmipthread_cflags="$temp_result"
4179 else
4180 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4181 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4182 fi
4183 AC_MSG_RESULT([$temp_result])
4184 fi
4186 if test "x$with_libopenipmipthread" = "xyes"
4187 then
4188 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4189 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4190 if test "$?" = "0"
4191 then
4192 with_libopenipmipthread_ldflags="$temp_result"
4193 else
4194 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4195 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4196 fi
4197 AC_MSG_RESULT([$temp_result])
4198 fi
4200 if test "x$with_libopenipmipthread" = "xyes"
4201 then
4202 SAVE_CPPFLAGS="$CPPFLAGS"
4203 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4205 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4206 [with_libopenipmipthread="yes"],
4207 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4208 [#include <OpenIPMI/ipmiif.h>
4209 #include <OpenIPMI/ipmi_err.h>
4210 #include <OpenIPMI/ipmi_posix.h>
4211 #include <OpenIPMI/ipmi_conn.h>
4212 ])
4214 CPPFLAGS="$SAVE_CPPFLAGS"
4215 fi
4217 if test "x$with_libopenipmipthread" = "xyes"
4218 then
4219 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4220 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4221 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4222 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4223 fi
4224 # }}}
4226 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4227 [with_libnotify="yes"],
4228 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4229 with_libnotify="no"
4230 else
4231 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4232 fi])
4234 # Check for enabled/disabled features
4235 #
4237 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4238 # ------------------------------------------------------------
4239 dnl
4240 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4241 dnl
4242 AC_DEFUN(
4243 [AC_COLLECTD],
4244 [
4245 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4246 m4_if(
4247 [$2],
4248 [enable],
4249 [dnl
4250 m4_define([EnDis],[disabled])dnl
4251 m4_define([YesNo],[no])dnl
4252 ],dnl
4253 [m4_if(
4254 [$2],
4255 [disable],
4256 [dnl
4257 m4_define([EnDis],[enabled])dnl
4258 m4_define([YesNo],[yes])dnl
4259 ],
4260 [dnl
4261 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4262 ]dnl
4263 )]dnl
4264 )dnl
4265 m4_if([$3], [feature], [],
4266 [m4_if(
4267 [$3], [module], [],
4268 [dnl
4269 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4270 ]dnl
4271 )]dnl
4272 )dnl
4273 AC_ARG_ENABLE(
4274 [$1],
4275 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4276 [],
4277 enable_$1='[YesNo]'dnl
4278 )# AC_ARG_ENABLE
4279 if test "x$enable_$1" = "xno"
4280 then
4281 collectd_$1=0
4282 else
4283 if test "x$enable_$1" = "xyes"
4284 then
4285 collectd_$1=1
4286 else
4287 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4288 collectd_$1=1
4289 enable_$1='yes'
4290 fi
4291 fi
4292 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4293 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4294 ]dnl
4295 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4297 # AC_PLUGIN(name, default, info)
4298 # ------------------------------------------------------------
4299 dnl
4300 AC_DEFUN(
4301 [AC_PLUGIN],
4302 [
4303 enable_plugin="no"
4304 force="no"
4305 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4306 [
4307 if test "x$enableval" = "xyes"
4308 then
4309 enable_plugin="yes"
4310 else if test "x$enableval" = "xforce"
4311 then
4312 enable_plugin="yes"
4313 force="yes"
4314 else
4315 enable_plugin="no (disabled on command line)"
4316 fi; fi
4317 ],
4318 [
4319 if test "x$enable_all_plugins" = "xauto"
4320 then
4321 if test "x$2" = "xyes"
4322 then
4323 enable_plugin="yes"
4324 else
4325 enable_plugin="no"
4326 fi
4327 else
4328 enable_plugin="$enable_all_plugins"
4329 fi
4330 ])
4331 if test "x$enable_plugin" = "xyes"
4332 then
4333 if test "x$2" = "xyes" || test "x$force" = "xyes"
4334 then
4335 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4336 if test "x$2" != "xyes"
4337 then
4338 dependency_warning="yes"
4339 fi
4340 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4341 dependency_error="yes"
4342 enable_plugin="no (dependency error)"
4343 fi
4344 fi
4345 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4346 enable_$1="$enable_plugin"
4347 ]
4348 )# AC_PLUGIN(name, default, info)
4350 m4_divert_once([HELP_ENABLE], [
4351 collectd features:])
4352 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4353 AC_COLLECTD([debug], [enable], [feature], [debugging])
4354 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4355 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4357 dependency_warning="no"
4358 dependency_error="no"
4360 plugin_ascent="no"
4361 plugin_battery="no"
4362 plugin_bind="no"
4363 plugin_conntrack="no"
4364 plugin_contextswitch="no"
4365 plugin_cpu="no"
4366 plugin_cpufreq="no"
4367 plugin_curl_json="no"
4368 plugin_curl_xml="no"
4369 plugin_df="no"
4370 plugin_disk="no"
4371 plugin_entropy="no"
4372 plugin_interface="no"
4373 plugin_ipmi="no"
4374 plugin_ipvs="no"
4375 plugin_irq="no"
4376 plugin_libvirt="no"
4377 plugin_load="no"
4378 plugin_memory="no"
4379 plugin_multimeter="no"
4380 plugin_nfs="no"
4381 plugin_fscache="no"
4382 plugin_perl="no"
4383 plugin_processes="no"
4384 plugin_protocols="no"
4385 plugin_serial="no"
4386 plugin_swap="no"
4387 plugin_tape="no"
4388 plugin_tcpconns="no"
4389 plugin_ted="no"
4390 plugin_thermal="no"
4391 plugin_users="no"
4392 plugin_uptime="no"
4393 plugin_vmem="no"
4394 plugin_vserver="no"
4395 plugin_wireless="no"
4396 plugin_zfs_arc="no"
4398 # Linux
4399 if test "x$ac_system" = "xLinux"
4400 then
4401 plugin_battery="yes"
4402 plugin_conntrack="yes"
4403 plugin_contextswitch="yes"
4404 plugin_cpu="yes"
4405 plugin_cpufreq="yes"
4406 plugin_disk="yes"
4407 plugin_entropy="yes"
4408 plugin_interface="yes"
4409 plugin_irq="yes"
4410 plugin_load="yes"
4411 plugin_memory="yes"
4412 plugin_nfs="yes"
4413 plugin_fscache="yes"
4414 plugin_processes="yes"
4415 plugin_protocols="yes"
4416 plugin_serial="yes"
4417 plugin_swap="yes"
4418 plugin_tcpconns="yes"
4419 plugin_thermal="yes"
4420 plugin_uptime="yes"
4421 plugin_vmem="yes"
4422 plugin_vserver="yes"
4423 plugin_wireless="yes"
4425 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4426 then
4427 plugin_ipvs="yes"
4428 fi
4429 fi
4431 if test "x$ac_system" = "xOpenBSD"
4432 then
4433 plugin_tcpconns="yes"
4434 fi
4436 # Mac OS X devices
4437 if test "x$with_libiokit" = "xyes"
4438 then
4439 plugin_battery="yes"
4440 plugin_disk="yes"
4441 fi
4443 # AIX
4444 if test "x$with_perfstat" = "xyes"
4445 then
4446 plugin_cpu="yes"
4447 plugin_disk="yes"
4448 plugin_memory="yes"
4449 plugin_swap="yes"
4450 plugin_interface="yes"
4451 plugin_load="yes"
4452 fi
4454 if test "x$with_procinfo" = "xyes"
4455 then
4456 plugin_processes="yes"
4457 fi
4459 # Solaris
4460 if test "x$with_kstat" = "xyes"
4461 then
4462 plugin_uptime="yes"
4463 plugin_zfs_arc="yes"
4464 fi
4466 if test "x$with_devinfo$with_kstat" = "xyesyes"
4467 then
4468 plugin_cpu="yes"
4469 plugin_disk="yes"
4470 plugin_interface="yes"
4471 plugin_memory="yes"
4472 plugin_tape="yes"
4473 fi
4475 # libstatgrab
4476 if test "x$with_libstatgrab" = "xyes"
4477 then
4478 plugin_cpu="yes"
4479 plugin_disk="yes"
4480 plugin_interface="yes"
4481 plugin_load="yes"
4482 plugin_memory="yes"
4483 plugin_swap="yes"
4484 plugin_users="yes"
4485 fi
4487 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4488 then
4489 plugin_ascent="yes"
4490 if test "x$have_strptime" = "xyes"
4491 then
4492 plugin_bind="yes"
4493 fi
4494 fi
4496 if test "x$with_libopenipmipthread" = "xyes"
4497 then
4498 plugin_ipmi="yes"
4499 fi
4501 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4502 then
4503 plugin_curl_json="yes"
4504 fi
4506 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4507 then
4508 plugin_curl_xml="yes"
4509 fi
4511 if test "x$have_processor_info" = "xyes"
4512 then
4513 plugin_cpu="yes"
4514 fi
4515 if test "x$have_sysctl" = "xyes"
4516 then
4517 plugin_cpu="yes"
4518 plugin_memory="yes"
4519 plugin_uptime="yes"
4520 if test "x$ac_system" = "xDarwin"
4521 then
4522 plugin_swap="yes"
4523 fi
4524 fi
4525 if test "x$have_sysctlbyname" = "xyes"
4526 then
4527 plugin_contextswitch="yes"
4528 plugin_cpu="yes"
4529 plugin_memory="yes"
4530 plugin_tcpconns="yes"
4531 fi
4533 # Df plugin: Check if we know how to determine mount points first.
4534 #if test "x$have_listmntent" = "xyes"; then
4535 # plugin_df="yes"
4536 #fi
4537 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4538 then
4539 plugin_df="yes"
4540 fi
4541 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4542 then
4543 plugin_df="yes"
4544 fi
4545 #if test "x$have_getmntent" = "xseq"
4546 #then
4547 # plugin_df="yes"
4548 #fi
4549 if test "x$c_cv_have_one_getmntent" = "xyes"
4550 then
4551 plugin_df="yes"
4552 fi
4554 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4555 if test "x$plugin_df" = "xyes"
4556 then
4557 plugin_df="no"
4558 if test "x$have_statfs" = "xyes"
4559 then
4560 plugin_df="yes"
4561 fi
4562 if test "x$have_statvfs" = "xyes"
4563 then
4564 plugin_df="yes"
4565 fi
4566 fi
4568 if test "x$have_getifaddrs" = "xyes"
4569 then
4570 plugin_interface="yes"
4571 fi
4573 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4574 then
4575 plugin_libvirt="yes"
4576 fi
4578 if test "x$have_getloadavg" = "xyes"
4579 then
4580 plugin_load="yes"
4581 fi
4583 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4584 then
4585 plugin_perl="yes"
4586 fi
4588 # Mac OS X memory interface
4589 if test "x$have_host_statistics" = "xyes"
4590 then
4591 plugin_memory="yes"
4592 fi
4594 if test "x$have_termios_h" = "xyes"
4595 then
4596 plugin_multimeter="yes"
4597 plugin_ted="yes"
4598 fi
4600 if test "x$have_thread_info" = "xyes"
4601 then
4602 plugin_processes="yes"
4603 fi
4605 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4606 then
4607 plugin_processes="yes"
4608 fi
4610 if test "x$with_kvm_getswapinfo" = "xyes"
4611 then
4612 plugin_swap="yes"
4613 fi
4615 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4616 then
4617 plugin_swap="yes"
4618 fi
4620 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4621 then
4622 plugin_tcpconns="yes"
4623 fi
4625 if test "x$have_getutent" = "xyes"
4626 then
4627 plugin_users="yes"
4628 fi
4629 if test "x$have_getutxent" = "xyes"
4630 then
4631 plugin_users="yes"
4632 fi
4634 m4_divert_once([HELP_ENABLE], [
4635 collectd plugins:])
4637 AC_ARG_ENABLE([all-plugins],
4638 AC_HELP_STRING([--enable-all-plugins],
4639 [enable all plugins (auto by def)]),
4640 [
4641 if test "x$enableval" = "xyes"
4642 then
4643 enable_all_plugins="yes"
4644 else if test "x$enableval" = "xauto"
4645 then
4646 enable_all_plugins="auto"
4647 else
4648 enable_all_plugins="no"
4649 fi; fi
4650 ],
4651 [enable_all_plugins="auto"])
4653 m4_divert_once([HELP_ENABLE], [])
4655 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4656 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4657 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4658 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4659 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4660 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4661 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4662 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4663 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4664 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4665 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4666 AC_PLUGIN([csv], [yes], [CSV output plugin])
4667 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4668 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4669 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4670 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4671 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4672 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4673 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4674 AC_PLUGIN([email], [yes], [EMail statistics])
4675 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4676 AC_PLUGIN([exec], [yes], [Execution of external programs])
4677 AC_PLUGIN([filecount], [yes], [Count files in directories])
4678 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4679 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4680 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4681 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4682 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4683 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4684 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4685 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4686 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4687 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4688 AC_PLUGIN([load], [$plugin_load], [System load])
4689 AC_PLUGIN([logfile], [yes], [File logging plugin])
4690 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4691 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4692 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4693 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4694 AC_PLUGIN([match_regex], [yes], [The regex match])
4695 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4696 AC_PLUGIN([match_value], [yes], [The value match])
4697 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4698 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4699 AC_PLUGIN([memcached], [yes], [memcached statistics])
4700 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4701 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4702 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4703 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4704 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4705 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4706 AC_PLUGIN([network], [yes], [Network communication plugin])
4707 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4708 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4709 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4710 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4711 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4712 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4713 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4714 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4715 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4716 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4717 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4718 # FIXME: Check for libevent, too.
4719 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4720 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4721 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4722 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4723 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4724 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4725 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4726 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4727 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4728 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4729 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4730 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4731 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4732 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4733 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4734 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4735 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4736 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4737 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4738 AC_PLUGIN([target_notification], [yes], [The notification target])
4739 AC_PLUGIN([target_replace], [yes], [The replace target])
4740 AC_PLUGIN([target_scale],[yes], [The scale target])
4741 AC_PLUGIN([target_set], [yes], [The set target])
4742 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4743 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4744 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4745 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4746 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4747 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4748 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4749 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4750 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4751 AC_PLUGIN([users], [$plugin_users], [User statistics])
4752 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4753 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4754 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4755 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4756 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4757 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4758 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4759 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4760 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4762 dnl Default configuration file
4763 # Load either syslog or logfile
4764 LOAD_PLUGIN_SYSLOG=""
4765 LOAD_PLUGIN_LOGFILE=""
4767 AC_MSG_CHECKING([which default log plugin to load])
4768 default_log_plugin="none"
4769 if test "x$enable_syslog" = "xyes"
4770 then
4771 default_log_plugin="syslog"
4772 else
4773 LOAD_PLUGIN_SYSLOG="##"
4774 fi
4776 if test "x$enable_logfile" = "xyes"
4777 then
4778 if test "x$default_log_plugin" = "xnone"
4779 then
4780 default_log_plugin="logfile"
4781 else
4782 LOAD_PLUGIN_LOGFILE="#"
4783 fi
4784 else
4785 LOAD_PLUGIN_LOGFILE="##"
4786 fi
4787 AC_MSG_RESULT([$default_log_plugin])
4789 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4790 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4792 DEFAULT_LOG_LEVEL="info"
4793 if test "x$enable_debug" = "xyes"
4794 then
4795 DEFAULT_LOG_LEVEL="debug"
4796 fi
4797 AC_SUBST(DEFAULT_LOG_LEVEL)
4799 # Load only one of rrdtool, network, csv in the default config.
4800 LOAD_PLUGIN_RRDTOOL=""
4801 LOAD_PLUGIN_NETWORK=""
4802 LOAD_PLUGIN_CSV=""
4804 AC_MSG_CHECKING([which default write plugin to load])
4805 default_write_plugin="none"
4806 if test "x$enable_rrdtool" = "xyes"
4807 then
4808 default_write_plugin="rrdtool"
4809 else
4810 LOAD_PLUGIN_RRDTOOL="##"
4811 fi
4813 if test "x$enable_network" = "xyes"
4814 then
4815 if test "x$default_write_plugin" = "xnone"
4816 then
4817 default_write_plugin="network"
4818 else
4819 LOAD_PLUGIN_NETWORK="#"
4820 fi
4821 else
4822 LOAD_PLUGIN_NETWORK="##"
4823 fi
4825 if test "x$enable_csv" = "xyes"
4826 then
4827 if test "x$default_write_plugin" = "xnone"
4828 then
4829 default_write_plugin="csv"
4830 else
4831 LOAD_PLUGIN_CSV="#"
4832 fi
4833 else
4834 LOAD_PLUGIN_CSV="##"
4835 fi
4836 AC_MSG_RESULT([$default_write_plugin])
4838 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4839 AC_SUBST(LOAD_PLUGIN_NETWORK)
4840 AC_SUBST(LOAD_PLUGIN_CSV)
4842 dnl ip_vs.h
4843 if test "x$ac_system" = "xLinux" \
4844 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4845 then
4846 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4847 fi
4849 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4850 then
4851 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4852 fi
4854 dnl Perl bindings
4855 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4856 [
4857 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4858 then
4859 PERL_BINDINGS_OPTIONS="$withval"
4860 with_perl_bindings="yes"
4861 else
4862 PERL_BINDINGS_OPTIONS=""
4863 with_perl_bindings="$withval"
4864 fi
4865 ],
4866 [
4867 PERL_BINDINGS_OPTIONS=""
4868 if test -n "$perl_interpreter"
4869 then
4870 with_perl_bindings="yes"
4871 else
4872 with_perl_bindings="no (no perl interpreter found)"
4873 fi
4874 ])
4875 if test "x$with_perl_bindings" = "xyes"
4876 then
4877 PERL_BINDINGS="perl"
4878 else
4879 PERL_BINDINGS=""
4880 fi
4881 AC_SUBST(PERL_BINDINGS)
4882 AC_SUBST(PERL_BINDINGS_OPTIONS)
4884 dnl libcollectdclient
4885 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4886 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4887 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4889 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4891 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4893 AC_SUBST(LCC_VERSION_MAJOR)
4894 AC_SUBST(LCC_VERSION_MINOR)
4895 AC_SUBST(LCC_VERSION_PATCH)
4896 AC_SUBST(LCC_VERSION_EXTRA)
4897 AC_SUBST(LCC_VERSION_STRING)
4899 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4901 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)
4903 if test "x$with_librrd" = "xyes" \
4904 && test "x$librrd_threadsafe" != "xyes"
4905 then
4906 with_librrd="yes (warning: librrd is not thread-safe)"
4907 fi
4909 if test "x$with_libperl" = "xyes"
4910 then
4911 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4912 else
4913 enable_perl="no (needs libperl)"
4914 fi
4916 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4917 then
4918 enable_perl="no (libperl doesn't support ithreads)"
4919 fi
4921 if test "x$with_perl_bindings" = "xyes" \
4922 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4923 then
4924 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4925 fi
4927 cat <<EOF;
4929 Configuration:
4930 Libraries:
4931 libcurl . . . . . . . $with_libcurl
4932 libdbi . . . . . . . $with_libdbi
4933 libcredis . . . . . . $with_libcredis
4934 libesmtp . . . . . . $with_libesmtp
4935 libganglia . . . . . $with_libganglia
4936 libgcrypt . . . . . . $with_libgcrypt
4937 libiokit . . . . . . $with_libiokit
4938 libiptc . . . . . . . $with_libiptc
4939 libjvm . . . . . . . $with_java
4940 libkstat . . . . . . $with_kstat
4941 libkvm . . . . . . . $with_libkvm
4942 libmemcached . . . . $with_libmemcached
4943 libmodbus . . . . . . $with_libmodbus
4944 libmysql . . . . . . $with_libmysql
4945 libnetapp . . . . . . $with_libnetapp
4946 libnetlink . . . . . $with_libnetlink
4947 libnetsnmp . . . . . $with_libnetsnmp
4948 libnotify . . . . . . $with_libnotify
4949 liboconfig . . . . . $with_liboconfig
4950 libopenipmi . . . . . $with_libopenipmipthread
4951 liboping . . . . . . $with_liboping
4952 libpcap . . . . . . . $with_libpcap
4953 libperfstat . . . . . $with_perfstat
4954 libperl . . . . . . . $with_libperl
4955 libpq . . . . . . . . $with_libpq
4956 libpthread . . . . . $with_libpthread
4957 librabbitmq . . . . . $with_librabbitmq
4958 librouteros . . . . . $with_librouteros
4959 librrd . . . . . . . $with_librrd
4960 libsensors . . . . . $with_libsensors
4961 libstatgrab . . . . . $with_libstatgrab
4962 libtokyotyrant . . . $with_libtokyotyrant
4963 libupsclient . . . . $with_libupsclient
4964 libvarnish . . . . . $with_libvarnish
4965 libvirt . . . . . . . $with_libvirt
4966 libxml2 . . . . . . . $with_libxml2
4967 libxmms . . . . . . . $with_libxmms
4968 libyajl . . . . . . . $with_libyajl
4969 libevent . . . . . . $with_libevent
4970 protobuf-c . . . . . $have_protoc_c
4971 oracle . . . . . . . $with_oracle
4972 python . . . . . . . $with_python
4974 Features:
4975 daemon mode . . . . . $enable_daemon
4976 debug . . . . . . . . $enable_debug
4978 Bindings:
4979 perl . . . . . . . . $with_perl_bindings
4981 Modules:
4982 amqp . . . . . . . $enable_amqp
4983 apache . . . . . . . $enable_apache
4984 apcups . . . . . . . $enable_apcups
4985 apple_sensors . . . . $enable_apple_sensors
4986 ascent . . . . . . . $enable_ascent
4987 battery . . . . . . . $enable_battery
4988 bind . . . . . . . . $enable_bind
4989 conntrack . . . . . . $enable_conntrack
4990 contextswitch . . . . $enable_contextswitch
4991 cpu . . . . . . . . . $enable_cpu
4992 cpufreq . . . . . . . $enable_cpufreq
4993 csv . . . . . . . . . $enable_csv
4994 curl . . . . . . . . $enable_curl
4995 curl_json . . . . . . $enable_curl_json
4996 curl_xml . . . . . . $enable_curl_xml
4997 dbi . . . . . . . . . $enable_dbi
4998 df . . . . . . . . . $enable_df
4999 disk . . . . . . . . $enable_disk
5000 dns . . . . . . . . . $enable_dns
5001 email . . . . . . . . $enable_email
5002 entropy . . . . . . . $enable_entropy
5003 exec . . . . . . . . $enable_exec
5004 filecount . . . . . . $enable_filecount
5005 fscache . . . . . . . $enable_fscache
5006 gmond . . . . . . . . $enable_gmond
5007 hddtemp . . . . . . . $enable_hddtemp
5008 interface . . . . . . $enable_interface
5009 ipmi . . . . . . . . $enable_ipmi
5010 iptables . . . . . . $enable_iptables
5011 ipvs . . . . . . . . $enable_ipvs
5012 irq . . . . . . . . . $enable_irq
5013 java . . . . . . . . $enable_java
5014 libvirt . . . . . . . $enable_libvirt
5015 load . . . . . . . . $enable_load
5016 logfile . . . . . . . $enable_logfile
5017 lpar... . . . . . . . $enable_lpar
5018 madwifi . . . . . . . $enable_madwifi
5019 match_empty_counter . $enable_match_empty_counter
5020 match_hashed . . . . $enable_match_hashed
5021 match_regex . . . . . $enable_match_regex
5022 match_timediff . . . $enable_match_timediff
5023 match_value . . . . . $enable_match_value
5024 mbmon . . . . . . . . $enable_mbmon
5025 memcachec . . . . . . $enable_memcachec
5026 memcached . . . . . . $enable_memcached
5027 memory . . . . . . . $enable_memory
5028 modbus . . . . . . . $enable_modbus
5029 multimeter . . . . . $enable_multimeter
5030 mysql . . . . . . . . $enable_mysql
5031 netapp . . . . . . . $enable_netapp
5032 netlink . . . . . . . $enable_netlink
5033 network . . . . . . . $enable_network
5034 nfs . . . . . . . . . $enable_nfs
5035 nginx . . . . . . . . $enable_nginx
5036 notify_desktop . . . $enable_notify_desktop
5037 notify_email . . . . $enable_notify_email
5038 ntpd . . . . . . . . $enable_ntpd
5039 nut . . . . . . . . . $enable_nut
5040 olsrd . . . . . . . . $enable_olsrd
5041 onewire . . . . . . . $enable_onewire
5042 openvpn . . . . . . . $enable_openvpn
5043 oracle . . . . . . . $enable_oracle
5044 perl . . . . . . . . $enable_perl
5045 pinba . . . . . . . . $enable_pinba
5046 ping . . . . . . . . $enable_ping
5047 postgresql . . . . . $enable_postgresql
5048 powerdns . . . . . . $enable_powerdns
5049 processes . . . . . . $enable_processes
5050 protocols . . . . . . $enable_protocols
5051 python . . . . . . . $enable_python
5052 redis . . . . . . . . $enable_redis
5053 routeros . . . . . . $enable_routeros
5054 rrdcached . . . . . . $enable_rrdcached
5055 rrdtool . . . . . . . $enable_rrdtool
5056 sensors . . . . . . . $enable_sensors
5057 serial . . . . . . . $enable_serial
5058 snmp . . . . . . . . $enable_snmp
5059 swap . . . . . . . . $enable_swap
5060 syslog . . . . . . . $enable_syslog
5061 table . . . . . . . . $enable_table
5062 tail . . . . . . . . $enable_tail
5063 tape . . . . . . . . $enable_tape
5064 target_notification . $enable_target_notification
5065 target_replace . . . $enable_target_replace
5066 target_scale . . . . $enable_target_scale
5067 target_set . . . . . $enable_target_set
5068 target_v5upgrade . . $enable_target_v5upgrade
5069 tcpconns . . . . . . $enable_tcpconns
5070 teamspeak2 . . . . . $enable_teamspeak2
5071 ted . . . . . . . . . $enable_ted
5072 thermal . . . . . . . $enable_thermal
5073 threshold . . . . . . $enable_threshold
5074 tokyotyrant . . . . . $enable_tokyotyrant
5075 unixsock . . . . . . $enable_unixsock
5076 uptime . . . . . . . $enable_uptime
5077 users . . . . . . . . $enable_users
5078 uuid . . . . . . . . $enable_uuid
5079 varnish . . . . . . . $enable_varnish
5080 vmem . . . . . . . . $enable_vmem
5081 vserver . . . . . . . $enable_vserver
5082 wireless . . . . . . $enable_wireless
5083 write_http . . . . . $enable_write_http
5084 write_redis . . . . . $enable_write_redis
5085 xmms . . . . . . . . $enable_xmms
5086 zfs_arc . . . . . . . $enable_zfs_arc
5088 EOF
5090 if test "x$dependency_error" = "xyes"; then
5091 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5092 fi
5094 if test "x$dependency_warning" = "xyes"; then
5095 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5096 fi
5098 # vim: set fdm=marker :