Code

Bumped version to 3.10.1; Updated ChangeLog.
[collectd.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.10.1)
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 swap module
201 AC_CHECK_HEADERS(sys/swap.h)
203 # For users module
204 AC_CHECK_HEADERS(utmp.h)
205 AC_CHECK_HEADERS(utmpx.h)
207 # For traffic plugin
208 AC_CHECK_HEADERS(ifaddrs.h)
209 AC_CHECK_HEADERS(net/if.h, [], [],
211 #if HAVE_SYS_TYPES_H
212 #  include <sys/types.h>
213 #endif
214 #if HAVE_SYS_SOCKET_H
215 #  include <sys/socket.h>
216 #endif
217 ])
218 AC_CHECK_HEADERS(linux/if.h, [], [],
220 #if HAVE_SYS_TYPES_H
221 #  include <sys/types.h>
222 #endif
223 #if HAVE_SYS_SOCKET_H
224 #  include <sys/socket.h>
225 #endif
226 ])
227 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
229 #if HAVE_SYS_TYPES_H
230 #  include <sys/types.h>
231 #endif
232 #if HAVE_SYS_SOCKET_H
233 #  include <sys/socket.h>
234 #endif
235 #if HAVE_LINUX_IF_H
236 # include <linux/if.h>
237 #endif
238 ])
240 # For apache plugin
241 AC_CHECK_HEADERS(curl/curl.h)
243 # For quota module
244 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
245 AC_CHECK_HEADERS(ctype.h)
246 AC_CHECK_HEADERS(limits.h)
247 AC_CHECK_HEADERS(sys/quota.h)
248 AC_CHECK_HEADERS(xfs/xqm.h)
250 # For mount interface
251 AC_CHECK_HEADERS(fs_info.h)
252 AC_CHECK_HEADERS(fshelp.h)
253 AC_CHECK_HEADERS(paths.h)
254 AC_CHECK_HEADERS(mntent.h)
255 AC_CHECK_HEADERS(mnttab.h)
256 AC_CHECK_HEADERS(sys/fstyp.h)
257 AC_CHECK_HEADERS(sys/fs_types.h)
258 AC_CHECK_HEADERS(sys/mntent.h)
259 AC_CHECK_HEADERS(sys/mnttab.h)
260 AC_CHECK_HEADERS(sys/mount.h)
261 AC_CHECK_HEADERS(sys/statfs.h)
262 AC_CHECK_HEADERS(sys/statvfs.h)
263 AC_CHECK_HEADERS(sys/vfs.h)
264 AC_CHECK_HEADERS(sys/vfstab.h)
266 # For the swap plugin, FreeBSD
267 AC_CHECK_HEADERS(kvm.h)
269 # For debugging interface (variable number of arguments)
270 AC_CHECK_HEADERS(stdarg.h)
272 dnl Checking for libraries
273 AC_CHECK_LIB(m, ext)
276 # Checks for typedefs, structures, and compiler characteristics.
278 AC_C_CONST
279 AC_TYPE_PID_T
280 AC_TYPE_SIZE_T
281 AC_TYPE_UID_T
282 AC_HEADER_TIME
285 # Checks for library functions.
287 AC_PROG_GCC_TRADITIONAL
288 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
289 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
290 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
291 AC_CHECK_FUNCS(strncasecmp strcasecmp)
292 AC_CHECK_FUNCS(openlog syslog closelog)
294 socket_needs_socket="no"
295 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
296 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
298 nanosleep_needs_rt="no"
299 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
300 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
302 # For cpu module
303 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
305 # For df module
306 AC_CHECK_FUNCS(statfs statvfs)
308 # For load module
309 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
311 # For the `processes' plugin
312 AC_CHECK_FUNCS(thread_info)
314 # For users module
315 AC_CHECK_FUNCS(getutent getutxent)
317 # For quota module
318 AC_CHECK_FUNCS(quotactl)
319 AC_CHECK_FUNCS(getgrgid getpwuid)
321 # For traffic module
322 AC_CHECK_FUNCS(getifaddrs)
324 # For mount interface
325 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
326 AC_CHECK_FUNCS(getfsstat)
328 # Check for different versions of `getmntent' here..
329 AC_FUNC_GETMNTENT
330 if test "x$ac_cv_lib_sun_getmntent" = "xyes"
331 then
332         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
333                   [Define if the function getmntent exists. It's the version from libsun.])
334 fi
335 if test "x$ac_cv_lib_seq_getmntent" = "xyes"
336 then
337         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
338                   [Define if the function getmntent exists. It's the version from libseq.])
339 fi
340 if test "x$ac_cv_lib_gen_getmntent" = "xyes"
341 then
342         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
343                   [Define if the function getmntent exists. It's the version from libgen.])
344 fi
346 if test "x$ac_cv_func_getmntent" = "xyes"; then
347         saveCFLAGS="$CFLAGS"
348         CFLAGS="-Wall -Werror $CFLAGS"
349         AC_CACHE_CHECK([whether getmntent takes one argument],
350                 [fu_cv_getmntent1],
351                 AC_COMPILE_IFELSE(
352                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
353 #include "$srcdir/src/utils_mount.h"]],
354                                 [[(void)getmntent((FILE *)NULL);]]
355                         ),
356                         [fu_cv_getmntent1=yes],
357                         [fu_cv_getmntent1=no]
358                 )
359         )
360         if test "x$fu_cv_getmntent1" = "xno"; then
361                 AC_CACHE_CHECK([whether getmntent takes two arguments],
362                         [fu_cv_getmntent2],
363                         AC_COMPILE_IFELSE(
364                                 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
365 #include "$srcdir/src/utils_mount.h"]],
366                                         [[(void)getmntent((FILE *)NULL,
367                                                 (struct mnttab *)NULL);]]
368                                 ),
369                                 [fu_cv_getmntent2=yes],
370                                 [fu_cv_getmntent2=no]
371                         )
372                 )
373         fi
374         CFLAGS="$saveCFLAGS"
375 fi
376 if test "x$fu_cv_getmntent1" = "xyes"; then
377         AC_DEFINE(HAVE_GETMNTENT1,
378                 1,
379                 [Define if there is a function named getmntent
380                         for reading the list of mounted filesystems, and
381                         that function takes a single argument. (4.3BSD,
382                         SunOS, HP-UX, Dynix, Irix, Linux)]
383                 )
384 fi
385 if test "x$fu_cv_getmntent2" = "xyes"; then
386         AC_DEFINE(HAVE_GETMNTENT2,
387                 1,
388                 [Define if there is a function named getmntent
389                         for reading the list of mounted filesystems, and
390                         that function takes two arguments. (SVR4)]
391                 )
392 fi
394 # Check for structures
395 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
396         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
397         [],
398         [
399         #include <sys/types.h>
400         #include <sys/socket.h>
401         #include <net/if.h>
402         ])
403 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
404         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
405         [],
406         [
407         #include <sys/types.h>
408         #include <sys/socket.h>
409         #include <linux/if.h>
410         #include <linux/netdevice.h>
411         ])
413 AC_MSG_CHECKING([for kernel type ($host_os)])
414 case $host_os in
415         *linux*)
416         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
417         ac_system="Linux"
418         ;;
419         *solaris*)
420         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
421         ac_system="Solaris"
422         ;;
423         *)
424         ac_system="unknown"
425 esac
426 AC_MSG_RESULT([$ac_system])
428 with_libresolv="yes"
429 AC_CHECK_LIB(resolv, res_search,
431         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
432 ],
433 [with_libresolv="no"])
434 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
437 m4_divert_once([HELP_WITH], [
438 collectd additional packages:])
440 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
441 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
442 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
443         then
444                 LDFLAGS="$LDFLAGS -L$withval/lib"
445                 CPPFLAGS="$CPPFLAGS -I$withval/include"
446                 with_rrdtool="yes"
447         fi
448 ], [with_rrdtool="yes"])
449 if test "x$with_rrdtool" = "xyes"
450 then
451         AC_CHECK_LIB(rrd, rrd_update,
452         [
453                 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
454         ],
455         [with_rrdtool="no (librrd not found)"], [-lm])
456 fi
457 if test "x$with_rrdtool" = "xyes"
458 then
459         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
460 fi
461 if test "x$with_rrdtool" = "xyes"
462 then
463         collect_rrdtool=1
464 else
465         collect_rrdtool=0
466 fi
467 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
468         [Wether or not to use rrdtool library])
469 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
471 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
472 #[      if test "x$withval" != "xno" && test "x$withval" != "xyes"
473 #       then
474 #               LDFLAGS="$LDFLAGS -L$withval/lib"
475 #               CPPFLAGS="$CPPFLAGS -I$withval/include"
476 #               with_pth="yes"
477 #       fi
478 #], [with_pth="no"])
479 #if test "x$with_pth" = "xyes"
480 #then
481 #       AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
482 #fi
483 #if test "x$with_pth" = "xyes"
484 #then
485 #       AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
486 #fi
487 #if test "x$with_pth" = "xyes"
488 #then
489 #       collect_pth=1
490 #else
491 #       collect_pth=0
492 #fi
493 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
494 #       [Wether or not to use pth (portable threads) library])
495 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
497 if test "$ac_system" = "Solaris"
498 then
499         with_kstat="yes"
500         with_devinfo="yes"
501 else
502         with_kstat="no (Solaris only)"
503         with_devinfo="no (Solaris only)"
504 fi
506 if test "x$with_kstat" = "xyes"
507 then
508         AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
509 fi
510 if test "x$with_kstat" = "xyes"
511 then
512         AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
513         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
514 fi
515 if test "x$with_kstat" = "xyes"
516 then
517         collect_kstat=1
518 else
519         collect_kstat=0
520 fi
521 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
522         [Wether or not to use kstat library (Solaris)])
523 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
524 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
526 ### BEGIN of check for libcurl ###
527 with_curl_config="curl-config"
528 with_curl_prefix=0
529 with_curl_libs=""
530 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
532         if test "x$withval" != "xno" -a "x$withval" != "xyes"
533         then
534                 if test -x "$withval/bin/curl-config"
535                 then
536                         with_curl_config="$withval/bin/curl-config"
537                         with_curl_prefix=1
538                 fi
539         fi
540         if test "x$withval" = "xno"
541         then
542                 with_libcurl="no"
543         else
544                 with_libcurl="yes"
545         fi
546 ],
548         with_libcurl="yes"
549 ])
550 if test "x$with_libcurl" = "xyes"
551 then
552         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
553         curl_config_status=$?
555         if test $curl_config_status -ne 0
556         then
557                 with_libcurl="no"
558         else
559                 AC_CHECK_LIB(curl, curl_easy_init,
560                 [
561                         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
562                         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
563                 ],
564                 [
565                         with_libcurl="no"
566                 ],
567                 [$with_curl_libs])
568         fi
569 fi
570 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
571 then
572         with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
573         curl_config_status=$?
575         if test $curl_config_status -ne 0
576         then
577                 with_libcurl="no"
578         else
579                 if test -d "$with_curl_prefix/include"
580                 then
581                         CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
582                 fi
583         fi
584 fi
586 with_libcurl_numeric=0
587 if test "x$with_libcurl" = "xyes"
588 then
589         with_libcurl_numeric=1
590 fi
591 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
592 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
593 ### END of check for libcurl ###
595 with_libiokit="no"
596 collectd_libiokit=0
597 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
599         with_libiokit="yes"
600         collectd_libiokit=1
601 ], 
603         with_libiokit="no"
604         collectd_libiokit=0
605 ])
606 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
607 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
609 with_libstatgrab="yes"
610 with_libdevstat="no"
611 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
613         if test "x$withval" != "xno" -a "x$withval" != "xyes"
614         then
615                 LDFLAGS="$LDFLAGS -L$withval/lib"
616                 CPPFLAGS="$CPPFLAGS -I$withval/include"
617                 with_libstatgrab="yes"
618         fi
619 ],
621         if test "x$ac_system" == "xunknown"
622         then
623                 with_libstatgrab="yes"
624         else
625                 with_libstatgrab="no"
626         fi
627 ])
628 if test "x$with_libstatgrab" = "xyes"
629 then
630         AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
631 fi
632 if test "x$with_libstatgrab" = "xyes"
633 then
634         AC_CHECK_HEADERS(statgrab.h,,    [with_libstatgrab="no (statgrab.h not found)"])
635 fi
636 if test "x$with_libstatgrab" = "xyes"
637 then
638         AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
639 fi
640 if test "x$with_libstatgrab" = "xyes"
641 then
642         collect_libstatgrab=1
643 else
644         collect_libstatgrab=0
645 fi
646 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
647         [Wether or not to use statgrab library])
648 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
649 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
651 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
652 if test "x$with_libkvm" = "xyes"
653 then
654         AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
655 fi
656 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
658 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
660         if test "x$withval" != "xno" && test "x$withval" != "xyes"
661         then
662                 LDFLAGS="$LDFLAGS -L$withval/lib"
663                 CPPFLAGS="$CPPFLAGS -I$withval/include"
664                 with_lm_sensors="yes"
665         fi
666 ],
668         if test "x$ac_system" = "xLinux"
669         then
670                 with_lm_sensors="yes"
671         else
672                 with_lm_sensors="no"
673         fi
674 ])
675 if test "x$with_lm_sensors" = "xyes"
676 then
677         AC_CHECK_LIB(sensors, sensors_init,
678         [
679                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
680         ],
681         [with_lm_sensors="no (libsensors not found)"])
682 fi
683 if test "x$with_lm_sensors" = "xyes"
684 then
685         AC_CHECK_HEADERS(sensors/sensors.h,
686         [
687                 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
688         ],
689         [with_lm_sensors="no (sensors/sensors.h not found)"])
690 fi
691 if test "x$with_lm_sensors" = "xyes"
692 then
693         collect_lm_sensors=1
694 else
695         collect_lm_sensors=0
696 fi
697 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
698         [Wether or not to use sensors library])
699 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
701 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
703         if test "x$withval" != "xno" && test "x$withval" != "xyes"
704         then
705                 LDFLAGS="$LDFLAGS -L$withval/lib"
706                 CPPFLAGS="$CPPFLAGS -I$withval/include"
707                 with_libmysql="yes"
708         fi
709 ],
711         with_libmysql="yes"
712 ])
713 if test "x$with_libmysql" = "xyes"
714 then
715         AC_CHECK_LIB(mysqlclient, mysql_init,
716         [
717                 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
718         ], [with_libmysql="no (libmysql not found)"])
719 fi
720 if test "x$with_libmysql" = "xyes"
721 then
722         AC_CHECK_HEADERS(mysql/mysql.h,
723         [
724                 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
725         ], [with_libmysql="no (mysql/mysql.h not found)"])
726 fi
727 if test "x$with_libmysql" = "xyes"
728 then
729         collect_libmysql=1
730 else
731         collect_libmysql=0
732 fi
733 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
734         [Wether or not to use mysql library])
735 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
737 #with_liboping="yes"
738 with_own_liboping="no"
739 liboping_LDFLAGS="$LDFLAGS"
740 liboping_CPPFLAGS="$CPPFLAGS"
741 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
743         if test "x$withval" != "xno" && test "x$withval" != "xyes"
744         then
745                 if test -d "$withval/lib"
746                 then
747                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
748                 fi
749                 if test -d "$withval/include"
750                 then
751                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
752                 fi
753         fi
754         if test "x$withval" = "xno"
755         then
756                 with_liboping="no"
757                 with_own_liboping="no"
758         fi
759 ],
761         #753
762         with_liboping="yes"
763 ])
765 if test "x$with_liboping" = "xyes"
766 then
767         save_LDFLAGS="$LDFLAGS"
768         save_CPPFLAGS="$CPPFLAGS"
769         LDFLAGS="$liboping_LDFLAGS"
770         CPPFLAGS="$liboping_CPPFLAGS"
771         AC_CHECK_LIB(oping, ping_construct,
772         [
773                 with_liboping="yes"
774                 with_own_liboping="no"
775         ],
776         [
777                 with_liboping="yes"
778                 with_own_liboping="yes"
779                 LDFLAGS="$save_LDFLAGS"
780                 CPPFLAGS="$save_CPPFLAGS"
781         ])
782 fi
783 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
784 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
785 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
786 then
787         with_liboping="yes (shipped version)"
788 fi
790 # Define `step' and `hearbeat' values..
791 declare -i collectd_step=10
792 declare -i collectd_heartbeat=25
793 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
795         if test "x$withval" != "xno" -a "x$withval" != "xyes"
796         then
797                 declare -i tmp_collectd_step="$withval"
798                 if test $tmp_collectd_step -gt 0
799                 then
800                         collectd_step=$tmp_collectd_step
801                         let "collectd_heartbeat=$collectd_step*2"
802                 fi
803         fi
804 ], [])
805 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
807         if test "x$withval" != "xno" -a "x$withval" != "xyes"
808         then
809                 declare -i tmp_collectd_heartbeat="$withval"
810                 if test $tmp_collectd_heartbeat -gt 0
811                 then
812                         collectd_heartbeat=$tmp_collectd_heartbeat
813                 fi
814         fi
815 ], [])
817 if test $collectd_step -ne 10
818 then
819         AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
820 fi
821 if test $collectd_heartbeat -ne 25
822 then
823         AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
824 fi
827 # Check for enabled/disabled features
830 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
831 # ------------------------------------------------------------
832 dnl
833 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
834 dnl
835 AC_DEFUN(
836         [AC_COLLECTD],
837         [
838         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
839         m4_if(
840                 [$2],
841                 [enable],
842                 [dnl
843                 m4_define([EnDis],[disabled])dnl
844                 m4_define([YesNo],[no])dnl
845                 ],dnl
846                 [m4_if(
847                         [$2],
848                         [disable],
849                         [dnl
850                         m4_define([EnDis],[enabled])dnl
851                         m4_define([YesNo],[yes])dnl
852                         ],
853                         [dnl
854                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
855                         ]dnl
856                 )]dnl
857         )dnl
858         m4_if([$3], [feature], [],
859                 [m4_if(
860                         [$3], [module], [],
861                         [dnl
862                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
863                         ]dnl
864                 )]dnl
865         )dnl
866         AC_ARG_ENABLE(
867                 [$1],
868                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
869                 [],
870                 enable_$1='[YesNo]'dnl
871         )# AC_ARG_ENABLE
872 if test "x$enable_$1" = "xno"
873 then
874         collectd_$1=0
875 else
876         if test "x$enable_$1" = "xyes"
877         then
878                 collectd_$1=1
879         else
880                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
881                 collectd_$1=1
882                 enable_$1='yes'
883         fi
884 fi
885         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
886         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
887         ]dnl
888 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
890 m4_divert_once([HELP_ENABLE], [
891 collectd features:])
892 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
893 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
894 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
896 m4_divert_once([HELP_ENABLE], [
897 collectd modules:])
898 AC_COLLECTD([apache],    [disable], [module], [Apache httpd statistics])
899 AC_COLLECTD([apcups],    [disable], [module], [Statistics of UPSes by APC])
900 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
901 AC_COLLECTD([battery],   [disable], [module], [battery statistics])
902 AC_COLLECTD([cpu],       [disable], [module], [cpu usage statistics])
903 AC_COLLECTD([cpufreq],   [disable], [module], [system cpu frequency statistics])
904 AC_COLLECTD([disk],      [disable], [module], [disk/partition statistics])
905 AC_COLLECTD([df],        [disable], [module], [df statistics])
906 AC_COLLECTD([quota],     [enable],  [module], [quota statistics (experimental)])
907 AC_COLLECTD([hddtemp],   [disable], [module], [hdd temperature statistics])
908 AC_COLLECTD([load],      [disable], [module], [system load statistics])
909 AC_COLLECTD([memory],    [disable], [module], [memory statistics])
910 AC_COLLECTD([mysql],     [disable], [module], [mysql statistics])
911 AC_COLLECTD([nfs],       [disable], [module], [nfs statistics])
912 AC_COLLECTD([ntpd],      [disable], [module], [nfs statistics])
913 AC_COLLECTD([ping],      [disable], [module], [ping statistics])
914 AC_COLLECTD([processes], [disable], [module], [processes statistics])
915 AC_COLLECTD([sensors],   [disable], [module], [lm_sensors statistics])
916 AC_COLLECTD([serial],    [disable], [module], [serial statistics])
917 AC_COLLECTD([swap],      [disable], [module], [swap statistics])
918 AC_COLLECTD([tape],      [disable], [module], [tape statistics])
919 AC_COLLECTD([traffic],   [disable], [module], [system traffic statistics])
920 AC_COLLECTD([users],     [disable], [module], [user count statistics])
921 AC_COLLECTD([vserver],   [disable], [module], [vserver statistics])
922 AC_COLLECTD([wireless],  [disable], [module], [wireless link statistics])
924 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
926 cat <<EOF;
928 Configuration:
929   Libraries:
930     libcurl . . . . . . $with_libcurl
931     libiokit  . . . . . $with_libiokit
932     liboping  . . . . . $with_liboping
933     librrd  . . . . . . $with_rrdtool
934     lm_sensors  . . . . $with_lm_sensors
935     libstatgrab . . . . $with_libstatgrab
936     libkstat  . . . . . $with_kstat
937     libmysql  . . . . . $with_libmysql
939   Features:
940     debug . . . . . . . $enable_debug
941     daemon mode . . . . $enable_daemon
942     step  . . . . . . . $collectd_step seconds
943     heartbeat . . . . . $collectd_heartbeat seconds
945   Modules:
946     apache  . . . . . . $enable_apache
947     apcups  . . . . . . $enable_apcups
948     apple_sensors . . . $enable_apple_sensors
949     battery . . . . . . $enable_battery
950     cpu . . . . . . . . $enable_cpu
951     cpufreq . . . . . . $enable_cpufreq
952     df  . . . . . . . . $enable_df
953     disk  . . . . . . . $enable_disk
954     hddtemp . . . . . . $enable_hddtemp
955     load  . . . . . . . $enable_load
956     memory  . . . . . . $enable_memory
957     mysql . . . . . . . $enable_mysql
958     nfs . . . . . . . . $enable_nfs
959     ntpd  . . . . . . . $enable_ntpd
960     ping  . . . . . . . $enable_ping
961     processes . . . . . $enable_processes
962     sensors . . . . . . $enable_sensors
963     serial  . . . . . . $enable_serial
964     swap  . . . . . . . $enable_swap
965     tape  . . . . . . . $enable_tape
966     traffic . . . . . . $enable_traffic
967     users . . . . . . . $enable_users
968     vserver . . . . . . $enable_vserver
969     wireless  . . . . . $enable_wireless
971 EOF