canonicalize, canonicalize-lgpl: update module dependencies
authorEric Blake <ebb9@byu.net>
Fri, 11 Sep 2009 14:34:37 +0000 (08:34 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 18 Sep 2009 01:16:12 +0000 (19:16 -0600)
The m4 files were checking whether canonicalize_file_name was
declared, but without enabling extensions, this would never
succeed.  Also, mingw failed to compile the module combination of
canonicalize-lgpl and sys_stat, due to a link error on lstat.

* modules/canonicalize (Depends-on): Add extensions, lstat,
pathmax, stdlib.
(Files): Drop pathmax.h.
(configure.ac): Adjust macro name.
* modules/canonicalize-lgpl (Depends-on): Add errno, extensions,
lstat, stdlib, sys_stat.
* m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME): Rename...
(gl_FUNC_CANONICALIZE_FILENAME_MODE): ...to this, and require
extensions.
* m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL)
(gl_CANONICALIZE_LGPL_SEPARATE): Require extensions.
(gl_PREREQ_CANONICALIZE_LGPL): Assume unistd.h.
* lib/canonicalize.h (canonicalize_file_name): Use <stdlib.h>
declaration, if available.
* lib/canonicalize-lgpl.c [HAVE_READLINK]: Delete this condition;
we can rely on the readlink module.
(MAXSYMLINKS): Also consult SYMLOOP_MAX.
(includes): Use <unistd.h> unconditionally.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/canonicalize-lgpl.c
lib/canonicalize.h
m4/canonicalize-lgpl.m4
m4/canonicalize.m4
modules/canonicalize
modules/canonicalize-lgpl

index af6ee58..4bfc445 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2009-09-17  Eric Blake  <ebb9@byu.net>
 
+       canonicalize, canonicalize-lgpl: update module dependencies
+       * modules/canonicalize (Depends-on): Add extensions, lstat,
+       pathmax, stdlib.
+       (Files): Drop pathmax.h.
+       (configure.ac): Adjust macro name.
+       * modules/canonicalize-lgpl (Depends-on): Add errno, extensions,
+       lstat, stdlib, sys_stat.
+       * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME): Rename...
+       (gl_FUNC_CANONICALIZE_FILENAME_MODE): ...to this, and require
+       extensions.
+       * m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL)
+       (gl_CANONICALIZE_LGPL_SEPARATE): Require extensions.
+       (gl_PREREQ_CANONICALIZE_LGPL): Assume unistd.h.
+       * lib/canonicalize.h (canonicalize_file_name): Use <stdlib.h>
+       declaration, if available.
+       * lib/canonicalize-lgpl.c [HAVE_READLINK]: Delete this condition;
+       we can rely on the readlink module.
+       (MAXSYMLINKS): Also consult SYMLOOP_MAX.
+       (includes): Use <unistd.h> unconditionally.
+
+2009-09-17  Eric Blake  <ebb9@byu.net>
+
        maint: make Include sections of modules consistent
        * modules/alloca: Use only header name; no need to list #include.
        * modules/alloca-opt: Likewise.
index 6b5663a..ce52cbc 100644 (file)
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-
-#if HAVE_UNISTD_H || defined _LIBC
-# include <unistd.h>
-#endif
+#include <unistd.h>
 
 #include <limits.h>
 
 # include <sys/param.h>
 #endif
 #ifndef MAXSYMLINKS
-# define MAXSYMLINKS 20
+# ifdef SYMLOOP_MAX
+#  define MAXSYMLINKS SYMLOOP_MAX
+# else
+#  define MAXSYMLINKS 20
+# endif
 #endif
 
 #include <sys/stat.h>
 #  define __getcwd(buf, max) getwd (buf)
 # endif
 # define __readlink readlink
