Permalink
Browse files

lib: Make sure -lselinux is used when linking libguestfs.so.

If libselinux was detected, it was not added to the linker command
line.  This still worked (at least on Fedora) because some other
library pulls in the dependency implicitly, possibly libvirt.  However
this broke on Arch:

https://aur.archlinux.org/packages/libguestfs/

Reported by and thanks: Antoni Segura Puimedon.
  • Loading branch information...
1 parent 5959681 commit acce28e8874e08acce0a6cd7a6703043a1e4ec25 @rwmjones rwmjones committed Nov 19, 2013
Showing with 5 additions and 4 deletions.
  1. +3 −3 configure.ac
  2. +1 −1 daemon/Makefile.am
  3. +1 −0 src/Makefile.am
View
@@ -592,17 +592,17 @@ dnl Check for libselinux (optional).
AC_CHECK_HEADERS([selinux/selinux.h])
AC_CHECK_LIB([selinux],[setexeccon],[
have_libselinux="$ac_cv_header_selinux_selinux_h"
- SELINUX_LIB="-lselinux"
+ SELINUX_LIBS="-lselinux"
old_LIBS="$LIBS"
- LIBS="$LIBS $SELINUX_LIB"
+ LIBS="$LIBS $SELINUX_LIBS"
AC_CHECK_FUNCS([setcon getcon])
LIBS="$old_LIBS"
],[have_libselinux=no])
if test "x$have_libselinux" = "xyes"; then
AC_DEFINE([HAVE_LIBSELINUX],[1],[Define to 1 if you have libselinux.])
fi
-AC_SUBST([SELINUX_LIB])
+AC_SUBST([SELINUX_LIBS])
dnl Check for systemtap/DTrace userspace probes (optional).
dnl Since the probe points break under clang, allow this to be disabled.
View
@@ -182,7 +182,7 @@ guestfsd_LDADD = \
$(ACL_LIBS) \
$(CAP_LIBS) \
$(YAJL_LIBS) \
- $(SELINUX_LIB) \
+ $(SELINUX_LIBS) \
$(AUGEAS_LIBS) \
$(HIVEX_LIBS) \
$(SD_JOURNAL_LIBS) \
View
@@ -144,6 +144,7 @@ libguestfs_la_LIBADD = \
libutils.la \
$(PCRE_LIBS) $(MAGIC_LIBS) \
$(LIBVIRT_LIBS) $(LIBXML2_LIBS) \
+ $(SELINUX_LIBS) \
$(YAJL_LIBS) \
../gnulib/lib/libgnu.la \
$(GETADDRINFO_LIB) \

0 comments on commit acce28e

Please sign in to comment.