dnl configure.in for GMPlite
dnl
dnl           Author: Erick Gallesio [eg@unice.fr]
dnl    Creation date:  4-Jul-2003 16:56 (eg) 
dnl Last file update:  7-Jul-2004 22:38 (eg)


AC_INIT(gmp-impl.h)
dnl AC_PREREQ(2.59)

AM_INIT_AUTOMAKE(gmplite, 1.0)
AM_CONFIG_HEADER(config.h)
AC_PROG_MAKE_SET

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

dnl Trick automake into thinking we've run AM_C_PROTOTYPES which it wants
dnl for ansi2knr, and instead use our own test.  (It's only a warning
dnl automake prints, but it's good to suppress it.)
ifelse(0,1,[
AM_C_PROTOTYPES
])

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memset)

dnl
dnl define some constants used in gmp.h
dnl

case `uname -m` in
  i*86) 
     BITS_PER_MP_LIMB=32
     BYTES_PER_MP_LIMB=4
     DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */"
     HAVE_HOST_CPU_FAMILY_power=0
     HAVE_HOST_CPU_FAMILY_powerpc=0
     DEFINE_ARCH=
     LIBGMP_DLL=0
     GMP_NAIL_BITS=0
     ;;
  i86*) 
     BITS_PER_MP_LIMB=32
     BYTES_PER_MP_LIMB=4
     DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */"
     HAVE_HOST_CPU_FAMILY_power=0
     HAVE_HOST_CPU_FAMILY_powerpc=0
     DEFINE_ARCH=
     LIBGMP_DLL=0
     GMP_NAIL_BITS=0
     ;;
  Power\ Macintosh) 
     BITS_PER_MP_LIMB=32
     BYTES_PER_MP_LIMB=4
     DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */"
     HAVE_HOST_CPU_FAMILY_power=0
     HAVE_HOST_CPU_FAMILY_powerpc=1
     DEFINE_ARCH=
     LIBGMP_DLL=0
     GMP_NAIL_BITS=0
     ;;
  sun4u) 
     BITS_PER_MP_LIMB=32
     BYTES_PER_MP_LIMB=4
     DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */"
     HAVE_HOST_CPU_FAMILY_sparc=1
     DEFINE_ARCH=-D__sparc_v8__
     LIBGMP_DLL=0
     GMP_NAIL_BITS=0
     ;;     
  *) echo "**********"
     echo "
Your architecture is not known by GMP light. You ave 2 solution
  - Use the official gmp package and install it. One this is done 
    you just need to reconfigure STklos et voila, it should work.
    In this case, can you send the file gmp.h you obtained to 
    support@stklos.net
  - try to hack some constants in the gmp/configure.in for your 
    architecture. When it works, send these values to 
    support@stklos.net
" 
echo > NOGMP;;
esac

AC_SUBST(BITS_PER_MP_LIMB)
AC_SUBST(BYTES_PER_MP_LIMB)
AC_SUBST(DEFN_LONG_LONG_LIMB)
AC_SUBST(HAVE_HOST_CPU_FAMILY_power)
AC_SUBST(HAVE_HOST_CPU_FAMILY_powerpc)
AC_SUBST(DEFINE_ARCH)
AC_SUBST(GMP_NAIL_BITS) 
AC_SUBST(LIBGMP_DLL)

AC_OUTPUT(Makefile gmp-stklos.h)
