From d68a82ecbd617bfa6dfc2038020227566bc21d9a Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 5 Apr 2004 16:29:37 +0000 Subject: [PATCH] Fix shared format1 build. --- configure | 19 +++++++++++++++++-- configure.in | 15 ++++++++++++++- lib/Makefile.in | 2 +- lib/format1/Makefile.in | 2 +- make.tmpl.in | 3 +++ 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 4d0b08b2f..d3305e399 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ #endif" ac_default_prefix=/usr -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS SOFLAG LVM_VERSION DEBUG DEVMAPPER HAVE_LIBDL CMDLIB LOCALEDIR INTL_PACKAGE INTL LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS LD_FLAGS SOFLAG LVM_VERSION DEBUG DEVMAPPER HAVE_LIBDL CMDLIB LOCALEDIR INTL_PACKAGE INTL LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -3885,6 +3885,7 @@ case "$host_os" in CLDWHOLEARCHIVE="-Wl,-whole-archive" CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive" LD_DEPS=".export.sym" + LD_FLAGS="-Wl,--export-dynamic" SOFLAG="-shared" DEVMAPPER=yes ODIRECT=yes ;; @@ -3894,6 +3895,7 @@ case "$host_os" in CLDWHOLEARCHIVE="-all_load" CLDNOWHOLEARCHIVE= LD_DEPS= + LD_FLAGS= SOFLAG="-dynamiclib" DEVMAPPER=no ODIRECT=no ;; @@ -4582,11 +4584,22 @@ else fi -if test x$HAVE_LIBDL = xyes; then +if [ "x$HAVE_LIBDL" = xyes -a "xSTATIC_LINK" = xno ]; then CFLAGS="$CFLAGS -DHAVE_LIBDL" LIBS="-ldl $LIBS" +else + HAVE_LIBDL=no fi +if [ "x$LVM1" = xshared -a "x$STATIC_LINK" = xyes ]; + then { { echo "$as_me:$LINENO: error: Features cannot be \"shared\" when building statically +" >&5 +echo "$as_me: error: Features cannot be \"shared\" when building statically +" >&2;} + { (exit 1); exit 1; }; } + exit +fi; + for ac_header in getopt.h do @@ -4989,6 +5002,7 @@ fi + ac_config_files="$ac_config_files Makefile make.tmpl include/Makefile lib/Makefile lib/format1/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile" @@ -5678,6 +5692,7 @@ s,@CLDFLAGS@,$CLDFLAGS,;t t s,@CLDWHOLEARCHIVE@,$CLDWHOLEARCHIVE,;t t s,@CLDNOWHOLEARCHIVE@,$CLDNOWHOLEARCHIVE,;t t s,@LD_DEPS@,$LD_DEPS,;t t +s,@LD_FLAGS@,$LD_FLAGS,;t t s,@SOFLAG@,$SOFLAG,;t t s,@LVM_VERSION@,$LVM_VERSION,;t t s,@DEBUG@,$DEBUG,;t t diff --git a/configure.in b/configure.in index a5b1a59a5..a2e1ef301 100644 --- a/configure.in +++ b/configure.in @@ -55,6 +55,7 @@ case "$host_os" in CLDWHOLEARCHIVE="-Wl,-whole-archive" CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive" LD_DEPS=".export.sym" + LD_FLAGS="-Wl,--export-dynamic" SOFLAG="-shared" DEVMAPPER=yes ODIRECT=yes ;; @@ -64,6 +65,7 @@ case "$host_os" in CLDWHOLEARCHIVE="-all_load" CLDNOWHOLEARCHIVE= LD_DEPS= + LD_FLAGS= SOFLAG="-dynamiclib" DEVMAPPER=no ODIRECT=no ;; @@ -183,11 +185,21 @@ fi dnl Check for dlopen AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no) -if test x$HAVE_LIBDL = xyes; then +if [[ "x$HAVE_LIBDL" = xyes -a "xSTATIC_LINK" = xno ]]; then CFLAGS="$CFLAGS -DHAVE_LIBDL" LIBS="-ldl $LIBS" +else + HAVE_LIBDL=no fi +dnl Check for shared/static conflicts +if [[ "x$LVM1" = xshared -a "x$STATIC_LINK" = xyes ]]; + then AC_MSG_ERROR( +Features cannot be \"shared\" when building statically +) + exit +fi; + dnl Check for getopt AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG") @@ -246,6 +258,7 @@ AC_SUBST(CLDFLAGS) AC_SUBST(CLDWHOLEARCHIVE) AC_SUBST(CLDNOWHOLEARCHIVE) AC_SUBST(LD_DEPS) +AC_SUBST(LD_FLAGS) AC_SUBST(SOFLAG) AC_SUBST(LIBS) AC_SUBST(LVM_VERSION) diff --git a/lib/Makefile.in b/lib/Makefile.in index 3b5df4db7..4ed7eba0d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -97,7 +97,7 @@ endif LIB_STATIC = liblvm.a -TARGETS = $(LIB_STATIC) +$(SUBDIRS): $(LIB_STATIC) include ../make.tmpl diff --git a/lib/format1/Makefile.in b/lib/format1/Makefile.in index 6b8b92f2b..e046390ec 100644 --- a/lib/format1/Makefile.in +++ b/lib/format1/Makefile.in @@ -25,7 +25,7 @@ SOURCES =\ lvm1-label.c \ vg_number.c -TARGETS = liblvm2format1.so +LIB_SHARED = liblvm2format1.so include ../../make.tmpl diff --git a/make.tmpl.in b/make.tmpl.in index ea4f2417e..a7472db50 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -29,6 +29,7 @@ CLDFLAGS += @CLDFLAGS@ CLDWHOLEARCHIVE += @CLDWHOLEARCHIVE@ CLDNOWHOLEARCHIVE += @CLDNOWHOLEARCHIVE@ LD_DEPS += @LD_DEPS@ +LD_FLAGS += @LD_FLAGS@ SOFLAG += @SOFLAG@ # Setup directory variables @@ -109,6 +110,8 @@ SUBDIRS.distclean := $(SUBDIRS:=.distclean) .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean) .PHONY: $(SUBDIRS.pofile) +TARGETS += $(LIB_SHARED) $(LIB_STATIC) + all: $(SUBDIRS) $(TARGETS) install: all $(SUBDIRS.install) -- 2.43.5