#!/bin/sh

prefix=/usr/X11R6
exec_prefix=/usr/X11R6
exec_prefix_set=no

usage()
{
	cat <<EOF
Usage: oms-config [OPTIONS] [LIBRARIES]
Options:
	[--prefix[=DIR]]
	[--exec-prefix[=DIR]]
	[--version]
	[--libs]
	[--cflags]
	[--plugin_dir]
	[--skin_dir]
	[--built_os]
	[--built_cpu]
	[--mmlibs]
Libraries:
	oms
EOF
	exit $1
}

if test $# -eq 0; then
	usage 1 1>&2
fi

lib_oms=yes

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=yes
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo_exec_prefix=yes
      ;;
    --version)
      echo 0.1.2
      exit 0
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    --plugin_dir)
      echo_plugin_dir=yes
      ;;
    --skin_dir)
      echo_skin_dir=yes
      ;;
    --built_os)
      echo_built_os=yes
      ;;
    --built_cpu)
      echo_built_cpu=yes
      ;;
    --mmlibs)
      echo_mmlibs=yes
      ;;
    oms)
      lib_oms=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

if test "$echo_built_cpu" = "yes"; then
	echo $target_cpu
fi
if test "$echo_built_os" = "yes"; then
	echo $target_os
fi
if test "$echo_prefix" = "yes"; then
	echo $prefix
fi
if test "$echo_exec_prefix" = "yes"; then
	echo $exec_prefix
fi
if test "$echo_cflags" = "yes"; then
	cflags=""
	includes="-I/usr/X11R6/include"
	echo $includes $cflags
fi
if test "$echo_libs" = "yes"; then
	libs=""
	if test "$lib_oms" = "yes"; then
		libs="$libs -loms"
	fi
	echo -L/usr/X11R6/lib $libs
fi
if test "$echo_plugin_dir" = "yes"; then
	echo /usr/X11R6/lib/oms/plugins
fi
if test "$echo_skin_dir" = "yes"; then
	echo @SKIN_DIR@
fi
if test "$echo_mmlibs" = "yes"; then
	echo ${mmlibs}
fi
