From 86ca149a90f7290172f140129e62d6ca2a8773c5 Mon Sep 17 00:00:00 2001 From: octo Date: Thu, 1 Dec 2005 16:16:41 +0000 Subject: [PATCH] Fiddling with that autoconf/automake stuff.. --- configure.in | 419 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 112 +++++++++++++++ 2 files changed, 531 insertions(+) create mode 100644 configure.in create mode 100644 src/Makefile.am diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..a0b10335 --- /dev/null +++ b/configure.in @@ -0,0 +1,419 @@ +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_LANG(C) + +AC_PREFIX_DEFAULT("/opt/collectd") + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +dnl configure libtool +AC_DISABLE_STATIC +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL +#AC_PROG_RANLIB + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h unistd.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(errno.h) +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) + +dnl Checking for libraries +AC_CHECK_LIB(m, ext) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME + +dnl Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_CHECK_FUNCS(gettimeofday select socket strdup strstr 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_MSG_CHECKING([for kernel type ($host_os)]) +case $host_os in + *linux*) + AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel]) + ac_system="Linux" + ;; + *solaris*) + AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel]) + ac_system="Solaris" + ;; + *) + ac_system="unknown" +esac +AC_MSG_RESULT([$ac_system]) + +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 + +# 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" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_rrdtool="yes" + fi +], [with_rrdtool="yes"]) +if test "x$with_rrdtool" = "xyes" +then + AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm]) +fi +if test "x$with_rrdtool" = "xyes" +then + AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"]) +fi +AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes") + +if test "$ac_system" = "Solaris" +then + with_kstat="yes" + AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"]) + AC_CHECK_LIB(devinfo, di_init) + AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"]) +else + with_kstat="no (Solaris only)" +fi + +AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]), +[ + # given.. + if test "x$withval" != "xno" + then + if test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libstatgrab="yes" + fi + fi +], +[ + # not given.. + if test "x$ac_system" != "xunknown" + then + with_libstatgrab="no" + else + with_libstatgrab="yes" + 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)"]) +fi + +AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]), +[ + # given.. + if test "x$withval" != "xno" + then + if test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_lm_sensors="yes" + fi + fi +], +[ + # not given.. + if test "x$ac_system" = "xLinux" + then + with_lm_sensors="yes" + else + with_lm_sensors="no" + fi +]) +if test "x$with_lm_sensors" = "xyes" +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)"]) + AC_CHECK_HEADERS(sensors/sensors.h, + [ + with_lm_sensors="yes" + AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the header file.]) + ], + [with_lm_sensors="no (not found)"]) +fi + + + +# +# Check for enabled/disabled features +# +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" + then + enable_cpu="yes" + else + enable_cpu="no" + fi +fi +if test "x$enable_cpu" = "xno" +then + AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes") + +AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"]) +if test "x$enable_cpufreq" != "xno" +then + if test "x$ac_system" = "xLinux" + then + enable_cpufreq="yes" + else + enable_cpufreq="no" + fi +fi +if test "x$enable_cpufreq" = "xno" +then + AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes") + +AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"]) +if test "x$enable_disk" != "xno" +then + if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" + then + enable_disk="yes" + else + enable_disk="no" + fi +fi +if test "x$enable_disk" = "xno" +then + AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats]) +fi +AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes") + +AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"]) +if test "x$enable_hddtemp" = "xno" +then + AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes") + +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" + then + enable_load="yes" + else + enable_load="no" + fi +fi +if test "x$enable_load" = "xno" +then + AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes") + +AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"]) +if test "x$enable_memory" != "xno" +then + if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes" + then + enable_memory="yes" + else + enable_memory="no" + fi +fi +if test "x$enable_memory" = "xno" +then + AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes") + +AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"]) +if test "x$enable_nfs" != "xno" +then + if test "x$ac_system" = "xLinux" + then + enable_nfs="yes" + else + enable_nfs="no" + fi +fi +if test "x$enable_nfs" = "xno" +then + AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes") + +AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"]) +if test "x$enable_ping" != "xno" +then + enable_ping="yes" +fi +if test "x$enable_ping" = "xno" +then + AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes") + +AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"]) +if test "x$enable_processes" != "xno" +then + if test "x$ac_system" = "xLinux" + then + enable_processes="yes" + else + enable_processes="no" + fi +fi +if test "x$enable_processes" = "xno" +then + AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes") + +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 + if test "x$with_lm_sensors" = "xyes" + then + enable_sensors="yes" + else + enable_sensors="no" + fi +fi +if test "x$enable_sensors" = "xno" +then + AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes") + +AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"]) +if test "x$enable_serial" != "xno" +then + if test "x$ac_system" = "xLinux" + then + enable_serial="yes" + else + enable_serial="no" + fi +fi +if test "x$enable_serial" = "xno" +then + AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes") + +AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"]) +if test "x$enable_swap" != "xno" +then + if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes" + then + enable_swap="yes" + else + enable_swap="no" + fi +fi +if test "x$enable_swap" = "xno" +then + AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes") + +AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"]) +if test "x$enable_tape" != "xno" +then + if test "x$with_kstat" = "xyes" + then + enable_tape="yes" + else + enable_tape="no" + fi +fi +if test "x$enable_tape" = "xno" +then + AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes") + +AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"]) +if test "x$enable_traffic" != "xno" +then + if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes" + then + enable_traffic="yes" + else + enable_traffic="no" + fi +fi +if test "x$enable_traffic" = "xno" +then + AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics]) +fi +AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes") + +AC_OUTPUT(Makefile src/libping/Makefile src/Makefile) + +cat <$@ -- 2.11.0