Code

New plugin "email" to collectd ham, spam, ... statistics
[collectd.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.10.3)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 #
11 # Checks for programs.
12 #
13 AC_PROG_CC
14 AC_PROG_CPP
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_MAKE_SET
18 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
20 dnl configure libtool
21 AC_DISABLE_STATIC
22 AC_LIBLTDL_CONVENIENCE
23 AC_SUBST(LTDLINCL)
24 AC_SUBST(LIBLTDL)
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 #AC_PROG_RANLIB
28 AC_CONFIG_SUBDIRS(libltdl src/libconfig)
30 #
31 # Checks for header files.
32 #
33 AC_HEADER_STDC
34 AC_HEADER_SYS_WAIT
35 AC_HEADER_DIRENT
36 AC_CHECK_HEADERS(stdint.h)
37 AC_CHECK_HEADERS(stdio.h)
38 AC_CHECK_HEADERS(errno.h)
39 AC_CHECK_HEADERS(math.h)
40 AC_CHECK_HEADERS(syslog.h)
41 AC_CHECK_HEADERS(fcntl.h)
42 AC_CHECK_HEADERS(signal.h)
43 AC_CHECK_HEADERS(assert.h)
44 AC_CHECK_HEADERS(sys/types.h)
45 AC_CHECK_HEADERS(sys/socket.h)
46 AC_CHECK_HEADERS(sys/select.h)
47 AC_CHECK_HEADERS(sys/poll.h)
48 AC_CHECK_HEADERS(netdb.h)
49 AC_CHECK_HEADERS(arpa/inet.h)
50 AC_CHECK_HEADERS(sys/resource.h)
51 AC_CHECK_HEADERS(sys/param.h)
53 # For ping library
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
55 [#if HAVE_STDINT_H
56 # include <stdint.h>
57 #endif
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
63 [#if HAVE_STDINT_H
64 # include <stdint.h>
65 #endif
66 #if HAVE_SYS_TYPES_H
67 # include <sys/types.h>
68 #endif
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
71 #endif
72 ])
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
74 [#if HAVE_STDINT_H
75 # include <stdint.h>
76 #endif
77 #if HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
82 #endif
83 #if HAVE_NETINET_IN_H
84 # include <netinet/in.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
88 [#if HAVE_STDINT_H
89 # include <stdint.h>
90 #endif
91 #if HAVE_SYS_TYPES_H
92 # include <sys/types.h>
93 #endif
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
96 #endif
97 #if HAVE_NETINET_IN_H
98 # include <netinet/in.h>
99 #endif
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
102 #endif
103 ])
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
105 [#if HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108 #if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
110 #endif
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_NETINET_IN_SYSTM_H
129 # include <netinet/in_systm.h>
130 #endif
131 #if HAVE_NETINET_IN_H
132 # include <netinet/in.h>
133 #endif
134 ])
135 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
136 [#if HAVE_STDINT_H
137 # include <stdint.h>
138 #endif
139 #if HAVE_SYS_TYPES_H
140 # include <sys/types.h>
141 #endif
142 #if HAVE_NETINET_IN_SYSTM_H
143 # include <netinet/in_systm.h>
144 #endif
145 #if HAVE_NETINET_IN_H
146 # include <netinet/in.h>
147 #endif
148 #if HAVE_NETINET_IP6_H
149 # include <netinet/ip6.h>
150 #endif
151 ])
153 # For cpu modules
154 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
155 AC_CHECK_HEADERS(mach/mach_init.h)
156 AC_CHECK_HEADERS(mach/host_priv.h)
157 AC_CHECK_HEADERS(mach/mach_error.h)
158 AC_CHECK_HEADERS(mach/mach_host.h)
159 AC_CHECK_HEADERS(mach/mach_port.h)
160 AC_CHECK_HEADERS(mach/mach_types.h)
161 AC_CHECK_HEADERS(mach/message.h)
162 AC_CHECK_HEADERS(mach/processor_set.h)
163 AC_CHECK_HEADERS(mach/processor.h)
164 AC_CHECK_HEADERS(mach/processor_info.h)
165 AC_CHECK_HEADERS(mach/task.h)
166 AC_CHECK_HEADERS(mach/thread_act.h)
167 AC_CHECK_HEADERS(mach/vm_region.h)
168 AC_CHECK_HEADERS(mach/vm_map.h)
169 AC_CHECK_HEADERS(mach/vm_prot.h)
170 AC_CHECK_HEADERS(mach/vm_statistics.h)
171 AC_CHECK_HEADERS(mach/kern_return.h)
173 # For hddtemp module
174 AC_CHECK_HEADERS(linux/major.h)
176 # For the apple_sensors module
177 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
178 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
179 AC_CHECK_HEADERS(IOKit/IOTypes.h)
181 # For the battery plugin
182 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
184 #if HAVE_IOKIT_IOKITLIB_H
185 #  include <IOKit/IOKitLib.h>
186 #endif
187 #if HAVE_IOKIT_IOTYPES_H
188 #  include <IOKit/IOTypes.h>
189 #endif
190 ])
191 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
193 # For the `disk' plugin
194 AC_CHECK_HEADERS(IOKit/IOBSD.h)
195 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
197 # For load module
198 AC_CHECK_HEADERS(sys/loadavg.h)
200 # For the processes plugin
201 AC_CHECK_HEADERS(linux/config.h)
203 # For the swap module
204 AC_CHECK_HEADERS(sys/swap.h)
206 # For users module
207 AC_CHECK_HEADERS(utmp.h)
208 AC_CHECK_HEADERS(utmpx.h)
210 # For traffic plugin
211 AC_CHECK_HEADERS(ifaddrs.h)
212 AC_CHECK_HEADERS(net/if.h, [], [],
214 #if HAVE_SYS_TYPES_H
215 #  include <sys/types.h>
216 #endif
217 #if HAVE_SYS_SOCKET_H
218 #  include <sys/socket.h>
219 #endif
220 ])
221 AC_CHECK_HEADERS(linux/if.h, [], [],
223 #if HAVE_SYS_TYPES_H
224 #  include <sys/types.h>
225 #endif
226 #if HAVE_SYS_SOCKET_H
227 #  include <sys/socket.h>
228 #endif
229 ])
230 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
232 #if HAVE_SYS_TYPES_H
233 #  include <sys/types.h>
234 #endif
235 #if HAVE_SYS_SOCKET_H
236 #  include <sys/socket.h>
237 #endif
238 #if HAVE_LINUX_IF_H
239 # include <linux/if.h>
240 #endif
241 ])
243 # For apache plugin
244 AC_CHECK_HEADERS(curl/curl.h)
246 # For quota module
247 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
248 AC_CHECK_HEADERS(ctype.h)
249 AC_CHECK_HEADERS(limits.h)
250 AC_CHECK_HEADERS(sys/quota.h)
251 AC_CHECK_HEADERS(xfs/xqm.h)
253 # For mount interface
254 AC_CHECK_HEADERS(fs_info.h)
255 AC_CHECK_HEADERS(fshelp.h)
256 AC_CHECK_HEADERS(paths.h)
257 AC_CHECK_HEADERS(mntent.h)
258 AC_CHECK_HEADERS(mnttab.h)
259 AC_CHECK_HEADERS(sys/fstyp.h)
260 AC_CHECK_HEADERS(sys/fs_types.h)
261 AC_CHECK_HEADERS(sys/mntent.h)
262 AC_CHECK_HEADERS(sys/mnttab.h)
263 AC_CHECK_HEADERS(sys/mount.h)
264 AC_CHECK_HEADERS(sys/statfs.h)
265 AC_CHECK_HEADERS(sys/statvfs.h)
266 AC_CHECK_HEADERS(sys/vfs.h)
267 AC_CHECK_HEADERS(sys/vfstab.h)
269 # For the swap plugin, FreeBSD
270 AC_CHECK_HEADERS(kvm.h)
272 # For the email plugin
273 AC_CHECK_HEADERS(linux/un.h, [], [],
275 #if HAVE_SYS_SOCKET_H
276 #       include <sys/socket.h>
277 #endif
278 ])
279 AC_CHECK_HEADERS(sys/un.h)
281 # For debugging interface (variable number of arguments)
282 AC_CHECK_HEADERS(stdarg.h)
284 dnl Checking for libraries
285 AC_CHECK_LIB(m, ext)
288 # Checks for typedefs, structures, and compiler characteristics.
290 AC_C_CONST
291 AC_TYPE_PID_T
292 AC_TYPE_SIZE_T
293 AC_TYPE_UID_T
294 AC_HEADER_TIME
297 # Checks for library functions.
299 AC_PROG_GCC_TRADITIONAL
300 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
301 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
302 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
303 AC_CHECK_FUNCS(strncasecmp strcasecmp)
304 AC_CHECK_FUNCS(openlog syslog closelog)
306 socket_needs_socket="no"
307 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
308 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
310 nanosleep_needs_rt="no"
311 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
312 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
314 # For cpu module
315 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
317 # For df module
318 AC_CHECK_FUNCS(statfs statvfs)
320 # For load module
321 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
323 # For the `processes' plugin
324 AC_CHECK_FUNCS(thread_info)
326 # For users module
327 AC_CHECK_FUNCS(getutent getutxent)
329 # For quota module
330 AC_CHECK_FUNCS(quotactl)
331 AC_CHECK_FUNCS(getgrgid getpwuid)
333 # For traffic module
334 AC_CHECK_FUNCS(getifaddrs)
336 # For mount interface
337 #AC_CHECK_FUNCS(getfsent getvfsent)
339 have_getfsstat="no"
340 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
341 have_getvfsstat="no"
342 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
343 have_listmntent="no"
344 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
346 have_getmntent="no"
347 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
348 if test "x$have_getmntent" = "xno"; then
349         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
350 fi
351 if test "x$have_getmntent" = "xno"; then
352         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
353 fi
354 if test "x$have_getmntent" = "xno"; then
355         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
356 fi
358 if test "x$have_getmntent" = "xc"; then
359         AC_CACHE_CHECK([whether getmntent takes one argument],
360                 [have_one_getmntent],
361                 AC_COMPILE_IFELSE(
362                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
363 #include <mntent.h>
364 #include "$srcdir/src/utils_mount.h"]],
365                                 [[
366                                  FILE *fh;
367                                  struct mntent *me;
368                                  fh = setmntent ("/etc/mtab", "r");
369                                  me = getmntent (fh);
370                                 ]]
371                         ),
372                         [have_one_getmntent="yes"],
373                         [have_one_getmntent="no"]
374                 )
375         )
376         AC_CACHE_CHECK([whether getmntent takes two arguments],
377                 [have_two_getmntent],
378                 AC_COMPILE_IFELSE(
379                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
380 #include <sys/mnttab.h>
381 #include "$srcdir/src/utils_mount.h"]],
382                                 [[
383                                  FILE *fh;
384                                  struct mnttab mt;
385                                  int status;
386                                  fh = fopen ("/etc/mnttab", "r");
387                                  status = getmntent (fh, &mt);
388                                 ]]
389                         ),
390                         [have_two_getmntent="yes"],
391                         [have_two_getmntent="no"]
392                 )
393         )
394 fi
396 # Check for different versions of `getmntent' here..
398 if test "x$have_getmntent" = "xc"; then
399         if test "x$have_one_getmntent" = "xyes"; then
400                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
401                           [Define if the function getmntent exists and takes one argument.])
402         fi
403         if test "x$have_two_getmntent" = "xyes"; then
404                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
405                           [Define if the function getmntent exists and takes two arguments.])
406         fi
407 fi
408 if test "x$have_getmntent" = "xsun"; then
409         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
410                   [Define if the function getmntent exists. It's the version from libsun.])
411 fi
412 if test "x$have_getmntent" = "xseq"; then
413         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
414                   [Define if the function getmntent exists. It's the version from libseq.])
415 fi
416 if test "x$have_getmntent" = "xgen"; then
417         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
418                   [Define if the function getmntent exists. It's the version from libgen.])
419 fi
421 # Check for structures
422 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
423         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
424         [],
425         [
426         #include <sys/types.h>
427         #include <sys/socket.h>
428         #include <net/if.h>
429         ])
430 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
431         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
432         [],
433         [
434         #include <sys/types.h>
435         #include <sys/socket.h>
436         #include <linux/if.h>
437         #include <linux/netdevice.h>
438         ])
440 AC_MSG_CHECKING([for kernel type ($host_os)])
441 case $host_os in
442         *linux*)
443         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
444         ac_system="Linux"
445         ;;
446         *solaris*)
447         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
448         ac_system="Solaris"
449         ;;
450         *)
451         ac_system="unknown"
452 esac
453 AC_MSG_RESULT([$ac_system])
455 with_libresolv="yes"
456 AC_CHECK_LIB(resolv, res_search,
458         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
459 ],
460 [with_libresolv="no"])
461 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
464 m4_divert_once([HELP_WITH], [
465 collectd additional packages:])
467 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
468 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
469 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
470         then
471                 LDFLAGS="$LDFLAGS -L$withval/lib"
472                 CPPFLAGS="$CPPFLAGS -I$withval/include"
473                 with_rrdtool="yes"
474         fi
475 ], [with_rrdtool="yes"])
476 if test "x$with_rrdtool" = "xyes"
477 then
478         AC_CHECK_LIB(rrd, rrd_update,
479         [
480                 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
481         ],
482         [with_rrdtool="no (librrd not found)"], [-lm])
483 fi
484 if test "x$with_rrdtool" = "xyes"
485 then
486         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
487 fi
488 if test "x$with_rrdtool" = "xyes"
489 then
490         collect_rrdtool=1
491 else
492         collect_rrdtool=0
493 fi
494 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
495         [Wether or not to use rrdtool library])
496 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
498 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
499 #[      if test "x$withval" != "xno" && test "x$withval" != "xyes"
500 #       then
501 #               LDFLAGS="$LDFLAGS -L$withval/lib"
502 #               CPPFLAGS="$CPPFLAGS -I$withval/include"
503 #               with_pth="yes"
504 #       fi
505 #], [with_pth="no"])
506 #if test "x$with_pth" = "xyes"
507 #then
508 #       AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
509 #fi
510 #if test "x$with_pth" = "xyes"
511 #then
512 #       AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
513 #fi
514 #if test "x$with_pth" = "xyes"
515 #then
516 #       collect_pth=1
517 #else
518 #       collect_pth=0
519 #fi
520 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
521 #       [Wether or not to use pth (portable threads) library])
522 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
524 if test "$ac_system" = "Solaris"
525 then
526         with_kstat="yes"
527         with_devinfo="yes"
528 else
529         with_kstat="no (Solaris only)"
530         with_devinfo="no (Solaris only)"
531 fi
533 if test "x$with_kstat" = "xyes"
534 then
535         AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
536 fi
537 if test "x$with_kstat" = "xyes"
538 then
539         AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
540         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
541 fi
542 if test "x$with_kstat" = "xyes"
543 then
544         collect_kstat=1
545 else
546         collect_kstat=0
547 fi
548 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
549         [Wether or not to use kstat library (Solaris)])
550 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
551 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
553 ### BEGIN of check for libcurl ###
554 with_curl_config="curl-config"
555 with_curl_prefix=0
556 with_curl_libs=""
557 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
559         if test "x$withval" != "xno" -a "x$withval" != "xyes"
560         then
561                 if test -x "$withval/bin/curl-config"
562                 then
563                         with_curl_config="$withval/bin/curl-config"
564                         with_curl_prefix=1
565                 fi
566         fi
567         if test "x$withval" = "xno"
568         then
569                 with_libcurl="no"
570         else
571                 with_libcurl="yes"
572         fi
573 ],
575         with_libcurl="yes"
576 ])
577 if test "x$with_libcurl" = "xyes"
578 then
579         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
580         curl_config_status=$?
582         if test $curl_config_status -ne 0
583         then
584                 with_libcurl="no"
585         else
586                 AC_CHECK_LIB(curl, curl_easy_init,
587                 [
588                         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
589                         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
590                 ],
591                 [
592                         with_libcurl="no"
593                 ],
594                 [$with_curl_libs])
595         fi
596 fi
597 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
598 then
599         with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
600         curl_config_status=$?
602         if test $curl_config_status -ne 0
603         then
604                 with_libcurl="no"
605         else
606                 if test -d "$with_curl_prefix/include"
607                 then
608                         CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
609                 fi
610         fi
611 fi
613 with_libcurl_numeric=0
614 if test "x$with_libcurl" = "xyes"
615 then
616         with_libcurl_numeric=1
617 fi
618 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
619 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
620 ### END of check for libcurl ###
622 with_libiokit="no"
623 collectd_libiokit=0
624 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
626         with_libiokit="yes"
627         collectd_libiokit=1
628 ], 
630         with_libiokit="no"
631         collectd_libiokit=0
632 ])
633 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
634 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
636 with_libstatgrab="yes"
637 with_libdevstat="no"
638 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
640         if test "x$withval" != "xno" -a "x$withval" != "xyes"
641         then
642                 LDFLAGS="$LDFLAGS -L$withval/lib"
643                 CPPFLAGS="$CPPFLAGS -I$withval/include"
644                 with_libstatgrab="yes"
645         fi
646 ],
648         if test "x$ac_system" == "xunknown"
649         then
650                 with_libstatgrab="yes"
651         else
652                 with_libstatgrab="no"
653         fi
654 ])
655 if test "x$with_libstatgrab" = "xyes"
656 then
657         AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
658 fi
659 if test "x$with_libstatgrab" = "xyes"
660 then
661         AC_CHECK_HEADERS(statgrab.h,,    [with_libstatgrab="no (statgrab.h not found)"])
662 fi
663 if test "x$with_libstatgrab" = "xyes"
664 then
665         AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
666 fi
667 if test "x$with_libstatgrab" = "xyes"
668 then
669         collect_libstatgrab=1
670 else
671         collect_libstatgrab=0
672 fi
673 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
674         [Wether or not to use statgrab library])
675 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
676 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
678 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
679 if test "x$with_libkvm" = "xyes"
680 then
681         AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
682 fi
683 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
685 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
687         if test "x$withval" != "xno" && test "x$withval" != "xyes"
688         then
689                 LDFLAGS="$LDFLAGS -L$withval/lib"
690                 CPPFLAGS="$CPPFLAGS -I$withval/include"
691                 with_lm_sensors="yes"
692         fi
693 ],
695         if test "x$ac_system" = "xLinux"
696         then
697                 with_lm_sensors="yes"
698         else
699                 with_lm_sensors="no"
700         fi
701 ])
702 if test "x$with_lm_sensors" = "xyes"
703 then
704         AC_CHECK_LIB(sensors, sensors_init,
705         [
706                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
707         ],
708         [with_lm_sensors="no (libsensors not found)"])
709 fi
710 if test "x$with_lm_sensors" = "xyes"
711 then
712         AC_CHECK_HEADERS(sensors/sensors.h,
713         [
714                 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
715         ],
716         [with_lm_sensors="no (sensors/sensors.h not found)"])
717 fi
718 if test "x$with_lm_sensors" = "xyes"
719 then
720         collect_lm_sensors=1
721 else
722         collect_lm_sensors=0
723 fi
724 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
725         [Wether or not to use sensors library])
726 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
728 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
730         if test "x$withval" != "xno" && test "x$withval" != "xyes"
731         then
732                 LDFLAGS="$LDFLAGS -L$withval/lib"
733                 CPPFLAGS="$CPPFLAGS -I$withval/include"
734                 with_libmysql="yes"
735         fi
736 ],
738         with_libmysql="yes"
739 ])
740 if test "x$with_libmysql" = "xyes"
741 then
742         AC_CHECK_LIB(mysqlclient, mysql_init,
743         [
744                 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
745         ], [with_libmysql="no (libmysql not found)"])
746 fi
747 if test "x$with_libmysql" = "xyes"
748 then
749         AC_CHECK_HEADERS(mysql/mysql.h,
750         [
751                 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
752         ], [with_libmysql="no (mysql/mysql.h not found)"])
753 fi
754 if test "x$with_libmysql" = "xyes"
755 then
756         collect_libmysql=1
757 else
758         collect_libmysql=0
759 fi
760 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
761         [Wether or not to use mysql library])
762 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
764 #with_liboping="yes"
765 with_own_liboping="no"
766 liboping_LDFLAGS="$LDFLAGS"
767 liboping_CPPFLAGS="$CPPFLAGS"
768 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
770         if test "x$withval" != "xno" && test "x$withval" != "xyes"
771         then
772                 if test -d "$withval/lib"
773                 then
774                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
775                 fi
776                 if test -d "$withval/include"
777                 then
778                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
779                 fi
780         fi
781         if test "x$withval" = "xno"
782         then
783                 with_liboping="no"
784                 with_own_liboping="no"
785         fi
786 ],
788         #753
789         with_liboping="yes"
790 ])
792 if test "x$with_liboping" = "xyes"
793 then
794         save_LDFLAGS="$LDFLAGS"
795         save_CPPFLAGS="$CPPFLAGS"
796         LDFLAGS="$liboping_LDFLAGS"
797         CPPFLAGS="$liboping_CPPFLAGS"
798         AC_CHECK_LIB(oping, ping_construct,
799         [
800                 with_liboping="yes"
801                 with_own_liboping="no"
802         ],
803         [
804                 with_liboping="yes"
805                 with_own_liboping="yes"
806                 LDFLAGS="$save_LDFLAGS"
807                 CPPFLAGS="$save_CPPFLAGS"
808         ])
809 fi
810 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
811 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
812 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
813 then
814         with_liboping="yes (shipped version)"
815 fi
817 # Define `step' and `hearbeat' values..
818 declare -i collectd_step=10
819 declare -i collectd_heartbeat=25
820 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
822         if test "x$withval" != "xno" -a "x$withval" != "xyes"
823         then
824                 declare -i tmp_collectd_step="$withval"
825                 if test $tmp_collectd_step -gt 0
826                 then
827                         collectd_step=$tmp_collectd_step
828                         let "collectd_heartbeat=$collectd_step*2"
829                 fi
830         fi
831 ], [])
832 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
834         if test "x$withval" != "xno" -a "x$withval" != "xyes"
835         then
836                 declare -i tmp_collectd_heartbeat="$withval"
837                 if test $tmp_collectd_heartbeat -gt 0
838                 then
839                         collectd_heartbeat=$tmp_collectd_heartbeat
840                 fi
841         fi
842 ], [])
844 if test $collectd_step -ne 10
845 then
846         AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
847 fi
848 if test $collectd_heartbeat -ne 25
849 then
850         AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
851 fi
853 dnl Check for regex
854 AC_ARG_WITH(regex, [AS_HELP_STRING([--with-regex], [Use POSIX regular expression in config.])],
856         if test "x$withval" != "xno" && test "x$withval" != "xyes"
857         then
858                 with_regex="yes"
859         fi
860 ],
862         with_regex="no"
863 ])
864 if test "x$with_regex" = "xyes"
865 then
866         AC_CHECK_FUNCS([regcomp regexec],
867         [with_regfuncs="yes"],
868         [with_regfuncs="no (regcomp & regexec not found)"])
869 fi
870 if test "x$with_regex" = "xyes"
871 then
872         AC_CHECK_HEADERS(regex.h,
873         [with_regexh="yes"],
874         [with_regexh="no (regex.h not found)"])
875 fi
876 if test "x$with_regex" = "xyes" -a "x$with_regfuncs" = "xyes" -a "x$with_regexh"  = "xyes"
877 then
878         collect_regex=1
879 else
880         collect_regex=0
881 fi
882 AC_DEFINE_UNQUOTED(COLLECT_REGEX, [$collect_regex],
883         [Wether or not to use regular expressions])
884 AM_CONDITIONAL(BUILD_WITH_REGEX, test "x$with_regex" = "xyes")
886 # Check for enabled/disabled features
889 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
890 # ------------------------------------------------------------
891 dnl
892 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
893 dnl
894 AC_DEFUN(
895         [AC_COLLECTD],
896         [
897         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
898         m4_if(
899                 [$2],
900                 [enable],
901                 [dnl
902                 m4_define([EnDis],[disabled])dnl
903                 m4_define([YesNo],[no])dnl
904                 ],dnl
905                 [m4_if(
906                         [$2],
907                         [disable],
908                         [dnl
909                         m4_define([EnDis],[enabled])dnl
910                         m4_define([YesNo],[yes])dnl
911                         ],
912                         [dnl
913                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
914                         ]dnl
915                 )]dnl
916         )dnl
917         m4_if([$3], [feature], [],
918                 [m4_if(
919                         [$3], [module], [],
920                         [dnl
921                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
922                         ]dnl
923                 )]dnl
924         )dnl
925         AC_ARG_ENABLE(
926                 [$1],
927                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
928                 [],
929                 enable_$1='[YesNo]'dnl
930         )# AC_ARG_ENABLE
931 if test "x$enable_$1" = "xno"
932 then
933         collectd_$1=0
934 else
935         if test "x$enable_$1" = "xyes"
936         then
937                 collectd_$1=1
938         else
939                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
940                 collectd_$1=1
941                 enable_$1='yes'
942         fi
943 fi
944         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
945         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
946         ]dnl
947 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
949 m4_divert_once([HELP_ENABLE], [
950 collectd features:])
951 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
952 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
953 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
955 m4_divert_once([HELP_ENABLE], [
956 collectd modules:])
957 AC_COLLECTD([apache],    [disable], [module], [Apache httpd statistics])
958 AC_COLLECTD([apcups],    [disable], [module], [Statistics of UPSes by APC])
959 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
960 AC_COLLECTD([battery],   [disable], [module], [battery statistics])
961 AC_COLLECTD([cpu],       [disable], [module], [cpu usage statistics])
962 AC_COLLECTD([cpufreq],   [disable], [module], [system cpu frequency statistics])
963 AC_COLLECTD([disk],      [disable], [module], [disk/partition statistics])
964 AC_COLLECTD([df],        [disable], [module], [df statistics])
965 AC_COLLECTD([email],     [disable], [module], [email statistics])
966 AC_COLLECTD([quota],     [enable],  [module], [quota statistics (experimental)])
967 AC_COLLECTD([hddtemp],   [disable], [module], [hdd temperature statistics])
968 AC_COLLECTD([load],      [disable], [module], [system load statistics])
969 AC_COLLECTD([memory],    [disable], [module], [memory statistics])
970 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
971 AC_COLLECTD([mysql],     [disable], [module], [mysql statistics])
972 AC_COLLECTD([nfs],       [disable], [module], [nfs statistics])
973 AC_COLLECTD([ntpd],      [disable], [module], [nfs statistics])
974 AC_COLLECTD([ping],      [disable], [module], [ping statistics])
975 AC_COLLECTD([processes], [disable], [module], [processes statistics])
976 AC_COLLECTD([sensors],   [disable], [module], [lm_sensors statistics])
977 AC_COLLECTD([serial],    [disable], [module], [serial statistics])
978 AC_COLLECTD([swap],      [disable], [module], [swap statistics])
979 AC_COLLECTD([tape],      [disable], [module], [tape statistics])
980 AC_COLLECTD([traffic],   [disable], [module], [system traffic statistics])
981 AC_COLLECTD([users],     [disable], [module], [user count statistics])
982 AC_COLLECTD([vserver],   [disable], [module], [vserver statistics])
983 AC_COLLECTD([wireless],  [disable], [module], [wireless link statistics])
985 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
987 cat <<EOF;
989 Configuration:
990   Libraries:
991     libcurl . . . . . . $with_libcurl
992     libiokit  . . . . . $with_libiokit
993     liboping  . . . . . $with_liboping
994     librrd  . . . . . . $with_rrdtool
995     lm_sensors  . . . . $with_lm_sensors
996     libstatgrab . . . . $with_libstatgrab
997     libkstat  . . . . . $with_kstat
998     libmysql  . . . . . $with_libmysql
999     regex . . . . . . . $with_regex
1001   Features:
1002     debug . . . . . . . $enable_debug
1003     daemon mode . . . . $enable_daemon
1004     step  . . . . . . . $collectd_step seconds
1005     heartbeat . . . . . $collectd_heartbeat seconds
1007   Modules:
1008     apache  . . . . . . $enable_apache
1009     apcups  . . . . . . $enable_apcups
1010     apple_sensors . . . $enable_apple_sensors
1011     battery . . . . . . $enable_battery
1012     cpu . . . . . . . . $enable_cpu
1013     cpufreq . . . . . . $enable_cpufreq
1014     df  . . . . . . . . $enable_df
1015     disk  . . . . . . . $enable_disk
1016     email . . . . . . . $enable_email
1017     hddtemp . . . . . . $enable_hddtemp
1018     load  . . . . . . . $enable_load
1019     memory  . . . . . . $enable_memory
1020     multimeter  . . . . $enable_multimeter
1021     mysql . . . . . . . $enable_mysql
1022     nfs . . . . . . . . $enable_nfs
1023     ntpd  . . . . . . . $enable_ntpd
1024     ping  . . . . . . . $enable_ping
1025     processes . . . . . $enable_processes
1026     sensors . . . . . . $enable_sensors
1027     serial  . . . . . . $enable_serial
1028     swap  . . . . . . . $enable_swap
1029     tape  . . . . . . . $enable_tape
1030     traffic . . . . . . $enable_traffic
1031     users . . . . . . . $enable_users
1032     vserver . . . . . . $enable_vserver
1033     wireless  . . . . . $enable_wireless
1035 EOF