diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/extensions.m4 | 5 | ||||
-rw-r--r-- | m4/extern-inline.m4 | 40 | ||||
-rw-r--r-- | m4/gnulib-common.m4 | 58 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 29 | ||||
-rw-r--r-- | m4/manywarnings.m4 | 30 | ||||
-rw-r--r-- | m4/pkg.m4 | 214 | ||||
-rw-r--r-- | m4/pthread_sigmask.m4 | 90 | ||||
-rw-r--r-- | m4/readlinkat.m4 | 15 | ||||
-rw-r--r-- | m4/stdalign.m4 | 8 | ||||
-rw-r--r-- | m4/stdarg.m4 | 78 | ||||
-rw-r--r-- | m4/stdbool.m4 | 100 | ||||
-rw-r--r-- | m4/stddef_h.m4 | 8 | ||||
-rw-r--r-- | m4/stdio_h.m4 | 3 | ||||
-rw-r--r-- | m4/stdlib_h.m4 | 2 | ||||
-rw-r--r-- | m4/stpcpy.m4 | 25 | ||||
-rw-r--r-- | m4/timer_time.m4 | 39 | ||||
-rw-r--r-- | m4/unistd_h.m4 | 4 | ||||
-rw-r--r-- | m4/vararrays.m4 | 68 |
18 files changed, 520 insertions, 296 deletions
diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 37f55ca3d15..cf285ba273a 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -68,6 +68,10 @@ dnl configure.ac when using autoheader 2.62. #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS @@ -100,6 +104,7 @@ dnl configure.ac when using autoheader 2.62. AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([__USE_MINGW_ANSI_STDIO]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 index 240150efbc7..0edbe3c81c6 100644 --- a/m4/extern-inline.m4 +++ b/m4/extern-inline.m4 @@ -19,13 +19,28 @@ AC_DEFUN([gl_EXTERN_INLINE], 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations. - OS X 10.8 and earlier mishandle it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like <ctype.h>. For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. - Perhaps Apple will fix this some day. */ -#if (defined __APPLE__ \ + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ @@ -33,19 +48,19 @@ AC_DEFUN([gl_EXTERN_INLINE], && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) -# define _GL_EXTERN_INLINE_APPLE_BUG +# define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !(defined __SUNPRO_C && __STDC__))) \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) @@ -59,6 +74,11 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_EXTERN_INLINE static _GL_UNUSED #endif +/* In GCC, suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA @@ -66,10 +86,6 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif - /* Suppress GCC's bogus "no previous prototype for 'FOO'" - and "no previous declaration for 'FOO'" diagnostics, - when FOO is an inline function in the header; see - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 20ce40e7441..31e5f9499e0 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 34 +# gnulib-common.m4 serial 36 dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -49,6 +49,16 @@ AC_DEFUN([gl_COMMON_BODY], [ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -309,26 +319,28 @@ m4_ifdef([AC_PROG_MKDIR_P], [ ]) # AC_C_RESTRICT -# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, -# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ -# works. -# This definition can be removed once autoconf >= 2.62 can be assumed. -# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. -m4_ifndef([AC_AUTOCONF_VERSION],[ +# This definition is copied from post-2.69 Autoconf and overrides the +# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed +# once autoconf >= 2.70 can be assumed. It's painful to check version +# numbers, and in practice this macro is more up-to-date than Autoconf +# is, so override Autoconf unconditionally. AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - }]], - [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + ]], + [[int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done @@ -338,21 +350,21 @@ AC_DEFUN([AC_C_RESTRICT], nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict, even - though the corresponding Sun C compiler does, which causes - "#define restrict _Restrict" in the previous line. Perhaps some future - version of Sun C++ will work with _Restrict; if so, it'll probably - define __RESTRICT, just as Sun C does. */ +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict +# define __restrict__ #endif]) case $ac_cv_c_restrict in restrict) ;; no) AC_DEFINE([restrict], []) ;; *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac -]) -]) +])# AC_C_RESTRICT # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 0ba2d7950af..49fdf5ef199 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -119,17 +119,11 @@ AC_DEFUN([gl_EARLY], # Code from module stat: # Code from module stat-time: # Code from module stdalign: - # Code from module stdarg: - dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode - dnl for the builtin va_copy to work. With Autoconf 2.60 or later, - dnl gl_PROG_CC_C99 arranges for this. With older Autoconf gl_PROG_CC_C99 - dnl shouldn't hurt, though installers are on their own to set c99 mode. - gl_PROG_CC_C99 - # Code from module stdbool: # Code from module stddef: # Code from module stdint: # Code from module stdio: # Code from module stdlib: + # Code from module stpcpy: # Code from module strftime: # Code from module string: # Code from module strtoimax: @@ -153,7 +147,9 @@ AC_DEFUN([gl_EARLY], # Code from module unsetenv: # Code from module update-copyright: # Code from module utimens: + # Code from module vararrays: # Code from module verify: + # Code from module vla: # Code from module warnings: # Code from module xalloc-oversized: ]) @@ -327,7 +323,7 @@ AC_DEFUN([gl_INIT], fi gl_UNISTD_MODULE_INDICATOR([readlink]) gl_FUNC_READLINKAT - if test $HAVE_READLINKAT = 0; then + if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then AC_LIBOBJ([readlinkat]) fi gl_UNISTD_MODULE_INDICATOR([readlinkat]) @@ -342,12 +338,16 @@ AC_DEFUN([gl_INIT], gl_STAT_TIME gl_STAT_BIRTHTIME gl_STDALIGN_H - gl_STDARG_H - AM_STDBOOL_H gl_STDDEF_H gl_STDINT_H gl_STDIO_H gl_STDLIB_H + gl_FUNC_STPCPY + if test $HAVE_STPCPY = 0; then + AC_LIBOBJ([stpcpy]) + gl_PREREQ_STPCPY + fi + gl_STRING_MODULE_INDICATOR([stpcpy]) gl_FUNC_GNU_STRFTIME gl_HEADER_STRING_H gl_FUNC_STRTOIMAX @@ -392,6 +392,7 @@ AC_DEFUN([gl_INIT], fi gl_STDLIB_MODULE_INDICATOR([unsetenv]) gl_UTIMENS + AC_C_VARARRAYS gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false gl_gnulib_enabled_dosname=false gl_gnulib_enabled_euidaccess=false @@ -891,12 +892,11 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stat-time.h lib/stat.c lib/stdalign.in.h - lib/stdarg.in.h - lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h lib/stdio.in.h lib/stdlib.in.h + lib/stpcpy.c lib/strftime.c lib/strftime.h lib/string.in.h @@ -927,6 +927,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/utimens.c lib/utimens.h lib/verify.h + lib/vla.h lib/xalloc-oversized.h m4/00gnulib.m4 m4/absolute-header.m4 @@ -998,12 +999,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stat-time.m4 m4/stat.m4 m4/stdalign.m4 - m4/stdarg.m4 - m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 m4/stdio_h.m4 m4/stdlib_h.m4 + m4/stpcpy.m4 m4/strftime.m4 m4/string_h.m4 m4/strtoimax.m4 @@ -1026,6 +1026,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/utimbuf.m4 m4/utimens.m4 m4/utimes.m4 + m4/vararrays.m4 m4/warn-on-use.m4 m4/warnings.m4 m4/wchar_t.m4 diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index e1cee6cf9d1..3e6dd215ced 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -1,4 +1,4 @@ -# manywarnings.m4 serial 6 +# manywarnings.m4 serial 7 dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -93,6 +93,14 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], fi # List all gcc warning categories. + # To compare this list to your installed GCC's, run this Bash command: + # + # comm -3 \ + # <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \ + # <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort | + # grep -v -x -f <( + # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec)) + gl_manywarn_set= for gl_manywarn_item in \ -W \ @@ -111,6 +119,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wcomments \ -Wcoverage-mismatch \ -Wcpp \ + -Wdate-time \ -Wdeprecated \ -Wdeprecated-declarations \ -Wdisabled-optimization \ @@ -150,9 +159,9 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wnarrowing \ -Wnested-externs \ -Wnonnull \ - -Wnormalized=nfc \ -Wold-style-declaration \ -Wold-style-definition \ + -Wopenmp-simd \ -Woverflow \ -Woverlength-strings \ -Woverride-init \ @@ -203,13 +212,26 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], -Wvla \ -Wvolatile-register-var \ -Wwrite-strings \ - -fdiagnostics-show-option \ - -funit-at-a-time \ \ ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done + # gcc --help=warnings outputs an unusual form for this option; list + # it here so that the above 'comm' command doesn't report a false match. + gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc" + + # These are needed for older GCC versions. + if test -n "$GCC"; then + case `($CC --version) 2>/dev/null` in + 'gcc (GCC) '[[0-3]].* | \ + 'gcc (GCC) '4.[[0-7]].*) + gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option" + gl_manywarn_set="$gl_manywarn_set -funit-at-a-time" + ;; + esac + fi + # Disable specific options as needed. if test "$gl_cv_cc_nomfi_needed" = yes; then gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 00000000000..c5b26b52e6c --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,214 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index 4ba073231f9..5153828a969 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 @@ -1,4 +1,4 @@ -# pthread_sigmask.m4 serial 13 +# pthread_sigmask.m4 serial 15 dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,7 +40,7 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], LIBS="$gl_save_LIBS" ]) if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then - dnl pthread_sigmask is available with -lpthread. + dnl pthread_sigmask is available with -pthread or -lpthread. LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" else dnl pthread_sigmask is not available at all. @@ -86,7 +86,7 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], AC_SUBST([LIB_PTHREAD_SIGMASK]) dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the - dnl same: either both empty or both "-lpthread". + dnl same. dnl Now test for some bugs in the system function. if test $HAVE_PTHREAD_SIGMASK = 1; then @@ -97,39 +97,44 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], dnl with -lpthread, the pthread_sigmask() function always returns 0 and has dnl no effect. if test -z "$LIB_PTHREAD_SIGMASK"; then - AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], - [gl_cv_func_pthread_sigmask_in_libc_works], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <pthread.h> -#include <signal.h> -#include <stddef.h> -int main () -{ - sigset_t set; - sigemptyset (&set); - return pthread_sigmask (1729, &set, NULL) != 0; -}]])], - [gl_cv_func_pthread_sigmask_in_libc_works=no], - [gl_cv_func_pthread_sigmask_in_libc_works=yes], - [ -changequote(,)dnl - case "$host_os" in - freebsd* | hpux* | solaris | solaris2.[2-9]*) - gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; - *) - gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; - esac -changequote([,])dnl - ]) - ]) - case "$gl_cv_func_pthread_sigmask_in_libc_works" in - *no) - REPLACE_PTHREAD_SIGMASK=1 - AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], - [Define to 1 if pthread_sigmask() may returns 0 and have no effect.]) - ;; + case " $LIBS " in + *' -pthread '*) ;; + *' -lpthread '*) ;; + *) + AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], + [gl_cv_func_pthread_sigmask_in_libc_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include <pthread.h> + #include <signal.h> + #include <stddef.h> + int main () + { + sigset_t set; + sigemptyset (&set); + return pthread_sigmask (1729, &set, NULL) != 0; + }]])], + [gl_cv_func_pthread_sigmask_in_libc_works=no], + [gl_cv_func_pthread_sigmask_in_libc_works=yes], + [ + changequote(,)dnl + case "$host_os" in + freebsd* | hpux* | solaris | solaris2.[2-9]*) + gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; + *) + gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; + esac + changequote([,])dnl + ]) + ]) + case "$gl_cv_func_pthread_sigmask_in_libc_works" in + *no) + REPLACE_PTHREAD_SIGMASK=1 + AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], + [Define to 1 if pthread_sigmask may return 0 and have no effect.]) + ;; + esac;; esac fi @@ -184,11 +189,12 @@ int main () *) gl_cv_func_pthread_sigmask_unblock_works="guessing yes";; esac - dnl Here we link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK, - dnl otherwise we get a false positive on those platforms where - dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no". - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" + m4_ifdef([gl_][THREADLIB], + [dnl Link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK. + dnl Otherwise we get a false positive on those platforms where + dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no". + gl_save_LIBS=$LIBS + LIBS="$LIBS $LIBMULTITHREAD"]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <pthread.h> @@ -227,7 +233,7 @@ int main () [:], [gl_cv_func_pthread_sigmask_unblock_works=no], [:]) - LIBS="$gl_save_LIBS" + m4_ifdef([gl_][THREADLIB], [LIBS=$gl_save_LIBS]) ]) case "$gl_cv_func_pthread_sigmask_unblock_works" in *no) diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4 index 65c0689c114..f9ed9436af6 100644 --- a/m4/readlinkat.m4 +++ b/m4/readlinkat.m4 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # See if we need to provide readlinkat replacement. dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. @@ -15,5 +15,18 @@ AC_DEFUN([gl_FUNC_READLINKAT], AC_CHECK_FUNCS_ONCE([readlinkat]) if test $ac_cv_func_readlinkat = no; then HAVE_READLINKAT=0 + else + AC_CACHE_CHECK([whether readlinkat signature is correct], + [gl_cv_decl_readlinkat_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> + /* Check whether original declaration has correct type. */ + ssize_t readlinkat (int, char const *, char *, size_t);]])], + [gl_cv_decl_readlinkat_works=yes], + [gl_cv_decl_readlinkat_works=no])]) + if test "$gl_cv_decl_readlink_works" != yes; then + REPLACE_READLINKAT=1 + fi fi ]) diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 9efafe5c5b2..f60257f16ab 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -32,8 +32,12 @@ AC_DEFUN([gl_STDALIGN_H], /* Test _Alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ - || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \ - || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) + || (defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__) \ + || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ + || __ICC || 0x5110 <= __SUNPRO_C \ + || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; }; char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 ? 1 : -1]; diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 deleted file mode 100644 index 732aa313b6a..00000000000 --- a/m4/stdarg.m4 +++ /dev/null @@ -1,78 +0,0 @@ -# stdarg.m4 serial 6 -dnl Copyright (C) 2006, 2008-2014 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. - -dnl From Bruno Haible. -dnl Provide a working va_copy in combination with <stdarg.h>. - -AC_DEFUN([gl_STDARG_H], -[ - STDARG_H='' - NEXT_STDARG_H='<stdarg.h>' - AC_MSG_CHECKING([for va_copy]) - AC_CACHE_VAL([gl_cv_func_va_copy], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stdarg.h>]], - [[ -#ifndef va_copy -void (*func) (va_list, va_list) = va_copy; -#endif - ]])], - [gl_cv_func_va_copy=yes], - [gl_cv_func_va_copy=no])]) - AC_MSG_RESULT([$gl_cv_func_va_copy]) - if test $gl_cv_func_va_copy = no; then - dnl Provide a substitute. - dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5 - dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h> - dnl which does '#undef va_copy', leading to a missing va_copy symbol. For - dnl this platform, we use an <stdarg.h> substitute. But we cannot use this - dnl approach on other platforms, because <stdarg.h> often defines only - dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do - dnl not work in this situation. - AC_EGREP_CPP([vaccine], - [#if defined _AIX && !defined __GNUC__ - AIX vaccine - #endif - ], [gl_aixcc=yes], [gl_aixcc=no]) - if test $gl_aixcc = yes; then - dnl Provide a substitute <stdarg.h> file. - STDARG_H=stdarg.h - gl_NEXT_HEADERS([stdarg.h]) - dnl Fallback for the case when <stdarg.h> contains only macro definitions. - if test "$gl_cv_next_stdarg_h" = '""'; then - gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' - NEXT_STDARG_H="$gl_cv_next_stdarg_h" - fi - else - dnl Provide a substitute in <config.h>, either __va_copy or as a simple - dnl assignment. - gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stdarg.h>]], - [[ -#ifndef __va_copy -error, bail out -#endif - ]])], - [gl_cv_func___va_copy=yes], - [gl_cv_func___va_copy=no])]) - if test $gl_cv_func___va_copy = yes; then - AC_DEFINE([va_copy], [__va_copy], - [Define as a macro for copying va_list variables.]) - else - AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ -#define gl_va_copy(a,b) ((a) = (b))]) - AC_DEFINE([va_copy], [gl_va_copy], - [Define as a macro for copying va_list variables.]) - fi - fi - fi - AC_SUBST([STDARG_H]) - AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) - AC_SUBST([NEXT_STDARG_H]) -]) diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 deleted file mode 100644 index 006ed52de5d..00000000000 --- a/m4/stdbool.m4 +++ /dev/null @@ -1,100 +0,0 @@ -# Check for stdbool.h that conforms to C99. - -dnl Copyright (C) 2002-2006, 2009-2014 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. - -#serial 5 - -# Prepare for substituting <stdbool.h> if it is not supported. - -AC_DEFUN([AM_STDBOOL_H], -[ - AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) - - # Define two additional variables used in the Makefile substitution. - - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' - else - STDBOOL_H='stdbool.h' - fi - AC_SUBST([STDBOOL_H]) - AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) - - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 - else - HAVE__BOOL=0 - fi - AC_SUBST([HAVE__BOOL]) -]) - -# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. -AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) - -# This version of the macro is needed in autoconf <= 2.68. - -AC_DEFUN([AC_CHECK_HEADER_STDBOOL], - [AC_CACHE_CHECK([for stdbool.h that conforms to C99], - [ac_cv_header_stdbool_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - ]], - [[ - bool e = &s; - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - ]])], - [ac_cv_header_stdbool_h=yes], - [ac_cv_header_stdbool_h=no])]) - AC_CHECK_TYPES([_Bool]) -]) diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index c555e295244..9659813bda6 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,5 +1,5 @@ -dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 4 +dnl A placeholder for <stddef.h>, for platforms that have issues. +# stddef_h.m4 serial 5 dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,9 @@ AC_DEFUN([gl_STDDEF_H], AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) STDDEF_H= + AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h], + [[#include <stddef.h> + ]]) if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -43,5 +46,6 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) + HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ]) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index d15913a3ca0..ef0dcc12d26 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -6,6 +6,9 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ + dnl For __USE_MINGW_ANSI_STDIO + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 03b448b94f4..86aff16eb05 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -55,6 +55,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) @@ -107,6 +108,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4 new file mode 100644 index 00000000000..966ba951f52 --- /dev/null +++ b/m4/stpcpy.m4 @@ -0,0 +1,25 @@ +# stpcpy.m4 serial 8 +dnl Copyright (C) 2002, 2007, 2009-2014 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_FUNC_STPCPY], +[ + dnl Persuade glibc <string.h> to declare stpcpy(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. + AC_REQUIRE([AC_C_RESTRICT]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_FUNCS([stpcpy]) + if test $ac_cv_func_stpcpy = no; then + HAVE_STPCPY=0 + fi +]) + +# Prerequisites of lib/stpcpy.c. +AC_DEFUN([gl_PREREQ_STPCPY], [ + : +]) diff --git a/m4/timer_time.m4 b/m4/timer_time.m4 index 8e2c921cbef..578ebe0809a 100644 --- a/m4/timer_time.m4 +++ b/m4/timer_time.m4 @@ -1,4 +1,4 @@ -# timer_time.m4 serial 2 +# timer_time.m4 serial 3 dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,12 @@ AC_DEFUN([gl_TIMER_TIME], dnl Based on clock_time.m4. See details there. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_THREADLIB]) + + dnl Test whether the gnulib module 'threadlib' is in use. + dnl Some packages like Emacs use --avoid=threadlib. + dnl Write the symbol in such a way that it does not cause 'aclocal' to pick + dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. + m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])]) LIB_TIMER_TIME= AC_SUBST([LIB_TIMER_TIME]) @@ -19,21 +24,21 @@ AC_DEFUN([gl_TIMER_TIME], AC_SEARCH_LIBS([timer_settime], [rt posix4], [test "$ac_cv_search_timer_settime" = "none required" || LIB_TIMER_TIME=$ac_cv_search_timer_settime]) - dnl GLIBC uses threads to emulate posix timers when kernel support - dnl is not available (like Linux < 2.6 or when used with kFreeBSD) - dnl Now the pthread lib is linked automatically in the normal case, - dnl but when linking statically, it needs to be explicitly specified. - AC_EGREP_CPP([Thread], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ - && !(__UCLIBC__ && __HAS_NO_THREADS__) - Thread emulation available - #endif -#endif - ], - [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"]) + m4_ifdef([gl_][THREADLIB], + [dnl GLIBC uses threads to emulate posix timers when kernel support + dnl is not available (like Linux < 2.6 or when used with kFreeBSD) + dnl Now the pthread lib is linked automatically in the normal case, + dnl but when linking statically, it needs to be explicitly specified. + AC_EGREP_CPP([Thread], + [#include <features.h> + #ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ + && !(__UCLIBC__ && __HAS_NO_THREADS__) + Thread emulation available + #endif + #endif + ], + [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])]) AC_CHECK_FUNCS([timer_settime]) LIBS=$gl_saved_libs ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 1fa197e6943..d7346a0b05b 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 67 +# unistd_h.m4 serial 68 dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -173,9 +173,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) diff --git a/m4/vararrays.m4 b/m4/vararrays.m4 new file mode 100644 index 00000000000..cbda525c75e --- /dev/null +++ b/m4/vararrays.m4 @@ -0,0 +1,68 @@ +# Check for variable-length arrays. + +# serial 5 + +# From Paul Eggert + +# Copyright (C) 2001, 2009-2014 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. + +# This is a copy of AC_C_VARARRAYS from a recent development version +# of Autoconf. It replaces Autoconf's version, or for pre-2.61 autoconf +# it defines the macro that Autoconf lacks. +AC_DEFUN([AC_C_VARARRAYS], +[ + AC_CACHE_CHECK([for variable-length arrays], + ac_cv_c_vararrays, + [AC_EGREP_CPP([defined], + [#ifdef __STDC_NO_VLA__ + defined + #endif + ], + [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* Test for VLA support. This test is partly inspired + from examples in the C standard. Use at least two VLA + functions to detect the GCC 3.4.3 bug described in: + http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00014.html + */ + #ifdef __STDC_NO_VLA__ + syntax error; + #else + extern int n; + int B[100]; + int fvla (int m, int C[m][m]); + + int + simple (int count, int all[static count]) + { + return all[count - 1]; + } + + int + fvla (int m, int C[m][m]) + { + typedef int VLA[m][m]; + VLA x; + int D[m]; + static int (*q)[m] = &B; + int (*s)[n] = q; + return C && &x[0][0] == &D[0] && &D[0] == s[0]; + } + #endif + ]])], + [ac_cv_c_vararrays=yes], + [ac_cv_c_vararrays=no])])]) + if test "$ac_cv_c_vararrays" = yes; then + dnl This is for compatibility with Autoconf 2.61-2.69. + AC_DEFINE([HAVE_C_VARARRAYS], 1, + [Define to 1 if C supports variable-length arrays.]) + elif test "$ac_cv_c_vararrays" = no; then + AC_DEFINE([__STDC_NO_VLA__], 1, + [Define to 1 if C does not support variable-length arrays, and + if the compiler does not already define this.]) + fi +]) |