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).
6#
7# Written by Benjamin Kosnik <bkoz@redhat.com>
8#            Gabriel Dos Reis <gdr@codesourcery.com>
9#
10
11# Print a message saying how this script is intended to be invoked
12print_usage() {
13    cat <<EOF
14Usage: 
15    testsuite_flags --install-includes
16		    --build-includes
17		    --build-cxx
18		    --build-cc
19		    --install-cxx
20		    --cxxflags
21		    --cxxldflags
22		    --cxxpchflags
23		    --cxxvtvflags
24
25EOF
26}
27
28# Establish configure-generated directory structure.
29BUILD_DIR=@glibcxx_builddir@
30SRC_DIR=@glibcxx_srcdir@
31PREFIX_DIR=@glibcxx_prefixdir@
32query=$1
33
34case ${query} in
35    --install-includes)
36      INCLUDES="-I${SRC_DIR}/testsuite/util"
37      echo ${INCLUDES}
38      ;;
39    --build-includes)
40      INCLUDES="-nostdinc++ @GLIBCXX_INCLUDES@
41                -I${SRC_DIR}/include/backward -I${SRC_DIR}/testsuite/util"
42      echo ${INCLUDES}
43      ;;
44    --install-cxx)
45      CXX=${PREFIX_DIR}/bin/g++
46      echo ${CXX}
47      ;;
48    --build-cxx)
49      CXX_build="@CXX@"
50      CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/xg++ ,'`
51      echo ${CXX}
52      ;;
53    --build-cc)
54      CC_build="@CC@"
55      CC="$CC_build"
56      echo ${CC}
57      ;;
58    --cxxflags)
59      CXXFLAGS_default="-D_GLIBCXX_ASSERT -fmessage-length=0"
60      CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@"
61      echo ${CXXFLAGS_default} ${CXXFLAGS_config}
62      ;;
63    --cxxvtvflags)
64      CXXFLAGS_vtv="@VTV_CXXFLAGS@"
65      LDFLAGS_vtv="@VTV_CXXLINKFLAGS@"
66      echo ${CXXFLAGS_vtv} ${LDFLAGS_vtv}
67      ;;
68    --cxxparallelflags)
69      CXXFLAGS_parallel="-D_GLIBCXX_PARALLEL -fopenmp
70			 -B${BUILD_DIR}/../libgomp
71                         -I${BUILD_DIR}/../libgomp
72			 -L${BUILD_DIR}/../libgomp/.libs -lgomp"
73      echo ${CXXFLAGS_parallel}
74      ;;
75    --cxxpchflags)
76      PCHFLAGS="@glibcxx_PCHFLAGS@"
77      echo ${PCHFLAGS}
78      ;;
79    --cxxldflags)
80      SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@"
81      echo ${SECTIONLDFLAGS}
82      ;;
83    *)
84      print_usage
85      ;;
86esac
87
88exit 0
89