bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

restrict.m4: do not punish autoconf 2.59 users


From: Ralf Wildenhues
Subject: restrict.m4: do not punish autoconf 2.59 users
Date: Thu, 6 Oct 2005 21:05:31 +0200
User-agent: Mutt/1.5.9i

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
-])
+])])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]