Avoid unnecessary dependencies on COND_EXEC insns.
[official-gcc.git] / libstdc++-v3 / tests_flags.in
blob2e2e59b983d17f4d9b5ee300d05b0950e709ddfa
1 #!/bin/sh
4 # This script computes the various flags needed to run GNU C++ testsuites
5 # (compiler specific as well as library specific). It is based on
6 # the ./mkcheck.in, which in the long will be removed in favor of a
7 # DejaGnu-base framework.
9 # Written by Gabriel Dos Reis <gdr@codesourcery.com>
13 # Synopsis
14 # * tests_flags --compiler build-dir src-dir
16 # Returns a space-separated list of flags needed to run front-end
17 # specific tests.
19 # * tests_flags --built-library build-dir src-dir
20 # * tests_flags --installed-library build-dir src-dir install-dir
22 # Returns a colon-separated list of space-separated list of flags,
23 # needed to run library specific tests,
24 # BUILD_DIR:SRC_DIR:PREFIX_DIR:LTCXX:LIBS:LTEXE:CXX:CXXFLAGS
25 # the meaning of which is as follows:
26 # BUILD_DIR build-dir
27 # SRC_DIR src-dir
28 # PREFIX_DIR install-dir (meaningful only with --installed-library)
29 # LTCXX libtoolized command to compile a C++ program
30 # LIBS flags to pass to the linker
31 # LTEXE libtoolized command to run a compiled C++ program
32 # CXX which C++ compiler is being used
33 # CXXFLAGS special C++ flags used
37 ## Utility functions
40 # Print a message saying how this script is intended to be invoked
41 print_usage() {
42 cat <<EOF
43 Usage:
44 tests_fags --compiler <build-dir> <src-dir>
45 --built-library <build-dir> <src-dir>
46 --installed-library <build-dir> <src-dir> <install-dir>
47 EOF
48 exit 1
51 # Check for command line option
52 check_options() {
53 # First, check for number of command line arguments
54 if [ \( $1 -ne 3 \) -a \( $1 -ne 4 \) ]; then
55 print_usage;
58 # Then, see if we understand the job we're asked for
59 case $2 in
60 --compiler|--built-library|--installed-library)
61 # OK
63 *)
64 print_usage
66 esac
69 # Directory sanity check
70 check_directory() {
71 if [ ! $2 ]; then
72 echo "$1 '$2' directory not found, exiting."
73 exit 1
78 ## Main processing
81 # Command line options sanity check
82 check_options $# $1
84 query=$1
86 # Check for build, source and install directories
87 BUILD_DIR=$2; SRC_DIR=$3
88 check_directory 'Build' ${BUILD_DIR}
89 check_directory 'Source' ${SRC_DIR}
90 case ${query} in
91 --installed-library)
92 PREFIX_DIR=$4
93 check_directory 'Install' ${PREFIX_DIR}
96 PREFIX_DIR=
98 esac
100 # This is LIBTOOL=@LIBTOOL@ piped through a bit of sanity that we can
101 # assume for this script (by the time we run this).
102 LIBTOOL="${BUILD_DIR}/libtool"
103 chmod u+x ${LIBTOOL}
105 # Compute include paths
106 # INC_PATH == include path to new headers for use on gcc command-line
107 top_srcdir=@top_srcdir@
108 C_DIR="`basename @C_INCLUDE_DIR@`"
109 case ${query} in
110 --installed-library)
111 INC_PATH="-I${SRC_DIR}/testsuite"
114 INC_PATH="-nostdinc++ @CSHADOW_FLAGS@ -I${BUILD_DIR}/include
115 -I${SRC_DIR}/include/std -I${SRC_DIR}/include/$C_DIR
116 -I${SRC_DIR}/include -I${SRC_DIR}/libsupc++ -I${SRC_DIR}/libio
117 -I${SRC_DIR}/testsuite"
119 esac
121 # If called for compiler tests, just output include paths
122 case ${query} in
123 --compiler)
124 echo ${INC_PATH} -I${SRC_DIR}/include/backward -I${SRC_DIR}/include/ext
125 exit 0
127 esac
129 # For built or installed libraries, we need to get right OS-specific bits.
130 . ${top_srcdir}/configure.target
132 # LIB_PATH == where to find the build libraries for libtool's use
133 # CXX == how to call the compiler
134 case ${query} in
135 --built-library)
136 LIB_PATH=${BUILD_DIR}/src
137 CXX="${BUILD_DIR}/../../gcc/g++ -B${BUILD_DIR}/../../gcc/"
139 --installed-library)
140 LIB_PATH=${PREFIX_DIR}/lib
141 CXX=${PREFIX_DIR}/bin/g++
143 esac
145 # gcc compiler flags (maybe use glibcpp_cxxflags from configure.target,
146 # but thst's really meant for building the library itself, not using it)
147 CXXFLAGS="-ggdb3 -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@"
149 # LTCXX == how to call libtool when creating an executable
150 # LIBS == any extra needed -l switches, etc (may need more libs, lose lose)
151 case ${query} in
152 --built-library)
153 LTCXX="${LIBTOOL} --tag=CXX --mode=link ${CXX} ${CXXFLAGS} ${INC_PATH}
154 ${LIB_PATH}/../libsupc++/libsupc++.la ${LIB_PATH}/libstdc++.la
155 -no-install"
156 LTEXE="${LIBTOOL} --mode=execute"
157 LIBS="-nodefaultlibs -lc -lgcc -lc"
159 --installed-library)
160 # For the installed version, we really only need to use libtool and
161 # the .la file to get correct rpaths.
162 LTCXX="${LIBTOOL} --tag=CXX --mode=link ${CXX} ${CXXFLAGS} ${INC_PATH}
163 -L${LIB_PATH} ${LIB_PATH}/libstdc++.la -no-install
164 -rpath ${LIB_PATH}"
165 LTEXE="${LIBTOOL} --mode=execute"
166 LIBS=
168 esac
170 echo ${BUILD_DIR}:${SRC_DIR}:${PREFIX_DIR}:${LTCXX}:${LIBS}:${LTEXE}:${CXX}:${CXXFLAGS}
171 exit 0