re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / m4 / readlinkat.m4
1 # serial 5
2 # See if we need to provide readlinkat replacement.
3
4 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
8
9 # Written by Eric Blake.
10
11 AC_DEFUN([gl_FUNC_READLINKAT],
12 [
13   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
14   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15   AC_CHECK_FUNCS_ONCE([readlinkat])
16   AC_REQUIRE([gl_FUNC_READLINK])
17   if test $ac_cv_func_readlinkat = no; then
18     HAVE_READLINKAT=0
19   else
20     AC_CACHE_CHECK([whether readlinkat signature is correct],
21       [gl_cv_decl_readlinkat_works],
22       [AC_COMPILE_IFELSE(
23          [AC_LANG_PROGRAM(
24            [[#include <unistd.h>
25              /* Check whether original declaration has correct type.  */
26              ssize_t readlinkat (int, char const *, char *, size_t);]])],
27          [gl_cv_decl_readlinkat_works=yes],
28          [gl_cv_decl_readlinkat_works=no])])
29     # Assume readinkat has the same trailing slash bug as readlink,
30     # as is the case on Mac Os X 10.10
31     case "$gl_cv_func_readlink_works" in
32       *yes)
33         if test "$gl_cv_decl_readlinkat_works" != yes; then
34           REPLACE_READLINKAT=1
35         fi
36         ;;
37       *)
38         REPLACE_READLINKAT=1
39         ;;
40     esac
41   fi
42 ])