double-slash-root.m4 1.6 KB

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