
# Process this file with autoconf to produce a configure script.

dnl package-name version-number bugs-to:
AC_INIT(laue, 7.0, ) 

dnl package-name version-number, the gzip'd tar file is named
dnl package-version.tar.gz.  
AM_INIT_AUTOMAKE(laue, 7.0)

AC_CONFIG_SRCDIR([src/lauegen.f])


AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_FC
AC_PROG_CC
AC_PROG_CXX
dnlAC_PROG_LIBTOOL
AC_PROG_INSTALL
#AC_PROG_RANLIB

AC_ARG_ENABLE(debug,
  AC_HELP_STRING( [--enable-debug], [ enable debugging options ] ),
  [ac_cv_enable_debug=yes ],
  [ac_cv_enable_debug=no ] )

AC_ARG_WITH(ccp4,
  AC_HELP_STRING( [--with-ccp4=PFX], [ set ccp4 libraries prefix] ),
  [if test "x${withval}" != xyes; then
   ccp4_prefix=$withval
   else
AC_MSG_ERROR([incorrect use of --with-ccp4])
   fi ],
   ccp4_prefix=""
   )

_AC_F77_NAME_MANGLING
dnl The alternatives in the cases here could be left over from a previous
dnl config.cache -- autoconf changed.
echo "$ac_cv_f77_mangling"--
case "$ac_cv_f77_mangling" in
  "upper case, no underscore, no extra underscore" | \
  "upper case, no underscores")
    AC_DEFINE(LINKTYP, 2) ;;
  "lower case, no underscore, no extra underscore" | \
  "lower case, no underscores" )
    AC_DEFINE(LINKTYP, 3) ;;
  "lower case, underscore, no extra underscore" | \
  "lower case, single underscores")
    AC_DEFINE(LINKTYP, 1) ;;
  "lower case, underscore, extra underscore" | \
  "lower case, double underscores")
    AC_DEFINE(LINKTYP, 1)
    # We aren't set up for f2c-style double underscoring.
    if test "$G77" = yes; then
      AC_MSG_WARN([ 
*** You need to use option -fno-second-underscore with g77
*** to compile Fortran to link with xdl_view.
])
      FFLAGS="-fno-second-underscore $FFLAGS"
    else
      AC_MSG_WARN([
*** Your Fortran compiler looks like f2c.
*** You can't currently link xdl_view routines with Fortran compiled with it.
*** You could use g77 with option `'-fno-second-underscore' instead.])
    fi ;;
  *)
    AC_MSG_ERROR([Unknown sort of Fortran name mangling]) ;;
esac
AC_CXX_LIBRARY_LDFLAGS
CCP4_CHECK_LIB
AC_LANG_PUSH(C)
AC_PATH_XTRA
AC_LANG_POP
CCP4_CHECK_XDL_VIEW

case "$F77" in
  gfortran* ) FFLAGS="$FFLAGS -fno-range-check" ;;
  esac

AC_PROG_LIBTOOL

AC_SUBST(AR_FLAGS)

AM_CONDITIONAL(DEBUG, test "$ac_cv_enable_debug" = yes)
AM_CONDITIONAL(AMDEP, test "x$enable_dependency_tracking" != xno)

AC_CONFIG_FILES([Makefile
                 lib/src/Makefile
                 lib/dat/Makefile
                 src/Makefile
                 gnom/src/Makefile
                 cmd/Makefile
                 dl/Makefile])

AC_OUTPUT
