configure.in   [plain text]


dnl configure.in for libgfor
dnl Copyright Free Software Foundation
dnl Released under the LGPL

dnl The rest of gcc uses autoconf 2.13, but we really need more, hence:
AC_PREREQ(2.54)

AC_INIT([GNU Fortran Runtime Library], 0.2,,[libgfortran])
AM_INIT_AUTOMAKE()
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

AC_SUBST(enable_shared)
AC_SUBST(enable_static)

# check for compiler
AC_PROG_CC
dnl Add -Wall if using gcc
if test "x$GCC" = "xyes"; then
 CFLAGS="$CFLAGS -Wall"
fi

# We need gfortran to compile parts of the library
# We can't use AC_PROG_F77 because it expects a fully working gfortran. 
#AC_PROG_F77(gfortran)
F77="$GFORTRAN"
AC_PROG_F77(gfortran)
FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring"

AC_FUNC_MMAP
AC_TYPE_OFF_T

# Check for install
AC_PROG_INSTALL

# check header files
AC_STDC_HEADERS
AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h)
AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
# Check for complex math functions
AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])

# Check for complex math functions in -lmx also
AC_CHECK_LIB([mx],[csin],[need_math="no"],[need_math="yes"])

dnl Checks for library functions.
AC_CHECK_FUNCS(getrusage times)

# Let the user override this
AC_ARG_ENABLE(cmath,
	AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
    [need_math=$enableval])
if test "$need_math" = "yes"; then
	AC_MSG_NOTICE([Including complex math functions in libgfor]);
  extra_math_obj='$(gfor_cmath_obj)'
fi

AC_SUBST([MATH_OBJ],["$extra_math_obj"])

dnl The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
dnl for struct timezone, as you might think.  We also need to check how
dnl to call gettimeofday if we have it.
LIBGFOR_GETTIMEOFDAY

dnl These should be inherited in the recursive make, but ensure they are
dnl defined:
test "$AR" || AR=ar
AC_SUBST(AR)
if test "$RANLIB"; then :
  AC_SUBST(RANLIB)
else
  AC_PROG_RANLIB
fi

dnl Don't pull is system libtool.m4, it conflicts with the gcc version.
dnl if test "$LIBTOOL"; then :
dnl   AC_SUBST(LIBTOOL)
dnl else
dnl   AC_PROG_LIBTOOL
dnl fi
AM_PROG_LIBTOOL

AC_PROG_MAKE_SET
AC_PROG_INSTALL

AC_OUTPUT(Makefile)