dnl File: configure.in
dnl Process this file with autoconf to produce a configure script.
dnl

# the following macro comes from
# http://www.gnu.org/software/ac-archive/htmldoc/index.html
# http://ac-archive.sourceforge.net/Installed_Packages/ac_caolan_check_package.html
#
AC_DEFUN([AC_caolan_CHECK_PACKAGE],
[

AC_ARG_WITH($1,
[  --with-$1[=DIR]      root directory of $1 installation],
with_$1=$withval
if test "${with_$1}" != yes; then
        $1_include="$withval/include"
        $1_libdir="$withval/lib"
	$1_home="$withval"
fi
)

AC_ARG_WITH($1-include,
[  --with-$1-include=DIR   specify exact include dir for $1 headers],
$1_include="$withval")

AC_ARG_WITH($1-libdir,
[  --with-$1-libdir=DIR    specify exact library dir for $1 library
  --without-$1      disables $1 usage completely],
$1_libdir="$withval")

if test "${with_$1}" != no ; then
        OLD_LIBS=$LIBS
        OLD_LDFLAGS=$LDFLAGS
        OLD_CFLAGS=$CFLAGS
        OLD_CPPFLAGS=$CPPFLAGS

        if test "${$1_libdir}" ; then
                LDFLAGS="$LDFLAGS -L${$1_libdir}"
        fi
        if test "${$1_include}" ; then
                CPPFLAGS="$CPPFLAGS -I${$1_include}"
                CFLAGS="$CFLAGS -I${$1_include}"
        fi

        no_good=no
        AC_CHECK_LIB($3,$2,,no_good=yes)
        AC_CHECK_HEADER($4,,no_good=yes)
        if test "$no_good" = yes; then
dnl     broken
                ifelse([$6], , , [$6])

                LIBS=$OLD_LIBS
                LDFLAGS=$OLD_LDFLAGS
                CPPFLAGS=$OLD_CPPFLAGS
                CFLAGS=$OLD_CFLAGS
        else
dnl     fixed
                ifelse([$5], , , [$5])
		$1_LIBS="-L${$1_libdir} -l$3 "
		$1_CFLAGS="-I${$1_include} "
		$1_HOME=${$1_home}
                AC_DEFINE(HAVE_PKG_$1)
        fi

fi

])

AC_DEFUN([AC_caolan_CHECK_PACKAGE_HEADER_AS_FILE],
[

AC_ARG_WITH($1,
[  --with-$1[=DIR]      root directory of $1 installation],
with_$1=$withval
if test "${with_$1}" != yes; then
        $1_include="$withval/include"
	$1_home="$withval"
fi
)

AC_ARG_WITH($1-include,
[  --with-$1-include=DIR   specify exact include dir for $1 headers],
$1_include="$withval")

if test "${with_$1}" != no ; then
        OLD_CFLAGS=$CFLAGS
        OLD_CPPFLAGS=$CPPFLAGS

        if test "${$1_include}" ; then
                CPPFLAGS="$CPPFLAGS -I${$1_include}"
                CFLAGS="$CFLAGS -I${$1_include}"
        fi

        no_good=no

dnl create the path to the header which is treated as a file
	$1_PATH="${$1_include}/$2"
dnl check for the header as a file
        AC_CHECK_FILE(${$1_PATH},,no_good=yes)
        if test "$no_good" = yes; then
dnl     broken
                ifelse([$4], , , [$4])

                CPPFLAGS=$OLD_CPPFLAGS
                CFLAGS=$OLD_CFLAGS
        else
dnl     fixed
                ifelse([$3], , , [$3])
		$1_CFLAGS="-I${$1_include} "
		$1_HOME=${$1_home}
                AC_DEFINE(HAVE_PKG_$1)
        fi

fi

])

dnl the configure.in starts from here
dnl
AC_INIT(class/system/Integral/Integral.h)

dnl set default location for isip
dnl
AC_PREFIX_DEFAULT(`pwd`)

dnl find the system type for ISIP_BINARY
dnl
AC_CANONICAL_SYSTEM

dnl find the system type for wide character support
dnl
AC_MSG_CHECKING(Checking for wide character support)
case "$target" in
*solaris*) case "$target" in
           *2.7) ISIP_WCHAR_OS_VER="ISIP_WCHAR_SOLARIS_27" ;;
           *2.8) ISIP_WCHAR_OS_VER="ISIP_WCHAR_SOLARIS_27" ;;
           *) ISIP_WCHAR_OS_VER="ISIP_WCHAR_SOLARIS" ;;
           esac ;;
