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