I like
| checking for C/C++ restrict keyword... __restrict
| checking for C/C++ restrict keyword... (cached) __restrict

much better than
| checking for C/C++ restrict keyword... __restrict
| checking for C/C++ restrict keyword... restrict

in case both gl_C_RESTRICT and AC_C_RESTRICT are used.  In large
software with multiple third-party macros this may happen.  This
approach can probably be improved further: make a required gl_C_RESTRICT
expand to nothing if AC_C_RESTRICT is already required and expanded, or
at least to the identical text.  The latter might be problematic if
there are bugs in (one of) the test, but I'm sure you'll find something
better that actually works.  :)

Thinking out loud: one of them could even AU_DEFUN the other..

cat configure.ac
AC_INIT
AC_PROG_CC
AC_DEFUN([FOO], [AC_REQUIRE([AC_C_RESTRICT])])
AC_DEFUN([BAR], [AC_REQUIRE([gl_C_RESTRICT])])
FOO
BAR
AC_OUTPUT

Cheers,
Ralf

        * restrict.m4 (gl_C_RESTRICT): If defined, expand to
        AC_C_RESTRICT.

Index: restrict.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/restrict.m4,v
retrieving revision 1.3
diff -u -r1.3 restrict.m4
--- restrict.m4 23 Jan 2005 08:06:57 -0000      1.3
+++ restrict.m4 6 Oct 2005 18:47:15 -0000
@@ -18,7 +18,8 @@
 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
 # Otherwise, define "restrict" to be empty.
 AC_DEFUN([gl_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
+[m4_ifdef([AC_C_RESTRICT], [AC_C_RESTRICT],
+         [AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
   [gl_cv_c_restrict=no
    # Try the official restrict keyword, then gcc's __restrict, and
    # the less common variants.
@@ -35,4 +36,4 @@
        is not supported.  Do not define if restrict is supported directly.]) ;;
    *)  AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;;
  esac
-])
+])])


_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to