2000-11-26 20:20:50 +08: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 08:55:09 +08:00
|
|
|
# the file ./mkcheck.in, which in the long will be removed in favor of a
|
|
|
|
# DejaGnu-based framework.
|
2000-11-26 20:20:50 +08: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 08:55:09 +08:00
|
|
|
# BUILD_DIR:SRC_DIR:PREFIX_DIR:CXX:CXXFLAGS:INCLUDES:LIBS
|
2000-11-27 18:01:52 +08:00
|
|
|
# the meaning of which is as follows:
|
2001-02-23 15:12:03 +08:00
|
|
|
# BUILD_DIR libstdc++-v3 build-dir
|
|
|
|
# SRC_DIR libstdc++-v3 src-dir
|
2000-11-26 20:20:50 +08:00
|
|
|
# PREFIX_DIR install-dir (meaningful only with --installed-library)
|
2001-01-20 08:55:09 +08:00
|
|
|
# CXX which C++ compiler is being used
|
|
|
|
# CXXFLAGS special flags to pass to g++
|
|
|
|
# INCLUDES paths to headers
|
2000-11-26 20:20:50 +08: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 07:14:43 +08:00
|
|
|
tests_flags --compiler <build-dir> <src-dir>
|
2000-11-26 20:20:50 +08: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 10:48:08 +08:00
|
|
|
if [ ! -d $2 ]; then
|
2000-11-26 20:20:50 +08: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)
|
|
|
|
PREFIX_DIR=$4
|
2000-11-29 11:57:35 +08:00
|
|
|
check_directory 'Install' ${PREFIX_DIR}
|
2000-11-26 20:20:50 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PREFIX_DIR=
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Compute include paths
|
2001-01-20 08:55:09 +08:00
|
|
|
# INCLUDES == include path to new headers for use on gcc command-line
|
2000-11-26 20:20:50 +08:00
|
|
|
C_DIR="`basename @C_INCLUDE_DIR@`"
|
|
|
|
case ${query} in
|
|
|
|
--installed-library)
|
2001-01-20 08:55:09 +08:00
|
|
|
INCLUDES="-I${SRC_DIR}/testsuite"
|
2000-11-26 20:20:50 +08:00
|
|
|
;;
|
|
|
|
*)
|
2001-01-20 08:55:09 +08:00
|
|
|
INCLUDES="-nostdinc++ @CSHADOW_FLAGS@ -I${BUILD_DIR}/include
|
2000-11-26 20:20:50 +08:00
|
|
|
-I${SRC_DIR}/include/std -I${SRC_DIR}/include/$C_DIR
|
|
|
|
-I${SRC_DIR}/include -I${SRC_DIR}/libsupc++ -I${SRC_DIR}/libio
|
|
|
|
-I${SRC_DIR}/testsuite"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2001-01-20 08:55:09 +08:00
|
|
|
# If called for compiler tests, just output appropriate include paths
|
2000-11-26 20:20:50 +08:00
|
|
|
case ${query} in
|
|
|
|
--compiler)
|
2001-01-20 08:55:09 +08:00
|
|
|
echo ${INCLUDES} -I${SRC_DIR}/include/backward -I${SRC_DIR}/include/ext
|
2000-11-26 20:20:50 +08:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# For built or installed libraries, we need to get right OS-specific bits.
|
2001-01-25 12:09:22 +08:00
|
|
|
. ${SRC_DIR}/configure.target
|
2000-11-26 20:20:50 +08:00
|
|
|
|
2001-02-23 15:12:03 +08: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-01-20 08:55:09 +08:00
|
|
|
# CXX == the full pathname of the compiler
|
2000-11-26 20:20:50 +08:00
|
|
|
case ${query} in
|
|
|
|
--built-library)
|
|
|
|
LIB_PATH=${BUILD_DIR}/src
|
2001-02-23 15:12:03 +08:00
|
|
|
GCC_LIB_PATH=${BUILD_DIR}/../../gcc
|
2001-01-20 08:55:09 +08:00
|
|
|
CXX="${BUILD_DIR}/../../gcc/g++"
|
2000-11-26 20:20:50 +08:00
|
|
|
;;
|
|
|
|
--installed-library)
|
|
|
|
LIB_PATH=${PREFIX_DIR}/lib
|
|
|
|
CXX=${PREFIX_DIR}/bin/g++
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# gcc compiler flags (maybe use glibcpp_cxxflags from configure.target,
|
|
|
|
# but thst's really meant for building the library itself, not using it)
|
|
|
|
CXXFLAGS="-ggdb3 -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@"
|
|
|
|
|
|
|
|
# LIBS == any extra needed -l switches, etc (may need more libs, lose lose)
|
|
|
|
case ${query} in
|
|
|
|
--built-library)
|
2001-01-20 08:55:09 +08:00
|
|
|
LIBS="${LIB_PATH}/../libsupc++/libsupc++.la ${LIB_PATH}/libstdc++.la
|
2001-02-23 15:12:03 +08:00
|
|
|
-no-install -rpath ${GCC_LIB_PATH}"
|
2001-01-02 07:14:43 +08:00
|
|
|
case @target_os@ in
|
2001-01-20 08:55:09 +08:00
|
|
|
*cygwin*) LIBS="${LIBS} -nodefaultlibs -lgcc -lcygwin -luser32
|
2001-01-02 07:14:43 +08:00
|
|
|
-lkernel32 -ladvapi32 -lshell32" ;;
|
2001-01-20 08:55:09 +08:00
|
|
|
*) LIBS="${LIBS} -nodefaultlibs -lc -lgcc -lc" ;;
|
2001-01-02 07:14:43 +08:00
|
|
|
esac
|
2000-11-26 20:20:50 +08:00
|
|
|
;;
|
|
|
|
--installed-library)
|
2001-01-20 08:55:09 +08:00
|
|
|
LIBS="-L${LIB_PATH} ${LIB_PATH}/libstdc++.la -no-install
|
|
|
|
-rpath ${LIB_PATH}"
|
2000-11-26 20:20:50 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2001-02-22 05:58:20 +08:00
|
|
|
echo ${BUILD_DIR}:${SRC_DIR}:${PREFIX_DIR}:${CXX}:${CXXFLAGS}:${INCLUDES}:${LIBS}
|
2000-11-26 20:20:50 +08:00
|
|
|
exit 0
|