Clean up configure/build longstanding issues.
[platform/upstream/gcc.git] / libstdc++-v3 / mkcheck.in
index a597e2b..b716a14 100755 (executable)
@@ -8,28 +8,31 @@
 # 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"
+# mkcheck [012] (path to build) (path to src) (path to install)
 
 #
 # 1: variables
 #
-# WHICH determines if you are testing the installed binary and headers, or
-# the build binary and headers.
+# 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 != "1" ]; then
-  WHICH=0
+if [ "$WHICH"x = 0x ] && [ $# -eq 3 ]; then
+  echo "running mkcheck"
   echo "$0: testing the build directory"
-elif [ $WHICH -eq 1 ]; then
+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 [ ! -d "$BUILD_DIR" ]; then
   echo "build directory $BUILD_DIR not found, exiting."
@@ -57,19 +60,26 @@ 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.
 if [ $WHICH != "1" ]; then
   LIB_PATH="$BUILD_DIR/src/.libs"
-  CXX="../../gcc/g++ -B../../gcc/"
+  CXX="../../gcc/g++"
+  CXX_BASE="-B../../gcc/"
 elif [ $WHICH -eq 1 ]; then
   LIB_PATH="$PREFIX_DIR/lib"
   CXX="$PREFIX_DIR/bin/g++"
+  CXX_BASE=""
 fi
 
 # gcc compiler flags
 #CXX_FLAG="-fsquangle -fhonor-std -fnew-exceptions -g -O2 -DDEBUG_ASSERT "
 #CXX_FLAG="-g -O2 -DDEBUG_ASSERT "
-CXX_FLAG="-g -DDEBUG_ASSERT "
+CXX_FLAG="-g $CXX_BASE -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@"
 
 # a specific flag(s) to force the use of shared libraries, if any
 SH_FLAG=""
@@ -133,10 +143,12 @@ rm -rf ./*core
 # Copy over the data files for filebufs in read-only mode
 cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR
 cp $SRC_DIR/testsuite/27_io/*.tst $TEST_DIR
+chmod u+w $TEST_DIR/*.txt
+chmod u+w $TEST_DIR/*.tst
 
 # Emit useful info about compiler and platform
 echo "host: $(uname -mrsv)" >> $RESULTS_FILE
-echo "compiler: $($CXX --version)" >> $RESULTS_FILE
+echo "compiler: $($CXX -v 2>&1 | tail -1)" >> $RESULTS_FILE
 echo "compiler flags: $CXX_FLAG" >> $RESULTS_FILE
 echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE
 echo "" >> $RESULTS_FILE