-  /* On systems without symbolic links, call stat() instead of lstat().  */
-# if !defined S_ISLNK && !HAVE_READLINK
-#  define lstat stat
-# endif
 #endif
 
 /* Return the canonical absolute name of file NAME.  A canonical name
@@ -97,9 +94,7 @@ __realpath (const char *name, char *resolved)
   char *rpath, *dest, *extra_buf = NULL;
   const char *start, *end, *rpath_limit;
   long int path_max;
-#if HAVE_READLINK
   int num_links = 0;
-#endif
 
   if (name == NULL)
     {
@@ -237,7 +232,6 @@ __realpath (const char *name, char *resolved)
 #endif
            goto error;
 
-#if HAVE_READLINK
          if (S_ISLNK (st.st_mode))
            {
              char *buf;
@@ -297,7 +291,6 @@ __realpath (const char *name, char *resolved)
                if (dest > rpath + 1)
                  while ((--dest)[-1] != '/');
            }
-#endif
        }
     }
   if (dest > rpath + 1 && dest[-1] == '/')
index 8ca4fb4..e068c20 100644 (file)
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2007 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ typedef enum canonicalize_mode_t canonicalize_mode_t;
 char *canonicalize_filename_mode (const char *, canonicalize_mode_t);
 # endif
 
-# if HAVE_DECL_CANONICALIZE_FILE_NAME
+# if HAVE_CANONICALIZE_FILE_NAME
 #  include <stdlib.h>
 # else
 /* Return a malloc'd string containing the canonical absolute name of
index 3a8ee2f..bd3a381 100644 (file)
@@ -1,4 +1,4 @@
-# canonicalize-lgpl.m4 serial 5
+# canonicalize-lgpl.m4 serial 6
 dnl Copyright (C) 2003, 2006-2007, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,7 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
 [
   dnl Do this replacement check manually because the file name is shorter
   dnl than the function name.
-  AC_CHECK_DECLS_ONCE([canonicalize_file_name])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
   if test $ac_cv_func_canonicalize_file_name = no; then
     AC_LIBOBJ([canonicalize-lgpl])
@@ -22,7 +22,7 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
 # (no AC_LIBOBJ).
 AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 [
-  AC_CHECK_DECLS_ONCE([canonicalize_file_name])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
   gl_PREREQ_CANONICALIZE_LGPL
 ])
@@ -30,6 +30,6 @@ AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 # Prerequisites of lib/canonicalize-lgpl.c.
 AC_DEFUN([gl_PREREQ_CANONICALIZE_LGPL],
 [
-  AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
   AC_CHECK_FUNCS_ONCE([getcwd readlink])
 ])
index 817edd5..0a42a41 100644 (file)
@@ -1,17 +1,19 @@
-#serial 12
+#serial 13
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Free Software
+# Foundation, Inc.
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2007 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 Jim Meyering.
 
-AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME],
-  [
-    AC_LIBOBJ([canonicalize])
+AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
+[
+  AC_LIBOBJ([canonicalize])
 
-    AC_CHECK_HEADERS_ONCE([sys/param.h])
-    AC_CHECK_DECLS_ONCE([canonicalize_file_name])
-    AC_CHECK_FUNCS_ONCE([canonicalize_file_name resolvepath])
-  ])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  AC_CHECK_FUNCS_ONCE([canonicalize_file_name resolvepath])
+])
index e24be3d..a7e61a6 100644 (file)
@@ -4,22 +4,24 @@ Return the canonical absolute name of a given file.
 Files:
 lib/canonicalize.h
 lib/canonicalize.c
-lib/pathmax.h
 m4/canonicalize.m4
 
 Depends-on:
 areadlink-with-size
 errno
+extensions
 file-set
 filenamecat
 hash-triple
+lstat
 memmove
+pathmax
 sys_stat
 xalloc
 xgetcwd
 
 configure.ac:
-AC_FUNC_CANONICALIZE_FILE_NAME
+gl_FUNC_CANONICALIZE_FILENAME_MODE
 gl_MODULE_INDICATOR([canonicalize])
 
 Makefile.am:
index b462c61..45a9a43 100644 (file)
@@ -8,10 +8,15 @@ m4/canonicalize-lgpl.m4
 
 Depends-on:
 alloca-opt
+errno
+extensions
+lstat
 malloca
 memmove
 pathmax
 readlink
+stdlib
+sys_stat
 
 configure.ac:
 gl_CANONICALIZE_LGPL