Code

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