blob: 9f9332d7d9a73531ac2c2133cf3903f44bc6ae96 [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 Kelleyb98d22c2014-02-04 16:57:25 +000014
15 if [ $op = "--copy" ]; then
16 pkg="$*"
Simon Kelley4ea8e802014-03-05 11:01:23 +000017 elif grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
18 echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
19 pkg=`$pkg --static $op $*`
Simon Kelleyb98d22c2014-02-04 16:57:25 +000020 else
Simon Kelley4ea8e802014-03-05 11:01:23 +000021 pkg=`$pkg $op $*`
Simon Kelleyb98d22c2014-02-04 16:57:25 +000022 fi
23
24 if grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
25 echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
26 if [ $op = "--libs" ] || [ $op = "--copy" ]; then
27 echo "-Wl,-Bstatic $pkg -Wl,-Bdynamic"
28 else
29 echo "$pkg"
30 fi
31 else
32 echo "$pkg"
33 fi
Simon Kelleyc979fa02014-01-21 13:45:17 +000034fi
Simon Kelley3d8df262005-08-29 12:19:27 +010035