~ubuntu-branches/ubuntu/intrepid/parted/intrepid

« back to all changes in this revision

Viewing changes to gnulib/m4/link-follow.m4

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-06-24 14:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080624143105-rd7yw67a9qnvh51i
Tags: 1.8.8.git.2008.03.24-7ubuntu1
* Resynchronise with Debian (LP: #237568). Remaining changes:
  - swap-uuid.dpatch: Create UUIDs on new swap partitions.
  - gptsync.dpatch: On Intel Mac systems, write a synced MBR rather than a
    protective MBR.
  - Add -fno-stack-protector on sparc.
  - sparc-new-label.dpatch: Fix sparc disk label generation. This is
    required for LDOM and parallel installations with Solaris 10.
  - loop-partitions.dpatch: Loop devices can only have one partition, so
    don't generate device names such as "/dev/loop0p1".
  - unpartitioned-disks.dpatch: Don't try to call BLKPG ioctls on
    unpartitionable disks (only implemented for loop devices at the
    moment), as they will always fail.
  - When building with gcc-4.3, add -Wno-array-bounds to CFLAGS.
  - Cell partition tables are misdetected as pc98, so disable pc98 support
    on powerpc.
  - array-bounds.dpatch: Backport patch from git to allow building with
    gcc-4.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#serial 9
 
2
dnl Run a program to determine whether link(2) follows symlinks.
 
3
dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
 
4
 
 
5
# Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
 
6
# This file is free software; the Free Software Foundation
 
7
# gives unlimited permission to copy and/or distribute it,
 
8
# with or without modifications, as long as this notice is preserved.
 
9
 
 
10
AC_DEFUN([gl_AC_FUNC_LINK_FOLLOWS_SYMLINK],
 
11
[dnl
 
12
  AC_CACHE_CHECK(
 
13
    [whether link(2) dereferences a symlink specified with a trailing slash],
 
14
                 jm_ac_cv_func_link_follows_symlink,
 
15
  [
 
16
    # Create a regular file.
 
17
    echo > conftest.file
 
18
    AC_TRY_RUN(
 
19
      [
 
20
#       include <sys/types.h>
 
21
#       include <sys/stat.h>
 
22
#       include <unistd.h>
 
23
#       include <stdlib.h>
 
24
 
 
25
#       define SAME_INODE(Stat_buf_1, Stat_buf_2) \
 
26
          ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
 
27
           && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
 
28
 
 
29
        int
 
30
        main ()
 
31
        {
 
32
          const char *file = "conftest.file";
 
33
          const char *sym = "conftest.sym";
 
34
          const char *hard = "conftest.hard";
 
35
          struct stat sb_file, sb_hard;
 
36
 
 
37
          /* Create a symlink to the regular file. */
 
38
          if (symlink (file, sym))
 
39
            abort ();
 
40
 
 
41
          /* Create a hard link to that symlink.  */
 
42
          if (link (sym, hard))
 
43
            abort ();
 
44
 
 
45
          if (lstat (hard, &sb_hard))
 
46
            abort ();
 
47
          if (lstat (file, &sb_file))
 
48
            abort ();
 
49
 
 
50
          /* If the dev/inode of hard and file are the same, then
 
51
             the link call followed the symlink.  */
 
52
          return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
 
53
        }
 
54
      ],
 
55
      jm_ac_cv_func_link_follows_symlink=yes,
 
56
      jm_ac_cv_func_link_follows_symlink=no,
 
57
      jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
 
58
    )
 
59
  ])
 
60
  if test $jm_ac_cv_func_link_follows_symlink = yes; then
 
61
    AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
 
62
      [Define if `link(2)' dereferences symbolic links.])
 
63
  fi
 
64
])