This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

replace CROSS_COMPILE with CROSS_DIRECTORY_STRUCTURE


This renames the CROSS_COMPILE macro to CROSS_DIRECTORY_STRUCTURE to
better reflect how it is actually used.

It should make no change whatsoever in GCC's behaviour.

There was one problematic part, in the Ada runtime; there are some
uses there of CROSS_COMPILE that I think are wrong, and I have filed
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30094> about them.  All
the other uses of CROSS_COMPILE I looked at and have verified that
they really do intend to test whether a native set of headers or
libraries are in use.

Tested by bootstrapping on powerpc-darwin8, just to make sure I didn't
introduce any syntax errors in configure.ac.
-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-crossdirstructure.patch===============
Index: gcc/ChangeLog
2006-12-06  Geoffrey Keating  <geoffk@apple.com>

	* mips-tdump.c: Replace CROSS_COMPILE with
	CROSS_DIRECTORY_STRUCTURE.
	* mips-tfile.c: Likewise.
	* gcc.c: Likewise.
	* configure.ac: Likewise.
	* cppdefault.c: Likewise.
	* Makefile.in: Likewise.
	* config/alpha/osf.h: Likewise.
	* config/i386/cygwin.h: Likewise.
	* config/i386/beos-elf.h: Likewise.
	* config/i386/nto.h: Likewise.
	* config/fr30/fr30.h: Likewise.
	* config/svr4.h: Likewise.
	* config/rs6000/aix.h: Likewise.
	* config/rs6000/sysv4.h: Likewise.
	* config/pa/pa64-hpux.h: Likewise.
	* config/pa/pa-hpux10.h: Likewise.
	* config/pa/pa-hpux11.h: Likewise.
	* collect2.c: Likewise.

Index: gcc/ada/ChangeLog
2006-12-07  Geoffrey Keating  <geoffk@apple.com>

	* Makefile.in: Replace CROSS_COMPILE with CROSS_DIRECTORY_STRUCTURE.
	* adaint.c: Likewise.

Index: gcc/mips-tdump.c
===================================================================
--- gcc/mips-tdump.c	(revision 119518)
+++ gcc/mips-tdump.c	(working copy)
@@ -29,11 +29,11 @@
 #ifdef index
 #undef index
 #endif
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #include <a.out.h>
 #else
 #include "mips/a.out.h"
-#endif /* CROSS_COMPILE */
+#endif /* CROSS_DIRECTORY_STRUCTURE */
 
 /* Include getopt.h for the sake of getopt_long.  */
 #include "getopt.h"
Index: gcc/mips-tfile.c
===================================================================
--- gcc/mips-tfile.c	(revision 119518)
+++ gcc/mips-tfile.c	(working copy)
@@ -667,11 +667,11 @@
 
 #include <signal.h>
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #include <a.out.h>
 #else
 #include "mips/a.out.h"
-#endif /* CROSS_COMPILE */
+#endif /* CROSS_DIRECTORY_STRUCTURE */
 
 #include "gstab.h"
 
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 119518)
+++ gcc/gcc.c	(working copy)
@@ -238,7 +238,7 @@
 /* Nonzero if cross-compiling.
    When -b is used, the value comes from the `specs' file.  */
 
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 static const char *cross_compile = "1";
 #else
 static const char *cross_compile = "0";
@@ -1455,7 +1455,7 @@
 #define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
 #endif
 
-#ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */
+#ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
 #undef MD_EXEC_PREFIX
 #undef MD_STARTFILE_PREFIX
 #undef MD_STARTFILE_PREFIX_1
Index: gcc/ada/Makefile.in
===================================================================
--- gcc/ada/Makefile.in	(revision 119518)
+++ gcc/ada/Makefile.in	(working copy)
@@ -228,7 +228,8 @@
 
 # IN_GCC distinguishes between code compiled into GCC itself and other
 # programs built during a bootstrap.
-# autoconf inserts -DCROSS_COMPILE if we are building a cross compiler.
+# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
+# compiler which does not use the native libraries and headers.
 INTERNAL_CFLAGS = @CROSS@ -DIN_GCC
 
 # This is the variable actually used when we compile.
Index: gcc/ada/adaint.c
===================================================================
--- gcc/ada/adaint.c	(revision 119518)
+++ gcc/ada/adaint.c	(working copy)
@@ -197,7 +197,7 @@
 #endif
 
 /* Check for cross-compilation */
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 int __gnat_is_cross_compiler = 1;
 #else
 int __gnat_is_cross_compiler = 0;
