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