diff --git a/configure.in b/configure.in
index a0b1033593aec6e2f19230958c8797df5d47fead..e5cf5cb55a550b4a95ec040483478bd0b5d2beb0 100644 (file)
--- a/configure.in
+++ b/configure.in
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(src/collectd.c)
-AM_INIT_AUTOMAKE(collectd, 3.4.0)
-AM_CONFIG_HEADER(src/config.h src/libping/config.h)
+AC_INIT(collectd, 3.5.0)
+AC_CONFIG_SRCDIR(src/collectd.c)
+AC_CONFIG_HEADERS(src/config.h)
+AM_INIT_AUTOMAKE(dist-bzip2)
AC_LANG(C)
AC_PREFIX_DEFAULT("/opt/collectd")
-dnl Checks for programs.
+#
+# Checks for programs.
+#
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
dnl configure libtool
AC_DISABLE_STATIC
+AC_LIBLTDL_CONVENIENCE
+AC_SUBST(LTDLINCL)
+AC_SUBST(LIBLTDL)
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
#AC_PROG_RANLIB
+AC_CONFIG_SUBDIRS(libltdl src/libconfig)
-dnl Checks for header files.
-AC_HEADER_STDC
+#
+# Checks for header files.
+#
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h unistd.h)
+AC_HEADER_DIRENT
+AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(netdb.h)
-AC_CHECK_HEADERS(sys/time.h sys/times.h)
-AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/resource.h)
+AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(errno.h)
+AC_CHECK_HEADERS(syslog.h)
+
+# For cpu modules
+AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
+
+# For load module
+AC_CHECK_HEADERS(sys/loadavg.h)
+
+# For ping module
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(netinet/in.h)
-AC_CHECK_HEADERS(netdb.h)
-AC_CHECK_HEADERS(syslog.h)
-AC_CHECK_HEADERS(dlfcn.h)
+
+# For users module
+AC_CHECK_HEADERS(utmp.h)
+AC_CHECK_HEADERS(utmpx.h)
+
+# For quota module
+AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
+AC_CHECK_HEADERS(ctype.h)
+AC_CHECK_HEADERS(limits.h)
+AC_CHECK_HEADERS(sys/quota.h)
+AC_CHECK_HEADERS(xfs/xqm.h)
+
+# For mount interface
+AC_CHECK_HEADERS(fs_info.h)
+AC_CHECK_HEADERS(fshelp.h)
+AC_CHECK_HEADERS(paths.h)
+AC_CHECK_HEADERS(mntent.h)
+AC_CHECK_HEADERS(mnttab.h)
+AC_CHECK_HEADERS(sys/fstyp.h)
+AC_CHECK_HEADERS(sys/fs_types.h)
+AC_CHECK_HEADERS(sys/mntent.h)
+AC_CHECK_HEADERS(sys/mnttab.h)
+AC_CHECK_HEADERS(sys/mount.h)
+AC_CHECK_HEADERS(sys/statfs.h)
+AC_CHECK_HEADERS(sys/vfs.h)
+AC_CHECK_HEADERS(sys/vfstab.h)
+
+# For debugging interface (variable number of arguments)
+AC_CHECK_HEADERS(stdarg.h)
dnl Checking for libraries
AC_CHECK_LIB(m, ext)
-dnl Checks for typedefs, structures, and compiler characteristics.
+#
+# Checks for typedefs, structures, and compiler characteristics.
+#
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
+AC_TYPE_UID_T
AC_HEADER_TIME
-dnl Checks for library functions.
+#
+# Checks for library functions.
+#
AC_PROG_GCC_TRADITIONAL
-AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
+AC_CHECK_FUNCS(gettimeofday select strdup strtol)
AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
-AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
+AC_CHECK_FUNCS(strncasecmp strcasecmp)
+AC_CHECK_FUNCS(openlog syslog closelog)
+
+# For cpu module
+AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
+
+# For load module
+AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
+
+# For users module
+AC_CHECK_FUNCS(getutent getutxent)
+
+# For quota module
+AC_CHECK_FUNCS(quotactl)
+AC_CHECK_FUNCS(getgrgid getpwuid)
+
+# For mount interface
+AC_CHECK_FUNCS(getfsent getvfsent listmntent)
+AC_FUNC_GETMNTENT
+if test "x$ac_cv_func_getmntent" = "xyes"; then
+ saveCFLAGS="$CFLAGS"
+ CFLAGS="-Wall -Werror $CFLAGS"
+ AC_CACHE_CHECK([whether getmntent takes one argument],
+ [fu_cv_getmntent1],
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#include "$srcdir/src/utils_mount.h"]],
+ [[(void)getmntent((FILE *)NULL);]]
+ ),
+ [fu_cv_getmntent1=yes],
+ [fu_cv_getmntent1=no]
+ )
+ )
+ if test "x$fu_cv_getmntent1" = "xno"; then
+ AC_CACHE_CHECK([whether getmntent takes two arguments],
+ [fu_cv_getmntent2],
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#include "$srcdir/src/utils_mount.h"]],
+ [[(void)getmntent((FILE *)NULL,
+ (struct mnttab *)NULL);]]
+ ),
+ [fu_cv_getmntent2=yes],
+ [fu_cv_getmntent2=no]
+ )
+ )
+ fi
+ CFLAGS="$saveCFLAGS"
+fi
+if test "x$fu_cv_getmntent1" = "xyes"; then
+ AC_DEFINE(HAVE_GETMNTENT1,
+ 1,
+ [Define if there is a function named getmntent
+ for reading the list of mounted filesystems, and
+ that function takes a single argument. (4.3BSD,
+ SunOS, HP-UX, Dynix, Irix, Linux)]
+ )
+fi
+if test "x$fu_cv_getmntent2" = "xyes"; then
+ AC_DEFINE(HAVE_GETMNTENT2,
+ 1,
+ [Define if there is a function named getmntent
+ for reading the list of mounted filesystems, and
+ that function takes two arguments. (SVR4)]
+ )
+fi
AC_MSG_CHECKING([for kernel type ($host_os)])
case $host_os in
dnl Checks for libraries.
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(resolv, res_search)
-AC_CHECK_LIB(dl, dlopen)
-#if "x$localstatedir" != "x"
-#then
-# CPPFLAGS="$CPPFLAGS -DLOCALSTATEDIR=\"$localstatedir\""
-#fi
+m4_divert_once([HELP_WITH], [
+collectd additional packages:])
# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
-AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
-[ if test "x$withval" != "xno" -a "x$withval" != "xyes"
+AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
+[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
@@ -90,67 +200,120 @@ AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
], [with_rrdtool="yes"])
if test "x$with_rrdtool" = "xyes"
then
- AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
+ AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no (librrd not found)"], [-lm])
fi
if test "x$with_rrdtool" = "xyes"
then
- AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
+ AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
fi
+if test "x$with_rrdtool" = "xyes"
+then
+ collect_rrdtool=1
+else
+ collect_rrdtool=0
+fi
+AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
+ [Wether or not to use rrdtool library])
AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
+#AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
+#[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+# then
+# LDFLAGS="$LDFLAGS -L$withval/lib"
+# CPPFLAGS="$CPPFLAGS -I$withval/include"
+# with_pth="yes"
+# fi
+#], [with_pth="no"])
+#if test "x$with_pth" = "xyes"
+#then
+# AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
+#fi
+#if test "x$with_pth" = "xyes"
+#then
+# AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
+#fi
+#if test "x$with_pth" = "xyes"
+#then
+# collect_pth=1
+#else
+# collect_pth=0
+#fi
+#AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
+# [Wether or not to use pth (portable threads) library])
+#AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
+
if test "$ac_system" = "Solaris"
then
with_kstat="yes"
- AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
+else
+ with_kstat="no (Solaris only)"
+fi
+if test "x$with_kstat" = "xyes"
+then
+ AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
+fi
+if test "x$with_kstat" = "xyes"
+then
AC_CHECK_LIB(devinfo, di_init)
AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
+fi
+if test "x$with_kstat" = "xyes"
+then
+ collect_kstat=1
else
- with_kstat="no (Solaris only)"
+ collect_kstat=0
fi
+AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
+ [Wether or not to use kstat library (Solaris)])
+AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
-AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
+AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
[
- # given..
- if test "x$withval" != "xno"
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
then
- if test "x$withval" != "xyes"
- then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- with_libstatgrab="yes"
- fi
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ with_libstatgrab="yes"
fi
],
[
- # not given..
- if test "x$ac_system" != "xunknown"
+ if test "x$ac_system" == "xunknown"
then
- with_libstatgrab="no"
- else
with_libstatgrab="yes"
+ else
+ with_libstatgrab="no"
fi
])
if test "x$with_libstatgrab" = "xyes"
then
- AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
- AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
+ AC_CHECK_LIB(devstat, getdevs)
+ AC_CHECK_LIB(kvm, kvm_getargv)
+ AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
+fi
+if test "x$with_libstatgrab" = "xyes"
+then
+ AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
fi
+if test "x$with_libstatgrab" = "xyes"
+then
+ collect_libstatgrab=1
+else
+ collect_libstatgrab=0
+fi
+AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
+ [Wether or not to use statgrab library])
+AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
-AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
+AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
[
- # given..
- if test "x$withval" != "xno"
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
then
- if test "x$withval" != "xyes"
- then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- with_lm_sensors="yes"
- fi
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ with_lm_sensors="yes"
fi
],
[
- # not given..
if test "x$ac_system" = "xLinux"
then
with_lm_sensors="yes"
then
AC_CHECK_LIB(sensors, sensors_init,
[
- with_lm_sensors="yes"
AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
],
- [with_lm_sensors="no (not found)"])
+ [with_lm_sensors="no (libsensors not found)"])
+fi
+if test "x$with_lm_sensors" = "xyes"
+then
AC_CHECK_HEADERS(sensors/sensors.h,
[
- with_lm_sensors="yes"
AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
],
- [with_lm_sensors="no (not found)"])
+ [with_lm_sensors="no (sensors/sensors.h not found)"])
+fi
+if test "x$with_lm_sensors" = "xyes"
+then
+ collect_lm_sensors=1
+else
+ collect_lm_sensors=0
fi
+AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
+ [Wether or not to use sensors library])
+AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
#
# Check for enabled/disabled features
#
+
+# AC_COLLECTD(name, enable/disable, info-text, feature/module)
+# ------------------------------------------------------------
+dnl
+m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
+dnl
+AC_DEFUN(
+ [AC_COLLECTD],
+ [
+ m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
+ m4_if(
+ [$2],
+ [enable],
+ [dnl
+ m4_define([EnDis],[disabled])dnl
+ m4_define([YesNo],[no])dnl
+ ],dnl
+ [m4_if(
+ [$2],
+ [disable],
+ [dnl
+ m4_define([EnDis],[enabled])dnl
+ m4_define([YesNo],[yes])dnl
+ ],
+ [dnl
+ AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
+ ]dnl
+ )]dnl
+ )dnl
+ m4_if([$3], [feature], [],
+ [m4_if(
+ [$3], [module], [],
+ [dnl
+ AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
+ ]dnl
+ )]dnl
+ )dnl
+ AC_ARG_ENABLE(
+ [$1],
+ AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
+ [],
+ enable_$1='[YesNo]'dnl
+ )# AC_ARG_ENABLE
+if test "x$enable_$1" = "xno"
+then
+ collectd_$1=0
+else
+ if test "x$enable_$1" = "xyes"
+ then
+ collectd_$1=1
+ else
+ AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
+ collectd_$1=1
+ enable_$1='yes'
+ fi
+fi
+ AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
+ AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
+ ]dnl
+)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
+
+
+
+#m4_divert_once([HELP_ENABLE], [
+#collectd modules:])
+#AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
+#AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
+#AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
+#AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
+#AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
+#AC_COLLECTD([load], [disable], [module], [system load statistics])
+#AC_COLLECTD([memory], [disable], [module], [memory statistics])
+#AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
+#AC_COLLECTD([ping], [disable], [module], [ping statistics])
+#AC_COLLECTD([processes], [disable], [module], [processes statistics])
+#AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
+#AC_COLLECTD([serial], [disable], [module], [serial statistics])
+#AC_COLLECTD([swap], [disable], [module], [swap statistics])
+#AC_COLLECTD([tape], [disable], [module], [tape statistics])
+#AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
+#AC_COLLECTD([users], [disable], [module], [user count statistics])
+
+
+
+m4_divert_once([HELP_ENABLE], [
+collectd features:])
+
+AC_COLLECTD([debug], [enable], [feature], [debugging])
+AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
+
+m4_divert_once([HELP_ENABLE], [
+collectd modules:])
AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
if test "x$enable_cpu" != "xno"
then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
+ if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
then
enable_cpu="yes"
else
AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
if test "x$enable_load" != "xno"
then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
+ if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
then
enable_load="yes"
else
fi
AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
+#AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
+
AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
if test "x$enable_sensors" != "xno"
then
fi
AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
-AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
+AC_COLLECTD([users], [disable], [module], [user count statistics])
+
+AC_OUTPUT(Makefile src/libconfig/Makefile src/libping/Makefile src/Makefile)
cat <<EOF;
libkstat . . . . . $with_kstat
Features:
+ debug . . . . . . . $enable_debug
+ daemon mode . . . . $enable_daemon
+
+ Modules:
cpu . . . . . . . . $enable_cpu
cpufreq . . . . . . $enable_cpufreq
disk . . . . . . . $enable_disk
swap . . . . . . . $enable_swap
tape . . . . . . . $enable_tape
traffic . . . . . . $enable_traffic
+ users . . . . . . . $enable_users
EOF