#----------------------------------------------------------------
#
#  configure.ac
#
#  Autoconf source file for Boundary Element MMTL (bem).
#  This file, along with aclocal, autoconf, Makefile.am,
#  and automake can produce a highly functional configuration
#  script and Makefile.
#
#  Sharon Zahn, Bob Techentin
#  October 3, 2002
#
#  Copyright 2002 (C) Mayo Foundation.  All Rights Reserved
#
#----------------------------------------------------------------


#----------------------------------------------------------------
#  Declare the package name and version.
#  All the bouquets and brickbats go to Sharon. :-)
#----------------------------------------------------------------
AC_INIT([CALCCAP], [1.0], [zahn.sharon@mayo.edu])

#----------------------------------------------------------------
#  Give autoconf a point of reference, and tell it that
#  we're going to use automake later.
#----------------------------------------------------------------
AC_CONFIG_SRCDIR(src/calcCAP.cpp)
AM_INIT_AUTOMAKE

#----------------------------------------------------------------
#  Check platform name so we can specify particular
#  compilers and switches that we like.
#----------------------------------------------------------------
AC_CANONICAL_HOST
case "${host}" in
*hpux11*)
	CC=cc
	CXX=aCC
	CXXFLAGS="+O3 -DFORTRAN_UNDERBARS"
	F77=f90
	FFLAGS="+ppu -O2"
 ;;
*cygwin*)
	#  On Windows using Cygwin
	#  Use the GNU compilers, but not the cygwin.dll,
	#  which would infect our code with the GPL.
	#  Note that we must also specify the gcc compiler,
	#  as the -mno-cygwin switch makes it behave differently
	#  for many of the configure tests.
	CC="gcc -mno-cygwin"
	CXX="g++ -mno-cygwin"
	F77="g77 -mno-cygwin"
	AM_CXXFLAGS="-DFORTRAN_UNDERBARS"
;;
esac



#----------------------------------------------------------------
#  Portabiliy checks were, for the most part, generated by
#  an initial 'autoscan' of the source code.  The configure
#  script checks the system for features and generates the
#  compile commands with flags like -DHAVE_STDLIB_H=1, but
#  the nmmtl source code does not (as of this writing) take
#  advantage of those flags.
#----------------------------------------------------------------

#----------------------------------------------------------------
# Checks for programs.
#----------------------------------------------------------------
AC_PROG_CXX
AC_PROG_CC
AC_PROG_F77

#----------------------------------------------------------------
# Checks for header files.
#----------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h float.h limits.h malloc.h stddef.h stdlib.h string.h sys/times.h unistd.h])

#----------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
#----------------------------------------------------------------
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_STRUCT_TM

#----------------------------------------------------------------
# Checks for library functions.
#----------------------------------------------------------------
AC_FUNC_GETGROUPS
AC_FUNC_MALLOC
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd pow rmdir sqrt strchr strdup strrchr strstr])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
