summaryrefslogtreecommitdiffstats
path: root/gl/m4/gnulib-common.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/gnulib-common.m4')
-rw-r--r--gl/m4/gnulib-common.m445
1 files changed, 44 insertions, 1 deletions
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 53980108..9336d726 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
1# gnulib-common.m4 serial 2 1# gnulib-common.m4 serial 3
2dnl Copyright (C) 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
20 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 20 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
21 MKDIR_P='$(mkdir_p)' 21 MKDIR_P='$(mkdir_p)'
22 AC_SUBST([MKDIR_P])])]) 22 AC_SUBST([MKDIR_P])])])
23
24# AC_C_RESTRICT
25# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
26# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
27# works.
28# This definition can be removed once autoconf >= 2.62 can be assumed.
29AC_DEFUN([AC_C_RESTRICT],
30[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
31 [ac_cv_c_restrict=no
32 # The order here caters to the fact that C++ does not require restrict.
33 for ac_kw in __restrict __restrict__ _Restrict restrict; do
34 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
35 [[typedef int * int_ptr;
36 int foo (int_ptr $ac_kw ip) {
37 return ip[0];
38 }]],
39 [[int s[1];
40 int * $ac_kw t = s;
41 t[0] = 0;
42 return foo(t)]])],
43 [ac_cv_c_restrict=$ac_kw])
44 test "$ac_cv_c_restrict" != no && break
45 done
46 ])
47 AH_VERBATIM([restrict],
48[/* Define to the equivalent of the C99 'restrict' keyword, or to
49 nothing if this is not supported. Do not define if restrict is
50 supported directly. */
51#undef restrict
52/* Work around a bug in Sun C++: it does not support _Restrict, even
53 though the corresponding Sun C compiler does, which causes
54 "#define restrict _Restrict" in the previous line. Perhaps some future
55 version of Sun C++ will work with _Restrict; if so, it'll probably
56 define __RESTRICT, just as Sun C does. */
57#if defined __SUNPRO_CC && !defined __RESTRICT
58# define _Restrict
59#endif])
60 case $ac_cv_c_restrict in
61 restrict) ;;
62 no) AC_DEFINE([restrict], []) ;;
63 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
64 esac
65])