+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
#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
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)
{
#endif
goto error;
-#if HAVE_READLINK
if (S_ISLNK (st.st_mode))
{
char *buf;
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
}
-#endif
}
}
if (dest > rpath + 1 && dest[-1] == '/')
/* 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
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
-# 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,
[
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])
# (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
])
# 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])
])
-#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])
+])
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:
Depends-on:
alloca-opt
+errno
+extensions
+lstat
malloca
memmove
pathmax
readlink
+stdlib
+sys_stat
configure.ac:
gl_CANONICALIZE_LGPL