gcc.c (option_map): Add --sysroot.

* gcc.c (option_map): Add --sysroot.
	(process_command): Handle --sysroot.
	(display_help): Document it.
	* doc/cppopts.tex (-isysroot): Document.
	* doc/invoke.texi (--sysroot): Document.
	* doc/install.texi (--with-build-sysroot): Document.

	* Makefile.in (inhibit_libc): New variable.
	(INHIBIT_LIBC_CFLAGS): Likewise.
	(LIBGCC2_CFLAGS): Include
	$(INHIBIT_LIBC_CFLAGS).
	(CRTSTUFF_CFLAGS): Include $(INHIBIT_LIBC_CFLAGS).
	($(T)crtbegin.o): Do not use @inhibit_libc@.
	($(T)crtend.o): Likewise.
	($(T)crtbeginS.o): Do not use @inhibit_libc@.
	($(T)crtendS.o): Likewise.
	($(T)crtbeginT.o): Do not use @inhibit_libc@.
	($(T)crtendT.o): Likewise.
	(stmp-fixinc): Do not complain about missing headers if
	inhibit_libc.
	* configure.ac (inhibit_libc): Set it to true/false.
	(--with-build-sysroot): New option.  Use it to set
	SYSTEM_HEADER_DIR.
	* configure: Regenerated.

From-SVN: r102367
This commit is contained in:
Mark Mitchell 2005-07-25 19:42:04 +00:00 committed by Mark Mitchell
parent 334a03fd1e
commit 160633c626
8 changed files with 122 additions and 21 deletions

View File

@ -1,3 +1,30 @@
2005-07-25 Mark Mitchell <mark@codesourcery.com>
* gcc.c (option_map): Add --sysroot.
(process_command): Handle --sysroot.
(display_help): Document it.
* doc/cppopts.tex (-isysroot): Document.
* doc/invoke.texi (--sysroot): Document.
* doc/install.texi (--with-build-sysroot): Document.
* Makefile.in (inhibit_libc): New variable.
(INHIBIT_LIBC_CFLAGS): Likewise.
(LIBGCC2_CFLAGS): Include
$(INHIBIT_LIBC_CFLAGS).
(CRTSTUFF_CFLAGS): Include $(INHIBIT_LIBC_CFLAGS).
($(T)crtbegin.o): Do not use @inhibit_libc@.
($(T)crtend.o): Likewise.
($(T)crtbeginS.o): Do not use @inhibit_libc@.
($(T)crtendS.o): Likewise.
($(T)crtbeginT.o): Do not use @inhibit_libc@.
($(T)crtendT.o): Likewise.
(stmp-fixinc): Do not complain about missing headers if
inhibit_libc.
* configure.ac (inhibit_libc): Set it to true/false.
(--with-build-sysroot): New option. Use it to set
SYSTEM_HEADER_DIR.
* configure: Regenerated.
2005-07-25 Manfred Hollstein <mh@suse.com> 2005-07-25 Manfred Hollstein <mh@suse.com>
* calls.c (store_one_arg): Fix unsigned comparison warning. * calls.c (store_one_arg): Fix unsigned comparison warning.

View File

