diff --git a/ChangeLog b/ChangeLog index cef28b90b..1437af557 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-07-17 Pavel Roskin + * 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 diff --git a/aclocal.m4 b/aclocal.m4 index a6732636a..b7cc0a22e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 diff --git a/configure b/configure index cc92328ac..ede2168d2 100644 --- 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 diff --git a/configure.ac b/configure.ac index 164f76049..4d47f64cd 100644 --- a/configure.ac +++ b/configure.ac @@ -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