mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@yahoo.com> Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Luis R. Rodriguez <mcgrof@do-not-panic.com> Cc: Mark Pryor <tlviewer@yahoo.com> [ ijc -- reran autogen.sh as requested ]
This commit is contained in:
1 parent
f688aec47c
commit
e6c3d371d4
2 files changed
+64
-101
No files matched your search
+2
-10
@@ -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
|
||||
|
||||
Vendored
+62
-91
@@ -8663,53 +8663,77 @@ 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
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5
|
||||
$as_echo_n "checking for SYSTEMD... " >&6; }
|
||||
|
||||
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_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lsystemd-daemon $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* 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
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
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
|
||||
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
|
||||
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"
|
||||
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 $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_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
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
if test "x$enable_systemd" != "xno"; then :
|
||||
@@ -8721,59 +8745,6 @@ $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
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lsystemd-daemon $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* 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
|
||||
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"
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "x$libsystemddaemon" = x; then :
|
||||
|
||||
as_fn_error $? "Unable to find a suitable libsystemd-daemon library" "$LINENO" 5
|
||||
|
||||
fi
|
||||
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5
|
||||
|
||||