This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

PATCH: to allow libstdc++ v2 or v3 to be checked in build tree.


It has not been possible to run ``make check-g++'' when the gcc tree
has been configured and built against libstdc++-v3 without a
system-specific patch applied to the latest-released dejagnu.  This
patch addresses the issue solely in gcc.  An alternate approach has
been discussed involving pre-installing all the libstdc++-v3 headers
and libraries into a system independent form under the build tree, but
no one has done any work on that.  Even in that approach some patch
would be required to the official dejagnu/libgloss.exp file and/or
gcc/testsuite/lib/g++.exp but the patch to libstdc++-v3/mkcheck.in
would not be required.

Bootstrapped and tested on i686-unknown-freebsd3.4 when configured
against both libstdc++ v2 and v3 (independent builds since, to my
knowledge, there is no way to configure a tree to support both
versions of the library concurrently).

Special note: this patch only supports testing a tree configured
against libstdc++-v3 when $gccpath != "" in g++_link_flags (related to
multilibs? - I think I covered the case for systems that are
configured to use them) since I don't have the ability to test the
other case nor do I trust myself to write the patch for the other path
without testing it.

[Entry for libstdc++-v3/ChangeLog:]

2000-06-27  H.J. Lu  <hjl@gnu.org>
	    Loren J. Rittle  <ljrittle@acm.org>

	* mkcheck.in: Add support to print standard flags needed to
	test g++ in build tree.  Enhance command line error checking.

[Entry for gcc/testsuite/ChangeLog:]

2000-06-27  H.J. Lu  <hjl@gnu.org>
	    Loren J. Rittle  <ljrittle@acm.org>

	* lib/g++.exp (g++_include_flags): Override libgloss.exp
	version with one that knows about the new gcc tree structure.
	(g++_link_flags): Same.

Index: libstdc++-v3/mkcheck.in
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/mkcheck.in,v
retrieving revision 1.14
diff -c -p -r1.14 mkcheck.in
*** mkcheck.in	2000/06/26 18:58:19	1.14
--- mkcheck.in	2000/06/27 05:18:55
***************
*** 8,33 ****
  # shared linkage.
  
  # Invocation 
! # mkcheck [01] (path to build) (path to src) (path to install)
  
