| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
prefix=/usr
|
| 4 |
exec_prefix=/usr
|
| 5 |
exec_prefix_set=no
|
| 6 |
|
| 7 |
name=`basename $0`
|
| 8 |
name=${name#lib}
|
| 9 |
name=${name%-config}
|
| 10 |
|
| 11 |
libs=`pkg-config --libs $name`
|
| 12 |
cflags=`pkg-config --cflags $name`
|
| 13 |
version=`pkg-config --modversion $name`
|
| 14 |
|
| 15 |
usage()
|
| 16 |
{
|
| 17 |
|
| 18 |
echo Usage: lib$name-config [OPTIONS]
|
| 19 |
cat <<EOF
|
| 20 |
Options:
|
| 21 |
[--prefix[=DIR]]
|
| 22 |
[--exec-prefix[=DIR]]
|
| 23 |
[--version]
|
| 24 |
[--libs]
|
| 25 |
[--cflags]
|
| 26 |
EOF
|
| 27 |
exit $1
|
| 28 |
}
|
| 29 |
|
| 30 |
if test $# -eq 0; then
|
| 31 |
usage 1 1>&2
|
| 32 |
fi
|
| 33 |
|
| 34 |
while test $# -gt 0; do
|
| 35 |
case "$1" in
|
| 36 |
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
| 37 |
*) optarg= ;;
|
| 38 |
esac
|
| 39 |
|
| 40 |
case $1 in
|
| 41 |
--prefix=*)
|
| 42 |
prefix=$optarg
|
| 43 |
if test $exec_prefix_set = no ; then
|
| 44 |
exec_prefix=$optarg
|
| 45 |
fi
|
| 46 |
;;
|
| 47 |
--prefix)
|
| 48 |
echo_prefix=yes
|
| 49 |
;;
|
| 50 |
--exec-prefix=*)
|
| 51 |
exec_prefix=$optarg
|
| 52 |
exec_prefix_set=yes
|
| 53 |
;;
|
| 54 |
--exec-prefix)
|
| 55 |
echo_exec_prefix=yes
|
| 56 |
;;
|
| 57 |
--version)
|
| 58 |
echo $version
|
| 59 |
exit 0
|
| 60 |
;;
|
| 61 |
--cflags)
|
| 62 |
echo_cflags=yes
|
| 63 |
;;
|
| 64 |
--libs)
|
| 65 |
echo_libs=yes
|
| 66 |
;;
|
| 67 |
--help)
|
| 68 |
usage 0
|
| 69 |
;;
|
| 70 |
*)
|
| 71 |
usage 1 1>&2
|
| 72 |
;;
|
| 73 |
esac
|
| 74 |
shift
|
| 75 |
done
|
| 76 |
|
| 77 |
if test "$echo_prefix" = "yes"; then
|
| 78 |
echo $prefix
|
| 79 |
fi
|
| 80 |
|
| 81 |
if test "$echo_exec_prefix" = "yes"; then
|
| 82 |
echo $exec_prefix
|
| 83 |
fi
|
| 84 |
|
| 85 |
if test "$echo_cflags" = "yes"; then
|
| 86 |
echo $cflags
|
| 87 |
fi
|
| 88 |
|
| 89 |
if test "$echo_libs" = "yes"; then
|
| 90 |
echo $libs
|
| 91 |
fi
|