1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2014 Taco Hoekwater <taco@metatex.org>
4 dnl Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
6 dnl This file is free software; the copyright holder
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
10 m4_include([version.ac])[] dnl define gmp_version
11 AC_INIT([gmp (TeX Live)], gmp_version, [tex-k@tug.org])
13 AC_CONFIG_SRCDIR([gmp-src/gmp-impl.h])
14 AC_CONFIG_AUX_DIR([../../build-aux])
15 AC_CONFIG_MACRO_DIRS([../../m4 m4])
23 KPSE_COMPILER_VISIBILITY
26 CFLAGS="$CFLAGS -DNO_ASM"
28 AC_CONFIG_HEADERS([config.h])
32 AC_CHECK_FUNCS([memset raise strchr])
35 GMP_C_ATTRIBUTE_MALLOC
37 GMP_C_ATTRIBUTE_NORETURN
39 AC_CHECK_TYPE([long long])
41 AC_CHECK_SIZEOF([void *])
42 AC_CHECK_SIZEOF([unsigned short])
43 AC_CHECK_SIZEOF([unsigned])
44 AC_CHECK_SIZEOF([unsigned long])
45 AC_CHECK_SIZEOF([unsigned long long])
48 [x86_64-*-cygwin], [gmp_limb=longlong], [dnl
49 AS_IF([test $ac_cv_sizeof_void_p -gt $ac_cv_sizeof_unsigned_long], [dnl
50 AS_IF([test $ac_cv_sizeof_void_p -le $ac_cv_sizeof_unsigned_long_long],
57 [DEFN_LONG_LONG_LIMB="@%:@define _LONG_LONG_LIMB 1"
58 gmp_limb_size=$ac_cv_sizeof_unsigned_long_long],
59 [DEFN_LONG_LONG_LIMB="/* @%:@undef _LONG_LONG_LIMB */"
60 gmp_limb_size=$ac_cv_sizeof_unsigned_long])
61 AC_SUBST([DEFN_LONG_LONG_LIMB])
62 AC_SUBST([GMP_LIMB_BITS], [`expr 8 \* $gmp_limb_size`])
64 AC_SUBST([GMP_NAIL_BITS], 0)
68 dnl Create a temporary file gmp-tmp.h to be used instead of gmp.h, since that
69 dnl file isn't generated until the end of the configure.
70 AC_DEFUN([KPSE_GMP_H], [dnl
71 cat >gmp-tmp.h <<KPSE_EOF
72 #define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
73 #define GMP_NAIL_BITS $GMP_NAIL_BITS
74 #define GMP_LIMB_BITS 123
76 #include "$srcdir/gmp-src/gmp-h.in"
78 AC_CONFIG_COMMANDS_POST([rm -rf gmp-tmp.h])
82 AC_CHECK_SIZEOF([mp_limb_t], , [#include "gmp-tmp.h"])
90 if test "x$enable_build" != xno || test -f config.force; then
93 [unknown], [AC_MSG_ERROR([Sorry, no suitable limb size])])
95 if test "x$ac_cv_sizeof_mp_limb_t" != "x$gmp_limb_size"; then
96 AC_MSG_ERROR([Oops, mp_limb_t doesn't seem to work])
99 echo timestamp >config.force
102 AM_CONDITIONAL([build], [test "x$enable_build" != xno])
104 AC_SUBST([GMP_TREE], [gmp-src])
106 AC_SUBST([HAVE_HOST_CPU_FAMILY_power], 0)
107 AC_SUBST([HAVE_HOST_CPU_FAMILY_powerpc], 0)
108 AC_SUBST([DEFN_LONG_LONG_LIMB])
109 AC_SUBST([LIBGMP_DLL], 0)
111 AC_CONFIG_FILES([Makefile include/Makefile gmp.h:gmp-src/gmp-h.in])
113 dnl The subdirectory native must be configured for the build system.
114 KPSE_NATIVE_SUBDIRS([native])