2 dnl based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
3 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html
5 # Determine whether the C/C++ compiler supports the "restrict" keyword
6 # introduced in ANSI C99, or an equivalent. Do nothing if the compiler
7 # accepts it. Otherwise, if the compiler supports an equivalent (like
8 # gcc's __restrict__) define "restrict" to be that. Otherwise, define
9 # "restrict" to be empty.
11 AC_DEFUN([ACX_C_RESTRICT],
12 [AC_CACHE_CHECK([for C/C++ restrict keyword], acx_cv_c_restrict,
14 # Try the official restrict keyword, then gcc's __restrict__.
15 for acx_kw in restrict __restrict__; do
16 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
17 [float * $acx_kw x;])],
18 [acx_cv_c_restrict=$acx_kw; break])
21 case $acx_cv_c_restrict in
23 no) AC_DEFINE(restrict,,
24 [Define to equivalent of C99 restrict keyword, or to nothing if this
25 is not supported. Do not define if restrict is supported directly.]) ;;
26 *) AC_DEFINE_UNQUOTED(restrict, $acx_cv_c_restrict) ;;