public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] avoid '//' prefixes when sysroot is set to '/'
@ 2012-01-25 15:52 Matthias Klose
  2012-01-25 16:45 ` Joseph S. Myers
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Klose @ 2012-01-25 15:52 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

when setting sysroot to / (for whatever reason), then search directories and 
headers start with a double-slash, as seen with gcc -v.

#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc/x86_64-linux-gnu/4.6/include
  //usr/local/include
  /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
  //usr/include/x86_64-linux-gnu
  //usr/include
End of search list.

LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/://lib/x86_64-linux-gnu/://lib/../lib/://usr/lib/x86_64-linux-gnu/://usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../://lib/://usr/lib/

This can end up in generation for dependency files, and other files parsing the 
output. The solution I came up with is to check for sysroot set to '/' and 
special case this in two places. Afaics, there are no other places.

With the patch, both the include paths and the library paths start with a single 
slash. No regressions seen running the testsuite on x86_64-linux-gnu.

   Matthias

[-- Attachment #2: gcc.diff --]
[-- Type: text/plain, Size: 1297 bytes --]

2012-01-24  Matthias Klose  <doko@ubuntu.com>

	* gcc.c (add_sysrooted_prefix): Don't prefix with the system root,
	  if it is the root directory.
	* incpath.c (add_standard_paths): Likewise.

Index: gcc/incpath.c
===================================================================
--- gcc/incpath.c	(revision 183421)
+++ gcc/incpath.c	(working copy)
@@ -166,7 +166,10 @@
 
 	  /* Should this directory start with the sysroot?  */
 	  if (sysroot && p->add_sysroot)
-	    str = concat (sysroot, p->fname, NULL);
+	    if (IS_DIR_SEPARATOR (*sysroot) && sysroot[1] == '\0')
+	      str = concat (p->fname, NULL);
+	    else
+	      str = concat (sysroot, p->fname, NULL);
 	  else if (!p->add_sysroot && relocated
 		   && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
 	    {
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 183421)
+++ gcc/gcc.c	(working copy)
@@ -2443,7 +2443,9 @@
   if (!IS_ABSOLUTE_PATH (prefix))
     fatal_error ("system path %qs is not absolute", prefix);
 
-  if (target_system_root)
+  if (target_system_root 
+      && !IS_DIR_SEPARATOR (*target_system_root)
+      && target_system_root[1] != '\0')
     {
       if (target_sysroot_suffix)
 	  prefix = concat (target_sysroot_suffix, prefix, NULL);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-01-25 15:52 [patch] avoid '//' prefixes when sysroot is set to '/' Matthias Klose
@ 2012-01-25 16:45 ` Joseph S. Myers
  2012-01-26 14:34   ` Matthias Klose
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph S. Myers @ 2012-01-25 16:45 UTC (permalink / raw)
  To: Matthias Klose; +Cc: GCC Patches

On Wed, 25 Jan 2012, Matthias Klose wrote:

> This can end up in generation for dependency files, and other files parsing
> the output. The solution I came up with is to check for sysroot set to '/' and
> special case this in two places. Afaics, there are no other places.

I could imagine a sysroot path that isn't just '/' but ends with '/' 
resulting in duplicate '/' in the middle of the path - although that's not 
a correctness issue in the way that '//' at the start could be, maybe the 
best check is actually for '/' at end of sysroot (in which case skip the 
'/' at the start of the path within the sysroot)?  Or remove such a '/' at 
end of sysroot at configure time rather than checking for it later....

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-01-25 16:45 ` Joseph S. Myers
@ 2012-01-26 14:34   ` Matthias Klose
  2012-01-26 17:57     ` Joseph S. Myers
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Klose @ 2012-01-26 14:34 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

On 25.01.2012 17:45, Joseph S. Myers wrote:
> On Wed, 25 Jan 2012, Matthias Klose wrote:
>
>> This can end up in generation for dependency files, and other files parsing
>> the output. The solution I came up with is to check for sysroot set to '/' and
>> special case this in two places. Afaics, there are no other places.
>
> I could imagine a sysroot path that isn't just '/' but ends with '/'
> resulting in duplicate '/' in the middle of the path - although that's not
> a correctness issue in the way that '//' at the start could be, maybe the
> best check is actually for '/' at end of sysroot (in which case skip the
> '/' at the start of the path within the sysroot)?

as in the attached trailing.diff? built and regression tested.

> Or remove such a '/' at
> end of sysroot at configure time rather than checking for it later....

