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