Patch to improve computations of gxx_include_dir and gcc_tooldir

Nick Clifton nickc@cygnus.com
Thu Feb 25 15:25:00 GMT 1999


Hi Guys,

  I would like to submit the patch below for consideration.  It does
  two things:

  1. It renames the variable 'gxx_include_dir' to 'gcc_gxx_include_dir'
  in line with the recent renaming of the variable 'tooldir' to
  'gcc_tooldir'.  This prevents the defintion of GPLUSPLUS_INCLUDE_DIR
  from being overridden by the top level Makefile. 

  2. It changes the computation of the value of 'gcc_tooldir' if
  both prefix and exec_prefix are specified.  The new version
  makes the computation be the same as if exec_prefix were not
  defined, or as if it was defined to be the same as prefix, except
  that the relative path between exec_prefix and prefix is included in
  the resulting string. 

  Both of these patches have proved necessary to allow installed
  toolchains to work, when they are installed into directories whoes 
  pathes do not match the pathes specified by the prefix variable when
  they were built.

Cheers
	Nick

Thu Feb 25 15:23:17 1999  Nick Clifton  <nickc@cygnus.com>

	* configure.in (gxx_include_dir): Rename to
	gcc_gxx_include_dir in order to prevent it being overridden by
	a top level Makefile.
	(gcc_tooldir): If $exec_prefix != $prefix then use the
	difference between the two as the basis for gcc_tooldir.

	* configure: Rebuild.

	* Makefile.in: Rename gxx_include_dir to gcc_gxx_include_dir.


Index: gcc/configure.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure.in,v
retrieving revision 1.211
diff -p -r1.211 configure.in
*** configure.in	1999/02/22 11:31:56	1.211
--- configure.in	1999/02/25 23:00:46
*************** if test x$local_prefix = x; then
*** 149,155 ****
  	local_prefix=/usr/local
  fi
  
! gxx_include_dir=
  # Specify the g++ header file directory
  AC_ARG_WITH(gxx-include-dir,
  [  --with-gxx-include-dir=DIR
--- 149,158 ----
  	local_prefix=/usr/local
  fi
  
! # 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.
! gcc_gxx_include_dir=
  # Specify the g++ header file directory
  AC_ARG_WITH(gxx-include-dir,
  [  --with-gxx-include-dir=DIR
*************** AC_ARG_WITH(gxx-include-dir,
*** 157,172 ****
  [case "${withval}" in
  yes)	AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
  no)	;;
! *)	gxx_include_dir=$with_gxx_include_dir ;;
  esac])
  
! if test x${gxx_include_dir} = x; then
    if test x${enable_version_specific_runtime_libs} = xyes; then
!     gxx_include_dir='${libsubdir}/include/g++'
    else
      topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
  changequote(<<, >>)dnl
!     gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface}
  changequote([, ])dnl
    fi
  fi
--- 160,175 ----
  [case "${withval}" in
  yes)	AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
  no)	;;
! *)	gcc_gxx_include_dir=$with_gxx_include_dir ;;
  esac])
  
! if test x${gcc_gxx_include_dir} = x; then
    if test x${enable_version_specific_runtime_libs} = xyes; then
!     gcc_gxx_include_dir='${libsubdir}/include/g++'
    else
      topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
  changequote(<<, >>)dnl
!     gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface}
  changequote([, ])dnl
    fi
  fi
*************** if test x$enable_haifa != x; then
*** 4208,4223 ****
      done
  fi
  
! # if $(exec_prefix) is not the same as $(prefix), then do not use a relative
! # directory to get to $gcc_tooldir.  Also handle the case where the user did
! # not specify a value for exec_prefix.
  # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
  # make and thus we'd get different behavior depending on where we built the
  # sources.
  if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
      gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
  else
!     gcc_tooldir='$(exec_prefix)'/${target_alias}
  fi
  AC_SUBST(gcc_tooldir)
  
--- 4211,4251 ----
      done
  fi
  
! # If $(exec_prefix) exists and is not the same as $(prefix), then compute an
! # absolute path for gcc_tooldir based on inserting the number of up-directory
! # movements required to get from $(exec_prefix) to $(prefix) into the basic
! # $(libsubdir)/@(unlibsubdir) based path.
  # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
  # make and thus we'd get different behavior depending on where we built the
  # sources.
  if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
      gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
  else