that's not enough. you can pass --sysroot=/ to the driver as well. I tried that 
in the attached tsr.diff, but I don't like it because the driver then pases 
`-isysroot ""' to the cc*1 binaries, which looks a bit misleading.

   Matthias

[-- Attachment #2: trailing.diff --]
[-- Type: text/plain, Size: 1688 bytes --]

Index: gcc/incpath.c
===================================================================
--- gcc/incpath.c	(revision 183555)
+++ gcc/incpath.c	(working copy)
@@ -166,7 +166,15 @@
 
 	  /* Should this directory start with the sysroot?  */
 	  if (sysroot && p->add_sysroot)
-	    str = concat (sysroot, p->fname, NULL);
+	    {
+	      char *sysroot_no_trailing_dir_separator = xstrdup (sysroot);
+	      int sysroot_len = strlen (sysroot);
+
+	      if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR)
+		sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0';
+	      str = concat (sysroot_no_trailing_dir_separator, p->fname, NULL);
+	      free (sysroot_no_trailing_dir_separator);
+	    }
 	  else if (!p->add_sysroot && relocated
 		   && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
 	    {
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 183555)
+++ gcc/gcc.c	(working copy)
@@ -2445,9 +2445,17 @@
 
   if (target_system_root)
     {
+      char *sysroot_no_trailing_dir_separator = xstrdup (target_system_root);
+      int sysroot_len = strlen (target_system_root);
+
+      if (sysroot_len > 0
+	  && target_system_root[sysroot_len - 1] == DIR_SEPARATOR)
+	sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0';
+
       if (target_sysroot_suffix)
 	  prefix = concat (target_sysroot_suffix, prefix, NULL);
-      prefix = concat (target_system_root, prefix, NULL);
+      prefix = concat (sysroot_no_trailing_dir_separator, prefix, NULL);
+      free (sysroot_no_trailing_dir_separator);
 
       /* We have to override this because GCC's notion of sysroot
 	 moves along with GCC.  */

[-- Attachment #3: tsr.diff --]
[-- Type: text/plain, Size: 1584 bytes --]

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 183514)
+++ gcc/gcc.c	(working copy)
@@ -3417,6 +3417,12 @@
 
     case OPT__sysroot_:
       target_system_root = arg;
+      {
+        int target_system_root_len = strlen (target_system_root);
+
+        if (target_system_root[target_system_root_len - 1] == DIR_SEPARATOR)
+          target_system_root[target_system_root_len - 1] = '\0';
+      }
       target_system_root_changed = 1;
       do_save = false;
       break;
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 183514)
+++ gcc/configure.ac	(working copy)
@@ -767,7 +767,7 @@
 [
  case ${with_sysroot} in
  yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+ *) TARGET_SYSTEM_ROOT=`echo $with_sysroot | sed 's,/$,,'` ;;
  esac
    
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
@@ -1830,7 +1830,7 @@
 		*)
 			;;
 	esac
-elif test "x$TARGET_SYSTEM_ROOT" != x; then
+elif test "x$TARGET_SYSTEM_ROOT_DEFINE" != x; then
         SYSTEM_HEADER_DIR=$build_system_header_dir 
 fi
 
@@ -4547,7 +4547,7 @@
 [Define to PREFIX/include if cpp should also search that directory.])
 fi
 
-if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
+if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT_DEFINE" != x; then
   if test "x$with_headers" != x; then
     target_header_dir=$with_headers
   elif test "x$with_sysroot" = x; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-01-26 14:34   ` Matthias Klose
@ 2012-01-26 17:57     ` Joseph S. Myers
  2012-02-08  0:14       ` Matthias Klose
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph S. Myers @ 2012-01-26 17:57 UTC (permalink / raw)
  To: Matthias Klose; +Cc: GCC Patches

On Thu, 26 Jan 2012, Matthias Klose wrote:

> On 25.01.2012 17:45, Joseph S. Myers wrote:
> > On Wed, 25 Jan 2012, Matthias Klose wrote:
> > 
> > > This can end up in generation for dependency files, and other files
> > > parsing
> > > the output. The solution I came up with is to check for sysroot set to '/'
> > > and
> > > special case this in two places. Afaics, there are no other places.
> > 
> > I could imagine a sysroot path that isn't just '/' but ends with '/'
> > resulting in duplicate '/' in the middle of the path - although that's not
> > a correctness issue in the way that '//' at the start could be, maybe the
> > best check is actually for '/' at end of sysroot (in which case skip the
> > '/' at the start of the path within the sysroot)?
> 
> as in the attached trailing.diff? built and regression tested.

Yes, that's OK (with copyright date updates in incpath.c).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-01-26 17:57     ` Joseph S. Myers
@ 2012-02-08  0:14       ` Matthias Klose
  2012-02-08  1:01         ` Joseph S. Myers
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Klose @ 2012-02-08  0:14 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

