summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-06-03 13:38:17 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-06-03 13:38:17 +0000
commit97674b79479ca67d71cc3c1c15bdb0c050cd0c80 (patch)
tree92b1ac524eb519108ed6dda896fc701d0a294836
parent1b67fc835f8023c24101dff09c7c8987c4e903d4 (diff)
downloadmpfr-97674b79479ca67d71cc3c1c15bdb0c050cd0c80.tar.gz
Cleanup about the function detection by autoconf.
* acinclude.m4: removed the detection of memmove, memset and strtol, which was not used (a macro "HAVE_..." was defined... to be removed in configure.ac!); for AC_CHECK_FUNCS, remove options starting with "-Werror" as they can yield a spurious failure due to the way this test is done (this occurred on memmove and memset with GCC due to builtins, and similar issues could still occur in practice with the remaining functions in the AC_CHECK_FUNCS list). * configure.ac: removed HAVE_STRTOL from the macro cleanup: no longer needed since strtol has been removed from the AC_CHECK_FUNCS list. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13933 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--acinclude.m431
-rw-r--r--configure.ac2
2 files changed, 16 insertions, 17 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index a4874242d..49e2881f4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -149,22 +149,21 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
]])], [AC_DEFINE([HAVE___VA_COPY]) AC_MSG_RESULT([__va_copy])],
[AC_MSG_RESULT([memcpy])])])
-dnl FIXME: The functions memmove, memset and strtol are really needed by
-dnl MPFR, but if they are implemented as macros, this is also OK (in our
-dnl case). So, we do not return an error, but their tests are currently
-dnl useless.
-dnl Moreover, for memmove and memset, when gcc -Werror is used, these
-dnl functions are considered to be missing because of a "conflicting
-dnl types for built-in function" error. Possible workarounds if the
-dnl results of this test are used (thus one doesn't want an error):
-dnl * If "$GCC" is set, disable built-ins by adding -fno-builtin
-dnl to $CFLAGS for this test (this would yield a failure if such
-dnl functions are defined only as built-ins, but does this occur
-dnl in practice?).
-dnl * Enable -Werror only for the main compilation (and possibly
-dnl some particular tests) via a new configure option.
-dnl gettimeofday is not defined for MinGW
-AC_CHECK_FUNCS([memmove memset setlocale strtol gettimeofday signal])
+dnl Options like -Werror can yield a failure as AC_CHECK_FUNCS uses some
+dnl fixed prototype for function detection, generally incompatible with
+dnl the standard one. For instance, with GCC, if the function is defined
+dnl as a builtin, one can get a "conflicting types for built-in function"
+dnl error [-Werror=builtin-declaration-mismatch], even though the header
+dnl is not included; when these functions were tested, this occurred with
+dnl memmove and memset. Even though no failures are known with the tested
+dnl functions at this time, let's remove options starting with "-Werror"
+dnl since failures may still be possible.
+dnl
+dnl The gettimeofday function is not defined with MinGW.
+saved_CFLAGS="$CFLAGS"
+CFLAGS=`[echo " $CFLAGS" | $SED 's/ -Werror[^ ]*//g']`
+AC_CHECK_FUNCS([setlocale gettimeofday signal])
+CFLAGS="$saved_CFLAGS"
dnl We cannot use AC_CHECK_FUNCS on sigaction, because while this
dnl function may be provided by the C library, its prototype and
diff --git a/configure.ac b/configure.ac
index 87f18f923..5d369633c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -811,7 +811,7 @@ dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR and
dnl pollute (and slow down because libtool has to parse them) the build.
if test -f confdefs.h; then
for i in PACKAGE_ HAVE_STRING HAVE_DLFCN_H HAVE_MEM STDC_HEADERS \
- HAVE_STRTOL HAVE_STDLIB_H HAVE_UNISTD_H HAVE_STDC_HEADERS \
+ HAVE_STDLIB_H HAVE_UNISTD_H HAVE_STDC_HEADERS \
HAVE_LONG_DOUBLE HAVE_SYS_STAT_H HAVE_SYS_TYPES_H \
PROTOTYPES __PROTOTYPES
do