From patchwork Tue Jan 25 20:33:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baldwin X-Patchwork-Id: 80402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F2F3FB70E3 for ; Wed, 26 Jan 2011 07:34:05 +1100 (EST) Received: (qmail 6433 invoked by alias); 25 Jan 2011 20:34:01 -0000 Received: (qmail 6357 invoked by uid 22791); 25 Jan 2011 20:33:59 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 20:33:52 +0000 Received: from wpaz9.hot.corp.google.com (wpaz9.hot.corp.google.com [172.24.198.73]) by smtp-out.google.com with ESMTP id p0PKXnGR028320 for ; Tue, 25 Jan 2011 12:33:50 -0800 Received: from hpgntab-ubiq73.eem.corp.google.com (hpgntab-ubiq73.eem.corp.google.com [172.25.130.115]) by wpaz9.hot.corp.google.com with ESMTP id p0PKXm9n002442 for ; Tue, 25 Jan 2011 12:33:48 -0800 Received: by hpgntab-ubiq73.eem.corp.google.com (Postfix, from userid 9603) id 5E03E1C656D; Tue, 25 Jan 2011 21:33:46 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [google] Add --with-native-system-header-dir to specify the location of /usr/include Message-Id: <20110125203347.5E03E1C656D@hpgntab-ubiq73.eem.corp.google.com> Date: Tue, 25 Jan 2011 21:33:46 +0100 (CET) From: simonb@google.com (Simon Baldwin) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Add --with-native-system-header-dir to specify the location of /usr/include instead of having it hard-coded. Useful when building a sysroot'ed cross-compiler and you want to relocate everything inside the system root. Without this, the makefile and configure scripts assume system header files live in /usr/include (or in usr/include under the system root directory). Targetted for the google/integration branch. gcc/ChangeLog.google: 2011-01-25 Simon Baldwin * configure.ac: Add --with-native-system-header-dir option. * configure: Rebuild from configure.ac. * Makefile.in: Support --with-native-system-header-dir. * doc/install.texi: Document --with-native-system-header-dir. Google ref: 38871, 37499, 24118, 12980 Index: gcc/doc/install.texi =================================================================== --- gcc/doc/install.texi (revision 169243) +++ gcc/doc/install.texi (working copy) @@ -874,6 +874,18 @@ ideas of what it is for. People use it 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. + +Please note that for certain targets, such as DJGPP, this value is +ignored. If the target specifies a default value for native system +header files then this option is ignored. + @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 @@ -1686,6 +1698,10 @@ target libraries (which runs on the buil 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} option +then the compiler will search that directory within @var{dir} 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 @@ -1700,6 +1716,10 @@ This option affects the system root for 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} option +then the compiler will search that directory within @var{dir} 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}. Index: gcc/configure =================================================================== --- gcc/configure (revision 169243) +++ gcc/configure (working copy) @@ -759,6 +759,7 @@ CONFIGURE_SPECS CROSS_SYSTEM_HEADER_DIR TARGET_SYSTEM_ROOT_DEFINE TARGET_SYSTEM_ROOT +NATIVE_SYSTEM_HEADER_DIR enable_shared enable_fixed_point enable_decimal_float @@ -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. @@ -7057,6 +7062,27 @@ fi +# The use of native_system_header_dir here is for the value (optionally) +# configured here. Uses of NATIVE_SYSTEM_HEADER_DIR in this file refer +# to the make variable defined in Makefile or in target make fragments. + +# 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 native system include directory" "$LINENO" 5 ;; + /*) ;; + *) as_fn_error "${withval} should be an absolute directory" "$LINENO" 5 ;; + esac + native_system_header_dir="${withval}" + +else + native_system_header_dir=/usr/include +fi + +NATIVE_SYSTEM_HEADER_DIR=$native_system_header_dir + + # Check whether --with-build-sysroot was given. if test "${with_build_sysroot+set}" = set; then : @@ -17513,7 +17539,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17516 "configure" +#line 17542 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17619,7 +17645,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17622 "configure" +#line 17648 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -25664,14 +25690,14 @@ if test x$host != x$target || test "x$TA 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. Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 169243) +++ gcc/configure.ac (working copy) @@ -709,6 +709,23 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +# The use of native_system_header_dir here is for the value (optionally) +# configured here. Uses of NATIVE_SYSTEM_HEADER_DIR in this file refer +# to the make variable defined in Makefile or in target make fragments. +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 native system include directory]) ;; + /*) ;; + *) AC_MSG_ERROR([${withval} should be an absolute directory]) ;; + esac + native_system_header_dir="${withval}" +], [native_system_header_dir=/usr/include]) +AC_SUBST(NATIVE_SYSTEM_HEADER_DIR, $native_system_header_dir) + AC_ARG_WITH(build-sysroot, [ --with-build-sysroot=sysroot use sysroot as the system root during the build]) @@ -4264,14 +4281,14 @@ if test x$host != x$target || test "x$TA 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. Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 169243) +++ gcc/Makefile.in (working copy) @@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../inclu 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@