! changequote(<<, >>)dnl
! # An explanation of the sed strings:
! #  -e 's|^\$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
! #  -e 's|/$||'            match a trailing forward slash and eliminates it
! #  -e 's|^[^/]|/|'        forces the string to start with a forward slash (*)
! #  -e 's|/[^/]*|../|g'    replaces each occurance of /<directory> with ../
! #
! # (*) Note this pattern overwrites the first character of the string
! # with a forward slash if one is not already present.  This is not a
! # problem because the exact names of the sub-directories concerned is
! # unimportant, just the number of them matters.
! #
! # The practical upshot of these patterns is like this:
! #
! #  prefix     exec_prefix        result
! #  ------     -----------        ------
! #   /foo        /foo/bar          ../
! #   /foo/       /foo/bar          ../
! #   /foo        /foo/bar/         ../
! #   /foo/       /foo/bar/         ../
! #   /foo        /foo/bar/ugg      ../../
! #
!     gcc_tooldir="$(libsubdir)/$(unlibsubdir)/\`echo \$(exec_prefix) |
! sed -e 's|^\$(prefix)||' -e 's|/$||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`$(target_alias)"
! changequote([, ])dnl
  fi
  AC_SUBST(gcc_tooldir)
  
*************** AC_SUBST(JAVAGC)
*** 4273,4279 ****
  AC_SUBST(gcc_version)
  AC_SUBST(gcc_version_trigger)
  AC_SUBST(local_prefix)
! AC_SUBST(gxx_include_dir)
  AC_SUBST(fixincludes)
  AC_SUBST(build_install_headers_dir)
  AC_SUBST(build_exeext)
--- 4301,4307 ----
  AC_SUBST(gcc_version)
  AC_SUBST(gcc_version_trigger)
  AC_SUBST(local_prefix)
! AC_SUBST(gcc_gxx_include_dir)
  AC_SUBST(fixincludes)
  AC_SUBST(build_install_headers_dir)
  AC_SUBST(build_exeext)

Index: gcc/configure
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure,v
retrieving revision 1.207
diff -p -r1.207 configure
*** configure	1999/02/22 11:31:55	1.207
--- configure	1999/02/25 23:00:53
*************** if test x$local_prefix = x; then
*** 731,737 ****
  	local_prefix=/usr/local
  fi
  
! gxx_include_dir=
  # Specify the g++ header file directory
  # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
  if test "${with_gxx_include_dir+set}" = set; then
--- 731,740 ----
  	local_prefix=/usr/local
  fi
  
! # 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.
! gcc_gxx_include_dir=
  # Specify the g++ header file directory
  # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
  if test "${with_gxx_include_dir+set}" = set; then
*************** if test "${with_gxx_include_dir+set}" = 
*** 739,755 ****
    case "${withval}" in
  yes)	{ echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2; exit 1; } ;;
  no)	;;
! *)	gxx_include_dir=$with_gxx_include_dir ;;
  esac
  fi
  
  
! if test x${gxx_include_dir} = x; then
    if test x${enable_version_specific_runtime_libs} = xyes; then
!     gxx_include_dir='${libsubdir}/include/g++'
    else
      topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
!     gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface}
    fi
  fi
  
--- 742,758 ----
    case "${withval}" in
  yes)	{ echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2; exit 1; } ;;
  no)	;;
! *)	gcc_gxx_include_dir=$with_gxx_include_dir ;;
  esac
  fi
  
  
! if test x${gcc_gxx_include_dir} = x; then
    if test x${enable_version_specific_runtime_libs} = xyes; then
!     gcc_gxx_include_dir='${libsubdir}/include/g++'
    else
      topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
!     gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface}
    fi
  fi
  
*************** if test x$enable_haifa != x; then
*** 8321,8336 ****
      done
  fi
  
! # if $(exec_prefix) is not the same as $(prefix), then do not use a relative
! # directory to get to $gcc_tooldir.  Also handle the case where the user did
! # not specify a value for exec_prefix.
  # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
  # make and thus we'd get different behavior depending on where we built the
  # sources.
  if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
      gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
  else
!     gcc_tooldir='$(exec_prefix)'/${target_alias}
  fi
  
  
--- 8324,8362 ----
      done
  fi
  
! # If $(exec_prefix) exists and is not the same as $(prefix), then compute an
! # absolute path for gcc_tooldir based on inserting the number of up-directory
! # movements required to get from $(exec_prefix) to $(prefix) into the basic
! # $(libsubdir)/@(unlibsubdir) based path.
  # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
  # make and thus we'd get different behavior depending on where we built the
  # sources.
  if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
      gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
  else
