aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-27 18:36:44 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-27 18:36:44 +0000
commit4f86276385dfd9fcbac0b7d774a8f69d9fea7bcf (patch)
treea8a5a984b8e48b991896dc56f840725bbaa69e51 /m4
parent171de1ba8843fdd06eca8844b70bbf0fcd2956d5 (diff)
downloadlibmicrohttpd-4f86276385dfd9fcbac0b7d774a8f69d9fea7bcf.tar.gz
libmicrohttpd-4f86276385dfd9fcbac0b7d774a8f69d9fea7bcf.zip
-update autotools logic to work nicely with the 'GNU libmicohttpd' package name
Diffstat (limited to 'm4')
-rw-r--r--m4/codeset.m415
-rw-r--r--m4/extern-inline.m4102
-rw-r--r--m4/fcntl-o.m495
-rw-r--r--m4/glibc2.m47
-rw-r--r--m4/glibc21.m414
-rw-r--r--m4/intdiv0.m417
-rw-r--r--m4/intl.m484
-rw-r--r--m4/intmax.m413
-rw-r--r--m4/inttypes-pri.m416
-rw-r--r--m4/inttypes_h.m419
-rw-r--r--m4/lcmessage.m418
-rw-r--r--m4/lock.m425
-rw-r--r--m4/longlong.m487
-rw-r--r--m4/printf-posix.m423
-rw-r--r--m4/size_max.m416
-rw-r--r--m4/stdint_h.m417
-rw-r--r--m4/threadlib.m4162
-rw-r--r--m4/visibility.m425
-rw-r--r--m4/wchar_t.m414
-rw-r--r--m4/wint_t.m414
-rw-r--r--m4/xsize.m45
21 files changed, 526 insertions, 262 deletions
diff --git a/m4/codeset.m4 b/m4/codeset.m4
index a53c0426..bc98201e 100644
--- a/m4/codeset.m4
+++ b/m4/codeset.m4
@@ -1,5 +1,6 @@
1# codeset.m4 serial 4 (gettext-0.18) 1# codeset.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016 Free Software Foundation,
3dnl Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -9,10 +10,12 @@ dnl From Bruno Haible.
9AC_DEFUN([AM_LANGINFO_CODESET], 10AC_DEFUN([AM_LANGINFO_CODESET],
10[ 11[
11 AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], 12 AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
12 [AC_TRY_LINK([#include <langinfo.h>], 13 [AC_LINK_IFELSE(
13 [char* cs = nl_langinfo(CODESET); return !cs;], 14 [AC_LANG_PROGRAM(
14 [am_cv_langinfo_codeset=yes], 15 [[#include <langinfo.h>]],
15 [am_cv_langinfo_codeset=no]) 16 [[char* cs = nl_langinfo(CODESET); return !cs;]])],
17 [am_cv_langinfo_codeset=yes],
18 [am_cv_langinfo_codeset=no])
16 ]) 19 ])
17 if test $am_cv_langinfo_codeset = yes; then 20 if test $am_cv_langinfo_codeset = yes; then
18 AC_DEFINE([HAVE_LANGINFO_CODESET], [1], 21 AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
new file mode 100644
index 00000000..1e578f3d
--- /dev/null
+++ b/m4/extern-inline.m4
@@ -0,0 +1,102 @@
1dnl 'extern inline' a la ISO C99.
2
3dnl Copyright 2012-2016 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8AC_DEFUN([gl_EXTERN_INLINE],
9[
10 AH_VERBATIM([extern_inline],
11[/* Please see the Gnulib manual for how to use these macros.
12
13 Suppress extern inline with HP-UX cc, as it appears to be broken; see
14 <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
15
16 Suppress extern inline with Sun C in standards-conformance mode, as it
17 mishandles inline functions that call each other. E.g., for 'inline void f
18 (void) { } inline void g (void) { f (); }', c99 incorrectly complains
19 'reference to static identifier "f" in extern inline function'.
20 This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
21
22 Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
23 on configurations that mistakenly use 'static inline' to implement
24 functions or macros in standard C headers like <ctype.h>. For example,
25 if isdigit is mistakenly implemented via a static inline function,
26 a program containing an extern inline function that calls isdigit
27 may not work since the C standard prohibits extern inline functions
28 from calling static functions. This bug is known to occur on:
29
30 OS X 10.8 and earlier; see:
31 http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html
32
33 DragonFly; see
34 http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
35
36 FreeBSD; see:
37 http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
38
39 OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
40 for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
41 Assume DragonFly and FreeBSD will be similar. */
42#if (((defined __APPLE__ && defined __MACH__) \
43 || defined __DragonFly__ || defined __FreeBSD__) \
44 && (defined __header_inline \
45 ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
46 && ! defined __clang__) \
47 : ((! defined _DONT_USE_CTYPE_INLINE_ \
48 && (defined __GNUC__ || defined __cplusplus)) \
49 || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
50 && defined __GNUC__ && ! defined __cplusplus))))
51# define _GL_EXTERN_INLINE_STDHEADER_BUG
52#endif
53#if ((__GNUC__ \
54 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
55 : (199901L <= __STDC_VERSION__ \
56 && !defined __HP_cc \
57 && !defined __PGI \
58 && !(defined __SUNPRO_C && __STDC__))) \
59 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
60# define _GL_INLINE inline
61# define _GL_EXTERN_INLINE extern inline
62# define _GL_EXTERN_INLINE_IN_USE
63#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
64 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
65# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
66 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
67# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
68# else
69# define _GL_INLINE extern inline
70# endif
71# define _GL_EXTERN_INLINE extern
72# define _GL_EXTERN_INLINE_IN_USE
73#else
74# define _GL_INLINE static _GL_UNUSED
75# define _GL_EXTERN_INLINE static _GL_UNUSED
76#endif
77
78/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
79 suppress bogus "no previous prototype for 'FOO'"
80 and "no previous declaration for 'FOO'" diagnostics,
81 when FOO is an inline function in the header; see
82 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
83 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
84#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
85# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
86# define _GL_INLINE_HEADER_CONST_PRAGMA
87# else
88# define _GL_INLINE_HEADER_CONST_PRAGMA \
89 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
90# endif
91# define _GL_INLINE_HEADER_BEGIN \
92 _Pragma ("GCC diagnostic push") \
93 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
94 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
95 _GL_INLINE_HEADER_CONST_PRAGMA
96# define _GL_INLINE_HEADER_END \
97 _Pragma ("GCC diagnostic pop")
98#else
99# define _GL_INLINE_HEADER_BEGIN
100# define _GL_INLINE_HEADER_END
101#endif])
102])
diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4
index d416a61c..24fcf88d 100644
--- a/m4/fcntl-o.m4
+++ b/m4/fcntl-o.m4
@@ -1,5 +1,5 @@
1# fcntl-o.m4 serial 1 1# fcntl-o.m4 serial 4
2dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,13 +12,26 @@ dnl Written by Paul Eggert.
12AC_DEFUN([gl_FCNTL_O_FLAGS], 12AC_DEFUN([gl_FCNTL_O_FLAGS],
13[ 13[
14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. 14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
15 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 15 dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
16 dnl AC_GNU_SOURCE.
17 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
18 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
19 [AC_REQUIRE([AC_GNU_SOURCE])])
20
21 AC_CHECK_HEADERS_ONCE([unistd.h])
22 AC_CHECK_FUNCS_ONCE([symlink])
16 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], 23 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
17 [AC_RUN_IFELSE( 24 [AC_RUN_IFELSE(
18 [AC_LANG_PROGRAM( 25 [AC_LANG_PROGRAM(
19 [[#include <sys/types.h> 26 [[#include <sys/types.h>
20 #include <sys/stat.h> 27 #include <sys/stat.h>
21 #include <unistd.h> 28 #if HAVE_UNISTD_H
29 # include <unistd.h>
30 #else /* on Windows with MSVC */
31 # include <io.h>
32 # include <stdlib.h>
33 # defined sleep(n) _sleep ((n) * 1000)
34 #endif
22 #include <fcntl.h> 35 #include <fcntl.h>
23 #ifndef O_NOATIME 36 #ifndef O_NOATIME
24 #define O_NOATIME 0 37 #define O_NOATIME 0
@@ -33,34 +46,74 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
33 }; 46 };
34 ]], 47 ]],
35 [[ 48 [[
36 int status = !constants; 49 int result = !constants;
50 #if HAVE_SYMLINK
37 { 51 {
38 static char const sym[] = "conftest.sym"; 52 static char const sym[] = "conftest.sym";
39 if (symlink (".", sym) != 0 53 if (symlink ("/dev/null", sym) != 0)
40 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) 54 result |= 2;
41 status |= 32; 55 else
56 {
57 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
58 if (fd >= 0)
59 {
60 close (fd);
61 result |= 4;
62 }
63 }
64 if (unlink (sym) != 0 || symlink (".", sym) != 0)
65 result |= 2;
66 else
67 {
68 int fd = open (sym, O_RDONLY | O_NOFOLLOW);
69 if (fd >= 0)
70 {
71 close (fd);
72 result |= 4;
73 }
74 }
42 unlink (sym); 75 unlink (sym);
43 } 76 }
77 #endif
44 { 78 {
45 static char const file[] = "confdefs.h"; 79 static char const file[] = "confdefs.h";
46 int fd = open (file, O_RDONLY | O_NOATIME); 80 int fd = open (file, O_RDONLY | O_NOATIME);
47 char c; 81 if (fd < 0)
48 struct stat st0, st1; 82 result |= 8;
49 if (fd < 0 83 else
50 || fstat (fd, &st0) != 0 84 {
51 || sleep (1) != 0 85 struct stat st0;
52 || read (fd, &c, 1) != 1 86 if (fstat (fd, &st0) != 0)
53 || close (fd) != 0 87 result |= 16;
54 || stat (file, &st1) != 0 88 else
55 || st0.st_atime != st1.st_atime) 89 {
56 status |= 64; 90 char c;
91 sleep (1);
92 if (read (fd, &c, 1) != 1)
93 result |= 24;
94 else
95 {
96 if (close (fd) != 0)
97 result |= 32;
98 else
99 {
100 struct stat st1;
101 if (stat (file, &st1) != 0)
102 result |= 40;
103 else
104 if (st0.st_atime != st1.st_atime)
105 result |= 64;
106 }
107 }
108 }
109 }
57 } 110 }
58 return status;]])], 111 return result;]])],
59 [gl_cv_header_working_fcntl_h=yes], 112 [gl_cv_header_working_fcntl_h=yes],
60 [case $? in #( 113 [case $? in #(
61 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 114 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
62 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 115 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
63 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( 116 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
64 *) gl_cv_header_working_fcntl_h='no';; 117 *) gl_cv_header_working_fcntl_h='no';;
65 esac], 118 esac],
66 [gl_cv_header_working_fcntl_h=cross-compiling])]) 119 [gl_cv_header_working_fcntl_h=cross-compiling])])
diff --git a/m4/glibc2.m4 b/m4/glibc2.m4
index f148c12c..785bba09 100644
--- a/m4/glibc2.m4
+++ b/m4/glibc2.m4
@@ -1,5 +1,6 @@
1# glibc2.m4 serial 2 1# glibc2.m4 serial 3
2dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2016 Free Software Foundation,
3dnl Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -15,7 +16,7 @@ AC_DEFUN([gt_GLIBC2],
15 [ 16 [
16#include <features.h> 17#include <features.h>
17#ifdef __GNU_LIBRARY__ 18#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ >= 2) 19 #if (__GLIBC__ >= 2) && !defined __UCLIBC__
19 Lucky GNU user 20 Lucky GNU user
20 #endif 21 #endif
21#endif 22#endif
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
index 68ada9d4..dafebf50 100644
--- a/m4/glibc21.m4
+++ b/m4/glibc21.m4
@@ -1,17 +1,18 @@
1# glibc21.m4 serial 4 1# glibc21.m4 serial 5
2dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2016 Free Software Foundation,
3dnl Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
6 7
7# Test for the GNU C Library, version 2.1 or newer. 8# Test for the GNU C Library, version 2.1 or newer, or uClibc.
8# From Bruno Haible. 9# From Bruno Haible.
9 10
10AC_DEFUN([gl_GLIBC21], 11AC_DEFUN([gl_GLIBC21],
11 [ 12 [
12 AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], 13 AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc],
13 [ac_cv_gnu_library_2_1], 14 [ac_cv_gnu_library_2_1],
14 [AC_EGREP_CPP([Lucky GNU user], 15 [AC_EGREP_CPP([Lucky],
15 [ 16 [
16#include <features.h> 17#include <features.h>
17#ifdef __GNU_LIBRARY__ 18#ifdef __GNU_LIBRARY__
@@ -19,6 +20,9 @@ AC_DEFUN([gl_GLIBC21],
19 Lucky GNU user 20 Lucky GNU user
20 #endif 21 #endif
21#endif 22#endif
23#ifdef __UCLIBC__
24 Lucky user
25#endif
22 ], 26 ],
23 [ac_cv_gnu_library_2_1=yes], 27 [ac_cv_gnu_library_2_1=yes],
24 [ac_cv_gnu_library_2_1=no]) 28 [ac_cv_gnu_library_2_1=no])
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4
index 289c4df5..744b99ea 100644
--- a/m4/intdiv0.m4
+++ b/m4/intdiv0.m4
@@ -1,5 +1,5 @@
1# intdiv0.m4 serial 3 (gettext-0.18) 1# intdiv0.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2008, 2010-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -18,7 +18,7 @@ AC_DEFUN([gt_INTDIV0],
18changequote(,)dnl 18changequote(,)dnl
19 case "$host_os" in 19 case "$host_os" in
20 macos* | darwin[6-9]* | darwin[1-9][0-9]*) 20 macos* | darwin[6-9]* | darwin[1-9][0-9]*)
21 # On MacOS X 10.2 or newer, just assume the same as when cross- 21 # On Mac OS X 10.2 or newer, just assume the same as when cross-
22 # compiling. If we were to perform the real test, 1 Crash Report 22 # compiling. If we were to perform the real test, 1 Crash Report
23 # dialog window would pop up. 23 # dialog window would pop up.
24 case "$host_cpu" in 24 case "$host_cpu" in
@@ -29,7 +29,8 @@ changequote(,)dnl
29 esac 29 esac
30changequote([,])dnl 30changequote([,])dnl
31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then 31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then
32 AC_TRY_RUN([ 32 AC_RUN_IFELSE(
33 [AC_LANG_SOURCE([[
33#include <stdlib.h> 34#include <stdlib.h>
34#include <signal.h> 35#include <signal.h>
35 36
@@ -37,7 +38,7 @@ static void
37sigfpe_handler (int sig) 38sigfpe_handler (int sig)
38{ 39{
39 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ 40 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
40 exit (sig != SIGFPE); 41 _exit (sig != SIGFPE);
41} 42}
42 43
43int x = 1; 44int x = 1;
@@ -59,9 +60,11 @@ int main ()
59 60
60 z = x / y; 61 z = x / y;
61 nan = y / y; 62 nan = y / y;
62 exit (1); 63 exit (2);
63} 64}
64], [gt_cv_int_divbyzero_sigfpe=yes], [gt_cv_int_divbyzero_sigfpe=no], 65]])],
66 [gt_cv_int_divbyzero_sigfpe=yes],
67 [gt_cv_int_divbyzero_sigfpe=no],
65 [ 68 [
66 # Guess based on the CPU. 69 # Guess based on the CPU.
67changequote(,)dnl 70changequote(,)dnl
diff --git a/m4/intl.m4 b/m4/intl.m4
index 335b23c2..42fac953 100644
--- a/m4/intl.m4
+++ b/m4/intl.m4
@@ -1,23 +1,23 @@
1# intl.m4 serial 17 (gettext-0.18) 1# intl.m4 serial 29 (gettext-0.19)
2dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6dnl 6dnl
7dnl This file can can be used in projects which are not available under 7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Library General Public 8dnl the GNU General Public License or the GNU Library General Public
9dnl License but which still want to provide support for the GNU gettext 9dnl License but which still want to provide support for the GNU gettext
10dnl functionality. 10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered 11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Library General Public License, and the rest of the GNU 12dnl by the GNU Library General Public License, and the rest of the GNU
13dnl gettext package package is covered by the GNU General Public License. 13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain. 14dnl They are *not* in the public domain.
15 15
16dnl Authors: 16dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009. 18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009.
19 19
20AC_PREREQ([2.52]) 20AC_PREREQ([2.60])
21 21
22dnl Checks for all prerequisites of the intl subdirectory, 22dnl Checks for all prerequisites of the intl subdirectory,
23dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, 23dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
@@ -25,7 +25,7 @@ dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
25AC_DEFUN([AM_INTL_SUBDIR], 25AC_DEFUN([AM_INTL_SUBDIR],
26[ 26[
27 AC_REQUIRE([AC_PROG_INSTALL])dnl 27 AC_REQUIRE([AC_PROG_INSTALL])dnl
28 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 28 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
29 AC_REQUIRE([AC_PROG_CC])dnl 29 AC_REQUIRE([AC_PROG_CC])dnl
30 AC_REQUIRE([AC_CANONICAL_HOST])dnl 30 AC_REQUIRE([AC_CANONICAL_HOST])dnl
31 AC_REQUIRE([gt_GLIBC2])dnl 31 AC_REQUIRE([gt_GLIBC2])dnl
@@ -42,6 +42,8 @@ AC_DEFUN([AM_INTL_SUBDIR],
42 AC_REQUIRE([gl_XSIZE])dnl 42 AC_REQUIRE([gl_XSIZE])dnl
43 AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl 43 AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
44 AC_REQUIRE([gt_INTL_MACOSX])dnl 44 AC_REQUIRE([gt_INTL_MACOSX])dnl
45 AC_REQUIRE([gl_EXTERN_INLINE])dnl
46 AC_REQUIRE([gt_GL_ATTRIBUTE])dnl
45 47
46 dnl Support for automake's --enable-silent-rules. 48 dnl Support for automake's --enable-silent-rules.
47 case "$enable_silent_rules" in 49 case "$enable_silent_rules" in
@@ -55,21 +57,19 @@ AC_DEFUN([AM_INTL_SUBDIR],
55 [AC_DEFINE([ptrdiff_t], [long], 57 [AC_DEFINE([ptrdiff_t], [long],
56 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) 58 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
57 ]) 59 ])
58 AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) 60 AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
59 AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ 61 AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
60 snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) 62 snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
61 63
62 dnl Use the _snprintf function only if it is declared (because on NetBSD it 64 dnl Use the _snprintf function only if it is declared (because on NetBSD it
63 dnl is defined as a weak alias of snprintf; we prefer to use the latter). 65 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
64 gt_CHECK_DECL(_snprintf, [#include <stdio.h>]) 66 AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>])
65 gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
66 67
67 dnl Use the *_unlocked functions only if they are declared. 68 dnl Use the *_unlocked functions only if they are declared.
68 dnl (because some of them were defined without being declared in Solaris 69 dnl (because some of them were defined without being declared in Solaris
69 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built 70 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
70 dnl on Solaris 2.5.1 to run on Solaris 2.6). 71 dnl on Solaris 2.5.1 to run on Solaris 2.6).
71 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. 72 AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>])
72 gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
73 73
74 case $gt_cv_func_printf_posix in 74 case $gt_cv_func_printf_posix in
75 *yes) HAVE_POSIX_PRINTF=1 ;; 75 *yes) HAVE_POSIX_PRINTF=1 ;;
@@ -220,9 +220,10 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
220 AC_REQUIRE([gt_INTTYPES_PRI])dnl 220 AC_REQUIRE([gt_INTTYPES_PRI])dnl
221 AC_REQUIRE([gl_LOCK])dnl 221 AC_REQUIRE([gl_LOCK])dnl
222 222
223 AC_TRY_LINK( 223 AC_LINK_IFELSE(
224 [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }], 224 [AC_LANG_PROGRAM(
225 [], 225 [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
226 [[]])],
226 [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], 227 [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
227 [Define to 1 if the compiler understands __builtin_expect.])]) 228 [Define to 1 if the compiler understands __builtin_expect.])])
228 229
@@ -231,20 +232,23 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
231 stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \ 232 stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \
232 argz_stringify argz_next __fsetlocking]) 233 argz_stringify argz_next __fsetlocking])
233 234
235 dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have
236 dnl it nor the equivalent.
237 if test $ac_cv_func_uselocale = yes; then
238 AC_CHECK_FUNCS([getlocalename_l])
239 fi
240
234 dnl Use the *_unlocked functions only if they are declared. 241 dnl Use the *_unlocked functions only if they are declared.
235 dnl (because some of them were defined without being declared in Solaris 242 dnl (because some of them were defined without being declared in Solaris
236 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built 243 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
237 dnl on Solaris 2.5.1 to run on Solaris 2.6). 244 dnl on Solaris 2.5.1 to run on Solaris 2.6).
238 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. 245 AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>])
239 gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>])
240 gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>])
241 246
242 AM_ICONV 247 AM_ICONV
243 248
244 dnl intl/plural.c is generated from intl/plural.y. It requires bison, 249 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
245 dnl because plural.y uses bison specific features. It requires at least 250 dnl because plural.y uses bison specific features. It requires at least
246 dnl bison-1.26 because earlier versions generate a plural.c that doesn't 251 dnl bison-2.7 for %define api.pure.
247 dnl compile.
248 dnl bison is only needed for the maintainer (who touches plural.y). But in 252 dnl bison is only needed for the maintainer (who touches plural.y). But in
249 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put 253 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
250 dnl the rule in general Makefile. Now, some people carelessly touch the 254 dnl the rule in general Makefile. Now, some people carelessly touch the
@@ -261,7 +265,7 @@ changequote(<<,>>)dnl
261 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` 265 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
262 case $ac_prog_version in 266 case $ac_prog_version in
263 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 267 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
264 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) 268 2.[7-9]* | [3-9].*)
265changequote([,])dnl 269changequote([,])dnl
266 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; 270 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
267 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; 271 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -273,22 +277,28 @@ changequote([,])dnl
273 fi 277 fi
274]) 278])
275 279
280dnl Copies _GL_UNUSED and _GL_ATTRIBUTE_PURE definitions from
281dnl gnulib-common.m4 as a fallback, if the project isn't using Gnulib.
282AC_DEFUN([gt_GL_ATTRIBUTE], [
283 m4_ifndef([gl_[]COMMON],
284 AH_VERBATIM([gt_gl_attribute],
285[/* Define as a marker that can be attached to declarations that might not
286 be used. This helps to reduce warnings, such as from
287 GCC -Wunused-parameter. */
288#ifndef _GL_UNUSED
289# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
290# define _GL_UNUSED __attribute__ ((__unused__))
291# else
292# define _GL_UNUSED
293# endif
294#endif
276 295
277dnl gt_CHECK_DECL(FUNC, INCLUDES) 296/* The __pure__ attribute was added in gcc 2.96. */
278dnl Check whether a function is declared. 297#ifndef _GL_ATTRIBUTE_PURE
279AC_DEFUN([gt_CHECK_DECL], 298# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
280[ 299# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
281 AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1], 300# else
282 [AC_TRY_COMPILE([$2], [ 301# define _GL_ATTRIBUTE_PURE /* empty */
283#ifndef $1 302# endif
284 char *p = (char *) $1;
285#endif 303#endif
286], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) 304]))])
287 if test $ac_cv_have_decl_$1 = yes; then
288 gt_value=1
289 else
290 gt_value=0
291 fi
292 AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
293 [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
294])
diff --git a/m4/intmax.m4 b/m4/intmax.m4
index 74aaaf5e..1a47107f 100644
--- a/m4/intmax.m4
+++ b/m4/intmax.m4
@@ -1,5 +1,5 @@
1# intmax.m4 serial 5 (gettext-0.18) 1# intmax.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002-2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2005, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -13,7 +13,9 @@ AC_DEFUN([gt_TYPE_INTMAX_T],
13 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 13 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
14 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 14 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
15 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], 15 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
16 [AC_TRY_COMPILE([ 16 [AC_COMPILE_IFELSE(
17 [AC_LANG_PROGRAM(
18 [[
17#include <stddef.h> 19#include <stddef.h>
18#include <stdlib.h> 20#include <stdlib.h>
19#if HAVE_STDINT_H_WITH_UINTMAX 21#if HAVE_STDINT_H_WITH_UINTMAX
@@ -22,8 +24,9 @@ AC_DEFUN([gt_TYPE_INTMAX_T],
22#if HAVE_INTTYPES_H_WITH_UINTMAX 24#if HAVE_INTTYPES_H_WITH_UINTMAX
23#include <inttypes.h> 25#include <inttypes.h>
24#endif 26#endif
25], [intmax_t x = -1; 27 ]],
26 return !x;], 28 [[intmax_t x = -1;
29 return !x;]])],
27 [gt_cv_c_intmax_t=yes], 30 [gt_cv_c_intmax_t=yes],
28 [gt_cv_c_intmax_t=no])]) 31 [gt_cv_c_intmax_t=no])])
29 if test $gt_cv_c_intmax_t = yes; then 32 if test $gt_cv_c_intmax_t = yes; then
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4
index 718a4f4e..ae20183d 100644
--- a/m4/inttypes-pri.m4
+++ b/m4/inttypes-pri.m4
@@ -1,12 +1,12 @@
1# inttypes-pri.m4 serial 6 (gettext-0.18) 1# inttypes-pri.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1997-2002, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2002, 2006, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl From Bruno Haible. 7dnl From Bruno Haible.
8 8
9AC_PREREQ([2.52]) 9AC_PREREQ([2.53])
10 10
11# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* 11# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
12# macros to non-string values. This is the case on AIX 4.3.3. 12# macros to non-string values. This is the case on AIX 4.3.3.
@@ -18,11 +18,17 @@ AC_DEFUN([gt_INTTYPES_PRI],
18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], 18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
19 [gt_cv_inttypes_pri_broken], 19 [gt_cv_inttypes_pri_broken],
20 [ 20 [
21 AC_TRY_COMPILE([#include <inttypes.h> 21 AC_COMPILE_IFELSE(
22 [AC_LANG_PROGRAM(
23 [[
24#include <inttypes.h>
22#ifdef PRId32 25#ifdef PRId32
23char *p = PRId32; 26char *p = PRId32;
24#endif 27#endif
25], [], [gt_cv_inttypes_pri_broken=no], [gt_cv_inttypes_pri_broken=yes]) 28 ]],
29 [[]])],
30 [gt_cv_inttypes_pri_broken=no],
31 [gt_cv_inttypes_pri_broken=yes])
26 ]) 32 ])
27 fi 33 fi
28 if test "$gt_cv_inttypes_pri_broken" = yes; then 34 if test "$gt_cv_inttypes_pri_broken" = yes; then
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4
index 782d77ed..76571199 100644
--- a/m4/inttypes_h.m4
+++ b/m4/inttypes_h.m4
@@ -1,5 +1,5 @@
1# inttypes_h.m4 serial 9 1# inttypes_h.m4 serial 10
2dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,12 +12,15 @@ dnl From Paul Eggert.
12AC_DEFUN([gl_AC_HEADER_INTTYPES_H], 12AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
13[ 13[
14 AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], 14 AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
15 [AC_TRY_COMPILE( 15 [AC_COMPILE_IFELSE(
16 [#include <sys/types.h> 16 [AC_LANG_PROGRAM(
17#include <inttypes.h>], 17 [[
18 [uintmax_t i = (uintmax_t) -1; return !i;], 18#include <sys/types.h>
19 [gl_cv_header_inttypes_h=yes], 19#include <inttypes.h>
20 [gl_cv_header_inttypes_h=no])]) 20 ]],
21 [[uintmax_t i = (uintmax_t) -1; return !i;]])],
22 [gl_cv_header_inttypes_h=yes],
23 [gl_cv_header_inttypes_h=no])])
21 if test $gl_cv_header_inttypes_h = yes; then 24 if test $gl_cv_header_inttypes_h = yes; then
22 AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], 25 AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
23 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, 26 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4
index 1a705431..1c24d6d9 100644
--- a/m4/lcmessage.m4
+++ b/m4/lcmessage.m4
@@ -1,17 +1,17 @@
1# lcmessage.m4 serial 6 (gettext-0.18) 1# lcmessage.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, 2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014, 2016 Free Software
3dnl Inc. 3dnl Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl 7dnl
8dnl This file can can be used in projects which are not available under 8dnl This file can be used in projects which are not available under
9dnl the GNU General Public License or the GNU Library General Public 9dnl the GNU General Public License or the GNU Library General Public
10dnl License but which still want to provide support for the GNU gettext 10dnl License but which still want to provide support for the GNU gettext
11dnl functionality. 11dnl functionality.
12dnl Please note that the actual code of the GNU gettext library is covered 12dnl Please note that the actual code of the GNU gettext library is covered
13dnl by the GNU Library General Public License, and the rest of the GNU 13dnl by the GNU Library General Public License, and the rest of the GNU
14dnl gettext package package is covered by the GNU General Public License. 14dnl gettext package is covered by the GNU General Public License.
15dnl They are *not* in the public domain. 15dnl They are *not* in the public domain.
16 16
17dnl Authors: 17dnl Authors:
@@ -22,8 +22,12 @@ dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
22AC_DEFUN([gt_LC_MESSAGES], 22AC_DEFUN([gt_LC_MESSAGES],
23[ 23[
24 AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], 24 AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
25 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 25 [AC_LINK_IFELSE(
26 [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])]) 26 [AC_LANG_PROGRAM(
27 [[#include <locale.h>]],
28 [[return LC_MESSAGES]])],
29 [gt_cv_val_LC_MESSAGES=yes],
30 [gt_cv_val_LC_MESSAGES=no])])
27 if test $gt_cv_val_LC_MESSAGES = yes; then 31 if test $gt_cv_val_LC_MESSAGES = yes; then
28 AC_DEFINE([HAVE_LC_MESSAGES], [1], 32 AC_DEFINE([HAVE_LC_MESSAGES], [1],
29 [Define if your <locale.h> file defines LC_MESSAGES.]) 33 [Define if your <locale.h> file defines LC_MESSAGES.])
diff --git a/m4/lock.m4 b/m4/lock.m4
index 9da8465e..1e83e236 100644
--- a/m4/lock.m4
+++ b/m4/lock.m4
@@ -1,5 +1,5 @@
1# lock.m4 serial 10 (gettext-0.18) 1# lock.m4 serial 13 (gettext-0.18.2)
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -10,7 +10,7 @@ AC_DEFUN([gl_LOCK],
10[ 10[
11 AC_REQUIRE([gl_THREADLIB]) 11 AC_REQUIRE([gl_THREADLIB])
12 if test "$gl_threads_api" = posix; then 12 if test "$gl_threads_api" = posix; then
13 # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the 13 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the
14 # pthread_rwlock_* functions. 14 # pthread_rwlock_* functions.
15 AC_CHECK_TYPE([pthread_rwlock_t], 15 AC_CHECK_TYPE([pthread_rwlock_t],
16 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], 16 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
@@ -18,20 +18,25 @@ AC_DEFUN([gl_LOCK],
18 [], 18 [],
19 [#include <pthread.h>]) 19 [#include <pthread.h>])
20 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. 20 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
21 AC_TRY_COMPILE([#include <pthread.h>], 21 AC_COMPILE_IFELSE([
22 [#if __FreeBSD__ == 4 22 AC_LANG_PROGRAM(
23 [[#include <pthread.h>]],
24 [[
25#if __FreeBSD__ == 4
23error "No, in FreeBSD 4.0 recursive mutexes actually don't work." 26error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
27#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \
28 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
29error "No, in Mac OS X < 10.7 recursive mutexes actually don't work."
24#else 30#else
25int x = (int)PTHREAD_MUTEX_RECURSIVE; 31int x = (int)PTHREAD_MUTEX_RECURSIVE;
26return !x; 32return !x;
27#endif], 33#endif
34 ]])],
28 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], 35 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
29 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) 36 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
30 fi 37 fi
31 gl_PREREQ_LOCK 38 gl_PREREQ_LOCK
32]) 39])
33 40
34# Prerequisites of lib/lock.c. 41# Prerequisites of lib/glthread/lock.c.
35AC_DEFUN([gl_PREREQ_LOCK], [ 42AC_DEFUN([gl_PREREQ_LOCK], [:])
36 AC_REQUIRE([AC_C_INLINE])
37])
diff --git a/m4/longlong.m4 b/m4/longlong.m4
index cca3c1a9..36d8b124 100644
--- a/m4/longlong.m4
+++ b/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 14 1# longlong.m4 serial 17
2dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007, 2009-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl From Paul Eggert. 7dnl From Paul Eggert.
8 8
9# Define HAVE_LONG_LONG_INT if 'long long int' works. 9# Define HAVE_LONG_LONG_INT if 'long long int' works.
10# This fixes a bug in Autoconf 2.61, but can be removed once we 10# This fixes a bug in Autoconf 2.61, and can be faster
11# assume 2.62 everywhere. 11# than what's in Autoconf 2.62 through 2.68.
12 12
13# Note: If the type 'long long int' exists but is only 32 bits large 13# Note: If the type 'long long int' exists but is only 32 bits large
14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be 14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -16,44 +16,48 @@ dnl From Paul Eggert.
16 16
17AC_DEFUN([AC_TYPE_LONG_LONG_INT], 17AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[ 18[
19 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], 20 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE( 21 [ac_cv_type_long_long_int=yes
21 [_AC_TYPE_LONG_LONG_SNIPPET], 22 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. 23 ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
23 dnl If cross compiling, assume the bug isn't important, since 24 if test $ac_cv_type_long_long_int = yes; then
24 dnl nobody cross compiles for this platform as far as we know. 25 dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
25 AC_RUN_IFELSE( 26 dnl If cross compiling, assume the bug is not important, since
26 [AC_LANG_PROGRAM( 27 dnl nobody cross compiles for this platform as far as we know.
27 [[@%:@include <limits.h> 28 AC_RUN_IFELSE(
28 @%:@ifndef LLONG_MAX 29 [AC_LANG_PROGRAM(
29 @%:@ define HALF \ 30 [[@%:@include <limits.h>
30 (1LL << (sizeof (long long int) * CHAR_BIT - 2)) 31 @%:@ifndef LLONG_MAX
31 @%:@ define LLONG_MAX (HALF - 1 + HALF) 32 @%:@ define HALF \
32 @%:@endif]], 33 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
33 [[long long int n = 1; 34 @%:@ define LLONG_MAX (HALF - 1 + HALF)
34 int i; 35 @%:@endif]],
35 for (i = 0; ; i++) 36 [[long long int n = 1;
36 { 37 int i;
37 long long int m = n << i; 38 for (i = 0; ; i++)
38 if (m >> i != n) 39 {
39 return 1; 40 long long int m = n << i;
40 if (LLONG_MAX / 2 < m) 41 if (m >> i != n)
41 break; 42 return 1;
42 } 43 if (LLONG_MAX / 2 < m)
43 return 0;]])], 44 break;
44 [ac_cv_type_long_long_int=yes], 45 }
45 [ac_cv_type_long_long_int=no], 46 return 0;]])],
46 [ac_cv_type_long_long_int=yes])], 47 [],
47 [ac_cv_type_long_long_int=no])]) 48 [ac_cv_type_long_long_int=no],
49 [:])
50 fi
51 fi])
48 if test $ac_cv_type_long_long_int = yes; then 52 if test $ac_cv_type_long_long_int = yes; then
49 AC_DEFINE([HAVE_LONG_LONG_INT], [1], 53 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
50 [Define to 1 if the system has the type `long long int'.]) 54 [Define to 1 if the system has the type 'long long int'.])
51 fi 55 fi
52]) 56])
53 57
54# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. 58# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
55# This fixes a bug in Autoconf 2.61, but can be removed once we 59# This fixes a bug in Autoconf 2.61, and can be faster
56# assume 2.62 everywhere. 60# than what's in Autoconf 2.62 through 2.68.
57 61
58# Note: If the type 'unsigned long long int' exists but is only 32 bits 62# Note: If the type 'unsigned long long int' exists but is only 32 bits
59# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT 63# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
@@ -64,13 +68,16 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
64[ 68[
65 AC_CACHE_CHECK([for unsigned long long int], 69 AC_CACHE_CHECK([for unsigned long long int],
66 [ac_cv_type_unsigned_long_long_int], 70 [ac_cv_type_unsigned_long_long_int],
67 [AC_LINK_IFELSE( 71 [ac_cv_type_unsigned_long_long_int=yes
68 [_AC_TYPE_LONG_LONG_SNIPPET], 72 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
69 [ac_cv_type_unsigned_long_long_int=yes], 73 AC_LINK_IFELSE(
70 [ac_cv_type_unsigned_long_long_int=no])]) 74 [_AC_TYPE_LONG_LONG_SNIPPET],
75 [],
76 [ac_cv_type_unsigned_long_long_int=no])
77 fi])
71 if test $ac_cv_type_unsigned_long_long_int = yes; then 78 if test $ac_cv_type_unsigned_long_long_int = yes; then
72 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], 79 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
73 [Define to 1 if the system has the type `unsigned long long int'.]) 80 [Define to 1 if the system has the type 'unsigned long long int'.])
74 fi 81 fi
75]) 82])
76 83
diff --git a/m4/printf-posix.m4 b/m4/printf-posix.m4
index 1eacf95a..f9088c09 100644
--- a/m4/printf-posix.m4
+++ b/m4/printf-posix.m4
@@ -1,5 +1,5 @@
1# printf-posix.m4 serial 5 (gettext-0.18) 1# printf-posix.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2003, 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,7 +14,8 @@ AC_DEFUN([gt_PRINTF_POSIX],
14 AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], 14 AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
15 gt_cv_func_printf_posix, 15 gt_cv_func_printf_posix,
16 [ 16 [
17 AC_TRY_RUN([ 17 AC_RUN_IFELSE(
18 [AC_LANG_SOURCE([[
18#include <stdio.h> 19#include <stdio.h>
19#include <string.h> 20#include <string.h>
20/* The string "%2$d %1$d", with dollar characters protected from the shell's 21/* The string "%2$d %1$d", with dollar characters protected from the shell's
@@ -25,16 +26,18 @@ int main ()
25{ 26{
26 sprintf (buf, format, 33, 55); 27 sprintf (buf, format, 33, 55);
27 return (strcmp (buf, "55 33") != 0); 28 return (strcmp (buf, "55 33") != 0);
28}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, 29}]])],
29 [ 30 [gt_cv_func_printf_posix=yes],
30 AC_EGREP_CPP([notposix], [ 31 [gt_cv_func_printf_posix=no],
32 [
33 AC_EGREP_CPP([notposix], [
31#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ 34#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
32 notposix 35 notposix
33#endif 36#endif
34 ], 37 ],
35 [gt_cv_func_printf_posix="guessing no"], 38 [gt_cv_func_printf_posix="guessing no"],
36 [gt_cv_func_printf_posix="guessing yes"]) 39 [gt_cv_func_printf_posix="guessing yes"])
37 ]) 40 ])
38 ]) 41 ])
39 case $gt_cv_func_printf_posix in 42 case $gt_cv_func_printf_posix in
40 *yes) 43 *yes)
diff --git a/m4/size_max.m4 b/m4/size_max.m4
index ce992db1..de69025d 100644
--- a/m4/size_max.m4
+++ b/m4/size_max.m4
@@ -1,5 +1,5 @@
1# size_max.m4 serial 9 1# size_max.m4 serial 10
2dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2006, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -34,10 +34,14 @@ Found it
34 if test $fits_in_uint = 1; then 34 if test $fits_in_uint = 1; then
35 dnl Even though SIZE_MAX fits in an unsigned int, it must be of type 35 dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
36 dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. 36 dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
37 AC_TRY_COMPILE([#include <stddef.h> 37 AC_COMPILE_IFELSE(
38 extern size_t foo; 38 [AC_LANG_PROGRAM(
39 extern unsigned long foo; 39 [[#include <stddef.h>
40 ], [], [fits_in_uint=0]) 40 extern size_t foo;
41 extern unsigned long foo;
42 ]],
43 [[]])],
44 [fits_in_uint=0])
41 fi 45 fi
42 dnl We cannot use 'expr' to simplify this expression, because 'expr' 46 dnl We cannot use 'expr' to simplify this expression, because 'expr'
43 dnl works only with 'long' integers in the host environment, while we 47 dnl works only with 'long' integers in the host environment, while we
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4
index b8e3c6cc..f823b94c 100644
--- a/m4/stdint_h.m4
+++ b/m4/stdint_h.m4
@@ -1,5 +1,5 @@
1# stdint_h.m4 serial 8 1# stdint_h.m4 serial 9
2dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,12 +12,13 @@ dnl From Paul Eggert.
12AC_DEFUN([gl_AC_HEADER_STDINT_H], 12AC_DEFUN([gl_AC_HEADER_STDINT_H],
13[ 13[
14 AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], 14 AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
15 [AC_TRY_COMPILE( 15 [AC_COMPILE_IFELSE(
16 [#include <sys/types.h> 16 [AC_LANG_PROGRAM(
17#include <stdint.h>], 17 [[#include <sys/types.h>
18 [uintmax_t i = (uintmax_t) -1; return !i;], 18 #include <stdint.h>]],
19 [gl_cv_header_stdint_h=yes], 19 [[uintmax_t i = (uintmax_t) -1; return !i;]])],
20 [gl_cv_header_stdint_h=no])]) 20 [gl_cv_header_stdint_h=yes],
21 [gl_cv_header_stdint_h=no])])
21 if test $gl_cv_header_stdint_h = yes; then 22 if test $gl_cv_header_stdint_h = yes; then
22 AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], 23 AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
23 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, 24 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 05cc4ffa..b43534ea 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,5 +1,5 @@
1# threadlib.m4 serial 5 (gettext-0.18) 1# threadlib.m4 serial 11 (gettext-0.18.2)
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,15 +9,20 @@ dnl From Bruno Haible.
9dnl gl_THREADLIB 9dnl gl_THREADLIB
10dnl ------------ 10dnl ------------
11dnl Tests for a multithreading library to be used. 11dnl Tests for a multithreading library to be used.
12dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
13dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
14dnl default is 'no', otherwise it is system dependent. In both cases, the user
15dnl can change the choice through the options --enable-threads=choice or
16dnl --disable-threads.
12dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, 17dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
13dnl USE_PTH_THREADS, USE_WIN32_THREADS 18dnl USE_PTH_THREADS, USE_WINDOWS_THREADS
14dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use 19dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
15dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with 20dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
16dnl libtool). 21dnl libtool).
17dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for 22dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
18dnl programs that really need multithread functionality. The difference 23dnl programs that really need multithread functionality. The difference
19dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak 24dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
20dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". 25dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not.
21dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for 26dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
22dnl multithread-safe programs. 27dnl multithread-safe programs.
23 28
@@ -44,10 +49,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
44 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], 49 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
45 [AC_REQUIRE([AC_GNU_SOURCE])]) 50 [AC_REQUIRE([AC_GNU_SOURCE])])
46 dnl Check for multithreading. 51 dnl Check for multithreading.
47 m4_divert_text([DEFAULTS], [gl_use_threads_default=]) 52 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
53 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
54 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
48 AC_ARG_ENABLE([threads], 55 AC_ARG_ENABLE([threads],
49AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) 56AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
50AC_HELP_STRING([--disable-threads], [build without multithread safety]), 57AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
51 [gl_use_threads=$enableval], 58 [gl_use_threads=$enableval],
52 [if test -n "$gl_use_threads_default"; then 59 [if test -n "$gl_use_threads_default"; then
53 gl_use_threads="$gl_use_threads_default" 60 gl_use_threads="$gl_use_threads_default"
@@ -80,7 +87,7 @@ changequote([,])dnl
80 # groks <pthread.h>. cc also understands the flag -pthread, but 87 # groks <pthread.h>. cc also understands the flag -pthread, but
81 # we don't use it because 1. gcc-2.95 doesn't understand -pthread, 88 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
82 # 2. putting a flag into CPPFLAGS that has an effect on the linker 89 # 2. putting a flag into CPPFLAGS that has an effect on the linker
83 # causes the AC_TRY_LINK test below to succeed unexpectedly, 90 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
84 # leading to wrong values of LIBTHREAD and LTLIBTHREAD. 91 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
85 CPPFLAGS="$CPPFLAGS -D_REENTRANT" 92 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
86 ;; 93 ;;
@@ -111,18 +118,25 @@ AC_DEFUN([gl_THREADLIB_BODY],
111 [gl_cv_have_weak], 118 [gl_cv_have_weak],
112 [gl_cv_have_weak=no 119 [gl_cv_have_weak=no
113 dnl First, test whether the compiler accepts it syntactically. 120 dnl First, test whether the compiler accepts it syntactically.
114 AC_TRY_LINK([extern void xyzzy (); 121 AC_LINK_IFELSE(
115#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe]) 122 [AC_LANG_PROGRAM(
123 [[extern void xyzzy ();
124#pragma weak xyzzy]],
125 [[xyzzy();]])],
126 [gl_cv_have_weak=maybe])
116 if test $gl_cv_have_weak = maybe; then 127 if test $gl_cv_have_weak = maybe; then
117 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 128 dnl Second, test whether it actually works. On Cygwin 1.7.2, with
118 dnl gcc 4.3, symbols declared weak always evaluate to the address 0. 129 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
119 AC_TRY_RUN([ 130 AC_RUN_IFELSE(
131 [AC_LANG_SOURCE([[
120#include <stdio.h> 132#include <stdio.h>
121#pragma weak fputs 133#pragma weak fputs
122int main () 134int main ()
123{ 135{
124 return (fputs == NULL); 136 return (fputs == NULL);
125}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no], 137}]])],
138 [gl_cv_have_weak=yes],
139 [gl_cv_have_weak=no],
126 [dnl When cross-compiling, assume that only ELF platforms support 140 [dnl When cross-compiling, assume that only ELF platforms support
127 dnl weak symbols. 141 dnl weak symbols.
128 AC_EGREP_CPP([Extensible Linking Format], 142 AC_EGREP_CPP([Extensible Linking Format],
@@ -148,13 +162,31 @@ int main ()
148 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist 162 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
149 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but 163 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
150 # the second one only in libpthread, and lock.c needs it. 164 # the second one only in libpthread, and lock.c needs it.
151 AC_TRY_LINK([#include <pthread.h>], 165 #
152 [pthread_mutex_lock((pthread_mutex_t*)0); 166 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
153 pthread_mutexattr_init((pthread_mutexattr_t*)0);], 167 # needs -pthread for some reason. See:
154 [gl_have_pthread=yes]) 168 # http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00023.html
169 save_LIBS=$LIBS
170 for gl_pthread in '' '-pthread'; do
171 LIBS="$LIBS $gl_pthread"
172 AC_LINK_IFELSE(
173 [AC_LANG_PROGRAM(
174 [[#include <pthread.h>
175 pthread_mutex_t m;
176 pthread_mutexattr_t ma;
177 ]],
178 [[pthread_mutex_lock (&m);
179 pthread_mutexattr_init (&ma);]])],
180 [gl_have_pthread=yes
181 LIBTHREAD=$gl_pthread LTLIBTHREAD=$gl_pthread
182 LIBMULTITHREAD=$gl_pthread LTLIBMULTITHREAD=$gl_pthread])
183 LIBS=$save_LIBS
184 test -n "$gl_have_pthread" && break
185 done
186
155 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 187 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
156 # since it is defined as a macro on OSF/1.) 188 # since it is defined as a macro on OSF/1.)
157 if test -n "$gl_have_pthread"; then 189 if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then
158 # The program links fine without libpthread. But it may actually 190 # The program links fine without libpthread. But it may actually
159 # need to link with libpthread in order to create multiple threads. 191 # need to link with libpthread in order to create multiple threads.
160 AC_CHECK_LIB([pthread], [pthread_kill], 192 AC_CHECK_LIB([pthread], [pthread_kill],
@@ -169,7 +201,7 @@ int main ()
169 [Define if the pthread_in_use() detection is hard.]) 201 [Define if the pthread_in_use() detection is hard.])
170 esac 202 esac
171 ]) 203 ])
172 else 204 elif test -z "$gl_have_pthread"; then
173 # Some library is needed. Try libpthread and libc_r. 205 # Some library is needed. Try libpthread and libc_r.
174 AC_CHECK_LIB([pthread], [pthread_kill], 206 AC_CHECK_LIB([pthread], [pthread_kill],
175 [gl_have_pthread=yes 207 [gl_have_pthread=yes
@@ -203,9 +235,13 @@ int main ()
203 gl_have_solaristhread= 235 gl_have_solaristhread=
204 gl_save_LIBS="$LIBS" 236 gl_save_LIBS="$LIBS"
205 LIBS="$LIBS -lthread" 237 LIBS="$LIBS -lthread"
206 AC_TRY_LINK([#include <thread.h> 238 AC_LINK_IFELSE(
207#include <synch.h>], 239 [AC_LANG_PROGRAM(
208 [thr_self();], 240 [[
241#include <thread.h>
242#include <synch.h>
243 ]],
244 [[thr_self();]])],
209 [gl_have_solaristhread=yes]) 245 [gl_have_solaristhread=yes])
210 LIBS="$gl_save_LIBS" 246 LIBS="$gl_save_LIBS"
211 if test -n "$gl_have_solaristhread"; then 247 if test -n "$gl_have_solaristhread"; then
@@ -230,8 +266,10 @@ int main ()
230 AC_LIB_LINKFLAGS([pth]) 266 AC_LIB_LINKFLAGS([pth])
231 gl_have_pth= 267 gl_have_pth=
232 gl_save_LIBS="$LIBS" 268 gl_save_LIBS="$LIBS"
233 LIBS="$LIBS -lpth" 269 LIBS="$LIBS $LIBPTH"
234 AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes]) 270 AC_LINK_IFELSE(
271 [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])],
272 [gl_have_pth=yes])
235 LIBS="$gl_save_LIBS" 273 LIBS="$gl_save_LIBS"
236 if test -n "$gl_have_pth"; then 274 if test -n "$gl_have_pth"; then
237 gl_threads_api=pth 275 gl_threads_api=pth
@@ -254,17 +292,19 @@ int main ()
254 fi 292 fi
255 fi 293 fi
256 if test -z "$gl_have_pthread"; then 294 if test -z "$gl_have_pthread"; then
257 if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then 295 case "$gl_use_threads" in
258 if { case "$host_os" in 296 yes | windows | win32) # The 'win32' is for backward compatibility.
259 mingw*) true;; 297 if { case "$host_os" in
260 *) false;; 298 mingw*) true;;
261 esac 299 *) false;;
262 }; then 300 esac
263 gl_threads_api=win32 301 }; then
264 AC_DEFINE([USE_WIN32_THREADS], [1], 302 gl_threads_api=windows
265 [Define if the Win32 multithreading API can be used.]) 303 AC_DEFINE([USE_WINDOWS_THREADS], [1],
266 fi 304 [Define if the native Windows multithreading API can be used.])
267 fi 305 fi
306 ;;
307 esac
268 fi 308 fi
269 fi 309 fi
270 AC_MSG_CHECKING([for multithread API to use]) 310 AC_MSG_CHECKING([for multithread API to use])
@@ -295,50 +335,52 @@ AC_DEFUN([gl_DISABLE_THREADS], [
295 335
296dnl Survey of platforms: 336dnl Survey of platforms:
297dnl 337dnl
298dnl Platform Available Compiler Supports test-lock 338dnl Platform Available Compiler Supports test-lock
299dnl flavours option weak result 339dnl flavours option weak result
300dnl --------------- --------- --------- -------- --------- 340dnl --------------- --------- --------- -------- ---------
301dnl Linux 2.4/glibc posix -lpthread Y OK 341dnl Linux 2.4/glibc posix -lpthread Y OK
342dnl
343dnl GNU Hurd/glibc posix
302dnl 344dnl
303dnl GNU Hurd/glibc posix 345dnl Ubuntu 14.04 posix -pthread Y OK
304dnl 346dnl
305dnl FreeBSD 5.3 posix -lc_r Y 347dnl FreeBSD 5.3 posix -lc_r Y
306dnl posix -lkse ? Y 348dnl posix -lkse ? Y
307dnl posix -lpthread ? Y 349dnl posix -lpthread ? Y
308dnl posix -lthr Y 350dnl posix -lthr Y
309dnl 351dnl
310dnl FreeBSD 5.2 posix -lc_r Y 352dnl FreeBSD 5.2 posix -lc_r Y
311dnl posix -lkse Y 353dnl posix -lkse Y
312dnl posix -lthr Y 354dnl posix -lthr Y
313dnl 355dnl
314dnl FreeBSD 4.0,4.10 posix -lc_r Y OK 356dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
315dnl 357dnl
316dnl NetBSD 1.6 -- 358dnl NetBSD 1.6 --
317dnl 359dnl
318dnl OpenBSD 3.4 posix -lpthread Y OK 360dnl OpenBSD 3.4 posix -lpthread Y OK
319dnl 361dnl
320dnl MacOS X 10.[123] posix -lpthread Y OK 362dnl Mac OS X 10.[123] posix -lpthread Y OK
321dnl 363dnl
322dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK 364dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
323dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK 365dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
324dnl 366dnl
325dnl HP-UX 11 posix -lpthread N (cc) OK 367dnl HP-UX 11 posix -lpthread N (cc) OK
326dnl Y (gcc) 368dnl Y (gcc)
327dnl 369dnl
328dnl IRIX 6.5 posix -lpthread Y 0.5 370dnl IRIX 6.5 posix -lpthread Y 0.5
329dnl 371dnl
330dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK 372dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
331dnl 373dnl
332dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK 374dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
333dnl -lpthread (gcc) Y 375dnl -lpthread (gcc) Y
334dnl 376dnl
335dnl Cygwin posix -lpthread Y OK 377dnl Cygwin posix -lpthread Y OK
336dnl 378dnl
337dnl Any of the above pth -lpth 0.0 379dnl Any of the above pth -lpth 0.0
338dnl 380dnl
339dnl Mingw win32 N OK 381dnl Mingw windows N OK
340dnl 382dnl
341dnl BeOS 5 -- 383dnl BeOS 5 --
342dnl 384dnl
343dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is 385dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
344dnl turned off: 386dnl turned off:
diff --git a/m4/visibility.m4 b/m4/visibility.m4
index 077c4765..e99e3fba 100644
--- a/m4/visibility.m4
+++ b/m4/visibility.m4
@@ -1,5 +1,5 @@
1# visibility.m4 serial 3 (gettext-0.18) 1# visibility.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,7 +12,7 @@ dnl __attribute__((__visibility__("hidden"))) and
12dnl __attribute__((__visibility__("default"))). 12dnl __attribute__((__visibility__("default"))).
13dnl Does *not* test for __visibility__("protected") - which has tricky 13dnl Does *not* test for __visibility__("protected") - which has tricky
14dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on 14dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
15dnl MacOS X. 15dnl Mac OS X.
16dnl Does *not* test for __visibility__("internal") - which has processor 16dnl Does *not* test for __visibility__("internal") - which has processor
17dnl dependent semantics. 17dnl dependent semantics.
18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is 18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
@@ -33,7 +33,8 @@ AC_DEFUN([gl_VISIBILITY],
33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [ 33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [
34 gl_save_CFLAGS="$CFLAGS" 34 gl_save_CFLAGS="$CFLAGS"
35 CFLAGS="$CFLAGS -Werror" 35 CFLAGS="$CFLAGS -Werror"
36 AC_TRY_COMPILE([], [], 36 AC_COMPILE_IFELSE(
37 [AC_LANG_PROGRAM([[]], [[]])],
37 [gl_cv_cc_vis_werror=yes], 38 [gl_cv_cc_vis_werror=yes],
38 [gl_cv_cc_vis_werror=no]) 39 [gl_cv_cc_vis_werror=no])
39 CFLAGS="$gl_save_CFLAGS"]) 40 CFLAGS="$gl_save_CFLAGS"])
@@ -51,13 +52,15 @@ AC_DEFUN([gl_VISIBILITY],
51 if test $gl_cv_cc_vis_werror = yes; then 52 if test $gl_cv_cc_vis_werror = yes; then
52 CFLAGS="$CFLAGS -Werror" 53 CFLAGS="$CFLAGS -Werror"
53 fi 54 fi
54 AC_TRY_COMPILE( 55 AC_COMPILE_IFELSE(
55 [extern __attribute__((__visibility__("hidden"))) int hiddenvar; 56 [AC_LANG_PROGRAM(
56 extern __attribute__((__visibility__("default"))) int exportedvar; 57 [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
57 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 58 extern __attribute__((__visibility__("default"))) int exportedvar;
58 extern __attribute__((__visibility__("default"))) int exportedfunc (void); 59 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
59 void dummyfunc (void) {}], 60 extern __attribute__((__visibility__("default"))) int exportedfunc (void);
60 [], 61 void dummyfunc (void) {}
62 ]],
63 [[]])],
61 [gl_cv_cc_visibility=yes], 64 [gl_cv_cc_visibility=yes],
62 [gl_cv_cc_visibility=no]) 65 [gl_cv_cc_visibility=no])
63 CFLAGS="$gl_save_CFLAGS"]) 66 CFLAGS="$gl_save_CFLAGS"])
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4
index ed804e66..2db8c3f2 100644
--- a/m4/wchar_t.m4
+++ b/m4/wchar_t.m4
@@ -1,5 +1,5 @@
1# wchar_t.m4 serial 3 (gettext-0.18) 1# wchar_t.m4 serial 4 (gettext-0.18.2)
2dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,9 +11,13 @@ dnl Prerequisite: AC_PROG_CC
11AC_DEFUN([gt_TYPE_WCHAR_T], 11AC_DEFUN([gt_TYPE_WCHAR_T],
12[ 12[
13 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], 13 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
14 [AC_TRY_COMPILE([#include <stddef.h> 14 [AC_COMPILE_IFELSE(
15 wchar_t foo = (wchar_t)'\0';], , 15 [AC_LANG_PROGRAM(
16 [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) 16 [[#include <stddef.h>
17 wchar_t foo = (wchar_t)'\0';]],
18 [[]])],
19 [gt_cv_c_wchar_t=yes],
20 [gt_cv_c_wchar_t=no])])
17 if test $gt_cv_c_wchar_t = yes; then 21 if test $gt_cv_c_wchar_t = yes; then
18 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) 22 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
19 fi 23 fi
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
index a6c7d15c..8ff2a5b5 100644
--- a/m4/wint_t.m4
+++ b/m4/wint_t.m4
@@ -1,5 +1,5 @@
1# wint_t.m4 serial 4 (gettext-0.18) 1# wint_t.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,9 @@ dnl Prerequisite: AC_PROG_CC
11AC_DEFUN([gt_TYPE_WINT_T], 11AC_DEFUN([gt_TYPE_WINT_T],
12[ 12[
13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], 13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
14 [AC_TRY_COMPILE([ 14 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[
15/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 17/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
16 <wchar.h>. 18 <wchar.h>.
17 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included 19 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
@@ -20,8 +22,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
20#include <stdio.h> 22#include <stdio.h>
21#include <time.h> 23#include <time.h>
22#include <wchar.h> 24#include <wchar.h>
23 wint_t foo = (wchar_t)'\0';], , 25 wint_t foo = (wchar_t)'\0';]],
24 [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) 26 [[]])],
27 [gt_cv_c_wint_t=yes],
28 [gt_cv_c_wint_t=no])])
25 if test $gt_cv_c_wint_t = yes; then 29 if test $gt_cv_c_wint_t = yes; then
26 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) 30 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
27 fi 31 fi
diff --git a/m4/xsize.m4 b/m4/xsize.m4
index b653693a..16764e89 100644
--- a/m4/xsize.m4
+++ b/m4/xsize.m4
@@ -1,5 +1,5 @@
1# xsize.m4 serial 4 1# xsize.m4 serial 5
2dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003-2004, 2008-2016 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,5 @@ AC_DEFUN([gl_XSIZE],
8[ 8[
9 dnl Prerequisites of lib/xsize.h. 9 dnl Prerequisites of lib/xsize.h.
10 AC_REQUIRE([gl_SIZE_MAX]) 10 AC_REQUIRE([gl_SIZE_MAX])
11 AC_REQUIRE([AC_C_INLINE])
12 AC_CHECK_HEADERS([stdint.h]) 11 AC_CHECK_HEADERS([stdint.h])
13]) 12])