1--- /dev/null
2+++ autogen.sh
3@@ -0,0 +1,8 @@
4+mv LICENSE COPYING
5+mv CHANGES NEWS
6+touch AUTHORS
7+touch ChangeLog
8+libtoolize --force
9+aclocal
10+automake --add-missing --gnu
11+autoconf
12--- /dev/null
13+++ README.autotools
14@@ -0,0 +1,41 @@
15+bzip2 autoconfiscated
16+=====================
17+
18+Temporarily at http://ftp.suse.com/pub/people/sbrabec/bzip2/ expecting
19+that it will become a new upstream version to prevent per-distribution
20+shared library patching done by nearly each Linux vendor separately.
21+
22+Autoconfiscation brings standard ./configure ; make ; make install
23+installation, seamless support of DESTDIR, automatic check for supported
24+CFLAGS, standard shared library support, automatic large files CFLAGS
25+check and all things that are supported by automake.
26+
27+It makes obsolete Makefile-libbz2_so and README.COMPILATION.PROBLEMS.
28+Now configure should automatically detect correct build flags.
29+
30+In case of any problem or question with autotools support feel free to
31+contact me: Stanislav Brabec <sbrabec@suse.cz>
32+
33+Autoconfiscated version binaries are exactly equal to
34+bzip2-1.0.6.tar.gz. There are only few changes. See below.
35+
36+
37+New features:
38+
39+Trivial link man pages for bzcat and bunzip2 added.
40+
41+bzip2.pc file for pkg-config. Packages can use it for checks.
42+
43+
44+Incompatible changes:
45+
46+soname change. Libtool has no support for two parts soname suffix (e. g.
47+libbz2.so.1.0). It must be a single number (e. g. libbz2.so.1). That is
48+why soname must change. But I see not a big problem with it. Several
49+distributions already use the new number instead of the non-standard
50+number from Makefile-libbz2_so.
51+
52+Shared library exports only public symbols.
53+
54+To be super-safe, I incremented minor number of the library file, so
55+both instances of the shared library can live together.
56--- /dev/null
57+++ configure.ac
58@@ -0,0 +1,62 @@
59+# -*- Autoconf -*-
60+# Process this file with autoconf to produce a configure script.
61+
62+AC_PREREQ([2.57])
63+AC_INIT([bzip2], [1.0.6], [Julian Seward <jseward@bzip.org>])
64+BZIP2_LT_CURRENT=1
65+BZIP2_LT_REVISION=6
66+BZIP2_LT_AGE=0
67+AC_CONFIG_SRCDIR([bzlib.h])
68+AC_CONFIG_MACRO_DIR([m4])
69+
70+AM_INIT_AUTOMAKE([foreign subdir-objects])
71+AM_MAINTAINER_MODE
72+
73+# Checks for programs.
74+AC_PROG_AWK
75+AC_PROG_CC_STDC
76+AC_PROG_CC_C_O
77+AC_USE_SYSTEM_EXTENSIONS
78+AC_PROG_INSTALL
79+AC_PROG_LN_S
80+AC_PROG_MAKE_SET
81+LT_INIT([disable-static pic-only])
82+PKG_PROG_PKG_CONFIG
83+gl_VISIBILITY
84+# Checks for libraries.
85+
86+# Checks for header files.
87+
88+# Checks for typedefs, structures, and compiler characteristics.
89+
90+# Check for system features.
91+AC_SYS_LARGEFILE
92+
93+AC_MSG_CHECKING([whether compiler understands -Wall])
94+save_CFLAGS="$CFLAGS"
95+CFLAGS="$CFLAGS -Wall"
96+AC_TRY_COMPILE([], [], [
97+ AC_MSG_RESULT([yes])
98+], [
99+ AC_MSG_RESULT([no])
100+ CFLAGS="$save_CFLAGS"
101+])
102+
103+AC_MSG_CHECKING([whether compiler understands -Winline])
104+save_CFLAGS="$CFLAGS"
105+CFLAGS="$CFLAGS -Winline"
106+AC_TRY_COMPILE([], [], [
107+ AC_MSG_RESULT([yes])
108+], [
109+ AC_MSG_RESULT([no])
110+ CFLAGS="$save_CFLAGS"
111+])
112+
113+# Checks for library functions.
114+
115+# Write the output.
116+AC_SUBST([BZIP2_LT_CURRENT])
117+AC_SUBST([BZIP2_LT_REVISION])
118+AC_SUBST([BZIP2_LT_AGE])
119+AC_CONFIG_FILES([Makefile bzip2.pc])
120+AC_OUTPUT
121--- /dev/null
122+++ Makefile.am
123@@ -0,0 +1,137 @@
124+ACLOCAL_AMFLAGS = -I m4
125+lib_LTLIBRARIES = libbz2.la
126+AM_CFLAGS = $(CFLAG_VISIBILITY)
127+libbz2_la_SOURCES = \
128+ blocksort.c \
129+ huffman.c \
130+ crctable.c \
131+ randtable.c \
132+ compress.c \
133+ decompress.c \
134+ bzlib.c
135+
136+libbz2_la_LDFLAGS = \
137+ -version-info $(BZIP2_LT_CURRENT):$(BZIP2_LT_REVISION):$(BZIP2_LT_AGE) \
138+ -no-undefined
139+
140+include_HEADERS = bzlib.h
141+
142+noinst_HEADERS = bzlib_private.h
143+
144+bin_PROGRAMS = bzip2 bzip2recover
145+
146+bzip2_SOURCES = bzip2.c
147+bzip2_LDADD = libbz2.la
148+
149+bzip2recover_SOURCES = bzip2recover.c
150+bzip2recover_LDADD = libbz2.la
151+
152+bin_SCRIPTS = bzgrep bzmore bzdiff
153+
154+man_MANS = bzip2.1 bzgrep.1 bzmore.1 bzdiff.1
155+
156+pkgconfigdir = $(libdir)/pkgconfig
157+pkgconfig_DATA = bzip2.pc
158+
159+$(pkgconfig_DATA): $(srcdir)/bzip2.pc.in config.status
160+
161+install-exec-hook:
162+ rm -f $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
163+ rm -f $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
164+ rm -f $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
165+ rm -f $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
166+ rm -f $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
167+ rm -f $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
168+ $(LN_S) `echo "bzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
169+ $(LN_S) `echo "bzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
170+ $(LN_S) `echo "bzgrep" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`
171+ $(LN_S) `echo "bzgrep" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`
172+ $(LN_S) `echo "bzmore" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform)'`
173+ $(LN_S) `echo "bzdiff" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`
174+
175+install-data-hook:
176+ echo ".so man1/`echo "bzip2" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bunzip2" | sed 's,^.*/,,;$(transform)'`.1
177+ echo ".so man1/`echo "bzip2" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzcat" | sed 's,^.*/,,;$(transform)'`.1
178+ echo ".so man1/`echo "bzgrep" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`.1
179+ echo ".so man1/`echo "bzgrep" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`.1
180+ echo ".so man1/`echo "bzmore" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzless" | sed 's,^.*/,,;$(transform)'`.1
181+ echo ".so man1/`echo "bzdiff" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1
182+
183+uninstall-hook:
184+ rm -f $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
185+ rm -f $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
186+ rm -f $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`
187+ rm -f $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`
188+ rm -f $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform)'`
189+ rm -f $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`
190+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bunzip2" | sed 's,^.*/,,;$(transform)'`.1
191+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcat" | sed 's,^.*/,,;$(transform)'`.1
192+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`.1
193+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`.1
194+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bzless" | sed 's,^.*/,,;$(transform)'`.1
195+ rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1
196+
197+test: bzip2
198+ @cat $(srcdir)/words1
199+ ./bzip2 -1 <$(srcdir)/sample1.ref >sample1.rb2
200+ ./bzip2 -2 <$(srcdir)/sample2.ref >sample2.rb2
201+ ./bzip2 -3 <$(srcdir)/sample3.ref >sample3.rb2
202+ ./bzip2 -d <$(srcdir)/sample1.bz2 >sample1.tst
203+ ./bzip2 -d <$(srcdir)/sample2.bz2 >sample2.tst
204+ ./bzip2 -ds <$(srcdir)/sample3.bz2 >sample3.tst
205+ cmp $(srcdir)/sample1.bz2 sample1.rb2
206+ cmp $(srcdir)/sample2.bz2 sample2.rb2
207+ cmp $(srcdir)/sample3.bz2 sample3.rb2
208+ cmp sample1.tst $(srcdir)/sample1.ref
209+ cmp sample2.tst $(srcdir)/sample2.ref
210+ cmp sample3.tst $(srcdir)/sample3.ref
211+ @cat $(srcdir)/words3
212+
213+manual: $(srcdir)/manual.html $(srcdir)/manual.ps $(srcdir)/manual.pdf
214+
215+manual.ps: $(MANUAL_SRCS)
216+ cd $(srcdir); ./xmlproc.sh -ps manual.xml
217+
218+manual.pdf: $(MANUAL_SRCS)
219+ cd $(srcdir); ./xmlproc.sh -pdf manual.xml
220+
221+manual.html: $(MANUAL_SRCS)
222+ cd $(srcdir); ./xmlproc.sh -html manual.xml
223+
224+EXTRA_DIST = \
225+ $(bin_SCRIPTS) \
226+ $(man_MANS) \
227+ README.autotools \
228+ README.XML.STUFF \
229+ bz-common.xsl \
230+ bz-fo.xsl \
231+ bz-html.xsl \
232+ bzip.css \
233+ bzip2.1.preformatted \
234+ bzip2.pc.in \
235+ bzip2.txt \
236+ dlltest.c \
237+ dlltest.dsp \
238+ entities.xml \
239+ format.pl \
240+ libbz2.def \
241+ libbz2.dsp \
242+ makefile.msc \
243+ manual.html \
244+ manual.pdf \
245+ manual.ps \
246+ manual.xml \
247+ mk251.c \
248+ sample1.bz2 \
249+ sample1.ref \
250+ sample2.bz2 \
251+ sample2.ref \
252+ sample3.bz2 \
253+ sample3.ref \
254+ spewG.c \
255+ unzcrash.c \
256+ words0 \
257+ words1 \
258+ words2 \
259+ words3 \
260+ xmlproc.sh
261--- /dev/null
262+++ bzip2.pc.in
263@@ -0,0 +1,11 @@
264+prefix=@prefix@
265+exec_prefix=@exec_prefix@
266+bindir=@bindir@
267+libdir=@libdir@
268+includedir=@includedir@
269+
270+Name: bzip2
271+Description: Lossless, block-sorting data compression
272+Version: @VERSION@
273+Libs: -L${libdir} -lbz2
274+Cflags: -I${includedir}
275--- /dev/null
276+++ m4/visibility.m4
277@@ -0,0 +1,78 @@
278+# visibility.m4 serial 4 (gettext-0.18.2)
279+dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc.
280+dnl This file is free software; the Free Software Foundation
281+dnl gives unlimited permission to copy and/or distribute it,
282+dnl with or without modifications, as long as this notice is preserved.
283+
284+dnl From Bruno Haible.
285+
286+dnl Tests whether the compiler supports the command-line option
287+dnl -fvisibility=hidden and the function and variable attributes
288+dnl __attribute__((__visibility__("hidden"))) and
289+dnl __attribute__((__visibility__("default"))).
290+dnl Does *not* test for __visibility__("protected") - which has tricky
291+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
292+dnl MacOS X.
293+dnl Does *not* test for __visibility__("internal") - which has processor
294+dnl dependent semantics.
295+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
296+dnl "really only recommended for legacy code".
297+dnl Set the variable CFLAG_VISIBILITY.
298+dnl Defines and sets the variable HAVE_VISIBILITY.
299+
300+AC_DEFUN([gl_VISIBILITY],
301+[
302+ AC_REQUIRE([AC_PROG_CC])
303+ CFLAG_VISIBILITY=
304+ HAVE_VISIBILITY=0
305+ if test -n "$GCC"; then
306+ dnl First, check whether -Werror can be added to the command line, or
307+ dnl whether it leads to an error because of some other option that the
308+ dnl user has put into $CC $CFLAGS $CPPFLAGS.
309+ AC_MSG_CHECKING([whether the -Werror option is usable])
310+ AC_CACHE_VAL([gl_cv_cc_vis_werror], [
311+ gl_save_CFLAGS="$CFLAGS"
312+ CFLAGS="$CFLAGS -Werror"
313+ AC_COMPILE_IFELSE(
314+ [AC_LANG_PROGRAM([[]], [[]])],
315+ [gl_cv_cc_vis_werror=yes],
316+ [gl_cv_cc_vis_werror=no])
317+ CFLAGS="$gl_save_CFLAGS"])
318+ AC_MSG_RESULT([$gl_cv_cc_vis_werror])
319+ dnl Now check whether visibility declarations are supported.
320+ AC_MSG_CHECKING([for simple visibility declarations])
321+ AC_CACHE_VAL([gl_cv_cc_visibility], [
322+ gl_save_CFLAGS="$CFLAGS"
323+ CFLAGS="$CFLAGS -fvisibility=hidden"
324+ dnl We use the option -Werror and a function dummyfunc, because on some
325+ dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
326+ dnl "visibility attribute not supported in this configuration; ignored"
327+ dnl at the first function definition in every compilation unit, and we
328+ dnl don't want to use the option in this case.
329+ if test $gl_cv_cc_vis_werror = yes; then
330+ CFLAGS="$CFLAGS -Werror"
331+ fi
332+ AC_COMPILE_IFELSE(
333+ [AC_LANG_PROGRAM(
334+ [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
335+ extern __attribute__((__visibility__("default"))) int exportedvar;
336+ extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
337+ extern __attribute__((__visibility__("default"))) int exportedfunc (void);
338+ void dummyfunc (void) {}
339+ ]],
340+ [[]])],
341+ [gl_cv_cc_visibility=yes],
342+ [gl_cv_cc_visibility=no])
343+ CFLAGS="$gl_save_CFLAGS"])
344+ AC_MSG_RESULT([$gl_cv_cc_visibility])
345+ if test $gl_cv_cc_visibility = yes; then
346+ CFLAG_VISIBILITY="-fvisibility=hidden"
347+ HAVE_VISIBILITY=1
348+ AC_DEFINE([BZ_EXTERN], [__attribute__((__visibility__("default")))], [To make symbol visible])
349+ fi
350+ fi
351+ AC_SUBST([CFLAG_VISIBILITY])
352+ AC_SUBST([HAVE_VISIBILITY])
353+ AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
354+ [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
355+])
356--- bzlib.h.orig
357+++ bzlib.h
358@@ -91,9 +91,11 @@ typedef
359 # endif
360 #else
361 # define BZ_API(func) func
362-# define BZ_EXTERN extern
363 #endif
364
365+#ifndef BZ_EXTERN
366+#define BZ_EXTERN extern
367+#endif
368
369 /*-- Core (low-level) library functions --*/
370