2000-11-26 13:20:50 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# This script computes the various flags needed to run GNU C++ testsuites
|
|
|
|
# (compiler specific as well as library specific). It is based on
|
2001-01-20 01:55:09 +01:00
|
|
|
# the file ./mkcheck.in, which in the long will be removed in favor of a
|
|
|
|
# DejaGnu-based framework.
|
2000-11-26 13:20:50 +01:00
|
|
|
#
|
|
|
|
# Written by Gabriel Dos Reis <gdr@codesourcery.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Synopsis
|
|
|
|
# * tests_flags --compiler build-dir src-dir
|
|
|
|
#
|
|
|
|
# Returns a space-separated list of flags needed to run front-end
|
|
|
|
# specific tests.
|
|
|
|
#
|
|
|
|
# * tests_flags --built-library build-dir src-dir
|
|
|
|
# * tests_flags --installed-library build-dir src-dir install-dir
|
|
|
|
#
|
|
|
|
# Returns a colon-separated list of space-separated list of flags,
|
|
|
|
# needed to run library specific tests,
|
2001-01-20 01:55:09 +01:00
|
|
|
# BUILD_DIR:SRC_DIR:PREFIX_DIR:CXX:CXXFLAGS:INCLUDES:LIBS
|
2000-11-27 11:01:52 +01:00
|
|
|
# the meaning of which is as follows:
|
2001-02-23 08:12:03 +01:00
|
|
|
# BUILD_DIR libstdc++-v3 build-dir
|
|
|
|
# SRC_DIR libstdc++-v3 src-dir
|
2000-11-26 13:20:50 +01:00
|
|
|
# PREFIX_DIR install-dir (meaningful only with --installed-library)
|
2001-01-20 01:55:09 +01:00
|
|
|
# CXX which C++ compiler is being used
|
|
|
|
# CXXFLAGS special flags to pass to g++
|
|
|
|
# INCLUDES paths to headers
|
2000-11-26 13:20:50 +01:00
|
|
|
# LIBS flags to pass to the linker
|
|
|
|
#
|
|
|
|
|
|
|
|
##
|
|
|
|
## Utility functions
|
|
|
|
##
|
|
|
|
|
|
|
|
# Print a message saying how this script is intended to be invoked
|
|
|
|
print_usage() {
|
|
|
|
cat <<EOF
|
|
|
|
Usage:
|
2001-01-02 00:14:43 +01:00
|
|
|
tests_flags --compiler <build-dir> <src-dir>
|
2000-11-26 13:20:50 +01:00
|
|
|
--built-library <build-dir> <src-dir>
|
|
|
|
--installed-library <build-dir> <src-dir> <install-dir>
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check for command line option
|
|
|
|
check_options() {
|
|
|
|
# First, check for number of command line arguments
|
|
|
|
if [ \( $1 -ne 3 \) -a \( $1 -ne 4 \) ]; then
|
|
|
|
print_usage;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Then, see if we understand the job we're asked for
|
|
|
|
case $2 in
|
|
|
|
--compiler|--built-library|--installed-library)
|
|
|
|
# OK
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
print_usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# Directory sanity check
|
|
|
|
check_directory() {
|
2001-01-10 03:48:08 +01:00
|
|
|
if [ ! -d $2 ]; then
|
2000-11-26 13:20:50 +01:00
|
|
|
echo "$1 '$2' directory not found, exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
## Main processing
|
|
|
|
##
|
|
|
|
|
|
|
|
# Command line options sanity check
|
|
|
|
check_options $# $1
|
|
|
|
|
|
|
|
query=$1
|
|
|
|
|
|
|
|
# Check for build, source and install directories
|
|
|
|
BUILD_DIR=$2; SRC_DIR=$3
|
|
|
|
check_directory 'Build' ${BUILD_DIR}
|
|
|
|
check_directory 'Source' ${SRC_DIR}
|
|
|
|
case ${query} in
|
|
|
|
--installed-library)
|
2001-03-27 21:17:16 +02:00
|
|
|
PREFIX_DIR=$4
|
|
|
|
check_directory 'Install' ${PREFIX_DIR}
|
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
*)
|
2001-03-27 21:17:16 +02:00
|
|
|
PREFIX_DIR=
|
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Compute include paths
|
2001-01-20 01:55:09 +01:00
|
|
|
# INCLUDES == include path to new headers for use on gcc command-line
|
2000-11-26 13:20:50 +01:00
|
|
|
C_DIR="`basename @C_INCLUDE_DIR@`"
|
|
|
|
case ${query} in
|
|
|
|
--installed-library)
|
2001-03-27 21:17:16 +02:00
|
|
|
INCLUDES="-I${SRC_DIR}/testsuite"
|
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
*)
|
2001-03-27 21:17:16 +02:00
|
|
|
INCLUDES="-nostdinc++ -I${BUILD_DIR}/include -I${SRC_DIR}/include
|
|
|
|
-I${SRC_DIR}/include/std -I${SRC_DIR}/include/$C_DIR
|
|
|
|
-I${SRC_DIR}/libsupc++ -I${SRC_DIR}/libio
|
|
|
|
-I${SRC_DIR}/testsuite"
|
2001-03-30 10:14:15 +02:00
|
|
|
if test x@xcompiling@ == x1; then
|
|
|
|
INCLUDES="${INCLUDES} -I${SRC_DIR}/../newlib/libc/include"
|
|
|
|
fi
|
2001-03-27 21:17:16 +02:00
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
esac
|
|
|
|
|
2001-01-20 01:55:09 +01:00
|
|
|
# If called for compiler tests, just output appropriate include paths
|
2000-11-26 13:20:50 +01:00
|
|
|
case ${query} in
|
|
|
|
--compiler)
|
2001-03-27 21:17:16 +02:00
|
|
|
echo ${INCLUDES} -I${SRC_DIR}/include/backward -I${SRC_DIR}/include/ext
|
|
|
|
exit 0
|
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
# For built or installed libraries, we need to get right OS-specific bits.
|
2001-01-25 05:09:22 +01:00
|
|
|
. ${SRC_DIR}/configure.target
|
2000-11-26 13:20:50 +01:00
|
|
|
|
2001-02-23 08:12:03 +01:00
|
|
|
# LIB_PATH == where to find the C++ build libraries for libtool's use
|
|
|
|
# GCC_LIB_PATH == where to find the gcc build libraries for libtool's use
|
2001-03-30 10:14:15 +02:00
|
|
|
# CXX == how to invoke the compiler
|
2000-11-26 13:20:50 +01:00
|
|
|
case ${query} in
|
|
|
|
--built-library)
|
2001-03-27 21:17:16 +02:00
|
|
|
LIB_PATH=${BUILD_DIR}/src
|
|
|
|
GCC_LIB_PATH=${BUILD_DIR}/../../gcc
|
2001-03-30 10:14:15 +02:00
|
|
|
CXX="${BUILD_DIR}/../../gcc/g++ -B${BUILD_DIR}/../../gcc/"
|
2001-03-27 21:17:16 +02:00
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
--installed-library)
|
2001-03-27 21:17:16 +02:00
|
|
|
LIB_PATH=${PREFIX_DIR}/lib
|
|
|
|
GCC_LIB_PATH=
|
|
|
|
CXX=${PREFIX_DIR}/bin/g++
|
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
esac
|
|
|
|
|
2001-03-30 10:14:15 +02:00
|
|
|
# CXXFLAGS == run the testsuite with any special configuration
|
|
|
|
# flags from the library build.
|
2000-11-26 13:20:50 +01:00
|
|
|
CXXFLAGS="-ggdb3 -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@"
|
|
|
|
|
2001-03-30 10:14:15 +02:00
|
|
|
# LIBS == any extra may needed -L switches
|
2000-11-26 13:20:50 +01:00
|
|
|
case ${query} in
|
|
|
|
--built-library)
|
2001-03-27 21:17:16 +02:00
|
|
|
LIBS="${LIB_PATH}/libstdc++.la -no-install -rpath ${GCC_LIB_PATH}"
|
2001-01-02 00:14:43 +01:00
|
|
|
case @target_os@ in
|
2001-03-27 21:17:16 +02:00
|
|
|
*cygwin*)
|
|
|
|
LIBS="${LIBS} -nodefaultlibs -lgcc -lcygwin -luser32
|
|
|
|
-lkernel32 -ladvapi32 -lshell32"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LIBS="${LIBS} -nodefaultlibs -lgcc -lc -lgcc"
|
|
|
|
;;
|
2001-01-02 00:14:43 +01:00
|
|
|
esac
|
2000-11-26 13:20:50 +01:00
|
|
|
;;
|
|
|
|
--installed-library)
|
2001-03-30 23:59:12 +02:00
|
|
|
LIBS="${LIB_PATH}/libstdc++.la -no-install -rpath ${LIB_PATH}"
|
2001-03-27 21:17:16 +02:00
|
|
|
;;
|
2000-11-26 13:20:50 +01:00
|
|
|
esac
|
|
|
|
|
2001-02-21 22:58:20 +01:00
|
|
|
echo ${BUILD_DIR}:${SRC_DIR}:${PREFIX_DIR}:${CXX}:${CXXFLAGS}:${INCLUDES}:${LIBS}
|
2000-11-26 13:20:50 +01:00
|
|
|
exit 0
|