Mercurial > hg > octave-lojdl > gnulib-hg
changeset 12009:5905adc25666
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 <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>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Fri, 11 Sep 2009 08:34:37 -0600 |
parents | 18ea6ab4e81d |
children | e5fd78d17104 |
files | ChangeLog lib/canonicalize-lgpl.c lib/canonicalize.h m4/canonicalize-lgpl.m4 m4/canonicalize.m4 modules/canonicalize modules/canonicalize-lgpl |
diffstat | 7 files changed, 54 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +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
--- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -31,10 +31,7 @@ #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> @@ -42,7 +39,11 @@ # 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> @@ -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 @@ 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 @@ #endif goto error; -#if HAVE_READLINK if (S_ISLNK (st.st_mode)) { char *buf; @@ -297,7 +291,6 @@ if (dest > rpath + 1) while ((--dest)[-1] != '/'); } -#endif } } if (dest > rpath + 1 && dest[-1] == '/')
--- 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 @@ 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
--- 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 @@ [ 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 @@ # (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 @@ # 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]) ])
--- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -1,17 +1,19 @@ -#serial 12 +#serial 13 -# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 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]) +])
--- a/modules/canonicalize +++ b/modules/canonicalize @@ -4,22 +4,24 @@ 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: