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>
14 # * tests_flags --compiler build-dir src-dir
16 # Returns a space-separated list of flags needed to run front-end
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:
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
40 # Print a message saying how this script is intended to be invoked
44 tests_fags --compiler <build-dir> <src-dir>
45 --built-library <build-dir> <src-dir>
46 --installed-library <build-dir> <src-dir> <install-dir>
51 # Check for command line option
53 # First, check for number of command line arguments
54 if [ \
( $1 -ne 3 \
) -a \
( $1 -ne 4 \
) ]; then
58 # Then, see if we understand the job we're asked for
60 --compiler|
--built-library|
--installed-library)
69 # Directory sanity check
72 echo "$1 '$2' directory not found, exiting."
81 # Command line options sanity check
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}
93 check_directory
'Install' ${PREFIX_DIR}
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"
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@`"
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"
121 # If called for compiler tests, just output include paths
124 echo ${INC_PATH} -I${SRC_DIR}/include/backward -I${SRC_DIR}/include
/ext
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
136 LIB_PATH
=${BUILD_DIR}/src
137 CXX
="${BUILD_DIR}/../../gcc/g++ -B${BUILD_DIR}/../../gcc/"
140 LIB_PATH
=${PREFIX_DIR}/lib
141 CXX
=${PREFIX_DIR}/bin
/g
++
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)
153 LTCXX
="${LIBTOOL} --tag=CXX --mode=link ${CXX} ${CXXFLAGS} ${INC_PATH}
154 ${LIB_PATH}/../libsupc++/libsupc++.la ${LIB_PATH}/libstdc++.la
156 LTEXE
="${LIBTOOL} --mode=execute"
157 LIBS
="-nodefaultlibs -lc -lgcc -lc"
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
165 LTEXE
="${LIBTOOL} --mode=execute"
170 echo ${BUILD_DIR}:${SRC_DIR}:${PREFIX_DIR}:${LTCXX}:${LIBS}:${LTEXE}:${CXX}:${CXXFLAGS}