aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-07-07 18:20:06 +0000
committerVladimir Prus <vprus@gcc.gnu.org>2008-07-07 18:20:06 +0000
commit3def13974f5a8ff5026a4a1abeff2131bd6d9049 (patch)
tree56bd9fbe878933d3f0bf4006e207b57c5ea16cea /gcc
parent40a420d5a84a8ee860c65ec86ee01c3e165a8ff8 (diff)
downloadgcc-3def13974f5a8ff5026a4a1abeff2131bd6d9049.zip
gcc-3def13974f5a8ff5026a4a1abeff2131bd6d9049.tar.gz
gcc-3def13974f5a8ff5026a4a1abeff2131bd6d9049.tar.bz2
gcc.c (print_sysroot): New.
* gcc.c (print_sysroot): New. (option_map, display_help, process_command): Handle the -print-sysroot option. (main): Print the sysroot if requested. * doc/invoke.texi (Debugging Options): Document -print-sysroot. From-SVN: r137584
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/doc/invoke.texi10
-rw-r--r--gcc/gcc.c20
3 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 580e615..cb18582 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-07 Vladimir Prus <vladimir@codesourcery.com>
+
+ * gcc.c (print_sysroot): New.
+ (option_map, display_help, process_command): Handle the
+ -print-sysroot option.
+ (main): Print the sysroot if requested.
+ * doc/invoke.texi (Debugging Options): Document -print-sysroot.
+
2008-07-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR target/34780
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5732d98..29f5534 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -310,7 +310,7 @@ Objective-C and Objective-C++ Dialects}.
-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
-print-multi-directory -print-multi-lib @gol
-print-prog-name=@var{program} -print-search-dirs -Q @gol
--print-sysroot-headers-suffix @gol
+-print-sysroot -print-sysroot-headers-suffix @gol
-save-temps -time}
@item Optimization Options
@@ -5059,6 +5059,14 @@ variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
Don't forget the trailing @samp{/}.
@xref{Environment Variables}.
+@item -print-sysroot
+@opindex print-sysroot
+Print the target sysroot directory that will be used during
+compilation. This is the target sysroot specified either at configure
+time or or using the @option{--sysroot} option, possibly with an extra
+suffix that depends on compilation options. If no target sysroot is
+specified, the option prints nothing.
+
@item -print-sysroot-headers-suffix
@opindex print-sysroot-headers-suffix
Print the suffix added to the target sysroot when searching for
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0053324..7914e4b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -155,6 +155,8 @@ static const char *print_prog_name = NULL;
static int print_multi_directory;
+static int print_sysroot;
+
/* Flag saying to print the relative path we'd use to
find OS libraries given the current compiler flags. */
@@ -1162,6 +1164,7 @@ static const struct option_map option_map[] =
{"--print-multi-directory", "-print-multi-directory", 0},
{"--print-multi-os-directory", "-print-multi-os-directory", 0},
{"--print-prog-name", "-print-prog-name=", "aj"},
+ {"--print-sysroot", "-print-sysroot", 0},
{"--print-sysroot-headers-suffix", "-print-sysroot-headers-suffix", 0},
{"--profile", "-p", 0},
{"--profile-blocks", "-a", 0},
@@ -3244,6 +3247,7 @@ display_help (void)
-print-multi-lib Display the mapping between command line options and\n\
multiple library search directories\n"), stdout);
fputs (_(" -print-multi-os-directory Display the relative path to OS libraries\n"), stdout);
+ fputs (_(" -print-sysroot Display the target libraries directory\n"), stdout);
fputs (_(" -print-sysroot-headers-suffix Display the sysroot suffix used to find headers\n"), stdout);
fputs (_(" -Wa,<options> Pass comma-separated <options> on to the assembler\n"), stdout);
fputs (_(" -Wp,<options> Pass comma-separated <options> on to the preprocessor\n"), stdout);
@@ -3686,6 +3690,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
print_multi_lib = 1;
else if (! strcmp (argv[i], "-print-multi-directory"))
print_multi_directory = 1;
+ else if (! strcmp (argv[i], "-print-sysroot"))
+ print_sysroot = 1;
else if (! strcmp (argv[i], "-print-multi-os-directory"))
print_multi_os_directory = 1;
else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
@@ -4126,6 +4132,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
;
else if (! strcmp (argv[i], "-print-multi-directory"))
;
+ else if (! strcmp (argv[i], "-print-sysroot"))
+ ;
else if (! strcmp (argv[i], "-print-multi-os-directory"))
;
else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
@@ -6529,6 +6537,18 @@ main (int argc, char **argv)
return (0);
}
+ if (print_sysroot)
+ {
+ if (target_system_root)
+ {
+ if (target_sysroot_suffix)
+ printf ("%s%s\n", target_system_root, target_sysroot_suffix);
+ else
+ printf ("%s\n", target_system_root);
+ }
+ return (0);
+ }
+
if (print_multi_os_directory)
{
if (multilib_os_dir == NULL)