summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gl/m4/getcwd.m433
-rw-r--r--gl/m4/gnulib-common.m449
-rw-r--r--gl/m4/largefile.m420
-rw-r--r--gl/tests/init.sh4
-rw-r--r--gl/tests/lstat.c10
-rw-r--r--gl/tests/open.c11
-rw-r--r--gl/tests/stat.c10
-rw-r--r--gl/tests/test-float.c9
-rw-r--r--gl/unistd.in.h3
-rw-r--r--maint.mk6
10 files changed, 112 insertions, 43 deletions
diff --git a/gl/m4/getcwd.m4 b/gl/m4/getcwd.m4
index 269fdd7c65..d3bbe597b3 100644
--- a/gl/m4/getcwd.m4
+++ b/gl/m4/getcwd.m4
@@ -6,7 +6,7 @@
# with or without modifications, as long as this notice is preserved.
# Written by Paul Eggert.
-# serial 7
+# serial 8
AC_DEFUN([gl_FUNC_GETCWD_NULL],
[
@@ -37,9 +37,6 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
return 0;
}
#endif
- /* If size is non-zero, allocation must fail if size is too small */
- if (getcwd (NULL, 1))
- return 5;
]])],
[gl_cv_func_getcwd_null=yes],
[gl_cv_func_getcwd_null=no],
@@ -55,6 +52,24 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
]])])
])
+AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
+[
+ AC_CACHE_CHECK([for getcwd with POSIX signature],
+ [gl_cv_func_getcwd_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>]],
+ [[extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ char *getcwd (char *, size_t);
+ ]])
+ ],
+ [gl_cv_func_getcwd_posix_signature=yes],
+ [gl_cv_func_getcwd_posix_signature=no])
+ ])
+])
dnl Guarantee that getcwd will malloc with a NULL first argument. Assumes
dnl that either the system getcwd is robust, or that calling code is okay
@@ -67,9 +82,10 @@ AC_DEFUN([gl_FUNC_GETCWD_LGPL],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+ AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
- case $gl_cv_func_getcwd_null in
- *yes) ;;
+ case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+ *yes,yes) ;;
*)
dnl Minimal replacement lib/getcwd-lgpl.c.
REPLACE_GETCWD=1
@@ -83,6 +99,7 @@ AC_DEFUN([gl_FUNC_GETCWD],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+ AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
gl_abort_bug=no
@@ -94,8 +111,8 @@ AC_DEFUN([gl_FUNC_GETCWD],
gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]);;
esac
- case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
- *yes,yes,no) ;;
+ case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature$gl_cv_func_getcwd_path_max,$gl_abort_bug in
+ *yes,yes,yes,no) ;;
*)
dnl Full replacement lib/getcwd.c, overrides LGPL replacement.
REPLACE_GETCWD=1;;
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 9dc8fbe8e4..8fc448fdc8 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 29
+# gnulib-common.m4 serial 30
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -213,6 +213,8 @@ m4_ifndef([AS_VAR_IF],
# gl_PROG_AR_RANLIB
# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
+# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
+# the values.
AC_DEFUN([gl_PROG_AR_RANLIB],
[
dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
@@ -220,24 +222,47 @@ AC_DEFUN([gl_PROG_AR_RANLIB],
dnl library formats. In particular, the GNU binutils programs ar, ranlib
dnl produce libraries that work only with gcc, not with cc.
AC_REQUIRE([AC_PROG_CC])
- AC_EGREP_CPP([Amsterdam],
+ AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
[
+ AC_EGREP_CPP([Amsterdam],
+ [
#ifdef __ACK__
Amsterdam
#endif
- ],
- [AR='cc -c.a'
- ARFLAGS='-o'
- RANLIB=':'
- ],
- [dnl Use the Automake-documented default values for AR and ARFLAGS.
- AR='ar'
- ARFLAGS='cru'
- dnl Use the ranlib program if it is available.
- AC_PROG_RANLIB
+ ],
+ [gl_cv_c_amsterdam_compiler=yes],
+ [gl_cv_c_amsterdam_compiler=no])
])
+ if test -z "$AR"; then
+ if test $gl_cv_c_amsterdam_compiler = yes; then
+ AR='cc -c.a'
+ if test -z "$ARFLAGS"; then
+ ARFLAGS='-o'
+ fi
+ else
+ dnl Use the Automake-documented default values for AR and ARFLAGS,
+ dnl but prefer ${host}-ar over ar (useful for cross-compiling).
+ AC_CHECK_TOOL([AR], [ar], [ar])
+ if test -z "$ARFLAGS"; then
+ ARFLAGS='cru'
+ fi
+ fi
+ else
+ if test -z "$ARFLAGS"; then
+ ARFLAGS='cru'
+ fi
+ fi
AC_SUBST([AR])
AC_SUBST([ARFLAGS])
+ if test -z "$RANLIB"; then
+ if test $gl_cv_c_amsterdam_compiler = yes; then
+ RANLIB=':'
+ else
+ dnl Use the ranlib program if it is available.
+ AC_PROG_RANLIB
+ fi
+ fi
+ AC_SUBST([RANLIB])
])
# AC_PROG_MKDIR_P
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index 6986244b39..d83fea1233 100644
--- a/gl/m4/largefile.m4
+++ b/gl/m4/largefile.m4
@@ -19,8 +19,8 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
incorrectly reject 9223372036854775807. */
@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1]];[]dnl
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1]];[]dnl
])
@@ -58,7 +58,7 @@ rm -rf conftest*[]dnl
# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
AC_DEFUN([AC_SYS_LARGEFILE],
[AC_ARG_ENABLE(largefile,
- [ --disable-largefile omit support for large files])
+ [ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CACHE_CHECK([for special C compiler options needed for large files],
@@ -67,13 +67,13 @@ if test "$enable_largefile" != no; then
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
- # IRIX 6.2 and later do not support large files by default,
- # so use the C compiler's -n32 option if that helps.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
- AC_COMPILE_IFELSE([], [break])
- CC="$CC -n32"
- AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
- break
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
+ AC_COMPILE_IFELSE([], [break])
+ CC="$CC -n32"
+ AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
+ break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
diff --git a/gl/tests/init.sh b/gl/tests/init.sh
index 0da6c1e328..e6f5f1c42c 100644
--- a/gl/tests/init.sh
+++ b/gl/tests/init.sh
@@ -208,8 +208,10 @@ export MALLOC_PERTURB_
# a partition, or to undo any other global state changes.
cleanup_ () { :; }
-if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
+if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
compare () { diff -u "$@"; }
+elif ( diff -c "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
+ compare () { diff -c "$@"; }
elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare () { cmp -s "$@"; }
else
diff --git a/gl/tests/lstat.c b/gl/tests/lstat.c
index b26065ede2..d786288f2b 100644
--- a/gl/tests/lstat.c
+++ b/gl/tests/lstat.c
@@ -17,6 +17,10 @@
/* written by Jim Meyering */
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+ the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
+ rpl_lstat. */
+#define __need_system_sys_stat_h
#include <config.h>
#if !HAVE_LSTAT
@@ -27,7 +31,6 @@ typedef int dummy;
#else /* HAVE_LSTAT */
/* Get the original definition of lstat. It might be defined as a macro. */
-# define __need_system_sys_stat_h
# include <sys/types.h>
# include <sys/stat.h>
# undef __need_system_sys_stat_h
@@ -39,7 +42,10 @@ orig_lstat (const char *filename, struct stat *buf)
}
/* Specification. */
-# include <sys/stat.h>
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+ eliminates this include because of the preliminary #include <sys/stat.h>
+ above. */
+# include "sys/stat.h"
# include <string.h>
# include <errno.h>
diff --git a/gl/tests/open.c b/gl/tests/open.c
index e60b619949..8dc36ef1e4 100644
--- a/gl/tests/open.c
+++ b/gl/tests/open.c
@@ -16,13 +16,16 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+ the system's <fcntl.h> here, so that orig_open doesn't recurse to
+ rpl_open. */
+#define __need_system_fcntl_h
#include <config.h>
/* Get the original definition of open. It might be defined as a macro. */
-#define __need_system_fcntl_h
#include <fcntl.h>
-#undef __need_system_fcntl_h
#include <sys/types.h>
+#undef __need_system_fcntl_h
static inline int
orig_open (const char *filename, int flags, mode_t mode)
@@ -31,7 +34,9 @@ orig_open (const char *filename, int flags, mode_t mode)
}
/* Specification. */
-#include <fcntl.h>
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+ this include because of the preliminary #include <fcntl.h> above. */
+#include "fcntl.h"
#include <errno.h>
#include <stdarg.h>
diff --git a/gl/tests/stat.c b/gl/tests/stat.c
index f07370dd06..1002f161bf 100644
--- a/gl/tests/stat.c
+++ b/gl/tests/stat.c
@@ -16,10 +16,13 @@
/* written by Eric Blake */
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+ the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
+ rpl_stat. */
+#define __need_system_sys_stat_h
#include <config.h>
/* Get the original definition of stat. It might be defined as a macro. */
-#define __need_system_sys_stat_h
#include <sys/types.h>
#include <sys/stat.h>
#undef __need_system_sys_stat_h
@@ -31,7 +34,10 @@ orig_stat (const char *filename, struct stat *buf)
}
/* Specification. */
-#include <sys/stat.h>
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+ eliminates this include because of the preliminary #include <sys/stat.h>
+ above. */
+#include "sys/stat.h"
#include <errno.h>
#include <limits.h>
diff --git a/gl/tests/test-float.c b/gl/tests/test-float.c
index 530181306f..57a472faea 100644
--- a/gl/tests/test-float.c
+++ b/gl/tests/test-float.c
@@ -298,7 +298,14 @@ test_long_double (void)
/* Check that 'long double' is at least as wide as 'double'. */
ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG);
- ASSERT (LDBL_MIN_EXP <= DBL_MIN_EXP);
+
+ /* Normally, we would also assert this:
+ ASSERT (LDBL_MIN_EXP <= DBL_MIN_EXP);
+ but at least on powerpc64 with gcc-4.4.4, it would fail:
+ $ :|gcc -dD -E -include stddef.h -|grep -E 'L?DBL_MIN_EXP'
+ #define __DBL_MIN_EXP__ (-1021)
+ #define __LDBL_MIN_EXP__ (-968)
+ */
ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP);
/* Check the value of LDBL_DIG. */
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 769ecf0d43..119cd142f4 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -85,7 +85,8 @@
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-# include <io.h>
+# include <io.h> /* mingw32, mingw64 */
+# include <direct.h> /* mingw64 */
#endif
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
diff --git a/maint.mk b/maint.mk
index d364934549..c9ffb95a5b 100644
--- a/maint.mk
+++ b/maint.mk
@@ -1235,9 +1235,9 @@ emit_upload_commands:
@echo =====================================
define emit-commit-log
- printf '%s\n' 'post-release administrivia' '' \
- '* NEWS: Add header line for next release.' \
- '* .prev-version: Record previous version.' \
+ printf '%s\n' 'maint: post-release administrivia' '' \
+ '* NEWS: Add header line for next release.' \
+ '* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef