blob: 0ddb678c6a2c48be7be0b42f55a4dd4fb493f834 [file] [log] [blame]
Simon Kelley3d8df262005-08-29 12:19:27 +01001#!/bin/sh
2
Simon Kelley1f15b812009-10-13 17:49:32 +01003search=$1
4shift
Simon Kelleyc979fa02014-01-21 13:45:17 +00005pkg=$1
6shift
7op=$1
8shift
Simon Kelley1f15b812009-10-13 17:49:32 +01009
Simon Kelleyc979fa02014-01-21 13:45:17 +000010in=`cat`
11
Simon Kelleyc979fa02014-01-21 13:45:17 +000012if grep "^\#[[:space:]]*define[[:space:]]*$search" config.h >/dev/null 2>&1 || \
13 echo $in | grep $search >/dev/null 2>&1; then
Simon Kelley063efb32014-06-17 19:49:31 +010014# Nasty, nasty, in --copy, arg 2 is another config to search for, use with NO_GMP
Simon Kelleyb98d22c2014-02-04 16:57:25 +000015 if [ $op = "--copy" ]; then
Simon Kelley063efb32014-06-17 19:49:31 +010016 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 Kelley4ea8e802014-03-05 11:01:23 +000022 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 Kelleyb98d22c2014-02-04 16:57:25 +000025 else
Simon Kelley4ea8e802014-03-05 11:01:23 +000026 pkg=`$pkg $op $*`
Simon Kelleyb98d22c2014-02-04 16:57:25 +000027 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 Kelleyc979fa02014-01-21 13:45:17 +000039fi
Simon Kelley3d8df262005-08-29 12:19:27 +010040