- if [ $# != 3 ] && [ $# != 4 ]; then
-     echo 'Usage: mkcheck 0 (path to build) (path to src)'
-     echo '       mkcheck 1 (path to build) (path to src) (path to install)'
-     exit 1
- fi
- echo "running mkcheck"
- 
  #
  # 1: variables
  #
! # WHICH determines if you are testing the installed binary and headers, or
! # the build binary and headers.
  WHICH=$1
! if [ $WHICH != "1" ]; then
!   WHICH=0
    echo "$0: testing the build directory"
! elif [ $WHICH -eq 1 ]; then
    echo "$0: testing the install directory $4"
  fi
  
  BUILD_DIR=$2
--- 8,36 ----
  # shared linkage.
  
  # Invocation 
! # mkcheck [012] (path to build) (path to src) (path to install)
  
  #
  # 1: variables
  #
! # WHICH determines if you are
! # (0) testing the build binary and headers, or
! # (1) testing the installed binary and headers, or
! # (2) testing under dejagnu (just print the standard flags needed).
  WHICH=$1
! if [ "$WHICH"x = 0x ] && [ $# -eq 3 ]; then
!   echo "running mkcheck"
    echo "$0: testing the build directory"
! elif [ "$WHICH"x = 1x ] && [ $# -eq 4 ]; then
!   echo "running mkcheck"
    echo "$0: testing the install directory $4"
+ elif [ "$WHICH"x = 2x ] && [ $# -eq 3 ]; then
+   true
+ else
+   echo 'Usage: mkcheck 0 (path to build) (path to src)'
+   echo '       mkcheck 1 (path to build) (path to src) (path to install)'
+   echo '       mkcheck 2 (path to build) (path to src)'
+   exit 1;
  fi
  
  BUILD_DIR=$2
*************** if [ $WHICH != "1" ]; then
*** 55,60 ****
--- 58,68 ----
    INC_PATH="@CSHADOWFLAGS@ -I$BUILD_DIR -I$BUILD_DIR/libio -I$SRC_DIR/@ctype_include_dir@ -I$SRC_DIR/@cpu_include_dir@  -I$SRC_DIR/std -I$SRC_DIR -I$SRC_DIR/libio"
  elif [ $WHICH -eq 1 ]; then
    INC_PATH=""
+ fi
+ 
+ if [ $WHICH -eq 2 ]; then
+   echo $INC_PATH -I$SRC_DIR/backward -I$SRC_DIR/ext
+   exit 0;
  fi
  
  #LIB_PATH == where to find the build library binaries.
Index: gcc/testsuite/lib/g++.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/g++.exp,v
retrieving revision 1.8
diff -c -p -r1.8 g++.exp
*** g++.exp	2000/03/08 22:50:54	1.8
--- g++.exp	2000/06/27 05:18:55
*************** proc g++_version { } {
*** 63,68 ****
--- 63,162 ----
  }
  
  #
+ # provide new versions of g++_include_flags and g++_link_flags (both
+ # originally from libgloss.exp) which know about the new gcc tree structure
+ #
+ proc g++_include_flags { args } {
+     global srcdir
+ 
+     if [is_remote host] {
+ 	return ""
+     }
+ 
+     set gccpath [get_multilibs]
+     set libio_dir ""
+     set flags ""
+ 
+     set dir [lookfor_file ${srcdir} libg++]
+     if { ${dir} != "" } {
+ 	append flags "-I${dir} -I${dir}/src "
+     }
+     set odir_v2 [lookfor_file ${gccpath} libstdc++]
+     set sdir_v2 [lookfor_file ${srcdir} libstdc++]
+     if { ${odir_v2} != "" } {
+ 	append flags "-I${sdir_v2} -I${sdir_v2}/stl "
+     }
+     set odir_v3 [lookfor_file ${gccpath} libstdc++-v3]
+     set sdir_v3 [lookfor_file ${srcdir} libstdc++-v3]
+     if { ${odir_v3} != "" } {
+ 	append flags [exec ${odir_v3}/mkcheck 2 ${odir_v3} ${sdir_v3}]
+     }
+ 
+     if { ${odir_v2} != "" && ${odir_v3} != ""} {
+ 	send_error "ERROR: can't handle both libstdc++ and libstdc++-v3 appearing in build tree.\n"
+ 	exit 1	
+     }
+ 
+     return "$flags"
+ }
+ 
+ proc g++_link_flags { args } {
+     global srcdir
+     global ld_library_path
+ 
+     set gccpath [get_multilibs];
+     set libio_dir ""
+     set flags ""
+     set ld_library_path "."
+ 
+     if { $gccpath != "" } {
+ 	if [file exists "${gccpath}/lib/libstdc++.a"] {
+ 	    append ld_library_path ":${gccpath}/lib"
+ 	}
+ 	if [file exists "${gccpath}/libg++/libg++.a"] {
+ 	    append flags "-L${gccpath}/libg++ "
+ 	    append ld_library_path ":${gccpath}/libg++"
+ 	}
+ 	if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
+ 	    append flags "-L${gccpath}/libstdc++ "
+ 	    append ld_library_path ":${gccpath}/libstdc++"
+ 	}
+ 	if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
+ 	    append flags " -L${gccpath}/libstdc++-v3/src/.libs "
+ 	    append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+ 	}
+ 	if [file exists "${gccpath}/libiberty/libiberty.a"] {
+ 	    append flags "-L${gccpath}/libiberty "
+ 	}
+ 	if [file exists "${gccpath}/librx/librx.a"] {
+ 	    append flags "-L${gccpath}/librx "
+ 	}
+     } else {
+ 	global tool_root_dir;
+ 
+ 	set libgpp [lookfor_file ${tool_root_dir} libg++];
+ 	if { $libgpp != "" } {
+ 	    append flags "-L${libgpp} ";
+ 	    append ld_library_path ":${libgpp}"
+ 	}
+ 	set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
+ 	if { $libstdcpp != "" } {
+ 	    append flags "-L${libstdcpp} ";
+ 	    append ld_library_path ":${libstdcpp}"
+ 	}
+ 	set libiberty [lookfor_file ${tool_root_dir} libiberty];
+ 	if { $libiberty != "" } {
+ 	    append flags "-L${libiberty} ";
+ 	}
+ 	set librx [lookfor_file ${tool_root_dir} librx];
+ 	if { $librx != "" } {
+ 	    append flags "-L${librx} ";
+ 	}
+     }
+     return "$flags"
+ }
+ 
+ #
  # g++_init -- called at the start of each subdir of tests
  #
  

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