#! /bin/sh
#
# This file is part of GWXLIBS. It is a wrapper script around pkgconfig,
# and replaces the old pcre-5.0-config script. This file is automatically
# generated. Do not change this. Change the template if you need to.
#
# (C) Copyright 1998, 2002-2004 J. Kean Johnston. All rights reserved.
#
# This file is free software. You are free to distribute it under the terms
# and conditions of the GNU General Public License, version2, or, at your
# option, any later version.

usage()
{
  cat <<EOF

Usage: pcre-5.0-config [OPTION [OPTION] ...] [LIBRARIES]
Where OPTION is one or more of:
  --prefix[=DIR]        Get/set the installation prefix
  --exec-prefix[=DIR]   Set/set the executable prefix
  --libs                Print library linking information
  --cflags              Print compiler control information
  --help                Print this help message
  --version             Print version information

Default library if none specified: pcre-5.0

EOF
}

if test $# -eq 0; then
  usage
  exit 1
fi

ARGLIST=
LIBLIST=
while test $# -gt 0; do
  cmdarg=""
  case "$1" in
    --*=*)	optarg=`echo "$1" | sed -e 's/[-_a-zA-Z0-9]*=//'`
		varname=`echo "$1" | sed -e 's/=.*//'`
		ARGLIST="$ARGLIST --define-variable=$varname=$optarg"
		;;
    --*)	cmdarg=`echo "$1" | sed -e 's/^--//'` ;;
    *)		LIBLIST="$LIBLIST $1" ;;
  esac

  if test "$cmdarg" = "version"; then
    cmdarg=modversion
  fi

  if test "$cmdarg" = "libs-posix"; then
    cmdarg=libs
  fi

  case "$cmdarg" in
    modversion | libs | libs-only-l | libs-only-L | \
    cflags | cflags-only-I | exists | uninstalled | list-all | \
    debug | print-errors | silence-errors | errors-to-stdout | \
    help | usage) ARGLIST="$ARGLIST --$cmdarg" ;;

    *) if test -n "$cmdarg"; then 
           cmdarg=`echo $cmdarg | sed -e 's/-/_/g'`
           ARGLIST="$ARGLIST --variable=$cmdarg"
       fi
    ;;
  esac

  shift
done # End of loop through the arguments

PKGCONFIG=${PKGCONFIG:-/usr/bin/pkg-config}
LIBLIST=${LIBLIST:-pcre-5.0}

if test -n "$ARGLIST" ; then
  $PKGCONFIG $ARGLIST $LIBLIST
fi
