aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/Makefile.am
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-06-30 17:09:57 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-06-30 17:09:57 +0300
commitf42ee981668b545ab6d06c6072e262c29605273c (patch)
tree3c629000a91b0b0dccf11bacdd1878cea508be73 /src/liblzma/Makefile.am
parentAdded a comment about "autoconf -fi" to autogen.sh. (diff)
downloadxz-f42ee981668b545ab6d06c6072e262c29605273c.tar.xz
Build system fixes
Don't use libtool convenience libraries to avoid recently discovered long-standing subtle but somewhat severe bugs in libtool (at least 1.5.22 and 2.2.6 are affected). It was found when porting XZ Utils to Windows <http://lists.gnu.org/archive/html/libtool/2009-06/msg00070.html> but the problem is significant also e.g. on GNU/Linux. Unless --disable-shared is passed to configure, static library built from a set of convenience libraries will contain PIC objects. That is, while libtool builds non-PIC objects too, only PIC objects will be used from the convenience libraries. On 32-bit x86 (tested on mobile XP2400+), using PIC instead of non-PIC makes the decompressor 10 % slower with the default CFLAGS. So while xz was linked against static liblzma by default, it got the slower PIC objects unless --disable-shared was used. I tend develop and benchmark with --disable-shared due to faster build time, so I hadn't noticed the problem in benchmarks earlier. This commit also adds support for building Windows resources into liblzma and executables.
Diffstat (limited to '')
-rw-r--r--src/liblzma/Makefile.am79
1 files changed, 62 insertions, 17 deletions
diff --git a/src/liblzma/Makefile.am b/src/liblzma/Makefile.am
index defed167..5490ba02 100644
--- a/src/liblzma/Makefile.am
+++ b/src/liblzma/Makefile.am
@@ -5,45 +5,90 @@
## You can do whatever you want with this file.
##
-SUBDIRS = api common check
+SUBDIRS = api
+
+EXTRA_DIST =
+CLEANFILES =
+doc_DATA =
lib_LTLIBRARIES = liblzma.la
liblzma_la_SOURCES =
+liblzma_la_CPPFLAGS = \
+ -I$(top_srcdir)/src/liblzma/api \
+ -I$(top_srcdir)/src/liblzma/common \
+ -I$(top_srcdir)/src/liblzma/check \
+ -I$(top_srcdir)/src/liblzma/lz \
+ -I$(top_srcdir)/src/liblzma/rangecoder \
+ -I$(top_srcdir)/src/liblzma/lzma \
+ -I$(top_srcdir)/src/liblzma/subblock \
+ -I$(top_srcdir)/src/liblzma/delta \
+ -I$(top_srcdir)/src/liblzma/simple \
+ -I$(top_srcdir)/src/common
liblzma_la_LDFLAGS = -no-undefined -version-info 0:0:0
-liblzma_la_LIBADD = \
- common/libcommon.la \
- check/libcheck.la
+include $(srcdir)/common/Makefile.inc
+include $(srcdir)/check/Makefile.inc
if COND_FILTER_LZ
-SUBDIRS += lz
-liblzma_la_LIBADD += lz/liblz.la
+include $(srcdir)/lz/Makefile.inc
endif
if COND_FILTER_LZMA1
-SUBDIRS += lzma rangecoder
-liblzma_la_LIBADD += \
- lzma/liblzma2.la \
- rangecoder/librangecoder.la
+include $(srcdir)/lzma/Makefile.inc
+include $(srcdir)/rangecoder/Makefile.inc
endif
if COND_FILTER_SUBBLOCK
-SUBDIRS += subblock
-liblzma_la_LIBADD += subblock/libsubblock.la
+include $(srcdir)/subblock/Makefile.inc
endif
if COND_FILTER_DELTA
-SUBDIRS += delta
-liblzma_la_LIBADD += delta/libdelta.la
+include $(srcdir)/delta/Makefile.inc
endif
if COND_FILTER_SIMPLE
-SUBDIRS += simple
-liblzma_la_LIBADD += simple/libsimple.la
+include $(srcdir)/simple/Makefile.inc
+endif
+
+
+## Windows-specific stuff
+
+# Windows resource compiler support. libtool knows what to do with .rc
+# files, but Automake (<= 1.11 at least) doesn't know.
+#
+# We want the resource file only in shared liblzma. To avoid linking it into
+# static liblzma, we overwrite the static object file with an object file
+# compiled from empty input. Note that GNU-specific features are OK here,
+# because on Windows we are compiled with the GNU toolchain.
+.rc.lo:
+ $(LIBTOOL) --mode=compile $(RC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) \
+ -i $< -o $@
+ echo > empty.c
+ $(COMPILE) -c empty.c -o $(*D)/$(*F).o
+
+# Remove ordinals from the generated .def file. People must link by name,
+# not by ordinal, because no one is going to track the ordinal numbers.
+liblzma.def: liblzma.la liblzma.def.in
+ $(SED) 's/ \+@ *[0-9]\+//' liblzma.def.in > liblzma.def
+
+# Creating liblzma.def.in is a side effect of linking the library.
+liblzma.def.in: liblzma.la
+
+if COND_W32
+CLEANFILES += liblzma.def liblzma.def.in empty.c
+liblzma_la_SOURCES += liblzma_w32res.rc
+liblzma_la_LDFLAGS += -Xlinker --output-def -Xlinker liblzma.def.in
+
+## liblzma.def.in is created only when building shared liblzma, so don't
+## try to create liblzma.def when not building shared liblzma.
+if COND_SHARED
+doc_DATA += liblzma.def
+endif
endif
## pkg-config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = liblzma.pc
-EXTRA_DIST = liblzma.pc.in
+EXTRA_DIST += liblzma.pc.in