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