diff options
| author | 2020-08-13 10:00:34 +0200 | |
|---|---|---|
| committer | 2020-08-13 10:00:34 +0200 | |
| commit | 00bc6dadedcf62fe00c85f4967d24a3dbffd0bd0 (patch) | |
| tree | c853f94ebefaee58217c7bfb563e377524a59ad6 | |
| parent | 93dbf11118cc84eb37a500b59b683255462f5ba2 (diff) | |
| download | libplist-00bc6dadedcf62fe00c85f4967d24a3dbffd0bd0.tar.gz libplist-00bc6dadedcf62fe00c85f4967d24a3dbffd0bd0.tar.bz2 | |
Simplify configure check for fmin
AC_TRY_LINK is deprecated and users are encouraged to replace it with
AC_LINK_IFELSE. However, AC_SEARCH_LIBS uses AC_LINK_IFELSE internally
and does exactly what we need here: test whether an `fmin` symbol is
already resolved or if libm will resolve it, neatly avoiding autoconf
caching and AC_TRY_LINK/AC_LINK_IFELSE pitfalls. So just use that.
| -rw-r--r-- | configure.ac | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac index 08825be..f4e89a1 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -79,19 +79,7 @@ case ${host_os} in | |||
| 79 | esac | 79 | esac |
| 80 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) | 80 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) |
| 81 | 81 | ||
| 82 | # Check if we need libm for fmin | 82 | AC_SEARCH_LIBS([fmin],[m]) |
| 83 | CACHED_CFLAGS="$CFLAGS" | ||
| 84 | CFLAGS="-O0" | ||
| 85 | AC_CACHE_CHECK(if fmin is a builtin function, ac_cv_fmin_builtin, | ||
| 86 | AC_TRY_LINK([ | ||
| 87 | #include <math.h> | ||
| 88 | #include <float.h> | ||
| 89 | ], [ | ||
| 90 | double val = 3.1415f * 0.55555f; | ||
| 91 | double diff = fmin(val, DBL_MAX); | ||
| 92 | if (diff > 0) return 1; | ||
| 93 | ], ac_cv_fmin_builtin=yes, ac_cv_fmin_builtin=no)) | ||
| 94 | CFLAGS="$CACHED_CFLAGS" | ||
| 95 | 83 | ||
| 96 | # Check if struct tm has a tm_gmtoff member | 84 | # Check if struct tm has a tm_gmtoff member |
| 97 | AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff, | 85 | AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff, |
| @@ -153,10 +141,6 @@ AM_CONDITIONAL([HAVE_CYTHON],[test "x$cython_python_bindings" = "xyes"]) | |||
| 153 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing -fvisibility=hidden $PTHREAD_CFLAGS") | 141 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing -fvisibility=hidden $PTHREAD_CFLAGS") |
| 154 | GLOBAL_LDFLAGS="$PTHREAD_LIBS" | 142 | GLOBAL_LDFLAGS="$PTHREAD_LIBS" |
| 155 | 143 | ||
| 156 | if test "x$ac_cv_fmin_builtin" != "xyes"; then | ||
| 157 | GLOBAL_LDFLAGS+=" -lm" | ||
| 158 | fi | ||
| 159 | |||
| 160 | AC_ARG_ENABLE(debug, | 144 | AC_ARG_ENABLE(debug, |
| 161 | AS_HELP_STRING([--enable-debug], | 145 | AS_HELP_STRING([--enable-debug], |
| 162 | [build debug message output code (default is no)]), | 146 | [build debug message output code (default is no)]), |
