dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 4.0.0-rc4)
+AC_INIT(collectd, 4.0.6)
AC_CONFIG_SRCDIR(src/collectd.c)
AC_CONFIG_HEADERS(src/config.h)
AM_INIT_AUTOMAKE(dist-bzip2)
AC_PREFIX_DEFAULT("/opt/collectd")
+AC_SYS_LARGEFILE
+
#
# Checks for programs.
#
])
# For cpu modules
-AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
+AC_CHECK_HEADERS(sys/sysctl.h, [], [],
+[
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+])
+AC_CHECK_HEADERS(sys/dkstat.h)
AC_CHECK_HEADERS(mach/mach_init.h)
AC_CHECK_HEADERS(mach/host_priv.h)
AC_CHECK_HEADERS(mach/mach_error.h)
# For hddtemp module
AC_CHECK_HEADERS(linux/major.h)
+AC_CHECK_HEADERS(libgen.h)
# For the apple_sensors module
AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
AC_CHECK_HEADERS(linux/config.h)
# For the swap module
-AC_CHECK_HEADERS(sys/swap.h)
+AC_CHECK_HEADERS(sys/swap.h, [], [],
+[
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+])
# For users module
AC_CHECK_HEADERS(utmp.h)
AC_CHECK_HEADERS(curl/curl.h)
# For quota module
-AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
+AC_CHECK_HEADERS(pwd.h)
+AC_CHECK_HEADERS(sys/ucred.h, [], [],
+[
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+])
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(sys/quota.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/mount.h, [], [],
+[
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+])
AC_CHECK_HEADERS(sys/statfs.h)
AC_CHECK_HEADERS(sys/statvfs.h)
AC_CHECK_HEADERS(sys/vfs.h)
AC_CHECK_HEADERS(regex.h)
# For the dns plugin
-AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
+AC_CHECK_HEADERS(arpa/nameser.h)
+AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
+[
+#if HAVE_ARPA_NAMESER_H
+# include <arpa/nameser.h>
+#endif
+])
AC_CHECK_HEADERS(net/if_arp.h, [], [],
[#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
-AC_CHECK_HEADERS(net/if_ppp.h)
+AC_CHECK_HEADERS(net/ppp_defs.h)
+AC_CHECK_HEADERS(net/if_ppp.h, [], [],
+[#if HAVE_NET_PPP_DEFS_H
+# include <net/ppp_defs.h>
+#endif
+])
AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
AC_CHECK_FUNCS(strncasecmp strcasecmp)
AC_CHECK_FUNCS(openlog syslog closelog)
+AC_CHECK_FUNCS(getpwnam_r)
+AC_CHECK_FUNCS(getgrnam_r)
+
socket_needs_socket="no"
AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
# For users module
AC_CHECK_FUNCS(getutent getutxent)
-# For quota module
-AC_CHECK_FUNCS(quotactl)
-AC_CHECK_FUNCS(getgrgid getpwuid)
-
# For interface module
AC_CHECK_FUNCS(getifaddrs)
# Check for NAN
-nan_type="none"
+AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
+[
+ if test "x$withval" = "xno"; then
+ nan_type="none"
+ else if test "x$withval" = "xyes"; then
+ nan_type="zero"
+ else
+ nan_type="$withval"
+ fi; fi
+],
+[nan_type="none"])
if test "x$nan_type" = "xnone"; then
AC_CACHE_CHECK([whether NAN is defined by default],
[have_nan_default],
)
if test "x$have_nan_default" = "xyes"
then
- nan_type="default"
- AC_DEFINE(NAN_STATIC_DEFAULT, 1,
- [Define if NAN is defined by default and can initialize static variables.])
+ nan_type="default"
fi
fi
if test "x$nan_type" = "xnone"; then
)
if test "x$have_nan_isoc" = "xyes"
then
- nan_type="isoc99"
- AC_DEFINE(NAN_STATIC_ISOC, 1,
- [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
+ nan_type="isoc99"
fi
fi
if test "x$nan_type" = "xnone"; then
)
if test "x$have_nan_zero" = "xyes"
then
- nan_type="zero"
- AC_DEFINE(NAN_ZERO_ZERO, 1,
- [Define if NAN can be defined as (0.0 / 0.0)])
+ nan_type="zero"
fi
fi
-if test "x$nan_type" = "xnone"; then
+
+if test "x$nan_type" = "xdefault"; then
+ AC_DEFINE(NAN_STATIC_DEFAULT, 1,
+ [Define if NAN is defined by default and can initialize static variables.])
+else if test "x$nan_type" = "xisoc99"; then
+ AC_DEFINE(NAN_STATIC_ISOC, 1,
+ [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
+else if test "x$nan_type" = "xzero"; then
+ AC_DEFINE(NAN_ZERO_ZERO, 1,
+ [Define if NAN can be defined as (0.0 / 0.0)])
+else
AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
-fi
+fi; fi; fi
# For mount interface
#AC_CHECK_FUNCS(getfsent getvfsent)
[Wether or not to use mysql library])
AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
+with_own_liboconfig="no"
+liboconfig_LDFLAGS="$LDFLAGS"
+liboconfig_CPPFLAGS="$CPPFLAGS"
+AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
+[
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ then
+ if test -d "$withval/lib"
+ then
+ liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
+ fi
+ if test -d "$withval/include"
+ then
+ liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
+ fi
+ fi
+ if test "x$withval" = "xno"
+ then
+ AC_MSG_ERROR("liboconfig is required")
+ fi
+],
+[
+ with_liboconfig="yes"
+])
+
+save_LDFLAGS="$LDFLAGS"
+save_CPPFLAGS="$CPPFLAGS"
+LDFLAGS="$liboconfig_LDFLAGS"
+CPPFLAGS="$liboconfig_CPPFLAGS"
+AC_CHECK_LIB(oconfig, oconfig_parse_fh,
+[
+ with_liboconfig="yes"
+ with_own_liboconfig="no"
+],
+[
+ with_liboconfig="yes"
+ with_own_liboconfig="yes"
+ LDFLAGS="$save_LDFLAGS"
+ CPPFLAGS="$save_CPPFLAGS"
+])
+
+AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
+if test "x$with_own_liboconfig" = "xyes"
+then
+ with_liboconfig="yes (shipped version)"
+fi
+
#with_liboping="yes"
with_own_liboping="no"
liboping_LDFLAGS="$LDFLAGS"
[Wether or not to use the pcap library])
AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
+perl_interpreter="perl"
AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
[
if test "x$withval" != "xno" && test "x$withval" != "xyes"
then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
+ perl_interpreter="$withval/bin/perl"
with_libperl="yes"
fi
],
then
SAVE_CFLAGS=$CFLAGS
SAVE_LDFLAGS=$LDFLAGS
- CFLAGS="$CFLAGS `perl -MExtUtils::Embed -e ccopts`"
- LDFLAGS="$LDFLAGS `perl -MExtUtils::Embed -e ldopts`"
+ PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
+ PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
+ CFLAGS="$CFLAGS $PERL_CFLAGS"
+ LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
AC_CACHE_CHECK([for libperl],
[have_libperl],
[[
PerlInterpreter *perl = NULL;
Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
- Perl_newSVpvf (perl, "Collectd::Plugin::%s", "foo"),
+ newSVpv ("Collectd::Plugin::FooBar", 24),
Nullsv);
]]),
[have_libperl="yes"],
if test "x$have_libperl" = "xyes"
then
AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
+ AC_SUBST(PERL_CFLAGS)
+ AC_SUBST(PERL_LDFLAGS)
else
with_libperl="no"
fi
AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
-if test "x$with_libperl" != "xyes"
+if test "x$with_libperl" = "xyes"
then
+ with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
+else
enable_perl="no (needs libperl)"
fi
libiptc . . . . . . $with_libiptc
libkstat . . . . . $with_kstat
libmysql . . . . . $with_libmysql
+ liboconfig . . . . $with_liboconfig
liboping . . . . . $with_liboping
libpcap . . . . . . $with_libpcap
libperl . . . . . . $with_libperl