#!/bin/sh

prefix=@prefix@
prelude_conf_prefix=@prelude_config_dir@
exec_prefix=@exec_prefix@
exec_prefix_set=no

usage="\
Usage: libprelude-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--config-prefix] [--version] [--libs] [--ldflags] [--cflags] [--pthread-cflags]"

if test $# -eq 0; then
      echo "${usage}" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;

    --prefix)
      echo $prefix
      ;;

    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;

    --exec-prefix)
      echo $exec_prefix
      ;;

    --config-prefix)
      echo $prelude_conf_prefix
      ;;

    --version)
      echo @VERSION@
      ;;

    --cflags)
      if test @includedir@ != /usr/include ; then
        includes=-I@includedir@
      fi
      echo @libprelude_cflags@ $includes
      ;;

    --pthread-cflags)
      if test @includedir@ != /usr/include ; then
        includes=-I@includedir@
      fi
      echo @PTHREAD_CFLAGS@ @libprelude_cflags@ $includes
      ;;

    --ldflags)
      echo @PTHREAD_CFLAGS@
      ;;

    --libs)
      libdirs=-L@libdir@
      echo $libdirs -lprelude @libprelude_libs@ @LIBADD_DL@ @PTHREAD_LIBS@
      ;;

    *)
      echo "${usage}" 1>&2
      exit 1
      ;;

  esac
  shift
done

exit 0
