commit 55da987650b36a1b910a5968f7d83a190827f8bb Author: Theodore Ts'o Date: Tue Sep 2 23:12:38 2008 -0400 Improve ELF shared library handling Pass in -rpath-link option to the linker so that blkid will build correctly on systems that don't have libcom_err.so.2 installed. Fix debugfs to only try to link with -ldl when building without shared libraries; with ELF shared libraries, the library which requires -ldl (libss.so) can required the library dependency itself. Fix how we build tune2fs.static so that we use @LDFLAG_STATIC@, via $(LDFLAGS_STATIC), instead of hard-coding the use of -static. Addresses-Sourceforge-Bug: #2088537 Signed-off-by: "Theodore Ts'o" diff --git a/MCONFIG.in b/MCONFIG.in index 554b5b5..2f32b92 100644 --- a/MCONFIG.in +++ b/MCONFIG.in @@ -41,7 +41,8 @@ INTL_FLAGS = @INTL_FLAGS@ ALL_CFLAGS = $(CPPFLAGS) $(DEFS) $(USE_WFLAGS) $(CFLAGS) $(XTRA_CFLAGS) \ $(INTL_FLAGS) $(LINUX_INCLUDE) LDFLAGS = @LDFLAGS@ -ALL_LDFLAGS = $(LDFLAGS) +ALL_LDFLAGS = $(LDFLAGS) @LDFLAG_DYNAMIC@ +LDFLAGS_STATIC = $(LDFLAGS) @LDFLAG_STATIC@ BUILD_CFLAGS = @BUILD_CFLAGS@ BUILD_LDFLAGS = @BUILD_LDFLAGS@ RM = @RM@ @@ -69,7 +70,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ # Library definitions # LIB = $(top_builddir)/lib -LIBSS = $(LIB)/libss@LIB_EXT@ @DLOPEN_LIB@ +LIBSS = $(LIB)/libss@LIB_EXT@ @PRIVATE_LIBS_CMT@ @DLOPEN_LIB@ LIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@ LIBE2P = $(LIB)/libe2p@LIB_EXT@ LIBEXT2FS = $(LIB)/libext2fs@LIB_EXT@ diff --git a/configure b/configure index 5cf203e..0e3bdbe 100755 --- a/configure +++ b/configure @@ -684,6 +684,8 @@ CHECKER_CMT LIB_EXT STATIC_LIB_EXT PROFILED_LIB_EXT +LDFLAG_DYNAMIC +PRIVATE_LIBS_CMT TEST_IO_CMT DEBUGFS_CMT IMAGER_CMT @@ -3842,6 +3844,8 @@ fi E2_PKG_CONFIG_STATIC=--static +LDFLAG_DYNAMIC= +PRIVATE_LIBS_CMT= # Check whether --enable-elf-shlibs was given. if test "${enable_elf_shlibs+set}" = set; then enableval=$enable_elf_shlibs; if test "$enableval" = "no" @@ -3861,6 +3865,8 @@ else esac BINARY_TYPE=elfbin LIB_EXT=.so + PRIVATE_LIBS_CMT=# + LDFLAG_DYNAMIC='-Wl,-rpath-link,$(top_builddir)/lib' { echo "$as_me:$LINENO: result: Enabling ELF shared libraries" >&5 echo "${ECHO_T}Enabling ELF shared libraries" >&6; } fi @@ -3962,6 +3968,8 @@ fi + + # Check whether --enable-jbd-debug was given. if test "${enable_jbd_debug+set}" = set; then enableval=$enable_jbd_debug; if test "$enableval" = "no" @@ -15902,8 +15910,8 @@ CHECKER_CMT!$CHECKER_CMT$ac_delim LIB_EXT!$LIB_EXT$ac_delim STATIC_LIB_EXT!$STATIC_LIB_EXT$ac_delim PROFILED_LIB_EXT!$PROFILED_LIB_EXT$ac_delim -TEST_IO_CMT!$TEST_IO_CMT$ac_delim -DEBUGFS_CMT!$DEBUGFS_CMT$ac_delim +LDFLAG_DYNAMIC!$LDFLAG_DYNAMIC$ac_delim +PRIVATE_LIBS_CMT!$PRIVATE_LIBS_CMT$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then @@ -15977,6 +15985,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +TEST_IO_CMT!$TEST_IO_CMT$ac_delim +DEBUGFS_CMT!$DEBUGFS_CMT$ac_delim IMAGER_CMT!$IMAGER_CMT$ac_delim RESIZER_CMT!$RESIZER_CMT$ac_delim FSCK_PROG!$FSCK_PROG$ac_delim @@ -16060,7 +16070,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 83; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -16508,4 +16518,3 @@ if test "$no_create" != yes; then fi if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi - diff --git a/configure.in b/configure.in index fcca2ac..7ec6945 100644 --- a/configure.in +++ b/configure.in @@ -211,6 +211,8 @@ dnl dnl This needs to be before all of the --enable-*-shlibs options dnl E2_PKG_CONFIG_STATIC=--static +LDFLAG_DYNAMIC= +PRIVATE_LIBS_CMT= dnl dnl handle --enable-elf-shlibs dnl @@ -232,6 +234,8 @@ else esac] BINARY_TYPE=elfbin LIB_EXT=.so + PRIVATE_LIBS_CMT=# + LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib'] AC_MSG_RESULT([Enabling ELF shared libraries]) fi , @@ -322,6 +326,8 @@ dnl AC_SUBST(LIB_EXT) AC_SUBST(STATIC_LIB_EXT) AC_SUBST(PROFILED_LIB_EXT) +AC_SUBST(LDFLAG_DYNAMIC) +AC_SUBST(PRIVATE_LIBS_CMT) dnl dnl handle --enable-jbd-debug dnl @@ -921,4 +927,3 @@ for i in MCONFIG Makefile e2fsprogs.spec \ done AC_OUTPUT($outlist) if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi - diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in index 7006b62..fe0fab5 100644 --- a/e2fsck/Makefile.in +++ b/e2fsck/Makefile.in @@ -8,7 +8,6 @@ VPATH = @srcdir@ top_builddir = .. my_dir = e2fsck INSTALL = @INSTALL@ -LDFLAG_STATIC = @LDFLAG_STATIC@ @MCONFIG@ @@ -119,8 +118,7 @@ e2fsck: $(OBJS) $(DEPLIBS) e2fsck.static: $(OBJS) $(STATIC_DEPLIBS) @echo " LD $@" - @$(LD) $(ALL_LDFLAGS) $(LDFLAG_STATIC) -o e2fsck.static $(OBJS) \ - $(STATIC_LIBS) + @$(LD) $(LDFLAGS_STATIC) -o e2fsck.static $(OBJS) $(STATIC_LIBS) e2fsck.profiled: $(PROFILED_OBJS) $(PROFILED_DEPLIBS) @echo " LD $@" diff --git a/misc/Makefile.in b/misc/Makefile.in index a81df8a..c208571 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -108,7 +108,7 @@ tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBS_BLKID) tune2fs.static: $(TUNE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBBLKID) @echo " LD $@" - @$(CC) $(ALL_LDFLAGS) -static -o tune2fs.static $(TUNE2FS_OBJS) \ + @$(CC) $(LDFLAGS_STATIC) -o tune2fs.static $(TUNE2FS_OBJS) \ $(STATIC_LIBS) $(STATIC_LIBBLKID) $(STATIC_LIBUUID) \ $(STATIC_LIBE2P) $(LIBINTL)