diff --git a/ChangeLog b/ChangeLog index b279f2f..78babfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-07-17 Vladimir Serbinenko + Always compile efiemu32.o + + * Makefile.in (enable_efiemu): Change to ... + (enable_efiemu64): ... this. + * conf/i386-pc.rmk (efiemu32.o): Always compile this target- + * configure.ac: Change enable-efiemu to enable-efiemu64. + Restrict efiemu compilation to i386-pc. + +2009-07-17 Vladimir Serbinenko + Fall back to efiemu32.o if efiemu64.o isn't available. * conf/i386-pc.rmk (efiemu_mod_SOURCES): diff --git a/Makefile.in b/Makefile.in index 8e2cdc6..52e7ae6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ enable_grub_pe2elf = @enable_grub_pe2elf@ enable_grub_mkfont = @enable_grub_mkfont@ freetype_cflags = @freetype_cflags@ freetype_libs = @freetype_libs@ -enable_efiemu = @enable_efiemu@ +enable_efiemu64 = @enable_efiemu64@ ### General variables. diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 86bdeb6..4b343b4 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -398,8 +398,6 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c hdparm_mod_CFLAGS = $(COMMON_CFLAGS) hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS) -ifeq ($(enable_efiemu), yes) - efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF) -rm -f $@ ifeq ($(TARGET_APPLE_CC), 1) @@ -412,6 +410,11 @@ else if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi endif +CLEANFILES += efiemu32.o +pkglib_DATA += efiemu32.o + +ifeq ($(enable_efiemu64), yes) + efiemu64_c.o: efiemu/runtime/efiemu.c ifeq ($(TARGET_APPLE_CC), 1) $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude @@ -439,8 +442,8 @@ else if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi endif -CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o -pkglib_DATA += efiemu32.o efiemu64.o +CLEANFILES += efiemu64.o efiemu64_c.o efiemu64_s.o +pkglib_DATA += efiemu64.o endif diff --git a/configure.ac b/configure.ac index 549b35c..3d53113 100644 --- a/configure.ac +++ b/configure.ac @@ -408,33 +408,34 @@ AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) #define NESTED_FUNC_ATTR #endif]) -AC_ARG_ENABLE([efiemu], - [AS_HELP_STRING([--enable-efiemu], - [build and install the efiemu runtimes (default=guessed)])]) -if test x"$enable_efiemu" = xno ; then - efiemu_excuse="explicitly disabled" -fi -if test x"$efiemu_excuse" = x ; then - AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ +if test "$target_cpu"-"$platform" = i386-pc; then +AC_ARG_ENABLE([efiemu-all], + [AS_HELP_STRING([--enable-efiemu-all], + [build and install the all efiemu runtimes (default=guessed)])]) +if test x"$enable_efiemu_all" = xno ; then + efiemuall_excuse="explicitly disabled" +fi +if test x"$efiemuall_excuse" = x ; then + AC_CACHE_CHECK([whether options required for 64-bit efiemu work], grub_cv_cc_efiemu64, [ CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_efiemu=yes], - [grub_cv_cc_efiemu=no]) + [grub_cv_cc_efiemu64=yes], + [grub_cv_cc_efiemu64=no]) ]) - if test x$grub_cv_cc_efiemu = xno; then - efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" + if test x$grub_cv_cc_efiemu64 = xno; then + efiemuall_excuse="can't compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" fi fi -if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then - AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) +if test x"$enable_efiemu_all" = xyes && test x"$efiemuall_excuse" != x ; then + AC_MSG_ERROR([All efiemu runtime was explicitly requested but can't be compiled.]) fi -if test x"$efiemu_excuse" = x ; then -enable_efiemu=yes +if test x"$efiemuall_excuse" = x ; then +enable_efiemu64=yes else -enable_efiemu=no +enable_efiemu64=no +fi +AC_SUBST([enable_efiemu64]) fi -AC_SUBST([enable_efiemu]) - # Restore the flags. CC="$tmp_CC" @@ -603,10 +604,12 @@ echo grub-pe2elf will be built but not installed else echo grub-pe2elf will not be built fi -if [ x"$efiemu_excuse" = x ]; then -echo efiemu runtime: Yes +if test "$target_cpu"-"$platform" = i386-pc; then +if [ x"$efiemuall_excuse" = x ]; then +echo All efiemu runtimes: Yes else -echo efiemu runtime: No "($efiemu_excuse)" +echo All efiemu runtimes: No "($efiemuall_excuse)" +fi fi if [ x"$grub_fstest_excuse" = x ]; then echo grub-fstest: Yes