#!/bin/sh

# Markus Neteler
#  6/2005
#  8/2005

# XEON flags
#export XEON="-O3 -msse -msse2 -mfpmath=sse -minline-all-stringops"
# don't optimize to keep -g functional
XEON="-mcpu=nocona -mtune=nocona -m64 -minline-all-stringops"

# some flags to catch all possible problems:
MYCFLAGS="-g -Wall -Werror-implicit-function-declaration -fno-common $XEON"
MYCXXFLAGS="-g -Wall"

# RHEL 4/64bit:
CFLAGS="$MYCFLAGS" CXXFLAGS="$MYCXXFLAGS" ./configure \
  --enable-64bit \
  --with-libs=/usr/lib64 \
  --with-cxx \
  --with-gdal=/usr/local/bin/gdal-config \
  --with-postgres-includes=/usr/include/pgsql --with-postgres-libs=/usr/lib \
  --without-mysql \
  --without-odbc \
  --with-nls \
  --with-fftw \
  --with-freetype --with-freetype-includes=/usr/include/freetype2 \
  --enable-largefile \
  --without-opendwg \
  2>&1 | tee config_log.txt

#  --with-opendwg --with-opendwg-includes=/ssi0/ssi/neteler/soft/openDWG \
#  --with-opendwg-libs=/ssi0/ssi/neteler/soft/openDWG 

if [ $? -eq 1 ]
	then
	 echo "an error occured"
	 exit
fi

### now compile:
echo "Run for compilation: make"

ARCH=`grep ARCH config.status | cut -d'%' -f3 |head -1`
echo "After that"
echo " GRASS 6 start script will be in: ./$BINDIR/bin.$ARCH"
echo " GRASS 6 binaries will be in:     ./$PREFIX/dist.$ARCH"
echo "Enjoy."
