This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Permit relative path for --with-gxx-include-dir


The --with-gxx-include-dir option to configure permits users to
specify the location in which the libstdc++ header files will be
installed, and, therefore, the directory that the compiler will
search.  At present, this must be an absolute path.

This patch makes it possible to specify a relative path, instead of an
absolute path.  If a relative path is provided, the path is relative
to $prefix.  I haven't yet fully tested this patch on mainline (though
I have tested it on 4.1 and 4.2).  I plan to do that testing, and
check in the patch, but I wanted to give a chance for people to
comment.  Any objections?  (I won't check this in for at least 24
hours, to give people a chance to comment.)

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2007-03-06  Mark Mitchell  <mark@codesourcery.com>

	gcc/
	* acinclude.m4 (--with-gxx-include-dir): Permit relative paths.
	* configure: Regenerated.
	libstdc++-v3/
	* acinclude.m4 (--with-gxx-include-dir): Likewise.
	* configure: Regenerated.

Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4	(revision 164822)
+++ libstdc++-v3/acinclude.m4	(working copy)
@@ -677,11 +677,23 @@ AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], 
   AC_MSG_CHECKING([for gxx-include-dir])
   AC_ARG_WITH([gxx-include-dir],
     AC_HELP_STRING([--with-gxx-include-dir=DIR],
-                   [installation directory for include files]),
+                   [Install libstdc++ header files in DIR.
+                    If DIR is not an absolute path, it is interpreted
+		    relative to the directory specified by the --prefix 
+	            option.]),
     [case "$withval" in
       yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
       no)  gxx_include_dir=no ;;
-      *)   gxx_include_dir=$withval ;;
+      /*)  gxx_include_dir=$withval ;;
+      *)   
+	# The user provided a relative path.  Relative paths are
+	# interpreted relative to the prefix.  However, we wish
+	# to allow for the possibility of configuring with one --prefix 
+	# option and then installing with a different prefix, via
+	# make install prefix=<something>.  So, we arrange for 
+	# make to expand the prefix itself, rather than expanding it
+	# here at configure time.
+	gxx_include_dir='${prefix}'/$withval ;;
      esac],
     [gxx_include_dir=no])
   AC_MSG_RESULT($gxx_include_dir)
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 164822)
+++ gcc/configure.ac	(working copy)
@@ -128,12 +128,16 @@ fi
 gcc_gxx_include_dir=
 # Specify the g++ header file directory
 AC_ARG_WITH(gxx-include-dir,
-[  --with-gxx-include-dir=DIR
-                          specifies directory to put g++ header files],
+  AC_HELP_STRING([--with-gxx-include-dir=DIR],
+                 [Install libstdc++ header files in DIR.
+                  If DIR is not an absolute path, it is interpreted
+		  relative to the directory specified by the --prefix 
+	          option.]),
 [case "${withval}" in
 yes)	AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
 no)	;;
-*)	gcc_gxx_include_dir=$with_gxx_include_dir ;;
+/*)	gcc_gxx_include_dir=$with_gxx_include_dir ;;
+*)	gcc_gxx_include_dir=$prefix/$with_gxx_include_dir ;;
 esac])
 
 # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]