## File:      configure.in
## Author(s): Rohan Shirwaikar
## Contact:   xsb-contact@cs.sunysb.edu
## 
## Copyright (C) The Research Foundation of SUNY, 2004
## 
## XSB is free software; you can redistribute it and/or modify it under the
## terms of the GNU Library General Public License as published by the Free
## Software Foundation; either version 2 of the License, or (at your option)
## any later version.
## 
## XSB is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
## more details.
## 
## You should have received a copy of the GNU Library General Public License
## along with XSB; if not, write to the Free Software Foundation,
## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## $Id: configure.in,v 1.1 2005/03/01 03:31:44 kifer Exp $
## 
##

dnl  Autoconf script for xpath
dnl  To rebuild the `configure' script from this, execute the command
dnl	autoconf
dnl  in the directory containing this script.
dnl
dnl

AC_PREREQ(2.12)dnl

AC_INIT(xpathconfig.P)

SHELL=/bin/sh

build_dir="`pwd`"
# strip the last two directories and possibly trailing slashes
topdir=`echo "${build_dir}" | sed 's,/[[^/]][[^/]]*/*/[[^/]][[^/]]*/*$,,'`


# Tell where the autoconf scripts are
AC_CONFIG_AUX_DIR($topdir/build)

dnl Check configuration for a Unix variant
echo '
- You did not tell me what kind of host system you want to configure.
- I will attempt to guess the kind of system this is.
' 1>&6
AC_CANONICAL_HOST
canonical=$host
configuration=$host_alias


# make sure new files are readable 
umask 022


ccflags=
ldflags=

xpath_config_prog="./xml2-config"

test "${enable_debug+yes}" = "yes" && xpath_debug=" -g"
if test "$exec_prefix" != "NONE" ; then
    exec_prefix_option="--exec-prefix=$exec_prefix"
fi
if test "$prefix" != "NONE" ; then
    prefix_option="--prefix=$prefix"
fi

xmllib_ccflags=`sh $xpath_config_prog $exec_prefix_option $prefix_option --cflags`
ccflags="$xpath_debug $xmllib_ccflags"	
ldflags="`sh $xpath_config_prog $exec_prefix_option $prefix_option --libs`"

if test  "$xmllib_ccflags" != "ERROR" && test "$ldflags" != "ERROR"  ; then
   support=yes
else
   support=no
fi

AC_SUBST(support)
AC_SUBST(ccflags)
AC_SUBST(ldflags)

(
echo ""
echo "  Xpath support: 				  $support"
if test "$support" = "yes"; then
   cat <<EOT
    Xpath C flags:			  $ccflags
    Xpath loader flags:			  $ldflags

EOT
fi
) | tee Installation_summary

AC_OUTPUT([xpath_init.P:xpath_init.in])
