#!/bin/sh
## ----------------------------------------------------------------------------
##                                                                           --
##                      GNADE  : GNu Ada Database Environment                --
##                                                                           --
##  Filename        : $Source: /var/cvs/gnuada/gnade/configure,v $
##  Description     : shell script to configure the makefiles for the build
##                    environment.
##  Author          : Michael Erdmann <Michael.Erdmann@snafu.de>
##  Created On      : 03-Jan-2001
##  Last Modified By: $Author: me $
##  Last Modified On: $Date: 2001/08/10 20:55:17 $
##  Status          : $State: Exp $
##                                                                           
##  Copyright (C) 2000-2001
##                                                                           --
##  GNADE is copyrighted by the persons and institutions enumerated in the   --
##  AUTHORS file. This file is located in the root directory of the          --
##  GNADE distribution.                                                      --
##                                                                           --
##  GNADE is free software;  you can redistribute it  and/or modify it under --
##  terms of the  GNU General Public License as published  by the Free Soft- --
##  ware  Foundation;  either version 2,  or (at your option) any later ver- --
##  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
##  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
##  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
##  for  more details.  You should have  received  a copy of the GNU General --
##  Public License  distributed with GNAT;  see file COPYING.  If not, write --
##  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
##  MA 02111-1307, USA.                                                      --
##                                                                           --
##  As a special exception,  if other files  instantiate  generics from      --
##  GNADE Ada units, or you link GNADE Ada units or libraries with other     --
##  files  to produce an executable, these  units or libraries do not by     --
##  itself cause the resulting  executable  to  be covered  by the  GNU      --
##  General  Public  License.  This exception does not however invalidate    --
##  any other reasons why  the executable file  might be covered by the      --
##  GNU Public License.                                                      --
##                                                                           --
##                                                                           --
##  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
##                                                                           --
## ----------------------------------------------------------------------------
##
. ./VERSION
VERS=$GNADE_MAJOR.$GNADE_MINOR.$GNADE_PATCHLEVEL
echo
echo "GNAT Data Base Developement Environment (GNADE) $VERS" 
echo "(C) Copyright 2000,2001; the GNADE Team (see -authors)"
echo 

basedir=`pwd` ; export basedir

config_opt=""

for i in $* 
do
   case $i in
      -debug|--enable-debug) 
	 config_opt="$config_opt --enable-debug";;
      -assert|--enable-assert) 
         config_opt="$config_opt --enable-assert";;
      -authors|--show-authors)
         cat AUTHORS
	 exit 0
         ;;
      -help|--help)
         echo "configure [ <options> ] [ <database> ]"
         echo
	 echo "options:"
	 echo "   --help            this message"
	 echo "   --enable-debug    compile with debugging code"
	 echo "   --enable-assert   compile with assert option"
	 echo "   --show-authors    display the authors of the GNADE team"
	 echo 
	 echo "database:"
         echo "   This parameter may be used to setup the test data base"
	 echo "   by means tools of the specified data base vendor." 
	 echo "   The following values are supported:"
	 echo
	 echo "      postgres"
	 echo "      mysql"
	 echo "      mimer"
	 echo "      oracle"
	 echo 
	 exit 0 
	 ;;

      *) 
         config_opt="$config_opt --with-$i" ;;
   esac
done

( cd autoconf && make && ./configure --with-install-dir=$basedir/autoconf --prefix=$basedir $config_opt ) 
if test $? -ne 0
then
   echo 
   echo "** CONFIGURE ABORTED **"
   echo
   exit $?
fi

make directories > /dev/null

echo
echo " ** CONFIGURE COMPLETE ** "
echo
#
# Output a decent final test
#
if test -f .configure
then
cat <<EOF

The configure script creates examples for the odbc init files. The files
are located at:
 
      ./samples/sample_db/odbcinst.ini.sample
                          odbc.ini.sample
                                             
For the complete authors list of the GNADE team check the AUTHORS file
or use the -authors switch, e.g:
   
      ./configure -authors 
    
EOF
else
   cat AUTHORS
   touch .configure
fi                          
