#!/bin/sh -e
# $Id$
# Configuration report script for gengameng 4.1

prefix=/usr/local
exec_prefix=${prefix}

sdl_cflags=`sdl-config --cflags`
sdl_libs="`sdl-config --libs` -lSDL_image"


# Remove any -rpath option from SDL_LIBS, so as not to hardcode
# the library path into the executable file:
#
sdl_libs=`echo $sdl_libs | sed 's:-Wl,-rpath,[^ ]*: :g'`


function usage
{
	exit_code=$1

	cat <<__EOF__
Usage: gengameng-config [OPTION]...

Generic options
  --version   print gengameng version information
  --help      print this help and exit

Compilation support options
  --cflags    print gengameng/SDL pre-processor and compiler flags
  --libs      print gengameng/SDL library linking information

Install directories gengameng was configured to:
  --prefix
  --exec-prefix

__EOF__

	exit $exit_code
}



while test $# -gt 0; do

	case "$1" in

		--version)
			echo "4.1"
			exit 0
			;;

		--help)
			usage 0
			;;

		--cflags)
			echo "-I${prefix}/include $sdl_cflags"
			exit 0
			;;

		--libs)
			echo "-L${exec_prefix}/lib -lgengameng $sdl_libs"
			exit 0
			;;

		--prefix)
			echo "$prefix"
			exit 0
			;;

		--exec_prefix)
			echo "$exec_prefix"
			exit 0
			;;

		*)
			usage 1
			;;
	esac

	shift
done
