#! /bin/sh
set -e

#
# simple pseudo-configure
#
# to use a specific python version call
#   `PYTHON=python2.0 ./configure'
#
# written by Markus F. X. J. Oberhumer <markus@oberhumer.com>
#

if test -z "$SDL_CONFIG"; then
SDL_CONFIG="sdl-config"
fi
SDL_VERSION=`$SDL_CONFIG --version`
SDL_CFLAGS=`$SDL_CONFIG --cflags`
SDL_LIBS=`$SDL_CONFIG --libs`

SMPEG_CFLAGS=""
SMPEG_LIBS="-lsmpeg"

sed -e "s|@SDL_VERSION@|$SDL_VERSION|g" -e "s|@SDL_CFLAGS@|$SDL_CFLAGS|g" -e "s|@SDL_LIBS@|$SDL_LIBS|g" -e "s|@SMPEG_CFLAGS@|$SMPEG_CFLAGS|g" -e "s|@SMPEG_LIBS@|$SMPEG_LIBS|g" < Setup.pre.in > Setup.in

###test -f Setup && test ! -f Setup.OLD && mv Setup Setup.OLD
###rm -f Setup

if test -z "$PYTHON"; then
  make -f Makefile.pre.in boot
else
  make -f Makefile.pre.in boot "PYTHON=$PYTHON"
fi

echo
echo "Configuration finished."
echo "Now type \"make\". Edit the file \`Setup' in case of troubles."
echo

exit 0
