~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to m4/link-follow.m4

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# serial 16
 
1
# serial 19
2
2
dnl Run a program to determine whether link(2) follows symlinks.
3
3
dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
4
4
 
5
 
# Copyright (C) 1999-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
 
5
# Copyright (C) 1999-2001, 2004-2006, 2009-2012 Free Software Foundation, Inc.
6
6
# This file is free software; the Free Software Foundation
7
7
# gives unlimited permission to copy and/or distribute it,
8
8
# with or without modifications, as long as this notice is preserved.
16
16
dnl runtime test.  If it is -2, use a generic runtime test.
17
17
AC_DEFUN([gl_FUNC_LINK_FOLLOWS_SYMLINK],
18
18
[dnl
 
19
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
19
20
  AC_CHECK_FUNCS_ONCE([readlink])
20
21
  dnl Mingw lacks link, although gnulib provides a good replacement.
21
22
  dnl However, it also lacks symlink, so there's nothing to test in
81
82
           ]])],
82
83
           [gl_cv_func_link_follows_symlink=no], dnl GNU behavior
83
84
           [gl_cv_func_link_follows_symlink=yes], dnl Followed link/compile failed
84
 
           [gl_cv_func_link_follows_symlink=unknown] dnl We're cross compiling.
85
 
         )
 
85
           [dnl We're cross compiling.
 
86
            dnl The past results are "yes" on Mac OS X, FreeBSD, NetBSD,
 
87
            dnl OpenBSD, Minix, AIX, HP-UX, OSF/1, and "no" on Linux, Cygwin.
 
88
            case "$host_os" in
 
89
                           # On glibc/Linux we know the result.
 
90
              linux*-gnu*) gl_cv_func_link_follows_symlink="guessing no" ;;
 
91
                           # Otherwise, we don't know.
 
92
              *)           gl_cv_func_link_follows_symlink=unknown ;;
 
93
            esac
 
94
           ])
86
95
         rm -f conftest.file conftest.sym conftest.hard
87
96
        ])
88
 
      case $gl_cv_func_link_follows_symlink in
89
 
        yes) gl_link_follows_symlinks=1 ;;
90
 
        no) ;; # already defaulted to 0
 
97
      case "$gl_cv_func_link_follows_symlink" in
 
98
        *yes) gl_link_follows_symlinks=1 ;;
 
99
        *no) ;; # already defaulted to 0
91
100
        *) gl_link_follows_symlinks=-2 ;;
92
101
      esac
93
102
    fi
94
103
  fi
95
104
  AC_DEFINE_UNQUOTED([LINK_FOLLOWS_SYMLINKS], [$gl_link_follows_symlinks],
96
 
    [Define to 1 if `link(2)' dereferences symbolic links, 0 if it
 
105
    [Define to 1 if 'link(2)' dereferences symbolic links, 0 if it
97
106
     creates hard links to symlinks, -1 if it depends on the variable __xpg4,
98
107
     and -2 if unknown.])
99
108
])