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