*** empty log message ***
[findutils.git] / m4 / lstat.m4
blob82e11abde663ad38fc5cca7be67243f5d89a19a7
1 #serial 3
3 dnl From Jim Meyering.
4 dnl Determine whether lstat has the bug that it succeeds when given the
5 dnl zero-length file name argument.  The lstat from SunOS4.1.4 and the Hurd
6 dnl (as of 1998-11-01) do this.
7 dnl
8 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
9 dnl compile the wrapper function.
10 dnl
12 AC_DEFUN(jm_FUNC_LSTAT,
14  AC_CACHE_CHECK([whether lstat accepts an empty string],
15   jm_cv_func_lstat_empty_string_bug,
16   [AC_TRY_RUN([
17 #   include <sys/types.h>
18 #   include <sys/stat.h>
20     int
21     main ()
22     {
23       struct stat sbuf;
24       exit (lstat ("", &sbuf) ? 1 : 0);
25     }
26           ],
27          jm_cv_func_lstat_empty_string_bug=yes,
28          jm_cv_func_lstat_empty_string_bug=no,
29          dnl When crosscompiling, assume lstat is broken.
30          jm_cv_func_lstat_empty_string_bug=yes)
31   ])
32   if test $jm_cv_func_lstat_empty_string_bug = yes; then
33     AC_SUBST(LIBOBJS)
34     LIBOBJS="$LIBOBJS lstat.$ac_objext"
35     AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
36 [Define if lstat has the bug that it succeeds when given the zero-length
37    file name argument.  The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
38    do this. ])
39   fi