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