Starting with autoconf 2.70, obsolescence warnings are output by
default. To keep the script as compatible as possible, I build
autoconf 2.60 and ran the autoupdate that came with it on
configure.ac and all m4 files.
This commit contains the following changes:
- Drops -fstack-protector in favor of -fstack-protector-strong.
Consequently, the ssp-buffer-size parameter has been removed as
-fstack-protector-strong ignores array size.
- Add new global opt-out for stack smash protection. This is enabled
by default for both autotools and CMake builds. Users can opt out
of stack smash protection by passing -DWITH_STACK_PROTECTOR=OFF to
CMake or --disable-stack-smash-protection when running ./configure.
- Renames HAVE_SSP_FLAG to HAVE_STACK_PROTECTOR_FLAG in
CMakeLists.txt to be more readable.
The flac configury marked clang as 'not being gcc' and excluded
a lot of compiler switches, most importantly the visibility flags,
from being used with it. This was done possibly after a problem
reported at: https://github.com/erikd/libsndfile/issues/49 .
This patch does the following:
- m4/gcc_version.m4 (XIPH_GCC_VERSION): set GCC_MAJOR_VERSION and
GCC_MINOR_VERSION to 0 for non-gcc. Previously, they were left
unset.
- configure: the gcc version checks are, naturally, against non-
zero values, so, allow many compiler switches to be used with
clang without affecting real-gcc cases.
- configure: When setting CFLAGS="-O3 -funroll-loops", also set
CXXFLAGS="-O3". Prevents g++ warnings with _FORTIFY_SOURCE, i.e.:
'_FORTIFY_SOURCE requires compiling with optimization (-O)'
Tested compilation using gcc-7.3.1 and clang-5.0.2 on x86_64-linux,
and gcc-4.4.7 and clang-3.4.2 on an i686-linux. Also tested cross-
compiling for Mac OS X using clang-5.0.2.
* Furthermore, use NDEBUG globally to detect the presence
of building with more debug output information.
AX_CHECK_ENABLE_DEBUG is easier to use, and nowadays
Gnome has also switched to it from its own custom solution.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Autoconf detects the Clang compiler as GNU GCC (clang sets defines like
__GNUC__ etc) but Clang is *not* completely compatible. If we detect
Clang we set ac_vc_c_compiler_gnu to 'no'.
* Mac OS X has incomplete installations of gettext/iconv. So stop
checking for gettext command on Darwin, and install some additional m4
scripts so it can be bootstrapped on Mac OS X.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This option is disabled by default because it is known not to work
on FreeBSD 9.1 and for Linux -> Windows cross compiling using the
Debian MinGW-w64 tool chain.
It is known to work for native compiles in Debian testing and
OpenBSD 5.2.
Extra compile options are detected at configure time with new
XIPH_ADD_*FLAGS m4 macros.
Options enabled include -Wextra, -D_FORTIFY_SOURCE=2 and stack
protection.