Blame m4/double-slash-root.m4

Packit 8f70b4
# double-slash-root.m4 serial 4   -*- Autoconf -*-
Packit 8f70b4
dnl Copyright (C) 2006, 2008-2018 Free Software Foundation, Inc.
Packit 8f70b4
dnl This file is free software; the Free Software Foundation
Packit 8f70b4
dnl gives unlimited permission to copy and/or distribute it,
Packit 8f70b4
dnl with or without modifications, as long as this notice is preserved.
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
Packit 8f70b4
[
Packit 8f70b4
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit 8f70b4
  AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
Packit 8f70b4
    [ if test x"$cross_compiling" = xyes ; then
Packit 8f70b4
        # When cross-compiling, there is no way to tell whether // is special
Packit 8f70b4
        # short of a list of hosts.  However, the only known hosts to date
Packit 8f70b4
        # that have a distinct // are Apollo DomainOS (too old to port to),
Packit 8f70b4
        # Cygwin, and z/OS.  If anyone knows of another system for which // has
Packit 8f70b4
        # special semantics and is distinct from /, please report it to
Packit 8f70b4
        # <bug-gnulib@gnu.org>.
Packit 8f70b4
        case $host in
Packit 8f70b4
          *-cygwin | i370-ibm-openedition)
Packit 8f70b4
            gl_cv_double_slash_root=yes ;;
Packit 8f70b4
          *)
Packit 8f70b4
            # Be optimistic and assume that / and // are the same when we
Packit 8f70b4
            # don't know.
Packit 8f70b4
            gl_cv_double_slash_root='unknown, assuming no' ;;
Packit 8f70b4
        esac
Packit 8f70b4
      else
Packit 8f70b4
        set x `ls -di / // 2>/dev/null`
Packit 8f70b4
        if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then
Packit 8f70b4
          gl_cv_double_slash_root=no
Packit 8f70b4
        else
Packit 8f70b4
          gl_cv_double_slash_root=yes
Packit 8f70b4
        fi
Packit 8f70b4
      fi])
Packit 8f70b4
  if test "$gl_cv_double_slash_root" = yes; then
Packit 8f70b4
    AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1],
Packit 8f70b4
      [Define to 1 if // is a file system root distinct from /.])
Packit 8f70b4
  fi
Packit 8f70b4
])