]> git.proxmox.com Git - grub2.git/commitdiff
2008-07-17 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Thu, 17 Jul 2008 20:19:55 +0000 (20:19 +0000)
committerproski <proski@localhost>
Thu, 17 Jul 2008 20:19:55 +0000 (20:19 +0000)
* aclocal.m4 (grub_PROG_TARGET_CC): New macro.  Check if the
target compiler is functional.
* configure.ac: Call grub_PROG_TARGET_CC once all target flags
are set up.

ChangeLog
aclocal.m4
configure
configure.ac

index cef28b90b9922868c6b381d3f7915e8784817844..1437af557ffbb2ece15d2ccffad1b008e3db5681 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-07-17  Pavel Roskin  <proski@gnu.org>
 
+       * aclocal.m4 (grub_PROG_TARGET_CC): New macro.  Check if the
+       target compiler is functional.
+       * configure.ac: Call grub_PROG_TARGET_CC once all target flags
+       are set up.
+
        * configure.ac: Default to efi platform for x86_64-apple.  Allow
        powerpc64 CPU, default to ieee1275 platform for it.  Split CPU
        adjustments from the rest, only do them if target is not
index a6732636a781bcbb771dc5a4ac971e7527332ab5..b7cc0a22e923937f87b6311898e7f6ca20f70d59 100644 (file)
@@ -1,3 +1,19 @@
+dnl Check whether target compiler is working
+AC_DEFUN(grub_PROG_TARGET_CC,
+[AC_MSG_CHECKING([whether target compiler is working])
+AC_CACHE_VAL(grub_cv_prog_target_cc,
+[AC_TRY_LINK([], [],
+   grub_cv_prog_target_cc=yes,
+   grub_cv_prog_target_cc=no)
+])
+AC_MSG_RESULT([$grub_cv_prog_target_cc])
+
+if test "x$grub_cv_prog_target_cc" = xno; then
+  AC_MSG_ERROR([cannot compile for the target])
+fi
+])
+
+
 dnl grub_ASM_USCORE checks if C symbols get an underscore after
 dnl compiling to assembler.
 dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
index cc92328ac47a71c659d0e61266a19a253f901d63..ede2168d20c60dbae9fe739629f5ea4c90a713d1 100644 (file)
--- a/configure
+++ b/configure
@@ -6766,6 +6766,66 @@ CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"
 
 # Defined in aclocal.m4.
+{ echo "$as_me:$LINENO: checking whether target compiler is working" >&5
+echo $ECHO_N "checking whether target compiler is working... $ECHO_C" >&6; }
+if test "${grub_cv_prog_target_cc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  grub_cv_prog_target_cc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       grub_cv_prog_target_cc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+{ echo "$as_me:$LINENO: result: $grub_cv_prog_target_cc" >&5
+echo "${ECHO_T}$grub_cv_prog_target_cc" >&6; }
+
+if test "x$grub_cv_prog_target_cc" = xno; then
+  { { echo "$as_me:$LINENO: error: cannot compile for the target" >&5
+echo "$as_me: error: cannot compile for the target" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
 { echo "$as_me:$LINENO: checking whether ${OBJCOPY} works for absolute addresses" >&5
 echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses... $ECHO_C" >&6; }
 if test "${grub_cv_prog_objcopy_absolute+set}" = set; then
index 164f760492fc57195362584138101e62b07a3699..4d47f64cd0514983e16d7b68dfa959284fb54cc8 100644 (file)
@@ -286,6 +286,7 @@ CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"
 
 # Defined in aclocal.m4.
+grub_PROG_TARGET_CC
 grub_PROG_OBJCOPY_ABSOLUTE
 grub_PROG_LD_BUILD_ID_NONE
 grub_ASM_USCORE