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