about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-12-12 13:56:47 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-12-12 13:56:47 +0000
commit8df5d34720dd71e934545bade879e04697830757 (patch)
treeaf607d1b63037ad92901e4ed8a4a71f95270ee31 /configure.ac
parent0cee1257a96fc2983c7cc0717015ad54d81ceff3 (diff)
downloadglibc-8df5d34720dd71e934545bade879e04697830757.tar.gz
glibc-8df5d34720dd71e934545bade879e04697830757.tar.xz
glibc-8df5d34720dd71e934545bade879e04697830757.zip
Remove --with-fp / --without-fp.
There is a configure option --without-fp that specifies that nofpu
sysdeps directories should be used instead of fpu directories.

For most glibc configurations, this option is of no use: either there
is no valid nofpu variant of that configuration, or there are no fpu
or nofpu sysdeps directories for that processor and so the option does
nothing.  For a few configurations, if you are using a soft-float
compiler this option is required, and failing to use it generally
results in compilation errors from inline asm using unavailable
floating-point instructions.

We're moving away from --with-cpu to configuring glibc based on how
the compiler generates code, and it is natural to do so for
--without-fp as well; in most cases the soft-float and hard-float ABIs
are incompatible so you have no hope of building a working glibc with
an inappropriately configured compiler or libgcc.

This patch eliminates --without-fp, replacing it entirely by automatic
configuration based on the compiler.  Configurations for which this is
relevant (coldfire / mips / powerpc32 / sh) define a variable
with_fp_cond in their preconfigure fragments (under the same
conditions under which those fragments do anything); this is a
preprocessor conditional which the toplevel configure script then uses
in a test to determine which sysdeps directories to use.

The config.make with-fp variable remains.  It's used only by powerpc
(sysdeps/powerpc/powerpc32/Makefile) to add -mhard-float to various
flags variables.  For powerpc, -mcpu= options can imply use of
soft-float.  That could be an issue if you want to build for
e.g. 476fp, but are using --with-cpu=476 because there isn't a 476fp
sysdeps directory.  If in future we eliminate --with-cpu and replace
it entirely by testing the compiler, it would be natural at that point
to eliminate that code as well (as the user should then just use a
compiler defaulting to 476fp and the 476 sysdeps directory would be
used automatically).

Tested for x86_64, and tested with build-many-glibcs.py that installed
shared libraries are unchanged by this patch.

	* configure.ac (--with-fp): Remove configure option.
	(with_fp_cond): New variable.
	(libc_cv_with_fp): New configure test.  Use this variable instead
	of with_fp.
	* configure: Regenerated.
	* config.make.in (with-fp): Use @libc_cv_with_fp@.
	* manual/install.texi (Configuring and compiling): Remove
	--without-fp.
	* INSTALL: Regenerated.
	* sysdeps/m68k/preconfigure (with_fp_cond): Define for ColdFire.
	* sysdeps/mips/preconfigure (with_fp_cond): Define.
	* sysdeps/powerpc/preconfigure (with_fp_cond): Define for 32-bit.
	* sysdeps/sh/preconfigure (with_fp_cond): Define.
	* scripts/build-many-glibcs.py (Context.add_all_configs): Do not
	use --without-fp to configure glibc.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 24 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index f85a50da53..edf662715b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,12 +127,6 @@ libgd-LDFLAGS = $libgd_ldflags"
 fi
 
 dnl Arguments to specify presence of other packages/features.
-AC_ARG_WITH([fp],
-	    AC_HELP_STRING([--with-fp],
-			   [if using floating-point hardware @<:@default=yes@:>@]),
-	    [with_fp=$withval],
-	    [with_fp=yes])
-AC_SUBST(with_fp)
 AC_ARG_WITH([binutils],
 	    AC_HELP_STRING([--with-binutils=PATH],
 			   [specify location of binutils (as and ld)]),
@@ -489,6 +483,11 @@ AC_ARG_WITH([cpu],
 # check below.
 libc_config_ok=no
 
+# A preconfigure script for a system that may or may not use fpu
+# sysdeps directories sets this to a preprocessor conditional for
+# whether to use such directories.
+with_fp_cond=1
+
 dnl Let sysdeps/*/preconfigure act here.
 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
 
@@ -517,6 +516,24 @@ fi
 test -n "$base_machine" || base_machine=$machine
 AC_SUBST(base_machine)
 
+# Determine whether to use fpu or nofpu sysdeps directories.
+AC_CACHE_CHECK([for use of fpu sysdeps directories],
+	       libc_cv_with_fp, [dnl
+cat > conftest.c <<EOF
+#if $with_fp_cond
+int dummy;
+#else
+# error "no hardware floating point"
+#endif
+EOF
+libc_cv_with_fp=no
+if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
+   1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
+  libc_cv_with_fp=yes
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_with_fp)
+
 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
 		   [libc_cv_ssp=yes],
@@ -720,7 +737,7 @@ tail=$machine${submachine:+/$submachine}
 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
   set $m
   # Prepend the machine's FPU directory unless --without-fp.
-  if test "$with_fp" = yes; then
+  if test "$libc_cv_with_fp" = yes; then
     maybe_fpu=/fpu
   else
     maybe_fpu=/nofpu