Simon Kelley | 3d8df26 | 2005-08-29 12:19:27 +0100 | [diff] [blame] | 1 | #!/bin/sh |
2 | |||||
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 3 | in=`cat` |
4 | |||||
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 5 | search() |
6 | { | ||||
7 | grep "^\#[[:space:]]*define[[:space:]]*$1" config.h >/dev/null 2>&1 || \ | ||||
8 | echo $in | grep $1 >/dev/null 2>&1 | ||||
9 | } | ||||
10 | |||||
11 | while [ "$#" -gt 0 ]; do | ||||
12 | search=$1 | ||||
13 | pkg=$2 | ||||
14 | op=$3 | ||||
15 | lib=$4 | ||||
16 | shift 4 | ||||
17 | if search "$search"; then | ||||
18 | |||||
Simon Kelley | 3a5a84c | 2018-10-31 21:30:13 +0000 | [diff] [blame] | 19 | # Nasty, nasty, in --copy, arg 2 (if non-empty) is another config to search for, used with NO_GMP |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 20 | if [ $op = "--copy" ]; then |
Simon Kelley | 3a5a84c | 2018-10-31 21:30:13 +0000 | [diff] [blame] | 21 | if [ -z "$pkg" ]; then |
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 22 | pkg="$lib" |
23 | elif search "$pkg"; then | ||||
Simon Kelley | 063efb3 | 2014-06-17 19:49:31 +0100 | [diff] [blame] | 24 | pkg="" |
25 | else | ||||
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 26 | pkg="$lib" |
Simon Kelley | 063efb3 | 2014-06-17 19:49:31 +0100 | [diff] [blame] | 27 | fi |
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 28 | elif search "${search}_STATIC"; then |
29 | pkg=`$pkg --static $op $lib` | ||||
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 30 | else |
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 31 | pkg=`$pkg $op $lib` |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 32 | fi |
Simon Kelley | 3a5a84c | 2018-10-31 21:30:13 +0000 | [diff] [blame] | 33 | |
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 34 | if search "${search}_STATIC"; then |
Simon Kelley | b98d22c | 2014-02-04 16:57:25 +0000 | [diff] [blame] | 35 | if [ $op = "--libs" ] || [ $op = "--copy" ]; then |
36 | echo "-Wl,-Bstatic $pkg -Wl,-Bdynamic" | ||||
37 | else | ||||
38 | echo "$pkg" | ||||
39 | fi | ||||
40 | else | ||||
41 | echo "$pkg" | ||||
42 | fi | ||||
Simon Kelley | c979fa0 | 2014-01-21 13:45:17 +0000 | [diff] [blame] | 43 | fi |
Simon Kelley | 3d8df26 | 2005-08-29 12:19:27 +0100 | [diff] [blame] | 44 | |
Petr Menšík | 2024f97 | 2020-11-25 17:18:55 +0100 | [diff] [blame] | 45 | done |