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