[Bug target/57792] fixincludes doesn't honor the use of --with-sysroot during bootstrap

2013-07-04 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57792

Jack Howarth howarth at nitro dot med.uc.edu changed:

   What|Removed |Added

Summary|--with-native-system-header |fixincludes doesn't honor
   |-dir confuses -isysroot |the use of --with-sysroot
   ||during bootstrap

--- Comment #1 from Jack Howarth howarth at nitro dot med.uc.edu ---
The removal of the SDK from / on darwin exposes a defect in fixincludes. The
fixinc.in hardcodes /usr/include without any attempt to detect if the
bootstrap has been invoked with the --with-sysroot configure option. On
darwin13, one currently has to hack around this defect with...

perl -pi -e 's|/usr/include|`xcrun --show-sdk-path`/usr/include|g'
fixincludes/fixinc.in

before executing…

--prefix=/sw --prefix=/sw/lib/gcc4.8 --mandir=/sw/share/man
--infodir=/sw/lib/gcc4.8/info
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-isl=/sw --with-cloog=/sw --with-mpc=/sw
--with-system-zlib --enable-checking=release --x-includes=/usr/X11R6/include
--x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.8
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk

This bootstraps normally and produces a compiler with a functional -isysroot
compiler option (i.e. the directory passed to -isysroot is appended to /).

Some mechanism needs to be added to allow the use of --with-sysroot in the
bootstrap to be detected in the fixincludes/fixinc.in shell script and, if
--with-sysroot is in use, the path to the sysroot prefixed to /usr/include at…

# # # # # # # # # # # # # # # # # # # # #
#
#  Search each input directory for broken header files.
#  This loop ends near the end of the file.
#
if test $# -eq 0
then
INPUTLIST=/usr/include
else
INPUTLIST=$@
fi

[Bug target/57792] fixincludes doesn't honor the use of --with-sysroot during bootstrap

2013-07-04 Thread bkorb at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57792

Bruce Korb bkorb at gnu dot org changed:

   What|Removed |Added

 CC||bonzini at gnu dot org,
   ||ghazi at gcc dot gnu.org

--- Comment #2 from Bruce Korb bkorb at gnu dot org ---
Paolo did the config stuff, with Kaveh's help.
However, Jack Howarth may be in a better position to
make a patch since I do not have an Apple development
system.


[Bug target/57792] fixincludes doesn't honor the use of --with-sysroot during bootstrap

2013-07-04 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57792

--- Comment #3 from Jack Howarth howarth at nitro dot med.uc.edu ---
(In reply to Bruce Korb from comment #2)
 Paolo did the config stuff, with Kaveh's help.
 However, Jack Howarth may be in a better position to
 make a patch since I do not have an Apple development
 system.

I would think that we want some permutation of the following code from
gcc/configure.ac added to fixincludes/configure.ac…

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)'

 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)

as well as associated changes to fixincludes/Makefile.in and
fixincludes/fixinc.in to have TARGET_SYSTEM_ROOT passed to and used by the
generated fixincludes/fixin shell script. I would be happy to test any proposed
fix along those lines (but I am unclear on how complex the additions to
fixincludes/configure.ac need to be to handle cross compiles, etc).