diff options
author | Daniel Colascione <dancol@dancol.org> | 2019-06-23 18:19:08 -0700 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2019-06-23 18:19:08 -0700 |
commit | b9ac4f815ebaa1acb0d045fe9583f665efa6f628 (patch) | |
tree | f2bfcf685bb9f83a67c5f70fe8e4f65ef16d8690 /m4 | |
parent | f3b1b5fb5034de026adc41cf2403cff42f4a0b67 (diff) | |
download | emacs-b9ac4f815ebaa1acb0d045fe9583f665efa6f628.tar.gz |
Fix locating pdump by symlink
* admin/merge-gnulib (GNULIB_MODULES): Add canonicalize-lgpl module
* build-aux/config.guess, build-aux/gitlog-to-changelog,
build-aux/update-copyright, lib/canonicalize-lgpl.c,
lib/gnulib.mk.in, lib/malloca.c, lib/malloca.h, lib/pathmax.h,
m4/canonicalize.m4, m4/double-slash-root.m4, m4/gnulib-comp.m4,
m4/malloca.m4, my/pathmax.4: copy from GNUlib or regenerate from
update
* src/emacs.c: find dump by canonical path
Diffstat (limited to 'm4')
-rw-r--r-- | m4/canonicalize.m4 | 133 | ||||
-rw-r--r-- | m4/double-slash-root.m4 | 38 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 43 | ||||
-rw-r--r-- | m4/malloca.m4 | 15 | ||||
-rw-r--r-- | m4/pathmax.m4 | 42 |
5 files changed, 271 insertions, 0 deletions
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 new file mode 100644 index 00000000000..b61747bd1a5 --- /dev/null +++ b/m4/canonicalize.m4 @@ -0,0 +1,133 @@ +# canonicalize.m4 serial 30 + +dnl Copyright (C) 2003-2007, 2009-2019 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 with or without modifications, as long as this notice is preserved. + +# Provides canonicalize_file_name and canonicalize_filename_mode, but does +# not provide or fix realpath. +AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_FUNCS_ONCE([canonicalize_file_name]) + AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) + AC_REQUIRE([gl_FUNC_REALPATH_WORKS]) + if test $ac_cv_func_canonicalize_file_name = no; then + HAVE_CANONICALIZE_FILE_NAME=0 + else + case "$gl_cv_func_realpath_works" in + *yes) ;; + *) REPLACE_CANONICALIZE_FILE_NAME=1 ;; + esac + fi +]) + +# Provides canonicalize_file_name and realpath. +AC_DEFUN([gl_CANONICALIZE_LGPL], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE]) + if test $ac_cv_func_canonicalize_file_name = no; then + HAVE_CANONICALIZE_FILE_NAME=0 + if test $ac_cv_func_realpath = no; then + HAVE_REALPATH=0 + else + case "$gl_cv_func_realpath_works" in + *yes) ;; + *) REPLACE_REALPATH=1 ;; + esac + fi + else + case "$gl_cv_func_realpath_works" in + *yes) + ;; + *) + REPLACE_CANONICALIZE_FILE_NAME=1 + REPLACE_REALPATH=1 + ;; + esac + fi +]) + +# Like gl_CANONICALIZE_LGPL, except prepare for separate compilation +# (no REPLACE_CANONICALIZE_FILE_NAME, no REPLACE_REALPATH, no AC_LIBOBJ). +AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_FUNCS_ONCE([canonicalize_file_name getcwd readlink]) + AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) + AC_REQUIRE([gl_FUNC_REALPATH_WORKS]) + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) + +# Check whether realpath works. Assume that if a platform has both +# realpath and canonicalize_file_name, but the former is broken, then +# so is the latter. +AC_DEFUN([gl_FUNC_REALPATH_WORKS], +[ + AC_CHECK_FUNCS_ONCE([realpath]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [ + touch conftest.a + mkdir conftest.d + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + ]GL_NOCRASH[ + #include <stdlib.h> + #include <string.h> + ]], [[ + int result = 0; + { + char *name = realpath ("conftest.a", NULL); + if (!(name && *name == '/')) + result |= 1; + free (name); + } + { + char *name = realpath ("conftest.b/../conftest.a", NULL); + if (name != NULL) + result |= 2; + free (name); + } + { + char *name = realpath ("conftest.a/", NULL); + if (name != NULL) + result |= 4; + free (name); + } + { + char *name1 = realpath (".", NULL); + char *name2 = realpath ("conftest.d//./..", NULL); + if (! name1 || ! name2 || strcmp (name1, name2)) + result |= 8; + free (name1); + free (name2); + } + return result; + ]]) + ], + [gl_cv_func_realpath_works=yes], + [gl_cv_func_realpath_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_realpath_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_realpath_works="guessing no" ;; + # If we don't know, assume the worst. + *) gl_cv_func_realpath_works="guessing no" ;; + esac + ]) + rm -rf conftest.a conftest.d + ]) + case "$gl_cv_func_realpath_works" in + *yes) + AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath() + can malloc memory, always gives an absolute path, and handles + trailing slash correctly.]) + ;; + esac +]) diff --git a/m4/double-slash-root.m4 b/m4/double-slash-root.m4 new file mode 100644 index 00000000000..0c5afb17156 --- /dev/null +++ b/m4/double-slash-root.m4 @@ -0,0 +1,38 @@ +# double-slash-root.m4 serial 4 -*- Autoconf -*- +dnl Copyright (C) 2006, 2008-2019 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 with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_DOUBLE_SLASH_ROOT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], + [ if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # <bug-gnulib@gnu.org>. + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi]) + if test "$gl_cv_double_slash_root" = yes; then + AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], + [Define to 1 if // is a file system root distinct from /.]) + fi +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 4627575bf63..cb6dce15ccf 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -52,6 +52,7 @@ AC_DEFUN([gl_EARLY], # Code from module byteswap: # Code from module c-ctype: # Code from module c-strcase: + # Code from module canonicalize-lgpl: # Code from module careadlinkat: # Code from module clock-time: # Code from module cloexec: @@ -113,6 +114,7 @@ AC_DEFUN([gl_EARLY], # Code from module limits-h: # Code from module localtime-buffer: # Code from module lstat: + # Code from module malloca: # Code from module manywarnings: # Code from module memmem-simple: # Code from module memrchr: @@ -125,6 +127,7 @@ AC_DEFUN([gl_EARLY], # Code from module nstrftime: # Code from module open: # Code from module openat-h: + # Code from module pathmax: # Code from module pipe2: # Code from module pselect: # Code from module pthread_sigmask: @@ -199,6 +202,13 @@ AC_DEFUN([gl_INIT], gl_FUNC_ALLOCA gl___BUILTIN_EXPECT gl_BYTESWAP + gl_CANONICALIZE_LGPL + if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then + AC_LIBOBJ([canonicalize-lgpl]) + fi + gl_MODULE_INDICATOR([canonicalize-lgpl]) + gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name]) + gl_STDLIB_MODULE_INDICATOR([realpath]) AC_CHECK_FUNCS_ONCE([readlinkat]) gl_CLOCK_TIME gl_MODULE_INDICATOR([close-stream]) @@ -447,9 +457,11 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467=false gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9=false + gl_gnulib_enabled_malloca=false gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false gl_gnulib_enabled_open=false gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false + gl_gnulib_enabled_pathmax=false gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false gl_gnulib_enabled_strtoll=false gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false @@ -561,6 +573,14 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9=true fi } + func_gl_gnulib_m4code_malloca () + { + if ! $gl_gnulib_enabled_malloca; then + gl_MALLOCA + gl_gnulib_enabled_malloca=true + func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec + fi + } func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31 () { if ! $gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31; then @@ -593,6 +613,13 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=true fi } + func_gl_gnulib_m4code_pathmax () + { + if ! $gl_gnulib_enabled_pathmax; then + gl_PATHMAX + gl_gnulib_enabled_pathmax=true + fi + } func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c () { if ! $gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c; then @@ -617,6 +644,12 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true fi } + if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then + func_gl_gnulib_m4code_malloca + fi + if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then + func_gl_gnulib_m4code_pathmax + fi if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b fi @@ -676,9 +709,11 @@ AC_DEFUN([gl_INIT], AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) AM_CONDITIONAL([gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467], [$gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467]) AM_CONDITIONAL([gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9], [$gl_gnulib_enabled_2049e887c7e5308faad27b3f894bb8c9]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_malloca], [$gl_gnulib_enabled_malloca]) AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], [$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31]) AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open]) AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], [$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax]) AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec]) @@ -845,6 +880,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/c-strcase.h lib/c-strcasecmp.c lib/c-strncasecmp.c + lib/canonicalize-lgpl.c lib/careadlinkat.c lib/careadlinkat.h lib/cdefs.h @@ -915,6 +951,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/localtime-buffer.c lib/localtime-buffer.h lib/lstat.c + lib/malloca.c + lib/malloca.h lib/md5.c lib/md5.h lib/memmem.c @@ -928,6 +966,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/openat-priv.h lib/openat-proc.c lib/openat.h + lib/pathmax.h lib/pipe2.c lib/pselect.c lib/pthread_sigmask.c @@ -1001,6 +1040,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/alloca.m4 m4/builtin-expect.m4 m4/byteswap.m4 + m4/canonicalize.m4 m4/clock_time.m4 m4/copy-file-range.m4 m4/count-leading-zeros.m4 @@ -1009,6 +1049,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/d-type.m4 m4/dirent_h.m4 m4/dirfd.m4 + m4/double-slash-root.m4 m4/dup2.m4 m4/eealloc.m4 m4/environ.m4 @@ -1048,6 +1089,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/localtime-buffer.m4 m4/longlong.m4 m4/lstat.m4 + m4/malloca.m4 m4/manywarnings-c++.m4 m4/manywarnings.m4 m4/mbstate_t.m4 @@ -1064,6 +1106,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/off_t.m4 m4/open-cloexec.m4 m4/open.m4 + m4/pathmax.m4 m4/pipe2.m4 m4/pselect.m4 m4/pthread_sigmask.m4 diff --git a/m4/malloca.m4 b/m4/malloca.m4 new file mode 100644 index 00000000000..820f40a8a88 --- /dev/null +++ b/m4/malloca.m4 @@ -0,0 +1,15 @@ +# malloca.m4 serial 1 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2019 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MALLOCA], +[ + dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables + dnl @ALLOCA@ and @LTALLOCA@. + dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) +]) diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 new file mode 100644 index 00000000000..0770aca3aac --- /dev/null +++ b/m4/pathmax.m4 @@ -0,0 +1,42 @@ +# pathmax.m4 serial 11 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2019 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) + +# Expands to a piece of C program that defines PATH_MAX in the same way as +# "pathmax.h" will do. +AC_DEFUN([gl_PATHMAX_SNIPPET], [[ +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <limits.h> +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include <sys/param.h> +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +]]) + +# Prerequisites of gl_PATHMAX_SNIPPET. +AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) +]) |