The symptom was that `./configure` would error out saying...
> configure: error: cannot run C compiled programs.
...because the binaries produced by Clang 14.0.6 with default target
"arm-unknown-linux-gnueabihf" would crash saying...
> qemu: uncaught target signal 4 (Illegal instruction) - core dumped
> Illegal instruction (core dumped)
Somewhat unobvious what the default is: you need to read the source or
compress a sufficiently large file and check with top.
For --block it was mentioned in the --help output but not the manpage.
Building with autotools on Linux produces bzip3.pc with a garbage in
Cflags:
[...]
Libs: -L${libdir} -lbzip3
Cflags: -I${includedir}@extra_cflags@
This bug was introduced in dca13c8231
commit (Fix handling of DLLs on Windows) which added @extra_cflags@ to
pkg-config file and defined the variable in CMake script, but forgot
to define it in an Autoconf script.
This patch defines it unconditionally in the Autoconf script as an
empty string, assuming people don't use this script on Windows
platforms.
In Makefile.am, soname is set to 1:0:0, but in CMake it is set to 0:0:0.
This means that when building with CMake, libraries with different sonames will
be built. This will not maintain library compatibility.
This sets the same soname in cmake as well.
Before:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so libbzip3.so.0 libbzip3.so.0.0.0
$ objdump -p libbzip3.so
SONAME libbzip3.so.0.0.0
$ cd .. && autoreconf -ivf && ./configure && make
$ ls .libs/*.so*
.libs/libbzip3.so .libs/libbzip3.so.1 .libs/libbzip3.so.1.0.0
$ objdump -p ./.libs/libbzip3.so | grep SONAME
SONAME libbzip3.so.1
```
After:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so libbzip3.so.1 libbzip3.so.1.0.0
$ objdump -p libbzip3.so
SONAME libbzip3.so.1
```
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
If CMAKE_CURRENT_SOURCE_DIR is not specified to ${BZIP3_MAN}.in, it will refer
to the current directory, which will result in an error if user builds with
out-of-source builds.
This sets CMAKE_CURRENT_SOURCE_DIR and supports out-of-source builds.
```
$ mkdir t && cd t && cmake ..
-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error: File /home/iwamatsu/dev/bzip3/bz3grep.1 does not exist.
CMake Error at CMakeLists.txt:152 (configure_file):
configure_file Problem configuring file
CMake Error: File /home/iwamatsu/dev/bzip3/bz3less.1 does not exist.
CMake Error at CMakeLists.txt:152 (configure_file):
configure_file Problem configuring file
[...]
```
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
* Add -DBZIP3_DLL_IMPORT=1 to pkgconfig C flags
* Add BZIP3_DLL_EXPORT=1 while building bzip3, and BZIP3_DLL_IMPORT=1 to CMake configs.
* When installing the bz3 target, install the DLL.
* Disable pthreads by default on Windows.
Attempting to build with pthreads turned on on Windows triggers a build failure due to missing pthreads headers. As Windows isn't a pthreads platform, it seems like this should be off by default.
* Turn on by default for MinGW or cygwin.