Skip to contentSkip to conversation

Fix static build

PATCH New Thomas Koeller 1 participant 1 message Aug 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix static build

I tried a statically-linked build of LVM2.2.02.86 on Linux 3.0 x86_64 using glibc 2.14, binutils 2.21.1, gcc 4.6.1. The linking step failed because of "-Wl,--export-dynamic" being present in LDFLAGS. This patch fixes it:

configure.in +6 -1
@@ -34,7 +34,7 @@ case "$host_os" in
 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
 		CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
 		LDDEPS="$LDDEPS .export.sym"
-		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+		DYNAMIC_LDFLAGS="-Wl,--export-dynamic"
 		LIB_SUFFIX=so
 		DEVMAPPER=yes
 		ODIRECT=yes
@@ -49,6 +49,7 @@ case "$host_os" in
 		CLDFLAGS="$CLDFLAGS"
 		CLDWHOLEARCHIVE="-all_load"
 		CLDNOWHOLEARCHIVE=
+		DYNAMIC_LDFLAGS=
 		LIB_SUFFIX=dylib
 		DEVMAPPER=yes
 		ODIRECT=no
@@ -153,6 +154,10 @@ AC_ARG_ENABLE(static_link,
 	      STATIC_LINK=$enableval, STATIC_LINK=no)
 AC_MSG_RESULT($STATIC_LINK)
 
+if test "$STATIC_LINK" != "yes"; then
+	LDFLAGS="$LDFLAGS $DYNAMIC_LDFLAGS"
+fi
+
 ################################################################################
 dnl -- Prefix is /usr by default, the exec_prefix default is setup later
 AC_PREFIX_DEFAULT(/usr)

Thomas