X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=configure.in;h=1b158ec7a4befe1864a14b2682115b3e6477917c;hb=d93c0d699a30ca7e1d65f04aab36b33d26a05486;hp=f380ca2bec989fe55cbebdeb66e2bc549934f9ad;hpb=05b7b7e327b01a33da39f5550694294fd0d29849;p=collectd.git diff --git a/configure.in b/configure.in index f380ca2b..1b158ec7 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(collectd, 3.11.2) +AC_INIT(collectd, 4.0.3) AC_CONFIG_SRCDIR(src/collectd.c) AC_CONFIG_HEADERS(src/config.h) AM_INIT_AUTOMAKE(dist-bzip2) @@ -7,6 +7,8 @@ AC_LANG(C) AC_PREFIX_DEFAULT("/opt/collectd") +AC_SYS_LARGEFILE + # # Checks for programs. # @@ -50,6 +52,7 @@ AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/param.h) +AC_CHECK_HEADERS(kstat.h) # For ping library AC_CHECK_HEADERS(netinet/in_systm.h, [], [], @@ -207,6 +210,7 @@ AC_CHECK_HEADERS(mach/kern_return.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) @@ -279,7 +283,7 @@ AC_CHECK_HEADERS(linux/netdevice.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 sys/ucred.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(limits.h) AC_CHECK_HEADERS(sys/quota.h) @@ -323,9 +327,29 @@ AC_CHECK_HEADERS(regex.h) # For the dns plugin AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h) -AC_CHECK_HEADERS(net/if_arp.h) +AC_CHECK_HEADERS(net/if_arp.h, [], [], +[#if HAVE_SYS_SOCKET_H +# include +#endif +]) AC_CHECK_HEADERS(net/if_ppp.h) -AC_CHECK_HEADERS(netinet/if_ether.h) +AC_CHECK_HEADERS(netinet/if_ether.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_NET_IF_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) # For the multimeter plugin AC_CHECK_HEADERS(termios.h) @@ -389,7 +413,17 @@ AC_CHECK_FUNCS(getgrgid getpwuid) 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], @@ -412,9 +446,7 @@ static float foo = NAN; ) 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 @@ -440,9 +472,7 @@ static float foo = NAN; ) 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 @@ -453,6 +483,9 @@ if test "x$nan_type" = "xnone"; then [[ #include #include +#ifdef NAN +# undef NAN +#endif #define NAN (0.0 / 0.0) #ifndef isnan # define isnan(f) ((f) != (f)) @@ -471,14 +504,22 @@ static float foo = NAN; ) 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) @@ -625,6 +666,15 @@ AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], #endif ]) +AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime], + [], + [], + [ +#if HAVE_KSTAT_H +# include +#endif + ]) + AC_MSG_CHECKING([for kernel type ($host_os)]) case $host_os in *linux*) @@ -734,12 +784,9 @@ then fi if test "x$with_kstat" = "xyes" then - collect_kstat=1 -else - collect_kstat=0 + AC_DEFINE(HAVE_LIBKSTAT, 1, + [Define to 1 if you have the 'kstat' library (-lkstat)]) fi -AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat], - [Wether or not to use kstat library (Solaris)]) AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes") AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes") @@ -954,6 +1001,53 @@ 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" +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" @@ -1043,6 +1137,63 @@ AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap], [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 +], +[ + with_libperl="yes" +]) +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS=$CFLAGS + SAVE_LDFLAGS=$LDFLAGS + 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], + AC_LINK_IFELSE( + AC_LANG_PROGRAM( + [[ +#include +#include +#include + ]], + [[ + PerlInterpreter *perl = NULL; + Perl_load_module (perl, PERL_LOADMOD_NOIMPORT, + newSVpv ("Collectd::Plugin::FooBar", 24), + Nullsv); + ]]), + [have_libperl="yes"], + [have_libperl="no"] + ) + ) + + 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 + + CFLAGS=$SAVE_CFLAGS + LDFLAGS=$SAVE_LDFLAGS +fi +AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") + AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" @@ -1082,6 +1233,34 @@ else fi AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") +AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libupsclient="yes" + fi +], +[ + with_libupsclient="yes" +]) +if test "x$with_libupsclient" = "xyes" +then + 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)"]) +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 header file.]) + ], [with_libupsclient="no (upsclient.h not found)"]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes") + # Check for enabled/disabled features # @@ -1178,6 +1357,8 @@ AC_COLLECTD([mysql], [disable], [module], [mysql statistics]) AC_COLLECTD([network], [disable], [module], [network functionality]) AC_COLLECTD([nfs], [disable], [module], [nfs statistics]) AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics]) +AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics]) +AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter]) AC_COLLECTD([ping], [disable], [module], [ping statistics]) AC_COLLECTD([processes], [disable], [module], [processes statistics]) AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics]) @@ -1193,25 +1374,35 @@ AC_COLLECTD([wireless], [disable], [module], [wireless link statistics]) AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile) +if test "x$with_libperl" = "xyes" +then + with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)" +else + enable_perl="no (needs libperl)" +fi + cat <