! # An explanation of the sed strings:
! #  -e 's|^\$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
! #  -e 's|/$||'            match a trailing forward slash and eliminates it
! #  -e 's|^[^/]|/|'        forces the string to start with a forward slash (*)
! #  -e 's|/[^/]*|../|g'    replaces each occurance of /<directory> with ../
! #
! # (*) Note this pattern overwrites the first character of the string
! # with a forward slash if one is not already present.  This is not a
! # problem because the exact names of the sub-directories concerned is
! # unimportant, just the number of them matters.
! #
! # The practical upshot of these patterns is like this:
! #
! #  prefix     exec_prefix        result
! #  ------     -----------        ------
! #   /foo        /foo/bar          ../
! #   /foo/       /foo/bar          ../
! #   /foo        /foo/bar/         ../
! #   /foo/       /foo/bar/         ../
! #   /foo        /foo/bar/ugg      ../../
! #
!     gcc_tooldir="$(libsubdir)/$(unlibsubdir)/\`echo \$(exec_prefix) |
! sed -e 's|^\$(prefix)||' -e 's|/$||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`$(target_alias)"
  fi
  
  
*************** s%@JAVAGC@%$JAVAGC%g
*** 8680,8686 ****
  s%@gcc_version@%$gcc_version%g
  s%@gcc_version_trigger@%$gcc_version_trigger%g
  s%@local_prefix@%$local_prefix%g
! s%@gxx_include_dir@%$gxx_include_dir%g
  s%@fixincludes@%$fixincludes%g
  s%@build_install_headers_dir@%$build_install_headers_dir%g
  s%@build_exeext@%$build_exeext%g
--- 8706,8712 ----
  s%@gcc_version@%$gcc_version%g
  s%@gcc_version_trigger@%$gcc_version_trigger%g
  s%@local_prefix@%$local_prefix%g
! s%@gcc_gxx_include_dir@%$gcc_gxx_include_dir%g
  s%@fixincludes@%$fixincludes%g
  s%@build_install_headers_dir@%$build_install_headers_dir%g
  s%@build_exeext@%$build_exeext%g

Index: gcc/Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.231
diff -p -r1.231 Makefile.in
*** Makefile.in	1999/02/22 08:49:24	1.231
--- Makefile.in	1999/02/25 23:01:08
*************** gcc_tooldir = @gcc_tooldir@
*** 272,278 ****
  # Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
  build_tooldir = $(exec_prefix)/$(target_alias)
  # Directory in which the compiler finds g++ includes.
! gxx_include_dir= @gxx_include_dir@
  # Directory to search for site-specific includes.
  includedir = $(local_prefix)/include
  # assertdir is overridden in cross-make.
--- 272,278 ----
  # Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
  build_tooldir = $(exec_prefix)/$(target_alias)
  # Directory in which the compiler finds g++ includes.
! gcc_gxx_include_dir= @gcc_gxx_include_dir@
  # Directory to search for site-specific includes.
  includedir = $(local_prefix)/include
  # assertdir is overridden in cross-make.
*************** FLAGS_TO_PASS = \
*** 633,639 ****
  	"exec_prefix=$(exec_prefix)" \
  	"prefix=$(prefix)" \
  	"local_prefix=$(local_prefix)" \
! 	"gxx_include_dir=$(gxx_include_dir)" \
  	"tooldir=$(tooldir)" \
  	"gcc_tooldir=$(gcc_tooldir)" \
  	"bindir=$(bindir)" \
--- 633,639 ----
  	"exec_prefix=$(exec_prefix)" \
  	"prefix=$(prefix)" \
  	"local_prefix=$(local_prefix)" \
! 	"gxx_include_dir=$(gcc_gxx_include_dir)" \
  	"tooldir=$(tooldir)" \
  	"gcc_tooldir=$(gcc_tooldir)" \
  	"bindir=$(bindir)" \
*************** cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h 
*** 1948,1954 ****
             mbchar.h prefix.h Makefile.in
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
--- 1948,1954 ----
             mbchar.h prefix.h Makefile.in
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
*************** cppinit.o:  cppalloc.c $(CONFIG_H) cppli
*** 1982,1988 ****
  		cpphash.h prefix.h output.h Makefile
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
--- 1982,1988 ----
  		cpphash.h prefix.h output.h Makefile
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
*************** protoize.o: protoize.c $(srcdir)/../incl
*** 2005,2011 ****
     Makefile
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
--- 2005,2011 ----
     Makefile
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
*************** unprotoize.o: unprotoize.c protoize.c $(
*** 2016,2022 ****
     $(CONFIG_H) system.h Makefile
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
--- 2016,2022 ----
     $(CONFIG_H) system.h Makefile
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
! 	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
  	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
  	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \


More information about the Gcc-patches mailing list