Update Gnulib to the latest git version
[deliverable/binutils-gdb.git] / gnulib / import / m4 / getcwd.m4
index 566c3c13ea8274356a4f265542ef93ae467a6cab..3b3f7554587b70d47a8cf24f2ca7cd0f517e43c2 100644 (file)
@@ -1,12 +1,12 @@
 # getcwd.m4 - check for working getcwd that is compatible with glibc
 
-# Copyright (C) 2001, 2003-2007, 2009-2016 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
 # Written by Paul Eggert.
-# serial 13
+# serial 18
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
@@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
          char *getcwd ();
 #        endif
 ]], [[
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if defined _WIN32 && ! defined __CYGWIN__
 /* mingw cwd does not start with '/', but getcwd does allocate.
    However, mingw fails to honor non-zero size.  */
 #else
@@ -37,9 +37,9 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
                if (! f)
                  return 2;
                if (f[0] != '/')
-                 return 3;
+                 { free (f); return 3; }
                if (f[1] != '\0')
-                 return 4;
+                 { free (f); return 4; }
                free (f);
                return 0;
              }
@@ -48,12 +48,14 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
         [gl_cv_func_getcwd_null=yes],
         [gl_cv_func_getcwd_null=no],
         [[case "$host_os" in
-                     # Guess yes on glibc systems.
-            *-gnu*)  gl_cv_func_getcwd_null="guessing yes";;
-                     # Guess yes on Cygwin.
-            cygwin*) gl_cv_func_getcwd_null="guessing yes";;
-                     # If we don't know, assume the worst.
-            *)       gl_cv_func_getcwd_null="guessing no";;
+                           # Guess yes on glibc systems.
+            *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on musl systems.
+            *-musl*)       gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on Cygwin.
+            cygwin*)       gl_cv_func_getcwd_null="guessing yes";;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             gl_cv_func_getcwd_null="$gl_cross_guess_normal";;
           esac
         ]])])
 ])
@@ -125,7 +127,7 @@ AC_DEFUN([gl_FUNC_GETCWD],
   dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
   dnl if appropriate.
   case "$gl_cv_func_getcwd_path_max" in
-    "no"|"no, it has the AIX bug") ;;
+    *"no" | *"no, it has the AIX bug") ;;
     *)
       AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
         [Define to 1 if getcwd minimally works, that is, its result can be
@@ -133,12 +135,12 @@ AC_DEFUN([gl_FUNC_GETCWD],
       ;;
   esac
   case "$gl_cv_func_getcwd_path_max" in
-    "no, but it is partly working")
+    *"no, but it is partly working")
       AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
         [Define to 1 if getcwd works, except it sometimes fails when it
          shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
       ;;
-    "yes, but with shorter paths")
+    *"yes, but with shorter paths")
       AC_DEFINE([HAVE_GETCWD_SHORTER], [1],
         [Define to 1 if getcwd works, but with shorter paths
          than is generally tested with the replacement.])
This page took 0.026559 seconds and 4 git commands to generate.