aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
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/common
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 'src/liblzma/common')
-rw-r--r--src/liblzma/common/Makefile.am78
-rw-r--r--src/liblzma/common/Makefile.inc67
-rw-r--r--src/liblzma/common/common.h16
3 files changed, 77 insertions, 84 deletions
diff --git a/src/liblzma/common/Makefile.am b/src/liblzma/common/Makefile.am
deleted file mode 100644
index 0509f1e6..00000000
--- a/src/liblzma/common/Makefile.am
+++ /dev/null
@@ -1,78 +0,0 @@
-##
-## Author: Lasse Collin
-##
-## This file has been put into the public domain.
-## You can do whatever you want with this file.
-##
-
-noinst_LTLIBRARIES = libcommon.la
-libcommon_la_CPPFLAGS = \
- -I$(top_srcdir)/src/liblzma/api \
- -I$(top_srcdir)/src/liblzma/check \
- -I$(top_srcdir)/src/liblzma/rangecoder \
- -I$(top_srcdir)/src/liblzma/lz \
- -I$(top_srcdir)/src/liblzma/lzma \
- -I$(top_srcdir)/src/liblzma/subblock \
- -I$(top_srcdir)/src/liblzma/delta \
- -I$(top_srcdir)/src/liblzma/simple
-
-libcommon_la_SOURCES = \
- common.c \
- common.h \
- bsr.h \
- block_util.c \
- easy_preset.c \
- easy_preset.h \
- filter_common.c \
- filter_common.h \
- index.c \
- index.h \
- stream_flags_common.c \
- stream_flags_common.h \
- vli_size.c
-
-if COND_MAIN_ENCODER
-libcommon_la_SOURCES += \
- alone_encoder.c \
- block_buffer_encoder.c \
- block_encoder.c \
- block_encoder.h \
- block_header_encoder.c \
- easy_buffer_encoder.c \
- easy_encoder.c \
- easy_encoder_memusage.c \
- filter_buffer_encoder.c \
- filter_encoder.c \
- filter_encoder.h \
- filter_flags_encoder.c \
- index_encoder.c \
- index_encoder.h \
- stream_buffer_encoder.c \
- stream_encoder.c \
- stream_encoder.h \
- stream_flags_encoder.c \
- vli_encoder.c
-endif
-
-if COND_MAIN_DECODER
-libcommon_la_SOURCES += \
- alone_decoder.c \
- alone_decoder.h \
- auto_decoder.c \
- block_buffer_decoder.c \
- block_decoder.c \
- block_decoder.h \
- block_header_decoder.c \
- easy_decoder_memusage.c \
- filter_buffer_decoder.c \
- filter_decoder.c \
- filter_decoder.h \
- filter_flags_decoder.c \
- index_decoder.c \
- index_hash.c \
- stream_buffer_decoder.c \
- stream_decoder.c \
- stream_decoder.h \
- stream_flags_decoder.c \
- vli_decoder.c
-endif
diff --git a/src/liblzma/common/Makefile.inc b/src/liblzma/common/Makefile.inc
new file mode 100644
index 00000000..aaaeee93
--- /dev/null
+++ b/src/liblzma/common/Makefile.inc
@@ -0,0 +1,67 @@
+##
+## Author: Lasse Collin
+##
+## This file has been put into the public domain.
+## You can do whatever you want with this file.
+##
+
+liblzma_la_SOURCES += \
+ common/common.c \
+ common/common.h \
+ common/bsr.h \
+ common/block_util.c \
+ common/easy_preset.c \
+ common/easy_preset.h \
+ common/filter_common.c \
+ common/filter_common.h \
+ common/index.c \
+ common/index.h \
+ common/stream_flags_common.c \
+ common/stream_flags_common.h \
+ common/vli_size.c
+
+if COND_MAIN_ENCODER
+liblzma_la_SOURCES += \
+ common/alone_encoder.c \
+ common/block_buffer_encoder.c \
+ common/block_encoder.c \
+ common/block_encoder.h \
+ common/block_header_encoder.c \
+ common/easy_buffer_encoder.c \
+ common/easy_encoder.c \
+ common/easy_encoder_memusage.c \
+ common/filter_buffer_encoder.c \
+ common/filter_encoder.c \
+ common/filter_encoder.h \
+ common/filter_flags_encoder.c \
+ common/index_encoder.c \
+ common/index_encoder.h \
+ common/stream_buffer_encoder.c \
+ common/stream_encoder.c \
+ common/stream_encoder.h \
+ common/stream_flags_encoder.c \
+ common/vli_encoder.c
+endif
+
+if COND_MAIN_DECODER
+liblzma_la_SOURCES += \
+ common/alone_decoder.c \
+ common/alone_decoder.h \
+ common/auto_decoder.c \
+ common/block_buffer_decoder.c \
+ common/block_decoder.c \
+ common/block_decoder.h \
+ common/block_header_decoder.c \
+ common/easy_decoder_memusage.c \
+ common/filter_buffer_decoder.c \
+ common/filter_decoder.c \
+ common/filter_decoder.h \
+ common/filter_flags_decoder.c \
+ common/index_decoder.c \
+ common/index_hash.c \
+ common/stream_buffer_decoder.c \
+ common/stream_decoder.c \
+ common/stream_decoder.h \
+ common/stream_flags_decoder.c \
+ common/vli_decoder.c
+endif
diff --git a/src/liblzma/common/common.h b/src/liblzma/common/common.h
index 1fd778b0..d794cb30 100644
--- a/src/liblzma/common/common.h
+++ b/src/liblzma/common/common.h
@@ -13,12 +13,16 @@
#ifndef LZMA_COMMON_H
#define LZMA_COMMON_H
-#include "../../common/sysdefs.h"
-#include "../../common/mythread.h"
-#include "../../common/integer.h"
-
-#if defined(DLL_EXPORT) && (defined(_WIN32) || defined(__CYGWIN__))
-# define LZMA_API_EXPORT __declspec(dllexport)
+#include "sysdefs.h"
+#include "mythread.h"
+#include "integer.h"
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+# ifdef DLL_EXPORT
+# define LZMA_API_EXPORT __declspec(dllexport)
+# else
+# define LZMA_API_EXPORT
+# endif
// Don't use ifdef or defined() below.
#elif HAVE_VISIBILITY
# define LZMA_API_EXPORT __attribute__((__visibility__("default")))