On Thu, Jul 04, 2013 at 10:41:45AM -0700, Bruce Korb wrote:
> On 07/04/13 09:40, Jack Howarth wrote:
>> Currently I am forced to manually patch fixincludes/fixinc.in to have the 
>> DIR passed to
>> --with-sysroot honored during the bootstrap. Thanks in advance for any help 
>> in getting
>> this oversight in fixincludes fixed for gcc 4.9.
>>              Jack
>
> I saw the bug report.  I find autotools sufficiently flexible that they
> are neigh on opaque.  I *think* you'll need:
>
>   AC_ARG_WITH([sysroot],
>     [the system include directory -- default: /usr/include],
>     [ AC_DEFINE_UNQUOTED([SYSTEM_INC_DIR], "$withval",
>           [system include directory])
>
>       [if test -d "$withval" ; then SYSTEM_INC_DIR=$withval
>        else AC_MSG_ERROR([provided value is not a directory: $withval]) ; 
> fi]],
>
>     [SYSTEM_INC_DIR=/usr/include])
>
> and then replace the INPUTLIST definition with:
>
>   test $# -eq 0 && INPUTLIST="@SYSTEM_INC_DIR@" || INPUTLIST="$*"
>
> using "$@" is confusing and won't actually work:
>
>> $ set a b c\ d;echo $#;f="$@";set -- $f; echo $#
>> 3
>> 4
>
>
> Anyway, I *think* that works, but like I said, it's pretty opaque to me.

   It appears that the existing code is sufficient. I'm not sure how I missed 
this in my previous
testing but a build with...

../gcc-4.8.1/configure --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

...produced...

chmod a+rx include-fixed
if [ -d ../prev-gcc ]; then \
          cd ../prev-gcc && \
          /Library/Developer/CommandLineTools/usr/bin/make 
real-install-headers-tar DESTDIR=`pwd`/../gcc/ \
            libsubdir=. ; \
        else \
          set -e; for ml in `cat fixinc_list`; do \
            sysroot_headers_suffix=`echo ${ml} | sed -e 's/;.*$//'`; \
            multi_dir=`echo ${ml} | sed -e 's/^[^;]*;//'`; \
            fix_dir=include-fixed${multi_dir}; \
            if ! false && test ! -d `echo 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk${sysroot_headers_suffix}/usr/include
 | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`; then \
              echo The directory that should contain system headers does not 
exist: >&2 ; \
              echo "  `echo 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk${sysroot_headers_suffix}/usr/include
 | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`" >&2 ; \
              tooldir_sysinc=`echo 
"/sw/lib/gcc4.8/lib/gcc/x86_64-apple-darwin13.0.0/4.8.1/../../../../x86_64-apple-darwin13.0.0/sys-include"
 | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
              if test "x`echo 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk${sysroot_headers_suffix}/usr/include
 | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`" = "x${tooldir_sysinc}"; \
              then sleep 1; else exit 1; fi; \
            fi; \
            /bin/sh ../../gcc-4.8.1/gcc/../mkinstalldirs ${fix_dir}; \
            chmod a+rx ${fix_dir} || true; \
            (TARGET_MACHINE='x86_64-apple-darwin13.0.0'; srcdir=`cd 
../../gcc-4.8.1/gcc; ${PWDCMD-pwd}`; \
              SHELL='/bin/sh'; MACRO_LIST=`${PWDCMD-pwd}`/macro_list ; \
              gcc_dir=`${PWDCMD-pwd}` ; \
              export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
              cd ../build-x86_64-apple-darwin13.0.0/fixincludes && \
              /bin/sh ./fixinc.sh "${gcc_dir}/${fix_dir}" \
                `echo 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk${sysroot_headers_suffix}/usr/include
 | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`  ); \
            rm -f ${fix_dir}/syslimits.h; \
            if [ -f ${fix_dir}/limits.h ]; then \
              mv ${fix_dir}/limits.h ${fix_dir}/syslimits.h; \
            else \
              cp ../../gcc-4.8.1/gcc/gsyslimits.h ${fix_dir}/syslimits.h; \
            fi; \
            chmod a+r ${fix_dir}/syslimits.h; \
          done; \
        fi
(cd `${PWDCMD-pwd}`/include-fixed ; \
         tar -cf - .; exit 0) | (cd 
/sw/src/fink.build/gcc48-4.8.1-1001/darwin_objdir/prev-gcc/../gcc/./include-fixed;
 tar xpf - )
echo timestamp > stmp-fixinc
if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
if [ -d include-fixed ] ; then true; else mkdir include-fixed; chmod a+rx 
include-fixed; fi

Sorry for the noise as I was certain that I had tested just --with-sysroot 
before. The top level configure really needs adjusted
to make '--with-sysroot="`xcrun --show-sdk-path`"' the default behavior on 
darwin13 and later.
               Jack

Reply via email to