1#! /bin/sh
2# script to set mcpp testsuite corresponding to the version of GCC 2 or 3, 4
3# ./set_test.sh $CC $gcc_path $gcc_testsuite_dir $gcc_maj_ver $LN_S $cpp_call
4#       $target_cc
5
6CC=$1
7gcc_path=`expr $2 : "\(.*\)/$CC"`
8target_cc=$7
9if test x$target_cc != x; then
10    CC=$target_cc
11fi
12gcc_testsuite_dir=$3
13gcc_maj_ver=$4
14if test $gcc_maj_ver = 4; then
15    gcc_maj_ver=3;
16fi
17LN_S=$5
18cpp_name=`echo $6 | sed 's,.*/,,'`
19cpp_path=`echo $6 | sed "s,/$cpp_name,,"`
20
21echo "  cd $gcc_testsuite_dir/gcc.dg/cpp-test/test-t"
22cd "$gcc_testsuite_dir/gcc.dg/cpp-test/test-t"
23for i in *_run.c
24do
25    rm -f $i
26    echo "  $LN_S $i.gcc$gcc_maj_ver $i"
27    $LN_S $i.gcc$gcc_maj_ver $i
28done
29
30echo "  cd $cpp_path"
31cd "$cpp_path"
32echo "  appending '-23j' options to mcpp invocation"
33for i in mcpp*.sh
34do
35    cat $i | sed 's/mcpp/mcpp -23j/' > tmp
36    mv -f tmp $i
37    chmod a+x $i
38done
39
40if test $CC = gcc; then
41    exit 0
42fi
43
44echo "  cd $gcc_path"
45cd "$gcc_path"
46if test -f "gcc"; then
47    echo "  mv gcc gcc.save"
48    mv gcc gcc.save
49fi
50echo "  $LN_S $CC gcc"
51$LN_S $CC gcc
52
53