@ -325,7 +325,7 @@ GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isyste
# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
# It omits XCFLAGS, and specifies -B./. # It omits XCFLAGS, and specifies -B./.
# It also specifies -isystem ./include to find, e.g., stddef.h. # It also specifies -isystem ./include to find, e.g., stddef.h.
GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS) GCC_CFLAGS=$(CFLAGS_FOR_TARGET) $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
# --------------------------------------------------- # ---------------------------------------------------
# Programs which produce files for the target machine # Programs which produce files for the target machine
@ -511,12 +511,20 @@ GGC_LIB=
LIBGCC = libgcc.a LIBGCC = libgcc.a
INSTALL_LIBGCC = install-libgcc INSTALL_LIBGCC = install-libgcc
# "true" if the target C library headers are unavailable; "false"
# otherwise.
inhibit_libc = @inhibit_libc@
ifeq ($(inhibit_libc),true)
INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
endif
# Options to use when compiling libgcc2.a. # Options to use when compiling libgcc2.a.
# #
LIBGCC2_DEBUG_CFLAGS = -g LIBGCC2_DEBUG_CFLAGS = -g
LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
$(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@ -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
$(INHIBIT_LIBC_CFLAGS)
# Additional options to use when compiling libgcc2.a. # Additional options to use when compiling libgcc2.a.
# Some targets override this to -isystem include # Some targets override this to -isystem include
@ -528,7 +536,8 @@ TARGET_LIBGCC2_CFLAGS =
# Options to use when compiling crtbegin/end. # Options to use when compiling crtbegin/end.
CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
-finhibit-size-directive -fno-inline-functions -fno-exceptions \ -finhibit-size-directive -fno-inline-functions -fno-exceptions \
-fno-zero-initialized-in-bss -fno-unit-at-a-time -fno-zero-initialized-in-bss -fno-unit-at-a-time \
$(INHIBIT_LIBC_CFLAGS)
# Additional sources to handle exceptions; overridden by targets as needed. # Additional sources to handle exceptions; overridden by targets as needed.
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
@ -1393,33 +1402,33 @@ stmp-multilib: $(LIBGCC_DEPS)
$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
@inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
-o $(T)crtbegin$(objext) -o $(T)crtbegin$(objext)
$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
@inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END \ -c $(srcdir)/crtstuff.c -DCRT_END \
-o $(T)crtend$(objext) -o $(T)crtend$(objext)
# These are versions of crtbegin and crtend for shared libraries. # These are versions of crtbegin and crtend for shared libraries.
$(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
@inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
-o $(T)crtbeginS$(objext) -o $(T)crtbeginS$(objext)
$(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
@inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
-o $(T)crtendS$(objext) -o $(T)crtendS$(objext)
# This is a version of crtbegin for -static links. # This is a version of crtbegin for -static links.
$(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
$(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
@inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
-o $(T)crtbeginT$(objext) -o $(T)crtbeginT$(objext)
# Compile the start modules crt0.o and mcrt0.o that are linked with # Compile the start modules crt0.o and mcrt0.o that are linked with
@ -3137,7 +3146,7 @@ s-macro_list : $(GCC_PASSES)
stmp-fixinc: gsyslimits.h macro_list \ stmp-fixinc: gsyslimits.h macro_list \
$(build_objdir)/fixincludes/fixincl \ $(build_objdir)/fixincludes/fixincl \
$(build_objdir)/fixincludes/fixinc.sh $(build_objdir)/fixincludes/fixinc.sh
@if test ! -d ${SYSTEM_HEADER_DIR}; then \ @if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
echo The directory that should contain system headers does not exist: >&2 ; \ echo The directory that should contain system headers does not exist: >&2 ; \
echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ echo " ${SYSTEM_HEADER_DIR}" >&2 ; \
if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \

28
gcc/configure vendored
View File

@ -922,6 +922,8 @@ Optional Packages:
--with-as arrange to use the specified as (full pathname) --with-as arrange to use the specified as (full pathname)
--with-stabs arrange to use stabs instead of host debug format --with-stabs arrange to use stabs instead of host debug format
--with-dwarf2 force the default debug format to be DWARF 2 --with-dwarf2 force the default debug format to be DWARF 2
--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. --with-sysroot=DIR Search for usr/lib, usr/include, et al, within DIR.
--with-gnu-ld assume the C compiler uses GNU ld default=no --with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
@ -6934,6 +6936,13 @@ fi;
# Check whether --with-build-sysroot or --without-build-sysroot was given.
if test "${with_build_sysroot+set}" = set; then
withval="$with_build_sysroot"
fi;
# Check whether --with-sysroot or --without-sysroot was given. # Check whether --with-sysroot or --without-sysroot was given.
if test "${with_sysroot+set}" = set; then if test "${with_sysroot+set}" = set; then
withval="$with_sysroot" withval="$with_sysroot"
@ -6945,6 +6954,11 @@ if test "${with_sysroot+set}" = set; then
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)' CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
if test "x$with_build_sysroot" != x; then
build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
else
build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
fi
if test "x$exec_prefix" = xNONE; then if test "x$exec_prefix" = xNONE; then
if test "x$prefix" = xNONE; then if test "x$prefix" = xNONE; then
@ -7464,7 +7478,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then
else else
ac_prog_version=`$MAKEINFO --version 2>&1 | ac_prog_version=`$MAKEINFO --version 2>&1 |
sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
echo "configure:7467: version of makeinfo is $ac_prog_version" >&5 echo "configure:7481: version of makeinfo is $ac_prog_version" >&5
case $ac_prog_version in case $ac_prog_version in
'') gcc_cv_prog_makeinfo_modern=no;; '') gcc_cv_prog_makeinfo_modern=no;;
4.[2-9]*) 4.[2-9]*)
@ -12737,7 +12751,7 @@ if test x$host != x$target
then then
CROSS="-DCROSS_COMPILE" CROSS="-DCROSS_COMPILE"
ALL=all.cross ALL=all.cross
SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' SYSTEM_HEADER_DIR=$build_system_header_dir
case "$host","$target" in case "$host","$target" in
# Darwin crosses can use the host system's libraries and headers, # Darwin crosses can use the host system's libraries and headers,
# because of the fat library support. Of course, it must be the # because of the fat library support. Of course, it must be the
@ -12771,11 +12785,11 @@ fi
# then define inhibit_libc in LIBGCC2_CFLAGS. # then define inhibit_libc in LIBGCC2_CFLAGS.
# This prevents libgcc2 from containing any code which requires libc # This prevents libgcc2 from containing any code which requires libc
# support. # support.
inhibit_libc= inhibit_libc=false
if { { test x$host != x$target && test "x$with_sysroot" = x ; } || if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
test x$with_newlib = xyes ; } && test x$with_newlib = xyes ; } &&
{ test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
inhibit_libc=-Dinhibit_libc inhibit_libc=true
fi fi
@ -13059,7 +13073,7 @@ fi
test -n "$gcc_cv_as" && break test -n "$gcc_cv_as" && break
done done
test -n "$gcc_cv_as" || gcc_cv_as="$gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext" test -n "$gcc_cv_as" || gcc_cv_as="$gcc_cv_tool_prefix/$default_tool_name$build_exeext"
fi fi
test "$silent" != yes && exec 6>&1 test "$silent" != yes && exec 6>&1
@ -13237,7 +13251,7 @@ fi
test -n "$gcc_cv_ld" && break test -n "$gcc_cv_ld" && break
done done
test -n "$gcc_cv_ld" || gcc_cv_ld="$gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext" test -n "$gcc_cv_ld" || gcc_cv_ld="$gcc_cv_tool_prefix/$default_tool_name$build_exeext"
fi fi
test "$silent" != yes && exec 6>&1 test "$silent" != yes && exec 6>&1
@ -13381,7 +13395,7 @@ fi
test -n "$gcc_cv_nm" && break test -n "$gcc_cv_nm" && break
done done
test -n "$gcc_cv_nm" || gcc_cv_nm="$gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext" test -n "$gcc_cv_nm" || gcc_cv_nm="$gcc_cv_tool_prefix/$default_tool_name$build_exeext"
fi fi
test "$silent" != yes && exec 6>&1 test "$silent" != yes && exec 6>&1

View File

@ -681,6 +681,10 @@ AC_ARG_ENABLE(shared,
], [enable_shared=yes]) ], [enable_shared=yes])
AC_SUBST(enable_shared) AC_SUBST(enable_shared)
AC_ARG_WITH(build-sysroot,
[ --with-build-sysroot=sysroot
use sysroot as the system root during the build])
AC_ARG_WITH(sysroot, AC_ARG_WITH(sysroot,
[ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.], [ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
[ [
@ -691,6 +695,11 @@ AC_ARG_WITH(sysroot,
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)' CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
if test "x$with_build_sysroot" != x; then
build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
else
build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
fi
if test "x$exec_prefix" = xNONE; then if test "x$exec_prefix" = xNONE; then
if test "x$prefix" = xNONE; then if test "x$prefix" = xNONE; then
@ -1643,7 +1652,7 @@ if test x$host != x$target
then then
CROSS="-DCROSS_COMPILE" CROSS="-DCROSS_COMPILE"
ALL=all.cross ALL=all.cross
SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' SYSTEM_HEADER_DIR=$build_system_header_dir
case "$host","$target" in case "$host","$target" in
# Darwin crosses can use the host system's libraries and headers, # Darwin crosses can use the host system's libraries and headers,
# because of the fat library support. Of course, it must be the # because of the fat library support. Of course, it must be the
@ -1677,11 +1686,11 @@ fi
# then define inhibit_libc in LIBGCC2_CFLAGS. # then define inhibit_libc in LIBGCC2_CFLAGS.
# This prevents libgcc2 from containing any code which requires libc # This prevents libgcc2 from containing any code which requires libc
# support. # support.
inhibit_libc= inhibit_libc=false
if { { test x$host != x$target && test "x$with_sysroot" = x ; } || if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
test x$with_newlib = xyes ; } && test x$with_newlib = xyes ; } &&
{ test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
inhibit_libc=-Dinhibit_libc inhibit_libc=true
fi fi
AC_SUBST(inhibit_libc) AC_SUBST(inhibit_libc)

View File

@ -478,6 +478,11 @@ Append @var{dir} to the prefix specified previously with
path. @option{-iwithprefixbefore} puts it in the same place @option{-I} path. @option{-iwithprefixbefore} puts it in the same place @option{-I}
would; @option{-iwithprefix} puts it where @option{-idirafter} would. would; @option{-iwithprefix} puts it where @option{-idirafter} would.
@item -isysroot @var{dir}
@opindex isysroot
This option is like the @option{--sysroot} option, but applies only to
header files. See the @option{--sysroot} option for more information.
@item -isystem @var{dir} @item -isystem @var{dir}
@opindex isystem @opindex isystem
Search @var{dir} for header files, after all directories specified by Search @var{dir} for header files, after all directories specified by

View File

@ -1228,6 +1228,16 @@ in case @option{--with-sysroot} is not given an argument, is
subdirectory of @option{$@{exec_prefix@}}, then it will be found relative to subdirectory of @option{$@{exec_prefix@}}, then it will be found relative to
the GCC binaries if the installation tree is moved. the GCC binaries if the installation tree is moved.
@item --with-build-sysroot
@itemx --with-build-sysroot=@var{dir}
Tells GCC to consider @var{dir} as the system root (see
@option{--with-sysroot}) while building the compiler itself, instead of
the directory specified with @option{--with-sysroot}. This option is
only useful when you are already using @option{--with-sysroot}. You
can use @option{--with-build-sysroot} when you are configure with
@option{--prefix} set to a directory that is different from the one in
which you are installing GCC and your target libraries.
@item --with-headers @item --with-headers
@itemx --with-headers=@var{dir} @itemx --with-headers=@var{dir}
Deprecated in favor of @option{--with-sysroot}. Deprecated in favor of @option{--with-sysroot}.

View File

@ -349,6 +349,7 @@ Objective-C and Objective-C++ Dialects}.
-include @var{file} -imacros @var{file} @gol -include @var{file} -imacros @var{file} @gol
-iprefix @var{file} -iwithprefix @var{dir} @gol -iprefix @var{file} -iwithprefix @var{dir} @gol
-iwithprefixbefore @var{dir} -isystem @var{dir} @gol -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
-isysroot @var{dir} @gol
-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
-P -fworking-directory -remap @gol -P -fworking-directory -remap @gol
-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
@ -368,7 +369,8 @@ Objective-C and Objective-C++ Dialects}.
@item Directory Options @item Directory Options
@xref{Directory Options,,Options for Directory Search}. @xref{Directory Options,,Options for Directory Search}.
@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} -specs=@var{file} -I-} @gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
-specs=@var{file} -I- --sysroot=@var{dir}}
@item Target Options @item Target Options
@c I wrote this xref this way to avoid overfull hbox. -- rms @c I wrote this xref this way to avoid overfull hbox. -- rms
@ -6372,6 +6374,22 @@ program uses when determining what switches to pass to @file{cc1},
@option{-specs=@var{file}} can be specified on the command line, and they @option{-specs=@var{file}} can be specified on the command line, and they
are processed in order, from left to right. are processed in order, from left to right.
@item --sysroot=@var{dir}
@opindex sysroot
Use @var{dir} as the logical root directory for headers and libraries.
For example, if the compiler would normally search for headers in
@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
If you use both this option and the @option{-isysroot} option, then
the @option{--sysroot} option will apply to libraries, but the
@option{-isysroot} option will apply to header files.
The GNU linker (beginning with version 2.16) has the necessary support
for this option. If your linker does not support this option, the
header file aspect of @option{--sysroot} will still work, but the
library aspect will not.
@item -I- @item -I-
@opindex I- @opindex I-
This option has been deprecated. Please use @option{-iquote} instead for This option has been deprecated. Please use @option{-iquote} instead for

