ref: 23a160b80578e67fb996d8c29e8021f00f37cd2d
parent: d2e7cb582b50cf8870fdc6a4e3c0146a95367360
author: David Seifert <soap@gentoo.org>
date: Tue Jun 13 05:24:06 EDT 2017
Modernise more Autoconf code
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@
Win32/Makefile.mingw
aclocal.m4
autom4te.cache
+libsamplerate-*.tar.bz2
compile
config.*
configure
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
-# Copyright (C) 2002-2011 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
+# Copyright (C) 2002-2017 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
-dnl Require autoconf version
-AC_PREREQ(2.57)
+dnl Require autoconf version >= 2.69)
+AC_PREREQ([2.69])
AC_INIT([libsamplerate],[0.1.9],[erikd@mega-nerd.com],
[libsamplerate],[http://www.mega-nerd.com/libsamplerate/])
@@ -22,7 +22,7 @@
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/samplerate.c])
-AC_CANONICAL_TARGET([])
+AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h])
@@ -30,48 +30,57 @@
AM_INIT_AUTOMAKE([1.14 foreign dist-bzip2 no-dist-gzip subdir-objects])
AM_SILENT_RULES([yes])
-AC_LANG([C])
+dnl ====================================================================================
+
AC_PROG_CC
AC_PROG_CC_C99
+
+AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
+ AC_MSG_ERROR([libsamplerate requires a C99 capable compiler!])
+ ])
+
+AC_LANG([C])
AX_COMPILER_VENDOR
AX_COMPILER_VERSION
AC_PROG_SED
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_MKDIR_P
+PKG_PROG_PKG_CONFIG
+dnl Catch ancient versions of pkg-config below 0.27
+AX_REQUIRE_DEFINED([PKG_INSTALLDIR])
+PKG_INSTALLDIR
+
LT_INIT
LT_PROG_RC
-AC_PROG_INSTALL
-AC_PROG_LN_S
+dnl ====================================================================================
+dnl Rules for library version information:
+dnl
+dnl 1. Start with version information of `0:0:0' for each libtool library.
+dnl 2. Update the version information only immediately before a public release of
+dnl your software. More frequent updates are unnecessary, and only guarantee
+dnl that the current interface number gets larger faster.
+dnl 3. If the library source code has changed at all since the last update, then
+dnl increment revision (`c:r:a' becomes `c:r+1:a').
+dnl 4. If any interfaces have been added, removed, or changed since the last update,
+dnl increment current, and set revision to 0.
+dnl 5. If any interfaces have been added since the last public release, then increment
+dnl age.
+dnl 6. If any interfaces have been removed since the last public release, then set age
+dnl to 0.
-#------------------------------------------------------------------------------------
-# Rules for library version information:
-#
-# 1. Start with version information of `0:0:0' for each libtool library.
-# 2. Update the version information only immediately before a public release of
-# your software. More frequent updates are unnecessary, and only guarantee
-# that the current interface number gets larger faster.
-# 3. If the library source code has changed at all since the last update, then
-# increment revision (`c:r:a' becomes `c:r+1:a').
-# 4. If any interfaces have been added, removed, or changed since the last update,
-# increment current, and set revision to 0.
-# 5. If any interfaces have been added since the last public release, then increment
-# age.
-# 6. If any interfaces have been removed since the last public release, then set age
-# to 0.
-
CLEAN_VERSION=`echo $PACKAGE_VERSION | $SED "s/p.*//"`
VERSION_MINOR=`echo $CLEAN_VERSION | $SED "s/.*\.//"`
SHARED_VERSION_INFO="1:$VERSION_MINOR:0"
-#------------------------------------------------------------------------------------
+dnl ====================================================================================
-AC_PROG_MAKE_SET
-AC_PROG_LN_S
-AC_PROG_MKDIR_P
-
-AS_IF([test "x$build_os$host_os$target_os" = "xmingw32mingw32mingw32"], [
+AS_IF([test "x${build_os}${host_os}" = "xmingw32mingw32"], [
AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
AC_CHECK_PROG(DLLWRAP, dllwrap, dllwrap)
AC_CHECK_PROG(PEXPORTS, pexports, pexports)
@@ -81,36 +90,39 @@
AC_CHECK_HEADERS([stdint.h sys/times.h])
-#====================================================================================
-# Couple of initializations here. Fill in real values later.
+dnl ====================================================================================
+dnl Couple of initializations here. Fill in real values later.
SHLIB_VERSION_ARG=""
-#====================================================================================
-# Finished checking, handle options.
+dnl ====================================================================================
+dnl Finished checking, handle options.
AC_ARG_ENABLE([werror],
- AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles]))
+ [AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])])
-AC_ARG_ENABLE([fftw],
- AS_HELP_STRING([--disable-fftw], [disable usage of FFTW ]))
-
AC_ARG_ENABLE([cpu-clip],
- AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
+ [AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])])
+AC_ARG_ENABLE([sndfile],
+ [AS_HELP_STRING([--disable-sndfile], [disable support for sndfile (default=autodetect)])], [], [enable_sndfile=auto])
+
AC_ARG_ENABLE([alsa],
- AS_HELP_STRING([--disable-alsa], [disable ALSA support in the varispeed-play example program]))
+ [AS_HELP_STRING([--disable-alsa], [disable ALSA support in the varispeed-play example program (default=autodetect)])], [], [enable_alsa=auto])
-#====================================================================================
-# Check types and their sizes.
+AC_ARG_ENABLE([fftw],
+ [AS_HELP_STRING([--disable-fftw], [disable usage of FFTW (default=autodetect)])], [], [enable_fftw=auto])
+dnl ====================================================================================
+dnl Check types and their sizes.
+
AC_CHECK_SIZEOF(int,0)
AC_CHECK_SIZEOF(long,0)
AC_CHECK_SIZEOF(float,4)
AC_CHECK_SIZEOF(double,8)
-#====================================================================================
-# Determine endian-ness of target processor.
+dnl ====================================================================================
+dnl Determine endian-ness of host processor.
AC_C_BIGENDIAN([
dnl big-endian
@@ -125,28 +137,21 @@
AC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], [Host processor is big endian.])
AC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], [Host processor is little endian.])
-#====================================================================================
-# Check for functions.
+dnl ====================================================================================
+dnl Check for functions.
-AC_CHECK_FUNCS(malloc calloc free memcpy memmove alarm signal)
+AC_CHECK_FUNCS([malloc calloc free memcpy memmove alarm signal])
-AC_CHECK_LIB([m],floor)
-AC_CHECK_FUNCS(floor ceil fmod)
+AC_SEARCH_LIBS([floor], [m], [], [
+ AC_MSG_ERROR([unable to find the floor() function!])
+ ])
+AC_CHECK_FUNCS([floor ceil fmod lrint lrintf])
AC_CHECK_SIGNAL(SIGALRM)
-AC_C99_FUNC_LRINT
-AC_C99_FUNC_LRINTF
-# AC_C99_FUNC_LLRINT Don't need this (yet?).
+dnl ====================================================================================
+dnl Determine if the processor can do clipping on float to int conversions.
-AS_IF([test "x$ac_cv_c99_lrint$ac_cv_c99_lrintf" != "xyesyes"], [
- AC_MSG_WARN([[*** Missing C99 standard functions lrint() and/or lrintf().]])
- AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
- ])
-
-#====================================================================================
-# Determine if the processor can do clipping on float to int conversions.
-
AS_IF([test "x$enable_cpu_clip" != "xno"], [
AC_C_CLIP_MODE
], [
@@ -155,79 +160,77 @@
ac_cv_c_clip_negative=0
])
-AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
- [Target processor clips on positive float to int conversion.])
-AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
- [Target processor clips on negative float to int conversion.])
+AC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}], [Host processor clips on positive float to int conversion.])
+AC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}], [Host processor clips on negative float to int conversion.])
-#====================================================================================
-# Check for libsndfile which is required for the test and example programs.
+dnl ====================================================================================
+dnl Check for libsndfile which is required for the test and example programs.
-AC_ARG_ENABLE([sndfile],
- AS_HELP_STRING([--disable-sndfile], [disable support for sndfile (default=autodetect)]))
-
-# Check for pkg-config outside the if statement.
-PKG_PROG_PKG_CONFIG
-PKG_INSTALLDIR
-
AS_IF([test "x$enable_sndfile" != "xno"], [
- PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0.6], [ac_cv_sndfile=1], [ac_cv_sndfile=0])
- ], [
- ac_cv_sndfile=0
+ PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0.6], [
+ AC_DEFINE([HAVE_SNDFILE], [1], [Set to 1 if you have libsndfile])
+ enable_sndfile="yes"
+ ], [
+ AS_IF([test "x$enable_sndfile" = "xyes"], [
+ dnl explicitly passed --enable-sndfile, hence error out loud and clearly
+ AC_MSG_ERROR([You explicitly requested libsndfile support, but libsndfile could not be found!])
+ ], [
+ dnl did not explicitly pass --enable-sndfile, relying on default automagic on
+ enable_sndfile="no (auto)"
+ ])
+ ])
])
+AM_CONDITIONAL([HAVE_LIBSNDFILE], [test "x$enable_sndfile" = "xyes"])
-AC_DEFINE_UNQUOTED([HAVE_SNDFILE], [$ac_cv_sndfile], [Set to 1 if you have libsndfile.])
+dnl ====================================================================================
+dnl Check for ALSA.
-AS_IF([test "x$ac_cv_sndfile" = "x1"], [
- ac_cv_sndfile=yes
- HAVE_SNDFILE=1
- ], [
- ac_cv_sndfile=no
- HAVE_SNDFILE=0
- ])
-
-AM_CONDITIONAL([HAVE_LIBSNDFILE], [test "x$ac_cv_sndfile" = "xyes"])
-
-#====================================================================================
-# Check for ALSA.
-
-ALSA_LIBS=""
-
AS_IF([test "x$enable_alsa" != "xno"], [
- AC_CHECK_HEADERS(alsa/asoundlib.h)
- AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [
- ALSA_LIBS="-lasound"
- enable_alsa=yes
- ], [test "x$enable_alsa" = "xyes"], [
- AC_MSG_ERROR(["ALSA headers not found"])
+ PKG_CHECK_MODULES([ALSA], [alsa], [
+ AC_DEFINE([HAVE_ALSA], [1], [Set to 1 if you have alsa])
+ enable_alsa="yes"
], [
- enable_alsa=no
+ AS_IF([test "x$enable_alsa" = "xyes"], [
+ dnl explicitly passed --enable-alsa, hence error out loud and clearly
+ AC_MSG_ERROR([You explicitly requested alsa support, but alsa could not be found!])
+ ], [
+ dnl did not explicitly pass --enable-alsa, relying on default automagic on
+ enable_alsa="no (auto)"
+ ])
])
])
-#====================================================================================
-# Check for libfftw3 which is required for the test and example programs.
+dnl ====================================================================================
+dnl Check for libfftw3 which is required for the test and example programs.
AS_IF([test "x$enable_fftw" != "xno"], [
- PKG_CHECK_MODULES([FFTW3], [fftw3 >= 0.15.0], [ac_cv_fftw3=1], [ac_cv_fftw3=0])
- AC_DEFINE_UNQUOTED([HAVE_FFTW3], [$ac_cv_fftw3], [Set to 1 if you have libfftw3.])
-
- AS_IF([test "x$ac_cv_fftw3" = "x1"], [
- ac_cv_fftw3=yes
- HAVE_FFTW3=1
+ PKG_CHECK_MODULES([FFTW3], [fftw3 >= 0.15.0], [
+ AC_DEFINE([HAVE_FFTW3], [1], [Set to 1 if you have fftw3])
+ enable_fftw="yes"
+ ], [
+ AS_IF([test "x$enable_fftw" = "xyes"], [
+ dnl explicitly passed --enable-fftw, hence error out loud and clearly
+ AC_MSG_ERROR([You explicitly requested FFTW3 support, but FFTW3 could not be found!])
+ ], [
+ dnl did not explicitly pass --enable-fftw, relying on default automagic on
+ enable_fftw="no (auto)"
+ ])
])
])
-AS_IF([test "x$ac_cv_fftw3" != "xyes"], [
- ac_cv_fftw3=no
- HAVE_FFTW3=0
- ])
+dnl ====================================================================================
+dnl Compiler stuff.
-#====================================================================================
-# Compiler stuff.
-
AS_IF([test "x$enable_flags_setting" = "xyes"], [
AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CFLAGS])
+
+ AS_CASE([${host_os}],
+ [darwin*], [
+ ldflags_test="-Wl,-dead_strip_dylibs"],
+ [linux*], [
+ ldflags_test="-Wl,-O1 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections"]
+ )
+ AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS])
])
AS_IF([test "x$enable_werror" = "xyes"], [
@@ -236,14 +239,14 @@
AX_APPEND_COMPILE_FLAGS([-W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith], [CFLAGS])
-#====================================================================================
-# GCC stuff.
-COMPILER_IS_GCC=0
+dnl ====================================================================================
+dnl GCC stuff.
+
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
# OS specific tweaks.
# Disable -Wall for Apple Darwin/Rhapsody.
# System headers on these systems are broken.
- AS_CASE([$target_os],
+ AS_CASE([${host_os}],
[darwin* | rhapsody*], [
temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall//"`
CFLAGS=$temp_CFLAGS],
@@ -250,20 +253,15 @@
[linux*|kfreebsd*-gnu*|gnu*], [
SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
])
-
- COMPILER_IS_GCC=1
- AC_DEFINE([COMPILER_IS_GCC], [1], [Set to 1 if the compile is GNU GCC.])
- GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
- AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION], [${GCC_MAJOR_VERSION}], [Major version of GCC or 3 otherwise.])
])
-#====================================================================================
-# Find known target OS.
+dnl ====================================================================================
+dnl Find known host OS.
OS_SPECIFIC_INCLUDES=""
os_is_win32=0
-AS_CASE([$target_os],
+AS_CASE([${host_os}],
[darwin* | rhapsody*], [
OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon"
OS_SPECIFIC_LINKS="-framework CoreAudio"],
@@ -275,8 +273,8 @@
OS_SPECIFIC_LINKS=""
])
-#====================================================================================
-# Now use the information from the checking stage.
+dnl ====================================================================================
+dnl Now use the information from the checking stage.
AC_DEFINE_UNQUOTED([OS_IS_WIN32], [${os_is_win32}], [Set to 1 if compiling for Win32])
@@ -285,21 +283,16 @@
AC_SUBST(OS_SPECIFIC_INCLUDES)
AC_SUBST(OS_SPECIFIC_LINKS)
-AC_SUBST(COMPILER_IS_GCC)
-AC_SUBST(GCC_MAJOR_VERSION)
-
-AC_SUBST(HAVE_FFTW3)
-AC_SUBST(HAVE_SNDFILE)
-
-AC_SUBST(ALSA_LIBS)
-
-AC_CONFIG_FILES([Makefile src/Version_script \
- Win32/Makefile Win32/Makefile.mingw \
- src/Makefile examples/Makefile tests/Makefile doc/Makefile \
- libsamplerate.spec samplerate.pc])
+AC_CONFIG_FILES([
+ Makefile
+ src/Version_script
+ Win32/Makefile.mingw
+ libsamplerate.spec
+ samplerate.pc
+ ])
AC_OUTPUT
-#====================================================================================
+dnl ====================================================================================
AX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir])
AX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir])
@@ -326,9 +319,9 @@
Extra tools required for testing and examples :
- Have FFTW : ........................... ${ac_cv_fftw3}
- Have libsndfile : ..................... ${ac_cv_sndfile}
+ Have libsndfile : ..................... ${enable_sndfile}
Have ALSA : ........................... ${enable_alsa}
+ Have FFTW : ........................... ${enable_fftw}
Installation directories :
--- a/examples/audio_out.c
+++ b/examples/audio_out.c
@@ -15,7 +15,7 @@
#include "audio_out.h"
-#if HAVE_ALSA_ASOUNDLIB_H
+#if HAVE_ALSA
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
@@ -39,7 +39,7 @@
#if defined (__linux__)
-#if HAVE_ALSA_ASOUNDLIB_H
+#if HAVE_ALSA
#define ALSA_MAGIC MAKE_MAGIC ('L', 'n', 'x', '-', 'A', 'L', 'S', 'A')
@@ -299,7 +299,7 @@
return ;
} /* alsa_close */
-#endif /* HAVE_ALSA_ASOUNDLIB_H */
+#endif /* HAVE_ALSA */
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -968,7 +968,7 @@
audio_open (int channels, int samplerate)
{
#if defined (__linux__)
- #if HAVE_ALSA_ASOUNDLIB_H
+ #if HAVE_ALSA
if (access ("/proc/asound/cards", R_OK) == 0)
return alsa_open (channels, samplerate) ;
#endif
@@ -1010,7 +1010,7 @@
} ;
#if defined (__linux__)
- #if HAVE_ALSA_ASOUNDLIB_H
+ #if HAVE_ALSA
if (audio_out->magic == ALSA_MAGIC)
alsa_play (callback, audio_out, callback_data) ;
#endif
@@ -1035,7 +1035,7 @@
audio_close (AUDIO_OUT *audio_out)
{
#if defined (__linux__)
- #if HAVE_ALSA_ASOUNDLIB_H
+ #if HAVE_ALSA
if (audio_out->magic == ALSA_MAGIC)
alsa_close (audio_out) ;
#endif
--- /dev/null
+++ b/m4/ax_append_link_flags.m4
@@ -1,0 +1,65 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# For every FLAG1, FLAG2 it is checked whether the linker works with the
+# flag. If it does, the flag is added FLAGS-VARIABLE
+#
+# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
+# used. During the check the flag is always added to the linker's flags.
+#
+# If EXTRA-FLAGS is defined, it is added to the linker's default flags
+# when the check is done. The check is thus made with the flags: "LDFLAGS
+# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
+# issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
+# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
+#
+# LICENSE
+#
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_LINK_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+ AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
+done
+])dnl AX_APPEND_LINK_FLAGS
--- /dev/null
+++ b/m4/ax_check_link_flag.m4
@@ -1,0 +1,74 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# Check whether the given FLAG works with the linker or gives an error.
+# (Warnings, however, are ignored)
+#
+# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+# success/failure.
+#
+# If EXTRA-FLAGS is defined, it is added to the linker's default flags
+# when the check is done. The check is thus made with the flags: "LDFLAGS
+# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
+# issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_LINK_IFELSE.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_LINK_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
+AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
+ ax_check_save_flags=$LDFLAGS
+ LDFLAGS="$LDFLAGS $4 $1"
+ AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ LDFLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_LINK_FLAGS
--- a/m4/lrint.m4
+++ /dev/null
@@ -1,37 +1,0 @@
-dnl @synopsis AC_C99_FUNC_LRINT
-dnl
-dnl Check whether C99's lrint function is available.
-dnl @version 1.3 Feb 12 2002
-dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
-dnl
-dnl Permission to use, copy, modify, distribute, and sell this file for any
-dnl purpose is hereby granted without fee, provided that the above copyright
-dnl and this permission notice appear in all copies. No representations are
-dnl made about the suitability of this software for any purpose. It is
-dnl provided "as is" without express or implied warranty.
-dnl
-AC_DEFUN([AC_C99_FUNC_LRINT],
-[AC_CACHE_CHECK(for lrint,
- ac_cv_c99_lrint,
-[
-lrint_save_CFLAGS=$CFLAGS
-CFLAGS="-lm"
-AC_TRY_LINK([
-#define _ISOC9X_SOURCE 1
-#define _ISOC99_SOURCE 1
-#define __USE_ISOC99 1
-#define __USE_ISOC9X 1
-
-#include <math.h>
-], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
-
-CFLAGS=$lrint_save_CFLAGS
-
-])
-
-if test "$ac_cv_c99_lrint" = yes; then
- AC_DEFINE(HAVE_LRINT, 1,
- [Define if you have C99's lrint function.])
-fi
-])# AC_C99_FUNC_LRINT
-
--- a/m4/lrintf.m4
+++ /dev/null
@@ -1,37 +1,0 @@
-dnl @synopsis AC_C99_FUNC_LRINTF
-dnl
-dnl Check whether C99's lrintf function is available.
-dnl @version 1.3 Feb 12 2002
-dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
-dnl
-dnl Permission to use, copy, modify, distribute, and sell this file for any
-dnl purpose is hereby granted without fee, provided that the above copyright
-dnl and this permission notice appear in all copies. No representations are
-dnl made about the suitability of this software for any purpose. It is
-dnl provided "as is" without express or implied warranty.
-dnl
-AC_DEFUN([AC_C99_FUNC_LRINTF],
-[AC_CACHE_CHECK(for lrintf,
- ac_cv_c99_lrintf,
-[
-lrintf_save_CFLAGS=$CFLAGS
-CFLAGS="-lm"
-AC_TRY_LINK([
-#define _ISOC9X_SOURCE 1
-#define _ISOC99_SOURCE 1
-#define __USE_ISOC99 1
-#define __USE_ISOC9X 1
-
-#include <math.h>
-], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
-
-CFLAGS=$lrintf_save_CFLAGS
-
-])
-
-if test "$ac_cv_c99_lrintf" = yes; then
- AC_DEFINE(HAVE_LRINTF, 1,
- [Define if you have C99's lrintf function.])
-fi
-])# AC_C99_FUNC_LRINTF
-
--- a/tests/calc_snr.c
+++ b/tests/calc_snr.c
@@ -10,7 +10,7 @@
#include "util.h"
-#if (HAVE_FFTW3 == 1)
+#if (HAVE_FFTW3)
#include <stdio.h>
#include <stdlib.h>