From f9907503f882a745dce9d84c2968f6c175ba966a Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 5 Oct 2010 14:13:16 +0300 Subject: [PATCH] Build: Remove the static/dynamic tricks. Most distros want xz linked against shared liblzma, so it doesn't help much to require --enable-dynamic for that. Those who want to avoid PIC on x86-32 to get better performance, can still do it e.g. by using --disable-shared to compile xz and then another pass to compile shared liblzma. Part of these static/dynamic tricks were needed for Windows in the past. Nowadays we rely on GCC and binutils to do the right thing with auto-import. If the Autotooled build system needs to support some other toolchain on Windows in the future, this may need some rethinking. --- configure.ac | 74 ---------------------------------------- debug/Makefile.am | 5 +-- src/lzmainfo/Makefile.am | 4 +-- src/xz/Makefile.am | 4 +-- src/xzdec/Makefile.am | 4 +-- tests/Makefile.am | 5 +-- 6 files changed, 5 insertions(+), 91 deletions(-) diff --git a/configure.ac b/configure.ac index 697cdf6c..5809c69a 100644 --- a/configure.ac +++ b/configure.ac @@ -369,41 +369,6 @@ AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram], be determined.]) -############################################ -# xz/xzdec/lzmadec linkage against liblzma # -############################################ - -# Link the xz, xzdec, and lzmadec command line tools against static liblzma -# unless using --enable-dynamic. Using static liblzma gives a little bit -# faster executable on x86, because no register is wasted for PIC. We also -# have one dependency less, which allows users to more freely copy the xz -# binary to other boxes. However, I wouldn't be surprised if distro -# maintainers still prefer dynamic linking, so let's make it easy for them. - -AC_MSG_CHECKING([how programs should be linked against liblzma]) -AC_ARG_ENABLE([dynamic], [AC_HELP_STRING([--enable-dynamic=TYPE], - [Set how command line tools are linked against liblzma. - TYPE can be mixed, yes, or no. The default is mixed.])], - [], [enable_dynamic=mixed]) -case $enable_dynamic in - mixed) - AC_MSG_RESULT([mixed (some dynamically, some statically)]) - ;; - yes) - AC_MSG_RESULT([dynamically]) - ;; - no) - AC_MSG_RESULT([statically]) - ;; - *) - AC_MSG_RESULT([]) - AC_MSG_ERROR([--enable-dynamic accepts only \`mixed', \`yes', or \`no']) - ;; -esac -# We use the actual results later, because we don't know yet -# if --disable-shared or --disable-static was used. - - ############################################################################### # Checks for programs. ############################################################################### @@ -611,45 +576,6 @@ AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS") # Add default AM_CFLAGS. AC_SUBST([AM_CFLAGS]) -# Set additional flags for static/dynamic linking. The idea is that every -# program (not library) being built will use either STATIC_{CPPFLAGS,LDFLAGS} -# or DYNAMIC_{CPPFLAGS,LDFLAGS} depending on which type of linkage is -# preferred. These preferences get overridden by use of --disable-static, -# --disable-shared, or --enable-dynamic. -# -# This is quite messy, because we want to use LZMA_API_STATIC when linking -# against static liblzma. It's needed on Windows. -if test "x$enable_static" = xno; then - enable_dynamic=yes -fi -if test "x$enable_shared" = xno; then - enable_dynamic=no -fi -case $enable_dynamic in - yes) - STATIC_CPPFLAGS= - STATIC_LDFLAGS= - DYNAMIC_CPPFLAGS= - DYNAMIC_LDFLAGS= - ;; - mixed) - STATIC_CPPFLAGS="-DLZMA_API_STATIC" - STATIC_LDFLAGS="-static" - DYNAMIC_CPPFLAGS= - DYNAMIC_LDFLAGS= - ;; - no) - STATIC_CPPFLAGS="-DLZMA_API_STATIC" - STATIC_LDFLAGS="-static" - DYNAMIC_CPPFLAGS="-DLZMA_API_STATIC" - DYNAMIC_LDFLAGS="-static" - ;; -esac -AC_SUBST([STATIC_CPPFLAGS]) -AC_SUBST([STATIC_LDFLAGS]) -AC_SUBST([DYNAMIC_CPPFLAGS]) -AC_SUBST([DYNAMIC_LDFLAGS]) - # This is needed for src/scripts. xz=`echo xz | sed "$program_transform_name"` AC_SUBST([xz]) diff --git a/debug/Makefile.am b/debug/Makefile.am index 23834f4f..45b4b7fd 100644 --- a/debug/Makefile.am +++ b/debug/Makefile.am @@ -16,10 +16,7 @@ noinst_PROGRAMS = \ AM_CPPFLAGS = \ -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/liblzma/api \ - $(STATIC_CPPFLAGS) - -AM_LDFLAGS = $(STATIC_LDFLAGS) + -I$(top_srcdir)/src/liblzma/api LDADD = $(top_builddir)/src/liblzma/liblzma.la diff --git a/src/lzmainfo/Makefile.am b/src/lzmainfo/Makefile.am index cbc7e5c7..3e18c5fb 100644 --- a/src/lzmainfo/Makefile.am +++ b/src/lzmainfo/Makefile.am @@ -16,10 +16,8 @@ lzmainfo_CPPFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(DYNAMIC_CPPFLAGS) + -I$(top_builddir)/lib -lzmainfo_LDFLAGS = $(DYNAMIC_LDFLAGS) lzmainfo_LDADD = $(top_builddir)/src/liblzma/liblzma.la if COND_GNULIB diff --git a/src/xz/Makefile.am b/src/xz/Makefile.am index da716dca..e4ed59cf 100644 --- a/src/xz/Makefile.am +++ b/src/xz/Makefile.am @@ -46,10 +46,8 @@ xz_CPPFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(STATIC_CPPFLAGS) + -I$(top_builddir)/lib -xz_LDFLAGS = $(STATIC_LDFLAGS) xz_LDADD = $(top_builddir)/src/liblzma/liblzma.la if COND_GNULIB diff --git a/src/xzdec/Makefile.am b/src/xzdec/Makefile.am index ad487721..c31a30a7 100644 --- a/src/xzdec/Makefile.am +++ b/src/xzdec/Makefile.am @@ -27,9 +27,7 @@ xzdec_CPPFLAGS = \ -DTUKLIB_GETTEXT=0 \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(STATIC_CPPFLAGS) -xzdec_LDFLAGS = $(STATIC_LDFLAGS) + -I$(top_builddir)/lib xzdec_LDADD = $(top_builddir)/src/liblzma/liblzma.la if COND_GNULIB diff --git a/tests/Makefile.am b/tests/Makefile.am index d01787a3..d0807ae4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,10 +17,7 @@ EXTRA_DIST = \ AM_CPPFLAGS = \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(STATIC_CPPFLAGS) - -AM_LDFLAGS = $(STATIC_LDFLAGS) + -I$(top_builddir)/lib LDADD = $(top_builddir)/src/liblzma/liblzma.la