OSDN Git Service

* ada/acats/run_acats (which): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / ada / acats / run_acats
1 #!/bin/sh
2
3 if [ "$testdir" = "" ]; then
4    echo You must use make check or make check-ada
5    exit 1
6 fi
7
8 # Provide which replacement.
9 #
10 # type -p is missing from Solaris 2 /bin/sh and /bin/ksh (ksh88), but both
11 # ksh93 and bash have it.
12 # type output format differs between ksh88 and ksh93, so avoid it if
13 # type -p is present.
14 # Fall back to whence which ksh88 and ksh93 provide, but bash does not.
15
16 which () {
17     type -p $* 2>/dev/null && return 0
18     type $* 2>/dev/null | awk '{print $3}' && return 0
19     whence $* 2>/dev/null && return 0
20     return 1
21 }
22
23 # Set up environment to use the Ada compiler from the object tree
24
25 host_gnatchop=`which gnatchop`
26 host_gnatmake=`which gnatmake`
27 ROOT=`${PWDCMD-pwd}`
28 BASE=`cd $ROOT/../../..; ${PWDCMD-pwd}`
29
30 PATH=$BASE:$ROOT:$PATH
31 ADA_INCLUDE_PATH=$BASE/ada/rts
32 LD_LIBRARY_PATH=$ADA_INCLUDE_PATH:$BASE:$LD_LIBRARY_PATH
33 ADA_OBJECTS_PATH=$ADA_INCLUDE_PATH
34
35 if [ ! -d $ADA_INCLUDE_PATH ]; then
36    echo gnatlib missing, exiting.
37    exit 1
38 fi
39
40 if [ ! -f $BASE/gnatchop ]; then
41    echo gnattools missing, exiting.
42    exit 1
43 fi
44
45 if [ ! -f $BASE/gnatmake ]; then
46    echo gnattools missing, exiting.
47    exit 1
48 fi
49
50 GCC_DRIVER="$BASE/xgcc"
51 GCC="$BASE/xgcc -B$BASE/"
52 export PATH ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_DRIVER GCC LD_LIBRARY_PATH
53
54 echo '#!/bin/sh' > host_gnatchop
55 echo PATH=`dirname $host_gnatchop`:'$PATH' >> host_gnatchop
56 echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatchop
57 echo export PATH >> host_gnatchop
58 echo exec gnatchop '"$@"' >> host_gnatchop
59
60 chmod +x host_gnatchop
61
62 echo '#!/bin/sh' > host_gnatmake
63 echo PATH=`dirname $host_gnatmake`:'$PATH' >> host_gnatmake
64 echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatmake
65 echo export PATH >> host_gnatmake
66 echo exec gnatmake '"$@"' >> host_gnatmake
67
68 chmod +x host_gnatmake
69
70 # Limit the stack to 16MB for stack checking
71 ulimit -s 16384
72
73 exec $SHELL $testdir/run_all.sh ${1+"$@"}