Simon Kelley | 3d8df26 | 2005-08-29 12:19:27 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Kelley | 1f15b81 | 2009-10-13 17:49:32 +0100 | [diff] [blame] | 3 | search=$1 |
| 4 | shift |
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 5 | pkg=$1 |
| 6 | shift |
| 7 | op=$1 |
| 8 | shift |
Simon Kelley | 1f15b81 | 2009-10-13 17:49:32 +0100 | [diff] [blame] | 9 | |
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 10 | in=`cat` |
| 11 | |
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 12 | if grep "^\#[[:space:]]*define[[:space:]]*$search" config.h >/dev/null 2>&1 || \ |
| 13 | echo $in | grep $search >/dev/null 2>&1; then |
Simon Kelley | 063efb3 | 2014-06-17 19:49:31 +0100 | [diff] [blame] | 14 | # Nasty, nasty, in --copy, arg 2 is another config to search for, use with NO_GMP |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 15 | if [ $op = "--copy" ]; then |
Simon Kelley | 063efb3 | 2014-06-17 19:49:31 +0100 | [diff] [blame] | 16 | if grep "^\#[[:space:]]*define[[:space:]]*$pkg" config.h >/dev/null 2>&1 || \ |
| 17 | echo $in | grep $pkg >/dev/null 2>&1; then |
| 18 | pkg="" |
| 19 | else |
| 20 | pkg="$*" |
| 21 | fi |
Simon Kelley | 4ea8e80 | 2014-03-05 11:01:23 +0000 | [diff] [blame] | 22 | elif grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \ |
| 23 | echo $in | grep ${search}_STATIC >/dev/null 2>&1; then |
| 24 | pkg=`$pkg --static $op $*` |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 25 | else |
Simon Kelley | 4ea8e80 | 2014-03-05 11:01:23 +0000 | [diff] [blame] | 26 | pkg=`$pkg $op $*` |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 27 | fi |
| 28 | |
| 29 | if grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \ |
| 30 | echo $in | grep ${search}_STATIC >/dev/null 2>&1; then |
| 31 | if [ $op = "--libs" ] || [ $op = "--copy" ]; then |
| 32 | echo "-Wl,-Bstatic $pkg -Wl,-Bdynamic" |
| 33 | else |
| 34 | echo "$pkg" |
| 35 | fi |
| 36 | else |
| 37 | echo "$pkg" |
| 38 | fi |
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 39 | fi |
Simon Kelley | 3d8df26 | 2005-08-29 12:19:27 +0100 | [diff] [blame] | 40 | |