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