dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 4.0.5)
+AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
AC_CONFIG_SRCDIR(src/collectd.c)
AC_CONFIG_HEADERS(src/config.h)
AM_INIT_AUTOMAKE(dist-bzip2)
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h)
+AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h)
# For ping library
AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
])
# For the multimeter plugin
-AC_CHECK_HEADERS(termios.h sys/ioctl.h)
+have_termios_h="no"
+AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
#
# Checking for libraries
### BEGIN of check for libcurl ###
with_curl_config="curl-config"
-with_curl_prefix=0
+with_curl_cflags=""
with_curl_libs=""
AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
[
- if test "x$withval" != "xno" -a "x$withval" != "xyes"
- then
- if test -x "$withval/bin/curl-config"
- then
- with_curl_config="$withval/bin/curl-config"
- with_curl_prefix=1
- fi
- fi
if test "x$withval" = "xno"
then
with_libcurl="no"
- else
+ else if test "x$withval" = "xyes"
+ then
with_libcurl="yes"
- fi
+ else
+ if test -x "$withval"
+ then
+ with_curl_config="$withval"
+ else if test -x "$withval/bin/curl-config"
+ then
+ with_curl_config="$withval/bin/curl-config"
+ fi; fi
+ fi; fi
],
[
with_libcurl="yes"
])
if test "x$with_libcurl" = "xyes"
then
- with_curl_libs=`$with_curl_config --libs 2>/dev/null`
+ with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
curl_config_status=$?
if test $curl_config_status -ne 0
then
with_libcurl="no"
else
- AC_CHECK_LIB(curl, curl_easy_init,
- [
- BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
- AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
- ],
- [
- with_libcurl="no"
- ],
- [$with_curl_libs])
+ SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $with_curl_cflags"
+
+ AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
+
+ CFLAGS="$SAVE_CFLAGS"
fi
fi
-if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
+if test "x$with_libcurl" = "xyes"
then
- with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
+ with_curl_libs=`$with_curl_config --libs 2>/dev/null`
curl_config_status=$?
if test $curl_config_status -ne 0
then
with_libcurl="no"
else
- if test -d "$with_curl_prefix/include"
- then
- CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
- fi
+ AC_CHECK_LIB(curl, curl_easy_init,
+ [
+ # We need to do this to have `HAVE_LIBCURL' defined but
+ # `-lcurl' NOT added to the default LDFLAGS.
+ AC_DEFINE(HAVE_LIBCURL, 1,
+ [Define to 1 if you have the curl library.])
+ ],
+ [with_libcurl="no (symbol 'curl_easy_init' not found)"],
+ [$with_curl_libs])
fi
fi
-
-with_libcurl_numeric=0
if test "x$with_libcurl" = "xyes"
then
- with_libcurl_numeric=1
+ BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
+ BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
+ AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
fi
-AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
### END of check for libcurl ###
[Wether or not to use sensors library])
AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
+with_mysql_config="mysql_config"
+with_mysql_cflags=""
+with_mysql_libs=""
AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
[
- if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ if test "x$withval" = "xno"
+ then
+ with_libmysql="no"
+ else if test "x$withval" = "xyes"
then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
with_libmysql="yes"
- fi
+ else
+ if test -x "$withval";
+ then
+ with_mysql_config="$withval"
+ else if test -x "$withval/bin/mysql_config"
+ then
+ with_mysql_config="$withval/bin/mysql_config"
+ fi; fi
+ fi; fi
],
[
with_libmysql="yes"
])
if test "x$with_libmysql" = "xyes"
then
- AC_CHECK_LIB(mysqlclient, mysql_init,
- [
- AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
- ], [with_libmysql="no (libmysql not found)"])
+ with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
+ mysql_config_status=$?
+
+ if test $mysql_config_status -ne 0
+ then
+ with_libmysql="no"
+ else
+ SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $with_mysql_cflags"
+
+ AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
+
+ CFLAGS="$SAVE_CFLAGS"
+ fi
fi
if test "x$with_libmysql" = "xyes"
then
- AC_CHECK_HEADERS(mysql/mysql.h,
- [
- AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
- ], [with_libmysql="no (mysql/mysql.h not found)"])
+ with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
+ mysql_config_status=$?
+
+ if test $mysql_config_status -ne 0
+ then
+ with_libmysql="no"
+ else
+ AC_CHECK_LIB(mysqlclient, mysql_init,
+ [
+ # We need to do this to have `HAVE_LIBMYSQLCLIENT' defined
+ # but `-lmysqlclient' NOT added to the default LDFLAGS.
+ AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1,
+ [Define to 1 if you have the mysqlclient library.])
+ ],
+ [with_libmysql="no (libmysql not found)"],
+ [$with_mysql_libs])
+ fi
fi
if test "x$with_libmysql" = "xyes"
then
- collect_libmysql=1
-else
- collect_libmysql=0
+ BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
+ BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
+ AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
fi
-AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
- [Wether or not to use mysql library])
AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
with_own_liboconfig="no"
fi
AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
+with_upsclient_config="libupsclient-config"
+with_upsclient_cflags=""
+with_upsclient_libs=""
AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
[
- if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ if test "x$withval" = "xno"
then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
+ with_libupsclient="no"
+ else
with_libupsclient="yes"
+ if "x$withval" != "xyes"
+ then
+ with_upsclient_config="$withval/bin/libupsclient-config"
+ fi
fi
],
[
])
if test "x$with_libupsclient" = "xyes"
then
+ with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
+ upsclient_config_status=$?
+
+ if test $upsclient_config_status -ne 0
+ then
+ with_libupsclient="no"
+ fi
+fi
+if test "x$with_libupsclient" = "xyes"
+then
+ with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
+ upsclient_config_status=$?
+
+ if test $upsclient_config_status -ne 0
+ then
+ with_libupsclient="no"
+ fi
+fi
+if test "x$with_libupsclient" = "xyes"
+then
+ CFLAGS_ORIG=$CFLAGS
+ CFLAGS="$CFLAGS $with_upsclient_cflags"
+ LDFLAGS_ORIG=$LDFLAGS
+ LDFLAGS="$LDFLAGS $with_upsclient_libs"
AC_CHECK_LIB(upsclient, upscli_connect,
[
- AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
- ], [with_libupsclient="no (libupsclient not found)"])
+ BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
+ BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
+ AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
+ ],
+ [
+ with_libupsclient="no"
+ ])
+ CFLAGS=$CFLAGS_ORIG
+ LDFLAGS=$LDFLAGS_ORIG
fi
if test "x$with_libupsclient" = "xyes"
then
- AC_CHECK_HEADERS(upsclient.h,
- [
- AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
- ], [with_libupsclient="no (upsclient.h not found)"])
+ AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
+fi
+if test "x$with_libupsclient" = "xyes"
+then
+ AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
+[#include <stdlib.h>
+#include <stdio.h>
+#include <upsclient.h>])
fi
AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
### BEGIN of check for libxmms ###
with_xmms_config="xmms-config"
-with_xmms_prefix=0
with_xmms_cflags=""
with_xmms_libs=""
AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
if test -x "$withval/bin/xmms-config"
then
with_xmms_config="$withval/bin/xmms-config"
- with_xmms_prefix=1
fi
fi
if test "x$withval" = "xno"
plugin_irq="no"
plugin_load="no"
plugin_memory="no"
+plugin_multimeter="no"
plugin_nfs="no"
plugin_processes="no"
plugin_serial="no"
plugin_memory="yes"
fi
+if test "x$have_termios_h" = "xyes"
+then
+ plugin_multimeter="yes"
+fi
+
if test "x$have_thread_info" = "xyes"
then
plugin_processes="yes"
m4_divert_once([HELP_ENABLE], [
collectd plugins:])
-AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
-AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
-AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
-AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
-AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
-AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
-AC_PLUGIN([csv], [yes], [CSV output plugin])
-AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
-AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
-AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
-AC_PLUGIN([email], [yes], [EMail statistics])
-AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
-AC_PLUGIN([exec], [yes], [Execution of external programs])
-AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
-AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
-AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
-AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
-AC_PLUGIN([load], [$plugin_load], [System load])
-AC_PLUGIN([logfile], [yes], [File logging plugin])
-AC_PLUGIN([mbmon], [yes], [Query mbmond])
-AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
-AC_PLUGIN([multimeter], [no], [Read multimeter values])
-AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
-AC_PLUGIN([network], [yes], [Network communication plugin])
-AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
-AC_PLUGIN([ntpd], [yes], [NTPd statistics])
+AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
+AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
+AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
+AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
+AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
+AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
+AC_PLUGIN([csv], [yes], [CSV output plugin])
+AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
+AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
+AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
+AC_PLUGIN([email], [yes], [EMail statistics])
+AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
+AC_PLUGIN([exec], [yes], [Execution of external programs])
+AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
+AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
+AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
+AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
+AC_PLUGIN([load], [$plugin_load], [System load])
+AC_PLUGIN([logfile], [yes], [File logging plugin])
+AC_PLUGIN([mbmon], [yes], [Query mbmond])
+AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
+AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
+AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
+AC_PLUGIN([network], [yes], [Network communication plugin])
+AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
+AC_PLUGIN([ntpd], [yes], [NTPd statistics])
AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
-AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
-AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
-AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
-AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
-AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
-AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
-AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
-AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
-AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
-AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
-AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
-AC_PLUGIN([users], [$plugin_users], [User statistics])
-AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
-AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
-AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
+AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
+AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
+AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
+AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
+AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
+AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
+AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
+AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
+AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
+AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
+AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
+AC_PLUGIN([users], [$plugin_users], [User statistics])
+AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
+AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
+AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)