blob: f507676156b251efdeb6e12309c1bbd6c17cdab8 [file] [log] [blame]
bart22999562008-03-16 07:44:29 +00001#!/bin/sh
2
3# Shell script with one argument (path of an OpenMP executable) that exits
4# with status 0 if the OpenMP test program should be run and that exits with
5# status 1 if the OpenMP test program should not be run.
6
7test -e "$1" || exit $?
8
bartc18e3562008-03-24 09:28:06 +00009./supported_libpthread || exit $?
10
bart82356a82008-07-01 13:16:07 +000011# Do not accept any statically linked executable.
12if /usr/bin/file "$1" | grep -q 'statically linked'; then
13 exit 1
14fi
15
bart22999562008-03-16 07:44:29 +000016if [ "$(uname)" = Linux ]; then
17
18 # Let the dynamic linker/loader print the path of libgomp. See also man ld.so
19 libgomp_path="$(LD_TRACE_LOADED_OBJECTS=1 "$1" \
20 | while read soname arrow path offset; \
21 do if [ "${soname#libgomp.so}" != "${soname}" ]; then echo $path; fi; done)"
22
bart5304e6b2008-03-22 08:08:58 +000023 # Inspect the output of nm. If nm does not find any symbol information,
24 # echo 1. If the symbol gomp_barrier_init is found, echo 0. Otherwise echo
25 # nothing. The second case occurs if gcc has been compiled with
26 # --disable-linux-futex, and the last case occurs if gcc has been compiled
27 # with --enable-linux-futex.
bart8186c852008-03-22 09:36:23 +000028 rc="$(nm "${libgomp_path}" 2>&1 \
bart5304e6b2008-03-22 08:08:58 +000029 |
30 while read line
31 do
32 if [ "${line%: no symbols}" != "${line}" ]; then
33 echo 1
bart8186c852008-03-22 09:36:23 +000034 break
bart5304e6b2008-03-22 08:08:58 +000035 elif [ "${line% gomp_barrier_init}" != "${line}" ]; then
36 echo 0
bart8186c852008-03-22 09:36:23 +000037 break
bart5304e6b2008-03-22 08:08:58 +000038 fi
39 done)"
bart56847ad2008-03-16 10:41:25 +000040 exit ${rc:-1}
bart22999562008-03-16 07:44:29 +000041
42fi