Commit a51fb732 authored by Federico Mena Quintero's avatar Federico Mena Quintero

Merge branch 'remove-autotools'

parents 1660afce 20b522d0
Pipeline #67247074 passed with stage
in 2 minutes and 34 seconds
# autotools generated files
*.la
*.lo
*.o
.deps/
.libs/
Makefile
Makefile.in
aclocal.m4
autom4te.cache
bzip2.pc
bzip2
bzip2recover
compile
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
m4/
manual.*
!manual.xml
missing
tests/*.rb2
tests/*.tst
# cmake
CMakeCache.txt
CMakeFiles/
......
......@@ -13,21 +13,6 @@ variables:
stages:
- test
.autotools_test:
stage: test
script:
- mkdir builddir && cd builddir
- ../autogen.sh
- make
- make check
after_script:
- cp builddir/config.status builddir/config.log .
- rm -rf builddir
artifacts:
paths:
- 'config.status'
- 'config.log'
.meson_test:
stage: test
script:
......@@ -62,13 +47,6 @@ debian:testing:
- apt update -y
- apt install -y gcc meson
ubuntu:bionic:autotools:
extends: '.autotools_test'
image: $AMD64_UBUNTU_BIONIC
before_script:
- apt update -y
- apt install -y gcc make automake libtool
ubuntu:bionic:cmake:
extends: '.cmake_test'
image: $AMD64_UBUNTU_BIONIC
......@@ -99,16 +77,6 @@ fedora:30:
before_script:
- dnf install -y gcc meson
fedora_mingw:latest:autotools:
image: $AMD64_FEDORA_LATEST
before_script:
- dnf install -y mingw64-gcc make automake libtool
script:
- mkdir builddir && cd builddir
- NOCONFIGURE=1 ../autogen.sh
- mingw64-configure
- make
fedora:rawhide:
extends: '.meson_test'
image: $AMD64_FEDORA_RAWHIDE
......
......@@ -4,17 +4,13 @@ The following build systems are available for Bzip2:
* [Meson]: This is our preferred build system for Unix-like systems.
* [CMake]: Build tool for Unix and Windows.
* GNU [Autotools]: Another traditional build system for Unix-like
systems.
* nmake: Unsupported; used only for Windows and Microsoft Visual
Studio 2013 or later.
Autotools is only supported on Unix-like OSes, nmake is only for Windows,
meson works for both.
Meson works for Unix-like OSes and Windows; nmake is only for Windows.
[Meson]: https://mesonbuild.com
[CMake]: https://cmake.org
[Autotools]: https://autotools.io/index.html
## Using Meson
......@@ -164,32 +160,6 @@ cmake --build . --config Release
ctest -C Release -V
```
## Using GNU Autotools
### Build instructions for Unix (Autotools)
If you are compiling a tarball:
```sh
./configure --prefix=/usr
make
make check
make install
```
See the [`INSTALL`](INSTALL) file for details on options you can pass
to the `configure` script to select where to install the compiled
library.
If you are compiling from a git checkout:
```sh
./autogen.sh --prefix=/usr
make
make check
make install
```
## Using nmake on Windows
Bzip2 can be built with Microsoft Visual Studio 2013 or later. From a Visual
......
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libbz2.la
libbz2_la_SOURCES = \
blocksort.c \
huffman.c \
crctable.c \
randtable.c \
compress.c \
decompress.c \
bzlib.c
libbz2_la_LDFLAGS = \
-version-info $(BZIP2_LT_CURRENT):$(BZIP2_LT_REVISION):$(BZIP2_LT_AGE) \
-no-undefined
include_HEADERS = bzlib.h
noinst_HEADERS = bzlib_private.h
bin_PROGRAMS = bzip2 bzip2recover
bzip2_SOURCES = bzip2.c
bzip2_LDADD = libbz2.la
bzip2recover_SOURCES = bzip2recover.c
bzip2recover_LDADD = libbz2.la
bin_SCRIPTS = bzgrep bzmore bzdiff
man_MANS = man/bzip2.1 man/bzgrep.1 man/bzmore.1 man/bzdiff.1
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = bzip2.pc
$(pkgconfig_DATA): $(srcdir)/bzip2.pc.in config.status
install-exec-hook:
rm -f $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
$(LN_S) `echo "bzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
$(LN_S) `echo "bzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
$(LN_S) `echo "bzgrep" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`
$(LN_S) `echo "bzgrep" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`
$(LN_S) `echo "bzmore" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform)'`
$(LN_S) `echo "bzdiff" | sed 's,^.*/,,;$(transform)'` $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`
install-data-hook:
echo ".so man1/`echo "bzip2" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bunzip2" | sed 's,^.*/,,;$(transform)'`.1
echo ".so man1/`echo "bzip2" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzcat" | sed 's,^.*/,,;$(transform)'`.1
echo ".so man1/`echo "bzgrep" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`.1
echo ".so man1/`echo "bzgrep" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`.1
echo ".so man1/`echo "bzmore" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzless" | sed 's,^.*/,,;$(transform)'`.1
echo ".so man1/`echo "bzdiff" | sed 's,^.*/,,;$(transform)'`.1" >$(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1
uninstall-hook:
rm -f $(DESTDIR)$(bindir)/`echo "bunzip2" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzcat" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`
rm -f $(DESTDIR)$(bindir)/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`
rm -f $(DESTDIR)$(bindir)/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`
rm -f $(DESTDIR)$(bindir)/`echo "bzless" | sed 's,^.*/,,;$(transform)'`
rm -f $(DESTDIR)$(bindir)/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`
rm -f $(DESTDIR)$(mandir)/man1/`echo "bunzip2" | sed 's,^.*/,,;$(transform)'`.1
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcat" | sed 's,^.*/,,;$(transform)'`.1
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzegrep" | sed 's,^.*/,,;$(transform)'`.1
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzfgrep" | sed 's,^.*/,,;$(transform)'`.1
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzless" | sed 's,^.*/,,;$(transform)'`.1
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1
check-local: bzip2
@cat $(top_srcdir)/tests/words1
@mkdir $(top_builddir)/tests/
./bzip2 -1 <$(top_srcdir)/tests/sample1.ref >$(top_builddir)/tests/sample1.rb2
./bzip2 -2 <$(top_srcdir)/tests/sample2.ref >$(top_builddir)/tests/sample2.rb2
./bzip2 -3 <$(top_srcdir)/tests/sample3.ref >$(top_builddir)/tests/sample3.rb2
./bzip2 -d <$(top_srcdir)/tests/sample1.bz2 >$(top_builddir)/tests/sample1.tst
./bzip2 -d <$(top_srcdir)/tests/sample2.bz2 >$(top_builddir)/tests/sample2.tst
./bzip2 -ds <$(top_srcdir)/tests/sample3.bz2 >$(top_builddir)/tests/sample3.tst
cmp $(top_srcdir)/tests/sample1.bz2 $(top_builddir)/tests/sample1.rb2
cmp $(top_srcdir)/tests/sample2.bz2 $(top_builddir)/tests/sample2.rb2
cmp $(top_srcdir)/tests/sample3.bz2 $(top_builddir)/tests/sample3.rb2
cmp $(top_builddir)/tests/sample1.tst $(top_srcdir)/tests/sample1.ref
cmp $(top_builddir)/tests/sample2.tst $(top_srcdir)/tests/sample2.ref
cmp $(top_builddir)/tests/sample3.tst $(top_srcdir)/tests/sample3.ref
@cat $(top_srcdir)/tests/words3
manual: $(top_builddir)/docs/manual.html $(top_builddir)/docs/manual.ps $(top_builddir)/docs/manual.pdf
docs/manual.ps: $(MANUAL_SRCS)
cd $(top_srcdir)/docs; ./xmlproc.sh -ps manual.xml
docs/manual.pdf: $(MANUAL_SRCS)
cd $(top_srcdir)/docs; ./xmlproc.sh -pdf manual.xml
docs/manual.html: $(MANUAL_SRCS)
cd $(top_srcdir)/docs; ./xmlproc.sh -html manual.xml
EXTRA_DIST = \
$(bin_SCRIPTS) \
$(man_MANS) \
README.XML.STUFF \
README.autotools \
bzip2.pc.in \
bzip2.txt \
dlltest.c \
dlltest.dsp \
docs/bz-common.xsl \
docs/bz-common.xsl \
docs/bz-fo.xsl \
docs/bz-fo.xsl \
docs/bz-html.xsl \
docs/bz-html.xsl \
docs/bzip.css \
docs/bzip.css \
docs/entities.xml \
docs/format.pl \
docs/manual.html \
docs/manual.pdf \
docs/manual.ps \
docs/manual.xml \
docs/meson.build \
docs/xmlproc.sh \
libbz2.def \
libbz2.dsp \
makefile.msc \
man/bzip2.1.preformatted \
man/meson.build \
meson.build \
meson_options.txt \
mk251.c \
spewG.c \
tests/meson.build \
tests/sample1.bz2 \
tests/sample1.ref \
tests/sample2.bz2 \
tests/sample2.ref \
tests/sample3.bz2 \
tests/sample3.ref \
tests/words0 \
tests/words1 \
tests/words2 \
tests/words3 \
unzcrash.c
bzip2 with autotools
====================
Switching bzip2 to autotools brings standard "./configure ; make ;
make install" installation, seamless support of DESTDIR, automatic
check for supported CFLAGS, standard shared library support, automatic
large files CFLAGS check, and all things that are supported by
automake.
It makes obsolete Makefile-libbz2_so and README.COMPILATION.PROBLEMS.
Now configure should automatically detect correct build flags.
In case of any problem or question with autotools support feel free to
contact me: Stanislav Brabec <sbrabec@suse.cz>, or
Federico Mena Quintero <federico@gnome.org>.
Autotools version binaries are exactly equal to
bzip2-1.0.6.tar.gz. There are only few changes. See below.
New features:
Trivial link man pages for bzcat and bunzip2 added.
bzip2.pc file for pkg-config. Packages can use it for checks.
Incompatible changes:
soname change. Libtool has no support for two parts soname suffix (e. g.
libbz2.so.1.0). It must be a single number (e. g. libbz2.so.1). That is
why soname must change. But I see not a big problem with it. Several
distributions already use the new number instead of the non-standard
number from Makefile-libbz2_so.
Shared library exports only public symbols.
To be super-safe, I incremented minor number of the library file, so
both instances of the shared library can live together.
......@@ -51,7 +51,7 @@ repository][gitlab] as well.
## Compiling Bzip2 and libbz2
Please see the [`COMPILING.md`][COMPILING.md] file for details. This includes
instructions for buliding using Meson, CMake, GNU Autotools, or nmake.
instructions for buliding using Meson, CMake, or nmake.
[COMPILING.md]: COMPILING.md
......
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.
olddir=$(pwd)
cd $srcdir
(test -f configure.ac) || {
echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
exit 1
}
# shellcheck disable=SC2016
PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
fi
aclocal --install || exit 1
autoreconf --verbose --force --install || exit 1
cd "$olddir"
if [ "$NOCONFIGURE" = "" ]; then
$srcdir/configure "$@" || exit 1
if [ "$1" = "--help" ]; then exit 0 else
echo "Now type 'make' to compile $PKG_NAME" || exit 1
fi
else
echo "Skipping configure process."
fi
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.57])
AC_INIT([bzip2], [1.0.7], [Julian Seward <jseward@bzip.org>])
BZIP2_LT_CURRENT=1
BZIP2_LT_REVISION=6
BZIP2_LT_AGE=0
AC_CONFIG_SRCDIR([bzlib.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_MAINTAINER_MODE
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC_STDC
AC_PROG_CC_C_O
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
LT_INIT([disable-static pic-only])
PKG_PROG_PKG_CONFIG
gl_VISIBILITY
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Check for system features.
AC_SYS_LARGEFILE
AC_MSG_CHECKING([whether compiler understands -Wall])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall"
AC_TRY_COMPILE([], [], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
CFLAGS="$save_CFLAGS"
])
AC_MSG_CHECKING([whether compiler understands -Winline])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Winline"
AC_TRY_COMPILE([], [], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
CFLAGS="$save_CFLAGS"
])
# Checks for library functions.
# Write the output.
AC_SUBST([BZIP2_LT_CURRENT])
AC_SUBST([BZIP2_LT_REVISION])
AC_SUBST([BZIP2_LT_AGE])
AC_CONFIG_FILES([Makefile bzip2.pc])
AC_OUTPUT
# visibility.m4 serial 4 (gettext-0.18.2)
dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Tests whether the compiler supports the command-line option
dnl -fvisibility=hidden and the function and variable attributes
dnl __attribute__((__visibility__("hidden"))) and
dnl __attribute__((__visibility__("default"))).
dnl Does *not* test for __visibility__("protected") - which has tricky
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
dnl MacOS X.
dnl Does *not* test for __visibility__("internal") - which has processor
dnl dependent semantics.
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
dnl "really only recommended for legacy code".
dnl Set the variable CFLAG_VISIBILITY.
dnl Defines and sets the variable HAVE_VISIBILITY.
AC_DEFUN([gl_VISIBILITY],
[
AC_REQUIRE([AC_PROG_CC])
CFLAG_VISIBILITY=
HAVE_VISIBILITY=0
if test -n "$GCC"; then
dnl First, check whether -Werror can be added to the command line, or
dnl whether it leads to an error because of some other option that the
dnl user has put into $CC $CFLAGS $CPPFLAGS.
AC_MSG_CHECKING([whether the -Werror option is usable])
AC_CACHE_VAL([gl_cv_cc_vis_werror], [
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[gl_cv_cc_vis_werror=yes],
[gl_cv_cc_vis_werror=no])
CFLAGS="$gl_save_CFLAGS"])
AC_MSG_RESULT([$gl_cv_cc_vis_werror])
dnl Now check whether visibility declarations are supported.
AC_MSG_CHECKING([for simple visibility declarations])
AC_CACHE_VAL([gl_cv_cc_visibility], [
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
dnl We use the option -Werror and a function dummyfunc, because on some
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
dnl "visibility attribute not supported in this configuration; ignored"
dnl at the first function definition in every compilation unit, and we
dnl don't want to use the option in this case.
if test $gl_cv_cc_vis_werror = yes; then
CFLAGS="$CFLAGS -Werror"
fi
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
extern __attribute__((__visibility__("default"))) int exportedvar;
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
void dummyfunc (void) {}
]],
[[]])],
[gl_cv_cc_visibility=yes],
[gl_cv_cc_visibility=no])
CFLAGS="$gl_save_CFLAGS"])
AC_MSG_RESULT([$gl_cv_cc_visibility])
if test $gl_cv_cc_visibility = yes; then
CFLAG_VISIBILITY="-fvisibility=hidden"
HAVE_VISIBILITY=1
AC_DEFINE([BZ_EXTERN], [__attribute__((__visibility__("default")))], [To make symbol visible])
fi
fi
AC_SUBST([CFLAG_VISIBILITY])
AC_SUBST([HAVE_VISIBILITY])
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment