#!/bin/sh

# Markus Neteler
# flags to compile GRASS 6.1 on 32bit (here Redhat Enterprise)
#  6/2004
# 11/2004
#  7/2005
#  8/2005
#  5/2006

# some flags to catch all possible problems:
# don't optimize to keep -g functional
MYCFLAGS="-g -Wall -Werror-implicit-function-declaration -fno-common"
MYCXXFLAGS="-g -Wall"

CFLAGS="$MYCFLAGS" CXXFLAGS="$MYCXXFLAGS" ./configure \
  --with-cxx \
  --with-gdal=/usr/local/bin/gdal-config \
  --with-postgres-includes=/usr/include/pgsql --with-postgres-libs=/usr/lib \
  --without-mysql \
  --with-sqlite \
  --without-odbc \
  --with-nls \
  --with-motif \
  --with-motif-includes=/usr/X11R6/include/Xm \
  --with-glw \
  --with-fftw \
  --with-freetype --with-freetype-includes=/usr/include/freetype2 \
  --enable-largefile \
  2>&1 | tee config_log.txt

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

# local trick for IRST
#cat include/Make/Platform.make | sed 's+/hardmnt+/nfsmnt+g' > myPlatform.make
#mv myPlatform.make include/Make/Platform.make

### 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."
