beta-0.89.2
[luatex.git] / source / libs / gmp / m4 / gmp-attribute.m4
blob9b1a6a76fe9058884db0d7274a66deb2274b2b83
1 # Autoconf macros for the GNU MP Library.
2 # Copyright (C) 2000-2014 Free Software Foundation, Inc.
4 # Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
5 # Extracted from gmp-6.0.0/acinclude.m4 and adapted for TeX Live.
7 # This file is free software; the copyright holders
8 # give unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
11 # GMP_C_ATTRIBUTE_CONST
12 # ---------------------
13 AC_DEFUN([GMP_C_ATTRIBUTE_CONST],
14 [AC_CACHE_CHECK([whether gcc __attribute__ ((const)) works],
15                 [gmp_cv_c_attribute_const],
16 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo (int x) __attribute__ ((const));]])],
17   [gmp_cv_c_attribute_const=yes], [gmp_cv_c_attribute_const=no])
19 if test $gmp_cv_c_attribute_const = yes; then
20   AC_DEFINE([HAVE_ATTRIBUTE_CONST], 1,
21   [Define to 1 if the compiler accepts gcc style __attribute__ ((const))])
23 ]) # GMP_C_ATTRIBUTE_CONST
26 # GMP_C_ATTRIBUTE_MALLOC
27 # ----------------------
28 # gcc 2.95.x accepts __attribute__ ((malloc)) but with a warning that
29 # it's ignored.  Pretend it doesn't exist in this case, to avoid that
30 # warning.
31 AC_DEFUN([GMP_C_ATTRIBUTE_MALLOC],
32 [AC_CACHE_CHECK([whether gcc __attribute__ ((malloc)) works],
33                 [gmp_cv_c_attribute_malloc],
34 [gmp_cv_c_attribute_malloc=no
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void *foo (int x) __attribute__ ((malloc));]])],
36   [AS_IF([grep "attribute directive ignored" conftest.err >/dev/null],
37          [],
38          [gmp_cv_c_attribute_malloc=yes])])
40 if test $gmp_cv_c_attribute_malloc = yes; then
41   AC_DEFINE([HAVE_ATTRIBUTE_MALLOC], 1,
42   [Define to 1 if the compiler accepts gcc style __attribute__ ((malloc))])
44 ]) # GMP_C_ATTRIBUTE_MALLOC
47 # GMP_C_ATTRIBUTE_MODE
48 # --------------------
49 # Introduced in gcc 2.2, but perhaps not in all Apple derived versions.
50 AC_DEFUN([GMP_C_ATTRIBUTE_MODE],
51 [AC_CACHE_CHECK([whether gcc __attribute__ ((mode (XX))) works],
52                 [gmp_cv_c_attribute_mode],
53 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef int SItype __attribute__ ((mode (SI)));]])],
54   [gmp_cv_c_attribute_mode=yes], [gmp_cv_c_attribute_mode=no])
56 if test $gmp_cv_c_attribute_mode = yes; then
57   AC_DEFINE([HAVE_ATTRIBUTE_MODE], 1,
58   [Define to 1 if the compiler accepts gcc style __attribute__ ((mode (XX)))])
60 ]) # GMP_C_ATTRIBUTE_MODE
63 # GMP_C_ATTRIBUTE_NORETURN
64 # ------------------------
65 AC_DEFUN([GMP_C_ATTRIBUTE_NORETURN],
66 [AC_CACHE_CHECK([whether gcc __attribute__ ((noreturn)) works],
67                 [gmp_cv_c_attribute_noreturn],
68 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (int x) __attribute__ ((noreturn));]])],
69   [gmp_cv_c_attribute_noreturn=yes], [gmp_cv_c_attribute_noreturn=no])
71 if test $gmp_cv_c_attribute_noreturn = yes; then
72   AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], 1,
73   [Define to 1 if the compiler accepts gcc style __attribute__ ((noreturn))])
75 ]) # GMP_C_ATTRIBUTE_NORETURN