dnl Process this file with autoconf to produce a configure script. AC_INIT mpfr_version=`cat $srcdir/VERSION` AM_INIT_AUTOMAKE(mpfr, $mpfr_version, [no-define]) AC_ARG_WITH(gmp_include, [ --with-gmp-include=DIR GMP include directory ], with_gmp_include=$withval) AC_ARG_WITH(gmp_lib, [ --with-gmp-lib=DIR GMP lib directory ], with_gmp_lib=$withval) AC_ARG_WITH(gmp_build, [ --with-gmp-build=DIR GMP source directory], with_gmp_include=$withval/ with_gmp_lib=$withval/.libs) AC_ARG_WITH(gmp, [ --with-gmp=DIR GMP install directory ], with_gmp_include=$withval/include with_gmp_lib=$withval/lib) AC_ARG_WITH(irix64, [ --with-irix64=on/off Irix 32/64 bits support ], with_irix64=$withval, with_irix64=off) AC_ARG_ENABLE(cache, [ --disable-cache Disable the cache of the global const ], , [enable_cache=yes]) AC_ARG_ENABLE(assert, AC_HELP_STRING(--enable-assert,enable ASSERT checking [[default=no]]), [case $enableval in yes|no|full) ;; *) AC_MSG_ERROR([bad value $enableval for --enable-assert: yes, no or full]) ;; esac], [enable_assert=no]) if test "$enable_assert" = "yes"; then AC_DEFINE([WANT_ASSERT],1) fi if test "$enable_assert" = "full"; then AC_DEFINE([WANT_ASSERT],1) AC_DEFINE([CHECK_AGAINST_SUB1],1) fi if test "$enable_cache" = "no"; then AC_DEFINE([MPFR_NO_CACHE],1) fi test_CFLAGS=${CFLAGS+set} dnl Same as in gmp acinclude.m4, though currently we're using the normal dnl config.sub, so the additional exact cpu types don't arise. define(X86_PATTERN, [[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]]) dnl Checks for programs. AC_PROG_CC AC_PROG_RANLIB AC_CANONICAL_HOST AC_CHECK_OS AC_CHECK_MACHTYPE dnl Check if compiler is ICC, and if such a case, disable GCC dnl And add some specific flags. dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings). dnl Add -long_double flags ? AC_MSG_CHECKING(for ICC) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if !defined(__ICC) # error "ICC Not Found" #endif ]], [[]])],[AC_MSG_RESULT(yes) GCC= CFLAGS="-pc64 -fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" ],[AC_MSG_RESULT(no)]) dnl If compiler is gcc, then use some specific flags. dnl But don't touch user specified flags. if test "$test_CFLAGS" != set && test -n "$GCC"; then CFLAGS="-Wall -Wmissing-prototypes $CFLAGS" fi dnl Set the OS-dependent flags. case $OS_TYPE in HP-UX*) if test -n "$GCC"; then LDFLAGS="-Xlinker +allowunsats $LDFLAGS" fi ;; IRIX64) if [[ "$irix64" = "on" ]]; then CFLAGS ="-mabi=64 $CFLAGS" else CFLAGS ="-mabi=n32 $CFLAGS" fi ;; esac dnl Tests concerning the include directories. if test -d "$with_gmp_include"; then CPPFLAGS="$CPPFLAGS -I$with_gmp_include" else with_gmp_include= fi AC_C_CONST AC_C_VOLATILE MPFR_CONFIGS dnl Check for GMP AC_MSG_CHECKING(for gmp.h) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "gmp.h" ]], [[]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) AC_MSG_ERROR([gmp.h may be missing ${with_gmp_include:+in $with_gmp_include}]) ]) AC_MSG_CHECKING(for recent GMP) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "gmp.h" #if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410) # error "min GMP version is 4.1.0" #endif ]], [[]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) AC_MSG_ERROR([GMP 4.1.0 min required]) ]) dnl Check if we can use internal header files of GMP. AC_MSG_CHECKING(for gmp internal files) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" ]], [[]])],[AC_MSG_RESULT(yes) AC_DEFINE([MPFR_HAVE_GMP_IMPL],1) dnl Check for valid BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB AC_MSG_CHECKING(for valid BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB) AC_TRY_RUN([ #include #include "gmp.h" #include "gmp-impl.h" int main() { return BITS_PER_MP_LIMB == BYTES_PER_MP_LIMB * CHAR_BIT && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; } ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_MSG_ERROR([BITS_PER_MP_LIMB or BYTES_PER_MP_LIMB are incorrect. You probably need to change some of the GMP or MPFR compile options: MPFR doesn't currently do as many architecture checks as GMP, so the default target architecture may be different, hence the error.])], AC_MSG_RESULT([can't test]) ) ],[AC_MSG_RESULT(no) AC_FUNC_ALLOCA ]) # Recent autoconf creates AC_DEFINEs of PACKAGE_VERSION etc, unfortunately # those -D defines in $DEFS conflict with the same defines in config.h from # GMP. Unless or until autoconf gives us a better way for two closely # related packages to cooperate, use this hack to get rid of them from $DEFS # here. # if test -f confdefs.h; then sed '/#define PACKAGE_/d' confdefs.tmp mv confdefs.tmp confdefs.h fi AC_MY_LIBS($with_gmp_lib, gmp) dnl Check for corresponding 'gmp.h' and libgmp.a AC_MSG_CHECKING(if gmp.h version and libgmp version are the same) AC_TRY_RUN([ #include #include #include "gmp.h" int main() { char buffer[100]; if (__GNU_MP_VERSION_PATCHLEVEL != 0) sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); else sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); printf ("(%s/%s) ", buffer, gmp_version); return (strcmp (buffer, gmp_version) != 0) ? 1 : 0; } ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_MSG_ERROR(['gmp.h' and 'libgmp' have different versions! you have to properly reinstall GMP.])], AC_MSG_RESULT([can't test]) ) AC_SUBST(INCLUDES) AC_SUBST(LDADD) AC_SUBST(LDFLAGS) AC_SUBST(CFLAGS) AC_CONFIG_FILES([Makefile tests/Makefile]) AC_OUTPUT dnl NEWS README AUTHORS Changelog