dnl Meschach autoconf script
dnl Copyright (C) Brook Milligan and David Stewart, 1993, 2002
dnl $Id: configure.in,v 1.3 1994/03/08 05:41:32 des Exp $
dnl
dnl I want to use this to see if the compiler can be made ANSI C compatible
dnl AC_PROG_CC_STDC
dnl Brook Milligan's prototype check
dnl Check if $(CC) supports prototypes
define(LOCAL_HAVE_PROTOTYPES,
[AC_TRY_COMPILE([function prototypes], ,
[extern int test (int i, double x);],
AC_DEFINE(HAVE_PROTOTYPES))])dnl
dnl
dnl Brook Milligan's compiler check
dnl Check for the sun ansi c compiler, acc
define(LOCAL_PROG_ACC,
[AC_BEFORE([$0], [AC_PROG_CPP])AC_PROVIDE([$0])dnl
AC_PROGRAM_CHECK(CC, acc, acc, "")])dnl
dnl David Stewart's modified compiler check
define(LOCAL_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])AC_PROVIDE([$0])dnl
AC_PROGRAM_CHECK(CC, acc, acc, cc)])dnl
dnl
dnl
dnl
dnl ----------------------------------------------------------------------
dnl Start of configure.in proper
dnl ----------------------------------------------------------------------
AC_INIT(err.c)
AC_CONFIG_HEADER(machine.h)
PROGS=""
AC_SUBST(PROGS)dnl
LOCAL_PROG_ACC
AC_PROGRAM_CHECK(CC, cc, cc, gcc)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CC_STDC
AC_AIX
AC_MINIX
AC_ISC_POSIX
dnl
dnl Brook Milligan's prototype check
dnl Check if $(CC) supports prototypes in function declarations and structures
define(LOCAL_HAVE_PROTOTYPES,
[AC_TRY_COMPILE([function prototypes], ,
[extern int test (int i, double x);],
AC_DEFINE(HAVE_PROTOTYPES))
AC_TRY_COMPILE([function prototypes in structures], ,
[struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};],
AC_DEFINE(HAVE_PROTOTYPES_IN_STRUCT))])dnl
dnl
AC_PROG_RANLIB
AC_HAVE_HEADERS(memory.h)
AC_STDC_HEADERS
AC_HEADER_CHECK(complex.h, AC_DEFINE(HAVE_COMPLEX_H),)
AC_HEADER_CHECK(malloc.h, AC_DEFINE(HAVE_MALLOC_H),)
AC_HEADER_CHECK(varargs.h, AC_DEFINE(VARARGS),)
AC_DEFINE(NOT_SEGMENTED)
AC_SIZE_T
AC_CONST
AC_WORDS_BIGENDIAN
AC_ARG_WITH(complex, AC_DEFINE(COMPLEX))
AC_ARG_WITH(sparse, AC_DEFINE(SPARSE))
AC_ARG_WITH(all, AC_DEFINE(COMPLEX))
AC_ARG_WITH(all, AC_DEFINE(SPARSE))
AC_ARG_WITH(unroll, AC_DEFINE(VUNROLL))
AC_ARG_WITH(munroll, AC_DEFINE(MUNROLL))
AC_ARG_WITH(segmem, AC_DEFINE(SEGMENTED))
AC_ARG_WITH(float, AC_DEFINE(REAL_FLT))
AC_ARG_WITH(double, AC_DEFINE(REAL_DBL))
LIBS="$LIBS -lm"
AC_TRY_COMPILE([u_int],[#include <stdio.h>
#ifdef __STDC__
#include <stdlib.h>
#endif],[u_int i; i = 1;],AC_DEFINE(U_INT_DEF))
echo 'computing machine epsilon(s)'
echo $CC -o macheps dmacheps.c
$CC -o macheps dmacheps.c
AC_DEFINE_UNQUOTED(D_MACHEPS,`macheps`)
echo $CC -o macheps fmacheps.c
$CC -o macheps fmacheps.c
AC_DEFINE_UNQUOTED(F_MACHEPS,`macheps`)
echo computing M_MAX_INT
echo $CC -o maxint maxint.c
$CC -o maxint maxint.c
AC_DEFINE_UNQUOTED(M_MAX_INT,`maxint`)
echo checking char '\\0' vs. float zeros
AC_PROGRAM_EGREP(yes,[main() {
    char	*cp = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
    double	*dp;
    dp = (double *)cp;
    if ( *dp == 0.0 ) printf("yes\n");  }
],AC_DEFINE(CHAR0ISDBL0))
AC_HAVE_FUNCS(bcopy bzero)
LOCAL_HAVE_PROTOTYPES
AC_CONFIG_FILES([makefile make.mex])
AC_OUTPUT
echo "Extensions to basic version: use configure --with-opt1 --with-opt2"
echo "  Option:"
echo "    --with-complex     incorporate complex functions"
echo "    --with-sparse      incorporate sparse matrix functions"
echo "    --with-all         both of the above"
echo "    --with-unroll      unroll low level loops on vectors"
echo "    --with-munroll     unroll low level loops on matrices"
echo "    --with-float       single precision"
echo "    --with-double      double precision (default)"
echo "Re-run configure with these options if you want them"
# configure.in copyright (C) Brook Milligan and David Stewart, 1993, 2002
