doc: Remove references to POSIX 202x.
[gnulib.git] / m4 / unlink-busy.m4
blobdfd8b10abf7538314a250f8f5a567b9b413bed76
1 # unlink-busy.m4
2 # serial 17
3 dnl Copyright (C) 2000-2001, 2004, 2007, 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl From J. David Anglin.
10 dnl HPUX and other systems can't unlink shared text that is being executed.
12 AC_DEFUN([gl_FUNC_UNLINK_BUSY_TEXT],
14   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
15   AC_CACHE_CHECK([whether a running program can be unlinked],
16     [gl_cv_func_unlink_busy_text],
17     [
18       AC_RUN_IFELSE(
19         [AC_LANG_SOURCE(
20            [AC_INCLUDES_DEFAULT
21             GL_MDA_DEFINES[
22             int
23             main (int argc, char **argv)
24             {
25               int result = 0;
26               if (argc == 0)
27                 result |= 1;
28               else if (unlink (argv[0]) != 0)
29                 result |= 2;
30               return result;
31             }]])],
32         [gl_cv_func_unlink_busy_text=yes],
33         [gl_cv_func_unlink_busy_text=no],
34         [case "$host_os" in
35                               # Guess no on native Windows.
36            mingw* | windows*) gl_cv_func_unlink_busy_text="guessing no" ;;
37            *)                 gl_cv_func_unlink_busy_text="guessing no" ;;
38          esac
39         ]
40       )
41     ]
42   )
44   case "$gl_cv_func_unlink_busy_text" in
45     *no) INSTALL=$ac_install_sh ;;
46   esac