]> gcc.gnu.org Git - gcc.git/blame - libstdc++-v3/tests_flags.in
tests_flags.in: Just output the bare minimum to run tests.
[gcc.git] / libstdc++-v3 / tests_flags.in
CommitLineData
b21218ce
GDR
1#!/bin/sh
2
3#
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
1af7d6cf
GDR
6# the file ./mkcheck.in, which in the long will be removed in favor of a
7# DejaGnu-based framework.
b21218ce
GDR
8#
9# Written by Gabriel Dos Reis <gdr@codesourcery.com>
10#
11
12#
13# Synopsis
14# * tests_flags --compiler build-dir src-dir
15#
16# Returns a space-separated list of flags needed to run front-end
17# specific tests.
18#
19# * tests_flags --built-library build-dir src-dir
20# * tests_flags --installed-library build-dir src-dir install-dir
21#
22# Returns a colon-separated list of space-separated list of flags,
23# needed to run library specific tests,
1af7d6cf 24# BUILD_DIR:SRC_DIR:PREFIX_DIR:CXX:CXXFLAGS:INCLUDES:LIBS
f6b60eb4 25# the meaning of which is as follows:
b21218ce
GDR
26# BUILD_DIR build-dir
27# SRC_DIR src-dir
28# PREFIX_DIR install-dir (meaningful only with --installed-library)
1af7d6cf
GDR
29# CXX which C++ compiler is being used
30# CXXFLAGS special flags to pass to g++
31# INCLUDES paths to headers
b21218ce 32# LIBS flags to pass to the linker
b21218ce
GDR
33#
34
b21218ce
GDR
35##
36## Utility functions
37##
38
39# Print a message saying how this script is intended to be invoked
40print_usage() {
41 cat <<EOF
42Usage:
fb34ebc5 43 tests_flags --compiler <build-dir> <src-dir>
b21218ce
GDR
44 --built-library <build-dir> <src-dir>
45 --installed-library <build-dir> <src-dir> <install-dir>
46EOF
47 exit 1
48}
49
50# Check for command line option
51check_options() {
52 # First, check for number of command line arguments
53 if [ \( $1 -ne 3 \) -a \( $1 -ne 4 \) ]; then
54 print_usage;
55 fi
56
57 # Then, see if we understand the job we're asked for
58 case $2 in
59 --compiler|--built-library|--installed-library)
60 # OK
61 ;;
62 *)
63 print_usage
64 ;;
65 esac
66}
67
68# Directory sanity check
69check_directory() {
b2fb4914 70 if [ ! -d $2 ]; then
b21218ce
GDR
71 echo "$1 '$2' directory not found, exiting."
72 exit 1
73 fi
74}
75
76##
77## Main processing
78##
79
80# Command line options sanity check
81check_options $# $1
82
83query=$1
84
85# Check for build, source and install directories
86BUILD_DIR=$2; SRC_DIR=$3
87check_directory 'Build' ${BUILD_DIR}
88check_directory 'Source' ${SRC_DIR}
89case ${query} in
90 --installed-library)
91 PREFIX_DIR=$4
56f8f4fb 92 check_directory 'Install' ${PREFIX_DIR}
b21218ce
GDR
93 ;;
94 *)
95 PREFIX_DIR=
96 ;;
97esac
98
b21218ce 99# Compute include paths
1af7d6cf 100# INCLUDES == include path to new headers for use on gcc command-line
b21218ce
GDR
101top_srcdir=@top_srcdir@
102C_DIR="`basename @C_INCLUDE_DIR@`"
103case ${query} in
104 --installed-library)
1af7d6cf 105 INCLUDES="-I${SRC_DIR}/testsuite"
b21218ce
GDR
106 ;;
107 *)
1af7d6cf 108 INCLUDES="-nostdinc++ @CSHADOW_FLAGS@ -I${BUILD_DIR}/include
b21218ce
GDR
109 -I${SRC_DIR}/include/std -I${SRC_DIR}/include/$C_DIR
110 -I${SRC_DIR}/include -I${SRC_DIR}/libsupc++ -I${SRC_DIR}/libio
111 -I${SRC_DIR}/testsuite"
112 ;;
113esac
114
1af7d6cf 115# If called for compiler tests, just output appropriate include paths
b21218ce
GDR
116case ${query} in
117 --compiler)
1af7d6cf 118 echo ${INCLUDES} -I${SRC_DIR}/include/backward -I${SRC_DIR}/include/ext
b21218ce
GDR
119 exit 0
120 ;;
121esac
122
123# For built or installed libraries, we need to get right OS-specific bits.
124. ${top_srcdir}/configure.target
125
126# LIB_PATH == where to find the build libraries for libtool's use
1af7d6cf 127# CXX == the full pathname of the compiler
b21218ce
GDR
128case ${query} in
129 --built-library)
130 LIB_PATH=${BUILD_DIR}/src
1af7d6cf 131 CXX="${BUILD_DIR}/../../gcc/g++"
b21218ce
GDR
132 ;;
133 --installed-library)
134 LIB_PATH=${PREFIX_DIR}/lib
135 CXX=${PREFIX_DIR}/bin/g++
136 ;;
137esac
138
139# gcc compiler flags (maybe use glibcpp_cxxflags from configure.target,
140# but thst's really meant for building the library itself, not using it)
141CXXFLAGS="-ggdb3 -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@"
142
b21218ce
GDR
143# LIBS == any extra needed -l switches, etc (may need more libs, lose lose)
144case ${query} in
145 --built-library)
1af7d6cf
GDR
146 LIBS="${LIB_PATH}/../libsupc++/libsupc++.la ${LIB_PATH}/libstdc++.la
147 -no-install"
fb34ebc5 148 case @target_os@ in
1af7d6cf 149 *cygwin*) LIBS="${LIBS} -nodefaultlibs -lgcc -lcygwin -luser32
fb34ebc5 150 -lkernel32 -ladvapi32 -lshell32" ;;
1af7d6cf 151 *) LIBS="${LIBS} -nodefaultlibs -lc -lgcc -lc" ;;
fb34ebc5 152 esac
b21218ce
GDR
153 ;;
154 --installed-library)
1af7d6cf
GDR
155 LIBS="-L${LIB_PATH} ${LIB_PATH}/libstdc++.la -no-install
156 -rpath ${LIB_PATH}"
b21218ce
GDR
157 ;;
158esac
159
1af7d6cf 160echo -n ${BUILD_DIR}:${SRC_DIR}:${PREFIX_DIR}:${CXX}:${CXXFLAGS}:${INCLUDES}:${LIBS}
b21218ce 161exit 0
This page took 0.075293 seconds and 5 git commands to generate.