annotate m4/link.m4 @ 15009:2917eb19f982

truncl: Move AC_LIBOBJ invocations to module description. * m4/truncl.m4 (gl_FUNC_TRUNCL): Move AC_LIBOBJ invocation from here... * modules/truncl (configure.ac): ... to here.
author Bruno Haible <bruno@clisp.org>
date Sat, 21 May 2011 11:32:55 +0200
parents 97fc9a21a8fb
children ff4e14f9c0be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
1 # link.m4 serial 5
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 13918
diff changeset
2 dnl Copyright (C) 2009-2011 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])
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
10 AC_CHECK_FUNCS_ONCE([link])
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
11 if test $ac_cv_func_link = no; then
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
12 HAVE_LINK=0
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
13 AC_LIBOBJ([link])
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
14 else
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
15 AC_CACHE_CHECK([whether link handles trailing slash correctly],
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;
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
32 #endif
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
33 return result;
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
34 ]])],
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
35 [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no],
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
36 [gl_cv_func_link_works="guessing no"])
12263
c689d1419da9 link: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12048
diff changeset
37 rm -f conftest.a conftest.b conftest.lnk])
12048
0f01e7ffb856 link: fix quoting
Eric Blake <ebb9@byu.net>
parents: 11981
diff changeset
38 if test "$gl_cv_func_link_works" != yes; then
11981
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
39 REPLACE_LINK=1
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
40 AC_LIBOBJ([link])
7e5f9267c62e link: fix platform bugs
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
41 fi
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
42 fi
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents:
diff changeset
43 ])