Home | History | Annotate | Line # | Download | only in m4
      1      1.1  christos # double-slash-root.m4 serial 4   -*- Autoconf -*-
      2  1.1.1.2  christos dnl Copyright (C) 2006, 2008-2022 Free Software Foundation, Inc.
      3      1.1  christos dnl This file is free software; the Free Software Foundation
      4      1.1  christos dnl gives unlimited permission to copy and/or distribute it,
      5      1.1  christos dnl with or without modifications, as long as this notice is preserved.
      6      1.1  christos 
      7      1.1  christos AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
      8      1.1  christos [
      9      1.1  christos   AC_REQUIRE([AC_CANONICAL_HOST])
     10      1.1  christos   AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
     11      1.1  christos     [ if test x"$cross_compiling" = xyes ; then
     12      1.1  christos         # When cross-compiling, there is no way to tell whether // is special
     13      1.1  christos         # short of a list of hosts.  However, the only known hosts to date
     14      1.1  christos         # that have a distinct // are Apollo DomainOS (too old to port to),
     15      1.1  christos         # Cygwin, and z/OS.  If anyone knows of another system for which // has
     16      1.1  christos         # special semantics and is distinct from /, please report it to
     17      1.1  christos         # <bug-gnulib (a] gnu.org>.
     18      1.1  christos         case $host in
     19      1.1  christos           *-cygwin | i370-ibm-openedition)
     20      1.1  christos             gl_cv_double_slash_root=yes ;;
     21      1.1  christos           *)
     22      1.1  christos             # Be optimistic and assume that / and // are the same when we
     23      1.1  christos             # don't know.
     24      1.1  christos             gl_cv_double_slash_root='unknown, assuming no' ;;
     25      1.1  christos         esac
     26      1.1  christos       else
     27      1.1  christos         set x `ls -di / // 2>/dev/null`
     28      1.1  christos         if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then
     29      1.1  christos           gl_cv_double_slash_root=no
     30      1.1  christos         else
     31      1.1  christos           gl_cv_double_slash_root=yes
     32      1.1  christos         fi
     33      1.1  christos       fi])
     34      1.1  christos   if test "$gl_cv_double_slash_root" = yes; then
     35      1.1  christos     AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1],
     36      1.1  christos       [Define to 1 if // is a file system root distinct from /.])
     37      1.1  christos   fi
     38      1.1  christos ])
     39