1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.5.0)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
11 # Checks for programs.
21 AC_LIBLTDL_CONVENIENCE
27 AC_CONFIG_SUBDIRS(libltdl src/libconfig)
30 # Checks for header files.
34 AC_CHECK_HEADERS(fcntl.h)
35 AC_CHECK_HEADERS(signal.h)
36 AC_CHECK_HEADERS(sys/socket.h)
37 AC_CHECK_HEADERS(sys/select.h)
38 AC_CHECK_HEADERS(netdb.h)
39 AC_CHECK_HEADERS(sys/resource.h)
40 AC_CHECK_HEADERS(sys/param.h)
41 AC_CHECK_HEADERS(errno.h)
42 AC_CHECK_HEADERS(syslog.h)
45 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
48 AC_CHECK_HEADERS(sys/loadavg.h)
51 AC_CHECK_HEADERS(arpa/inet.h)
52 AC_CHECK_HEADERS(netinet/in.h)
55 AC_CHECK_HEADERS(utmp.h)
56 AC_CHECK_HEADERS(utmpx.h)
59 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
60 AC_CHECK_HEADERS(ctype.h)
61 AC_CHECK_HEADERS(limits.h)
62 AC_CHECK_HEADERS(sys/quota.h)
63 AC_CHECK_HEADERS(xfs/xqm.h)
66 AC_CHECK_HEADERS(fs_info.h)
67 AC_CHECK_HEADERS(fshelp.h)
68 AC_CHECK_HEADERS(paths.h)
69 AC_CHECK_HEADERS(mntent.h)
70 AC_CHECK_HEADERS(mnttab.h)
71 AC_CHECK_HEADERS(sys/fstyp.h)
72 AC_CHECK_HEADERS(sys/fs_types.h)
73 AC_CHECK_HEADERS(sys/mntent.h)
74 AC_CHECK_HEADERS(sys/mnttab.h)
75 AC_CHECK_HEADERS(sys/mount.h)
76 AC_CHECK_HEADERS(sys/statfs.h)
77 AC_CHECK_HEADERS(sys/vfs.h)
78 AC_CHECK_HEADERS(sys/vfstab.h)
80 # For debugging interface (variable number of arguments)
81 AC_CHECK_HEADERS(stdarg.h)
83 dnl Checking for libraries
87 # Checks for typedefs, structures, and compiler characteristics.
96 # Checks for library functions.
98 AC_PROG_GCC_TRADITIONAL
99 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
100 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
101 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
102 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
103 AC_CHECK_FUNCS(strncasecmp strcasecmp)
104 AC_CHECK_FUNCS(openlog syslog closelog)
107 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
110 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
113 AC_CHECK_FUNCS(getutent getutxent)
116 AC_CHECK_FUNCS(quotactl)
117 AC_CHECK_FUNCS(getgrgid getpwuid)
119 # For mount interface
120 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
122 if test "x$ac_cv_func_getmntent" = "xyes"; then
124 CFLAGS="-Wall -Werror $CFLAGS"
125 AC_CACHE_CHECK([whether getmntent takes one argument],
128 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
129 #include "$srcdir/src/utils_mount.h"]],
130 [[(void)getmntent((FILE *)NULL);]]
132 [fu_cv_getmntent1=yes],
133 [fu_cv_getmntent1=no]
136 if test "x$fu_cv_getmntent1" = "xno"; then
137 AC_CACHE_CHECK([whether getmntent takes two arguments],
140 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
141 #include "$srcdir/src/utils_mount.h"]],
142 [[(void)getmntent((FILE *)NULL,
143 (struct mnttab *)NULL);]]
145 [fu_cv_getmntent2=yes],
146 [fu_cv_getmntent2=no]
152 if test "x$fu_cv_getmntent1" = "xyes"; then
153 AC_DEFINE(HAVE_GETMNTENT1,
155 [Define if there is a function named getmntent
156 for reading the list of mounted filesystems, and
157 that function takes a single argument. (4.3BSD,
158 SunOS, HP-UX, Dynix, Irix, Linux)]
161 if test "x$fu_cv_getmntent2" = "xyes"; then
162 AC_DEFINE(HAVE_GETMNTENT2,
164 [Define if there is a function named getmntent
165 for reading the list of mounted filesystems, and
166 that function takes two arguments. (SVR4)]
170 AC_MSG_CHECKING([for kernel type ($host_os)])
173 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
177 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
183 AC_MSG_RESULT([$ac_system])
185 dnl Checks for libraries.
186 AC_CHECK_LIB(socket, socket)
187 AC_CHECK_LIB(resolv, res_search)
189 m4_divert_once([HELP_WITH], [
190 collectd additional packages:])
192 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
193 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
194 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
196 LDFLAGS="$LDFLAGS -L$withval/lib"
197 CPPFLAGS="$CPPFLAGS -I$withval/include"
200 ], [with_rrdtool="yes"])
201 if test "x$with_rrdtool" = "xyes"
203 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no (librrd not found)"], [-lm])
205 if test "x$with_rrdtool" = "xyes"
207 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
209 if test "x$with_rrdtool" = "xyes"
215 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
216 [Wether or not to use rrdtool library])
217 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
219 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
220 #[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
222 # LDFLAGS="$LDFLAGS -L$withval/lib"
223 # CPPFLAGS="$CPPFLAGS -I$withval/include"
227 #if test "x$with_pth" = "xyes"
229 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
231 #if test "x$with_pth" = "xyes"
233 # AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
235 #if test "x$with_pth" = "xyes"
241 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
242 # [Wether or not to use pth (portable threads) library])
243 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
245 if test "$ac_system" = "Solaris"
249 with_kstat="no (Solaris only)"
251 if test "x$with_kstat" = "xyes"
253 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
255 if test "x$with_kstat" = "xyes"
257 AC_CHECK_LIB(devinfo, di_init)
258 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
260 if test "x$with_kstat" = "xyes"
266 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
267 [Wether or not to use kstat library (Solaris)])
268 AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
270 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
272 if test "x$withval" != "xno" && test "x$withval" != "xyes"
274 LDFLAGS="$LDFLAGS -L$withval/lib"
275 CPPFLAGS="$CPPFLAGS -I$withval/include"
276 with_libstatgrab="yes"
280 if test "x$ac_system" == "xunknown"
282 with_libstatgrab="yes"
284 with_libstatgrab="no"
287 if test "x$with_libstatgrab" = "xyes"
289 AC_CHECK_LIB(devstat, getdevs)
290 AC_CHECK_LIB(kvm, kvm_getargv)
291 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
293 if test "x$with_libstatgrab" = "xyes"
295 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
297 if test "x$with_libstatgrab" = "xyes"
299 collect_libstatgrab=1
301 collect_libstatgrab=0
303 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
304 [Wether or not to use statgrab library])
305 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
307 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
309 if test "x$withval" != "xno" && test "x$withval" != "xyes"
311 LDFLAGS="$LDFLAGS -L$withval/lib"
312 CPPFLAGS="$CPPFLAGS -I$withval/include"
313 with_lm_sensors="yes"
317 if test "x$ac_system" = "xLinux"
319 with_lm_sensors="yes"
324 if test "x$with_lm_sensors" = "xyes"
326 AC_CHECK_LIB(sensors, sensors_init,
328 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
330 [with_lm_sensors="no (libsensors not found)"])
332 if test "x$with_lm_sensors" = "xyes"
334 AC_CHECK_HEADERS(sensors/sensors.h,
336 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
338 [with_lm_sensors="no (sensors/sensors.h not found)"])
340 if test "x$with_lm_sensors" = "xyes"
346 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
347 [Wether or not to use sensors library])
348 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
353 # Check for enabled/disabled features
356 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
357 # ------------------------------------------------------------
359 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
364 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
369 m4_define([EnDis],[disabled])dnl
370 m4_define([YesNo],[no])dnl
376 m4_define([EnDis],[enabled])dnl
377 m4_define([YesNo],[yes])dnl
380 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
384 m4_if([$3], [feature], [],
388 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
394 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
396 enable_$1='[YesNo]'dnl
398 if test "x$enable_$1" = "xno"
402 if test "x$enable_$1" = "xyes"
406 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
411 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
412 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
414 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
418 #m4_divert_once([HELP_ENABLE], [
420 #AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
421 #AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
422 #AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
423 #AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
424 #AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
425 #AC_COLLECTD([load], [disable], [module], [system load statistics])
426 #AC_COLLECTD([memory], [disable], [module], [memory statistics])
427 #AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
428 #AC_COLLECTD([ping], [disable], [module], [ping statistics])
429 #AC_COLLECTD([processes], [disable], [module], [processes statistics])
430 #AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
431 #AC_COLLECTD([serial], [disable], [module], [serial statistics])
432 #AC_COLLECTD([swap], [disable], [module], [swap statistics])
433 #AC_COLLECTD([tape], [disable], [module], [tape statistics])
434 #AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
435 #AC_COLLECTD([users], [disable], [module], [user count statistics])
439 m4_divert_once([HELP_ENABLE], [
442 AC_COLLECTD([debug], [enable], [feature], [debugging])
443 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
445 m4_divert_once([HELP_ENABLE], [
447 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
448 #AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
449 #if test "x$enable_cpu" != "xno"
451 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
458 #if test "x$enable_cpu" = "xno"
460 # AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
462 #AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
464 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
465 if test "x$enable_cpufreq" != "xno"
467 if test "x$ac_system" = "xLinux"
474 if test "x$enable_cpufreq" = "xno"
476 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
478 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
480 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
481 if test "x$enable_disk" != "xno"
483 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
490 if test "x$enable_disk" = "xno"
492 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
494 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
496 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
497 if test "x$enable_hddtemp" = "xno"
499 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
501 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
503 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
504 if test "x$enable_load" != "xno"
506 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
513 if test "x$enable_load" = "xno"
515 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
517 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
519 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
520 if test "x$enable_memory" != "xno"
522 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
529 if test "x$enable_memory" = "xno"
531 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
533 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
535 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
536 if test "x$enable_nfs" != "xno"
538 if test "x$ac_system" = "xLinux"
545 if test "x$enable_nfs" = "xno"
547 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
549 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
551 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
552 if test "x$enable_ping" != "xno"
556 if test "x$enable_ping" = "xno"
558 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
560 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
562 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
563 if test "x$enable_processes" != "xno"
565 if test "x$ac_system" = "xLinux"
567 enable_processes="yes"
569 enable_processes="no"
572 if test "x$enable_processes" = "xno"
574 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
576 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
578 #AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
580 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
581 if test "x$enable_sensors" != "xno"
583 if test "x$with_lm_sensors" = "xyes"
590 if test "x$enable_sensors" = "xno"
592 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
594 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
596 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
597 if test "x$enable_serial" != "xno"
599 if test "x$ac_system" = "xLinux"
606 if test "x$enable_serial" = "xno"
608 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
610 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
612 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
613 if test "x$enable_swap" != "xno"
615 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
622 if test "x$enable_swap" = "xno"
624 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
626 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
628 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
629 if test "x$enable_tape" != "xno"
631 if test "x$with_kstat" = "xyes"
638 if test "x$enable_tape" = "xno"
640 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
642 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
644 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
645 if test "x$enable_traffic" != "xno"
647 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
654 if test "x$enable_traffic" = "xno"
656 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
658 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
660 AC_COLLECTD([users], [disable], [module], [user count statistics])
662 AC_OUTPUT(Makefile src/libconfig/Makefile src/libping/Makefile src/Makefile)
668 librrd . . . . . . $with_rrdtool
669 lm_sensors . . . . $with_lm_sensors
670 libstatgrab . . . . $with_libstatgrab
671 libkstat . . . . . $with_kstat
674 debug . . . . . . . $enable_debug
675 daemon mode . . . . $enable_daemon
678 cpu . . . . . . . . $enable_cpu
679 cpufreq . . . . . . $enable_cpufreq
680 disk . . . . . . . $enable_disk
681 hddtemp . . . . . . $enable_hddtemp
682 load . . . . . . . $enable_load
683 memory . . . . . . $enable_memory
684 nfs . . . . . . . . $enable_nfs
685 ping . . . . . . . $enable_ping
686 processes . . . . . $enable_processes
687 sensors . . . . . . $enable_sensors
688 serial . . . . . . $enable_serial
689 swap . . . . . . . $enable_swap
690 tape . . . . . . . $enable_tape
691 traffic . . . . . . $enable_traffic
692 users . . . . . . . $enable_users