@@ -614,7 +614,7 @@
 FILE *
 __gnat_fopen (char *path, char *mode)
 {
-#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_COMPILE)
+#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_DIRECTORY_STRUCTURE)
   TCHAR wpath[GNAT_MAX_PATH_LEN];
   TCHAR wmode[10];
 
@@ -630,7 +630,7 @@
 FILE *
 __gnat_freopen (char *path, char *mode, FILE *stream)
 {
-#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_COMPILE)
+#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_DIRECTORY_STRUCTURE)
   TCHAR wpath[GNAT_MAX_PATH_LEN];
   TCHAR wmode[10];
 
@@ -1402,7 +1402,7 @@
 {
   char *result = (char *) "";
 
-#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_COMPILE)
+#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_DIRECTORY_STRUCTURE)
 
   HKEY reg_key;
   DWORD name_size, value_size;
@@ -2604,7 +2604,7 @@
 }
 #endif
 
-#if defined (CROSS_COMPILE)  \
+#if defined (CROSS_DIRECTORY_STRUCTURE)  \
   || (! ((defined (sparc) || defined (i386)) && defined (sun) \
       && defined (__SVR4)) \
       && ! (defined (linux) && (defined (i386) || defined (__x86_64__))) \
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 119518)
+++ gcc/configure.ac	(working copy)
@@ -1745,7 +1745,8 @@
   esac
 done
 
-# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
+# Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
+# cross-compiler which does not use the native headers and libraries.
 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
 CROSS=						AC_SUBST(CROSS)
 ALL=all.internal				AC_SUBST(ALL)
@@ -1762,7 +1763,7 @@
 
 if test x$host != x$target
 then
-	CROSS="-DCROSS_COMPILE"
+	CROSS="-DCROSS_DIRECTORY_STRUCTURE"
 	ALL=all.cross
 	SYSTEM_HEADER_DIR=$build_system_header_dir
 	case "$host","$target" in
Index: gcc/cppdefault.c
===================================================================
--- gcc/cppdefault.c	(revision 119518)
+++ gcc/cppdefault.c	(working copy)
@@ -33,7 +33,7 @@
 #define STANDARD_INCLUDE_COMPONENT 0
 #endif
 
-#if defined (CROSS_COMPILE) && !defined (TARGET_SYSTEM_ROOT)
+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
 # undef LOCAL_INCLUDE_DIR
 # undef SYSTEM_INCLUDE_DIR
 # undef STANDARD_INCLUDE_DIR
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 119518)
+++ gcc/Makefile.in	(working copy)
@@ -820,7 +820,8 @@
 
 # IN_GCC distinguishes between code compiled into GCC itself and other
 # programs built during a bootstrap.
-# autoconf inserts -DCROSS_COMPILE if we are building a cross compiler.
+# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a
+# cross compiler which does not use the native headers and libraries.
 INTERNAL_CFLAGS = -DIN_GCC @CROSS@
 
 # This is the variable actually used when we compile. If you change this,
Index: gcc/config/alpha/osf.h
===================================================================
--- gcc/config/alpha/osf.h	(revision 119518)
+++ gcc/config/alpha/osf.h	(working copy)
@@ -138,7 +138,7 @@
 #define SUBTARGET_EXTRA_SPECS { "asm_oldas", ASM_OLDAS_SPEC }
 
 /* Indicate that we have a stamp.h to use.  */
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #define HAVE_STAMP_H 1
 #endif
 
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h	(revision 119518)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -146,7 +146,7 @@
 #undef TOOL_INCLUDE_DIR
 #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef STANDARD_INCLUDE_DIR
 #define STANDARD_INCLUDE_DIR "/usr/include"
 char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
Index: gcc/config/i386/beos-elf.h
===================================================================
--- gcc/config/i386/beos-elf.h	(revision 119518)
+++ gcc/config/i386/beos-elf.h	(working copy)
@@ -135,7 +135,7 @@
    for the BeOS include files relative to TOOL_INCLUDE_DIR.  Yes, we
    use ANSI string concatenation here (FIXME) */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef INCLUDE_DEFAULTS
 #define INCLUDE_DEFAULTS \
     { \
@@ -177,7 +177,7 @@
     { "/boot/develop/headers", 0, 0, 0 }, \
     { 0, 0, 0, 0 } \
     }
-#else /* CROSS_COMPILE */
+#else /* CROSS_DIRECTORY_STRUCTURE */
 #undef	INCLUDE_DEFAULTS
 #define INCLUDE_DEFAULTS				\
     { \
Index: gcc/config/i386/nto.h
===================================================================
--- gcc/config/i386/nto.h	(revision 119518)
+++ gcc/config/i386/nto.h	(working copy)
@@ -43,7 +43,7 @@
 #undef THREAD_MODEL_SPEC
 #define THREAD_MODEL_SPEC "posix"
 
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 #define SYSROOT_SUFFIX_SPEC "x86"
 #endif
 
Index: gcc/config/fr30/fr30.h
===================================================================
--- gcc/config/fr30/fr30.h	(revision 119518)
+++ gcc/config/fr30/fr30.h	(working copy)
@@ -1110,7 +1110,7 @@
 #define FUNCTION_MODE QImode
 
 /* If cross-compiling, don't require stdio.h etc to build libgcc.a.  */
-#if defined CROSS_COMPILE && ! defined inhibit_libc
+#if defined CROSS_DIRECTORY_STRUCTURE && ! defined inhibit_libc
 #define inhibit_libc
 #endif
 
Index: gcc/config/svr4.h
===================================================================
--- gcc/config/svr4.h	(revision 119518)
+++ gcc/config/svr4.h	(working copy)
@@ -84,7 +84,7 @@
 /* Under svr4, the normal location of the `ld' and `as' programs is the
    /usr/ccs/bin directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef  MD_EXEC_PREFIX
 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
 #endif
@@ -92,7 +92,7 @@
 /* Under svr4, the normal location of the various *crt*.o files is the
    /usr/ccs/lib directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef  MD_STARTFILE_PREFIX
 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
 #endif
@@ -136,7 +136,7 @@
    not being done.  */
 
 #undef	LINK_SPEC
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 #define LINK_SPEC "%{h*} %{v:-V} \
 		   %{b} \
 		   %{static:-dn -Bstatic} \
Index: gcc/config/rs6000/aix.h
===================================================================
--- gcc/config/rs6000/aix.h	(revision 119518)
+++ gcc/config/rs6000/aix.h	(working copy)
@@ -124,14 +124,14 @@
 /* #define ASM_SPEC "-u %(asm_cpu)" */
 
 /* Default location of syscalls.exp under AIX */
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
 #else
 #define LINK_SYSCALLS_SPEC ""
 #endif
 
 /* Default location of libg.exp under AIX */
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
 #else
 #define LINK_LIBG_SPEC ""
Index: gcc/config/rs6000/sysv4.h
===================================================================
--- gcc/config/rs6000/sysv4.h	(revision 119518)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -640,7 +640,7 @@
 %{profile: -p}"
 
 /* Don't put -Y P,<path> for cross compilers.  */
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #define LINK_PATH_SPEC "\
 %{!R*:%{L*:-R %*}} \
 %{!nostdlib: %{!YP,*: \
Index: gcc/config/pa/pa64-hpux.h
===================================================================
--- gcc/config/pa/pa64-hpux.h	(revision 119518)
+++ gcc/config/pa/pa64-hpux.h	(working copy)
@@ -88,7 +88,7 @@
 /* Under hpux11, the normal location of the `ld' and `as' programs is the
    /usr/ccs/bin directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_EXEC_PREFIX
 #define MD_EXEC_PREFIX "/usr/ccs/bin"
 #endif
@@ -105,12 +105,12 @@
    is the /usr/ccs/lib/pa20_64 directory.  Some files may also be in the
    /opt/langtools/lib/pa20_64 directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_STARTFILE_PREFIX
 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/pa20_64/"
 #endif
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_STARTFILE_PREFIX_1
 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/pa20_64/"
 #endif
Index: gcc/config/pa/pa-hpux10.h
===================================================================
--- gcc/config/pa/pa-hpux10.h	(revision 119518)
+++ gcc/config/pa/pa-hpux10.h	(working copy)
@@ -122,7 +122,7 @@
 /* Under hpux10, the normal location of the `ld' and `as' programs is the
    /usr/ccs/bin directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_EXEC_PREFIX
 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
 #endif
@@ -131,7 +131,7 @@
    the /usr/ccs/lib directory.  However, the profiling files are in
    /opt/langtools/lib.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_STARTFILE_PREFIX
 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
Index: gcc/config/pa/pa-hpux11.h
===================================================================
--- gcc/config/pa/pa-hpux11.h	(revision 119518)
+++ gcc/config/pa/pa-hpux11.h	(working copy)
@@ -147,7 +147,7 @@
 /* Under hpux11, the normal location of the `ld' and `as' programs is the
    /usr/ccs/bin directory.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_EXEC_PREFIX
 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
 #endif
@@ -156,7 +156,7 @@
    the /usr/ccs/lib directory.  However, the profiling files are in
    /opt/langtools/lib.  */
 
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #undef MD_STARTFILE_PREFIX
 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
Index: gcc/collect2.c
===================================================================
--- gcc/collect2.c	(revision 119518)
+++ gcc/collect2.c	(working copy)
@@ -53,7 +53,7 @@
    the utilities are not correct for a cross-compiler; we have to hope that
    cross-versions are in the proper directories.  */
 
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 #undef OBJECT_FORMAT_COFF
 #undef MD_EXEC_PREFIX
 #undef REAL_LD_FILE_NAME
@@ -553,7 +553,7 @@
 
 static struct path_prefix cpath, path;
 
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
 /* This is the name of the target machine.  We use it to form the name
    of the files to execute.  */
 
@@ -746,7 +746,7 @@
   static const char *const strip_suffix = "strip";
   static const char *const gstrip_suffix = "gstrip";
 
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
   /* If we look for a program in the compiler directories, we just use
      the short name, since these directories are already system-specific.
      But it we look for a program in the system directories, we need to
@@ -775,7 +775,7 @@
 #endif
   const char *const full_strip_suffix	= strip_suffix;
   const char *const full_gstrip_suffix	= gstrip_suffix;
-#endif /* CROSS_COMPILE */
+#endif /* CROSS_DIRECTORY_STRUCTURE */
 
   const char *arg;
   FILE *outf;
@@ -957,7 +957,7 @@
   c_file_name = getenv ("COLLECT_GCC");
   if (c_file_name == 0)
     {
-#ifdef CROSS_COMPILE
+#ifdef CROSS_DIRECTORY_STRUCTURE
       c_file_name = concat (target_machine, "-gcc", NULL);
 #else
       c_file_name = "gcc";
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]