On 26.01.2012 18:57, Joseph S. Myers wrote:
> On Thu, 26 Jan 2012, Matthias Klose wrote:
>
>> On 25.01.2012 17:45, Joseph S. Myers wrote:
>>> On Wed, 25 Jan 2012, Matthias Klose wrote:
>>>
>>>> This can end up in generation for dependency files, and other files
>>>> parsing
>>>> the output. The solution I came up with is to check for sysroot set to '/'
>>>> and
>>>> special case this in two places. Afaics, there are no other places.
>>>
>>> I could imagine a sysroot path that isn't just '/' but ends with '/'
>>> resulting in duplicate '/' in the middle of the path - although that's not
>>> a correctness issue in the way that '//' at the start could be, maybe the
>>> best check is actually for '/' at end of sysroot (in which case skip the
>>> '/' at the start of the path within the sysroot)?
>>
>> as in the attached trailing.diff? built and regression tested.
>
> Yes, that's OK (with copyright date updates in incpath.c).

there is one more issue, when configuring

  --with-sysroot=/ --with-gxx-include-dir=/usr/include/c++/4.7

in that the leading / is stripped away in configure.ac. This case needs an 
explicit check. Ok for the trunk?

   Matthias

* configure.ac (gcc_gxx_include_dir): Don't strip a `/' sysroot value.

[-- Attachment #2: gcc-sysroot.diff --]
[-- Type: text/plain, Size: 459 bytes --]

--- a/src/gcc/configure.ac
+++ b/src/gcc/configure.ac
@@ -149,7 +149,9 @@
 if test "${with_sysroot+set}" = set; then
   gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
   if test "${gcc_gxx_without_sysroot}"; then
-    gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
+    if test x${with_sysroot} != x/; then
+      gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
+    fi
     gcc_gxx_include_dir_add_sysroot=1
   fi
 fi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-02-08  0:14       ` Matthias Klose
@ 2012-02-08  1:01         ` Joseph S. Myers
  2012-02-08  2:03           ` Matthias Klose
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph S. Myers @ 2012-02-08  1:01 UTC (permalink / raw)
  To: Matthias Klose; +Cc: GCC Patches

On Wed, 8 Feb 2012, Matthias Klose wrote:

> there is one more issue, when configuring
> 
>  --with-sysroot=/ --with-gxx-include-dir=/usr/include/c++/4.7
> 
> in that the leading / is stripped away in configure.ac. This case needs an
> explicit check. Ok for the trunk?

This looks like a case where any sysroot with a trailing '/' could 
misbehave and remove a leading '/' that should be left there, i.e. where 
gcc_gxx_without_sysroot should be computed in a way that ignores any 
trailing '/' on the sysroot setting.  Or is such a removal actually 
harmless in all cases except for plain '/' as the sysroot?

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] avoid '//' prefixes when sysroot is set to '/'
  2012-02-08  1:01         ` Joseph S. Myers
@ 2012-02-08  2:03           ` Matthias Klose
  0 siblings, 0 replies; 8+ messages in thread
From: Matthias Klose @ 2012-02-08  2:03 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

On 08.02.2012 02:01, Joseph S. Myers wrote:
> On Wed, 8 Feb 2012, Matthias Klose wrote:
>
>> there is one more issue, when configuring
>>
>>   --with-sysroot=/ --with-gxx-include-dir=/usr/include/c++/4.7
>>
>> in that the leading / is stripped away in configure.ac. This case needs an
>> explicit check. Ok for the trunk?
>
> This looks like a case where any sysroot with a trailing '/' could
> misbehave and remove a leading '/' that should be left there, i.e. where
> gcc_gxx_without_sysroot should be computed in a way that ignores any
> trailing '/' on the sysroot setting.  Or is such a removal actually
> harmless in all cases except for plain '/' as the sysroot?

not harmless, but not seen unless you pass --sysroot=<path with trailing /> to 
the driver. so lets strip the trailing / as well.

this requires that the definition for
   AC_ARG_WITH(sysroot, ...)
is moved before the use of the fixed with_sysroot before checking with_sysroot 
in the gcc_gxx_without_sysroot check.

   Matthias

[-- Attachment #2: 1.diff --]
[-- Type: text/plain, Size: 5069 bytes --]

	* configure.ac: Move AC_ARG_WITH checks for native-system-header-dir,
	build-sysroot, sysroot from the `Miscenalleous configure options'
	to the `Directories' section.

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 183991)
+++ gcc/configure.ac	(working copy)
@@ -118,6 +118,68 @@
 	local_prefix=/usr/local
 fi
 
+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, 
+  [AS_HELP_STRING([--with-build-sysroot=sysroot],
+                  [use sysroot as the system root during the build])],
+  [if test x"$withval" != x ; then
+     SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
+   fi],
+  [SYSROOT_CFLAGS_FOR_TARGET=])
+AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
+
+AC_ARG_WITH(sysroot,
+[AS_HELP_STRING([[--with-sysroot[=DIR]]],
+		[search for usr/lib, usr/include, et al, within DIR])],
+[
+ case ${with_sysroot} in
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
+ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+ esac
+   
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
+	
+ if test "x$prefix" = xNONE; then
+  test_prefix=/usr/local
+ else
+  test_prefix=$prefix
+ fi
+ if test "x$exec_prefix" = xNONE; then
+  test_exec_prefix=$test_prefix
+ else
+  test_exec_prefix=$exec_prefix
+ fi
+ case ${TARGET_SYSTEM_ROOT} in
+ "${test_prefix}"|"${test_prefix}/"*|\
+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+ '${prefix}'|'${prefix}/'*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
+   t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
+   TARGET_SYSTEM_ROOT_DEFINE="$t"
+   ;;
+ esac
+], [
+ TARGET_SYSTEM_ROOT=
+ TARGET_SYSTEM_ROOT_DEFINE=
+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+])
+AC_SUBST(TARGET_SYSTEM_ROOT)
+AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
+
 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
 # passed in by the toplevel make and thus we'd get different behavior
 # depending on where we built the sources.
@@ -739,68 +801,6 @@
 ], [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, 
-  [AS_HELP_STRING([--with-build-sysroot=sysroot],
-                  [use sysroot as the system root during the build])],
-  [if test x"$withval" != x ; then
-     SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
-   fi],
-  [SYSROOT_CFLAGS_FOR_TARGET=])
-AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
-
-AC_ARG_WITH(sysroot,
-[AS_HELP_STRING([[--with-sysroot[=DIR]]],
-		[search for usr/lib, usr/include, et al, within DIR])],
-[
- case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
-   
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
-	
- if test "x$prefix" = xNONE; then
-  test_prefix=/usr/local
- else
-  test_prefix=$prefix
- fi
- if test "x$exec_prefix" = xNONE; then
-  test_exec_prefix=$test_prefix
- else
-  test_exec_prefix=$exec_prefix
- fi
- case ${TARGET_SYSTEM_ROOT} in
- "${test_prefix}"|"${test_prefix}/"*|\
- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
- '${prefix}'|'${prefix}/'*|\
- '${exec_prefix}'|'${exec_prefix}/'*)
-   t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
-   TARGET_SYSTEM_ROOT_DEFINE="$t"
-   ;;
- esac
-], [
- TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE=
- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
-])
-AC_SUBST(TARGET_SYSTEM_ROOT)
-AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
-AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
-
 AC_ARG_WITH(specs,
   [AS_HELP_STRING([--with-specs=SPECS],
                   [add SPECS to driver command-line processing])],

[-- Attachment #3: 2.diff --]
[-- Type: text/plain, Size: 968 bytes --]

	* configure.ac: Strip trailing `/' from with_sysroot.
	(gcc_gxx_include_dir): Don't strip a `/' sysroot value.

--- gcc/configure.ac.1	2012-02-08 02:38:57.199995985 +0100
+++ gcc/configure.ac	2012-02-08 02:46:21.890648210 +0100
@@ -145,6 +145,10 @@
 		[search for usr/lib, usr/include, et al, within DIR])],
 [
  case ${with_sysroot} in
+ /) ;;
+ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
+ esac
+ case ${with_sysroot} in
  yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
