bug-coreutils
[Top][All Lists]
Advanced

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

Re: regex.h lacks configure tests for `restrict'?


From: Jim Meyering
Subject: Re: regex.h lacks configure tests for `restrict'?
Date: Wed, 12 Feb 2003 10:27:14 +0100

Hi Alexandre!

Thank you for the detailed bug report!

Alexandre Duret-Lutz <address@hidden> wrote:
> Automake 1.7.2a adds dependency tracking support for ICC, so
> I've tried to compile coreutils with it to see how that fumes.
>
> This is coreutils-4.5.7, on Debian unstable, with Makefile.am
> regenerated by Automake 1.7.2a, and configure run as
> `./configure CC=icc'.  ICC is version 7.0, with substitute
> headers slightly edited to accomodate my glibc (2.3.1).
>
> Besides a few harmless warnings, the only error I had was with regex.h.

Thanks for reporting all of those.

> lib/regex.h mentions a configure test for `restrict'.  I can't see
> where this is done.  The only mention of `restrict' in
> config.log is when jm_INCLUDED_REGEX fails to include
> /usr/include/regex.h.  This latter file also uses __restrict so
> it fails for the same reason.

I've just added an autoconf compile-check based on
Steven G. Johnson's ACX_C_RESTRICT macro.

2003-02-12  Jim Meyering  <address@hidden>

        * regex.m4 (jm_PREREQ_REGEX): Require ACX_C_RESTRICT.

        * restrict.m4 (ACX_C_RESTRICT): Minor syntactic changes:
        Split long lines, use AC_COMPILE_IFELSE, indent, use `case'
        instead of nested `if's, remove unnecessary quotes.

        * restrict.m4 (ACX_C_RESTRICT): New macro.
        Copied directly from the URL in the comments.
        By Steven G. Johnson.

Here's what I've called restrict.m4:
--------------
#serial 1000
dnl based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html

# Determine whether the C compiler supports the "restrict" keyword introduced
# in ANSI C99, or an equivalent.  Do nothing if the compiler accepts it.
# Otherwise, if the compiler supports an equivalent (like gcc's __restrict__)
# define "restrict" to be that.  Otherwise, define "restrict" to be empty.

AC_DEFUN([ACX_C_RESTRICT],
[AC_CACHE_CHECK([for C restrict keyword], acx_cv_c_restrict,
  [acx_cv_c_restrict=no
   # Try the official restrict keyword, then gcc's __restrict__, then
   # SGI's __restrict.  __restrict has slightly different semantics than
   # restrict (it's a bit stronger, in that __restrict pointers can't
   # overlap even with non __restrict pointers), but I think it should be
   # okay under the circumstances where restrict is normally used.
   for acx_kw in restrict __restrict__ __restrict; do
     AC_COMPILE_IFELSE([AC_LANG_SOURCE(
      [#ifndef __cplusplus
      float * $acx_kw x;
#endif
      ])], [acx_cv_c_restrict=$acx_kw; break])
   done
  ])
 case $acx_cv_c_restrict in
   restrict) ;;
   no) AC_DEFINE(restrict,,
        [Define to equivalent of C99 restrict keyword, or to nothing if this
        is not supported.  Do not define if restrict is supported directly.]) ;;
   *)  AC_DEFINE_UNQUOTED(restrict, $acx_cv_c_restrict) ;;
 esac
])

> I believe I should fix ICC's header to `#define __restrict',
> since /usr/include/regex.h needs it, however it still looks
> bogus that regex.h mention a test that jm_INCLUDED_REGEX
> doesn't do.
>
> I resumed compilation with `make CPPFLAGS=-Drestrict='.
> (`CFLAGS=-std=c99' would also work.)
>
> ----------------------------------------------------------------------
> source='pathchk.c' object='pathchk.o' libtool=no \
> depfile='.deps/pathchk.Po' tmpdepfile='.deps/pathchk.TPo' \
> depmode=icc /bin/sh ../config/depcomp \
> icc -DLOCALEDIR=\"/usr/local/share/locale\" -DSHAREDIR=\"/usr/local/share\" 
> -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I. -I../lib -I../lib  -Drestrict=  -g -c 
> `test -f 'pathchk.c' || echo './'`pathchk.c
> pathchk.c(235): warning #191: type qualifier is meaningless on cast type
>       if (portable_chars[(const unsigned char) *p] == 0)

I've just removed that `const'.
Thanks again!




reply via email to

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