bart | 2299956 | 2008-03-16 07:44:29 +0000 | [diff] [blame] | 1 | #!/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 | |
| 7 | test -e "$1" || exit $? |
| 8 | |
bart | c18e356 | 2008-03-24 09:28:06 +0000 | [diff] [blame] | 9 | ./supported_libpthread || exit $? |
| 10 | |
bart | 82356a8 | 2008-07-01 13:16:07 +0000 | [diff] [blame] | 11 | # Do not accept any statically linked executable. |
| 12 | if /usr/bin/file "$1" | grep -q 'statically linked'; then |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
bart | 2299956 | 2008-03-16 07:44:29 +0000 | [diff] [blame] | 16 | if [ "$(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 | |
bart | 5304e6b | 2008-03-22 08:08:58 +0000 | [diff] [blame] | 23 | # 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. |
bart | 8186c85 | 2008-03-22 09:36:23 +0000 | [diff] [blame] | 28 | rc="$(nm "${libgomp_path}" 2>&1 \ |
bart | 5304e6b | 2008-03-22 08:08:58 +0000 | [diff] [blame] | 29 | | |
| 30 | while read line |
| 31 | do |
| 32 | if [ "${line%: no symbols}" != "${line}" ]; then |
| 33 | echo 1 |
bart | 8186c85 | 2008-03-22 09:36:23 +0000 | [diff] [blame] | 34 | break |
bart | 5304e6b | 2008-03-22 08:08:58 +0000 | [diff] [blame] | 35 | elif [ "${line% gomp_barrier_init}" != "${line}" ]; then |
| 36 | echo 0 |
bart | 8186c85 | 2008-03-22 09:36:23 +0000 | [diff] [blame] | 37 | break |
bart | 5304e6b | 2008-03-22 08:08:58 +0000 | [diff] [blame] | 38 | fi |
| 39 | done)" |
bart | 56847ad | 2008-03-16 10:41:25 +0000 | [diff] [blame] | 40 | exit ${rc:-1} |
bart | 2299956 | 2008-03-16 07:44:29 +0000 | [diff] [blame] | 41 | |
| 42 | fi |