1 |
# This file is part of Autoconf. -*- Autoconf -*- |
# This file is part of Autoconf. -*- Autoconf -*- |
2 |
# Programming languages support. |
# Programming languages support. |
3 |
# Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. |
4 |
# |
# |
5 |
# This program is free software; you can redistribute it and/or modify |
# This program is free software; you can redistribute it and/or modify |
6 |
# it under the terms of the GNU General Public License as published by |
# it under the terms of the GNU General Public License as published by |
1077 |
])# AC_C_CONST |
])# AC_C_CONST |
1078 |
|
|
1079 |
|
|
1080 |
|
# AC_C_RESTRICT |
1081 |
|
# ------------- |
1082 |
|
# based on acx_restrict.m4, from the GNU Autoconf Macro Archive at: |
1083 |
|
# http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html |
1084 |
|
# |
1085 |
|
# Determine whether the C/C++ compiler supports the "restrict" keyword |
1086 |
|
# introduced in ANSI C99, or an equivalent. Do nothing if the compiler |
1087 |
|
# accepts it. Otherwise, if the compiler supports an equivalent, |
1088 |
|
# define "restrict" to be that. Here are some variants: |
1089 |
|
# - GCC supports both __restrict and __restrict__ |
1090 |
|
# - older DEC Alpha C compilers support only __restrict |
1091 |
|
# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C |
1092 |
|
# Otherwise, define "restrict" to be empty. |
1093 |
|
AN_IDENTIFIER([restrict], [AC_C_RESTRICT]) |
1094 |
|
AC_DEFUN([AC_C_RESTRICT], |
1095 |
|
[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict, |
1096 |
|
[ac_cv_c_restrict=no |
1097 |
|
# Try the official restrict keyword, then gcc's __restrict__, and |
1098 |
|
# the less common variants. |
1099 |
|
for ac_kw in restrict __restrict __restrict__ _Restrict; do |
1100 |
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
1101 |
|
[float * $ac_kw x;])], |
1102 |
|
[ac_cv_c_restrict=$ac_kw; break]) |
1103 |
|
done |
1104 |
|
]) |
1105 |
|
case $ac_cv_c_restrict in |
1106 |
|
restrict) ;; |
1107 |
|
no) AC_DEFINE(restrict,, |
1108 |
|
[Define to equivalent of C99 restrict keyword, or to nothing if this |
1109 |
|
is not supported. Do not define if restrict is supported directly.]) ;; |
1110 |
|
*) AC_DEFINE_UNQUOTED(restrict, $ac_cv_c_restrict) ;; |
1111 |
|
esac |
1112 |
|
])# AC_C_RESTRICT |
1113 |
|
|
1114 |
|
|
1115 |
# AC_C_VOLATILE |
# AC_C_VOLATILE |
1116 |
# ------------- |
# ------------- |
1117 |
# Note that, unlike const, #defining volatile to be the empty string can |
# Note that, unlike const, #defining volatile to be the empty string can |