View File

@ -1120,6 +1120,7 @@ static const struct option_map option_map[] =
{"--static", "-static", 0}, {"--static", "-static", 0},
{"--std", "-std=", "aj"}, {"--std", "-std=", "aj"},
{"--symbolic", "-symbolic", 0}, {"--symbolic", "-symbolic", 0},
{"--sysroot", "--sysroot=", "aj"},
{"--time", "-time", 0}, {"--time", "-time", 0},
{"--trace-includes", "-H", 0}, {"--trace-includes", "-H", 0},
{"--traditional", "-traditional", 0}, {"--traditional", "-traditional", 0},
@ -3064,6 +3065,9 @@ display_help (void)
fputs (_(" -time Time the execution of each subprocess\n"), stdout); fputs (_(" -time Time the execution of each subprocess\n"), stdout);
fputs (_(" -specs=<file> Override built-in specs with the contents of <file>\n"), stdout); fputs (_(" -specs=<file> Override built-in specs with the contents of <file>\n"), stdout);
fputs (_(" -std=<standard> Assume that the input sources are for <standard>\n"), stdout); fputs (_(" -std=<standard> Assume that the input sources are for <standard>\n"), stdout);
fputs (_("\
--sysroot=<directory> Use <directory> as the root directory for headers\n\
for headers and libraries\n"), stdout);
fputs (_(" -B <directory> Add <directory> to the compiler's search paths\n"), stdout); fputs (_(" -B <directory> Add <directory> to the compiler's search paths\n"), stdout);
fputs (_(" -b <machine> Run gcc for target <machine>, if installed\n"), stdout); fputs (_(" -b <machine> Run gcc for target <machine>, if installed\n"), stdout);
fputs (_(" -V <version> Run gcc version number <version>, if installed\n"), stdout); fputs (_(" -V <version> Run gcc version number <version>, if installed\n"), stdout);
@ -3926,6 +3930,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
; ;
else if (! strcmp (argv[i], "-fhelp")) else if (! strcmp (argv[i], "-fhelp"))
; ;
else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
{
target_system_root = argv[i] + strlen ("--sysroot=");
target_system_root_changed = 1;
}
else if (argv[i][0] == '+' && argv[i][1] == 'e') else if (argv[i][0] == '+' && argv[i][1] == 'e')
{ {
/* Compensate for the +e options to the C++ front-end; /* Compensate for the +e options to the C++ front-end;