#!/bin/sh

# taken from SDL-1.2.7 sdl-config.in, licensed under the LGPL v.2

prefix=/usr/local/bin/pvfs2-layout/
exec_prefix=${prefix}
exec_prefix_set=no

usage="\
Usage: pvfs2-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs] [--serverlibs] [--static-serverlibs]"

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
      ;;
    --version)
      echo 1.4.1pre1-2006-05-12-160950
      ;;
    --cflags)
      echo -I${prefix}/include 

      ;;
    --libs|--static-libs)
	libflags="-L${exec_prefix}/lib -lpvfs2  -lpthread" 
	if [ x"" = x"1" ]; then
		libflags="$libflags -L/lib -lgm"
	fi
	if [ x"" = x"1" ]; then
		libflags="$libflags -L -lvapi -lmtl_common -lmosal -lmpga -lpthread -ldl"
	fi

	echo $libflags
	;;
    --serverlibs|--static-serverlibs)
	libflags="-L${exec_prefix}/lib -lpthread -lpvfs2-server  " 
	if [ x"" = x"1" ]; then
		libflags="$libflags -lrt"
	fi
	if [ x"" = x"1" ]; then
		libflags="$libflags -L/lib -lgm"
	fi
	if [ x"" = x"1" ]; then
		libflags="$libflags -L -lvapi -lmtl_common -lmosal -lmpga -lpthread -ldl"
	fi

	echo $libflags
	;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done
