diff --git a/base/stdpre.h b/base/stdpre.h
index 4d88f28..7fd7ecb 100644 (file)
--- a/base/stdpre.h
+++ b/base/stdpre.h
@@ -98,7 +98,11 @@
 #elif defined(_MSC_VER) && _MSC_VER >= 1500 /* MSVC 9 or newer */
 #define gs_restrict __restrict
 #elif __GNUC__ >= 3 /* GCC 3 or newer */
+#if defined(HAVE_RESTRICT) && HAVE_RESTRICT==1
 #define gs_restrict __restrict
+#else /* defined(HAVE_RESTRICT) && HAVE_RESTRICT==1 */
+#define gs_restrict
+#endif /* defined(HAVE_RESTRICT) && HAVE_RESTRICT==1 */
 #else /* Unknown or ancient */
 #define gs_restrict
 #endif
diff --git a/configure.ac b/configure.ac
index ac85162..b21b141 100644 (file)
--- a/configure.ac
+++ b/configure.ac
@@ -339,6 +339,18 @@ else
     dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY"
 fi
 
+AC_MSG_CHECKING([if compiler supports restrict])
+AC_TRY_COMPILE([void test (char * __restrict p){}],[
+                 char * __restrict t;
+                 test(t);
+                 return 1;
+               ],[
+               CFLAGS="$CFLAGS -DHAVE_RESTRICT=1"
+               AC_MSG_RESULT([yes])],[
+               CFLAGS="$CFLAGS -DHAVE_RESTRICT=0"
+               AC_MSG_RESULT([no])])
+
+
 
 AC_ARG_WITH([arch_h], AC_HELP_STRING([--with-arch_h=<arch.h to use>],
             [Use a custom arch.h (must be an absolute path)]),[], [with_arch_h=])
