uuid plugin: Pass `int' to `isxdigit'.
[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 kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
859         [
860                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
861                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
862                 have_struct_kinfo_proc_freebsd="yes"
863         ],
864         [
865                 have_struct_kinfo_proc_freebsd="no"
866         ],
867         [
868 #include <kvm.h>
869 #include <sys/param.h>
870 #include <sys/sysctl.h>
871 #include <sys/user.h>
872         ])
873
874 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
875         [
876                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
877                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
878                 have_struct_kinfo_proc_openbsd="yes"
879         ],
880         [
881                 have_struct_kinfo_proc_openbsd="no"
882         ],
883         [
884 #include <sys/param.h>
885 #include <sys/sysctl.h>
886 #include <kvm.h>
887         ])
888
889 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
890 [#if HAVE_STDINT_H
891 # include <stdint.h>
892 #endif
893 #if HAVE_SYS_TYPES_H
894 # include <sys/types.h>
895 #endif
896 #if HAVE_NETINET_IN_SYSTM_H
897 # include <netinet/in_systm.h>
898 #endif
899 #if HAVE_NETINET_IN_H
900 # include <netinet/in.h>
901 #endif
902 #if HAVE_NETINET_IP_H
903 # include <netinet/ip.h>
904 #endif
905 #if HAVE_NETINET_UDP_H
906 # include <netinet/udp.h>
907 #endif
908 ])
909 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
910 [#if HAVE_STDINT_H
911 # include <stdint.h>
912 #endif
913 #if HAVE_SYS_TYPES_H
914 # include <sys/types.h>
915 #endif
916 #if HAVE_NETINET_IN_SYSTM_H
917 # include <netinet/in_systm.h>
918 #endif
919 #if HAVE_NETINET_IN_H
920 # include <netinet/in.h>
921 #endif
922 #if HAVE_NETINET_IP_H
923 # include <netinet/ip.h>
924 #endif
925 #if HAVE_NETINET_UDP_H
926 # include <netinet/udp.h>
927 #endif
928 ])
929
930 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
931         [],
932         [],
933         [
934 #if HAVE_KSTAT_H
935 # include <kstat.h>
936 #endif
937         ])
938
939 #
940 # Checks for libraries begin here
941 #
942 with_libresolv="yes"
943 AC_CHECK_LIB(resolv, res_search,
944 [
945         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
946 ],
947 [with_libresolv="no"])
948 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
949
950 dnl Check for HAL (hardware abstraction library)
951 with_libhal="yes"
952 AC_CHECK_LIB(hal,libhal_device_property_exists,
953              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
954              [with_libhal="no"])
955 if test "x$with_libhal" = "xyes"; then
956         if test "x$PKG_CONFIG" != "x"; then
957                 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
958                 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
959                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
960                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
961         fi
962 fi
963
964 m4_divert_once([HELP_WITH], [
965 collectd additional packages:])
966
967 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
968 librrd_cflags=""
969 librrd_ldflags=""
970 librrd_threadsafe="yes"
971 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
972 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
973         then
974                 librrd_cflags="-I$withval/include"
975                 librrd_ldflags="-L$withval/lib"
976                 with_rrdtool="yes"
977         else
978                 with_rrdtool="$withval"
979         fi
980 ], [with_rrdtool="yes"])
981 if test "x$with_rrdtool" = "xyes"
982 then
983         SAVE_CPPFLAGS="$CPPFLAGS"
984         SAVE_LDFLAGS="$LDFLAGS"
985
986         CPPFLAGS="$CPPFLAGS $librrd_cflags"
987         LDFLAGS="$LDFLAGS $librrd_ldflags"
988
989         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
990
991         CPPFLAGS="$SAVE_CPPFLAGS"
992         LDFLAGS="$SAVE_LDFLAGS"
993 fi
994 if test "x$with_rrdtool" = "xyes"
995 then
996         SAVE_CPPFLAGS="$CPPFLAGS"
997         SAVE_LDFLAGS="$LDFLAGS"
998
999         CPPFLAGS="$CPPFLAGS $librrd_cflags"
1000         LDFLAGS="$LDFLAGS $librrd_ldflags"
1001
1002         AC_CHECK_LIB(rrd_th, rrd_update_r,
1003         [with_rrdtool="yes"
1004          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
1005         ],
1006         [librrd_threadsafe="no"
1007          AC_CHECK_LIB(rrd, rrd_update,
1008          [with_rrdtool="yes"
1009           librrd_ldflags="$librrd_ldflags -lrrd -lm"
1010          ],
1011          [with_rrdtool="no (symbol 'rrd_update' not found)"],
1012          [-lm])
1013         ],
1014         [-lm])
1015
1016         CPPFLAGS="$SAVE_CPPFLAGS"
1017         LDFLAGS="$SAVE_LDFLAGS"
1018 fi
1019 if test "x$with_rrdtool" = "xyes"
1020 then
1021         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
1022         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
1023         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
1024         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
1025 fi
1026 if test "x$librrd_threadsafe" = "xyes"
1027 then
1028         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
1029 fi
1030
1031 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
1032 [       if test "x$withval" != "xno" \
1033                 && test "x$withval" != "xyes"
1034         then
1035                 LDFLAGS="$LDFLAGS -L$withval/lib"
1036                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1037                 with_libpthread="yes"
1038         else
1039                 if test "x$withval" = "xno"
1040                 then
1041                         with_libpthread="no (disabled)"
1042                 fi
1043         fi
1044 ], [with_libpthread="yes"])
1045 if test "x$with_libpthread" = "xyes"
1046 then
1047         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1048 fi
1049 if test "x$with_libpthread" = "xyes"
1050 then
1051         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1052 fi
1053 if test "x$with_libpthread" = "xyes"
1054 then
1055         collect_pthread=1
1056 else
1057         collect_pthread=0
1058 fi
1059 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1060         [Wether or not to use pthread (POSIX threads) library])
1061 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1062
1063 if test "x$ac_system" = "xSolaris"
1064 then
1065         with_kstat="yes"
1066         with_devinfo="yes"
1067 else
1068         with_kstat="no (Solaris only)"
1069         with_devinfo="no (Solaris only)"
1070 fi
1071
1072 if test "x$with_kstat" = "xyes"
1073 then
1074         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1075 fi
1076 if test "x$with_kstat" = "xyes"
1077 then
1078         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1079         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1080 fi
1081 if test "x$with_kstat" = "xyes"
1082 then
1083         AC_DEFINE(HAVE_LIBKSTAT, 1,
1084                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1085 fi
1086 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1087 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1088
1089 ### BEGIN of check for libcurl ###
1090 with_curl_config="curl-config"
1091 with_curl_cflags=""
1092 with_curl_libs=""
1093 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1094 [
1095         if test "x$withval" = "xno"
1096         then
1097                 with_libcurl="no"
1098         else if test "x$withval" = "xyes"
1099         then
1100                 with_libcurl="yes"
1101         else
1102                 if test -f "$withval" && test -x "$withval"
1103                 then
1104                         with_curl_config="$withval"
1105                         with_libcurl="yes"
1106                 else if test -x "$withval/bin/curl-config"
1107                 then
1108                         with_curl_config="$withval/bin/curl-config"
1109                         with_libcurl="yes"
1110                 fi; fi
1111                 with_libcurl="yes"
1112         fi; fi
1113 ],
1114 [
1115         with_libcurl="yes"
1116 ])
1117 if test "x$with_libcurl" = "xyes"
1118 then
1119         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1120         curl_config_status=$?
1121
1122         if test $curl_config_status -ne 0
1123         then
1124                 with_libcurl="no ($with_curl_config failed)"
1125         else
1126                 SAVE_CPPFLAGS="$CPPFLAGS"
1127                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1128
1129                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1130
1131                 CPPFLAGS="$SAVE_CPPFLAGS"
1132         fi
1133 fi
1134 if test "x$with_libcurl" = "xyes"
1135 then
1136         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1137         curl_config_status=$?
1138
1139         if test $curl_config_status -ne 0
1140         then
1141                 with_libcurl="no ($with_curl_config failed)"
1142         else
1143                 AC_CHECK_LIB(curl, curl_easy_init,
1144                  [with_libcurl="yes"],
1145                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1146                  [$with_curl_libs])
1147         fi
1148 fi
1149 if test "x$with_libcurl" = "xyes"
1150 then
1151         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1152         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1153         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1154         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1155 fi
1156 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1157 ### END of check for libcurl ###
1158
1159 with_libiokit="no"
1160 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1161 [
1162         with_libiokit="yes"
1163 ], 
1164 [
1165         with_libiokit="no"
1166 ])
1167 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1168
1169 with_libstatgrab_cflags=""
1170 with_libstatgrab_ldflags=""
1171 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1172 [
1173         if test "x$withval" != "xno" \
1174                 && test "x$withval" != "xyes"
1175         then
1176                 with_libstatgrab_cflags="-I$withval/include"
1177                 with_libstatgrab_ldflags="-L$withval/lib"
1178                 with_libstatgrab="yes"
1179         else
1180                 with_libstatgrab="$withval"
1181         fi
1182 ],
1183 [
1184         if test "x$ac_system" = "xunknown"
1185         then
1186                 with_libstatgrab="yes"
1187         else
1188                 with_libstatgrab="no"
1189         fi
1190 ])
1191 with_libstatgrab_pkg_config="yes"
1192 if test "x$with_libstatgrab" = "xyes" \
1193   && test "x$PKG_CONFIG" != "x"
1194 then
1195   AC_MSG_CHECKING([pkg-config for libstatgrab])
1196   temp_result="found"
1197   $PKG_CONFIG --exists libstatgrab 2>/dev/null
1198   if test "$?" != "0"
1199   then
1200     with_libstatgrab_pkg_config="no"
1201     temp_result="not found"
1202   fi
1203   AC_MSG_RESULT([$temp_result])
1204 else
1205   AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1206   with_libstatgrab_pkg_config="no"
1207   with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1208 fi
1209
1210 if test "x$with_libstatgrab" = "xyes" \
1211   && test "x$with_libstatgrab_pkg_config" = "xyes" \
1212   && test "x$with_libstatgrab_cflags" = "x"
1213 then
1214   AC_MSG_CHECKING([for libstatgrab CFLAGS])
1215   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1216   if test "$?" = "0"
1217   then
1218     with_libstatgrab_cflags="$temp_result"
1219   else
1220     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1221     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1222   fi
1223   AC_MSG_RESULT([$temp_result])
1224 fi
1225
1226 if test "x$with_libstatgrab" = "xyes" \
1227   && test "x$with_libstatgrab_pkg_config" = "xyes" \
1228   && test "x$with_libstatgrab_ldflags" = "x"
1229 then
1230   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1231   temp_result="`$PKG_CONFIG --libs libstatgrab`"
1232   if test "$?" = "0"
1233   then
1234     with_libstatgrab_ldflags="$temp_result"
1235   else
1236     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1237     temp_result="$PKG_CONFIG --libs libstatgrab failed"
1238   fi
1239   AC_MSG_RESULT([$temp_result])
1240 fi
1241
1242 if test "x$with_libstatgrab" = "xyes"
1243 then
1244   SAVE_CPPFLAGS="$CPPFLAGS"
1245   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1246
1247   AC_CHECK_HEADERS(statgrab.h,
1248                    [with_libstatgrab="yes"],
1249                    [with_libstatgrab="no (statgrab.h not found)"])
1250
1251   CPPFLAGS="$SAVE_CPPFLAGS"
1252 fi
1253
1254 if test "x$with_libstatgrab" = "xyes"
1255 then
1256   SAVE_CFLAGS="$CFLAGS"
1257   SAVE_LDFLAGS="$LDFLAGS"
1258
1259   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1260   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1261
1262   AC_CHECK_LIB(statgrab, sg_init,
1263                [with_libstatgrab="yes"],
1264                [with_libstatgrab="no (symbol sg_init not found)"])
1265
1266   CFLAGS="$SAVE_CFLAGS"
1267   LDFLAGS="$SAVE_LDFLAGS"
1268 fi
1269
1270 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1271 if test "x$with_libstatgrab" = "xyes"
1272 then
1273   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1274   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1275   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1276   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1277   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1278 fi
1279
1280 with_libkvm="no"
1281 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1282 if test "x$with_kvm_getprocs" = "xyes"
1283 then
1284         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1285                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1286         with_libkvm="yes"
1287 fi
1288 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1289
1290 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1291 if test "x$with_kvm_getswapinfo" = "xyes"
1292 then
1293         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1294                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1295         with_libkvm="yes"
1296 fi
1297 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1298
1299 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1300 if test "x$with_kvm_nlist" = "xyes"
1301 then
1302         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1303                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1304         with_libkvm="yes"
1305 fi
1306 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1307
1308 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1309 if test "x$with_kvm_openfiles" = "xyes"
1310 then
1311         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1312                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1313         with_libkvm="yes"
1314 fi
1315 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1316
1317 with_sensors_cflags=""
1318 with_sensors_ldflags=""
1319 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1320 [
1321         if test "x$withval" = "xno"
1322         then
1323                 with_lm_sensors="no"
1324         else
1325                 with_lm_sensors="yes"
1326                 if test "x$withval" != "xyes"
1327                 then
1328                         with_sensors_cflags="-I$withval/include"
1329                         with_sensors_ldflags="-L$withval/lib"
1330                         with_lm_sensors="yes"
1331                 fi
1332         fi
1333 ],
1334 [
1335         if test "x$ac_system" = "xLinux"
1336         then
1337                 with_lm_sensors="yes"
1338         else
1339                 with_lm_sensors="no (Linux only library)"
1340         fi
1341 ])
1342 if test "x$with_lm_sensors" = "xyes"
1343 then
1344         SAVE_CPPFLAGS="$CPPFLAGS"
1345         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1346
1347 #       AC_CHECK_HEADERS(sensors/sensors.h,
1348 #       [
1349 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1350 #       ],
1351 #       [with_lm_sensors="no (sensors/sensors.h not found)"])
1352         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1353
1354         CPPFLAGS="$SAVE_CPPFLAGS"
1355 fi
1356 if test "x$with_lm_sensors" = "xyes"
1357 then
1358         SAVE_CPPFLAGS="$CPPFLAGS"
1359         SAVE_LDFLAGS="$LDFLAGS"
1360         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1361         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1362
1363         AC_CHECK_LIB(sensors, sensors_init,
1364         [
1365                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1366         ],
1367         [with_lm_sensors="no (libsensors not found)"])
1368
1369         CPPFLAGS="$SAVE_CPPFLAGS"
1370         LDFLAGS="$SAVE_LDFLAGS"
1371 fi
1372 if test "x$with_lm_sensors" = "xyes"
1373 then
1374         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1375         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1376         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1377         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1378 fi
1379 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1380
1381 with_mysql_config="mysql_config"
1382 with_mysql_cflags=""
1383 with_mysql_libs=""
1384 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1385 [
1386         if test "x$withval" = "xno"
1387         then
1388                 with_libmysql="no"
1389         else if test "x$withval" = "xyes"
1390         then
1391                 with_libmysql="yes"
1392         else
1393                 if test -f "$withval" && test -x "$withval";
1394                 then
1395                         with_mysql_config="$withval"
1396                 else if test -x "$withval/bin/mysql_config"
1397                 then
1398                         with_mysql_config="$withval/bin/mysql_config"
1399                 fi; fi
1400                 with_libmysql="yes"
1401         fi; fi
1402 ],
1403 [
1404         with_libmysql="yes"
1405 ])
1406 if test "x$with_libmysql" = "xyes"
1407 then
1408         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1409         mysql_config_status=$?
1410
1411         if test $mysql_config_status -ne 0
1412         then
1413                 with_libmysql="no ($with_mysql_config failed)"
1414         else
1415                 SAVE_CPPFLAGS="$CPPFLAGS"
1416                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1417
1418                 have_mysql_h="no"
1419                 have_mysql_mysql_h="no"
1420                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1421
1422                 if test "x$have_mysql_h" = "xno"
1423                 then
1424                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1425                 fi
1426
1427                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1428                 then
1429                         with_libmysql="no (mysql.h not found)"
1430                 fi
1431
1432                 CPPFLAGS="$SAVE_CPPFLAGS"
1433         fi
1434 fi
1435 if test "x$with_libmysql" = "xyes"
1436 then
1437         with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1438         mysql_config_status=$?
1439
1440         if test $mysql_config_status -ne 0
1441         then
1442                 with_libmysql="no ($with_mysql_config failed)"
1443         else
1444                 AC_CHECK_LIB(mysqlclient, mysql_init,
1445                  [with_libmysql="yes"],
1446                  [with_libmysql="no (symbol 'mysql_init' not found)"],
1447                  [$with_mysql_libs])
1448         fi
1449 fi
1450 if test "x$with_libmysql" = "xyes"
1451 then
1452         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1453         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1454         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1455         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1456 fi
1457 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1458
1459 with_own_liboconfig="no"
1460 liboconfig_LDFLAGS="$LDFLAGS"
1461 liboconfig_CPPFLAGS="$CPPFLAGS"
1462 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1463 [
1464         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1465         then
1466                 if test -d "$withval/lib"
1467                 then
1468                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1469                 fi
1470                 if test -d "$withval/include"
1471                 then
1472                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1473                 fi
1474         fi
1475         if test "x$withval" = "xno"
1476         then
1477                 AC_MSG_ERROR("liboconfig is required")
1478         fi
1479 ],
1480 [
1481         with_liboconfig="yes"
1482 ])
1483
1484 save_LDFLAGS="$LDFLAGS"
1485 save_CPPFLAGS="$CPPFLAGS"
1486 LDFLAGS="$liboconfig_LDFLAGS"
1487 CPPFLAGS="$liboconfig_CPPFLAGS"
1488 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1489 [
1490         with_liboconfig="yes"
1491         with_own_liboconfig="no"
1492 ],
1493 [
1494         with_liboconfig="yes"
1495         with_own_liboconfig="yes"
1496         LDFLAGS="$save_LDFLAGS"
1497         CPPFLAGS="$save_CPPFLAGS"
1498 ])
1499
1500 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1501 if test "x$with_own_liboconfig" = "xyes"
1502 then
1503         with_liboconfig="yes (shipped version)"
1504 fi
1505
1506 #with_liboping="yes"
1507 with_own_liboping="no"
1508 liboping_LDFLAGS="$LDFLAGS"
1509 liboping_CPPFLAGS="$CPPFLAGS"
1510 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1511 [
1512         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1513         then
1514                 if test -d "$withval/lib"
1515                 then
1516                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1517                 fi
1518                 if test -d "$withval/include"
1519                 then
1520                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1521                 fi
1522         fi
1523         if test "x$withval" = "xno"
1524         then
1525                 with_liboping="no"
1526                 with_own_liboping="no"
1527         else if test "x$withval" = "xyes"
1528         then
1529                 with_liboping="yes"
1530         fi; fi
1531 ],
1532 [
1533         with_liboping="yes"
1534 ])
1535
1536 if test "x$with_liboping" = "xyes"
1537 then
1538         save_LDFLAGS="$LDFLAGS"
1539         save_CPPFLAGS="$CPPFLAGS"
1540         LDFLAGS="$liboping_LDFLAGS"
1541         CPPFLAGS="$liboping_CPPFLAGS"
1542         AC_CHECK_LIB(oping, ping_construct,
1543         [
1544                 with_liboping="yes"
1545                 with_own_liboping="no"
1546         ],
1547         [
1548                 with_liboping="yes"
1549                 with_own_liboping="yes"
1550                 LDFLAGS="$save_LDFLAGS"
1551                 CPPFLAGS="$save_CPPFLAGS"
1552         ])
1553 fi
1554 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1555 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1556
1557 with_libowcapi_cppflags=""
1558 with_libowcapi_libs="-lowcapi"
1559 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1560 [
1561         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1562         then
1563                 with_libowcapi_cppflags="-I$withval/include"
1564                 with_libowcapi_libs="-L$withval/lib -lowcapi"
1565                 with_libowcapi="yes"
1566         else
1567                 with_libowcapi="$withval"
1568         fi
1569 ],
1570 [
1571         with_libowcapi="yes"
1572 ])
1573 if test "x$with_libowcapi" = "xyes"
1574 then
1575         SAVE_CPPFLAGS="$CPPFLAGS"
1576         CPPFLAGS="$with_libowcapi_cppflags"
1577         
1578         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1579
1580         CPPFLAGS="$SAVE_CPPFLAGS"
1581 fi
1582 if test "x$with_libowcapi" = "xyes"
1583 then
1584         SAVE_LDFLAGS="$LDFLAGS"
1585         SAVE_CPPFLAGS="$CPPFLAGS"
1586         LDFLAGS="$with_libowcapi_libs"
1587         CPPFLAGS="$with_libowcapi_cppflags"
1588         
1589         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1590
1591         LDFLAGS="$SAVE_LDFLAGS"
1592         CPPFLAGS="$SAVE_CPPFLAGS"
1593 fi
1594 if test "x$with_libowcapi" = "xyes"
1595 then
1596         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1597         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1598         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1599         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1600 fi
1601
1602
1603 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1604 [
1605         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1606         then
1607                 LDFLAGS="$LDFLAGS -L$withval/lib"
1608                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1609                 with_libpcap="yes"
1610         else
1611                 with_libpcap="$withval"
1612         fi
1613 ],
1614 [
1615         with_libpcap="yes"
1616 ])
1617 if test "x$with_libpcap" = "xyes"
1618 then
1619         AC_CHECK_LIB(pcap, pcap_open_live,
1620         [
1621                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1622         ], [with_libpcap="no (libpcap not found)"])
1623 fi
1624 if test "x$with_libpcap" = "xyes"
1625 then
1626         AC_CHECK_HEADERS(pcap.h,
1627         [
1628                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1629         ], [with_libpcap="no (pcap.h not found)"])
1630 fi
1631 if test "x$with_libpcap" = "xyes"
1632 then
1633         collect_libpcap=1
1634 else
1635         collect_libpcap=0
1636 fi
1637 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1638         [Wether or not to use the pcap library])
1639 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1640
1641 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1642 [
1643         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1644         then
1645                 LDFLAGS="$LDFLAGS -L$withval/lib"
1646                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1647                 with_libesmtp="yes"
1648         else
1649                 with_libesmtp="$withval"
1650         fi
1651 ],
1652 [
1653         with_libesmtp="yes"
1654 ])
1655 if test "x$with_libesmtp" = "xyes"
1656 then
1657         AC_CHECK_LIB(esmtp, smtp_create_session,
1658         [
1659                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1660         ], [with_libesmtp="no (libesmtp not found)"])
1661 fi
1662 if test "x$with_libesmtp" = "xyes"
1663 then
1664         AC_CHECK_HEADERS(libesmtp.h,
1665         [
1666                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1667         ], [with_libesmtp="no (libesmtp.h not found)"])
1668 fi
1669 if test "x$with_libesmtp" = "xyes"
1670 then
1671         collect_libesmtp=1
1672 else
1673         collect_libesmtp=0
1674 fi
1675 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1676         [Wether or not to use the esmtp library])
1677 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1678
1679 perl_interpreter="perl"
1680 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1681 [
1682         if test -x "$withval"
1683         then
1684                 perl_interpreter="$withval"
1685                 with_libperl="yes"
1686         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1687         then
1688                 LDFLAGS="$LDFLAGS -L$withval/lib"
1689                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1690                 perl_interpreter="$withval/bin/perl"
1691                 with_libperl="yes"
1692         else
1693                 with_libperl="$withval"
1694         fi; fi
1695 ],
1696 [
1697         with_libperl="yes"
1698 ])
1699
1700 AC_MSG_CHECKING([for perl])
1701 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1702 if test -x "$perl_interpreter"
1703 then
1704         AC_MSG_RESULT([yes ($perl_interpreter)])
1705 else
1706         perl_interpreter=""
1707         AC_MSG_RESULT([no])
1708 fi
1709
1710 AC_SUBST(PERL, "$perl_interpreter")
1711
1712 if test "x$with_libperl" = "xyes" \
1713         && test -n "$perl_interpreter"
1714 then
1715   SAVE_CFLAGS=$CFLAGS
1716   SAVE_LDFLAGS=$LDFLAGS
1717 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
1718   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
1719   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
1720   CFLAGS="$CFLAGS $PERL_CFLAGS"
1721   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1722
1723   AC_CACHE_CHECK([for libperl],
1724     [c_cv_have_libperl],
1725     AC_LINK_IFELSE(
1726       AC_LANG_PROGRAM(
1727       [[
1728 #define PERL_NO_GET_CONTEXT
1729 #include <EXTERN.h>
1730 #include <perl.h>
1731 #include <XSUB.h>
1732       ]],
1733       [[
1734        dTHX;
1735        load_module (PERL_LOADMOD_NOIMPORT,
1736                          newSVpv ("Collectd::Plugin::FooBar", 24),
1737                          Nullsv);
1738       ]]),
1739       [c_cv_have_libperl="yes"],
1740       [c_cv_have_libperl="no"]
1741     )
1742   )
1743
1744   if test "x$c_cv_have_libperl" = "xyes"
1745   then
1746           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1747           AC_SUBST(PERL_CFLAGS)
1748           AC_SUBST(PERL_LDFLAGS)
1749   else
1750           with_libperl="no"
1751   fi
1752
1753   CFLAGS=$SAVE_CFLAGS
1754   LDFLAGS=$SAVE_LDFLAGS
1755 else if test -z "$perl_interpreter"; then
1756   with_libperl="no (no perl interpreter found)"
1757   c_cv_have_libperl="no"
1758 fi; fi
1759 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1760
1761 if test "x$with_libperl" = "xyes"
1762 then
1763         SAVE_CFLAGS=$CFLAGS
1764         SAVE_LDFLAGS=$LDFLAGS
1765         CFLAGS="$CFLAGS $PERL_CFLAGS"
1766         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1767
1768         AC_CACHE_CHECK([if perl supports ithreads],
1769                 [c_cv_have_perl_ithreads],
1770                 AC_LINK_IFELSE(
1771                         AC_LANG_PROGRAM(
1772                         [[
1773 #include <EXTERN.h>
1774 #include <perl.h>
1775 #include <XSUB.h>
1776
1777 #if !defined(USE_ITHREADS)
1778 # error "Perl does not support ithreads!"
1779 #endif /* !defined(USE_ITHREADS) */
1780                         ]],
1781                         [[ ]]),
1782                         [c_cv_have_perl_ithreads="yes"],
1783                         [c_cv_have_perl_ithreads="no"]
1784                 )
1785         )
1786
1787         if test "x$c_cv_have_perl_ithreads" = "xyes"
1788         then
1789                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1790         fi
1791
1792         CFLAGS=$SAVE_CFLAGS
1793         LDFLAGS=$SAVE_LDFLAGS
1794 fi
1795
1796 with_own_libiptc="no"
1797 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1798 [
1799         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1800         then
1801                 LDFLAGS="$LDFLAGS -L$withval/lib"
1802                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1803                 with_libiptc="yes"
1804         else
1805                 with_libiptc="$withval"
1806         fi
1807 ],
1808 [
1809         if test "x$ac_system" = "xLinux"
1810         then
1811                 with_libiptc="yes"
1812         else
1813                 with_libiptc="no (Linux only)"
1814         fi
1815 ])
1816 if test "x$with_libiptc" = "xyes"
1817 then
1818         AC_CHECK_LIB(iptc, iptc_init,
1819         [
1820                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1821         ],
1822         [
1823                 with_libiptc="yes"
1824                 with_own_libiptc="yes"
1825         ])
1826 fi
1827 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1828 then
1829         AC_CHECK_HEADERS(libiptc/libiptc.h,
1830         [
1831                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1832         ],
1833         [
1834                 with_libiptc="yes"
1835                 with_own_libiptc="yes"
1836         ])
1837 fi
1838 if test "x$with_libiptc" = "xyes"
1839 then
1840         SAVE_CFLAGS=$CFLAGS
1841         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1842
1843         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1844         [
1845                 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1846                 with_own_libiptc="no"
1847         ],
1848         [
1849 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1850         ])
1851
1852         CFLAGS=$SAVE_CFLAGS
1853 fi
1854 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1855 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1856 if test "x$with_own_libiptc" = "xyes"
1857 then
1858         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1859 fi
1860
1861 with_snmp_config="net-snmp-config"
1862 with_snmp_cflags=""
1863 with_snmp_libs=""
1864 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1865 [
1866         if test "x$withval" = "xno"
1867         then
1868                 with_libnetsnmp="no"
1869         else if test "x$withval" = "xyes"
1870         then
1871                 with_libnetsnmp="yes"
1872         else
1873                 if test -x "$withval"
1874                 then
1875                         with_snmp_config="$withval"
1876                         with_libnetsnmp="yes"
1877                 else
1878                         with_snmp_config="$withval/bin/net-snmp-config"
1879                         with_libnetsnmp="yes"
1880                 fi
1881         fi; fi
1882 ],
1883 [with_libnetsnmp="yes"])
1884 if test "x$with_libnetsnmp" = "xyes"
1885 then
1886         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1887         snmp_config_status=$?
1888
1889         if test $snmp_config_status -ne 0
1890         then
1891                 with_libnetsnmp="no ($with_snmp_config failed)"
1892         else
1893                 SAVE_CPPFLAGS="$CPPFLAGS"
1894                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1895                 
1896                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1897
1898                 CPPFLAGS="$SAVE_CPPFLAGS"
1899         fi
1900 fi
1901 if test "x$with_libnetsnmp" = "xyes"
1902 then
1903         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1904         snmp_config_status=$?
1905
1906         if test $snmp_config_status -ne 0
1907         then
1908                 with_libnetsnmp="no ($with_snmp_config failed)"
1909         else
1910                 AC_CHECK_LIB(netsnmp, init_snmp,
1911                 [with_libnetsnmp="yes"],
1912                 [with_libnetsnmp="no (libnetsnmp not found)"],
1913                 [$with_snmp_libs])
1914         fi
1915 fi
1916 if test "x$with_libnetsnmp" = "xyes"
1917 then
1918         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1919         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1920         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1921         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1922 fi
1923 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1924
1925 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1926                 [with_libnotify="yes"],
1927                 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1928
1929 with_libupsclient_config=""
1930 with_libupsclient_cflags=""
1931 with_libupsclient_libs=""
1932 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1933 [
1934         if test "x$withval" = "xno"
1935         then
1936                 with_libupsclient="no"
1937         else if test "x$withval" = "xyes"
1938         then
1939                 with_libupsclient="use_pkgconfig"
1940         else
1941                 if test -x "$withval"
1942                 then
1943                         with_libupsclient_config="$withval"
1944                         with_libupsclient="use_libupsclient_config"
1945                 else if test -x "$withval/bin/libupsclient-config"
1946                 then
1947                         with_libupsclient_config="$withval/bin/net-snmp-config"
1948                         with_libupsclient="use_libupsclient_config"
1949                 else
1950                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
1951                         with_libupsclient_cflags="-I$withval/include"
1952                         with_libupsclient_libs="-L$withval/lib -lupsclient"
1953                         with_libupsclient="yes"
1954                 fi; fi
1955         fi; fi
1956 ],
1957 [with_libupsclient="use_pkgconfig"])
1958
1959 # configure using libupsclient-config
1960 if test "x$with_libupsclient" = "xuse_libupsclient_config"
1961 then
1962         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
1963         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
1964         if test $? -ne 0
1965         then
1966                 with_libupsclient="no ($with_libupsclient_config failed)"
1967         fi
1968         with_libupsclient_libs="`$with_libupsclient_config --libs`"
1969         if test $? -ne 0
1970         then
1971                 with_libupsclient="no ($with_libupsclient_config failed)"
1972         fi
1973 fi
1974 if test "x$with_libupsclient" = "xuse_libupsclient_config"
1975 then
1976         with_libupsclient="yes"
1977 fi
1978
1979 # configure using pkg-config
1980 if test "x$with_libupsclient" = "xuse_pkgconfig"
1981 then
1982         if test "x$PKG_CONFIG" = "x"
1983         then
1984                 with_libupsclient="no (Don't have pkg-config)"
1985         fi
1986 fi
1987 if test "x$with_libupsclient" = "xuse_pkgconfig"
1988 then
1989         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
1990         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
1991         if test $? -ne 0
1992         then
1993                 with_libupsclient="no (pkg-config doesn't know library)"
1994         fi
1995 fi
1996 if test "x$with_libupsclient" = "xuse_pkgconfig"
1997 then
1998         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
1999         if test $? -ne 0
2000         then
2001                 with_libupsclient="no ($PKG_CONFIG failed)"
2002         fi
2003         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2004         if test $? -ne 0
2005         then
2006                 with_libupsclient="no ($PKG_CONFIG failed)"
2007         fi
2008 fi
2009 if test "x$with_libupsclient" = "xuse_pkgconfig"
2010 then
2011         with_libupsclient="yes"
2012 fi
2013
2014 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2015 # the actual checks.
2016 if test "x$with_libupsclient" = "xyes"
2017 then
2018         SAVE_CPPFLAGS="$CPPFLAGS"
2019         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2020
2021         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2022
2023         CPPFLAGS="$SAVE_CPPFLAGS"
2024 fi
2025 if test "x$with_libupsclient" = "xyes"
2026 then
2027         SAVE_CPPFLAGS="$CPPFLAGS"
2028         SAVE_LDFLAGS="$LDFLAGS"
2029
2030         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2031         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2032
2033         AC_CHECK_LIB(upsclient, upscli_connect,
2034                      [with_libupsclient="yes"],
2035                      [with_libupsclient="no (symbol upscli_connect not found)"])
2036
2037         CPPFLAGS="$SAVE_CPPFLAGS"
2038         LDFLAGS="$SAVE_LDFLAGS"
2039 fi
2040 if test "x$with_libupsclient" = "xyes"
2041 then
2042         SAVE_CPPFLAGS="$CPPFLAGS"
2043         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2044
2045         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2046 [#include <stdlib.h>
2047 #include <stdio.h>
2048 #include <upsclient.h>])
2049
2050         CPPFLAGS="$SAVE_CPPFLAGS"
2051 fi
2052 if test "x$with_libupsclient" = "xyes"
2053 then
2054         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2055         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2056         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2057         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2058 fi
2059
2060 ### BEGIN of check for libxmms ###
2061 with_xmms_config="xmms-config"
2062 with_xmms_cflags=""
2063 with_xmms_libs=""
2064 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2065 [
2066         if test "x$withval" != "xno" \
2067                 && test "x$withval" != "xyes"
2068         then
2069                 if test -f "$withval" && test -x "$withval";
2070                 then
2071                         with_xmms_config="$withval"
2072                 else if test -x "$withval/bin/xmms-config"
2073                 then
2074                         with_xmms_config="$withval/bin/xmms-config"
2075                 fi; fi
2076                 with_libxmms="yes"
2077         else if test "x$withval" = "xno"
2078         then
2079                 with_libxmms="no"
2080         else
2081                 with_libxmms="yes"
2082         fi; fi
2083 ],
2084 [
2085         with_libxmms="yes"
2086 ])
2087 if test "x$with_libxmms" = "xyes"
2088 then
2089         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2090         xmms_config_status=$?
2091
2092         if test $xmms_config_status -ne 0
2093         then
2094                 with_libxmms="no"
2095         fi
2096 fi
2097 if test "x$with_libxmms" = "xyes"
2098 then
2099         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2100         xmms_config_status=$?
2101
2102         if test $xmms_config_status -ne 0
2103         then
2104                 with_libxmms="no"
2105         fi
2106 fi
2107 if test "x$with_libxmms" = "xyes"
2108 then
2109         AC_CHECK_LIB(xmms, xmms_remote_get_info,
2110         [
2111                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2112                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2113                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2114                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2115         ],
2116         [
2117                 with_libxmms="no"
2118         ],
2119         [$with_xmms_libs])
2120 fi
2121 with_libxmms_numeric=0
2122 if test "x$with_libxmms" = "xyes"
2123 then
2124         with_libxmms_numeric=1
2125 fi
2126 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2127 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2128 ### END of check for libxmms ###
2129
2130 with_libnetlink_cflags=""
2131 with_libnetlink_libs="-lnetlink"
2132 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2133 [
2134  echo "libnetlink: withval = $withval"
2135  if test "x$withval" = "xyes"
2136  then
2137          with_libnetlink="yes"
2138  else if test "x$withval" = "xno"
2139  then
2140          with_libnetlink="no"
2141  else
2142          if test -d "$withval/include"
2143          then
2144                  with_libnetlink_cflags="-I$withval/include"
2145                  with_libnetlink_libs="-L$withval/lib -lnetlink"
2146                  with_libnetlink="yes"
2147          else
2148                  AC_MSG_ERROR("no such directory: $withval/include")
2149          fi
2150  fi; fi
2151 ],
2152 [
2153  if test "x$ac_system" = "xLinux"
2154  then
2155          with_libnetlink="yes"
2156  else
2157          with_libnetlink="no (Linux only library)"
2158  fi
2159 ])
2160 if test "x$with_libnetlink" = "xyes"
2161 then
2162         SAVE_CFLAGS=$CFLAGS
2163         CFLAGS="$CFLAGS $with_libnetlink_cflags"
2164
2165         with_libnetlink="no (libnetlink.h not found)"
2166
2167         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2168         [
2169          with_libnetlink="yes"
2170          break
2171         ], [],
2172 [#include <stdio.h>
2173 #include <sys/types.h>
2174 #include <asm/types.h>
2175 #include <sys/socket.h>
2176 #include <linux/netlink.h>
2177 #include <linux/rtnetlink.h>])
2178         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2179 [#include <stdio.h>
2180 #include <sys/types.h>
2181 #include <asm/types.h>
2182 #include <sys/socket.h>])
2183
2184         AC_COMPILE_IFELSE(
2185 [#include <stdio.h>
2186 #include <sys/types.h>
2187 #include <asm/types.h>
2188 #include <sys/socket.h>
2189 #include <linux/netlink.h>
2190 #include <linux/rtnetlink.h>
2191
2192 int main (void)
2193 {
2194         int retval = TCA_STATS2;
2195         return (retval);
2196 }],
2197         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2198         []);
2199
2200         AC_COMPILE_IFELSE(
2201 [#include <stdio.h>
2202 #include <sys/types.h>
2203 #include <asm/types.h>
2204 #include <sys/socket.h>
2205 #include <linux/netlink.h>
2206 #include <linux/rtnetlink.h>
2207
2208 int main (void)
2209 {
2210         int retval = TCA_STATS;
2211         return (retval);
2212 }],
2213         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2214         []);
2215
2216         CFLAGS="$SAVE_CFLAGS"
2217 fi
2218 if test "x$with_libnetlink" = "xyes"
2219 then
2220         AC_CHECK_LIB(netlink, rtnl_open,
2221                      [with_libnetlink="yes"],
2222                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2223                      [$with_libnetlink_libs])
2224 fi
2225 if test "x$with_libnetlink" = "xyes"
2226 then
2227         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2228         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2229         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2230         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2231 fi
2232 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2233
2234 with_libopenipmipthread="yes"
2235 with_libopenipmipthread_cflags=""
2236 with_libopenipmipthread_libs=""
2237
2238 AC_MSG_CHECKING([for pkg-config])
2239 temp_result="no"
2240 if test "x$PKG_CONFIG" = "x"
2241 then
2242         with_libopenipmipthread="no"
2243         temp_result="no"
2244 else
2245         temp_result="$PKG_CONFIG"
2246 fi
2247 AC_MSG_RESULT([$temp_result])
2248
2249 if test "x$with_libopenipmipthread" = "xyes"
2250 then
2251         AC_MSG_CHECKING([for libOpenIPMIpthread])
2252         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2253         if test "$?" != "0"
2254         then
2255                 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2256         fi
2257         AC_MSG_RESULT([$with_libopenipmipthread])
2258 fi
2259
2260 if test "x$with_libopenipmipthread" = "xyes"
2261 then
2262         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2263         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2264         if test "$?" = "0"
2265         then
2266                 with_libopenipmipthread_cflags="$temp_result"
2267         else
2268                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2269                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2270         fi
2271         AC_MSG_RESULT([$temp_result])
2272 fi
2273
2274 if test "x$with_libopenipmipthread" = "xyes"
2275 then
2276         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2277         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2278         if test "$?" = "0"
2279         then
2280                 with_libopenipmipthread_ldflags="$temp_result"
2281         else
2282                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2283                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2284         fi
2285         AC_MSG_RESULT([$temp_result])
2286 fi
2287
2288 if test "x$with_libopenipmipthread" = "xyes"
2289 then
2290         SAVE_CPPFLAGS="$CPPFLAGS"
2291         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2292
2293         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2294                          [with_libopenipmipthread="yes"],
2295                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2296 [#include <OpenIPMI/ipmiif.h>
2297 #include <OpenIPMI/ipmi_err.h>
2298 #include <OpenIPMI/ipmi_posix.h>
2299 #include <OpenIPMI/ipmi_conn.h>
2300 ])
2301
2302         CPPFLAGS="$SAVE_CPPFLAGS"
2303 fi
2304
2305 if test "x$with_libopenipmipthread" = "xyes"
2306 then
2307         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2308         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2309         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2310         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2311 fi
2312
2313 dnl Check for libpq.
2314 with_pg_config="pg_config"
2315 with_libpq_includedir=""
2316 with_libpq_libdir=""
2317 with_libpq_cppflags=""
2318 with_libpq_ldflags=""
2319 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2320         [Path to libpq.])],
2321 [
2322         if test "x$withval" = "xno"
2323         then
2324                 with_libpq="no"
2325         else if test "x$withval" = "xyes"
2326         then
2327                 with_libpq="yes"
2328         else
2329                 if test -f "$withval" && test -x "$withval";
2330                 then
2331                         with_pg_config="$withval"
2332                 else if test -x "$withval/bin/pg_config"
2333                 then
2334                         with_pg_config="$withval/bin/pg_config"
2335                 fi; fi
2336                 with_libpq="yes"
2337         fi; fi
2338 ],
2339 [
2340         with_libpq="yes"
2341 ])
2342 if test "x$with_libpq" = "xyes"
2343 then
2344         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2345         pg_config_status=$?
2346
2347         if test $pg_config_status -eq 0
2348         then
2349                 if test -n "$with_libpq_includedir"; then
2350                         for dir in $with_libpq_includedir; do
2351                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2352                         done
2353                 fi
2354         else
2355                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2356         fi
2357
2358         SAVE_CPPFLAGS="$CPPFLAGS"
2359         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2360
2361         AC_CHECK_HEADERS(libpq-fe.h, [],
2362                 [with_libpq="no (libpq-fe.h not found)"], [])
2363
2364         CPPFLAGS="$SAVE_CPPFLAGS"
2365 fi
2366 if test "x$with_libpq" = "xyes"
2367 then
2368         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2369         pg_config_status=$?
2370
2371         if test $pg_config_status -eq 0
2372         then
2373                 if test -n "$with_libpq_libdir"; then
2374                         for dir in $with_libpq_libdir; do
2375                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2376                         done
2377                 fi
2378         else
2379                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2380         fi
2381
2382         SAVE_LDFLAGS="$LDFLAGS"
2383         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2384
2385         AC_CHECK_LIB(pq, PQconnectdb,
2386                 [with_libpq="yes"],
2387                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2388
2389         LDFLAGS="$SAVE_LDFLAGS"
2390 fi
2391 if test "x$with_libpq" = "xyes"
2392 then
2393         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2394         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2395         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2396         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2397 fi
2398 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2399
2400 dnl Check for libvirt and libxml2 libraries.
2401 with_libxml2="no (pkg-config isn't available)"
2402 with_libxml2_cflags=""
2403 with_libxml2_ldflags=""
2404 with_libvirt="no (pkg-config isn't available)"
2405 with_libvirt_cflags=""
2406 with_libvirt_ldflags=""
2407 if test "x$PKG_CONFIG" != "x"
2408 then
2409         pkg-config --exists 'libxml-2.0' 2>/dev/null
2410         if test "$?" = "0"
2411         then
2412                 with_libxml2="yes"
2413         else
2414                 with_libxml2="no (pkg-config doesn't know library)"
2415         fi
2416
2417         pkg-config --exists libvirt 2>/dev/null
2418         if test "$?" = "0"
2419         then
2420                 with_libvirt="yes"
2421         else
2422                 with_libvirt="no (pkg-config doesn't know library)"
2423         fi
2424 fi
2425 if test "x$with_libxml2" = "xyes"
2426 then
2427         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2428         if test $? -ne 0
2429         then
2430                 with_libxml2="no"
2431         fi
2432         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2433         if test $? -ne 0
2434         then
2435                 with_libxml2="no"
2436         fi
2437 fi
2438 if test "x$with_libxml2" = "xyes"
2439 then
2440         SAVE_CPPFLAGS="$CPPFLAGS"
2441         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2442
2443         AC_CHECK_HEADERS(libxml/parser.h, [],
2444                       [with_libxml2="no (libxml/parser.h not found)"])
2445
2446         CPPFLAGS="$SAVE_CPPFLAGS"
2447 fi
2448 if test "x$with_libxml2" = "xyes"
2449 then
2450         SAVE_CFLAGS="$CFLAGS"
2451         SAVE_LDFLAGS="$LDFLAGS"
2452
2453         CFLAGS="$CFLAGS $with_libxml2_cflags"
2454         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2455
2456         AC_CHECK_LIB(xml2, xmlXPathEval,
2457                      [with_libxml2="yes"],
2458                      [with_libxml2="no (symbol xmlXPathEval not found)"])
2459
2460         CFLAGS="$SAVE_CFLAGS"
2461         LDFLAGS="$SAVE_LDFLAGS"
2462 fi
2463 dnl Add the right compiler flags and libraries.
2464 if test "x$with_libxml2" = "xyes"; then
2465         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2466         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2467         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2468         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2469 fi
2470 if test "x$with_libvirt" = "xyes"
2471 then
2472         with_libvirt_cflags="`pkg-config --cflags libvirt`"
2473         if test $? -ne 0
2474         then
2475                 with_libvirt="no"
2476         fi
2477         with_libvirt_ldflags="`pkg-config --libs libvirt`"
2478         if test $? -ne 0
2479         then
2480                 with_libvirt="no"
2481         fi
2482 fi
2483 if test "x$with_libvirt" = "xyes"
2484 then
2485         SAVE_CPPFLAGS="$CPPFLAGS"
2486         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2487
2488         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2489                       [with_libvirt="no (libvirt/libvirt.h not found)"])
2490
2491         CPPFLAGS="$SAVE_CPPFLAGS"
2492 fi
2493 if test "x$with_libvirt" = "xyes"
2494 then
2495         SAVE_CFLAGS="$CFLAGS"
2496         SAVE_LDFLAGS="$LDFLAGS"
2497
2498         CFLAGS="$CFLAGS $with_libvirt_cflags"
2499         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2500
2501         AC_CHECK_LIB(virt, virDomainBlockStats,
2502                      [with_libvirt="yes"],
2503                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
2504
2505         CFLAGS="$SAVE_CFLAGS"
2506         LDFLAGS="$SAVE_LDFLAGS"
2507 fi
2508 dnl Add the right compiler flags and libraries.
2509 if test "x$with_libvirt" = "xyes"; then
2510         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2511         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2512         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2513         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2514 fi
2515
2516 dnl End of check for libvirt and libxml2 libraries.
2517
2518 # Check for enabled/disabled features
2519 #
2520
2521 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2522 # ------------------------------------------------------------
2523 dnl
2524 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2525 dnl
2526 AC_DEFUN(
2527         [AC_COLLECTD],
2528         [
2529         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2530         m4_if(
2531                 [$2],
2532                 [enable],
2533                 [dnl
2534                 m4_define([EnDis],[disabled])dnl
2535                 m4_define([YesNo],[no])dnl
2536                 ],dnl
2537                 [m4_if(
2538                         [$2],
2539                         [disable],
2540                         [dnl
2541                         m4_define([EnDis],[enabled])dnl
2542                         m4_define([YesNo],[yes])dnl
2543                         ],
2544                         [dnl
2545                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2546                         ]dnl
2547                 )]dnl
2548         )dnl
2549         m4_if([$3], [feature], [],
2550                 [m4_if(
2551                         [$3], [module], [],
2552                         [dnl
2553                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2554                         ]dnl
2555                 )]dnl
2556         )dnl
2557         AC_ARG_ENABLE(
2558                 [$1],
2559                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2560                 [],
2561                 enable_$1='[YesNo]'dnl
2562         )# AC_ARG_ENABLE
2563 if test "x$enable_$1" = "xno"
2564 then
2565         collectd_$1=0
2566 else
2567         if test "x$enable_$1" = "xyes"
2568         then
2569                 collectd_$1=1
2570         else
2571                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2572                 collectd_$1=1
2573                 enable_$1='yes'
2574         fi
2575 fi
2576         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2577         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2578         ]dnl
2579 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2580
2581 # AC_PLUGIN(name, default, info)
2582 # ------------------------------------------------------------
2583 dnl
2584 AC_DEFUN(
2585   [AC_PLUGIN],
2586   [
2587     enable_plugin="no"
2588     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2589     [
2590      if test "x$enableval" = "xyes"
2591      then
2592              enable_plugin="yes"
2593      else
2594              enable_plugin="no"
2595      fi
2596     ],
2597     [
2598      if test "x$2" = "xyes"
2599      then
2600              enable_plugin="yes"
2601      else
2602              enable_plugin="no"
2603      fi
2604     ])
2605     if test "x$enable_plugin" = "xyes"
2606     then
2607             if test "x$2" = "xyes"
2608             then
2609                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2610             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2611                     dependency_error="yes"
2612                     enable_plugin="no (dependency error)"
2613             fi
2614     fi
2615     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2616     enable_$1="$enable_plugin"
2617   ]
2618 )# AC_PLUGIN(name, default, info)
2619
2620 m4_divert_once([HELP_ENABLE], [
2621 collectd features:])
2622 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2623 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
2624 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
2625 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
2626
2627 dependency_error="no"
2628 plugin_ascent="no"
2629 plugin_battery="no"
2630 plugin_cpu="no"
2631 plugin_cpufreq="no"
2632 plugin_df="no"
2633 plugin_disk="no"
2634 plugin_entropy="no"
2635 plugin_interface="no"
2636 plugin_ipmi="no"
2637 plugin_ipvs="no"
2638 plugin_irq="no"
2639 plugin_libvirt="no"
2640 plugin_load="no"
2641 plugin_memory="no"
2642 plugin_multimeter="no"
2643 plugin_nfs="no"
2644 plugin_perl="no"
2645 plugin_processes="no"
2646 plugin_serial="no"
2647 plugin_swap="no"
2648 plugin_tape="no"
2649 plugin_tcpconns="no"
2650 plugin_thermal="no"
2651 plugin_users="no"
2652 plugin_vmem="no"
2653 plugin_vserver="no"
2654 plugin_wireless="no"
2655
2656 # Linux
2657 if test "x$ac_system" = "xLinux"
2658 then
2659         plugin_battery="yes"
2660         plugin_cpu="yes"
2661         plugin_cpufreq="yes"
2662         plugin_disk="yes"
2663         plugin_entropy="yes"
2664         plugin_interface="yes"
2665         plugin_irq="yes"
2666         plugin_load="yes"
2667         plugin_memory="yes"
2668         plugin_nfs="yes"
2669         plugin_processes="yes"
2670         plugin_serial="yes"
2671         plugin_swap="yes"
2672         plugin_tcpconns="yes"
2673         plugin_thermal="yes"
2674         plugin_vmem="yes"
2675         plugin_vserver="yes"
2676         plugin_wireless="yes"
2677
2678         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2679         then
2680                 plugin_ipvs="yes"
2681         fi
2682 fi
2683
2684 if test "x$ac_system" = "xOpenBSD"
2685 then
2686         plugin_tcpconns="yes"
2687 fi
2688
2689 # Mac OS X devices
2690 if test "x$with_libiokit" = "xyes"
2691 then
2692         plugin_battery="yes"
2693         plugin_disk="yes"
2694 fi
2695
2696 # Solaris
2697 if test "x$with_devinfo$with_kstat" = "xyesyes"
2698 then
2699         plugin_cpu="yes"
2700         plugin_disk="yes"
2701         plugin_interface="yes"
2702         plugin_memory="yes"
2703         plugin_tape="yes"
2704 fi
2705
2706 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
2707 then
2708         plugin_swap="yes"
2709 fi
2710
2711 # libstatgrab
2712 if test "x$with_libstatgrab" = "xyes"
2713 then
2714         plugin_cpu="yes"
2715         plugin_disk="yes"
2716         plugin_interface="yes"
2717         plugin_load="yes"
2718         plugin_memory="yes"
2719         plugin_swap="yes"
2720         plugin_users="yes"
2721 fi
2722
2723 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2724 then
2725         plugin_ascent="yes"
2726 fi
2727
2728 if test "x$with_libopenipmipthread" = "xyes"
2729 then
2730         plugin_ipmi="yes"
2731 fi
2732
2733 if test "x$have_processor_info" = "xyes"
2734 then
2735         plugin_cpu="yes"
2736 fi
2737 if test "x$have_sysctlbyname" = "xyes"
2738 then
2739         plugin_cpu="yes"
2740         plugin_memory="yes"
2741         plugin_tcpconns="yes"
2742 fi
2743
2744 if test "x$have_statfs" = "xyes"
2745 then
2746         plugin_df="yes"
2747 fi
2748 if test "x$have_statvfs" = "xyes"
2749 then
2750         plugin_df="yes"
2751 fi
2752
2753 if test "x$have_getifaddrs" = "xyes"
2754 then
2755         plugin_interface="yes"
2756 fi
2757
2758 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2759 then
2760         plugin_libvirt="yes"
2761 fi
2762
2763 if test "x$have_getloadavg" = "xyes"
2764 then
2765         plugin_load="yes"
2766 fi
2767
2768 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
2769 then
2770         plugin_perl="yes"
2771 fi
2772
2773 # Mac OS X memory interface
2774 if test "x$have_host_statistics" = "xyes"
2775 then
2776         plugin_memory="yes"
2777 fi
2778
2779 if test "x$have_termios_h" = "xyes"
2780 then
2781         plugin_multimeter="yes"
2782 fi
2783
2784 if test "x$have_thread_info" = "xyes"
2785 then
2786         plugin_processes="yes"
2787 fi
2788
2789 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
2790 then
2791         plugin_processes="yes"
2792 fi
2793
2794 if test "x$with_kvm_getswapinfo" = "xyes"
2795 then
2796         plugin_swap="yes"
2797 fi
2798
2799 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
2800 then
2801         plugin_tcpconns="yes"
2802 fi
2803
2804 if test "x$have_getutent" = "xyes"
2805 then
2806         plugin_users="yes"
2807 fi
2808 if test "x$have_getutxent" = "xyes"
2809 then
2810         plugin_users="yes"
2811 fi
2812
2813 # FIXME: sysctl for swap plugin
2814
2815 m4_divert_once([HELP_ENABLE], [
2816 collectd plugins:])
2817
2818 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
2819 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
2820 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
2821 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
2822 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
2823 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
2824 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
2825 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
2826 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2827 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
2828 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
2829 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
2830 AC_PLUGIN([email],       [yes],                [EMail statistics])
2831 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
2832 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
2833 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
2834 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
2835 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
2836 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
2837 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
2838 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
2839 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
2840 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
2841 AC_PLUGIN([load],        [$plugin_load],       [System load])
2842 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
2843 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
2844 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
2845 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
2846 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
2847 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
2848 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
2849 AC_PLUGIN([network],     [yes],                [Network communication plugin])
2850 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
2851 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
2852 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
2853 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
2854 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
2855 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
2856 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
2857 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
2858 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
2859 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
2860 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
2861 AC_PLUGIN([rrdtool],     [$with_rrdtool],      [RRDTool output plugin])
2862 AC_PLUGIN([sensors],     [$with_lm_sensors],   [lm_sensors statistics])
2863 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
2864 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
2865 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
2866 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
2867 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
2868 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
2869 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
2870 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
2871 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
2872 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
2873 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
2874 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
2875 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
2876 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
2877 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
2878 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
2879
2880 dnl ip_vs.h
2881 if test "x$ac_system" = "xLinux" \
2882         && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2883 then
2884         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2885 fi
2886
2887 dnl Perl bindings
2888 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2889 [
2890         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2891         then
2892                 PERL_BINDINGS_OPTIONS="$withval"
2893                 with_perl_bindings="yes"
2894         else
2895                 PERL_BINDINGS_OPTIONS=""
2896                 with_perl_bindings="$withval"
2897         fi
2898 ],
2899 [
2900         PERL_BINDINGS_OPTIONS=""
2901         if test -n "$perl_interpreter"
2902         then
2903                 with_perl_bindings="yes"
2904         else
2905                 with_perl_bindings="no (no perl interpreter found)"
2906         fi
2907 ])
2908 if test "x$with_perl_bindings" = "xyes"
2909 then
2910         PERL_BINDINGS="perl"
2911 else
2912         PERL_BINDINGS=""
2913 fi
2914 AC_SUBST(PERL_BINDINGS)
2915 AC_SUBST(PERL_BINDINGS_OPTIONS)
2916
2917 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2918
2919 if test "x$with_rrdtool" = "xyes" \
2920         && test "x$librrd_threadsafe" != "xyes"
2921 then
2922         with_rrdtool="yes (warning: librrd is not thread-safe)"
2923 fi
2924
2925 if test "x$with_liboping" = "xyes" \
2926         && test "x$with_own_liboping" = "xyes"
2927 then
2928         with_liboping="yes (shipped version)"
2929 fi
2930
2931 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2932 then
2933         with_libiptc="yes (shipped version)"
2934 fi
2935
2936 if test "x$with_libperl" = "xyes"
2937 then
2938         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2939 else
2940         enable_perl="no (needs libperl)"
2941 fi
2942
2943 if test "x$with_perl_bindings" = "xyes" \
2944         && test "x$PERL_BINDINGS_OPTIONS" != "x"
2945 then
2946         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2947 fi
2948
2949 cat <<EOF;
2950
2951 Configuration:
2952   Libraries:
2953     libcurl . . . . . . . $with_libcurl
2954     libesmtp  . . . . . . $with_libesmtp
2955     libiokit  . . . . . . $with_libiokit
2956     libiptc . . . . . . . $with_libiptc
2957     libkstat  . . . . . . $with_kstat
2958     libkvm  . . . . . . . $with_libkvm
2959     libmysql  . . . . . . $with_libmysql
2960     libnetlink  . . . . . $with_libnetlink
2961     libnetsnmp  . . . . . $with_libnetsnmp
2962     libnotify . . . . . . $with_libnotify
2963     liboconfig  . . . . . $with_liboconfig
2964     libopenipmi . . . . . $with_libopenipmipthread
2965     liboping  . . . . . . $with_liboping
2966     libpcap . . . . . . . $with_libpcap
2967     libperl . . . . . . . $with_libperl
2968     libpthread  . . . . . $with_libpthread
2969     libpq . . . . . . . . $with_libpq
2970     librrd  . . . . . . . $with_rrdtool
2971     libsensors  . . . . . $with_lm_sensors
2972     libstatgrab . . . . . $with_libstatgrab
2973     libupsclient  . . . . $with_libupsclient
2974     libvirt . . . . . . . $with_libvirt
2975     libxml2 . . . . . . . $with_libxml2
2976     libxmms . . . . . . . $with_libxmms
2977
2978   Features:
2979     daemon mode . . . . . $enable_daemon
2980     debug . . . . . . . . $enable_debug
2981
2982   Bindings:
2983     perl  . . . . . . . . $with_perl_bindings
2984
2985   Modules:
2986     apache  . . . . . . . $enable_apache
2987     apcups  . . . . . . . $enable_apcups
2988     apple_sensors . . . . $enable_apple_sensors
2989     ascent  . . . . . . . $enable_ascent
2990     battery . . . . . . . $enable_battery
2991     cpu . . . . . . . . . $enable_cpu
2992     cpufreq . . . . . . . $enable_cpufreq
2993     csv . . . . . . . . . $enable_csv
2994     df  . . . . . . . . . $enable_df
2995     disk  . . . . . . . . $enable_disk
2996     dns . . . . . . . . . $enable_dns
2997     email . . . . . . . . $enable_email
2998     entropy . . . . . . . $enable_entropy
2999     exec  . . . . . . . . $enable_exec
3000     filecount . . . . . . $enable_filecount
3001     hddtemp . . . . . . . $enable_hddtemp
3002     interface . . . . . . $enable_interface
3003     iptables  . . . . . . $enable_iptables
3004     ipmi  . . . . . . . . $enable_ipmi
3005     ipvs  . . . . . . . . $enable_ipvs
3006     irq . . . . . . . . . $enable_irq
3007     libvirt . . . . . . . $enable_libvirt
3008     load  . . . . . . . . $enable_load
3009     logfile . . . . . . . $enable_logfile
3010     mbmon . . . . . . . . $enable_mbmon
3011     memcached . . . . . . $enable_memcached
3012     memory  . . . . . . . $enable_memory
3013     multimeter  . . . . . $enable_multimeter
3014     mysql . . . . . . . . $enable_mysql
3015     netlink . . . . . . . $enable_netlink
3016     network . . . . . . . $enable_network
3017     nfs . . . . . . . . . $enable_nfs
3018     nginx . . . . . . . . $enable_nginx
3019     notify_desktop  . . . $enable_notify_desktop
3020     notify_email  . . . . $enable_notify_email
3021     ntpd  . . . . . . . . $enable_ntpd
3022     nut . . . . . . . . . $enable_nut
3023     onewire . . . . . . . $enable_onewire
3024     perl  . . . . . . . . $enable_perl
3025     ping  . . . . . . . . $enable_ping
3026     postgresql  . . . . . $enable_postgresql
3027     powerdns  . . . . . . $enable_powerdns
3028     processes . . . . . . $enable_processes
3029     rrdtool . . . . . . . $enable_rrdtool
3030     sensors . . . . . . . $enable_sensors
3031     serial  . . . . . . . $enable_serial
3032     snmp  . . . . . . . . $enable_snmp
3033     swap  . . . . . . . . $enable_swap
3034     syslog  . . . . . . . $enable_syslog
3035     tail  . . . . . . . . $enable_tail
3036     tape  . . . . . . . . $enable_tape
3037     tcpconns  . . . . . . $enable_tcpconns
3038     teamspeak2  . . . . . $enable_teamspeak2
3039     thermal . . . . . . . $enable_thermal
3040     unixsock  . . . . . . $enable_unixsock
3041     users . . . . . . . . $enable_users
3042     uuid  . . . . . . . . $enable_uuid
3043     vmem  . . . . . . . . $enable_vmem
3044     vserver . . . . . . . $enable_vserver
3045     wireless  . . . . . . $enable_wireless
3046     xmms  . . . . . . . . $enable_xmms
3047
3048 EOF
3049
3050 if test "x$dependency_error" = "xyes"; then
3051         AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3052 fi