grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] compiling on x86_64 (again)


From: Ruslan Nikolaev
Subject: [PATCH] compiling on x86_64 (again)
Date: Tue, 9 Aug 2005 17:48:50 -0700 (PDT)

Hi!
 
I send patch again (patch in previous message was broken).
CC_ARCH is used just for saving CC for BUILD_CC; CC in turns overrides for x86_64
 
x86_64 uses separate host_cpu and host_vendor, but during configuring will be created links onto i386-specific files.
 
ChangeLog:
 
2005-08-08  Ruslan Nikolaev  <address@hidden>
   * configure.ac: Added x86_64 support.
 
PATCH:
 
diff -urN old/configure.ac new/configure.ac
--- old/configure.ac 2005-08-08 19:08:41.000000000 +0000
+++ new/configure.ac 2005-08-09 01:25:14.135290880 +0000
@@ -22,16 +22,27 @@
 
 case "$host_cpu" in
   i[[3456]]86) host_cpu=i386 ;;
+  x86_64) ;;
   powerpc) ;;
   *) AC_MSG_ERROR([unsupported CPU type]) ;;
 esac
 
 case "$host_cpu"-"$host_vendor" in
   i386-*) host_vendor=pc ;;
+  x86_64-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
   *) AC_MSG_ERROR([unsupported machine type]) ;;
 esac
 
+# Keep CC for BUILD_CC
+CC_ARCH="$CC"
+
+# Override x86_64 settings
+if test "x$host_cpu" = xx86_64; then
+  CC="$CC -m32"
+  LD="ld -melf_i386"
+fi
+
 AC_SUBST(host_cpu)
 AC_SUBST(host_vendor)
 
@@ -62,8 +73,8 @@
     tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
   fi
 
-  # Force no alignment to save space on i386.
-  if test "x$host_cpu" = xi386; then
+  # Force no alignment to save space on i386/x86_64.
+  if test "x$host_cpu" = xi386 -o "x$host_cpu" = xx86_64; then
     AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
       CFLAGS="-falign-loops=1"
       AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
@@ -82,13 +93,13 @@
 
 # Defined in aclocal.m4.
 grub_ASM_USCORE
-if test "x$host_cpu" = xi386; then
+if test "x$host_cpu" = xi386 -o "x$host_cpu" = xx86_64; then
   grub_CHECK_START_SYMBOL
   grub_CHECK_BSS_START_SYMBOL
   grub_CHECK_END_SYMBOL
 fi
 
-if test "x$host_cpu" = xi386; then
+if test "x$host_cpu" = xi386 -o "x$host_cpu" = xx86_64; then
   grub_I386_ASM_PREFIX_REQUIREMENT
   grub_I386_ASM_ADDR32
   grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
@@ -113,7 +124,7 @@
   AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
    [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
 else
-  BUILD_CC="$CC"
+  BUILD_CC="$CC_ARCH"
   AC_SUBST(BUILD_CC)
 fi
 
@@ -130,8 +141,8 @@
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(long)
 
-# Check LZO when compiling for the i386.
-if test "x$host_cpu" = xi386; then
+# Check LZO when compiling for the i386/x86_64.
+if test "x$host_cpu" = xi386 -o "x$host_cpu" = xx86_64; then
   AC_CHECK_LIB(lzo, __lzo_init2, ,
         AC_MSG_ERROR([LZO library version 1.02 or later is required]))
   AC_CHECK_FUNC(lzo1x_999_compress, ,
@@ -150,6 +161,13 @@
 CFLAGS="$tmp_CFLAGS"
 CPPFLAGS="$tmp_CPPFLAGS"
 
+# Create links for x86_64
+if test "x$host_cpu" = xx86_64; then
+  AC_CONFIG_LINKS([include/grub/x86_64:include/grub/i386])
+  AC_CONFIG_LINKS([conf/x86_64-$host_vendor.mk:conf/i386-$host_vendor.mk
+   conf/x86_64-$host_vendor.rmk:conf/i386-$host_vendor.rmk])
+fi
+
 # Output files.
 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu
  include/grub/machine:include/grub/$host_cpu/$host_vendor])


Yahoo! Mail
Stay connected, organized, and protected. Take the tour
reply via email to

[Prev in Thread] Current Thread [Next in Thread]