Merge branch 'upstream'
[gnulib.git] / m4 / unlink.m4
1 # unlink.m4 serial 1
2 dnl Copyright (C) 2009 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_FUNC_UNLINK],
8 [
9   AC_REQUIRE([gl_AC_DOS])
10   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
11   dnl Detect Solaris 9 bug.
12   AC_CACHE_CHECK([whether unlink honors trailing slashes],
13     [gl_cv_func_unlink_works],
14     [touch conftest.file
15      AC_RUN_IFELSE(
16        [AC_LANG_PROGRAM(
17          [[#include <stdio.h>
18            #include <errno.h>
19 ]], [[return !unlink ("conftest.file/") || errno != ENOTDIR;]])],
20       [gl_cv_func_unlink_works=yes], [gl_cv_func_unlink_works=no],
21       [gl_cv_func_unlink_works="guessing no"])
22      rm -f conftest.file])
23   if test x"$gl_cv_func_unlink_works" != xyes; then
24     REPLACE_UNLINK=1
25     AC_LIBOBJ([unlink])
26   fi
27 ])