2008-08-18 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@gnu.org>
Mon, 18 Aug 2008 09:42:17 +0000 (09:42 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 18 Aug 2008 09:42:17 +0000 (09:42 +0000)
* configure.in (--with-cpu): Check compiler support for -march/-mcpu.
* configure: Regenerated.
* config.make.in (cflags-cpu): New substituted variable.
(with-cpu): Variable removed.
* Makeconfig (+cflags): Use $(cflags-cpu), not $(with-cpu).

Makeconfig
config.make.in
configure
configure.in

index a78615e..83e1409 100644 (file)
@@ -643,7 +643,7 @@ ifeq        "$(strip $(+cflags))" ""
 +cflags        := $(default_cflags)
 endif  # $(+cflags) == ""
 
-+cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants)
 +gcc-nowarn := -w
 
 # Don't duplicate options if we inherited variables from the parent.
index 3fd0abc..aa73466 100644 (file)
@@ -31,7 +31,7 @@ base-machine = @base_machine@
 config-vendor = @host_vendor@
 config-os = @host_os@
 config-sysdirs = @sysnames@
-with-cpu = @submachine@
+cflags-cpu = @libc_cv_cc_submachine@
 
 defines = @DEFINES@
 sysincludes = @SYSINCLUDES@
index 6ffe5e6..73f1996 100755 (executable)
--- a/configure
+++ b/configure
@@ -730,6 +730,7 @@ libc_cv_gnu89_inline
 libc_cv_have_initfini
 no_whole_archive
 exceptions
+libc_cv_cc_submachine
 LIBGD
 have_libaudit
 have_libcap
@@ -2329,7 +2330,6 @@ echo "$as_me: error: --with-cpu requires an argument" >&2;}
 fi
 
 
-
 # An add-on can set this when it wants to disable the sanity check below.
 libc_config_ok=no
 
@@ -7097,6 +7097,35 @@ _ACEOF
   fi
 fi
 
+if test -n "$submachine"; then
+  { echo "$as_me:$LINENO: checking for compiler option for CPU variant" >&5
+echo $ECHO_N "checking for compiler option for CPU variant... $ECHO_C" >&6; }
+if test "${libc_cv_cc_submachine+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    libc_cv_cc_submachine=no
+  for opt in "-march=$submachine" "-mcpu=$submachine"; do
+    if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      libc_cv_cc_submachine="$opt"
+      break
+    fi
+  done
+fi
+{ echo "$as_me:$LINENO: result: $libc_cv_cc_submachine" >&5
+echo "${ECHO_T}$libc_cv_cc_submachine" >&6; }
+  if test "x$libc_cv_cc_submachine" = xno; then
+    { { echo "$as_me:$LINENO: error: ${CC-cc} does not support $submachine" >&5
+echo "$as_me: error: ${CC-cc} does not support $submachine" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
 { echo "$as_me:$LINENO: checking for libgd" >&5
 echo $ECHO_N "checking for libgd... $ECHO_C" >&6; }
 if test "$with_gd" != "no"; then
@@ -9264,6 +9293,7 @@ libc_cv_gnu89_inline!$libc_cv_gnu89_inline$ac_delim
 libc_cv_have_initfini!$libc_cv_have_initfini$ac_delim
 no_whole_archive!$no_whole_archive$ac_delim
 exceptions!$exceptions$ac_delim
+libc_cv_cc_submachine!$libc_cv_cc_submachine$ac_delim
 LIBGD!$LIBGD$ac_delim
 have_libaudit!$have_libaudit$ac_delim
 have_libcap!$have_libcap$ac_delim
@@ -9301,7 +9331,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index cd08a23..1651d38 100644 (file)
@@ -326,7 +326,6 @@ AC_ARG_WITH([cpu],
   esac
 ])
 
-
 # An add-on can set this when it wants to disable the sanity check below.
 libc_config_ok=no
 
@@ -1973,6 +1972,22 @@ EOF
   fi
 fi
 
+if test -n "$submachine"; then
+  AC_CACHE_CHECK([for compiler option for CPU variant],
+                libc_cv_cc_submachine, [dnl
+  libc_cv_cc_submachine=no
+  for opt in "-march=$submachine" "-mcpu=$submachine"; do
+    if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
+      libc_cv_cc_submachine="$opt"
+      break
+    fi
+  done])
+  if test "x$libc_cv_cc_submachine" = xno; then
+    AC_MSG_ERROR([${CC-cc} does not support $submachine])
+  fi
+fi
+AC_SUBST(libc_cv_cc_submachine)
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then