From: Eric Blake Date: Fri, 11 Sep 2009 14:34:37 +0000 (-0600) Subject: canonicalize, canonicalize-lgpl: update module dependencies X-Git-Tag: v0.1~5478 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=6cdf6086af1513a0a7cc54d8abd3d8634b452875;p=gnulib.git canonicalize, canonicalize-lgpl: update module dependencies 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 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 unconditionally. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index af6ee58eb..4bfc445d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2009-09-17 Eric Blake + 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 + 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 unconditionally. + +2009-09-17 Eric Blake + maint: make Include sections of modules consistent * modules/alloca: Use only header name; no need to list #include. * modules/alloca-opt: Likewise. diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index 6b5663a3d..ce52cbc22 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -31,10 +31,7 @@ #include #include #include - -#if HAVE_UNISTD_H || defined _LIBC -# include -#endif +#include #include @@ -42,7 +39,11 @@ # include #endif #ifndef MAXSYMLINKS -# define MAXSYMLINKS 20 +# ifdef SYMLOOP_MAX +# define MAXSYMLINKS SYMLOOP_MAX +# else +# define MAXSYMLINKS 20 +# endif #endif #include @@ -74,10 +75,6 @@ # 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] == '/') diff --git a/lib/canonicalize.h b/lib/canonicalize.h index 8ca4fb422..e068c20ea 100644 --- a/lib/canonicalize.h +++ b/lib/canonicalize.h @@ -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 # else /* Return a malloc'd string containing the canonical absolute name of diff --git a/m4/canonicalize-lgpl.m4 b/m4/canonicalize-lgpl.m4 index 3a8ee2f95..bd3a38142 100644 --- a/m4/canonicalize-lgpl.m4 +++ b/m4/canonicalize-lgpl.m4 @@ -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]) ]) diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index 817edd580..0a42a41ef 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -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]) +]) diff --git a/modules/canonicalize b/modules/canonicalize index e24be3d17..a7e61a67a 100644 --- a/modules/canonicalize +++ b/modules/canonicalize @@ -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: diff --git a/modules/canonicalize-lgpl b/modules/canonicalize-lgpl index b462c61bd..45a9a432b 100644 --- a/modules/canonicalize-lgpl +++ b/modules/canonicalize-lgpl @@ -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