@@ -211,7 +215,9 @@
 if test "${with_sysroot+set}" = set; then
   gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
   if test "${gcc_gxx_without_sysroot}"; then
-    gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
+    if test x${with_sysroot} != x/; then
+      gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
+    fi
     gcc_gxx_include_dir_add_sysroot=1
   fi
 fi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch] avoid '//' prefixes when sysroot is set to '/'
@ 2013-06-25 11:09 Yvan Roux
  0 siblings, 0 replies; 8+ messages in thread
From: Yvan Roux @ 2013-06-25 11:09 UTC (permalink / raw)
  To: gcc-patches

Hi,

any news on this one, as the issue with --with-sysroot and
--with-gxx-include-dir is still present in 4.8 ?

http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00320.html

Thanks,
Yvan

PS. Sorry for the re-post, I don't have the original one in my history

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-25 11:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 15:52 [patch] avoid '//' prefixes when sysroot is set to '/' Matthias Klose
2012-01-25 16:45 ` Joseph S. Myers
2012-01-26 14:34   ` Matthias Klose
2012-01-26 17:57     ` Joseph S. Myers
2012-02-08  0:14       ` Matthias Klose
2012-02-08  1:01         ` Joseph S. Myers
2012-02-08  2:03           ` Matthias Klose
2013-06-25 11:09 Yvan Roux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).