From ce2e4f524b86ac942041babed340cc8d7acfd2f9 Mon Sep 17 00:00:00 2001 From: Oneric Date: Sun, 15 Nov 2020 22:51:38 +0100 Subject: configure: let USE_ICONV depend on a usable iconv.h The result of the stdint.h check is neither used in the config script nor the code; remove the superfluous stdint-h check. As we do not use AC_CHECK_HEADERS (not-)found-callbacks or its additional includes, AC_CHECK_HEADERS_ONCE is sufficient and a tad faster; replace AC_CHECK_HEADERS with AC_CHECK_HEADERS_ONCE. --- configure.ac | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 89f6e86..40c7eec 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ AM_PROG_CC_C_O # Checks for header files. AC_HEADER_STDC AC_HEADER_STDBOOL -AC_CHECK_HEADERS([stdint.h iconv.h]) +AC_CHECK_HEADERS_ONCE([iconv.h]) # Checks for library functions. AC_CHECK_FUNCS([strdup strndup]) @@ -43,15 +43,17 @@ AC_ARG_ENABLE([large-tiles], AS_HELP_STRING([--enable-large-tiles], # and add packages to pkg-config for static linking OLDLIBS="$LIBS" LIBS= -use_libiconv=false -## Some iconv libraries like GNU's libiconv define iconv_open as a macro to -## libiconv_open. As SEARCH_LIBS tests linking not compilation, check for -## libiconv_open first. SEARCH_LIBS is smart enough to not add -liconv a second -## time in case both versions are defined in the local libiconv. -AC_SEARCH_LIBS([libiconv_open], [iconv], use_libiconv=true) -AC_SEARCH_LIBS([iconv_open], [iconv], use_libiconv=true) -AS_IF([test "x$use_libiconv" = xtrue], [ - AC_DEFINE(CONFIG_ICONV, 1, [use iconv]) +AS_IF([test "x$ac_cv_header_iconv_h" = xyes], [ + ## Some iconv libraries like GNU's libiconv define iconv_open as a macro to + ## libiconv_open. As SEARCH_LIBS tests linking not compilation, check for + ## libiconv_open first. SEARCH_LIBS is smart enough to not add -liconv a second + ## time in case both versions are defined in the local libiconv. + use_libiconv=false + AC_SEARCH_LIBS([libiconv_open], [iconv], use_libiconv=true) + AC_SEARCH_LIBS([iconv_open], [iconv], use_libiconv=true) + AS_IF([test "x$use_libiconv" = xtrue], [ + AC_DEFINE(CONFIG_ICONV, 1, [use iconv]) + ]) ]) # Locate math functions. Most systems have it either in libc or libm, but a few # have some, eg C89, functions in libc and others in libm. Use C99 lrint to probe. -- cgit v1.2.3