*) ISIP_WCHAR_OS_VER="ISIP_WCHAR_NONE" ;;
esac
AC_SUBST(ISIP_WCHAR_OS_VER)
AC_MSG_RESULT($ISIP_WCHAR_OS_VER)

dnl find sh
dnl
AC_MSG_CHECKING(Checking for sh)
AC_PATH_PROG(SH,sh)
AC_SUBST(SH)
if ( test -z "$SH" ); then
   isip_cancel=true
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(sh was not found on your system)
   AC_MSG_WARN("=============== Cannot Install ===============")
fi

dnl isip_cancel is used to allow for all programs to be tested before
dnl issuing a failure message at the end
dnl isip_test is a temporary variable for testing results
dnl
isip_cancel=

dnl define function to check for the g++ compiler. We redefine this so that
dnl autoconf will look for g++ before c++
dnl
AC_DEFUN(ISIP_PROG_CXX,
[AC_CHECK_PROGS(CXX, $CCC g++ c++ gcc CC cxx cc++ cl, gcc)
AC_PROG_CXX])

dnl check for programs
dnl
AC_PROG_AWK
ISIP_PROG_CXX
if [ test "$GXX" != "yes" ]; then
   isip_cancel=true
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(GNU C++, g++ (or c++), was not found on your system)
   AC_MSG_WARN(see http://www.gnu.org/software/gcc/gcc.html)
   AC_MSG_WARN("=============== Cannot Install ===============")
else
   dnl Get GCC Version
   CXX_VERSION=`"$CXX" --version | head -1 | awk '{print $3}'`
   CXX_MAJOR=`echo $CXX_VERSION | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
   CXX_MINOR=`echo $CXX_VERSION | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
   CXX_MICRO=`echo $CXX_VERSION | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
fi

dnl Make Sure GCC >= 4.1.0
if [ test "$CXX_MAJOR" = "4" ] && [ test "$CXX_MINOR" = "1" ]; then
   dnl  AC_MSG_WARN([Yes, you have $CXX_VERSION])
else
  AC_MSG_WARN("=============== Cannot Install ===============")
  AC_MSG_WARN([$CXX >= 4.1.0 is required, you have $CXX_VERSION])
  AC_MSG_WARN(see http://www.gnu.org/software/gcc/gcc.html)
  AC_MSG_WARN("=============== Cannot Install ===============")
  isip_cancel=true
fi

AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_SUBST(SET_MAKE)

AC_MSG_CHECKING(Checking for GNU make)
isip_test=`echo \`gmake --version 2>/dev/null | grep GNU | wc -l\` 2>/dev/null`

if [ test "$isip_test" = "1" ]; then
   AC_MSG_RESULT(found - gmake)
   ISIP_MAKE=gmake
else
   isip_test=`echo \`make --version 2>/dev/null | grep GNU | wc -l\` 2>/dev/null`
   if  [ test "$isip_test" = "1" ]; then
       AC_MSG_RESULT(found - make)
       ISIP_MAKE=make
   else
      AC_MSG_RESULT(not found)
      isip_cancel=true
   fi
fi

AC_SUBST(ISIP_MAKE)
if [ test "$ISIP_MAKE" = "" ]; then
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(GNU make was not found on your system)
   AC_MSG_WARN(see http://www.gnu.org/software/make/make.html)
   AC_MSG_WARN("=============== Cannot Install ===============")
fi

AC_PATH_PROG(LINK,ln)
AC_SUBST(LINK)
if ( test -z "$LINK" ); then
   AC_MSG_WARN("ln not found \- using cp")
   LINK="cp"
else
   LINK=$LINK" -s"
fi

AC_PATH_PROG(UNLINK,unlink)
AC_SUBST(UNLINK)
if ( test \("$LINK" = "cp"\) -o \("$UNLINK" = ""\) ); then
   AC_MSG_WARN("using rm for unlinking")
   UNLINK="rm -f"
fi

AC_PATH_PROG(PERL,perl)
AC_SUBST(PERL)
if ( test -z "$PERL" ); then
dnl   isip_cancel=true
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(perl was not found on your system)
   AC_MSG_WARN(see http://www.perl.com/pub)
   AC_MSG_WARN("=============== Cannot Install ===============")
fi

AC_CHECK_FILE(./util/speech/proto/GNUmakefile, ISIP_PROTO_FOUND=true, 
             ISIP_PROTO_FOUND=)
AC_SUBST(ISIP_PROTO_FOUND)
if ( test -z "$ISIP_PROTO_FOUND" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(ISIP prototype is not installed on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(AR,ar)
AC_SUBST(AR)
if ( test -z "$AR" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(ar was not found on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(JAVA,java)
AC_SUBST(JAVA)
if ( test -z "$JAVA" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(java was not found on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(JAVAC,javac)
AC_SUBST(JAVAC)
if ( test -z "$JAVAC" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(javac was not found on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(JAR,jar)
AC_SUBST(JAR)
if ( test -z "$JAR" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(jar was not found on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(JAVADOC,javadoc)
AC_SUBST(JAVADOC)
if ( test -z "$JAVADOC" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(javadoc was not found on your system)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_PATH_PROG(SED,sed)
AC_SUBST(SED)
if ( test -z "$SED" ); then
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(sed was not found on your system)
   AC_MSG_WARN("=============== Cannot Install ===============")
dnl   isip_cancel=true
fi

AC_PATH_PROG(AWK,awk)
AC_SUBST(AWK)
if ( test -z "$AWK" ); then
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(awk was not found on your system)
   AC_MSG_WARN("=============== Cannot Install ===============")
dnl   isip_cancel=true
fi

AC_MSG_CHECKING(tcl/tk)
AC_PATH_PROG(TCL,wish)
AC_SUBST(TCL)
if ( test -z "$TCL" ); then
   AC_MSG_WARN("=============== Cannot Install ===============")
   AC_MSG_WARN(tcl/tk was not found on your system)
   AC_MSG_WARN(see http://dev.scriptics.com/)
   AC_MSG_WARN(you may need to rename or link your version to /usr/bin/wish)
   AC_MSG_WARN("=============== Cannot Install ===============")
dnl   isip_cancel=true
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h strings.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_CHECK_FUNCS(strstr strtod strtol)

AC_caolan_CHECK_PACKAGE(sphere, sp_get_version, sp, sp/sphere.h)
if ( test -z "$sphere_LIBS" ); then
   AC_MSG_WARN("=============== No NIST SPHERE Support ===============")
   AC_MSG_WARN(NIST's libsp was not found on your system)
   AC_MSG_WARN(unable to use SPHERE format)
   AC_MSG_WARN(see http://www.nist.gov/speech/tools/index.htm)
   AC_MSG_WARN("=============== No NIST SPHERE Support ===============")
else
LIBSP="$sphere_LIBS"
LIBUTIL="-lutil"
fi
AC_SUBST(LIBSP)
AC_SUBST(LIBUTIL)

if ( test -z "$sphere_CFLAGS"); then
   AC_MSG_WARN("=============== No NIST SPHERE Support ===============")
   AC_MSG_WARN(NIST's's sphere header was not found on your system)
   AC_MSG_WARN(unable to use SPHERE format)
   AC_MSG_WARN(see http://www.nist.gov/speech/tools/index.htm)
   AC_MSG_WARN("=============== No NIST SPHERE Support ===============")
else
   INCLUDESP="$sphere_CFLAGS"
fi
AC_SUBST(INCLUDESP)

AC_caolan_CHECK_PACKAGE(audiofile, afInitFileFormat, audiofile, audiofile.h)

if ( test -z "$audiofile_LIBS" ); then
   AC_MSG_WARN("=============== No SGI Support ===============")
   AC_MSG_WARN(SGI's libaudiofile was not found on your system)
   AC_MSG_WARN(unable to use formats supported by SGI's audiofile)
   AC_MSG_WARN(see http://oss.sgi.com/projects/audiofile)
   AC_MSG_WARN("=============== No SGI Support ===============")
else
LIBAUDIOFILE="$audiofile_LIBS"
fi
AC_SUBST(LIBAUDIOFILE)

if ( test -z "$audiofile_CFLAGS"); then
   AC_MSG_WARN("=============== No SGI Support ===============")
   AC_MSG_WARN(SGI's audiofile header was not found on your system)
   AC_MSG_WARN(unable to use formats supported by SGI's audiofile)
   AC_MSG_WARN(see http://oss.sgi.com/projects/audiofile)
   AC_MSG_WARN("=============== No SGI Support ===============")
else
   INCLUDEAUDIOFILE="$audiofile_CFLAGS"
fi
AC_SUBST(INCLUDEAUDIOFILE)

AC_caolan_CHECK_PACKAGE(communicator, GalUtil_CPInfo1, Galaxy, galaxy/galaxy.h)

if ( test -z "$communicator_LIBS" ); then
   AC_MSG_WARN("=============== No Galaxy Support ===============")
   AC_MSG_WARN(Galaxy's libGalaxy was not found on your system)
   AC_MSG_WARN(unable to use formats supported by Galaxy Communicator)
   AC_MSG_WARN(see http://communicator.sourceforge.net/)
   AC_MSG_WARN("=============== No Galxy Support ===============")
else
LIBCOMM="$communicator_LIBS"
fi
AC_SUBST(LIBCOMM)

if ( test -z "$communicator_CFLAGS"); then
   AC_MSG_WARN("=============== No Galaxy Support ===============")
   AC_MSG_WARN(Galaxy's libGalaxy was not found on your system)
   AC_MSG_WARN(unable to use formats supported by Galaxy Communicator)
   AC_MSG_WARN(see http://communicator.sourceforge.net/)
   AC_MSG_WARN("=============== No Galxy Support ===============")
else
   INCLUDECOMM="$communicator_CFLAGS"
fi
AC_SUBST(INCLUDECOMM)

if (test -z "$communicator_HOME"); then
   AC_MSG_WARN("=============== No Galaxy Support ===============")
   AC_MSG_WARN(Galaxy's libGalaxy was not found on your system)
   AC_MSG_WARN(unable to use formats supported by Galaxy Communicator)
   AC_MSG_WARN(see http://communicator.sourceforge.net/)
   AC_MSG_WARN("=============== No Galxy Support ===============")
else
   GC_HOME="$communicator_HOME"
fi
AC_SUBST(GC_HOME)

AC_ARG_WITH([sctk],
    [  --with-sctk=DIR   build using DIR/include and DIR/lib],
    [
            if test -d $withval ; then
	    my_path="$PATH"
	    PATH="$PATH:$withval/bin"
	    AC_PATH_PROG(sctk_SUBS, sclite)
	    PATH="$my_path"
	    fi	
    ])


SCLITE="$sctk_SUBS"
AC_SUBST(SCLITE)
if ( test -z "$sctk_SUBS" ); then
   AC_MSG_WARN("=============== Warning ===============")
   AC_MSG_WARN(sclite was not found on your system)
   AC_MSG_WARN(for more information see http://www.itl.nist.gov/iaui/894.01)
   AC_MSG_WARN(or download from ftp://jaguar.ncsl.nist.gov/pub/sctk-1.2.tar.Z)
   AC_MSG_WARN(this package is required to run isip_eval utility)
   AC_MSG_WARN("=============== Warning ===============")
fi

AC_caolan_CHECK_PACKAGE(expat, XML_ParserCreate, expat, expat.h)

if ( test -z "$expat_LIBS" ); then
   AC_MSG_WARN("=============== No Expat Support ===============")
   AC_MSG_WARN(Expat library libexpat was not found on your system)
   AC_MSG_WARN(unable to use XML format)
   AC_MSG_WARN(see http://sourceforge.net/projects/expat/)
   AC_MSG_WARN("=============== No Expat Support ===============")
else
LIBEXPAT="$expat_LIBS"
fi

AC_SUBST(LIBEXPAT)

if ( test -z "$expat_CFLAGS"); then
   AC_MSG_WARN("=============== No Expat Support ===============")
   AC_MSG_WARN(Expat header file was not found on your system)
   AC_MSG_WARN(unable to use XML format)
   AC_MSG_WARN(see http://sourceforge.net/projects/expat/)
   AC_MSG_WARN("=============== No Expat Support ===============")
else
   INCLUDEEXPAT="$expat_CFLAGS"
fi
AC_SUBST(INCLUDEEXPAT)

AC_caolan_CHECK_PACKAGE_HEADER_AS_FILE(expatimpl, ExpatImpl.h)

if ( test -z "$expatimpl_CFLAGS"); then
   AC_MSG_WARN("=============== No ExpatImpl Support ===============")
   AC_MSG_WARN(ExpatImpl header file was not found on your system)
   AC_MSG_WARN(unable to use XML format)
   AC_MSG_WARN(see http://www.codeproject.com/soap/expatimpl.asp)
   AC_MSG_WARN("=============== No ExpatImpl Support ===============")
else
   INCLUDEEXPATIMPL="$expatimpl_CFLAGS"
fi
AC_SUBST(INCLUDEEXPATIMPL)

dnl if an absolute path is not given, then prepend the current working 
dnl directory. this takes care of problems with . and ..
dnl
if [ test -z $prefix ]; then
   prefix=`pwd`
fi
if [ test "$prefix" = "." ]; then
   prefix=`pwd`
else
case "$prefix" in
NONE) prefix=`pwd` ;;
/*) ;;
\\*) ;;
*) prefix=`pwd`/"$prefix" ;;
esac
fi

dnl for each utility in the software, output compilation status
dnl if a required program is missing, output "no compilation",
dnl otherwise, output "compilation"
AC_MSG_RESULT(===================================================)
AC_MSG_RESULT(utility name   		                 compilation)	

if ( test -n "$PERL" ); then 
   AC_MSG_RESULT(isip_dmalloc_run                            yes    )
   AC_MSG_RESULT(isip_commit_prep                            yes    )
   AC_MSG_RESULT(isip_log_accum                              yes    )
   AC_MSG_RESULT(isip_demo                                   yes    )
   AC_MSG_RESULT(isip_fmcover                                yes    )
else
   AC_MSG_RESULT(isip_dmalloc_run                           no perl )
   AC_MSG_RESULT(isip_commit_prep                           no perl )
   AC_MSG_RESULT(isip_log_accum                             no perl )
   AC_MSG_RESULT(isip_demo                                  no perl )
   AC_MSG_RESULT(isip_fmcover                               no perl )
fi

if ( test -n "$SH" ); then 
   AC_MSG_RESULT(isip_chmod                                  yes    )
   AC_MSG_RESULT(isip_ci                                     yes    )
   AC_MSG_RESULT(isip_co                                     yes    )
   AC_MSG_RESULT(isip_e                                      yes    )
   AC_MSG_RESULT(isip_gimp                                   yes    )
   AC_MSG_RESULT(isip_netscape                               yes    )
   AC_MSG_RESULT(isip_openscan                               yes    )
   AC_MSG_RESULT(isip_set_x_info                             yes    )
   AC_MSG_RESULT(isip_startxgo                               yes    )
   AC_MSG_RESULT(isip_xterm                                  yes    )
   AC_MSG_RESULT(isip_function_help_0                        yes    )
   AC_MSG_RESULT(isip_window_name_0                          yes    )
else
   AC_MSG_RESULT(isip_chmod                                 no sh   )
   AC_MSG_RESULT(isip_ci                                    no sh   )
   AC_MSG_RESULT(isip_co                                    no sh   )
   AC_MSG_RESULT(isip_e                                     no sh   )
   AC_MSG_RESULT(isip_gimp                                  no sh   )
   AC_MSG_RESULT(isip_netscape                              no sh   )
   AC_MSG_RESULT(isip_openscan                              no sh   )
   AC_MSG_RESULT(isip_set_x_info                            no sh   )
   AC_MSG_RESULT(isip_startxgo                              no sh   )
   AC_MSG_RESULT(isip_xterm                                 no sh   )
   AC_MSG_RESULT(isip_function_help_0                       no sh   )
   AC_MSG_RESULT(isip_window_name_0                         no sh   )
fi

if ( test -n "$PERL" ); then 
   if ( test -n "$SH" ); then 
      AC_MSG_RESULT(isip_change_xterm_title                     yes    )
      AC_MSG_RESULT(isip_check_code                             yes    )
   else
      AC_MSG_RESULT(isip_change_xterm_title                   no sh    )
      AC_MSG_RESULT(isip_check_code                           no sh    )
   fi
else
      AC_MSG_RESULT(isip_change_xterm_title                   no perl  )
      AC_MSG_RESULT(isip_check_code                           no_perl  )
fi

if ( test -n "$TCL" ); then 
   AC_MSG_RESULT(isip_tkdiff                                 yes    )
else
   AC_MSG_RESULT(isip_tkdiff                              no tcl/tk )
fi

if ( test "$GCC" = "yes"); then 
   AC_MSG_RESULT(isip_diagnose_class                         yes    )
   if ( test "ISIP_MAKE" != ""); then 	
      AC_MSG_RESULT(isip_make_sof                               yes    )
      AC_MSG_RESULT(isip_recognize                              yes    )
      AC_MSG_RESULT(isip_transform                              yes    )
      AC_MSG_RESULT(isip_capture_documentation                  yes    )
   else
      AC_MSG_RESULT(isip_make_sof                        no gmake/make )
      AC_MSG_RESULT(isip_recognize                       no gmake/make )
      AC_MSG_RESULT(isip_transform                       no gmake/make )
      AC_MSG_RESULT(isip_capture_documentation           no gmake/make )
   fi
else
   AC_MSG_RESULT(isip_diagnose_class                            no  )
   AC_MSG_RESULT(isip_make_sof                                  no  )
   AC_MSG_RESULT(isip_recognize                                 no  )
   AC_MSG_RESULT(isip_transform                                 no  )
   AC_MSG_RESULT(isip_capture_documentation                     no  )
fi

if ( test -n "$JAVA" ); then 
   if ( test -n "$JAVAC" ); then 
   	if ( test -n "$JAR" ); then
 	   if ( test -n "$PERL" ); then 
              if ( test -n "$SH" ); then

   AC_MSG_RESULT(isip_transform_builder                      yes    )
               else
   AC_MSG_RESULT(isip_transform_builder                         no sh  )  
	      fi
	   else
   AC_MSG_RESULT(isip_transform_builder                         no perl)
	   fi
	else
   AC_MSG_RESULT(isip_transform_builder                        no jar  )
	fi
   else
   AC_MSG_RESULT(isip_transform_builder                        no javac)
   fi
else   	
   AC_MSG_RESULT(isip_transform_builder                        no java )
fi
AC_MSG_RESULT(===================================================)
	
dnl set environment variable and substitution string ISIP
dnl issue warning if already set and not to current directory
dnl 
if ( test -n "$ISIP" ); then
 if [ test "$ISIP" != `pwd` ]; then
   AC_MSG_RESULT(===================================================)
   AC_MSG_RESULT(Environment variable \$ISIP is already defined as)
   AC_MSG_RESULT($ISIP)
   AC_MSG_RESULT(This may interfere with the rest of the install)
   AC_MSG_RESULT(which will force \$ISIP to be set to)
   AC_MSG_RESULT(`pwd`)
   AC_MSG_RESULT(Be sure to source ISIP_BASE_ENV.sh when doing makes)
   AC_MSG_RESULT(at other levels in the directory structure.)
   AC_MSG_RESULT(===================================================)
 fi
fi
ISIP=`pwd`
AC_SUBST(ISIP)

dnl if a required program is missing, echo an error message
dnl otherwise, output the proper files for making the system
dnl
if ( test -z "$isip_cancel" ); then
   AC_OUTPUT(GNUmakefile ISIP_BASE_ENV.sh class/system/Integral/IntegralConfigure.h scripts/make/compile_configure.make)
if ( test -n "$ISIP_DEVEL" ); then
 if ( test "$ISIP_DEVEL" != "$prefix" ); then
   AC_MSG_RESULT(===================================================)
   AC_MSG_RESULT(Environment variable \$ISIP_DEVEL is defined as)
   AC_MSG_RESULT($ISIP_DEVEL)
   AC_MSG_RESULT(This may interfere with the rest of the install)
   AC_MSG_RESULT(which assumes that \$ISIP_DEVEL is set to)
   AC_MSG_RESULT($prefix)
   AC_MSG_RESULT(Be sure to source ISIP_BASE_ENV.sh when doing makes)
   AC_MSG_RESULT(at other levels in the directory structure.)
 fi
fi
   AC_MSG_RESULT(=============================================)
   AC_MSG_RESULT(Use \"$ISIP_MAKE\" as your make program and type:)
   AC_MSG_RESULT(source ISIP_BASE_ENV.sh)
   AC_MSG_RESULT($ISIP_MAKE depend)
   AC_MSG_RESULT(to compile the programs and check dependencies)
   AC_MSG_RESULT($ISIP_MAKE install)
   AC_MSG_RESULT(to install everything to the correct directories)
   AC_MSG_RESULT($ISIP_MAKE test)
   AC_MSG_RESULT(to run the diagnostic suite)
   AC_MSG_RESULT(=============================================)
else
   AC_MSG_RESULT(===================================================)
   AC_MSG_RESULT(Required features missing.)
   AC_MSG_RESULT(Read warning messages above.)
   AC_MSG_ERROR(Unable to continue installation.)
   AC_MSG_RESULT(===================================================)
fi
