#!/bin/sh

# Markus Neteler
#  12/2005

# Pentium 64bit flags
# don't optimize to keep -g functional
PENTIUM64="-mtune=nocona -m64 -minline-all-stringops"

# some flags to catch all possible problems:
MYCFLAGS="-g -Wall -pedantic -Werror-implicit-function-declaration -fno-common $PENTIUM64"
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/lib64 \
  --with-mysql \
  --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql\
  --without-odbc \
  --with-sqlite \
  --with-nls \
  --with-fftw \
  --with-freetype --with-freetype-includes=/usr/include/freetype2 \
  --disable-largefile \
  2>&1 | tee config_log.txt

# --with-fftw  --with-fftw-libs=/usr/local/lib
#  --with-opendwg --with-opendwg-includes=$HOME/software/DWGDirect2 \
#  --with-opendwg-libs=$HOME/software/DWGDirect2 \

#old DWG1 lib:
#  --with-opendwg --with-opendwg-includes=/ssi0/ssi/neteler/software/openDWG \
#  --with-opendwg-libs=/ssi0/ssi/neteler/software/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."
