arm: wrap EABI check with a cache var

Message ID 1416521821-31271-1-git-send-email-vapier@gentoo.org
State Superseded
Headers

Commit Message

Mike Frysinger Nov. 20, 2014, 10:17 p.m. UTC
  This way people can force the test one way or the other.  It also matches
the style in other configure flags where tests are wrapper in cache vars.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
tested:
	../configure --host=armv7a-jalsjdf-linux-gnueabi -> fail
	libc_cv_arm_eabi=yes ../configure --host=armv7a-jalsjdf-linux-gnueabi -> pass
	libc_cv_arm_eabi=no ../configure --host=armv7a-jalsjdf-linux-gnueabi -> fail
	../configure --host=armv7a-unknown-linux-gnueabi -> pass
	libc_cv_arm_eabi=yes ../configure --host=armv7a-unknown-linux-gnueabi -> pass
	libc_cv_arm_eabi=no ../configure --host=armv7a-unknown-linux-gnueabi -> fail

 ChangeLog                   |  6 ++++++
 sysdeps/arm/preconfigure    | 17 ++++++++++++++---
 sysdeps/arm/preconfigure.ac |  7 ++++++-
 3 files changed, 26 insertions(+), 4 deletions(-)
  

Comments

Joseph Myers Nov. 20, 2014, 10:52 p.m. UTC | #1
On Thu, 20 Nov 2014, Mike Frysinger wrote:

> This way people can force the test one way or the other.  It also matches
> the style in other configure flags where tests are wrapper in cache vars.

OK, though I don't think overriding the results of tests in order to 
configure with a wrong-target compiler (or no compiler) is sensible.
  
Mike Frysinger Nov. 21, 2014, 12:06 a.m. UTC | #2
On 20 Nov 2014 22:52, Joseph Myers wrote:
> On Thu, 20 Nov 2014, Mike Frysinger wrote:
> > This way people can force the test one way or the other.  It also matches
> > the style in other configure flags where tests are wrapper in cache vars.
> 
> OK, though I don't think overriding the results of tests in order to 
> configure with a wrong-target compiler (or no compiler) is sensible.

i'd be fine with deleting the check altogether :)
-mike
  

Patch

diff --git a/ChangeLog b/ChangeLog
index 2fa59cf..f1db041 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2014-11-20  Mike Frysinger  <vapier@gentoo.org>
+
+	* sysdeps/arm/preconfigure.ac: Wrap EABI check in a libc_cv_arm_eabi
+	cache var.
+	* sysdeps/arm/preconfigure: Regenerate.
+
 2014-11-19  Carlos O'Donell  <carlos@redhat.com>
 	    Florian Weimer  <fweimer@redhat.com>
 	    Joseph Myers  <joseph@codesourcery.com>
diff --git a/sysdeps/arm/preconfigure b/sysdeps/arm/preconfigure
index 59d776d..c99a412 100644
--- a/sysdeps/arm/preconfigure
+++ b/sysdeps/arm/preconfigure
@@ -4,7 +4,12 @@ 
 case "$machine" in
 arm*)
 
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports ARM EABI" >&5
+$as_echo_n "checking whether $CC supports ARM EABI... " >&6; }
+if ${libc_cv_arm_eabi+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #if !__ARM_EABI__
@@ -19,11 +24,17 @@  main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  libc_cv_arm_eabi=yes
 else
-  as_fn_error $? "Old ABI no longer supported" "$LINENO" 5
+  libc_cv_arm_eabi=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_arm_eabi" >&5
+$as_echo "$libc_cv_arm_eabi" >&6; }
+  if test "$libc_cv_arm_eabi" != yes; then
+    as_fn_error $? "Old ABI no longer supported" "$LINENO" 5
+  fi
 
   # If the compiler enables unwind tables by default, this causes
   # problems with undefined symbols in -nostdlib link tests.  To
diff --git a/sysdeps/arm/preconfigure.ac b/sysdeps/arm/preconfigure.ac
index d78817b..3fe8e9c 100644
--- a/sysdeps/arm/preconfigure.ac
+++ b/sysdeps/arm/preconfigure.ac
@@ -3,10 +3,15 @@  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 
 case "$machine" in
 arm*)
+  AC_CACHE_CHECK(whether $CC supports ARM EABI,
+		 libc_cv_arm_eabi, [dnl
   AC_TRY_COMPILE([
 #if !__ARM_EABI__
 #error
-#endif], [], [], [AC_MSG_ERROR([Old ABI no longer supported])])
+#endif], [], [libc_cv_arm_eabi=yes], [libc_cv_arm_eabi=no])])
+  if test "$libc_cv_arm_eabi" != yes; then
+    AC_MSG_ERROR([Old ABI no longer supported])
+  fi
 
   # If the compiler enables unwind tables by default, this causes
   # problems with undefined symbols in -nostdlib link tests.  To