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