blob: 89713b4e708e82ee8f221d0bbbe21942a9cbba7d [file] [log] [blame]
Simon Kelley3d8df262005-08-29 12:19:27 +01001#!/bin/sh
2
Simon Kelleyc979fa02014-01-21 13:45:17 +00003in=`cat`
4
Petr Menšík2024f972020-11-25 17:18:55 +01005search()
6{
7 grep "^\#[[:space:]]*define[[:space:]]*$1" config.h >/dev/null 2>&1 || \
8 echo $in | grep $1 >/dev/null 2>&1
9}
10
11while [ "$#" -gt 0 ]; do
12 search=$1
13 pkg=$2
14 op=$3
15 lib=$4
16 shift 4
17if search "$search"; then
18
Simon Kelley3a5a84c2018-10-31 21:30:13 +000019# Nasty, nasty, in --copy, arg 2 (if non-empty) is another config to search for, used with NO_GMP
Simon Kelleyb98d22c2014-02-04 16:57:25 +000020 if [ $op = "--copy" ]; then
Simon Kelley3a5a84c2018-10-31 21:30:13 +000021 if [ -z "$pkg" ]; then
Petr Menšík2024f972020-11-25 17:18:55 +010022 pkg="$lib"
23 elif search "$pkg"; then
Simon Kelley063efb32014-06-17 19:49:31 +010024 pkg=""
25 else
Petr Menšík2024f972020-11-25 17:18:55 +010026 pkg="$lib"
Simon Kelley063efb32014-06-17 19:49:31 +010027 fi
Petr Menšík2024f972020-11-25 17:18:55 +010028 elif search "${search}_STATIC"; then
29 pkg=`$pkg --static $op $lib`
Simon Kelleyb98d22c2014-02-04 16:57:25 +000030 else
Petr Menšík2024f972020-11-25 17:18:55 +010031 pkg=`$pkg $op $lib`
Simon Kelleyb98d22c2014-02-04 16:57:25 +000032 fi
Simon Kelley3a5a84c2018-10-31 21:30:13 +000033
Petr Menšík2024f972020-11-25 17:18:55 +010034 if search "${search}_STATIC"; then
Simon Kelleyb98d22c2014-02-04 16:57:25 +000035 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 Kelleyc979fa02014-01-21 13:45:17 +000043fi
Simon Kelley3d8df262005-08-29 12:19:27 +010044
Petr Menšík2024f972020-11-25 17:18:55 +010045done