[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] build-system fixes for --enable-static



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 08/08/13 11:57 AM, Ian Stakenvicius wrote:
> The following patch fixes missing LDFLAGS from dependent packages
> when building lvm2 statically.  It also adjusts the build system
> for libselinux CFLAGS/LIBS, to attempt to grab them from pkg-config
> first.
> 


err.. oops. the first two lines of that file is cruft, please ignore
when evaluating the patch.  A cleaner attachment is below.  Sorry for
the second email.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iF4EAREIAAYFAlIDwPEACgkQ2ugaI38ACPCdaQD/bEHVd/Pdtvyd/YwW3pZCHqrN
qZbPHAVyhWtH23daoWgBALv+m+4YKNovLXp4sHJOQYsk9/CMvZ0S7djh2GYgt5OV
=VHZ/
-----END PGP SIGNATURE-----
--- a/configure.in	2013-08-03 21:42:30.204749302 -0500
+++ b/configure.in	2013-08-03 21:45:17.496740871 -0500
@@ -930,9 +930,10 @@
 	if  test x$PKGCONFIG_INIT != x1; then
 		pkg_config_init
 	fi
	PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
+	UDEV_STATIC_LIBS=`$PKG_CONFIG --static --libs libudev`
 	AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
 fi
 
 dnl -- Enable udev rules
 AC_MSG_CHECKING(whether to enable installation of udev rules required for synchronisation)

@@ -1171,29 +1172,42 @@ AC_ARG_ENABLE(selinux,
 	      SELINUX=$enableval)
 AC_MSG_RESULT($SELINUX)
 
 ################################################################################
 dnl -- Check for selinux
 if test x$SELINUX = xyes; then
 	AC_CHECK_LIB([sepol], [sepol_check_context], [
 		AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
-		SELINUX_LIBS="-lsepol"])
+		SEPOL_LIBS="-lsepol"])
 
-	AC_CHECK_LIB([selinux], [is_selinux_enabled], [
-		AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
-		AC_CHECK_HEADERS([selinux/label.h])
-		AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
-		SELINUX_LIBS="-lselinux $SELINUX_LIBS"
+	dnl -- init pkgconfig if required
+	if  test x$PKGCONFIG_INIT != x1; then
+		pkg_config_init
+	fi
+	PKG_CHECK_MODULES(SELINUX, libselinux, [
 		SELINUX_PC="libselinux"
-		HAVE_SELINUX=yes ], [
-		AC_MSG_WARN(Disabling selinux)
-		SELINUX_LIBS=
-		SELINUX_PC=
-		HAVE_SELINUX=no ])
+		SELINUX_STATIC_LIBS=`$PKG_CONFIG --static --libs libselinux`
+		SELINUX_LIBS="$SELINUX_LIBS $SEPOL_LIBS"
+		AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
+	],[
+		dnl -- old non-pkgconfig method, is buggy with static builds
+		AC_CHECK_LIB([selinux], [is_selinux_enabled], [
+			AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
+			AC_CHECK_HEADERS([selinux/label.h])
+			AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
+			SELINUX_LIBS="-lselinux $SEPOL_LIBS"
+			SELINUX_STATIC_LIBS="$SELINUX_LIBS"
+			SELINUX_PC="libselinux"
+			HAVE_SELINUX=yes ], [
+			AC_MSG_WARN(Disabling selinux)
+			SELINUX_LIBS=
+			SELINUX_PC=
+			HAVE_SELINUX=no ])
+	])
 fi
 
 ################################################################################
 dnl -- Check for realtime clock support
 if test x$REALTIME = xyes; then
 	AC_CHECK_LIB(rt, clock_gettime, HAVE_REALTIME=yes, HAVE_REALTIME=no)
 
 	if test x$HAVE_REALTIME = xyes; then
@@ -1588,25 +1601,27 @@ AC_SUBST(QUORUM_LIBS)
 AC_SUBST(RAID)
 AC_SUBST(READLINE_LIBS)
 AC_SUBST(REPLICATORS)
 AC_SUBST(SACKPT_CFLAGS)
 AC_SUBST(SACKPT_LIBS)
 AC_SUBST(SALCK_CFLAGS)
 AC_SUBST(SALCK_LIBS)
 AC_SUBST(SELINUX_LIBS)
+AC_SUBST(SELINUX_STATIC_LIBS)
 AC_SUBST(SELINUX_PC)
 AC_SUBST(SNAPSHOTS)
 AC_SUBST(STATICDIR)
 AC_SUBST(STATIC_LDFLAGS)
 AC_SUBST(STATIC_LINK)
 AC_SUBST(TESTING)
 AC_SUBST(THIN)
 AC_SUBST(THIN_CHECK_CMD)
 AC_SUBST(UDEV_LIBS)
+AC_SUBST(UDEV_STATIC_LIBS)
 AC_SUBST(UDEV_PC)
 AC_SUBST(UDEV_RULES)
 AC_SUBST(UDEV_SYNC)
 AC_SUBST(UDEV_RULE_EXEC_DETECTION)
 AC_SUBST(UDEV_HAS_BUILTIN_BLKID)
 AC_SUBST(CUNIT_LIBS)
 AC_SUBST(CUNIT_CFLAGS)
 AC_SUBST(WRITE_INSTALL)
--- a/make.tmpl.in	2013-08-03 21:42:30.204749302 -0500
+++ b/make.tmpl.in	2013-08-03 22:09:52.017666556 -0500
@@ -27,30 +27,32 @@ GENHTML = @GENHTML@
 LN_S = @LN_S@
 SED = @SED@
 CFLOW_CMD = @CFLOW_CMD@
 AWK = @AWK@
 PYTHON = @PYTHON@
 
 LIBS = @LIBS@
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS)
+STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS)
 DEFS += @DEFS@
 # FIXME set this only where it's needed, not globally?
 CFLAGS += @CFLAGS@ @UDEV_CFLAGS@
 CLDFLAGS += @CLDFLAGS@
 ELDFLAGS += @ELDFLAGS@
 LDDEPS += @LDDEPS@
 LDFLAGS += @LDFLAGS@
 STATIC_LDFLAGS += @STATIC_LDFLAGS@
 LIB_SUFFIX = @LIB_SUFFIX@
 LVMINTERNAL_LIBS = -llvm-internal $(DAEMON_LIBS) $(UDEV_LIBS) $(DL_LIBS)
 DL_LIBS = @DL_LIBS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 READLINE_LIBS = @READLINE_LIBS@
 SELINUX_LIBS = @SELINUX_LIBS@
+SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
 UDEV_LIBS = @UDEV_LIBS@
+UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
 TESTING = @TESTING@
 
 # Setup directory variables
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 udev_prefix = @udev_prefix@

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]