Imported Upstream version 2.6.2

This commit is contained in:
Arnaud Quette 2011-09-29 20:14:46 +02:00
parent a367d9bc54
commit 45043b58d0
246 changed files with 18228 additions and 1415 deletions

78
m4/nut_check_libavahi.m4 Normal file
View file

@ -0,0 +1,78 @@
dnl Check for LIBAVAHI compiler flags. On success, set nut_have_neon="yes"
dnl and set LIBAVAHI_CFLAGS and LIBAVAHI_LIBS. On failure, set
dnl nut_have_avahi="no". This macro can be run multiple times, but will
dnl do the checking only once.
AC_DEFUN([NUT_CHECK_LIBAVAHI],
[
if test -z "${nut_have_avahi_seen}"; then
nut_have_avahi_seen=yes
dnl save CFLAGS and LIBS
CFLAGS_ORIG="${CFLAGS}"
LIBS_ORIG="${LIBS}"
dnl See which version of the avahi library (if any) is installed
AC_MSG_CHECKING(for avahi-core version via pkg-config (0.6.30 minimum required))
AVAHI_CORE_VERSION="`pkg-config --silence-errors --modversion avahi-core 2>/dev/null`"
if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then
AVAHI_CORE_VERSION="none"
fi
AC_MSG_RESULT(${AVAHI_CORE_VERSION} found)
AC_MSG_CHECKING(for avahi-client version via pkg-config (0.6.30 minimum required))
AVAHI_CLIENT_VERSION="`pkg-config --silence-errors --modversion avahi-client 2>/dev/null`"
if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then
AVAHI_CLIENT_VERSION="none"
fi
AC_MSG_RESULT(${AVAHI_CLIENT_VERSION} found)
AC_MSG_CHECKING(for avahi cflags)
AC_ARG_WITH(avahi-includes,
AS_HELP_STRING([@<:@--with-avahi-includes=CFLAGS@:>@], [include flags for the avahi library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-avahi-includes - see docs/configure.txt)
;;
*)
CFLAGS="${withval}"
;;
esac
], [CFLAGS="`pkg-config --silence-errors --cflags avahi-core avahi-client 2>/dev/null`"])
AC_MSG_RESULT([${CFLAGS}])
AC_MSG_CHECKING(for avahi ldflags)
AC_ARG_WITH(avahi-libs,
AS_HELP_STRING([@<:@--with-avahi-libs=LIBS@:>@], [linker flags for the avahi library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-avahi-libs - see docs/configure.txt)
;;
*)
LIBS="${withval}"
;;
esac
], [LIBS="`pkg-config --silence-errors --libs avahi-core avahi-client 2>/dev/null`"])
AC_MSG_RESULT([${LIBS}])
dnl check if avahi-core is usable
AC_CHECK_HEADERS(avahi-common/malloc.h, [nut_have_avahi=yes], [nut_have_avahi=no], [AC_INCLUDES_DEFAULT])
AC_CHECK_FUNCS(avahi_free, [], [nut_have_avahi=no])
if test "${nut_have_avahi}" = "yes"; then
dnl check if avahi-client is usable
AC_CHECK_HEADERS(avahi-client/client.h, [nut_have_avahi=yes], [nut_have_avahi=no], [AC_INCLUDES_DEFAULT])
AC_CHECK_FUNCS(avahi_client_new, [], [nut_have_avahi=no])
if test "${nut_have_avahi}" = "yes"; then
LIBAVAHI_CFLAGS="${CFLAGS}"
LIBAVAHI_LIBS="${LIBS}"
fi
fi
dnl restore original CFLAGS and LIBS
CFLAGS="${CFLAGS_ORIG}"
LIBS="${LIBS_ORIG}"
fi
])

View file

