* argp.m4 (gl_ARGP): Don't call AC_CHECK_DECLS_ONCE with more than
[gnulib.git] / m4 / getcwd.m4
index c252491..35d0b53 100644 (file)
@@ -1,6 +1,6 @@
 # getcwd.m4 - check for working getcwd that is compatible with glibc
 
-# Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2005 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.
@@ -9,15 +9,14 @@
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
-   AC_CHECK_HEADERS_ONCE(unistd.h)
+   AC_LIBSOURCES([getcwd.c, getcwd.h])
+
    AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
      [gl_cv_func_getcwd_null],
      [AC_TRY_RUN(
         [
 #       include <stdlib.h>
-#       ifdef HAVE_UNISTD_H
-#        include <unistd.h>
-#       endif
+#       include <unistd.h>
 #       ifndef getcwd
         char *getcwd ();
 #       endif
@@ -61,6 +60,5 @@ AC_DEFUN([gl_PREREQ_GETCWD],
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_REQUIRE([AC_HEADER_DIRENT])
   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
-  AC_CHECK_HEADERS_ONCE(fcntl.h)
   :
 ])