diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-15 16:20:18 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-15 16:20:18 +0000 |
commit | f2df60d18c31d1e768bafe1368d3c823b20c7aff (patch) | |
tree | a41bf40859a39d8a1f7b506ce34a6dae93ffed84 | |
parent | eb76d255b6ecd5b274463ca6431df492a42c10ad (diff) | |
parent | d093d5bd6133d2320f52a6b0a32c2113f393adfc (diff) | |
download | gcc-tarball-f2df60d18c31d1e768bafe1368d3c823b20c7aff.tar.gz |
Merge branch 'baserock/samthursfield/build-essential-2-rebase' into baserock/build-essential
-rw-r--r-- | gcc.morph | 6 | ||||
-rw-r--r-- | gcc.morph.yaml | 37 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/config.gcc | 15 | ||||
-rw-r--r-- | gcc/config/gnu.h | 4 | ||||
-rw-r--r-- | gcc/config/i386/djgpp.h | 4 | ||||
-rw-r--r-- | gcc/config/i386/mingw32.h | 8 | ||||
-rw-r--r-- | gcc/config/i386/t-djgpp | 2 | ||||
-rw-r--r-- | gcc/config/i386/t-mingw-w32 | 3 | ||||
-rw-r--r-- | gcc/config/i386/t-mingw-w64 | 3 | ||||
-rw-r--r-- | gcc/config/i386/t-mingw32 | 3 | ||||
-rw-r--r-- | gcc/config/openbsd.h | 4 | ||||
-rw-r--r-- | gcc/config/spu/spu-elf.h | 5 | ||||
-rw-r--r-- | gcc/config/spu/t-spu-elf | 4 | ||||
-rw-r--r-- | gcc/config/t-gnu | 2 | ||||
-rw-r--r-- | gcc/config/vms/xm-vms.h | 3 | ||||
-rwxr-xr-x | gcc/configure | 35 | ||||
-rw-r--r-- | gcc/configure.ac | 27 | ||||
-rw-r--r-- | gcc/cppdefault.c | 22 | ||||
-rw-r--r-- | gcc/doc/fragments.texi | 9 | ||||
-rw-r--r-- | gcc/doc/install.texi | 16 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 30 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 30 | ||||
-rwxr-xr-x | morph-arch-config | 10 | ||||
-rw-r--r-- | stage1-gcc.morph | 15 | ||||
-rw-r--r-- | stage1-gcc.morph.yaml | 48 | ||||
-rw-r--r-- | stage2-gcc.morph | 17 | ||||
-rw-r--r-- | stage2-gcc.morph.yaml | 85 |
28 files changed, 322 insertions, 128 deletions
@@ -3,10 +3,7 @@ "kind": "chunk", "configure-commands": [ "mkdir o", - "cd o && touch configure-flags", - "cd o && if echo \"$TOOLCHAIN_TARGET\" | grep arm; then echo \"--with-arch=armv7-a\" >> configure-flags; fi", - "cd o && ../configure $(cat configure-flags) --prefix=\"$PREFIX\" --libdir=\"$PREFIX/lib\" --disable-libgomp --disable-multilib --disable-nls --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-threads=posix --without-cloog --without-ppl --with-mpfr-include=\"$(pwd)/../mpfr/src\" --with-mpfr-lib=\"$(pwd)/mpfr/src/.libs\"", - "if [ ! -d /usr/include ]; then mkdir /usr; ln -s /tools/include /usr/include; fi" + "cd o && \\\n../configure \\\n $(morph-arch-config) \\\n --prefix=\"$PREFIX\" \\\n `# [1]` --libdir=$PREFIX/lib \\\n --disable-nls \\\n --enable-languages=c,c++ --enable-shared --enable-threads=posix \\\n `# [2]` --disable-multilib \\\n `# [3]` --disable-libgomp --without-cloog --without-ppl \\\n `# [4]` --enable-__cxa_atexit \\\n `# [5]` --with-mpfr-include=\"$(pwd)/../mpfr/src\" \\\n --with-mpfr-lib=\"$(pwd)/mpfr/src/.libs\" \\\n `# [6]` --with-system-zlib\n" ], "build-commands": [ "cd o && make" @@ -16,4 +13,3 @@ "ln -s gcc \"$DESTDIR/$PREFIX/bin/cc\"" ] } - diff --git a/gcc.morph.yaml b/gcc.morph.yaml new file mode 100644 index 0000000000..fb5a293c72 --- /dev/null +++ b/gcc.morph.yaml @@ -0,0 +1,37 @@ +name: gcc +kind: chunk + +configure-commands: + - mkdir o + + # Configure flag notes: + # 1. An attempt to stop anything going in $PREFIX/lib64 (which doesn't + # fully work; we will need to hobble the multilib configuration in + # config/i386/t-linux64 if we really want to kill /lib64). + # 2. Multilib does not make sense in Baserock. + # 3. Optimisation libraries which for now we do without. + # 4. Recommended by Linux From Scratch; required for C++ ABI + # compatibility with other Linux distributions. + # 5. MPFR is built in the GCC tree, we need to locate it. + # 6. Avoid having more than one copy of ZLib in use on the system + - | + cd o && \ + ../configure \ + $(morph-arch-config) \ + --prefix="$PREFIX" \ + `# [1]` --libdir=$PREFIX/lib \ + --disable-nls \ + --enable-languages=c,c++ --enable-shared --enable-threads=posix \ + `# [2]` --disable-multilib \ + `# [3]` --disable-libgomp --without-cloog --without-ppl \ + `# [4]` --enable-__cxa_atexit \ + `# [5]` --with-mpfr-include="$(pwd)/../mpfr/src" \ + --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ + `# [6]` --with-system-zlib + +build-commands: + - cd o && make + +install-commands: + - cd o && make DESTDIR="$DESTDIR" install + - ln -s gcc "$DESTDIR/$PREFIX/bin/cc" diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 872956d1f6..1590ed1fea 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. -NATIVE_SYSTEM_HEADER_DIR = /usr/include +NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ @@ -3969,6 +3969,7 @@ PREPROCESSOR_DEFINES = \ -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \ -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \ -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ + -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\" \ -DPREFIX=\"$(prefix)/\" \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ @TARGET_SYSTEM_ROOT_DEFINE@ diff --git a/gcc/config.gcc b/gcc/config.gcc index 39d9a19f0a..d9122e976e 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -177,6 +177,13 @@ # configure_default_options # Set to an initializer for configure_default_options # in configargs.h, based on --with-cpu et cetera. +# +# native_system_header_dir +# Where system header files are found for this +# target. This defaults to /usr/include. If +# the --with-sysroot configure option or the +# --sysroot command line option is used this +# will be relative to the sysroot. # The following variables are used in each case-construct to build up the # outgoing variables: @@ -219,6 +226,7 @@ default_gnu_indirect_function=no target_gtfiles= need_64bit_hwint= need_64bit_isa= +native_system_header_dir=/usr/include # Don't carry these over build->host->target. Please. xm_file= @@ -574,7 +582,8 @@ case ${target} in *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu) :;; *-*-gnu*) - tmake_file="$tmake_file t-gnu";; + native_system_header_dir=/include + ;; esac # glibc / uclibc / bionic switch. # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD. @@ -1315,7 +1324,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) i[34567]86-pc-msdosdjgpp*) xm_file=i386/xm-djgpp.h tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h" - tmake_file="${tmake_file} i386/t-djgpp" + native_system_header_dir=/dev/env/DJDIR/include extra_options="${extra_options} i386/djgpp.opt" gnu_ld=yes gas=yes @@ -1546,6 +1555,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) tmake_file="${tmake_file} i386/t-mingw32" ;; esac + native_system_header_dir=/mingw/include target_gtfiles="\$(srcdir)/config/i386/winnt.c" extra_options="${extra_options} i386/cygming.opt i386/mingw.opt" case ${target} in @@ -2670,6 +2680,7 @@ sparc64-*-openbsd*) spu-*-elf*) tm_file="dbxelf.h elfos.h spu/spu-elf.h spu/spu.h newlib-stdint.h" tmake_file="spu/t-spu-elf" + native_system_header_dir=/include extra_headers="spu_intrinsics.h spu_internals.h vmx2spu.h spu_mfcio.h vec_types.h spu_cache.h" extra_modes=spu/spu-modes.def c_target_objs="${c_target_objs} spu-c.o" diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h index fcf6ebcd7c..73bc6474b7 100644 --- a/gcc/config/gnu.h +++ b/gcc/config/gnu.h @@ -28,10 +28,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>. #undef LIB_SPEC #define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}" -/* Standard include directory. In GNU, "/usr" is a four-letter word. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/include" - #undef LINUX_TARGET_OS_CPP_BUILTINS #define LINUX_TARGET_OS_CPP_BUILTINS() \ do { \ diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index 34a15facbf..e2e53aba52 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -55,10 +55,6 @@ along with GCC; see the file COPYING3. If not see /* We override default /usr or /usr/local part with /dev/env/DJDIR which */ /* points to actual DJGPP installation directory. */ -/* Standard include directory */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/" - /* Search for as.exe and ld.exe in DJGPP's binary directory. */ #undef MD_EXEC_PREFIX #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/" diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 27da92b4e8..3a340ad248 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -63,12 +63,8 @@ along with GCC; see the file COPYING3. If not see #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 #endif -/* Override the standard choice of /usr/include as the default prefix - to try when searching for header files. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/mingw/include" -#undef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT "MINGW" +#undef NATIVE_SYSTEM_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW" #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" diff --git a/gcc/config/i386/t-djgpp b/gcc/config/i386/t-djgpp deleted file mode 100644 index 7b54b7ba7a..0000000000 --- a/gcc/config/i386/t-djgpp +++ /dev/null @@ -1,2 +0,0 @@ -# Location of DJGPP's header directory. -NATIVE_SYSTEM_HEADER_DIR=$(DJDIR)/include diff --git a/gcc/config/i386/t-mingw-w32 b/gcc/config/i386/t-mingw-w32 index a142180166..83cee71f1c 100644 --- a/gcc/config/i386/t-mingw-w32 +++ b/gcc/config/i386/t-mingw-w32 @@ -1,6 +1,3 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - MULTILIB_OPTIONS = m64/m32 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib64 ../lib diff --git a/gcc/config/i386/t-mingw-w64 b/gcc/config/i386/t-mingw-w64 index dbe2d00a2e..041a02f101 100644 --- a/gcc/config/i386/t-mingw-w64 +++ b/gcc/config/i386/t-mingw-w64 @@ -1,6 +1,3 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - MULTILIB_OPTIONS = m64/m32 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib ../lib32 diff --git a/gcc/config/i386/t-mingw32 b/gcc/config/i386/t-mingw32 index a8235242a5..bfdef6723c 100644 --- a/gcc/config/i386/t-mingw32 +++ b/gcc/config/i386/t-mingw32 @@ -1,5 +1,2 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - # MinGW-specific parts of LIB_SPEC SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h index ae08ed8b5e..00b62bf430 100644 --- a/gcc/config/openbsd.h +++ b/gcc/config/openbsd.h @@ -1,5 +1,5 @@ /* Base configuration file for all OpenBSD targets. - Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010 + Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 }, \ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \ - { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 }, \ + { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0 }, \ { 0, 0, 0, 0 } \ } diff --git a/gcc/config/spu/spu-elf.h b/gcc/config/spu/spu-elf.h index 818c391f99..146bcb2105 100644 --- a/gcc/config/spu/spu-elf.h +++ b/gcc/config/spu/spu-elf.h @@ -35,10 +35,6 @@ #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_2 "" -/* Use "/include" instead of "/usr/include". */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/include" - /* We do not provide any "/usr/local/include" directory on SPU. */ #undef LOCAL_INCLUDE_DIR @@ -77,4 +73,3 @@ mcache-size=16 :-lgcc_cache16k; \ mcache-size=8 :-lgcc_cache8k; \ :-lgcc_cache64k}" - diff --git a/gcc/config/spu/t-spu-elf b/gcc/config/spu/t-spu-elf index 5189f28584..4fba7e6c26 100644 --- a/gcc/config/spu/t-spu-elf +++ b/gcc/config/spu/t-spu-elf @@ -15,10 +15,6 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -# Define system directory to match STANDARD_INCLUDE_DIR in spu-elf.h, -# allowing combined SPU/PPU sysroot builds. -NATIVE_SYSTEM_HEADER_DIR = /include - # Suppress building libgcc1.a LIBGCC1 = CROSS_LIBGCC1 = diff --git a/gcc/config/t-gnu b/gcc/config/t-gnu deleted file mode 100644 index 7be5d00a71..0000000000 --- a/gcc/config/t-gnu +++ /dev/null @@ -1,2 +0,0 @@ -# In GNU, "/usr" is a four-letter word. -NATIVE_SYSTEM_HEADER_DIR = /include diff --git a/gcc/config/vms/xm-vms.h b/gcc/config/vms/xm-vms.h index 7907f9263c..816935b506 100644 --- a/gcc/config/vms/xm-vms.h +++ b/gcc/config/vms/xm-vms.h @@ -1,6 +1,6 @@ /* Configuration for GCC for hosting on VMS using a Unix style C library. - Copyright (C) 1996, 1997, 2001, 2004, 2007, 2009 + Copyright (C) 1996, 1997, 2001, 2004, 2007, 2009, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -55,4 +55,3 @@ do \ #define STANDARD_EXEC_PREFIX "/gnu/libexec/gcc/" #define STANDARD_STARTFILE_PREFIX "/gnu/lib/" -#define STANDARD_INCLUDE_DIR "/gnu/include" diff --git a/gcc/configure b/gcc/configure index 63b5e8b19a..8494cbbd7e 100755 --- a/gcc/configure +++ b/gcc/configure @@ -725,6 +725,7 @@ USE_NLS extra_opt_files extra_modes_file gthread_flags +NATIVE_SYSTEM_HEADER_DIR objext manext LIBICONV_DEP @@ -879,6 +880,7 @@ enable_tls enable_objc_gc with_dwarf2 enable_shared +with_native_system_header_dir with_build_sysroot with_sysroot with_specs @@ -1643,6 +1645,9 @@ Optional Packages: --with-as arrange to use the specified as (full pathname) --with-stabs arrange to use stabs instead of host debug format --with-dwarf2 force the default debug format to be DWARF 2 + --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include. --with-build-sysroot=sysroot use sysroot as the system root during the build --with-sysroot=DIR Search for usr/lib, usr/include, et al, within DIR. @@ -7058,6 +7063,22 @@ fi +# Check whether --with-native-system-header-dir was given. +if test "${with_native_system_header_dir+set}" = set; then : + withval=$with_native_system_header_dir; + case ${with_native_system_header_dir} in + yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;; + /* | [A-Za-z]:[\\/]*) ;; + *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;; + esac + configured_native_system_header_dir="${withval}" + +else + configured_native_system_header_dir= +fi + + + # Check whether --with-build-sysroot was given. if test "${with_build_sysroot+set}" = set; then : withval=$with_build_sysroot; @@ -10742,6 +10763,12 @@ if test "$host_xm_file" != "$build_xm_file"; then fi fi +if test -n "$configured_native_system_header_dir"; then + native_system_header_dir=$configured_native_system_header_dir +fi +NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" + + case ${host} in powerpc*-*-darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mcontext_t fields have underscores" >&5 @@ -25732,14 +25759,14 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then elif test "x$with_sysroot" = x; then target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include" elif test "x$with_build_sysroot" != "x"; then - target_header_dir="${with_build_sysroot}/usr/include" + target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = xyes; then - target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include" + target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else - target_header_dir="${with_sysroot}/usr/include" + target_header_dir="${with_sysroot}${native_system_header_dir}" fi else - target_header_dir=/usr/include + target_header_dir=${native_system_header_dir} fi # Test for stack protector support in target C library. diff --git a/gcc/configure.ac b/gcc/configure.ac index 258ea6b967..4fd480e9a8 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -709,6 +709,19 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_WITH([native-system-header-dir], + [ --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include.], +[ + case ${with_native_system_header_dir} in + yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; + /* | [[A-Za-z]]:[[\\/]]*) ;; + *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; + esac + configured_native_system_header_dir="${withval}" +], [configured_native_system_header_dir=]) + AC_ARG_WITH(build-sysroot, [ --with-build-sysroot=sysroot use sysroot as the system root during the build]) @@ -1299,6 +1312,12 @@ if test "$host_xm_file" != "$build_xm_file"; then fi fi +if test -n "$configured_native_system_header_dir"; then + native_system_header_dir=$configured_native_system_header_dir +fi +NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" +AC_SUBST(NATIVE_SYSTEM_HEADER_DIR) + case ${host} in powerpc*-*-darwin*) AC_CACHE_CHECK([whether mcontext_t fields have underscores], @@ -4333,14 +4352,14 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then elif test "x$with_sysroot" = x; then target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include" elif test "x$with_build_sysroot" != "x"; then - target_header_dir="${with_build_sysroot}/usr/include" + target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = xyes; then - target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include" + target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else - target_header_dir="${with_sysroot}/usr/include" + target_header_dir="${with_sysroot}${native_system_header_dir}" fi else - target_header_dir=/usr/include + target_header_dir=${native_system_header_dir} fi # Test for stack protector support in target C library. diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c index 9b1495feb9..fabf314a02 100644 --- a/gcc/cppdefault.c +++ b/gcc/cppdefault.c @@ -1,6 +1,7 @@ /* CPP Library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004, 2006, 2007, 2010, 2011 + Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -25,18 +26,12 @@ #include "tm.h" #include "cppdefault.h" -#ifndef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/usr/include" -#endif - -#ifndef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT 0 +#ifndef NATIVE_SYSTEM_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT 0 #endif #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) # undef LOCAL_INCLUDE_DIR -# undef SYSTEM_INCLUDE_DIR -# undef STANDARD_INCLUDE_DIR #else # undef CROSS_INCLUDE_DIR #endif @@ -89,14 +84,8 @@ const struct default_include cpp_include_defaults[] /* Another place the target system's headers might be. */ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 }, #endif -#ifdef SYSTEM_INCLUDE_DIR - /* Some systems have an extra dir of include files. */ - { SYSTEM_INCLUDE_DIR, 0, 0, 0, 1, 0 }, -#endif -#ifdef STANDARD_INCLUDE_DIR /* /usr/include comes dead last. */ - { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 0 }, -#endif + { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0 } }; #endif /* no INCLUDE_DEFAULTS */ @@ -136,4 +125,3 @@ cpp_relocated (void) return relocated; } - diff --git a/gcc/doc/fragments.texi b/gcc/doc/fragments.texi index ff89d513d4..e8f6554cd1 100644 --- a/gcc/doc/fragments.texi +++ b/gcc/doc/fragments.texi @@ -1,5 +1,6 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2003, 2004, 2005, 2008 Free Software Foundation, Inc. +@c 1999, 2000, 2001, 2003, 2004, 2005, 2008, 2011 +@c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -151,12 +152,6 @@ compiler. In that case, set @code{MULTILIB_EXTRA_OPTS} to be the list of options to be used for all builds. If you set this, you should probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it. -@findex NATIVE_SYSTEM_HEADER_DIR -@item NATIVE_SYSTEM_HEADER_DIR -If the default location for system headers is not @file{/usr/include}, -you must set this to the directory containing the headers. This value -should match the value of the @code{SYSTEM_INCLUDE_DIR} macro. - @findex SPECS @item SPECS Unfortunately, setting @code{MULTILIB_EXTRA_OPTS} is not enough, since diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index fc04c96aa0..8866eafdb8 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -892,6 +892,14 @@ ideas of what it is for. People use it as if it specified where to install part of GCC@. Perhaps they make this assumption because installing GCC creates the directory. +@item --with-native-system-header-dir=@var{dirname} +Specifies that @var{dirname} is the directory that contains native system +header files, rather than @file{/usr/include}. This option is most useful +if you are creating a compiler that should be isolated from the system +as much as possible. It is most commonly used with the +@option{--with-sysroot} option and will cause GCC to search +@var{dirname} inside the system root specified by that option. + @item --enable-shared[=@var{package}[,@dots{}]] Build shared versions of libraries, if shared libraries are supported on the target platform. Unlike GCC 2.95.x and earlier, shared libraries @@ -1709,6 +1717,10 @@ target libraries (which runs on the build system) and the compiler newly installed with @code{make install}; it does not affect the compiler which is used to build GCC itself. +If you specify the @option{--with-native-system-header-dir=@var{dirname}} +option then the compiler will search that directory within @var{dirname} for +native system headers rather than the default @file{/usr/include}. + @item --with-build-sysroot @itemx --with-build-sysroot=@var{dir} Tells GCC to consider @var{dir} as the system root (see @@ -1723,6 +1735,10 @@ This option affects the system root for the compiler used to build target libraries (which runs on the build system); it does not affect the compiler which is used to build GCC itself. +If you specify the @option{--with-native-system-header-dir=@var{dirname}} +option then the compiler will search that directory within @var{dirname} for +native system headers rather than the default @file{/usr/include}. + @item --with-headers @itemx --with-headers=@var{dir} Deprecated in favor of @option{--with-sysroot}. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f7c0cce85b..8bcc119bff 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -448,33 +448,15 @@ initialize the necessary environment variables. Define this macro as a C string constant if you wish to override the standard choice of @file{/usr/local/include} as the default prefix to try when searching for local header files. @code{LOCAL_INCLUDE_DIR} -comes before @code{SYSTEM_INCLUDE_DIR} in the search order. +comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in +@file{config.gcc}, normally @file{/usr/include}) in the search order. Cross compilers do not search either @file{/usr/local/include} or its replacement. @end defmac -@defmac SYSTEM_INCLUDE_DIR -Define this macro as a C string constant if you wish to specify a -system-specific directory to search for header files before the standard -directory. @code{SYSTEM_INCLUDE_DIR} comes before -@code{STANDARD_INCLUDE_DIR} in the search order. - -Cross compilers do not use this macro and do not search the directory -specified. -@end defmac - -@defmac STANDARD_INCLUDE_DIR -Define this macro as a C string constant if you wish to override the -standard choice of @file{/usr/include} as the default prefix to -try when searching for header files. - -Cross compilers ignore this macro and do not search either -@file{/usr/include} or its replacement. -@end defmac - -@defmac STANDARD_INCLUDE_COMPONENT -The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}. +@defmac NATIVE_SYSTEM_HEADER_COMPONENT +The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. See @code{INCLUDE_DEFAULTS}, below, for the description of components. If you do not define this macro, no component is used. @end defmac @@ -483,8 +465,8 @@ If you do not define this macro, no component is used. Define this macro if you wish to override the entire default search path for include files. For a native compiler, the default search path usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, -@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and -@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} +@code{GPLUSPLUS_INCLUDE_DIR}, and +@code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, and specify private search areas for GCC@. The directory @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 40acf658c6..6e442166db 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -448,33 +448,15 @@ initialize the necessary environment variables. Define this macro as a C string constant if you wish to override the standard choice of @file{/usr/local/include} as the default prefix to try when searching for local header files. @code{LOCAL_INCLUDE_DIR} -comes before @code{SYSTEM_INCLUDE_DIR} in the search order. +comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in +@file{config.gcc}, normally @file{/usr/include}) in the search order. Cross compilers do not search either @file{/usr/local/include} or its replacement. @end defmac -@defmac SYSTEM_INCLUDE_DIR -Define this macro as a C string constant if you wish to specify a -system-specific directory to search for header files before the standard -directory. @code{SYSTEM_INCLUDE_DIR} comes before -@code{STANDARD_INCLUDE_DIR} in the search order. - -Cross compilers do not use this macro and do not search the directory -specified. -@end defmac - -@defmac STANDARD_INCLUDE_DIR -Define this macro as a C string constant if you wish to override the -standard choice of @file{/usr/include} as the default prefix to -try when searching for header files. - -Cross compilers ignore this macro and do not search either -@file{/usr/include} or its replacement. -@end defmac - -@defmac STANDARD_INCLUDE_COMPONENT -The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}. +@defmac NATIVE_SYSTEM_HEADER_COMPONENT +The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. See @code{INCLUDE_DEFAULTS}, below, for the description of components. If you do not define this macro, no component is used. @end defmac @@ -483,8 +465,8 @@ If you do not define this macro, no component is used. Define this macro if you wish to override the entire default search path for include files. For a native compiler, the default search path usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, -@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and -@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} +@code{GPLUSPLUS_INCLUDE_DIR}, and +@code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, and specify private search areas for GCC@. The directory @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. diff --git a/morph-arch-config b/morph-arch-config new file mode 100755 index 0000000000..f9ca2c5a0c --- /dev/null +++ b/morph-arch-config @@ -0,0 +1,10 @@ +#!/bin/sh + +# morph-arch-config: ouput GCC-specific configuration for specific +# Morph architectures + +# Morph's armv7* architecture is always armv7-a +case "$MORPH_ARCH" in + armv7*) echo "--with-arch=armv7-a" ;; +esac + diff --git a/stage1-gcc.morph b/stage1-gcc.morph new file mode 100644 index 0000000000..bd353b1a80 --- /dev/null +++ b/stage1-gcc.morph @@ -0,0 +1,15 @@ +{ + "name": "stage1-gcc", + "kind": "chunk", + "configure-commands": [ + "mkdir o", + "cd o &&\n../configure \\\n $(morph-arch-config) \\\n --build=$(sh ../config.guess) --host=$(sh ../config.guess) \\\n --target=$TARGET_STAGE1 \\\n --prefix=\"$PREFIX\" \\\n --disable-bootstrap --disable-nls \\\n `# [1]` --libdir=\"$PREFIX/lib\" --disable-multilib --disable-libgomp \\\n --without-cloog --without-ppl \\\n --with-mpfr-include=\"$(pwd)/../mpfr/src\" \\\n --with-mpfr-lib=\"$(pwd)/mpfr/src/.libs\" \\\n `# [2]` --with-local-prefix=\"$PREFIX\" \\\n `# [3]` --with-native-system-header-dir=\"$PREFIX/include\" \\\n `# [4]` --enable-languages=c --disable-decimal-float \\\n --disable-libmudflap --disable-libquadmath --disable-libssp \\\n --disable-shared --disable-threads --disable-target-libiberty \\\n --disable-target-zlib --without-headers --with-newlib \\\n --with-system-zlib\n" + ], + "build-commands": [ + "cd o && make" + ], + "install-commands": [ + "cd o && make DESTDIR=\"$DESTDIR\" install", + "libgcc_filename=$($DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc -print-libgcc-file-name)\nln -sv libgcc.a $(echo $libgcc_filename | sed 's/libgcc/&_eh/')\n" + ] +} diff --git a/stage1-gcc.morph.yaml b/stage1-gcc.morph.yaml new file mode 100644 index 0000000000..d641962cd6 --- /dev/null +++ b/stage1-gcc.morph.yaml @@ -0,0 +1,48 @@ +name: stage1-gcc +kind: chunk + +configure-commands: + - mkdir o + + # Configure flag notes: + # 1. Standard flags. See gcc.morph. + # 2. Disable searching /usr/local/include for headers + # 3. The pass 1 compiler needs to find the libraries we build in pass 2. + # Include path must be set explicility, because it defaults to + # $SYSROOT/usr/include rather than $SYSROOT/include. + # FIXME: this flag is not present until GCC 4.6.3! + # 4. Disable stuff that doesn't work when building a cross compiler + # without an existing libc, and generally try to keep this build as + # simple as possible. + - | + cd o && + ../configure \ + $(morph-arch-config) \ + --build=$(sh ../config.guess) --host=$(sh ../config.guess) \ + --target=$TARGET_STAGE1 \ + --prefix="$PREFIX" \ + --disable-bootstrap --disable-nls \ + `# [1]` --libdir="$PREFIX/lib" --disable-multilib --disable-libgomp \ + --without-cloog --without-ppl \ + --with-mpfr-include="$(pwd)/../mpfr/src" \ + --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ + `# [2]` --with-local-prefix="$PREFIX" \ + `# [3]` --with-native-system-header-dir="$PREFIX/include" \ + `# [4]` --enable-languages=c --disable-decimal-float \ + --disable-libmudflap --disable-libquadmath --disable-libssp \ + --disable-shared --disable-threads --disable-target-libiberty \ + --disable-target-zlib --without-headers --with-newlib \ + --with-system-zlib + +build-commands: + - cd o && make + +install-commands: + - cd o && make DESTDIR="$DESTDIR" install + + # The file libgcc_eh is required during eglibc's build, but is not created + # because we built GCC with --disable-shared. This is a workaround for + # eglibc's build system being slightly broken. + - | + libgcc_filename=$($DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc -print-libgcc-file-name) + ln -sv libgcc.a $(echo $libgcc_filename | sed 's/libgcc/&_eh/') diff --git a/stage2-gcc.morph b/stage2-gcc.morph new file mode 100644 index 0000000000..59d20a3838 --- /dev/null +++ b/stage2-gcc.morph @@ -0,0 +1,17 @@ +{ + "name": "stage2-gcc", + "kind": "chunk", + "configure-commands": [ + "stage2-eglibc-fix-specs", + "cat \"gcc/limitx.h\" \"gcc/glimits.h\" \"gcc/limity.h\" > limits.h.tmp\nlibgcc_dir=$(dirname $($TARGET_STAGE1-gcc -print-libgcc-file-name))\ncp limits.h.tmp \"$libgcc_dir/include-fixed/limits.h\"\n", + "mkdir o", + "export STAGE2_SYSROOT=\"$(dirname $(pwd))\"\nexport CC=\"$TARGET_STAGE1-gcc --sysroot=$STAGE2_SYSROOT\"\nexport LDFLAGS=\"-Wl,--sysroot=$STAGE2_SYSROOT\"\ncd o && ../configure \\\n $(morph-arch-config) \\\n `# [1]` --build=$(sh ../config.guess) \\\n --host=$TARGET_STAGE1 \\\n --target=$TARGET_STAGE1 \\\n --prefix=\"$PREFIX\" \\\n `# [2]` --with-local-prefix=$PREFIX \\\n `# [3]` --with-build-sysroot=\"$STAGE2_SYSROOT\" \\\n --disable-bootstrap \\\n --enable-clocale=gnu --enable-shared --enable-threads=posix \\\n `# [4]` --enable-languages=c \\\n `# [5]` --libdir=$PREFIX/lib \\\n --disable-libgomp --disable-multilib --disable-nls \\\n --without-cloog --without-ppl \\\n --with-mpfr-include=\"$(pwd)/../mpfr/src\" \\\n --with-mpfr-lib=\"$(pwd)/mpfr/src/.libs\" \\\n --with-system-zlib\n" + ], + "build-commands": [ + "export STAGE2_SYSROOT=\"$(dirname $(pwd))\"\ncd o && make\n" + ], + "install-commands": [ + "cd o && make DESTDIR=\"$DESTDIR\" install", + "if [ \"$(echo $TARGET | cut -c -6)\" = \"x86_64\" ]; then\n libdir=lib64\nelse\n libdir=lib\nfi\n\ninstall -d \"$DESTDIR/lib\"\nln -s \"$PREFIX/$libdir/libgcc_s.so\" \"$DESTDIR/lib/\"\nln -s \"$PREFIX/$libdir/libgcc_s.so.1\" \"$DESTDIR/lib/\"\n" + ] +} diff --git a/stage2-gcc.morph.yaml b/stage2-gcc.morph.yaml new file mode 100644 index 0000000000..7514beb40e --- /dev/null +++ b/stage2-gcc.morph.yaml @@ -0,0 +1,85 @@ +name: stage2-gcc +kind: chunk + +configure-commands: + - stage2-eglibc-fix-specs + + # Stage 1 GCC's fixincludes process created a limits.h before there was + # a real limits.h available for the target. This step (taken from Linux + # Linux From Scratch) creates a better one so that stage 2 GCC can compile. + # + # THIS IS A FRAGILE HACK! We have a staging area built from hardlinked + # chunk artifacts at this point and we sidestep that by moving a file + # over the hardlink, so as not to alter the original file. Maybe we could + # fix things by altering the include path instead, but this might be even + # more fragile. + - | + cat "gcc/limitx.h" "gcc/glimits.h" "gcc/limity.h" > limits.h.tmp + libgcc_dir=$(dirname $($TARGET_STAGE1-gcc -print-libgcc-file-name)) + cp limits.h.tmp "$libgcc_dir/include-fixed/limits.h" + + - mkdir o + + # In other projects we specify the sysroot location using CPPFLAGS. Here, + # that breaks because GCC compiles stuff for the *build* machine, too ... + # and this requires using the host's compiler, which cannot use the same + # set of CPPFLAGS as the target. If we specify the sysroot using CC instead + # then we don't interfere, because we are only specifying the *host* C + # compiler. + # + # Configure flag notes: + # 1. It's vital that this compiler targets the bootstrap machine + # (TARGET_STAGE1) so that the stage 1 GCC is used instead of the + # compiler of the build machine. + # 2. Disable searching /usr/local/include for headers + # 3. This flag causes the correct --sysroot flag to be passed when calling + # stage 1 GCC. + # 4. C++ is built in stage 3. + # 5. Standard flags. See gcc.morph. + - | + export STAGE2_SYSROOT="$(dirname $(pwd))" + export CC="$TARGET_STAGE1-gcc --sysroot=$STAGE2_SYSROOT" + export LDFLAGS="-Wl,--sysroot=$STAGE2_SYSROOT" + cd o && ../configure \ + $(morph-arch-config) \ + `# [1]` --build=$(sh ../config.guess) \ + --host=$TARGET_STAGE1 \ + --target=$TARGET_STAGE1 \ + --prefix="$PREFIX" \ + `# [2]` --with-local-prefix=$PREFIX \ + `# [3]` --with-build-sysroot="$STAGE2_SYSROOT" \ + --disable-bootstrap \ + --enable-clocale=gnu --enable-shared --enable-threads=posix \ + `# [4]` --enable-languages=c \ + `# [5]` --libdir=$PREFIX/lib \ + --disable-libgomp --disable-multilib --disable-nls \ + --without-cloog --without-ppl \ + --with-mpfr-include="$(pwd)/../mpfr/src" \ + --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ + --with-system-zlib + +build-commands: + - | + export STAGE2_SYSROOT="$(dirname $(pwd))" + cd o && make + +install-commands: + - cd o && make DESTDIR="$DESTDIR" install + + # Stage 3 builds need to link against this file in the location that + # it will be in the final system, so we make a temporary link now. + # + # On x86_64 GCC resolutely installs its libraries into lib64. To fix this + # would require hobbling the MULTILIB_OSDIRNAMES field in + # gcc/config/i386/t-linux64 and this might break things, so for now we + # tolerate the inconsistency. + - | + if [ "$(echo $TARGET | cut -c -6)" = "x86_64" ]; then + libdir=lib64 + else + libdir=lib + fi + + install -d "$DESTDIR/lib" + ln -s "$PREFIX/$libdir/libgcc_s.so" "$DESTDIR/lib/" + ln -s "$PREFIX/$libdir/libgcc_s.so.1" "$DESTDIR/lib/" |