beta-0.89.2
[luatex.git] / source / libs / gmp / configure.ac
blob2b8422223485048a8bbccfe8551a33852301bd91
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl   Copyright (C) 2014 Taco Hoekwater <taco@metatex.org>
4 dnl   Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
5 dnl
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.
9 dnl
10 m4_include([version.ac])[] dnl define gmp_version
11 AC_INIT([gmp (TeX Live)], gmp_version, [tex-k@tug.org])
12 AC_PREREQ([2.65])
13 AC_CONFIG_SRCDIR([gmp-src/gmp-impl.h])
14 AC_CONFIG_AUX_DIR([../../build-aux])
15 AC_CONFIG_MACRO_DIRS([../../m4 m4])
17 KPSE_BASIC([gmp])
19 AC_PROG_CC
20 AC_PROG_RANLIB
21 AC_PROG_LN_S
23 KPSE_COMPILER_VISIBILITY
25 AC_PROG_CC_C99
26 CFLAGS="$CFLAGS -DNO_ASM"
28 AC_CONFIG_HEADERS([config.h])
30 KPSE_CANONICAL_HOST
32 AC_CHECK_FUNCS([memset raise strchr])
34 GMP_C_ATTRIBUTE_CONST
35 GMP_C_ATTRIBUTE_MALLOC
36 GMP_C_ATTRIBUTE_MODE
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])
47 AS_CASE([$host],
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],
51       [gmp_limb=longlong],
52       [gmp_limb=unknown])
55 AS_CASE([$gmp_limb],
56         [longlong],
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)
66 dnl  KPSE_GMP_H
67 dnl  ----------
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
75 $DEFN_LONG_LONG_LIMB
76 #include "$srcdir/gmp-src/gmp-h.in"
77 KPSE_EOF
78 AC_CONFIG_COMMANDS_POST([rm -rf gmp-tmp.h])
79 ]) # KPSE_GMP_H
80 KPSE_GMP_H
82 AC_CHECK_SIZEOF([mp_limb_t], , [#include "gmp-tmp.h"])
84 GMP_H_EXTERN_INLINE
86 GMP_FUNC_ALLOCA
88 GMP_C_DOUBLE_FORMAT
90 if test "x$enable_build" != xno || test -f config.force; then
92 AS_CASE([$gmp_limb],
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])
116 AC_OUTPUT