Mercurial > hg > octave-jordi > gnulib-hg
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 |
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 | 2 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc. |
11041 | 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_LINK], | |
8 [ | |
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 | 11 AC_CHECK_FUNCS_ONCE([link]) |
12 if test $ac_cv_func_link = no; then | |
13 HAVE_LINK=0 | |
11981 | 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 | 16 [gl_cv_func_link_works], |
17 [touch conftest.a | |
12263 | 18 # Assume that if we have lstat, we can also check symlinks. |
19 if test $ac_cv_func_lstat = yes; then | |
20 ln -s conftest.a conftest.lnk | |
21 fi | |
11981 | 22 AC_RUN_IFELSE( |
23 [AC_LANG_PROGRAM( | |
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 | 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 | 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 | 38 ]])], |
11981 | 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 | 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 | 54 fi |
55 ]) |