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