[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] systemd: use pkg-config to determine systemd library availability
commit e6c3d371d475a10d2ebe9351472a2ec261023d72 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Tue Dec 2 15:11:30 2014 +0000 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Thu Dec 4 12:17:14 2014 +0000 systemd: use pkg-config to determine systemd library availability AC_CHECK_LIB fails on Debian Jessie since the ld flag it generates is incorrect, even in the event systemd library is available. Use PKG_CHECK_MODULES instead. Tested on Debian Jessie and Arch Linux. Reported-by: Mark Pryor <tlviewer@xxxxxxxxx> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Anthony Perard <anthony.perard@xxxxxxxxxx> Cc: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxxxxx> Cc: Mark Pryor <tlviewer@xxxxxxxxx> [ ijc -- reran autogen.sh as requested ] --- m4/systemd.m4 | 12 +---- tools/configure | 149 ++++++++++++++++++++++--------------------------------- 2 files changed, 62 insertions(+), 99 deletions(-) diff --git a/m4/systemd.m4 b/m4/systemd.m4 index a832d59..b04964b 100644 --- a/m4/systemd.m4 +++ b/m4/systemd.m4 @@ -42,13 +42,6 @@ AC_DEFUN([AX_ALLOW_SYSTEMD_OPTS], [ ]) AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [ - AC_CHECK_HEADER([systemd/sd-daemon.h], [ - AC_CHECK_LIB([systemd-daemon], [sd_listen_fds], [libsystemddaemon="y"]) - ]) - AS_IF([test "x$libsystemddaemon" = x], [ - AC_MSG_ERROR([Unable to find a suitable libsystemd-daemon library]) - ]) - PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon]) dnl pkg-config older than 0.24 does not set these for dnl PKG_CHECK_MODULES() worth also noting is that as of version 208 @@ -98,9 +91,8 @@ AC_DEFUN([AX_CHECK_SYSTEMD], [ ]) AC_DEFUN([AX_CHECK_SYSTEMD_ENABLE_AVAILABLE], [ - AC_CHECK_HEADER([systemd/sd-daemon.h], [ - AC_CHECK_LIB([systemd-daemon], [sd_listen_fds], [systemd="y"]) - ]) + PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon], [systemd="y"], + [systemd="n"]) ]) dnl Enables systemd by default and requires a --disable-systemd option flag diff --git a/tools/configure b/tools/configure index c65ad3a..b0aea0a 100755 --- a/tools/configure +++ b/tools/configure @@ -8663,116 +8663,87 @@ fi - ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-daemon.h" "ac_cv_header_systemd_sd_daemon_h" "$ac_includes_default" -if test "x$ac_cv_header_systemd_sd_daemon_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_listen_fds in -lsystemd-daemon" >&5 -$as_echo_n "checking for sd_listen_fds in -lsystemd-daemon... " >&6; } -if ${ac_cv_lib_systemd_daemon_sd_listen_fds+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsystemd-daemon $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5 +$as_echo_n "checking for SYSTEMD... " >&6; } -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sd_listen_fds (); -int -main () -{ -return sd_listen_fds (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_systemd_daemon_sd_listen_fds=yes +if test -n "$SYSTEMD_CFLAGS"; then + pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-daemon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-daemon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd-daemon" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - ac_cv_lib_systemd_daemon_sd_listen_fds=no + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_daemon_sd_listen_fds" >&5 -$as_echo "$ac_cv_lib_systemd_daemon_sd_listen_fds" >&6; } -if test "x$ac_cv_lib_systemd_daemon_sd_listen_fds" = xyes; then : - systemd="y" +if test -n "$SYSTEMD_LIBS"; then + pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-daemon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-daemon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd-daemon" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes fi - - + else + pkg_failed=untried fi +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - if test "x$enable_systemd" != "xno"; then : - - if test "x$systemd" = "xy" ; then : - - -$as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h - - systemd=y - - ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-daemon.h" "ac_cv_header_systemd_sd_daemon_h" "$ac_includes_default" -if test "x$ac_cv_header_systemd_sd_daemon_h" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_listen_fds in -lsystemd-daemon" >&5 -$as_echo_n "checking for sd_listen_fds in -lsystemd-daemon... " >&6; } -if ${ac_cv_lib_systemd_daemon_sd_listen_fds+:} false; then : - $as_echo_n "(cached) " >&6 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsystemd-daemon $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd-daemon" 2>&1` + else + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd-daemon" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SYSTEMD_PKG_ERRORS" >&5 -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sd_listen_fds (); -int -main () -{ -return sd_listen_fds (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_systemd_daemon_sd_listen_fds=yes + systemd="n" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + systemd="n" else - ac_cv_lib_systemd_daemon_sd_listen_fds=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_daemon_sd_listen_fds" >&5 -$as_echo "$ac_cv_lib_systemd_daemon_sd_listen_fds" >&6; } -if test "x$ac_cv_lib_systemd_daemon_sd_listen_fds" = xyes; then : - libsystemddaemon="y" + SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS + SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + systemd="y" fi -fi + if test "x$enable_systemd" != "xno"; then : + if test "x$systemd" = "xy" ; then : - if test "x$libsystemddaemon" = x; then : - as_fn_error $? "Unable to find a suitable libsystemd-daemon library" "$LINENO" 5 +$as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h -fi + systemd=y pkg_failed=no -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |