Mercurial > hg > octave-jordi > gnulib-hg
changeset 18030:bbdce0795bb7
linkat: fix invalid definition of LINKAT_SYMLINK_NOTSUP on OS X
It started like this when building coreutils' latest on OS X,
invoking ./configure with a nonempty --cache=.cache:
lib/linkat.c:46:42: error: operator '||' has no right operand
lib/linkat.c: In function 'rpl_linkat':
lib/linkat.c:330:27: error: #if with no expression
Here's linkat.c's line 46:
#if !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP
Here's some context:
$ grep linkat_nofoll .cache
gl_cv_func_linkat_nofollow=${gl_cv_func_linkat_nofollow=no}
$ grep LINKAT_SYM lib/config.h
#define LINKAT_SYMLINK_NOTSUP
The problem is that m4/linkat.m4's gl_FUNC_LINKAT
uses AC_CACHE_CHECK to set LINKAT_SYMLINK_NOTSUP,
but that violates a tenet of AC_CACHE_CHECK: it must
have no side effect other than setting its cache variable.
What happens is that when the cache is set, we'd skip the
code in that AC_CACHE_CHECK call, and leave LINKAT_SYMLINK_NOTSUP
defined to whatever value it happened to have in configure's
environment. In my case, it was not defined, so this later code:
AC_DEFINE_UNQUOTED([LINKAT_SYMLINK_NOTSUP], [$LINKAT_SYMLINK_NOTSUP],
[Define to 1 if linkat can create hardlinks to symlinks])
would emit code with an empty RHS.
* m4/linkat.m4 (gl_FUNC_LINKAT): Move the setting of
$LINKAT_SYMLINK_NOTSUP out of the AC_CACHE_CHECK code block.
author | Jim Meyering <meyering@fb.com> |
---|---|
date | Mon, 29 Jun 2015 10:05:31 -0700 |
parents | e4a13d95b503 |
children | e856c8618738 |
files | ChangeLog m4/linkat.m4 |
diffstat | 2 files changed, 49 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2015-06-29 Jim Meyering <meyering@fb.com> + + linkat: fix invalid definition of LINKAT_SYMLINK_NOTSUP on OS X + It started like this when building coreutils' latest on OS X, + invoking ./configure with a nonempty --cache=.cache: + + lib/linkat.c:46:42: error: operator '||' has no right operand + lib/linkat.c: In function 'rpl_linkat': + lib/linkat.c:330:27: error: #if with no expression + + Here's linkat.c's line 46: + + #if !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP + + Here's some context: + + $ grep linkat_nofoll .cache + gl_cv_func_linkat_nofollow=${gl_cv_func_linkat_nofollow=no} + $ grep LINKAT_SYM lib/config.h + #define LINKAT_SYMLINK_NOTSUP + + The problem is that m4/linkat.m4's gl_FUNC_LINKAT + uses AC_CACHE_CHECK to set LINKAT_SYMLINK_NOTSUP, + but that violates a tenet of AC_CACHE_CHECK: it must + have no side effect other than setting its cache variable. + + What happens is that when the cache is set, we'd skip the + code in that AC_CACHE_CHECK call, and leave LINKAT_SYMLINK_NOTSUP + defined to whatever value it happened to have in configure's + environment. In my case, it was not defined, so this later code: + + AC_DEFINE_UNQUOTED([LINKAT_SYMLINK_NOTSUP], [$LINKAT_SYMLINK_NOTSUP], + [Define to 1 if linkat can create hardlinks to symlinks]) + + would emit code with an empty RHS. + + * m4/linkat.m4 (gl_FUNC_LINKAT): Move the setting of + $LINKAT_SYMLINK_NOTSUP out of the AC_CACHE_CHECK code block. + 2015-06-28 Jim Meyering <meyering@fb.com> mountlist: avoid an unused-label warning on OS X
--- a/m4/linkat.m4 +++ b/m4/linkat.m4 @@ -1,4 +1,4 @@ -# serial 6 +# serial 7 # See if we need to provide linkat replacement. dnl Copyright (C) 2009-2015 Free Software Foundation, Inc. @@ -35,21 +35,20 @@ [return linkat (AT_FDCWD, "conftest.l1", AT_FDCWD, "conftest.l2", 0); ])], - [gl_cv_func_linkat_nofollow=yes - LINKAT_SYMLINK_NOTSUP=0], - [gl_cv_func_linkat_nofollow=no - LINKAT_SYMLINK_NOTSUP=1], + [gl_cv_func_linkat_nofollow=yes], + [gl_cv_func_linkat_nofollow=no], [case "$host_os" in - darwin*) - gl_cv_func_linkat_nofollow="guessing no" - LINKAT_SYMLINK_NOTSUP=1 ;; - *) - gl_cv_func_linkat_nofollow="guessing yes" - LINKAT_SYMLINK_NOTSUP=0 ;; + darwin*) gl_cv_func_linkat_nofollow="guessing no" ;; + *) gl_cv_func_linkat_nofollow="guessing yes" ;; esac]) rm -rf conftest.l1 conftest.l2]) + case $gl_cv_func_linkat_nofollow in + *no) LINKAT_SYMLINK_NOTSUP=1 ;; + *yes) LINKAT_SYMLINK_NOTSUP=0 ;; + esac + AC_CACHE_CHECK([whether linkat handles trailing slash correctly], [gl_cv_func_linkat_slash], [rm -rf conftest.a conftest.b conftest.c conftest.d conftest.e conftest.s