annotate m4/link.m4 @ 18070:d460ec17f09f

autoupdate
author Karl Berry <karl@freefriends.org>
date Tue, 28 Jul 2015 13:57:32 -0700
parents ab58d4870664
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
1 # link.m4 serial 8
17848
ab58d4870664 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 17587
diff changeset
2 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
6
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_LINK],
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
8 [
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
11 AC_CHECK_FUNCS_ONCE([link])
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
12 if test $ac_cv_func_link = no; then
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
13 HAVE_LINK=0
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
14 else
15313
8dfa469e2ba8 link: work around IRIX bug
Eric Blake <eblake@redhat.com>
parents: 15024
diff changeset
15 AC_CACHE_CHECK([whether link obeys POSIX],
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
16 [gl_cv_func_link_works],
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
17 [touch conftest.a
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
18 # Assume that if we have lstat, we can also check symlinks.
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
19 if test $ac_cv_func_lstat = yes; then
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
20 ln -s conftest.a conftest.lnk
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
21 fi
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
22 AC_RUN_IFELSE(
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
23 [AC_LANG_PROGRAM(
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
24 [[#include <unistd.h>
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
25 ]],
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
26 [[int result = 0;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
27 if (!link ("conftest.a", "conftest.b/"))
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
28 result |= 1;
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
29 #if HAVE_LSTAT
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
30 if (!link ("conftest.lnk/", "conftest.b"))
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
31 result |= 2;
15313
8dfa469e2ba8 link: work around IRIX bug
Eric Blake <eblake@redhat.com>
parents: 15024
diff changeset
32 if (rename ("conftest.a", "conftest.b"))
8dfa469e2ba8 link: work around IRIX bug
Eric Blake <eblake@redhat.com>
parents: 15024
diff changeset
33 result |= 4;
8dfa469e2ba8 link: work around IRIX bug
Eric Blake <eblake@redhat.com>
parents: 15024
diff changeset
34 if (!link ("conftest.b", "conftest.lnk"))
8dfa469e2ba8 link: work around IRIX bug
Eric Blake <eblake@redhat.com>
parents: 15024
diff changeset
35 result |= 8;
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
36 #endif
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
37 return result;
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
38 ]])],
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
39 [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no],
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
40 [case "$host_os" in
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
41 # Guess yes on glibc systems.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
42 *-gnu*) gl_cv_func_link_works="guessing yes" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
43 # If we don't know, assume the worst.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
44 *) gl_cv_func_link_works="guessing no" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
45 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
46 ])
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
47 rm -f conftest.a conftest.b conftest.lnk])
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
48 case "$gl_cv_func_link_works" in
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
49 *yes) ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
50 *)
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
51 REPLACE_LINK=1
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
52 ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
53 esac
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
54 fi
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
55 ])