X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=configure.ac;h=b78dd11bf5ce77841ec17cfd2436fce6d8c9c89b;hb=a3000cbe3a12163148a28c818269bbdabda1cf5c;hp=11c113491a1a2682ec965b6a41b7eb6acde3e15c;hpb=619cdcd8fb748ee06056fa4ef63dac7f24c7db1f;p=collectd.git diff --git a/configure.ac b/configure.ac index 11c11349..b78dd11b 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,11 @@ AC_CONFIG_SRCDIR(src/collectd.c) AC_CONFIG_HEADERS(src/config.h) AC_CONFIG_AUX_DIR([libltdl/config]) +dnl older automake's default of ARFLAGS=cru is noisy on newer binutils; +dnl we don't really need the 'u' even in older toolchains. Then there is +dnl older libtool, which spelled it AR_FLAGS +m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"]) + m4_ifdef([LT_PACKAGE_VERSION], # libtool >= 2.2 [ @@ -24,6 +29,8 @@ m4_ifdef([LT_PACKAGE_VERSION], ] ) +AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"]) + AM_INIT_AUTOMAKE([tar-pax dist-bzip2 foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_LANG(C) @@ -37,6 +44,7 @@ AC_SYS_LARGEFILE # AC_PROG_CC AC_PROG_CPP +AC_PROG_EGREP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET @@ -47,15 +55,42 @@ AC_DISABLE_STATIC AC_PROG_LIBTOOL AC_PROG_LEX AC_PROG_YACC + +# Warn when pkg.m4 is missing +m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) + PKG_PROG_PKG_CONFIG +AC_CACHE_CHECK([if bison is the parser generator], + [collectd_cv_prog_bison], + [AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '], + [collectd_cv_prog_bison=yes], [collectd_cv_prog_bison=no] + )] +) + +if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/src/liboconfig/parser.c" +then + AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison]) +fi + AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no]) -AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h], - [have_protobuf_c_h="yes"], - [have_protobuf_c_h="no"]) -if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes" +if test "x$have_protoc_c" = "xno" then - have_protoc_c="no (unable to find )" + have_protoc_c="no (protoc-c compiler not found)" +fi + +if test "x$have_protoc_c" = "xyes" +then + AC_CHECK_HEADERS([protobuf-c/protobuf-c.h google/protobuf-c/protobuf-c.h], + [have_protoc_c="yes"; break], + [have_protoc_c="no ( not found)"]) +fi +if test "x$have_protoc_c" = "xyes" +then + AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack], + [have_protoc_c="yes"], + [have_protoc_c="no (libprotobuf-c not found)"]) + fi AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes") @@ -276,7 +311,32 @@ AC_CHECK_HEADERS(netinet/udp.h, [], [], #endif ]) -AC_CHECK_TYPES([struct ip6_ext], [], [], +have_ip6_ext="no" +AC_CHECK_TYPES([struct ip6_ext], [have_ip6_ext="yes"], [have_ip6_ext="no"], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP6_H +# include +#endif +]) + +if test "x$have_ip6_ext" = "xno"; then + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -DSOLARIS2=8" + + AC_CHECK_TYPES([struct ip6_ext], + [have_ip6_ext="yes, with -DSOLARIS2=8"], + [have_ip6_ext="no"], [#if HAVE_STDINT_H # include #endif @@ -294,6 +354,11 @@ AC_CHECK_TYPES([struct ip6_ext], [], [], #endif ]) + if test "x$have_ip6_ext" = "xno"; then + CFLAGS="$SAVE_CFLAGS" + fi +fi + # For cpu modules AC_CHECK_HEADERS(sys/dkstat.h) if test "x$ac_system" = "xDarwin" @@ -536,7 +601,33 @@ AC_CHECK_HEADERS(linux/un.h, [], [], #endif ]) -AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h) +AC_CHECK_HEADERS([ \ + ctype.h \ + fs_info.h \ + fshelp.h \ + grp.h \ + kvm.h \ + limits.h \ + mntent.h \ + mnttab.h \ + paths.h \ + pwd.h \ + sys/fs_types.h \ + sys/fstyp.h \ + sys/mntent.h \ + sys/mnttab.h \ + sys/statfs.h \ + sys/statvfs.h \ + sys/un.h \ + sys/vfs.h \ + sys/vfstab.h \ + wordexp.h \ +]) + +AC_CHECK_HEADERS([xfs/xqm.h], [], [], +[ +#define _GNU_SOURCE +]) # For the dns plugin AC_CHECK_HEADERS(arpa/nameser.h) @@ -578,34 +669,6 @@ AC_CHECK_HEADERS(netinet/if_ether.h, [], [], AC_CHECK_HEADERS(netinet/ip_compat.h) -AC_CHECK_MEMBER([struct ip6_ext.ip6e_len], [], -[ -# Solaris needs special definition to have ip6_ext defined - # Invalidate cache so we can retest - AS_UNSET([ac_cv_member_struct_ip6_ext_ip6e_len]) - - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -DSOLARIS2=8" - AC_CHECK_MEMBER([struct ip6_ext.ip6e_len],[c_cv_ip6_ext_needs_d_solaris2_8=yes], [], -[[#if HAVE_NETINET_IP_COMPAT_H -# include -#endif -]]) - CFLAGS="$SAVE_CFLAGS" -],[[#if HAVE_NETINET_IP_COMPAT_H -# include -#endif -]]) - -AC_MSG_CHECKING([if struct ip6_ext.ip6e_len reauired -DSOLARIS2=8]) -if test "x$c_cv_ip6_ext_needs_d_solaris2_8" = "xyes" -then - AC_MSG_RESULT([yes]) - CFLAGS="$CFLAGS -DSOLARIS2=8" -else - AC_MSG_RESULT([no]) -fi - have_net_pfvar_h="no" AC_CHECK_HEADERS(net/pfvar.h, [have_net_pfvar_h="yes"], @@ -620,6 +683,9 @@ AC_CHECK_HEADERS(net/pfvar.h, #if HAVE_NET_IF_H # include #endif +#if HAVE_NETINET_IN_H +# include +#endif ]) # For the multimeter plugin @@ -1186,6 +1252,8 @@ have_getvfsstat="no" AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"]) have_listmntent="no" AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"]) +have_getmntent_r="no" +AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"]) have_getmntent="no" AC_CHECK_FUNCS(getmntent, [have_getmntent="c"]) @@ -1356,6 +1424,7 @@ AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc], AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], [#define _BSD_SOURCE +#define _DEFAULT_SOURCE #if HAVE_STDINT_H # include #endif @@ -1377,6 +1446,7 @@ AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], ]) AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], [#define _BSD_SOURCE +#define _DEFAULT_SOURCE #if HAVE_STDINT_H # include #endif @@ -1840,30 +1910,33 @@ AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Pat GANGLIA_LDFLAGS="-L$withval/lib" with_libganglia="yes" else - with_libganglia_config="ganglia-config" with_libganglia="$withval" fi; fi; fi ], [ - with_libganglia_config="ganglia-config" with_libganglia="yes" ]) -if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x" +if test "x$with_libganglia" = "xyes" then - if test "x$GANGLIA_CPPFLAGS" = "x" + if test "x$with_libganglia_config" != "x" then - GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null` - fi + if test "x$GANGLIA_CPPFLAGS" = "x" + then + GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null` + fi - if test "x$GANGLIA_LDFLAGS" = "x" - then - GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null` - fi + if test "x$GANGLIA_LDFLAGS" = "x" + then + GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null` + fi - if test "x$GANGLIA_LIBS" = "x" - then - GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null` + if test "x$GANGLIA_LIBS" = "x" + then + GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null` + fi + else + GANGLIA_LIBS="-lganglia" fi fi @@ -1935,12 +2008,6 @@ then GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null` fi - if test "x$GCRYPT_LDFLAGS" = "x" - then - gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null` - GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib" - fi - if test "x$GCRYPT_LIBS" = "x" then GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null` @@ -1949,8 +2016,10 @@ fi SAVE_CPPFLAGS="$CPPFLAGS" SAVE_LDFLAGS="$LDFLAGS" +SAVE_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS" LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS" +LIBS="$LIBS $GCRYPT_LIBS" if test "x$with_libgcrypt" = "xyes" then @@ -1965,10 +2034,6 @@ fi if test "x$with_libgcrypt" = "xyes" then - if test "x$GCRYPT_LDFLAGS" != "x" - then - AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS]) - fi AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer, [with_libgcrypt="yes"], [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"]) @@ -1982,6 +2047,7 @@ fi CPPFLAGS="$SAVE_CPPFLAGS" LDFLAGS="$SAVE_LDFLAGS" +LIBS="$SAVE_LIBS" if test "x$with_libgcrypt" = "xyes" then @@ -2164,7 +2230,7 @@ then fi AC_MSG_CHECKING([for libjvm.so]) - TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then AC_MSG_RESULT([found in $TMPVAR]) @@ -2454,7 +2520,7 @@ then SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" - AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"]) + AC_CHECK_HEADERS(modbus.h, [], [with_libmodbus="no (modbus.h not found)"]) CPPFLAGS="$SAVE_CPPFLAGS" fi @@ -2573,7 +2639,7 @@ AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to ]) if test "x$with_libmysql" = "xyes" then - with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` + with_mysql_cflags=`$with_mysql_config --include 2>/dev/null` mysql_config_status=$? if test $mysql_config_status -ne 0 @@ -2609,15 +2675,17 @@ then then with_libmysql="no ($with_mysql_config failed)" else - AC_CHECK_LIB(mysqlclient, mysql_init, - [with_libmysql="yes"], - [with_libmysql="no (symbol 'mysql_init' not found)"], - [$with_mysql_libs]) - - AC_CHECK_LIB(mysqlclient, mysql_get_server_version, + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_mysql_cflags" + SAVE_LIBS="$LIBS" + LIBS="$with_mysql_libs" + AC_SEARCH_LIBS([mysql_get_server_version], + [], [with_libmysql="yes"], [with_libmysql="no (symbol 'mysql_get_server_version' not found)"], - [$with_mysql_libs]) + []) + CPPFLAGS="$SAVE_CPPFLAGS" + LIBS="$SAVE_LIBS" fi fi if test "x$with_libmysql" = "xyes" @@ -3128,11 +3196,6 @@ then fi if test "x$with_libpcap" = "xyes" then - AC_CHECK_HEADERS(pcap-bpf.h,, - [with_libpcap="no (pcap-bpf.h not found)"]) -fi -if test "x$with_libpcap" = "xyes" -then AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP], [c_cv_libpcap_have_pcap_error_iface_not_up], AC_COMPILE_IFELSE([AC_LANG_PROGRAM( @@ -3743,76 +3806,102 @@ AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes") # }}} # --with-librrd {{{ -# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) librrd_cflags="" librrd_ldflags="" -librrd_threadsafe="yes" +librrd_threadsafe="no" librrd_rrdc_update="no" -AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])], -[ if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - librrd_cflags="-I$withval/include" - librrd_ldflags="-L$withval/lib" - with_librrd="yes" - else - with_librrd="$withval" - fi -], [with_librrd="yes"]) +AC_ARG_WITH(librrd, + [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])], + [ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + librrd_cflags="-I$withval/include" + librrd_ldflags="-L$withval/lib" + with_librrd="yes" + else + with_librrd="$withval" + fi + ], + [with_librrd="yes"] +) + if test "x$with_librrd" = "xyes" then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $librrd_ldflags" + PKG_CHECK_MODULES([RRD], [librrd >= 1.6.0], + [ + AC_CHECK_LIB([rrd], [rrd_update_r], + [librrd_threadsafe="yes"], + [:] + ) + AC_CHECK_LIB([rrd], [rrdc_update], + [librrd_rrdc_update="yes"], + [:] + ) + ],[:] + ) + LDFLAGS="$SAVE_LDFLAGS" - CPPFLAGS="$CPPFLAGS $librrd_cflags" - LDFLAGS="$LDFLAGS $librrd_ldflags" + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $RRD_CFLAGS $librrd_cflags" - AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"]) + AC_CHECK_HEADERS([rrd.h],, [with_librrd="no (rrd.h not found)"]) - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" fi -if test "x$with_librrd" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $librrd_cflags" - LDFLAGS="$LDFLAGS $librrd_ldflags" +if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno" +then + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $librrd_ldflags" - AC_CHECK_LIB(rrd_th, rrd_update_r, - [with_librrd="yes" - librrd_ldflags="$librrd_ldflags -lrrd_th -lm" - ], - [librrd_threadsafe="no" - AC_CHECK_LIB(rrd, rrd_update, - [with_librrd="yes" - librrd_ldflags="$librrd_ldflags -lrrd -lm" - ], - [with_librrd="no (symbol 'rrd_update' not found)"], - [-lm]) - ], - [-lm]) + AC_CHECK_LIB([rrd_th], [rrd_update_r], + [ + librrd_ldflags="$librrd_ldflags -lrrd_th" + librrd_threadsafe="yes" + AC_CHECK_LIB([rrd_th], [rrdc_update], + [librrd_rrdc_update="yes"], + [:], + ) + ], + [:] + ) + LDFLAGS="$SAVE_LDFLAGS" +fi - if test "x$librrd_threadsafe" = "xyes" - then - AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) - else - AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) - fi +if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno" +then + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $librrd_ldflags" - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" + AC_CHECK_LIB([rrd], [rrd_update], + [ + librrd_ldflags="$librrd_ldflags -lrrd" + AC_CHECK_LIB([rrd], [rrdc_update], + [librrd_rrdc_update="yes"], + [:] + ) + ], + [with_librrd="no (symbol 'rrd_update' not found)"] + ) + LDFLAGS="$SAVE_LDFLAGS" fi + if test "x$with_librrd" = "xyes" then - BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags" - BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags" - AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS) - AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS) + BUILD_WITH_LIBRRD_CFLAGS="$RRD_CFLAGS $librrd_cflags" + BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags" + BUILD_WITH_LIBRRD_LIBS="$RRD_LIBS" + AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS) + AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBRRD_LIBS) fi if test "x$librrd_threadsafe" = "xyes" then - AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).]) + AC_DEFINE([HAVE_THREADSAFE_LIBRRD], [1], + [Define to 1 if the rrd library is thread-safe] + ) fi # }}} @@ -5093,6 +5182,11 @@ then plugin_df="yes" fi +if test "x$c_cv_have_getmntent_r" = "xyes" +then + plugin_df="yes" +fi + # Df plugin: Check if we have either `statfs' or `statvfs' second. if test "x$plugin_df" = "xyes" then