b88a44
#!/bin/sh
b88a44
b88a44
prefix=/usr
b88a44
exec_prefix=/usr
b88a44
exec_prefix_set=no
b88a44
b88a44
name=`basename $0`
b88a44
name=${name#lib}
b88a44
name=${name%-config}
b88a44
b88a44
libs=`pkg-config --libs $name`
b88a44
cflags=`pkg-config --cflags $name`
b88a44
version=`pkg-config --modversion $name`
b88a44
b88a44
usage()
b88a44
{
b88a44
b88a44
echo Usage: lib$name-config [OPTIONS]
b88a44
	cat <
b88a44
Options:
b88a44
	[--prefix[=DIR]]
b88a44
	[--exec-prefix[=DIR]]
b88a44
	[--version]
b88a44
	[--libs]
b88a44
	[--cflags]
b88a44
EOF
b88a44
	exit $1
b88a44
}
b88a44
b88a44
if test $# -eq 0; then
b88a44
	usage 1 1>&2
b88a44
fi
b88a44
b88a44
while test $# -gt 0; do
b88a44
  case "$1" in
b88a44
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
b88a44
  *) optarg= ;;
b88a44
  esac
b88a44
b88a44
  case $1 in
b88a44
    --prefix=*)
b88a44
      prefix=$optarg
b88a44
      if test $exec_prefix_set = no ; then
b88a44
	exec_prefix=$optarg
b88a44
      fi
b88a44
      ;;
b88a44
    --prefix)
b88a44
      echo_prefix=yes
b88a44
      ;;
b88a44
    --exec-prefix=*)
b88a44
      exec_prefix=$optarg
b88a44
      exec_prefix_set=yes
b88a44
      ;;
b88a44
    --exec-prefix)
b88a44
      echo_exec_prefix=yes
b88a44
      ;;
b88a44
    --version)
b88a44
      echo $version
b88a44
      exit 0
b88a44
      ;;
b88a44
    --cflags)
b88a44
      echo_cflags=yes
b88a44
      ;;
b88a44
    --libs)
b88a44
      echo_libs=yes
b88a44
      ;;
b88a44
    --help)
b88a44
      usage 0
b88a44
      ;;
b88a44
    *)
b88a44
      usage 1 1>&2
b88a44
      ;;
b88a44
  esac
b88a44
  shift
b88a44
done
b88a44
b88a44
if test "$echo_prefix" = "yes"; then
b88a44
    echo $prefix
b88a44
fi
b88a44
b88a44
if test "$echo_exec_prefix" = "yes"; then
b88a44
    echo $exec_prefix
b88a44
fi
b88a44
b88a44
if test "$echo_cflags" = "yes"; then
b88a44
    echo $cflags
b88a44
fi
b88a44
b88a44
if test "$echo_libs" = "yes"; then
b88a44
    echo $libs
b88a44
fi