#!/bin/sh
for i in $*
do
  case $i in
  --prefix=*) prefix=`echo $i|sed 's/--prefix=//'` ;;
  --libdir=*) libdir=`echo $i|sed 's/--libdir=//'` ;;
  --includedir=*) includedir=`echo $i|sed 's/--includedir=//'` ;;
  esac
done

if test -r ../config.cache; then
  . ../config.cache
fi

if test set${ac_cv_singuname} = set; then
  :
else
  ac_cv_singuname="unknown"
  if test -r "../singuname.sh"; then
    if (/bin/sh ../singuname.sh >/dev/null 2>&1) then
      ac_cv_singuname=`/bin/sh ../singuname.sh`
    fi
  fi
fi

if test x$SING_CC = x
then
  SING_CC=gcc
fi

if test x$SING_CXX = x
then
  SING_CXX=g++
fi

if test x$CFLAGS = x
then
  CFLAGS="-O3 -fomit-frame-pointer"
fi

if test x$CXXFLAGS = x
then
  CXXFLAGS="-O3 -fomit-frame-pointer -fno-rtti -fno-exceptions"
fi
CFLAGS="$CPPFLAGS $CFLAGS"
CXXFLAGS="$CPPFLAGS $CXXFLAGS"
echo "#!/bin/sh" >config.status
echo "cd src" >>config.status
echo ./configure CC=\"$SING_CC\" CXX=\"$SING_CXX\" LIBDIR=$libdir INCLUDEDIR=$includedir PREFIX=$prefix NTL_GMP_LIP=on GMP_PREFIX=$prefix/${ac_cv_singuname} CFLAGS=\"$CFLAGS\" CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" NTL_STD_CXX=off >>config.status
echo "cd .." >>config.status

chmod +rx config.status

. ./config.status

