Disable disable multi -arch flags to perl.c on OSX Compilation of perl.c fails with:
[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 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
7
8 AC_PREFIX_DEFAULT("/opt/collectd")
9
10 AC_SYS_LARGEFILE
11
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_PROG_CC_C_O
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
22
23 dnl configure libtool
24 AC_DISABLE_STATIC
25 AC_LIBLTDL_CONVENIENCE
26 AC_SUBST(LTDLINCL)
27 AC_SUBST(LIBLTDL)
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_LEX
31 AC_PROG_YACC
32 PKG_PROG_PKG_CONFIG
33 AC_CONFIG_SUBDIRS(libltdl)
34
35 AC_MSG_CHECKING([for kernel type ($host_os)])
36 case $host_os in
37         *linux*)
38         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
39         ac_system="Linux"
40         ;;
41         *solaris*)
42         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
43         ac_system="Solaris"
44         ;;
45         *darwin*)
46         ac_system="Darwin"
47         ;;
48         *openbsd*)
49         ac_system="OpenBSD"
50         ;;
51         *)
52         ac_system="unknown"
53 esac
54 AC_MSG_RESULT([$ac_system])
55
56 if test "x$ac_system" = "xLinux"
57 then
58         AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
59         if test -z "$KERNEL_DIR"
60         then
61                 KERNEL_DIR="/lib/modules/`uname -r`/source"
62         fi
63
64         KERNEL_CFLAGS="-I$KERNEL_DIR/include"
65         AC_SUBST(KERNEL_CFLAGS)
66 fi
67
68 if test "x$ac_system" = "xSolaris"
69 then
70         CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
71 fi
72
73 #
74 # Checks for header files.
75 #
76 AC_HEADER_STDC
77 AC_HEADER_SYS_WAIT
78 AC_HEADER_DIRENT
79
80 AC_CHECK_HEADERS(stdio.h stdint.h stdbool.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)
81
82 # For ping library
83 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
84 [#if HAVE_STDINT_H
85 # include <stdint.h>
86 #endif
87 #if HAVE_SYS_TYPES_H
88 # include <sys/types.h>
89 #endif
90 ])
91 AC_CHECK_HEADERS(netinet/in.h, [], [],
92 [#if HAVE_STDINT_H
93 # include <stdint.h>
94 #endif
95 #if HAVE_SYS_TYPES_H
96 # include <sys/types.h>
97 #endif
98 #if HAVE_NETINET_IN_SYSTM_H
99 # include <netinet/in_systm.h>
100 #endif
101 ])
102 AC_CHECK_HEADERS(netinet/ip.h, [], [],
103 [#if HAVE_STDINT_H
104 # include <stdint.h>
105 #endif
106 #if HAVE_SYS_TYPES_H
107 # include <sys/types.h>
108 #endif
109 #if HAVE_NETINET_IN_SYSTM_H
110 # include <netinet/in_systm.h>
111 #endif
112 #if HAVE_NETINET_IN_H
113 # include <netinet/in.h>
114 #endif
115 ])
116 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
117 [#if HAVE_STDINT_H
118 # include <stdint.h>
119 #endif
120 #if HAVE_SYS_TYPES_H
121 # include <sys/types.h>
122 #endif
123 #if HAVE_NETINET_IN_SYSTM_H
124 # include <netinet/in_systm.h>
125 #endif
126 #if HAVE_NETINET_IN_H
127 # include <netinet/in.h>
128 #endif
129 #if HAVE_NETINET_IP_H
130 # include <netinet/ip.h>
131 #endif
132 ])
133 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
134 [#if HAVE_STDINT_H
135 # include <stdint.h>
136 #endif
137 #if HAVE_SYS_TYPES_H
138 # include <sys/types.h>
139 #endif
140 #if HAVE_NETINET_IN_SYSTM_H
141 # include <netinet/in_systm.h>
142 #endif
143 #if HAVE_NETINET_IN_H
144 # include <netinet/in.h>
145 #endif
146 #if HAVE_NETINET_IP_H
147 # include <netinet/ip.h>
148 #endif
149 ])
150 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
151 [#if HAVE_STDINT_H
152 # include <stdint.h>
153 #endif
154 #if HAVE_SYS_TYPES_H
155 # include <sys/types.h>
156 #endif
157 #if HAVE_NETINET_IN_SYSTM_H
158 # include <netinet/in_systm.h>
159 #endif
160 #if HAVE_NETINET_IN_H
161 # include <netinet/in.h>
162 #endif
163 ])
164 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
165 [#if HAVE_STDINT_H
166 # include <stdint.h>
167 #endif
168 #if HAVE_SYS_TYPES_H
169 # include <sys/types.h>
170 #endif
171 #if HAVE_NETINET_IN_SYSTM_H
172 # include <netinet/in_systm.h>
173 #endif
174 #if HAVE_NETINET_IN_H
175 # include <netinet/in.h>
176 #endif
177 #if HAVE_NETINET_IP6_H
178 # include <netinet/ip6.h>
179 #endif
180 ])
181 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
182 [#if HAVE_STDINT_H
183 # include <stdint.h>
184 #endif
185 #if HAVE_SYS_TYPES_H
186 # include <sys/types.h>
187 #endif
188 #if HAVE_NETINET_IN_SYSTM_H
189 # include <netinet/in_systm.h>
190 #endif
191 #if HAVE_NETINET_IN_H
192 # include <netinet/in.h>
193 #endif
194 #if HAVE_NETINET_IP_H
195 # include <netinet/ip.h>
196 #endif
197 ])
198 AC_CHECK_HEADERS(netinet/udp.h, [], [],
199 [#if HAVE_STDINT_H
200 # include <stdint.h>
201 #endif
202 #if HAVE_SYS_TYPES_H
203 # include <sys/types.h>
204 #endif
205 #if HAVE_NETINET_IN_SYSTM_H
206 # include <netinet/in_systm.h>
207 #endif
208 #if HAVE_NETINET_IN_H
209 # include <netinet/in.h>
210 #endif
211 #if HAVE_NETINET_IP_H
212 # include <netinet/ip.h>
213 #endif
214 ])
215
216 # For cpu modules
217 AC_CHECK_HEADERS(sys/dkstat.h)
218 if test "x$ac_system" = "xDarwin"
219 then
220         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)
221         AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
222 fi
223 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
224 [
225 #if HAVE_SYS_TYPES_H
226 #  include <sys/types.h>
227 #endif
228 #if HAVE_SYS_PARAM_H
229 # include <sys/param.h>
230 #endif
231 ])
232
233 # For hddtemp module
234 AC_CHECK_HEADERS(linux/major.h libgen.h)
235
236 # For the battery plugin
237 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
238 [
239 #if HAVE_IOKIT_IOKITLIB_H
240 #  include <IOKit/IOKitLib.h>
241 #endif
242 #if HAVE_IOKIT_IOTYPES_H
243 #  include <IOKit/IOTypes.h>
244 #endif
245 ])
246
247 # For the swap module
248 have_sys_swap_h="yes"
249 AC_CHECK_HEADERS(sys/swap.h, [], [have_sys_swap_h="no"],
250 [
251 #if HAVE_SYS_TYPES_H
252 #  include <sys/types.h>
253 #endif
254 #if HAVE_SYS_PARAM_H
255 # include <sys/param.h>
256 #endif
257 ])
258
259 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
260 then
261         AC_MSG_NOTICE([Solaris detected and sys/swap.h not found: Try building a 64bit binary.])
262 fi
263
264 # For load module
265 # For the processes plugin
266 # For users module
267 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
268
269 # For interface plugin
270 AC_CHECK_HEADERS(ifaddrs.h)
271 AC_CHECK_HEADERS(net/if.h, [], [],
272 [
273 #if HAVE_SYS_TYPES_H
274 #  include <sys/types.h>
275 #endif
276 #if HAVE_SYS_SOCKET_H
277 #  include <sys/socket.h>
278 #endif
279 ])
280 AC_CHECK_HEADERS(linux/if.h, [], [],
281 [
282 #if HAVE_SYS_TYPES_H
283 #  include <sys/types.h>
284 #endif
285 #if HAVE_SYS_SOCKET_H
286 #  include <sys/socket.h>
287 #endif
288 ])
289 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
290 [
291 #if HAVE_SYS_TYPES_H
292 #  include <sys/types.h>
293 #endif
294 #if HAVE_SYS_SOCKET_H
295 #  include <sys/socket.h>
296 #endif
297 #if HAVE_LINUX_IF_H
298 # include <linux/if.h>
299 #endif
300 ])
301
302 # For ipvs module
303 have_net_ip_vs_h="no"
304 have_ip_vs_h="no"
305 if test "x$ac_system" = "xLinux"
306 then
307         SAVE_CFLAGS=$CFLAGS
308         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
309
310         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
311         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
312
313         CFLAGS=$SAVE_CFLAGS
314 fi
315
316 # For quota module
317 AC_CHECK_HEADERS(sys/ucred.h, [], [],
318 [
319 #if HAVE_SYS_TYPES_H
320 #  include <sys/types.h>
321 #endif
322 #if HAVE_SYS_PARAM_H
323 # include <sys/param.h>
324 #endif
325 ])
326
327 # For mount interface
328 AC_CHECK_HEADERS(sys/mount.h, [], [],
329 [
330 #if HAVE_SYS_TYPES_H
331 #  include <sys/types.h>
332 #endif
333 #if HAVE_SYS_PARAM_H
334 # include <sys/param.h>
335 #endif
336 ])
337
338 # For the email plugin
339 AC_CHECK_HEADERS(linux/un.h, [], [],
340 [
341 #if HAVE_SYS_SOCKET_H
342 #       include <sys/socket.h>
343 #endif
344 ])
345
346 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.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)
347
348 # For the dns plugin
349 AC_CHECK_HEADERS(arpa/nameser.h)
350 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
351 [
352 #if HAVE_ARPA_NAMESER_H
353 # include <arpa/nameser.h>
354 #endif
355 ])
356
357 AC_CHECK_HEADERS(net/if_arp.h, [], [],
358 [#if HAVE_SYS_SOCKET_H
359 # include <sys/socket.h>
360 #endif
361 ])
362 AC_CHECK_HEADERS(net/ppp_defs.h)
363 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
364 [#if HAVE_NET_PPP_DEFS_H
365 # include <net/ppp_defs.h>
366 #endif
367 ])
368 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
369 [#if HAVE_STDINT_H
370 # include <stdint.h>
371 #endif
372 #if HAVE_SYS_TYPES_H
373 # include <sys/types.h>
374 #endif
375 #if HAVE_SYS_SOCKET_H
376 # include <sys/socket.h>
377 #endif
378 #if HAVE_NET_IF_H
379 # include <net/if.h>
380 #endif
381 #if HAVE_NETINET_IN_H
382 # include <netinet/in.h>
383 #endif
384 ])
385
386 # For the multimeter plugin
387 have_termios_h="no"
388 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
389
390 #
391 # Checks for typedefs, structures, and compiler characteristics.
392 #
393 AC_C_CONST
394 AC_TYPE_PID_T
395 AC_TYPE_SIZE_T
396 AC_TYPE_UID_T
397 AC_HEADER_TIME
398
399 #
400 # Checks for library functions.
401 #
402 AC_PROG_GCC_TRADITIONAL
403 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
404
405 AC_FUNC_STRERROR_R
406
407 AC_CACHE_CHECK([for strtok_r],
408   [c_cv_have_strtok_r_default],
409   AC_LINK_IFELSE(
410     AC_LANG_PROGRAM(
411     [[[[
412 #include <stdlib.h>
413 #include <stdio.h>
414 #include <string.h>
415     ]]]],
416     [[[[
417       char buffer[] = "foo,bar,baz";
418       char *token;
419       char *dummy;
420       char *saveptr;
421
422       dummy = buffer;
423       saveptr = NULL;
424       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
425       {
426         dummy = NULL;
427         printf ("token = %s;\n", token);
428       }
429     ]]]]),
430     [c_cv_have_strtok_r_default="yes"],
431     [c_cv_have_strtok_r_default="no"]
432   )
433 )
434
435 if test "x$c_cv_have_strtok_r_default" = "xno"
436 then
437   SAVE_CFLAGS="$CFLAGS"
438   CFLAGS="$CFLAGS -D_REENTRANT=1"
439
440   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
441     [c_cv_have_strtok_r_reentrant],
442     AC_LINK_IFELSE(
443       AC_LANG_PROGRAM(
444       [[[[
445 #include <stdlib.h>
446 #include <stdio.h>
447 #include <string.h>
448       ]]]],
449       [[[[
450         char buffer[] = "foo,bar,baz";
451         char *token;
452         char *dummy;
453         char *saveptr;
454
455         dummy = buffer;
456         saveptr = NULL;
457         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
458         {
459           dummy = NULL;
460           printf ("token = %s;\n", token);
461         }
462       ]]]]),
463       [c_cv_have_strtok_r_reentrant="yes"],
464       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
465     )
466   )
467 fi
468
469 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
470
471 socket_needs_socket="no"
472 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
473 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
474
475 nanosleep_needs_rt="no"
476 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
477 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
478
479 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
480 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
481 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
482 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
483 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
484 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
485 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
486 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
487 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
488 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
489
490 # For load module
491 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
492
493 # Check for NAN
494 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
495 [
496  if test "x$withval" = "xno"; then
497          nan_type="none"
498  else if test "x$withval" = "xyes"; then
499          nan_type="zero"
500  else
501          nan_type="$withval"
502  fi; fi
503 ],
504 [nan_type="none"])
505 if test "x$nan_type" = "xnone"; then
506   AC_CACHE_CHECK([whether NAN is defined by default],
507     [c_cv_have_nan_default],
508     AC_COMPILE_IFELSE(
509       AC_LANG_PROGRAM(
510       [[
511 #include <stdlib.h>
512 #include <math.h>
513 static float foo = NAN;
514       ]],
515       [[
516        if (isnan (foo))
517         return 0;
518        else
519         return 1;
520       ]]),
521       [c_cv_have_nan_default="yes"],
522       [c_cv_have_nan_default="no"]
523     )
524   )
525   if test "x$c_cv_have_nan_default" = "xyes"
526   then
527     nan_type="default"
528   fi
529 fi
530 if test "x$nan_type" = "xnone"; then
531   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
532     [c_cv_have_nan_isoc],
533     AC_COMPILE_IFELSE(
534       AC_LANG_PROGRAM(
535       [[
536 #include <stdlib.h>
537 #define __USE_ISOC99 1
538 #include <math.h>
539 static float foo = NAN;
540       ]],
541       [[
542        if (isnan (foo))
543         return 0;
544        else
545         return 1;
546       ]]),
547       [c_cv_have_nan_isoc="yes"],
548       [c_cv_have_nan_isoc="no"]
549     )
550   )
551   if test "x$c_cv_have_nan_isoc" = "xyes"
552   then
553     nan_type="isoc99"
554   fi
555 fi
556 if test "x$nan_type" = "xnone"; then
557   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
558     [c_cv_have_nan_zero],
559     AC_RUN_IFELSE(
560       AC_LANG_PROGRAM(
561       [[
562 #include <stdlib.h>
563 #include <math.h>
564 #ifdef NAN
565 # undef NAN
566 #endif
567 #define NAN (0.0 / 0.0)
568 #ifndef isnan
569 # define isnan(f) ((f) != (f))
570 #endif
571 static float foo = NAN;
572       ]],
573       [[
574        if (isnan (foo))
575         return 0;
576        else
577         return 1;
578       ]]),
579       [c_cv_have_nan_zero="yes"],
580       [c_cv_have_nan_zero="no"]
581     )
582   )
583   if test "x$c_cv_have_nan_zero" = "xyes"
584   then
585     nan_type="zero"
586   fi
587 fi
588
589 if test "x$nan_type" = "xdefault"; then
590   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
591     [Define if NAN is defined by default and can initialize static variables.])
592 else if test "x$nan_type" = "xisoc99"; then
593   AC_DEFINE(NAN_STATIC_ISOC, 1,
594     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
595 else if test "x$nan_type" = "xzero"; then
596   AC_DEFINE(NAN_ZERO_ZERO, 1,
597     [Define if NAN can be defined as (0.0 / 0.0)])
598 else
599   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
600 fi; fi; fi
601
602 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
603 [
604  if test "x$withval" = "xnothing"; then
605         fp_layout_type="nothing"
606  else if test "x$withval" = "xendianflip"; then
607         fp_layout_type="endianflip"
608  else if test "x$withval" = "xintswap"; then
609         fp_layout_type="intswap"
610  else
611         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
612 fi; fi; fi
613 ],
614 [fp_layout_type="unknown"])
615
616 if test "x$fp_layout_type" = "xunknown"; then
617   AC_CACHE_CHECK([if doubles are stored in x86 representation],
618     [c_cv_fp_layout_need_nothing],
619     AC_RUN_IFELSE(
620       AC_LANG_PROGRAM(
621       [[[[
622 #include <stdlib.h>
623 #include <stdio.h>
624 #include <stdint.h>
625 #include <string.h>
626       ]]]],
627       [[[[
628         uint64_t i0;
629         uint64_t i1;
630         uint8_t c[8];
631         double d;
632
633         d = 8.642135e130; 
634         memcpy ((void *) &i0, (void *) &d, 8);
635
636         i1 = i0;
637         memcpy ((void *) c, (void *) &i1, 8);
638
639         if ((c[0] == 0x2f) && (c[1] == 0x25)
640                         && (c[2] == 0xc0) && (c[3] == 0xc7)
641                         && (c[4] == 0x43) && (c[5] == 0x2b)
642                         && (c[6] == 0x1f) && (c[7] == 0x5b))
643                 return (0);
644         else
645                 return (1);
646       ]]]]),
647       [c_cv_fp_layout_need_nothing="yes"],
648       [c_cv_fp_layout_need_nothing="no"]
649     )
650   )
651   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
652     fp_layout_type="nothing"
653   fi
654 fi
655 if test "x$fp_layout_type" = "xunknown"; then
656   AC_CACHE_CHECK([if endianflip converts to x86 representation],
657     [c_cv_fp_layout_need_endianflip],
658     AC_RUN_IFELSE(
659       AC_LANG_PROGRAM(
660       [[[[
661 #include <stdlib.h>
662 #include <stdio.h>
663 #include <stdint.h>
664 #include <string.h>
665 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
666                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
667                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
668                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
669                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
670                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
671                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
672                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
673       ]]]],
674       [[[[
675         uint64_t i0;
676         uint64_t i1;
677         uint8_t c[8];
678         double d;
679
680         d = 8.642135e130; 
681         memcpy ((void *) &i0, (void *) &d, 8);
682
683         i1 = endianflip (i0);
684         memcpy ((void *) c, (void *) &i1, 8);
685
686         if ((c[0] == 0x2f) && (c[1] == 0x25)
687                         && (c[2] == 0xc0) && (c[3] == 0xc7)
688                         && (c[4] == 0x43) && (c[5] == 0x2b)
689                         && (c[6] == 0x1f) && (c[7] == 0x5b))
690                 return (0);
691         else
692                 return (1);
693       ]]]]),
694       [c_cv_fp_layout_need_endianflip="yes"],
695       [c_cv_fp_layout_need_endianflip="no"]
696     )
697   )
698   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
699     fp_layout_type="endianflip"
700   fi
701 fi
702 if test "x$fp_layout_type" = "xunknown"; then
703   AC_CACHE_CHECK([if intswap converts to x86 representation],
704     [c_cv_fp_layout_need_intswap],
705     AC_RUN_IFELSE(
706       AC_LANG_PROGRAM(
707       [[[[
708 #include <stdlib.h>
709 #include <stdio.h>
710 #include <stdint.h>
711 #include <string.h>
712 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
713                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
714       ]]]],
715       [[[[
716         uint64_t i0;
717         uint64_t i1;
718         uint8_t c[8];
719         double d;
720
721         d = 8.642135e130; 
722         memcpy ((void *) &i0, (void *) &d, 8);
723
724         i1 = intswap (i0);
725         memcpy ((void *) c, (void *) &i1, 8);
726
727         if ((c[0] == 0x2f) && (c[1] == 0x25)
728                         && (c[2] == 0xc0) && (c[3] == 0xc7)
729                         && (c[4] == 0x43) && (c[5] == 0x2b)
730                         && (c[6] == 0x1f) && (c[7] == 0x5b))
731                 return (0);
732         else
733                 return (1);
734       ]]]]),
735       [c_cv_fp_layout_need_intswap="yes"],
736       [c_cv_fp_layout_need_intswap="no"]
737     )
738   )
739   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
740     fp_layout_type="intswap"
741   fi
742 fi
743
744 if test "x$fp_layout_type" = "xnothing"; then
745   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
746   [Define if doubles are stored in x86 representation.])
747 else if test "x$fp_layout_type" = "xendianflip"; then
748   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
749   [Define if endianflip is needed to convert to x86 representation.])
750 else if test "x$fp_layout_type" = "xintswap"; then
751   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
752   [Define if intswap is needed to convert to x86 representation.])
753 else
754   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
755 fi; fi; fi
756
757 have_getfsstat="no"
758 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
759 have_getvfsstat="no"
760 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
761 have_listmntent="no"
762 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
763
764 have_getmntent="no"
765 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
766 if test "x$have_getmntent" = "xno"; then
767         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
768 fi
769 if test "x$have_getmntent" = "xno"; then
770         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
771 fi
772 if test "x$have_getmntent" = "xno"; then
773         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
774 fi
775
776 if test "x$have_getmntent" = "xc"; then
777         AC_CACHE_CHECK([whether getmntent takes one argument],
778                 [c_cv_have_one_getmntent],
779                 AC_COMPILE_IFELSE(
780                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
781 #include <mntent.h>
782 #include "$srcdir/src/utils_mount.h"]],
783                                 [[
784                                  FILE *fh;
785                                  struct mntent *me;
786                                  fh = setmntent ("/etc/mtab", "r");
787                                  me = getmntent (fh);
788                                 ]]
789                         ),
790                         [c_cv_have_one_getmntent="yes"],
791                         [c_cv_have_one_getmntent="no"]
792                 )
793         )
794         AC_CACHE_CHECK([whether getmntent takes two arguments],
795                 [c_cv_have_two_getmntent],
796                 AC_COMPILE_IFELSE(
797                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
798 #include <sys/mnttab.h>
799 #include "$srcdir/src/utils_mount.h"]],
800                                 [[
801                                  FILE *fh;
802                                  struct mnttab mt;
803                                  int status;
804                                  fh = fopen ("/etc/mnttab", "r");
805                                  status = getmntent (fh, &mt);
806                                 ]]
807                         ),
808                         [c_cv_have_two_getmntent="yes"],
809                         [c_cv_have_two_getmntent="no"]
810                 )
811         )
812 fi
813
814 # Check for different versions of `getmntent' here..
815
816 if test "x$have_getmntent" = "xc"; then
817         if test "x$c_cv_have_one_getmntent" = "xyes"; then
818                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
819                           [Define if the function getmntent exists and takes one argument.])
820         fi
821         if test "x$c_cv_have_two_getmntent" = "xyes"; then
822                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
823                           [Define if the function getmntent exists and takes two arguments.])
824         fi
825 fi
826 if test "x$have_getmntent" = "xsun"; then
827         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
828                   [Define if the function getmntent exists. It's the version from libsun.])
829 fi
830 if test "x$have_getmntent" = "xseq"; then
831         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
832                   [Define if the function getmntent exists. It's the version from libseq.])
833 fi
834 if test "x$have_getmntent" = "xgen"; then
835         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
836                   [Define if the function getmntent exists. It's the version from libgen.])
837 fi
838
839 # Check for structures
840 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
841         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
842         [],
843         [
844         #include <sys/types.h>
845         #include <sys/socket.h>
846         #include <net/if.h>
847         ])
848 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
849         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
850         [],
851         [
852         #include <sys/types.h>
853         #include <sys/socket.h>
854         #include <linux/if.h>
855         #include <linux/netdevice.h>
856         ])
857
858 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
859 [#if HAVE_STDINT_H
860 # include <stdint.h>
861 #endif
862 #if HAVE_SYS_TYPES_H
863 # include <sys/types.h>
864 #endif
865 #if HAVE_NETINET_IN_SYSTM_H
866 # include <netinet/in_systm.h>
867 #endif
868 #if HAVE_NETINET_IN_H
869 # include <netinet/in.h>
870 #endif
871 #if HAVE_NETINET_IP_H
872 # include <netinet/ip.h>
873 #endif
874 #if HAVE_NETINET_UDP_H
875 # include <netinet/udp.h>
876 #endif
877 ])
878 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
879 [#if HAVE_STDINT_H
880 # include <stdint.h>
881 #endif
882 #if HAVE_SYS_TYPES_H
883 # include <sys/types.h>
884 #endif
885 #if HAVE_NETINET_IN_SYSTM_H
886 # include <netinet/in_systm.h>
887 #endif
888 #if HAVE_NETINET_IN_H
889 # include <netinet/in.h>
890 #endif
891 #if HAVE_NETINET_IP_H
892 # include <netinet/ip.h>
893 #endif
894 #if HAVE_NETINET_UDP_H
895 # include <netinet/udp.h>
896 #endif
897 ])
898
899 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
900         [],
901         [],
902         [
903 #if HAVE_KSTAT_H
904 # include <kstat.h>
905 #endif
906         ])
907
908 #
909 # Checks for libraries begin here
910 #
911 with_libresolv="yes"
912 AC_CHECK_LIB(resolv, res_search,
913 [
914         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
915 ],
916 [with_libresolv="no"])
917 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
918
919 dnl Check for HAL (hardware abstraction library)
920 with_libhal="yes"
921 AC_CHECK_LIB(hal,libhal_device_property_exists,
922              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
923              [with_libhal="no"])
924 if test "x$with_libhal" = "xyes"; then
925         if test "x$PKG_CONFIG" != "x"; then
926                 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
927                 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
928                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
929                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
930         fi
931 fi
932
933 m4_divert_once([HELP_WITH], [
934 collectd additional packages:])
935
936 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
937 librrd_cflags=""
938 librrd_ldflags=""
939 librrd_threadsafe="yes"
940 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
941 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
942         then
943                 librrd_cflags="-I$withval/include"
944                 librrd_ldflags="-L$withval/lib"
945                 with_rrdtool="yes"
946         else
947                 with_rrdtool="$withval"
948         fi
949 ], [with_rrdtool="yes"])
950 if test "x$with_rrdtool" = "xyes"
951 then
952         SAVE_CPPFLAGS="$CPPFLAGS"
953         SAVE_LDFLAGS="$LDFLAGS"
954
955         CPPFLAGS="$CPPFLAGS $librrd_cflags"
956         LDFLAGS="$LDFLAGS $librrd_ldflags"
957
958         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
959
960         CPPFLAGS="$SAVE_CPPFLAGS"
961         LDFLAGS="$SAVE_LDFLAGS"
962 fi
963 if test "x$with_rrdtool" = "xyes"
964 then
965         SAVE_CPPFLAGS="$CPPFLAGS"
966         SAVE_LDFLAGS="$LDFLAGS"
967
968         CPPFLAGS="$CPPFLAGS $librrd_cflags"
969         LDFLAGS="$LDFLAGS $librrd_ldflags"
970
971         AC_CHECK_LIB(rrd_th, rrd_update_r,
972         [with_rrdtool="yes"
973          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
974         ],
975         [librrd_threadsafe="no"
976          AC_CHECK_LIB(rrd, rrd_update,
977          [with_rrdtool="yes"
978           librrd_ldflags="$librrd_ldflags -lrrd -lm"
979          ],
980          [with_rrdtool="no (symbol 'rrd_update' not found)"],
981          [-lm])
982         ],
983         [-lm])
984
985         CPPFLAGS="$SAVE_CPPFLAGS"
986         LDFLAGS="$SAVE_LDFLAGS"
987 fi
988 if test "x$with_rrdtool" = "xyes"
989 then
990         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
991         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
992         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
993         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
994 fi
995 if test "x$librrd_threadsafe" = "xyes"
996 then
997         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
998 fi
999
1000 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
1001 [       if test "x$withval" != "xno" \
1002                 && test "x$withval" != "xyes"
1003         then
1004                 LDFLAGS="$LDFLAGS -L$withval/lib"
1005                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1006                 with_libpthread="yes"
1007         else
1008                 if test "x$withval" = "xno"
1009                 then
1010                         with_libpthread="no (disabled)"
1011                 fi
1012         fi
1013 ], [with_libpthread="yes"])
1014 if test "x$with_libpthread" = "xyes"
1015 then
1016         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1017 fi
1018 if test "x$with_libpthread" = "xyes"
1019 then
1020         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1021 fi
1022 if test "x$with_libpthread" = "xyes"
1023 then
1024         collect_pthread=1
1025 else
1026         collect_pthread=0
1027 fi
1028 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1029         [Wether or not to use pthread (POSIX threads) library])
1030 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1031
1032 if test "x$ac_system" = "xSolaris"
1033 then
1034         with_kstat="yes"
1035         with_devinfo="yes"
1036 else
1037         with_kstat="no (Solaris only)"
1038         with_devinfo="no (Solaris only)"
1039 fi
1040
1041 if test "x$with_kstat" = "xyes"
1042 then
1043         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1044 fi
1045 if test "x$with_kstat" = "xyes"
1046 then
1047         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1048         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1049 fi
1050 if test "x$with_kstat" = "xyes"
1051 then
1052         AC_DEFINE(HAVE_LIBKSTAT, 1,
1053                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1054 fi
1055 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1056 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1057
1058 ### BEGIN of check for libcurl ###
1059 with_curl_config="curl-config"
1060 with_curl_cflags=""
1061 with_curl_libs=""
1062 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1063 [
1064         if test "x$withval" = "xno"
1065         then
1066                 with_libcurl="no"
1067         else if test "x$withval" = "xyes"
1068         then
1069                 with_libcurl="yes"
1070         else
1071                 if test -f "$withval" && test -x "$withval"
1072                 then
1073                         with_curl_config="$withval"
1074                         with_libcurl="yes"
1075                 else if test -x "$withval/bin/curl-config"
1076                 then
1077                         with_curl_config="$withval/bin/curl-config"
1078                         with_libcurl="yes"
1079                 fi; fi
1080                 with_libcurl="yes"
1081         fi; fi
1082 ],
1083 [
1084         with_libcurl="yes"
1085 ])
1086 if test "x$with_libcurl" = "xyes"
1087 then
1088         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1089         curl_config_status=$?
1090
1091         if test $curl_config_status -ne 0
1092         then
1093                 with_libcurl="no ($with_curl_config failed)"
1094         else
1095                 SAVE_CPPFLAGS="$CPPFLAGS"
1096                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1097
1098                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1099
1100                 CPPFLAGS="$SAVE_CPPFLAGS"
1101         fi
1102 fi
1103 if test "x$with_libcurl" = "xyes"
1104 then
1105         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1106         curl_config_status=$?
1107
1108         if test $curl_config_status -ne 0
1109         then
1110                 with_libcurl="no ($with_curl_config failed)"
1111         else
1112                 AC_CHECK_LIB(curl, curl_easy_init,
1113                  [with_libcurl="yes"],
1114                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1115                  [$with_curl_libs])
1116         fi
1117 fi
1118 if test "x$with_libcurl" = "xyes"
1119 then
1120         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1121         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1122         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1123         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1124 fi
1125 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1126 ### END of check for libcurl ###
1127
1128 with_libiokit="no"
1129 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1130 [
1131         with_libiokit="yes"
1132 ], 
1133 [
1134         with_libiokit="no"
1135 ])
1136 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1137
1138 with_libstatgrab_cflags=""
1139 with_libstatgrab_ldflags=""
1140 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1141 [
1142         if test "x$withval" != "xno" \
1143                 && test "x$withval" != "xyes"
1144         then
1145                 with_libstatgrab_cflags="-I$withval/include"
1146                 with_libstatgrab_ldflags="-L$withval/lib"
1147                 with_libstatgrab="yes"
1148         else
1149                 with_libstatgrab="$withval"
1150         fi
1151 ],
1152 [
1153         if test "x$ac_system" = "xunknown"
1154         then
1155                 with_libstatgrab="yes"
1156         else
1157                 with_libstatgrab="no"
1158         fi
1159 ])
1160 with_libstatgrab_pkg_config="yes"
1161 if test "x$with_libstatgrab" = "xyes" \
1162   && test "x$PKG_CONFIG" != "x"
1163 then
1164   AC_MSG_CHECKING([pkg-config for libstatgrab])
1165   temp_result="found"
1166   $PKG_CONFIG --exists libstatgrab 2>/dev/null
1167   if test "$?" != "0"
1168   then
1169     with_libstatgrab_pkg_config="no"
1170     temp_result="not found"
1171   fi
1172   AC_MSG_RESULT([$temp_result])
1173 else
1174   AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1175   with_libstatgrab_pkg_config="no"
1176   with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1177 fi
1178
1179 if test "x$with_libstatgrab" = "xyes" \
1180   && test "x$with_libstatgrab_pkg_config" = "xyes" \
1181   && test "x$with_libstatgrab_cflags" = "x"
1182 then
1183   AC_MSG_CHECKING([for libstatgrab CFLAGS])
1184   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1185   if test "$?" = "0"
1186   then
1187     with_libstatgrab_cflags="$temp_result"
1188   else
1189     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1190     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1191   fi
1192   AC_MSG_RESULT([$temp_result])
1193 fi
1194
1195 if test "x$with_libstatgrab" = "xyes" \
1196   && test "x$with_libstatgrab_pkg_config" = "xyes" \
1197   && test "x$with_libstatgrab_ldflags" = "x"
1198 then
1199   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1200   temp_result="`$PKG_CONFIG --libs libstatgrab`"
1201   if test "$?" = "0"
1202   then
1203     with_libstatgrab_ldflags="$temp_result"
1204   else
1205     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1206     temp_result="$PKG_CONFIG --libs libstatgrab failed"
1207   fi
1208   AC_MSG_RESULT([$temp_result])
1209 fi
1210
1211 if test "x$with_libstatgrab" = "xyes"
1212 then
1213   SAVE_CPPFLAGS="$CPPFLAGS"
1214   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1215
1216   AC_CHECK_HEADERS(statgrab.h,
1217                    [with_libstatgrab="yes"],
1218                    [with_libstatgrab="no (statgrab.h not found)"])
1219
1220   CPPFLAGS="$SAVE_CPPFLAGS"
1221 fi
1222
1223 if test "x$with_libstatgrab" = "xyes"
1224 then
1225   SAVE_CFLAGS="$CFLAGS"
1226   SAVE_LDFLAGS="$LDFLAGS"
1227
1228   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1229   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1230
1231   AC_CHECK_LIB(statgrab, sg_init,
1232                [with_libstatgrab="yes"],
1233                [with_libstatgrab="no (symbol sg_init not found)"])
1234
1235   CFLAGS="$SAVE_CFLAGS"
1236   LDFLAGS="$SAVE_LDFLAGS"
1237 fi
1238
1239 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1240 if test "x$with_libstatgrab" = "xyes"
1241 then
1242   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1243   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1244   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1245   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1246   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1247 fi
1248
1249 with_libkvm="no"
1250 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1251 if test "x$with_kvm_getprocs" = "xyes"
1252 then
1253         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1254                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1255         with_libkvm="yes"
1256 fi
1257 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1258
1259 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1260 if test "x$with_kvm_getswapinfo" = "xyes"
1261 then
1262         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1263                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1264         with_libkvm="yes"
1265 fi
1266 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1267
1268 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1269 if test "x$with_kvm_nlist" = "xyes"
1270 then
1271         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1272                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1273         with_libkvm="yes"
1274 fi
1275 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1276
1277 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1278 if test "x$with_kvm_openfiles" = "xyes"
1279 then
1280         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1281                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1282         with_libkvm="yes"
1283 fi
1284 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1285
1286 with_sensors_cflags=""
1287 with_sensors_ldflags=""
1288 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1289 [
1290         if test "x$withval" = "xno"
1291         then
1292                 with_lm_sensors="no"
1293         else
1294                 with_lm_sensors="yes"
1295                 if test "x$withval" != "xyes"
1296                 then
1297                         with_sensors_cflags="-I$withval/include"
1298                         with_sensors_ldflags="-L$withval/lib"
1299                         with_lm_sensors="yes"
1300                 fi
1301         fi
1302 ],
1303 [
1304         if test "x$ac_system" = "xLinux"
1305         then
1306                 with_lm_sensors="yes"
1307         else
1308                 with_lm_sensors="no (Linux only library)"
1309         fi
1310 ])
1311 if test "x$with_lm_sensors" = "xyes"
1312 then
1313         SAVE_CPPFLAGS="$CPPFLAGS"
1314         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1315
1316 #       AC_CHECK_HEADERS(sensors/sensors.h,
1317 #       [
1318 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1319 #       ],
1320 #       [with_lm_sensors="no (sensors/sensors.h not found)"])
1321         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1322
1323         CPPFLAGS="$SAVE_CPPFLAGS"
1324 fi
1325 if test "x$with_lm_sensors" = "xyes"
1326 then
1327         SAVE_CPPFLAGS="$CPPFLAGS"
1328         SAVE_LDFLAGS="$LDFLAGS"
1329         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1330         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1331
1332         AC_CHECK_LIB(sensors, sensors_init,
1333         [
1334                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1335         ],
1336         [with_lm_sensors="no (libsensors not found)"])
1337
1338         CPPFLAGS="$SAVE_CPPFLAGS"
1339         LDFLAGS="$SAVE_LDFLAGS"
1340 fi
1341 if test "x$with_lm_sensors" = "xyes"
1342 then
1343         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1344         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1345         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1346         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1347 fi
1348 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1349
1350 with_mysql_config="mysql_config"
1351 with_mysql_cflags=""
1352 with_mysql_libs=""
1353 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1354 [
1355         if test "x$withval" = "xno"
1356         then
1357                 with_libmysql="no"
1358         else if test "x$withval" = "xyes"
1359         then
1360                 with_libmysql="yes"
1361         else
1362                 if test -f "$withval" && test -x "$withval";
1363                 then
1364                         with_mysql_config="$withval"
1365                 else if test -x "$withval/bin/mysql_config"
1366                 then
1367                         with_mysql_config="$withval/bin/mysql_config"
1368                 fi; fi
1369                 with_libmysql="yes"
1370         fi; fi
1371 ],
1372 [
1373         with_libmysql="yes"
1374 ])
1375 if test "x$with_libmysql" = "xyes"
1376 then
1377         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1378         mysql_config_status=$?
1379
1380         if test $mysql_config_status -ne 0
1381         then
1382                 with_libmysql="no ($with_mysql_config failed)"
1383         else
1384                 SAVE_CPPFLAGS="$CPPFLAGS"
1385                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1386
1387                 have_mysql_h="no"
1388                 have_mysql_mysql_h="no"
1389                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1390
1391                 if test "x$have_mysql_h" = "xno"
1392                 then
1393                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1394                 fi
1395
1396                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1397                 then
1398                         with_libmysql="no (mysql.h not found)"
1399                 fi
1400
1401                 CPPFLAGS="$SAVE_CPPFLAGS"
1402         fi
1403 fi
1404 if test "x$with_libmysql" = "xyes"
1405 then
1406         with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1407         mysql_config_status=$?
1408
1409         if test $mysql_config_status -ne 0
1410         then
1411                 with_libmysql="no ($with_mysql_config failed)"
1412         else
1413                 AC_CHECK_LIB(mysqlclient, mysql_init,
1414                  [with_libmysql="yes"],
1415                  [with_libmysql="no (symbol 'mysql_init' not found)"],
1416                  [$with_mysql_libs])
1417         fi
1418 fi
1419 if test "x$with_libmysql" = "xyes"
1420 then
1421         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1422         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1423         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1424         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1425 fi
1426 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1427
1428 with_own_liboconfig="no"
1429 liboconfig_LDFLAGS="$LDFLAGS"
1430 liboconfig_CPPFLAGS="$CPPFLAGS"
1431 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1432 [
1433         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1434         then
1435                 if test -d "$withval/lib"
1436                 then
1437                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1438                 fi
1439                 if test -d "$withval/include"
1440                 then
1441                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1442                 fi
1443         fi
1444         if test "x$withval" = "xno"
1445         then
1446                 AC_MSG_ERROR("liboconfig is required")
1447         fi
1448 ],
1449 [
1450         with_liboconfig="yes"
1451 ])
1452
1453 save_LDFLAGS="$LDFLAGS"
1454 save_CPPFLAGS="$CPPFLAGS"
1455 LDFLAGS="$liboconfig_LDFLAGS"
1456 CPPFLAGS="$liboconfig_CPPFLAGS"
1457 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1458 [
1459         with_liboconfig="yes"
1460         with_own_liboconfig="no"
1461 ],
1462 [
1463         with_liboconfig="yes"
1464         with_own_liboconfig="yes"
1465         LDFLAGS="$save_LDFLAGS"
1466         CPPFLAGS="$save_CPPFLAGS"
1467 ])
1468
1469 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1470 if test "x$with_own_liboconfig" = "xyes"
1471 then
1472         with_liboconfig="yes (shipped version)"
1473 fi
1474
1475 #with_liboping="yes"
1476 with_own_liboping="no"
1477 liboping_LDFLAGS="$LDFLAGS"
1478 liboping_CPPFLAGS="$CPPFLAGS"
1479 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1480 [
1481         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1482         then
1483                 if test -d "$withval/lib"
1484                 then
1485                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1486                 fi
1487                 if test -d "$withval/include"
1488                 then
1489                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1490                 fi
1491         fi
1492         if test "x$withval" = "xno"
1493         then
1494                 with_liboping="no"
1495                 with_own_liboping="no"
1496         else if test "x$withval" = "xyes"
1497         then
1498                 with_liboping="yes"
1499         fi; fi
1500 ],
1501 [
1502         with_liboping="yes"
1503 ])
1504
1505 if test "x$with_liboping" = "xyes"
1506 then
1507         save_LDFLAGS="$LDFLAGS"
1508         save_CPPFLAGS="$CPPFLAGS"
1509         LDFLAGS="$liboping_LDFLAGS"
1510         CPPFLAGS="$liboping_CPPFLAGS"
1511         AC_CHECK_LIB(oping, ping_construct,
1512         [
1513                 with_liboping="yes"
1514                 with_own_liboping="no"
1515         ],
1516         [
1517                 with_liboping="yes"
1518                 with_own_liboping="yes"
1519                 LDFLAGS="$save_LDFLAGS"
1520                 CPPFLAGS="$save_CPPFLAGS"
1521         ])
1522 fi
1523 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1524 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1525
1526 with_libowcapi_cppflags=""
1527 with_libowcapi_libs="-lowcapi"
1528 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1529 [
1530         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1531         then
1532                 with_libowcapi_cppflags="-I$withval/include"
1533                 with_libowcapi_libs="-L$withval/lib -lowcapi"
1534                 with_libowcapi="yes"
1535         else
1536                 with_libowcapi="$withval"
1537         fi
1538 ],
1539 [
1540         with_libowcapi="yes"
1541 ])
1542 if test "x$with_libowcapi" = "xyes"
1543 then
1544         SAVE_CPPFLAGS="$CPPFLAGS"
1545         CPPFLAGS="$with_libowcapi_cppflags"
1546         
1547         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1548
1549         CPPFLAGS="$SAVE_CPPFLAGS"
1550 fi
1551 if test "x$with_libowcapi" = "xyes"
1552 then
1553         SAVE_LDFLAGS="$LDFLAGS"
1554         SAVE_CPPFLAGS="$CPPFLAGS"
1555         LDFLAGS="$with_libowcapi_libs"
1556         CPPFLAGS="$with_libowcapi_cppflags"
1557         
1558         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1559
1560         LDFLAGS="$SAVE_LDFLAGS"
1561         CPPFLAGS="$SAVE_CPPFLAGS"
1562 fi
1563 if test "x$with_libowcapi" = "xyes"
1564 then
1565         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1566         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1567         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1568         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1569 fi
1570
1571
1572 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1573 [
1574         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1575         then
1576                 LDFLAGS="$LDFLAGS -L$withval/lib"
1577                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1578                 with_libpcap="yes"
1579         else
1580                 with_libpcap="$withval"
1581         fi
1582 ],
1583 [
1584         with_libpcap="yes"
1585 ])
1586 if test "x$with_libpcap" = "xyes"
1587 then
1588         AC_CHECK_LIB(pcap, pcap_open_live,
1589         [
1590                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1591         ], [with_libpcap="no (libpcap not found)"])
1592 fi
1593 if test "x$with_libpcap" = "xyes"
1594 then
1595         AC_CHECK_HEADERS(pcap.h,
1596         [
1597                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1598         ], [with_libpcap="no (pcap.h not found)"])
1599 fi
1600 if test "x$with_libpcap" = "xyes"
1601 then
1602         collect_libpcap=1
1603 else
1604         collect_libpcap=0
1605 fi
1606 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1607         [Wether or not to use the pcap library])
1608 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1609
1610 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1611 [
1612         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1613         then
1614                 LDFLAGS="$LDFLAGS -L$withval/lib"
1615                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1616                 with_libesmtp="yes"
1617         else
1618                 with_libesmtp="$withval"
1619         fi
1620 ],
1621 [
1622         with_libesmtp="yes"
1623 ])
1624 if test "x$with_libesmtp" = "xyes"
1625 then
1626         AC_CHECK_LIB(esmtp, smtp_create_session,
1627         [
1628                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1629         ], [with_libesmtp="no (libesmtp not found)"])
1630 fi
1631 if test "x$with_libesmtp" = "xyes"
1632 then
1633         AC_CHECK_HEADERS(libesmtp.h,
1634         [
1635                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1636         ], [with_libesmtp="no (libesmtp.h not found)"])
1637 fi
1638 if test "x$with_libesmtp" = "xyes"
1639 then
1640         collect_libesmtp=1
1641 else
1642         collect_libesmtp=0
1643 fi
1644 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1645         [Wether or not to use the esmtp library])
1646 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1647
1648 perl_interpreter="perl"
1649 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1650 [
1651         if test -x "$withval"
1652         then
1653                 perl_interpreter="$withval"
1654                 with_libperl="yes"
1655         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1656         then
1657                 LDFLAGS="$LDFLAGS -L$withval/lib"
1658                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1659                 perl_interpreter="$withval/bin/perl"
1660                 with_libperl="yes"
1661         else
1662                 with_libperl="$withval"
1663         fi; fi
1664 ],
1665 [
1666         with_libperl="yes"
1667 ])
1668
1669 AC_MSG_CHECKING([for perl])
1670 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1671 if test -x "$perl_interpreter"
1672 then
1673         AC_MSG_RESULT([yes ($perl_interpreter)])
1674 else
1675         perl_interpreter=""
1676         AC_MSG_RESULT([no])
1677 fi
1678
1679 AC_SUBST(PERL, "$perl_interpreter")
1680
1681 if test "x$with_libperl" = "xyes" \
1682         && test -n "$perl_interpreter"
1683 then
1684   SAVE_CFLAGS=$CFLAGS
1685   SAVE_LDFLAGS=$LDFLAGS
1686 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
1687   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
1688   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
1689   CFLAGS="$CFLAGS $PERL_CFLAGS"
1690   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1691
1692   AC_CACHE_CHECK([for libperl],
1693     [c_cv_have_libperl],
1694     AC_LINK_IFELSE(
1695       AC_LANG_PROGRAM(
1696       [[
1697 #define PERL_NO_GET_CONTEXT
1698 #include <EXTERN.h>
1699 #include <perl.h>
1700 #include <XSUB.h>
1701       ]],
1702       [[
1703        dTHX;
1704        load_module (PERL_LOADMOD_NOIMPORT,
1705                          newSVpv ("Collectd::Plugin::FooBar", 24),
1706                          Nullsv);
1707       ]]),
1708       [c_cv_have_libperl="yes"],
1709       [c_cv_have_libperl="no"]
1710     )
1711   )
1712
1713   if test "x$c_cv_have_libperl" = "xyes"
1714   then
1715           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1716           AC_SUBST(PERL_CFLAGS)
1717           AC_SUBST(PERL_LDFLAGS)
1718   else
1719           with_libperl="no"
1720   fi
1721
1722   CFLAGS=$SAVE_CFLAGS
1723   LDFLAGS=$SAVE_LDFLAGS
1724 else if test -z "$perl_interpreter"; then
1725   with_libperl="no (no perl interpreter found)"
1726   c_cv_have_libperl="no"
1727 fi; fi
1728 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1729
1730 if test "x$with_libperl" = "xyes"
1731 then
1732         SAVE_CFLAGS=$CFLAGS
1733         SAVE_LDFLAGS=$LDFLAGS
1734         CFLAGS="$CFLAGS $PERL_CFLAGS"
1735         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1736
1737         AC_CACHE_CHECK([if perl supports ithreads],
1738                 [c_cv_have_perl_ithreads],
1739                 AC_LINK_IFELSE(
1740                         AC_LANG_PROGRAM(
1741                         [[
1742 #include <EXTERN.h>
1743 #include <perl.h>
1744 #include <XSUB.h>
1745
1746 #if !defined(USE_ITHREADS)
1747 # error "Perl does not support ithreads!"
1748 #endif /* !defined(USE_ITHREADS) */
1749                         ]],
1750                         [[ ]]),
1751                         [c_cv_have_perl_ithreads="yes"],
1752                         [c_cv_have_perl_ithreads="no"]
1753                 )
1754         )
1755
1756         if test "x$c_cv_have_perl_ithreads" = "xyes"
1757         then
1758                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1759         fi
1760
1761         CFLAGS=$SAVE_CFLAGS
1762         LDFLAGS=$SAVE_LDFLAGS
1763 fi
1764
1765 with_own_libiptc="no"
1766 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1767 [
1768         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1769         then
1770                 LDFLAGS="$LDFLAGS -L$withval/lib"
1771                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1772                 with_libiptc="yes"
1773         else
1774                 with_libiptc="$withval"
1775         fi
1776 ],
1777 [
1778         if test "x$ac_system" = "xLinux"
1779         then
1780                 with_libiptc="yes"
1781         else
1782                 with_libiptc="no (Linux only)"
1783         fi
1784 ])
1785 if test "x$with_libiptc" = "xyes"
1786 then
1787         AC_CHECK_LIB(iptc, iptc_init,
1788         [
1789                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1790         ],
1791         [
1792                 with_libiptc="yes"
1793                 with_own_libiptc="yes"
1794         ])
1795 fi
1796 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1797 then
1798         AC_CHECK_HEADERS(libiptc/libiptc.h,
1799         [
1800                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1801         ],
1802         [
1803                 with_libiptc="yes"
1804                 with_own_libiptc="yes"
1805         ])
1806 fi
1807 if test "x$with_libiptc" = "xyes"
1808 then
1809         SAVE_CFLAGS=$CFLAGS
1810         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1811
1812         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1813         [
1814                 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1815                 with_own_libiptc="no"
1816         ],
1817         [
1818 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1819         ])
1820
1821         CFLAGS=$SAVE_CFLAGS
1822 fi
1823 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1824 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1825 if test "x$with_own_libiptc" = "xyes"
1826 then
1827         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1828 fi
1829
1830 with_snmp_config="net-snmp-config"
1831 with_snmp_cflags=""
1832 with_snmp_libs=""
1833 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1834 [
1835         if test "x$withval" = "xno"
1836         then
1837                 with_libnetsnmp="no"
1838         else if test "x$withval" = "xyes"
1839         then
1840                 with_libnetsnmp="yes"
1841         else
1842                 if test -x "$withval"
1843                 then
1844                         with_snmp_config="$withval"
1845                         with_libnetsnmp="yes"
1846                 else
1847                         with_snmp_config="$withval/bin/net-snmp-config"
1848                         with_libnetsnmp="yes"
1849                 fi
1850         fi; fi
1851 ],
1852 [with_libnetsnmp="yes"])
1853 if test "x$with_libnetsnmp" = "xyes"
1854 then
1855         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1856         snmp_config_status=$?
1857
1858         if test $snmp_config_status -ne 0
1859         then
1860                 with_libnetsnmp="no ($with_snmp_config failed)"
1861         else
1862                 SAVE_CPPFLAGS="$CPPFLAGS"
1863                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1864                 
1865                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1866
1867                 CPPFLAGS="$SAVE_CPPFLAGS"
1868         fi
1869 fi
1870 if test "x$with_libnetsnmp" = "xyes"
1871 then
1872         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1873         snmp_config_status=$?
1874
1875         if test $snmp_config_status -ne 0
1876         then
1877                 with_libnetsnmp="no ($with_snmp_config failed)"
1878         else
1879                 AC_CHECK_LIB(netsnmp, init_snmp,
1880                 [with_libnetsnmp="yes"],
1881                 [with_libnetsnmp="no (libnetsnmp not found)"],
1882                 [$with_snmp_libs])
1883         fi
1884 fi
1885 if test "x$with_libnetsnmp" = "xyes"
1886 then
1887         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1888         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1889         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1890         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1891 fi
1892 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1893
1894 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1895                 [with_libnotify="yes"],
1896                 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1897
1898 with_libupsclient_config=""
1899 with_libupsclient_cflags=""
1900 with_libupsclient_libs=""
1901 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1902 [
1903         if test "x$withval" = "xno"
1904         then
1905                 with_libupsclient="no"
1906         else if test "x$withval" = "xyes"
1907         then
1908                 with_libupsclient="use_pkgconfig"
1909         else
1910                 if test -x "$withval"
1911                 then
1912                         with_libupsclient_config="$withval"
1913                         with_libupsclient="use_libupsclient_config"
1914                 else if test -x "$withval/bin/libupsclient-config"
1915                 then
1916                         with_libupsclient_config="$withval/bin/net-snmp-config"
1917                         with_libupsclient="use_libupsclient_config"
1918                 else
1919                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
1920                         with_libupsclient_cflags="-I$withval/include"
1921                         with_libupsclient_libs="-L$withval/lib -lupsclient"
1922                         with_libupsclient="yes"
1923                 fi; fi
1924         fi; fi
1925 ],
1926 [with_libupsclient="use_pkgconfig"])
1927
1928 # configure using libupsclient-config
1929 if test "x$with_libupsclient" = "xuse_libupsclient_config"
1930 then
1931         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
1932         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
1933         if test $? -ne 0
1934         then
1935                 with_libupsclient="no ($with_libupsclient_config failed)"
1936         fi
1937         with_libupsclient_libs="`$with_libupsclient_config --libs`"
1938         if test $? -ne 0
1939         then
1940                 with_libupsclient="no ($with_libupsclient_config failed)"
1941         fi
1942 fi
1943 if test "x$with_libupsclient" = "xuse_libupsclient_config"
1944 then
1945         with_libupsclient="yes"
1946 fi
1947
1948 # configure using pkg-config
1949 if test "x$with_libupsclient" = "xuse_pkgconfig"
1950 then
1951         if test "x$PKG_CONFIG" = "x"
1952         then
1953                 with_libupsclient="no (Don't have pkg-config)"
1954         fi
1955 fi
1956 if test "x$with_libupsclient" = "xuse_pkgconfig"
1957 then
1958         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
1959         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
1960         if test $? -ne 0
1961         then
1962                 with_libupsclient="no (pkg-config doesn't know library)"
1963         fi
1964 fi
1965 if test "x$with_libupsclient" = "xuse_pkgconfig"
1966 then
1967         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
1968         if test $? -ne 0
1969         then
1970                 with_libupsclient="no ($PKG_CONFIG failed)"
1971         fi
1972         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
1973         if test $? -ne 0
1974         then
1975                 with_libupsclient="no ($PKG_CONFIG failed)"
1976         fi
1977 fi
1978 if test "x$with_libupsclient" = "xuse_pkgconfig"
1979 then
1980         with_libupsclient="yes"
1981 fi
1982
1983 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
1984 # the actual checks.
1985 if test "x$with_libupsclient" = "xyes"
1986 then
1987         SAVE_CPPFLAGS="$CPPFLAGS"
1988         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1989
1990         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1991
1992         CPPFLAGS="$SAVE_CPPFLAGS"
1993 fi
1994 if test "x$with_libupsclient" = "xyes"
1995 then
1996         SAVE_CPPFLAGS="$CPPFLAGS"
1997         SAVE_LDFLAGS="$LDFLAGS"
1998
1999         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2000         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2001
2002         AC_CHECK_LIB(upsclient, upscli_connect,
2003                      [with_libupsclient="yes"],
2004                      [with_libupsclient="no (symbol upscli_connect not found)"])
2005
2006         CPPFLAGS="$SAVE_CPPFLAGS"
2007         LDFLAGS="$SAVE_LDFLAGS"
2008 fi
2009 if test "x$with_libupsclient" = "xyes"
2010 then
2011         SAVE_CPPFLAGS="$CPPFLAGS"
2012         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2013
2014         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2015 [#include <stdlib.h>
2016 #include <stdio.h>
2017 #include <upsclient.h>])
2018
2019         CPPFLAGS="$SAVE_CPPFLAGS"
2020 fi
2021 if test "x$with_libupsclient" = "xyes"
2022 then
2023         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2024         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2025         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2026         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2027 fi
2028
2029 ### BEGIN of check for libxmms ###
2030 with_xmms_config="xmms-config"
2031 with_xmms_cflags=""
2032 with_xmms_libs=""
2033 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2034 [
2035         if test "x$withval" != "xno" \
2036                 && test "x$withval" != "xyes"
2037         then
2038                 if test -f "$withval" && test -x "$withval";
2039                 then
2040                         with_xmms_config="$withval"
2041                 else if test -x "$withval/bin/xmms-config"
2042                 then
2043                         with_xmms_config="$withval/bin/xmms-config"
2044                 fi; fi
2045                 with_libxmms="yes"
2046         else if test "x$withval" = "xno"
2047         then
2048                 with_libxmms="no"
2049         else
2050                 with_libxmms="yes"
2051         fi; fi
2052 ],
2053 [
2054         with_libxmms="yes"
2055 ])
2056 if test "x$with_libxmms" = "xyes"
2057 then
2058         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2059         xmms_config_status=$?
2060
2061         if test $xmms_config_status -ne 0
2062         then
2063                 with_libxmms="no"
2064         fi
2065 fi
2066 if test "x$with_libxmms" = "xyes"
2067 then
2068         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2069         xmms_config_status=$?
2070
2071         if test $xmms_config_status -ne 0
2072         then
2073                 with_libxmms="no"
2074         fi
2075 fi
2076 if test "x$with_libxmms" = "xyes"
2077 then
2078         AC_CHECK_LIB(xmms, xmms_remote_get_info,
2079         [
2080                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2081                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2082                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2083                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2084         ],
2085         [
2086                 with_libxmms="no"
2087         ],
2088         [$with_xmms_libs])
2089 fi
2090 with_libxmms_numeric=0
2091 if test "x$with_libxmms" = "xyes"
2092 then
2093         with_libxmms_numeric=1
2094 fi
2095 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2096 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2097 ### END of check for libxmms ###
2098
2099 with_libnetlink_cflags=""
2100 with_libnetlink_libs="-lnetlink"
2101 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2102 [
2103  echo "libnetlink: withval = $withval"
2104  if test "x$withval" = "xyes"
2105  then
2106          with_libnetlink="yes"
2107  else if test "x$withval" = "xno"
2108  then
2109          with_libnetlink="no"
2110  else
2111          if test -d "$withval/include"
2112          then
2113                  with_libnetlink_cflags="-I$withval/include"
2114                  with_libnetlink_libs="-L$withval/lib -lnetlink"
2115                  with_libnetlink="yes"
2116          else
2117                  AC_MSG_ERROR("no such directory: $withval/include")
2118          fi
2119  fi; fi
2120 ],
2121 [
2122  if test "x$ac_system" = "xLinux"
2123  then
2124          with_libnetlink="yes"
2125  else
2126          with_libnetlink="no (Linux only library)"
2127  fi
2128 ])
2129 if test "x$with_libnetlink" = "xyes"
2130 then
2131         SAVE_CFLAGS=$CFLAGS
2132         CFLAGS="$CFLAGS $with_libnetlink_cflags"
2133
2134         with_libnetlink="no (libnetlink.h not found)"
2135
2136         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2137         [
2138          with_libnetlink="yes"
2139          break
2140         ], [],
2141 [#include <stdio.h>
2142 #include <sys/types.h>
2143 #include <asm/types.h>
2144 #include <sys/socket.h>
2145 #include <linux/netlink.h>
2146 #include <linux/rtnetlink.h>])
2147         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2148 [#include <stdio.h>
2149 #include <sys/types.h>
2150 #include <asm/types.h>
2151 #include <sys/socket.h>])
2152
2153         AC_COMPILE_IFELSE(
2154 [#include <stdio.h>
2155 #include <sys/types.h>
2156 #include <asm/types.h>
2157 #include <sys/socket.h>
2158 #include <linux/netlink.h>
2159 #include <linux/rtnetlink.h>
2160
2161 int main (void)
2162 {
2163         int retval = TCA_STATS2;
2164         return (retval);
2165 }],
2166         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2167         []);
2168
2169         AC_COMPILE_IFELSE(
2170 [#include <stdio.h>
2171 #include <sys/types.h>
2172 #include <asm/types.h>
2173 #include <sys/socket.h>
2174 #include <linux/netlink.h>
2175 #include <linux/rtnetlink.h>
2176
2177 int main (void)
2178 {
2179         int retval = TCA_STATS;
2180         return (retval);
2181 }],
2182         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2183         []);
2184
2185         CFLAGS="$SAVE_CFLAGS"
2186 fi
2187 if test "x$with_libnetlink" = "xyes"
2188 then
2189         AC_CHECK_LIB(netlink, rtnl_open,
2190                      [with_libnetlink="yes"],
2191                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2192                      [$with_libnetlink_libs])
2193 fi
2194 if test "x$with_libnetlink" = "xyes"
2195 then
2196         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2197         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2198         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2199         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2200 fi
2201 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2202
2203 with_libopenipmipthread="yes"
2204 with_libopenipmipthread_cflags=""
2205 with_libopenipmipthread_libs=""
2206
2207 AC_MSG_CHECKING([for pkg-config])
2208 temp_result="no"
2209 if test "x$PKG_CONFIG" = "x"
2210 then
2211         with_libopenipmipthread="no"
2212         temp_result="no"
2213 else
2214         temp_result="$PKG_CONFIG"
2215 fi
2216 AC_MSG_RESULT([$temp_result])
2217
2218 if test "x$with_libopenipmipthread" = "xyes"
2219 then
2220         AC_MSG_CHECKING([for libOpenIPMIpthread])
2221         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2222         if test "$?" != "0"
2223         then
2224                 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2225         fi
2226         AC_MSG_RESULT([$with_libopenipmipthread])
2227 fi
2228
2229 if test "x$with_libopenipmipthread" = "xyes"
2230 then
2231         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2232         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2233         if test "$?" = "0"
2234         then
2235                 with_libopenipmipthread_cflags="$temp_result"
2236         else
2237                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2238                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2239         fi
2240         AC_MSG_RESULT([$temp_result])
2241 fi
2242
2243 if test "x$with_libopenipmipthread" = "xyes"
2244 then
2245         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2246         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2247         if test "$?" = "0"
2248         then
2249                 with_libopenipmipthread_ldflags="$temp_result"
2250         else
2251                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2252                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2253         fi
2254         AC_MSG_RESULT([$temp_result])
2255 fi
2256
2257 if test "x$with_libopenipmipthread" = "xyes"
2258 then
2259         SAVE_CPPFLAGS="$CPPFLAGS"
2260         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2261
2262         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2263                          [with_libopenipmipthread="yes"],
2264                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2265 [#include <OpenIPMI/ipmiif.h>
2266 #include <OpenIPMI/ipmi_err.h>
2267 #include <OpenIPMI/ipmi_posix.h>
2268 #include <OpenIPMI/ipmi_conn.h>
2269 ])
2270
2271         CPPFLAGS="$SAVE_CPPFLAGS"
2272 fi
2273
2274 if test "x$with_libopenipmipthread" = "xyes"
2275 then
2276         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2277         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2278         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2279         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2280 fi
2281
2282 dnl Check for libpq.
2283 with_pg_config="pg_config"
2284 with_libpq_includedir=""
2285 with_libpq_libdir=""
2286 with_libpq_cppflags=""
2287 with_libpq_ldflags=""
2288 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2289         [Path to libpq.])],
2290 [
2291         if test "x$withval" = "xno"
2292         then
2293                 with_libpq="no"
2294         else if test "x$withval" = "xyes"
2295         then
2296                 with_libpq="yes"
2297         else
2298                 if test -f "$withval" && test -x "$withval";
2299                 then
2300                         with_pg_config="$withval"
2301                 else if test -x "$withval/bin/pg_config"
2302                 then
2303                         with_pg_config="$withval/bin/pg_config"
2304                 fi; fi
2305                 with_libpq="yes"
2306         fi; fi
2307 ],
2308 [
2309         with_libpq="yes"
2310 ])
2311 if test "x$with_libpq" = "xyes"
2312 then
2313         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2314         pg_config_status=$?
2315
2316         if test $pg_config_status -eq 0
2317         then
2318                 if test -n "$with_libpq_includedir"; then
2319                         for dir in $with_libpq_includedir; do
2320                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2321                         done
2322                 fi
2323         else
2324                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2325         fi
2326
2327         SAVE_CPPFLAGS="$CPPFLAGS"
2328         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2329
2330         AC_CHECK_HEADERS(libpq-fe.h, [],
2331                 [with_libpq="no (libpq-fe.h not found)"], [])
2332
2333         CPPFLAGS="$SAVE_CPPFLAGS"
2334 fi
2335 if test "x$with_libpq" = "xyes"
2336 then
2337         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2338         pg_config_status=$?
2339
2340         if test $pg_config_status -eq 0
2341         then
2342                 if test -n "$with_libpq_libdir"; then
2343                         for dir in $with_libpq_libdir; do
2344                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2345                         done
2346                 fi
2347         else
2348                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2349         fi
2350
2351         SAVE_LDFLAGS="$LDFLAGS"
2352         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2353
2354         AC_CHECK_LIB(pq, PQconnectdb,
2355                 [with_libpq="yes"],
2356                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2357
2358         LDFLAGS="$SAVE_LDFLAGS"
2359 fi
2360 if test "x$with_libpq" = "xyes"
2361 then
2362         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2363         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2364         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2365         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2366 fi
2367 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2368
2369 dnl Check for libvirt and libxml2 libraries.
2370 with_libxml2="no (pkg-config isn't available)"
2371 with_libxml2_cflags=""
2372 with_libxml2_ldflags=""
2373 with_libvirt="no (pkg-config isn't available)"
2374 with_libvirt_cflags=""
2375 with_libvirt_ldflags=""
2376 if test "x$PKG_CONFIG" != "x"
2377 then
2378         pkg-config --exists 'libxml-2.0' 2>/dev/null
2379         if test "$?" = "0"
2380         then
2381                 with_libxml2="yes"
2382         else
2383                 with_libxml2="no (pkg-config doesn't know library)"
2384         fi
2385
2386         pkg-config --exists libvirt 2>/dev/null
2387         if test "$?" = "0"
2388         then
2389                 with_libvirt="yes"
2390         else
2391                 with_libvirt="no (pkg-config doesn't know library)"
2392         fi
2393 fi
2394 if test "x$with_libxml2" = "xyes"
2395 then
2396         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2397         if test $? -ne 0
2398         then
2399                 with_libxml2="no"
2400         fi
2401         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2402         if test $? -ne 0
2403         then
2404                 with_libxml2="no"
2405         fi
2406 fi
2407 if test "x$with_libxml2" = "xyes"
2408 then
2409         SAVE_CPPFLAGS="$CPPFLAGS"
2410         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2411
2412         AC_CHECK_HEADERS(libxml/parser.h, [],
2413                       [with_libxml2="no (libxml/parser.h not found)"])
2414
2415         CPPFLAGS="$SAVE_CPPFLAGS"
2416 fi
2417 if test "x$with_libxml2" = "xyes"
2418 then
2419         SAVE_CFLAGS="$CFLAGS"
2420         SAVE_LDFLAGS="$LDFLAGS"
2421
2422         CFLAGS="$CFLAGS $with_libxml2_cflags"
2423         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2424
2425         AC_CHECK_LIB(xml2, xmlXPathEval,
2426                      [with_libxml2="yes"],
2427                      [with_libxml2="no (symbol xmlXPathEval not found)"])
2428
2429         CFLAGS="$SAVE_CFLAGS"
2430         LDFLAGS="$SAVE_LDFLAGS"
2431 fi
2432 dnl Add the right compiler flags and libraries.
2433 if test "x$with_libxml2" = "xyes"; then
2434         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2435         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2436         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2437         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2438 fi
2439 if test "x$with_libvirt" = "xyes"
2440 then
2441         with_libvirt_cflags="`pkg-config --cflags libvirt`"
2442         if test $? -ne 0
2443         then
2444                 with_libvirt="no"
2445         fi
2446         with_libvirt_ldflags="`pkg-config --libs libvirt`"
2447         if test $? -ne 0
2448         then
2449                 with_libvirt="no"
2450         fi
2451 fi
2452 if test "x$with_libvirt" = "xyes"
2453 then
2454         SAVE_CPPFLAGS="$CPPFLAGS"
2455         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2456
2457         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2458                       [with_libvirt="no (libvirt/libvirt.h not found)"])
2459
2460         CPPFLAGS="$SAVE_CPPFLAGS"
2461 fi
2462 if test "x$with_libvirt" = "xyes"
2463 then
2464         SAVE_CFLAGS="$CFLAGS"
2465         SAVE_LDFLAGS="$LDFLAGS"
2466
2467         CFLAGS="$CFLAGS $with_libvirt_cflags"
2468         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2469
2470         AC_CHECK_LIB(virt, virDomainBlockStats,
2471                      [with_libvirt="yes"],
2472                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
2473
2474         CFLAGS="$SAVE_CFLAGS"
2475         LDFLAGS="$SAVE_LDFLAGS"
2476 fi
2477 dnl Add the right compiler flags and libraries.
2478 if test "x$with_libvirt" = "xyes"; then
2479         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2480         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2481         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2482         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2483 fi
2484
2485 dnl End of check for libvirt and libxml2 libraries.
2486
2487 # Check for enabled/disabled features
2488 #
2489
2490 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2491 # ------------------------------------------------------------
2492 dnl
2493 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2494 dnl
2495 AC_DEFUN(
2496         [AC_COLLECTD],
2497         [
2498         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2499         m4_if(
2500                 [$2],
2501                 [enable],
2502                 [dnl
2503                 m4_define([EnDis],[disabled])dnl
2504                 m4_define([YesNo],[no])dnl
2505                 ],dnl
2506                 [m4_if(
2507                         [$2],
2508                         [disable],
2509                         [dnl
2510                         m4_define([EnDis],[enabled])dnl
2511                         m4_define([YesNo],[yes])dnl
2512                         ],
2513                         [dnl
2514                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2515                         ]dnl
2516                 )]dnl
2517         )dnl
2518         m4_if([$3], [feature], [],
2519                 [m4_if(
2520                         [$3], [module], [],
2521                         [dnl
2522                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2523                         ]dnl
2524                 )]dnl
2525         )dnl
2526         AC_ARG_ENABLE(
2527                 [$1],
2528                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2529                 [],
2530                 enable_$1='[YesNo]'dnl
2531         )# AC_ARG_ENABLE
2532 if test "x$enable_$1" = "xno"
2533 then
2534         collectd_$1=0
2535 else
2536         if test "x$enable_$1" = "xyes"
2537         then
2538                 collectd_$1=1
2539         else
2540                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2541                 collectd_$1=1
2542                 enable_$1='yes'
2543         fi
2544 fi
2545         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2546         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2547         ]dnl
2548 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2549
2550 # AC_PLUGIN(name, default, info)
2551 # ------------------------------------------------------------
2552 dnl
2553 AC_DEFUN(
2554   [AC_PLUGIN],
2555   [
2556     enable_plugin="no"
2557     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2558     [
2559      if test "x$enableval" = "xyes"
2560      then
2561              enable_plugin="yes"
2562      else
2563              enable_plugin="no"
2564      fi
2565     ],
2566     [
2567      if test "x$2" = "xyes"
2568      then
2569              enable_plugin="yes"
2570      else
2571              enable_plugin="no"
2572      fi
2573     ])
2574     if test "x$enable_plugin" = "xyes"
2575     then
2576             if test "x$2" = "xyes"
2577             then
2578                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2579             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2580                     dependency_error="yes"
2581                     enable_plugin="no (dependency error)"
2582             fi
2583     fi
2584     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2585     enable_$1="$enable_plugin"
2586   ]
2587 )# AC_PLUGIN(name, default, info)
2588
2589 m4_divert_once([HELP_ENABLE], [
2590 collectd features:])
2591 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2592 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
2593 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
2594 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
2595
2596 dependency_error="no"
2597 plugin_ascent="no"
2598 plugin_battery="no"
2599 plugin_cpu="no"
2600 plugin_cpufreq="no"
2601 plugin_df="no"
2602 plugin_disk="no"
2603 plugin_entropy="no"
2604 plugin_interface="no"
2605 plugin_ipmi="no"
2606 plugin_ipvs="no"
2607 plugin_irq="no"
2608 plugin_libvirt="no"
2609 plugin_load="no"
2610 plugin_memory="no"
2611 plugin_multimeter="no"
2612 plugin_nfs="no"
2613 plugin_perl="no"
2614 plugin_processes="no"
2615 plugin_serial="no"
2616 plugin_swap="no"
2617 plugin_tape="no"
2618 plugin_tcpconns="no"
2619 plugin_thermal="no"
2620 plugin_users="no"
2621 plugin_vmem="no"
2622 plugin_vserver="no"
2623 plugin_wireless="no"
2624
2625 # Linux
2626 if test "x$ac_system" = "xLinux"
2627 then
2628         plugin_battery="yes"
2629         plugin_cpu="yes"
2630         plugin_cpufreq="yes"
2631         plugin_disk="yes"
2632         plugin_entropy="yes"
2633         plugin_interface="yes"
2634         plugin_irq="yes"
2635         plugin_load="yes"
2636         plugin_memory="yes"
2637         plugin_nfs="yes"
2638         plugin_processes="yes"
2639         plugin_serial="yes"
2640         plugin_swap="yes"
2641         plugin_tcpconns="yes"
2642         plugin_thermal="yes"
2643         plugin_vmem="yes"
2644         plugin_vserver="yes"
2645         plugin_wireless="yes"
2646
2647         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2648         then
2649                 plugin_ipvs="yes"
2650         fi
2651 fi
2652
2653 if test "x$ac_system" = "xOpenBSD"
2654 then
2655         plugin_tcpconns="yes"
2656 fi
2657
2658 # Mac OS X devices
2659 if test "x$with_libiokit" = "xyes"
2660 then
2661         plugin_battery="yes"
2662         plugin_disk="yes"
2663 fi
2664
2665 # Solaris
2666 if test "x$with_devinfo$with_kstat" = "xyesyes"
2667 then
2668         plugin_cpu="yes"
2669         plugin_disk="yes"
2670         plugin_interface="yes"
2671         plugin_memory="yes"
2672         plugin_tape="yes"
2673 fi
2674
2675 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
2676 then
2677         plugin_swap="yes"
2678 fi
2679
2680 # libstatgrab
2681 if test "x$with_libstatgrab" = "xyes"
2682 then
2683         plugin_cpu="yes"
2684         plugin_disk="yes"
2685         plugin_interface="yes"
2686         plugin_load="yes"
2687         plugin_memory="yes"
2688         plugin_swap="yes"
2689         plugin_users="yes"
2690 fi
2691
2692 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2693 then
2694         plugin_ascent="yes"
2695 fi
2696
2697 if test "x$with_libopenipmipthread" = "xyes"
2698 then
2699         plugin_ipmi="yes"
2700 fi
2701
2702 if test "x$have_processor_info" = "xyes"
2703 then
2704         plugin_cpu="yes"
2705 fi
2706 if test "x$have_sysctlbyname" = "xyes"
2707 then
2708         plugin_cpu="yes"
2709         plugin_memory="yes"
2710         plugin_tcpconns="yes"
2711 fi
2712
2713 if test "x$have_statfs" = "xyes"
2714 then
2715         plugin_df="yes"
2716 fi
2717 if test "x$have_statvfs" = "xyes"
2718 then
2719         plugin_df="yes"
2720 fi
2721
2722 if test "x$have_getifaddrs" = "xyes"
2723 then
2724         plugin_interface="yes"
2725 fi
2726
2727 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2728 then
2729         plugin_libvirt="yes"
2730 fi
2731
2732 if test "x$have_getloadavg" = "xyes"
2733 then
2734         plugin_load="yes"
2735 fi
2736
2737 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
2738 then
2739         plugin_perl="yes"
2740 fi
2741
2742 # Mac OS X memory interface
2743 if test "x$have_host_statistics" = "xyes"
2744 then
2745         plugin_memory="yes"
2746 fi
2747
2748 if test "x$have_termios_h" = "xyes"
2749 then
2750         plugin_multimeter="yes"
2751 fi
2752
2753 if test "x$have_thread_info" = "xyes"
2754 then
2755         plugin_processes="yes"
2756 fi
2757
2758 if test "x$with_kvm_getprocs" = "xyes"
2759 then
2760         plugin_processes="yes"
2761 fi
2762
2763 if test "x$with_kvm_getswapinfo" = "xyes"
2764 then
2765         plugin_swap="yes"
2766 fi
2767
2768 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
2769 then
2770         plugin_tcpconns="yes"
2771 fi
2772
2773 if test "x$have_getutent" = "xyes"
2774 then
2775         plugin_users="yes"
2776 fi
2777 if test "x$have_getutxent" = "xyes"
2778 then
2779         plugin_users="yes"
2780 fi
2781
2782 # FIXME: sysctl for swap plugin
2783
2784 m4_divert_once([HELP_ENABLE], [
2785 collectd plugins:])
2786
2787 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
2788 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
2789 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
2790 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
2791 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
2792 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
2793 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
2794 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
2795 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2796 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
2797 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
2798 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
2799 AC_PLUGIN([email],       [yes],                [EMail statistics])
2800 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
2801 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
2802 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
2803 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
2804 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
2805 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
2806 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
2807 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
2808 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
2809 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
2810 AC_PLUGIN([load],        [$plugin_load],       [System load])
2811 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
2812 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
2813 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
2814 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
2815 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
2816 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
2817 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
2818 AC_PLUGIN([network],     [yes],                [Network communication plugin])
2819 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
2820 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
2821 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
2822 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
2823 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
2824 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
2825 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
2826 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
2827 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
2828 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
2829 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
2830 AC_PLUGIN([rrdtool],     [$with_rrdtool],      [RRDTool output plugin])
2831 AC_PLUGIN([sensors],     [$with_lm_sensors],   [lm_sensors statistics])
2832 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
2833 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
2834 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
2835 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
2836 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
2837 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
2838 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
2839 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
2840 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
2841 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
2842 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
2843 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
2844 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
2845 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
2846 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
2847 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
2848
2849 dnl ip_vs.h
2850 if test "x$ac_system" = "xLinux" \
2851         && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2852 then
2853         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2854 fi
2855
2856 dnl Perl bindings
2857 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2858 [
2859         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2860         then
2861                 PERL_BINDINGS_OPTIONS="$withval"
2862                 with_perl_bindings="yes"
2863         else
2864                 PERL_BINDINGS_OPTIONS=""
2865                 with_perl_bindings="$withval"
2866         fi
2867 ],
2868 [
2869         PERL_BINDINGS_OPTIONS=""
2870         if test -n "$perl_interpreter"
2871         then
2872                 with_perl_bindings="yes"
2873         else
2874                 with_perl_bindings="no (no perl interpreter found)"
2875         fi
2876 ])
2877 if test "x$with_perl_bindings" = "xyes"
2878 then
2879         PERL_BINDINGS="perl"
2880 else
2881         PERL_BINDINGS=""
2882 fi
2883 AC_SUBST(PERL_BINDINGS)
2884 AC_SUBST(PERL_BINDINGS_OPTIONS)
2885
2886 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2887
2888 if test "x$with_rrdtool" = "xyes" \
2889         && test "x$librrd_threadsafe" != "xyes"
2890 then
2891         with_rrdtool="yes (warning: librrd is not thread-safe)"
2892 fi
2893
2894 if test "x$with_liboping" = "xyes" \
2895         && test "x$with_own_liboping" = "xyes"
2896 then
2897         with_liboping="yes (shipped version)"
2898 fi
2899
2900 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2901 then
2902         with_libiptc="yes (shipped version)"
2903 fi
2904
2905 if test "x$with_libperl" = "xyes"
2906 then
2907         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2908 else
2909         enable_perl="no (needs libperl)"
2910 fi
2911
2912 if test "x$with_perl_bindings" = "xyes" \
2913         && test "x$PERL_BINDINGS_OPTIONS" != "x"
2914 then
2915         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2916 fi
2917
2918 cat <<EOF;
2919
2920 Configuration:
2921   Libraries:
2922     libcurl . . . . . . . $with_libcurl
2923     libesmtp  . . . . . . $with_libesmtp
2924     libiokit  . . . . . . $with_libiokit
2925     libiptc . . . . . . . $with_libiptc
2926     libkstat  . . . . . . $with_kstat
2927     libkvm  . . . . . . . $with_libkvm
2928     libmysql  . . . . . . $with_libmysql
2929     libnetlink  . . . . . $with_libnetlink
2930     libnetsnmp  . . . . . $with_libnetsnmp
2931     libnotify . . . . . . $with_libnotify
2932     liboconfig  . . . . . $with_liboconfig
2933     libopenipmi . . . . . $with_libopenipmipthread
2934     liboping  . . . . . . $with_liboping
2935     libpcap . . . . . . . $with_libpcap
2936     libperl . . . . . . . $with_libperl
2937     libpthread  . . . . . $with_libpthread
2938     libpq . . . . . . . . $with_libpq
2939     librrd  . . . . . . . $with_rrdtool
2940     libsensors  . . . . . $with_lm_sensors
2941     libstatgrab . . . . . $with_libstatgrab
2942     libupsclient  . . . . $with_libupsclient
2943     libvirt . . . . . . . $with_libvirt
2944     libxml2 . . . . . . . $with_libxml2
2945     libxmms . . . . . . . $with_libxmms
2946
2947   Features:
2948     daemon mode . . . . . $enable_daemon
2949     debug . . . . . . . . $enable_debug
2950
2951   Bindings:
2952     perl  . . . . . . . . $with_perl_bindings
2953
2954   Modules:
2955     apache  . . . . . . . $enable_apache
2956     apcups  . . . . . . . $enable_apcups
2957     apple_sensors . . . . $enable_apple_sensors
2958     ascent  . . . . . . . $enable_ascent
2959     battery . . . . . . . $enable_battery
2960     cpu . . . . . . . . . $enable_cpu
2961     cpufreq . . . . . . . $enable_cpufreq
2962     csv . . . . . . . . . $enable_csv
2963     df  . . . . . . . . . $enable_df
2964     disk  . . . . . . . . $enable_disk
2965     dns . . . . . . . . . $enable_dns
2966     email . . . . . . . . $enable_email
2967     entropy . . . . . . . $enable_entropy
2968     exec  . . . . . . . . $enable_exec
2969     filecount . . . . . . $enable_filecount
2970     hddtemp . . . . . . . $enable_hddtemp
2971     interface . . . . . . $enable_interface
2972     iptables  . . . . . . $enable_iptables
2973     ipmi  . . . . . . . . $enable_ipmi
2974     ipvs  . . . . . . . . $enable_ipvs
2975     irq . . . . . . . . . $enable_irq
2976     libvirt . . . . . . . $enable_libvirt
2977     load  . . . . . . . . $enable_load
2978     logfile . . . . . . . $enable_logfile
2979     mbmon . . . . . . . . $enable_mbmon
2980     memcached . . . . . . $enable_memcached
2981     memory  . . . . . . . $enable_memory
2982     multimeter  . . . . . $enable_multimeter
2983     mysql . . . . . . . . $enable_mysql
2984     netlink . . . . . . . $enable_netlink
2985     network . . . . . . . $enable_network
2986     nfs . . . . . . . . . $enable_nfs
2987     nginx . . . . . . . . $enable_nginx
2988     notify_desktop  . . . $enable_notify_desktop
2989     notify_email  . . . . $enable_notify_email
2990     ntpd  . . . . . . . . $enable_ntpd
2991     nut . . . . . . . . . $enable_nut
2992     onewire . . . . . . . $enable_onewire
2993     perl  . . . . . . . . $enable_perl
2994     ping  . . . . . . . . $enable_ping
2995     postgresql  . . . . . $enable_postgresql
2996     powerdns  . . . . . . $enable_powerdns
2997     processes . . . . . . $enable_processes
2998     rrdtool . . . . . . . $enable_rrdtool
2999     sensors . . . . . . . $enable_sensors
3000     serial  . . . . . . . $enable_serial
3001     snmp  . . . . . . . . $enable_snmp
3002     swap  . . . . . . . . $enable_swap
3003     syslog  . . . . . . . $enable_syslog
3004     tail  . . . . . . . . $enable_tail
3005     tape  . . . . . . . . $enable_tape
3006     tcpconns  . . . . . . $enable_tcpconns
3007     teamspeak2  . . . . . $enable_teamspeak2
3008     thermal . . . . . . . $enable_thermal
3009     unixsock  . . . . . . $enable_unixsock
3010     users . . . . . . . . $enable_users
3011     uuid  . . . . . . . . $enable_uuid
3012     vmem  . . . . . . . . $enable_vmem
3013     vserver . . . . . . . $enable_vserver
3014     wireless  . . . . . . $enable_wireless
3015     xmms  . . . . . . . . $enable_xmms
3016
3017 EOF
3018
3019 if test "x$dependency_error" = "xyes"; then
3020         AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3021 fi