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