@ -0,0 +1,85 @@
dnl Check for FreeIPMI (LIBFREEIPMI) compiler flags. On success, set
dnl nut_have_freeipmi="yes" and nut_ipmi_lib="FreeIPMI", and define WITH_IPMI,
dnl WITH_FREEIPMI, LIBIPMI_CFLAGS and LIBIPMI_LIBS. On failure, set
dnl nut_have_freeipmi="no".
dnl This macro can be run multiple times, but will do the checking only once.
AC_DEFUN([NUT_CHECK_LIBFREEIPMI],
[
if test -z "${nut_have_libfreeipmi_seen}"; then
nut_have_libfreeipmi_seen=yes
dnl save CFLAGS and LIBS
CFLAGS_ORIG="${CFLAGS}"
LIBS_ORIG="${LIBS}"
AC_MSG_CHECKING(for FreeIPMI version via pkg-config)
dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011
dnl but NUT should only require 0.8.5 or 1.0.1 (comment from upstream Al Chu)
FREEIPMI_VERSION="`pkg-config --silence-errors --modversion libfreeipmi 2>/dev/null`"
if test "$?" = "0" -a -n "${FREEIPMI_VERSION}"; then
CFLAGS="`pkg-config --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`"
LIBS="`pkg-config --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`"
else
FREEIPMI_VERSION="none"
CFLAGS=""
LIBS="-lfreeipmi -lipmimonitoring"
fi
AC_MSG_RESULT(${FREEIPMI_VERSION} found)
dnl allow overriding FreeIPMI settings if the user knows best
AC_MSG_CHECKING(for FreeIPMI cflags)
AC_ARG_WITH(freeipmi-includes,
AS_HELP_STRING([@<:@--with-freeipmi-includes=CFLAGS@:>@], [include flags for the FreeIPMI library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-freeipmi-includes - see docs/configure.txt)
;;
*)
CFLAGS="${withval}"
;;
esac
], [])
AC_MSG_RESULT([${CFLAGS}])
AC_MSG_CHECKING(for FreeIPMI ldflags)
AC_ARG_WITH(freeipmi-libs,
AS_HELP_STRING([@<:@--with-freeipmi-libs=LIBS@:>@], [linker flags for the FreeIPMI library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-freeipmi-libs - see docs/configure.txt)
;;
*)
LIBS="${withval}"
;;
esac
], [])
AC_MSG_RESULT([${LIBS}])
dnl check if freeipmi is usable with our current flags
AC_CHECK_HEADERS(freeipmi/freeipmi.h, [nut_have_freeipmi=yes], [nut_have_freeipmi=no], [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS(ipmi_monitoring.h, [], [nut_have_freeipmi=no], [AC_INCLUDES_DEFAULT])
AC_SEARCH_LIBS([ipmi_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
dnl when version cannot be tested (prior to 1.0.5, with no pkg-config)
dnl we have to check for some specific functions
AC_SEARCH_LIBS([ipmi_ctx_find_inband], [freeipmi], [], [nut_have_freeipmi=no])
AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
AC_SEARCH_LIBS([ipmi_monitoring_init], [ipmimonitoring], [], [nut_have_freeipmi=no])
if test "${nut_have_freeipmi}" = "yes"; then
nut_with_ipmi="yes"
nut_ipmi_lib="(FreeIPMI)"
nut_have_libipmi="yes"
AC_DEFINE(WITH_IPMI, 1, [Define to enable IPMI support])
AC_DEFINE(WITH_FREEIPMI, 1, [Define to enable IPMI support using FreeIPMI])
LIBIPMI_CFLAGS="${CFLAGS}"
LIBIPMI_LIBS="${LIBS}"
fi
dnl restore original CFLAGS and LIBS
CFLAGS="${CFLAGS_ORIG}"
LIBS="${LIBS_ORIG}"
fi
])

View file

@ -44,6 +44,7 @@ AC_DEFUN_ONCE([NUT_OS_FUNCTIONS],
AC_DEFUN([NUT_CHECK_OS],
[
m4_pattern_allow([^PKG_TARGET$])
# Look for all possible source of OS name resolution
# 1) we look for a LSB release info file
eval "dist_search_path=\"

View file

@ -5,7 +5,8 @@ AC_DEFUN([NUT_REPORT],
nut_report_feature_flag="1"
ac_clean_files="${ac_clean_files} conf_nut_report_feature"
echo > conf_nut_report_feature
echo -e "Configuration summary:\n======================" >> conf_nut_report_feature
echo "Configuration summary:" >> conf_nut_report_feature
echo "======================" >> conf_nut_report_feature
fi
echo "$1: $2" >> conf_nut_report_feature
])