aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-18 19:57:24 +0000
committerChristian Grothoff <christian@grothoff.org>2015-05-18 19:57:24 +0000
commit755b04521a5b37ceac529df984c9ca1e466741c6 (patch)
treef44b464dcad4c03281027aa95ca5e1dd11b2e7b9 /m4
parent55406e60956ebbd4e50e0907e0bcd94df5f71d55 (diff)
downloadgnunet-755b04521a5b37ceac529df984c9ca1e466741c6.tar.gz
gnunet-755b04521a5b37ceac529df984c9ca1e466741c6.zip
-gettext and libtoolize updates
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog9
-rw-r--r--m4/codeset.m418
-rw-r--r--m4/extern-inline.m499
-rw-r--r--m4/fcntl-o.m4134
-rw-r--r--m4/glibc2.m421
-rw-r--r--m4/glibc21.m426
-rw-r--r--m4/iconv.m4223
-rw-r--r--m4/intdiv0.m455
-rw-r--r--m4/intldir.m46
-rw-r--r--m4/intlmacosx.m456
-rw-r--r--m4/intmax.m421
-rw-r--r--m4/inttypes-pri.m420
-rw-r--r--m4/inttypes_h.m423
-rw-r--r--m4/lcmessage.m417
-rw-r--r--m4/lib-ld.m487
-rw-r--r--m4/lib-link.m4311
-rw-r--r--m4/lib-prefix.m491
-rw-r--r--m4/lock.m4323
-rw-r--r--m4/longlong.m4119
-rw-r--r--m4/nls.m413
-rw-r--r--m4/printf-posix.m426
-rw-r--r--m4/progtest.m431
-rw-r--r--m4/size_max.m447
-rw-r--r--m4/stdint_h.m421
-rw-r--r--m4/threadlib.m4389
-rw-r--r--m4/uintmax_t.m414
-rw-r--r--m4/visibility.m449
-rw-r--r--m4/wint_t.m426
-rw-r--r--m4/xsize.m47
29 files changed, 1606 insertions, 676 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index e76f4b088..35a8d8971 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,12 @@
12015-05-18 gettextize <bug-gnu-gettext@gnu.org>
2
3 * iconv.m4: Upgrade to gettext-0.19.3.
4 * lib-ld.m4: Upgrade to gettext-0.19.3.
5 * lib-link.m4: Upgrade to gettext-0.19.3.
6 * lib-prefix.m4: Upgrade to gettext-0.19.3.
7 * nls.m4: Upgrade to gettext-0.19.3.
8 * progtest.m4: Upgrade to gettext-0.19.3.
9
12007-02-08 gettextize <bug-gnu-gettext@gnu.org> 102007-02-08 gettextize <bug-gnu-gettext@gnu.org>
2 11
3 * gettext.m4: Upgrade to gettext-0.16.1. 12 * gettext.m4: Upgrade to gettext-0.16.1.
diff --git a/m4/codeset.m4 b/m4/codeset.m4
index 223955b45..d7de8d67e 100644
--- a/m4/codeset.m4
+++ b/m4/codeset.m4
@@ -1,5 +1,5 @@
1# codeset.m4 serial 2 (gettext-0.16) 1# codeset.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2006, 2008-2014 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,14 +8,16 @@ dnl From Bruno Haible.
8 8
9AC_DEFUN([AM_LANGINFO_CODESET], 9AC_DEFUN([AM_LANGINFO_CODESET],
10[ 10[
11 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 11 AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
12 [AC_TRY_LINK([#include <langinfo.h>], 12 [AC_LINK_IFELSE(
13 [char* cs = nl_langinfo(CODESET); return !cs;], 13 [AC_LANG_PROGRAM(
14 am_cv_langinfo_codeset=yes, 14 [[#include <langinfo.h>]],
15 am_cv_langinfo_codeset=no) 15 [[char* cs = nl_langinfo(CODESET); return !cs;]])],
16 [am_cv_langinfo_codeset=yes],
17 [am_cv_langinfo_codeset=no])
16 ]) 18 ])
17 if test $am_cv_langinfo_codeset = yes; then 19 if test $am_cv_langinfo_codeset = yes; then
18 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 20 AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
19 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 21 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
20 fi 22 fi
21]) 23])
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
new file mode 100644
index 000000000..7f1bb397c
--- /dev/null
+++ b/m4/extern-inline.m4
@@ -0,0 +1,99 @@
1dnl 'extern inline' a la ISO C99.
2
3dnl Copyright 2012-2014 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 __SUNPRO_C && __STDC__))) \
58 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
59# define _GL_INLINE inline
60# define _GL_EXTERN_INLINE extern inline
61# define _GL_EXTERN_INLINE_IN_USE
62#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
63 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
64# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
65 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
66# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
67# else
68# define _GL_INLINE extern inline
69# endif
70# define _GL_EXTERN_INLINE extern
71# define _GL_EXTERN_INLINE_IN_USE
72#else
73# define _GL_INLINE static _GL_UNUSED
74# define _GL_EXTERN_INLINE static _GL_UNUSED
75#endif
76
77#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
78# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
79# define _GL_INLINE_HEADER_CONST_PRAGMA
80# else
81# define _GL_INLINE_HEADER_CONST_PRAGMA \
82 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
83# endif
84 /* Suppress GCC's bogus "no previous prototype for 'FOO'"
85 and "no previous declaration for 'FOO'" diagnostics,
86 when FOO is an inline function in the header; see
87 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
88# define _GL_INLINE_HEADER_BEGIN \
89 _Pragma ("GCC diagnostic push") \
90 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
91 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
92 _GL_INLINE_HEADER_CONST_PRAGMA
93# define _GL_INLINE_HEADER_END \
94 _Pragma ("GCC diagnostic pop")
95#else
96# define _GL_INLINE_HEADER_BEGIN
97# define _GL_INLINE_HEADER_END
98#endif])
99])
diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4
new file mode 100644
index 000000000..43c93124e
--- /dev/null
+++ b/m4/fcntl-o.m4
@@ -0,0 +1,134 @@
1# fcntl-o.m4 serial 4
2dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Written by Paul Eggert.
8
9# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
10# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
11# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
12AC_DEFUN([gl_FCNTL_O_FLAGS],
13[
14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
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])
23 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
24 [AC_RUN_IFELSE(
25 [AC_LANG_PROGRAM(
26 [[#include <sys/types.h>
27 #include <sys/stat.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
35 #include <fcntl.h>
36 #ifndef O_NOATIME
37 #define O_NOATIME 0
38 #endif
39 #ifndef O_NOFOLLOW
40 #define O_NOFOLLOW 0
41 #endif
42 static int const constants[] =
43 {
44 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
45 O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
46 };
47 ]],
48 [[
49 int result = !constants;
50 #if HAVE_SYMLINK
51 {
52 static char const sym[] = "conftest.sym";
53 if (symlink ("/dev/null", sym) != 0)
54 result |= 2;
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 }
75 unlink (sym);
76 }
77 #endif
78 {
79 static char const file[] = "confdefs.h";
80 int fd = open (file, O_RDONLY | O_NOATIME);
81 if (fd < 0)
82 result |= 8;
83 else
84 {
85 struct stat st0;
86 if (fstat (fd, &st0) != 0)
87 result |= 16;
88 else
89 {
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 }
110 }
111 return result;]])],
112 [gl_cv_header_working_fcntl_h=yes],
113 [case $? in #(
114 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
115 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
116 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
117 *) gl_cv_header_working_fcntl_h='no';;
118 esac],
119 [gl_cv_header_working_fcntl_h=cross-compiling])])
120
121 case $gl_cv_header_working_fcntl_h in #(
122 *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
123 *) ac_val=1;;
124 esac
125 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
126 [Define to 1 if O_NOATIME works.])
127
128 case $gl_cv_header_working_fcntl_h in #(
129 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
130 *) ac_val=1;;
131 esac
132 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
133 [Define to 1 if O_NOFOLLOW works.])
134])
diff --git a/m4/glibc2.m4 b/m4/glibc2.m4
index e8f5bfe6e..71dd8a123 100644
--- a/m4/glibc2.m4
+++ b/m4/glibc2.m4
@@ -1,5 +1,6 @@
1# glibc2.m4 serial 1 1# glibc2.m4 serial 3
2dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2014 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,22 +10,22 @@ dnl with or without modifications, as long as this notice is preserved.
9 10
10AC_DEFUN([gt_GLIBC2], 11AC_DEFUN([gt_GLIBC2],
11 [ 12 [
12 AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, 13 AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer],
13 ac_cv_gnu_library_2, 14 [ac_cv_gnu_library_2],
14 [AC_EGREP_CPP([Lucky GNU user], 15 [AC_EGREP_CPP([Lucky GNU user],
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
22 ], 23 ],
23 ac_cv_gnu_library_2=yes, 24 [ac_cv_gnu_library_2=yes],
24 ac_cv_gnu_library_2=no) 25 [ac_cv_gnu_library_2=no])
25 ] 26 ]
26 ) 27 )
27 AC_SUBST(GLIBC2) 28 AC_SUBST([GLIBC2])
28 GLIBC2="$ac_cv_gnu_library_2" 29 GLIBC2="$ac_cv_gnu_library_2"
29 ] 30 ]
30) 31)
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
index d95fd9861..ab58b7121 100644
--- a/m4/glibc21.m4
+++ b/m4/glibc21.m4
@@ -1,30 +1,34 @@
1# glibc21.m4 serial 3 1# glibc21.m4 serial 5
2dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2014 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__
18 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 19 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
19 Lucky GNU user 20 Lucky GNU user
20 #endif 21 #endif
21#endif 22#endif
22 ], 23#ifdef __UCLIBC__
23 ac_cv_gnu_library_2_1=yes, 24 Lucky user
24 ac_cv_gnu_library_2_1=no) 25#endif
26 ],
27 [ac_cv_gnu_library_2_1=yes],
28 [ac_cv_gnu_library_2_1=no])
25 ] 29 ]
26 ) 30 )
27 AC_SUBST(GLIBC21) 31 AC_SUBST([GLIBC21])
28 GLIBC21="$ac_cv_gnu_library_2_1" 32 GLIBC21="$ac_cv_gnu_library_2_1"
29 ] 33 ]
30) 34)
diff --git a/m4/iconv.m4 b/m4/iconv.m4
index 654c41589..4b29c5f2c 100644
--- a/m4/iconv.m4
+++ b/m4/iconv.m4
@@ -1,5 +1,5 @@
1# iconv.m4 serial AM4 (gettext-0.11.3) 1# iconv.m4 serial 18 (gettext-0.18.2)
2dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2007-2014 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.
@@ -21,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK],
21[ 21[
22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
23 dnl those with the standalone portable GNU libiconv installed). 23 dnl those with the standalone portable GNU libiconv installed).
24 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
24 25
25 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV 26 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
26 dnl accordingly. 27 dnl accordingly.
@@ -29,34 +30,170 @@ AC_DEFUN([AM_ICONV_LINK],
29 dnl Add $INCICONV to CPPFLAGS before performing the following checks, 30 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
30 dnl because if the user has installed libiconv and not disabled its use 31 dnl because if the user has installed libiconv and not disabled its use
31 dnl via --without-libiconv-prefix, he wants to use it. The first 32 dnl via --without-libiconv-prefix, he wants to use it. The first
32 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. 33 dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
33 am_save_CPPFLAGS="$CPPFLAGS" 34 am_save_CPPFLAGS="$CPPFLAGS"
34 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
35 36
36 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 37 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
37 am_cv_func_iconv="no, consider installing GNU libiconv" 38 am_cv_func_iconv="no, consider installing GNU libiconv"
38 am_cv_lib_iconv=no 39 am_cv_lib_iconv=no
39 AC_TRY_LINK([#include <stdlib.h> 40 AC_LINK_IFELSE(
40#include <iconv.h>], 41 [AC_LANG_PROGRAM(
41 [iconv_t cd = iconv_open("",""); 42 [[
42 iconv(cd,NULL,NULL,NULL,NULL); 43#include <stdlib.h>
43 iconv_close(cd);], 44#include <iconv.h>
44 am_cv_func_iconv=yes) 45 ]],
46 [[iconv_t cd = iconv_open("","");
47 iconv(cd,NULL,NULL,NULL,NULL);
48 iconv_close(cd);]])],
49 [am_cv_func_iconv=yes])
45 if test "$am_cv_func_iconv" != yes; then 50 if test "$am_cv_func_iconv" != yes; then
46 am_save_LIBS="$LIBS" 51 am_save_LIBS="$LIBS"
47 LIBS="$LIBS $LIBICONV" 52 LIBS="$LIBS $LIBICONV"
48 AC_TRY_LINK([#include <stdlib.h> 53 AC_LINK_IFELSE(
49#include <iconv.h>], 54 [AC_LANG_PROGRAM(
50 [iconv_t cd = iconv_open("",""); 55 [[
51 iconv(cd,NULL,NULL,NULL,NULL); 56#include <stdlib.h>
52 iconv_close(cd);], 57#include <iconv.h>
53 am_cv_lib_iconv=yes 58 ]],
54 am_cv_func_iconv=yes) 59 [[iconv_t cd = iconv_open("","");
60 iconv(cd,NULL,NULL,NULL,NULL);
61 iconv_close(cd);]])],
62 [am_cv_lib_iconv=yes]
63 [am_cv_func_iconv=yes])
55 LIBS="$am_save_LIBS" 64 LIBS="$am_save_LIBS"
56 fi 65 fi
57 ]) 66 ])
58 if test "$am_cv_func_iconv" = yes; then 67 if test "$am_cv_func_iconv" = yes; then
59 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) 68 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
69 dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
70 dnl Solaris 10.
71 am_save_LIBS="$LIBS"
72 if test $am_cv_lib_iconv = yes; then
73 LIBS="$LIBS $LIBICONV"
74 fi
75 AC_RUN_IFELSE(
76 [AC_LANG_SOURCE([[
77#include <iconv.h>
78#include <string.h>
79int main ()
80{
81 int result = 0;
82 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
83 returns. */
84 {
85 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
86 if (cd_utf8_to_88591 != (iconv_t)(-1))
87 {
88 static const char input[] = "\342\202\254"; /* EURO SIGN */
89 char buf[10];
90 const char *inptr = input;
91 size_t inbytesleft = strlen (input);
92 char *outptr = buf;
93 size_t outbytesleft = sizeof (buf);
94 size_t res = iconv (cd_utf8_to_88591,
95 (char **) &inptr, &inbytesleft,
96 &outptr, &outbytesleft);
97 if (res == 0)
98 result |= 1;
99 iconv_close (cd_utf8_to_88591);
100 }
101 }
102 /* Test against Solaris 10 bug: Failures are not distinguishable from
103 successful returns. */
104 {
105 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
106 if (cd_ascii_to_88591 != (iconv_t)(-1))
107 {
108 static const char input[] = "\263";
109 char buf[10];
110 const char *inptr = input;
111 size_t inbytesleft = strlen (input);
112 char *outptr = buf;
113 size_t outbytesleft = sizeof (buf);
114 size_t res = iconv (cd_ascii_to_88591,
115 (char **) &inptr, &inbytesleft,
116 &outptr, &outbytesleft);
117 if (res == 0)
118 result |= 2;
119 iconv_close (cd_ascii_to_88591);
120 }
121 }
122 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
123 {
124 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
125 if (cd_88591_to_utf8 != (iconv_t)(-1))
126 {
127 static const char input[] = "\304";
128 static char buf[2] = { (char)0xDE, (char)0xAD };
129 const char *inptr = input;
130 size_t inbytesleft = 1;
131 char *outptr = buf;
132 size_t outbytesleft = 1;
133 size_t res = iconv (cd_88591_to_utf8,
134 (char **) &inptr, &inbytesleft,
135 &outptr, &outbytesleft);
136 if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
137 result |= 4;
138 iconv_close (cd_88591_to_utf8);
139 }
140 }
141#if 0 /* This bug could be worked around by the caller. */
142 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
143 {
144 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
145 if (cd_88591_to_utf8 != (iconv_t)(-1))
146 {
147 static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
148 char buf[50];
149 const char *inptr = input;
150 size_t inbytesleft = strlen (input);
151 char *outptr = buf;
152 size_t outbytesleft = sizeof (buf);
153 size_t res = iconv (cd_88591_to_utf8,
154 (char **) &inptr, &inbytesleft,
155 &outptr, &outbytesleft);
156 if ((int)res > 0)
157 result |= 8;
158 iconv_close (cd_88591_to_utf8);
159 }
160 }
161#endif
162 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
163 provided. */
164 if (/* Try standardized names. */
165 iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
166 /* Try IRIX, OSF/1 names. */
167 && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
168 /* Try AIX names. */
169 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
170 /* Try HP-UX names. */
171 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
172 result |= 16;
173 return result;
174}]])],
175 [am_cv_func_iconv_works=yes],
176 [am_cv_func_iconv_works=no],
177 [
178changequote(,)dnl
179 case "$host_os" in
180 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
181 *) am_cv_func_iconv_works="guessing yes" ;;
182 esac
183changequote([,])dnl
184 ])
185 LIBS="$am_save_LIBS"
186 ])
187 case "$am_cv_func_iconv_works" in
188 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
189 *) am_func_iconv=yes ;;
190 esac
191 else
192 am_func_iconv=no am_cv_lib_iconv=no
193 fi
194 if test "$am_func_iconv" = yes; then
195 AC_DEFINE([HAVE_ICONV], [1],
196 [Define if you have the iconv() function and it works.])
60 fi 197 fi
61 if test "$am_cv_lib_iconv" = yes; then 198 if test "$am_cv_lib_iconv" = yes; then
62 AC_MSG_CHECKING([how to link with libiconv]) 199 AC_MSG_CHECKING([how to link with libiconv])
@@ -68,34 +205,64 @@ AC_DEFUN([AM_ICONV_LINK],
68 LIBICONV= 205 LIBICONV=
69 LTLIBICONV= 206 LTLIBICONV=
70 fi 207 fi
71 AC_SUBST(LIBICONV) 208 AC_SUBST([LIBICONV])
72 AC_SUBST(LTLIBICONV) 209 AC_SUBST([LTLIBICONV])
73]) 210])
74 211
75AC_DEFUN([AM_ICONV], 212dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
213dnl avoid warnings like
214dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
215dnl This is tricky because of the way 'aclocal' is implemented:
216dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
217dnl Otherwise aclocal's initial scan pass would miss the macro definition.
218dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
219dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
220dnl warnings.
221m4_define([gl_iconv_AC_DEFUN],
222 m4_version_prereq([2.64],
223 [[AC_DEFUN_ONCE(
224 [$1], [$2])]],
225 [m4_ifdef([gl_00GNULIB],
226 [[AC_DEFUN_ONCE(
227 [$1], [$2])]],
228 [[AC_DEFUN(
229 [$1], [$2])]])]))
230gl_iconv_AC_DEFUN([AM_ICONV],
76[ 231[
77 AM_ICONV_LINK 232 AM_ICONV_LINK
78 if test "$am_cv_func_iconv" = yes; then 233 if test "$am_cv_func_iconv" = yes; then
79 AC_MSG_CHECKING([for iconv declaration]) 234 AC_MSG_CHECKING([for iconv declaration])
80 AC_CACHE_VAL(am_cv_proto_iconv, [ 235 AC_CACHE_VAL([am_cv_proto_iconv], [
81 AC_TRY_COMPILE([ 236 AC_COMPILE_IFELSE(
237 [AC_LANG_PROGRAM(
238 [[
82#include <stdlib.h> 239#include <stdlib.h>
83#include <iconv.h> 240#include <iconv.h>
84extern 241extern
85#ifdef __cplusplus 242#ifdef __cplusplus
86"C" 243"C"
87#endif 244#endif
88#if defined(__STDC__) || defined(__cplusplus) 245#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
89size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 246size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
90#else 247#else
91size_t iconv(); 248size_t iconv();
92#endif 249#endif
93], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") 250 ]],
251 [[]])],
252 [am_cv_proto_iconv_arg1=""],
253 [am_cv_proto_iconv_arg1="const"])
94 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) 254 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
95 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` 255 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
96 AC_MSG_RESULT([$]{ac_t:- 256 AC_MSG_RESULT([
97 }[$]am_cv_proto_iconv) 257 $am_cv_proto_iconv])
98 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, 258 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
99 [Define as const if the declaration of iconv() needs const.]) 259 [Define as const if the declaration of iconv() needs const.])
260 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
261 m4_ifdef([gl_ICONV_H_DEFAULTS],
262 [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
263 if test -n "$am_cv_proto_iconv_arg1"; then
264 ICONV_CONST="const"
265 fi
266 ])
100 fi 267 fi
101]) 268])
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4
index b8d78176a..afa9acb82 100644
--- a/m4/intdiv0.m4
+++ b/m4/intdiv0.m4
@@ -1,5 +1,5 @@
1# intdiv0.m4 serial 1 (gettext-0.11.3) 1# intdiv0.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2008, 2010-2014 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,16 +14,28 @@ AC_DEFUN([gt_INTDIV0],
14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], 14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
15 gt_cv_int_divbyzero_sigfpe, 15 gt_cv_int_divbyzero_sigfpe,
16 [ 16 [
17 AC_TRY_RUN([ 17 gt_cv_int_divbyzero_sigfpe=
18changequote(,)dnl
19 case "$host_os" in
20 macos* | darwin[6-9]* | darwin[1-9][0-9]*)
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
23 # dialog window would pop up.
24 case "$host_cpu" in
25 i[34567]86 | x86_64)
26 gt_cv_int_divbyzero_sigfpe="guessing yes" ;;
27 esac
28 ;;
29 esac
30changequote([,])dnl
31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then
32 AC_RUN_IFELSE(
33 [AC_LANG_SOURCE([[
18#include <stdlib.h> 34#include <stdlib.h>
19#include <signal.h> 35#include <signal.h>
20 36
21static void 37static void
22#ifdef __cplusplus
23sigfpe_handler (int sig) 38sigfpe_handler (int sig)
24#else
25sigfpe_handler (sig) int sig;
26#endif
27{ 39{
28 /* 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. */
29 exit (sig != SIGFPE); 41 exit (sig != SIGFPE);
@@ -48,23 +60,28 @@ int main ()
48 60
49 z = x / y; 61 z = x / y;
50 nan = y / y; 62 nan = y / y;
51 exit (1); 63 exit (2);
52} 64}
53], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, 65]])],
54 [ 66 [gt_cv_int_divbyzero_sigfpe=yes],
55 # Guess based on the CPU. 67 [gt_cv_int_divbyzero_sigfpe=no],
56 case "$host_cpu" in 68 [
57 alpha* | i[34567]86 | m68k | s390*) 69 # Guess based on the CPU.
58 gt_cv_int_divbyzero_sigfpe="guessing yes";; 70changequote(,)dnl
59 *) 71 case "$host_cpu" in
60 gt_cv_int_divbyzero_sigfpe="guessing no";; 72 alpha* | i[34567]86 | x86_64 | m68k | s390*)
61 esac 73 gt_cv_int_divbyzero_sigfpe="guessing yes";;
62 ]) 74 *)
75 gt_cv_int_divbyzero_sigfpe="guessing no";;
76 esac
77changequote([,])dnl
78 ])
79 fi
63 ]) 80 ])
64 case "$gt_cv_int_divbyzero_sigfpe" in 81 case "$gt_cv_int_divbyzero_sigfpe" in
65 *yes) value=1;; 82 *yes) value=1;;
66 *) value=0;; 83 *) value=0;;
67 esac 84 esac
68 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, 85 AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value],
69 [Define if integer division by zero raises signal SIGFPE.]) 86 [Define if integer division by zero raises signal SIGFPE.])
70]) 87])
diff --git a/m4/intldir.m4 b/m4/intldir.m4
index 7a28843f6..73b672a57 100644
--- a/m4/intldir.m4
+++ b/m4/intldir.m4
@@ -1,5 +1,5 @@
1# intldir.m4 serial 1 (gettext-0.16) 1# intldir.m4 serial 2 (gettext-0.18)
2dnl Copyright (C) 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009-2014 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,7 @@ dnl 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 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
16AC_PREREQ(2.52) 16AC_PREREQ([2.52])
17 17
18dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory. 18dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory.
19AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], []) 19AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], [])
diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4
new file mode 100644
index 000000000..8a045f6a2
--- /dev/null
+++ b/m4/intlmacosx.m4
@@ -0,0 +1,56 @@
1# intlmacosx.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2004-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can can be used in projects which are not available under
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
10dnl functionality.
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
13dnl gettext package package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Checks for special options needed on Mac OS X.
17dnl Defines INTL_MACOSX_LIBS.
18AC_DEFUN([gt_INTL_MACOSX],
19[
20 dnl Check for API introduced in Mac OS X 10.2.
21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
22 [gt_cv_func_CFPreferencesCopyAppValue],
23 [gt_save_LIBS="$LIBS"
24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
25 AC_LINK_IFELSE(
26 [AC_LANG_PROGRAM(
27 [[#include <CoreFoundation/CFPreferences.h>]],
28 [[CFPreferencesCopyAppValue(NULL, NULL)]])],
29 [gt_cv_func_CFPreferencesCopyAppValue=yes],
30 [gt_cv_func_CFPreferencesCopyAppValue=no])
31 LIBS="$gt_save_LIBS"])
32 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
33 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
34 [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
35 fi
36 dnl Check for API introduced in Mac OS X 10.3.
37 AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
38 [gt_save_LIBS="$LIBS"
39 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
40 AC_LINK_IFELSE(
41 [AC_LANG_PROGRAM(
42 [[#include <CoreFoundation/CFLocale.h>]],
43 [[CFLocaleCopyCurrent();]])],
44 [gt_cv_func_CFLocaleCopyCurrent=yes],
45 [gt_cv_func_CFLocaleCopyCurrent=no])
46 LIBS="$gt_save_LIBS"])
47 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
48 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
49 [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
50 fi
51 INTL_MACOSX_LIBS=
52 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
53 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
54 fi
55 AC_SUBST([INTL_MACOSX_LIBS])
56])
diff --git a/m4/intmax.m4 b/m4/intmax.m4
index ce7a8a49d..f70ceeea1 100644
--- a/m4/intmax.m4
+++ b/m4/intmax.m4
@@ -1,5 +1,5 @@
1# intmax.m4 serial 3 (gettext-0.16) 1# intmax.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2005, 2008-2014 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,8 +12,10 @@ AC_DEFUN([gt_TYPE_INTMAX_T],
12[ 12[
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,12 +24,13 @@ 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;
27 gt_cv_c_intmax_t=yes, 29 return !x;]])],
28 gt_cv_c_intmax_t=no)]) 30 [gt_cv_c_intmax_t=yes],
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
30 AC_DEFINE(HAVE_INTMAX_T, 1, 33 AC_DEFINE([HAVE_INTMAX_T], [1],
31 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) 34 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
32 fi 35 fi
33]) 36])
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4
index 7c7f89401..00251e1db 100644
--- a/m4/inttypes-pri.m4
+++ b/m4/inttypes-pri.m4
@@ -1,12 +1,12 @@
1# inttypes-pri.m4 serial 4 (gettext-0.16) 1# inttypes-pri.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2002, 2006, 2008-2014 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.
@@ -16,17 +16,23 @@ AC_DEFUN([gt_INTTYPES_PRI],
16 AC_CHECK_HEADERS([inttypes.h]) 16 AC_CHECK_HEADERS([inttypes.h])
17 if test $ac_cv_header_inttypes_h = yes; then 17 if test $ac_cv_header_inttypes_h = yes; then
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
29 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, 35 AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1],
30 [Define if <inttypes.h> exists and defines unusable PRI* macros.]) 36 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
31 PRI_MACROS_BROKEN=1 37 PRI_MACROS_BROKEN=1
32 else 38 else
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4
index edc8ecb2d..87be9cfb5 100644
--- a/m4/inttypes_h.m4
+++ b/m4/inttypes_h.m4
@@ -1,5 +1,5 @@
1# inttypes_h.m4 serial 7 1# inttypes_h.m4 serial 10
2dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2014 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,15 +11,18 @@ dnl From Paul Eggert.
11 11
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>,
24 and declares uintmax_t. ]) 27 and declares uintmax_t. ])
25 fi 28 fi
diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4
index 19aa77e4f..7470ec597 100644
--- a/m4/lcmessage.m4
+++ b/m4/lcmessage.m4
@@ -1,5 +1,6 @@
1# lcmessage.m4 serial 4 (gettext-0.14.2) 1# lcmessage.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014 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.
@@ -20,11 +21,15 @@ dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
20 21
21AC_DEFUN([gt_LC_MESSAGES], 22AC_DEFUN([gt_LC_MESSAGES],
22[ 23[
23 AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, 24 AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
24 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 25 [AC_LINK_IFELSE(
25 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])])
26 if test $gt_cv_val_LC_MESSAGES = yes; then 31 if test $gt_cv_val_LC_MESSAGES = yes; then
27 AC_DEFINE(HAVE_LC_MESSAGES, 1, 32 AC_DEFINE([HAVE_LC_MESSAGES], [1],
28 [Define if your <locale.h> file defines LC_MESSAGES.]) 33 [Define if your <locale.h> file defines LC_MESSAGES.])
29 fi 34 fi
30]) 35])
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
index 96c4e2c33..ddc569f73 100644
--- a/m4/lib-ld.m4
+++ b/m4/lib-ld.m4
@@ -1,50 +1,56 @@
1# lib-ld.m4 serial 3 (gettext-0.13) 1# lib-ld.m4 serial 6
2dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2009-2014 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 Subroutines of libtool.m4, 7dnl Subroutines of libtool.m4,
8dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision 8dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
9dnl with libtool.m4. 9dnl collision with libtool.m4.
10 10
11dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. 11dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
12AC_DEFUN([AC_LIB_PROG_LD_GNU], 12AC_DEFUN([AC_LIB_PROG_LD_GNU],
13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, 13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
14[# I'd rather use --version here, but apparently some GNU ld's only accept -v. 14[# I'd rather use --version here, but apparently some GNU lds only accept -v.
15case `$LD -v 2>&1 </dev/null` in 15case `$LD -v 2>&1 </dev/null` in
16*GNU* | *'with BFD'*) 16*GNU* | *'with BFD'*)
17 acl_cv_prog_gnu_ld=yes ;; 17 acl_cv_prog_gnu_ld=yes
18 ;;
18*) 19*)
19 acl_cv_prog_gnu_ld=no ;; 20 acl_cv_prog_gnu_ld=no
21 ;;
20esac]) 22esac])
21with_gnu_ld=$acl_cv_prog_gnu_ld 23with_gnu_ld=$acl_cv_prog_gnu_ld
22]) 24])
23 25
24dnl From libtool-1.4. Sets the variable LD. 26dnl From libtool-2.4. Sets the variable LD.
25AC_DEFUN([AC_LIB_PROG_LD], 27AC_DEFUN([AC_LIB_PROG_LD],
26[AC_ARG_WITH(gnu-ld, 28[AC_REQUIRE([AC_PROG_CC])dnl
27[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
28test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
29AC_REQUIRE([AC_PROG_CC])dnl
30AC_REQUIRE([AC_CANONICAL_HOST])dnl 29AC_REQUIRE([AC_CANONICAL_HOST])dnl
30
31AC_ARG_WITH([gnu-ld],
32 [AS_HELP_STRING([--with-gnu-ld],
33 [assume the C compiler uses GNU ld [default=no]])],
34 [test "$withval" = no || with_gnu_ld=yes],
35 [with_gnu_ld=no])dnl
36
31# Prepare PATH_SEPARATOR. 37# Prepare PATH_SEPARATOR.
32# The user is always right. 38# The user is always right.
33if test "${PATH_SEPARATOR+set}" != set; then 39if test "${PATH_SEPARATOR+set}" != set; then
34 echo "#! /bin/sh" >conf$$.sh 40 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
35 echo "exit 0" >>conf$$.sh 41 # contains only /bin. Note that ksh looks also at the FPATH variable,
36 chmod +x conf$$.sh 42 # so we have to set that as well for the test.
37 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 43 PATH_SEPARATOR=:
38 PATH_SEPARATOR=';' 44 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
39 else 45 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
40 PATH_SEPARATOR=: 46 || PATH_SEPARATOR=';'
41 fi 47 }
42 rm -f conf$$.sh
43fi 48fi
49
44ac_prog=ld 50ac_prog=ld
45if test "$GCC" = yes; then 51if test "$GCC" = yes; then
46 # Check if gcc -print-prog-name=ld gives a path. 52 # Check if gcc -print-prog-name=ld gives a path.
47 AC_MSG_CHECKING([for ld used by GCC]) 53 AC_MSG_CHECKING([for ld used by $CC])
48 case $host in 54 case $host in
49 *-*-mingw*) 55 *-*-mingw*)
50 # gcc leaves a trailing carriage return which upsets mingw 56 # gcc leaves a trailing carriage return which upsets mingw
@@ -54,12 +60,12 @@ if test "$GCC" = yes; then
54 esac 60 esac
55 case $ac_prog in 61 case $ac_prog in
56 # Accept absolute paths. 62 # Accept absolute paths.
57 [[\\/]* | [A-Za-z]:[\\/]*)] 63 [[\\/]]* | ?:[[\\/]]*)
58 [re_direlt='/[^/][^/]*/\.\./'] 64 re_direlt='/[[^/]][[^/]]*/\.\./'
59 # Canonicalize the path of ld 65 # Canonicalize the pathname of ld
60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` 66 ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do 67 while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 68 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
63 done 69 done
64 test -z "$LD" && LD="$ac_prog" 70 test -z "$LD" && LD="$ac_prog"
65 ;; 71 ;;
@@ -77,33 +83,36 @@ elif test "$with_gnu_ld" = yes; then
77else 83else
78 AC_MSG_CHECKING([for non-GNU ld]) 84 AC_MSG_CHECKING([for non-GNU ld])
79fi 85fi
80AC_CACHE_VAL(acl_cv_path_LD, 86AC_CACHE_VAL([acl_cv_path_LD],
81[if test -z "$LD"; then 87[if test -z "$LD"; then
82 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" 88 acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
83 for ac_dir in $PATH; do 89 for ac_dir in $PATH; do
90 IFS="$acl_save_ifs"
84 test -z "$ac_dir" && ac_dir=. 91 test -z "$ac_dir" && ac_dir=.
85 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then 92 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
86 acl_cv_path_LD="$ac_dir/$ac_prog" 93 acl_cv_path_LD="$ac_dir/$ac_prog"
87 # Check to see if the program is GNU ld. I'd rather use --version, 94 # Check to see if the program is GNU ld. I'd rather use --version,
88 # but apparently some GNU ld's only accept -v. 95 # but apparently some variants of GNU ld only accept -v.
89 # Break only if it was the GNU/non-GNU ld that we prefer. 96 # Break only if it was the GNU/non-GNU ld that we prefer.
90 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in 97 case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
91 *GNU* | *'with BFD'*) 98 *GNU* | *'with BFD'*)
92 test "$with_gnu_ld" != no && break ;; 99 test "$with_gnu_ld" != no && break
100 ;;
93 *) 101 *)
94 test "$with_gnu_ld" != yes && break ;; 102 test "$with_gnu_ld" != yes && break
103 ;;
95 esac 104 esac
96 fi 105 fi
97 done 106 done
98 IFS="$ac_save_ifs" 107 IFS="$acl_save_ifs"
99else 108else
100 acl_cv_path_LD="$LD" # Let the user override the test with a path. 109 acl_cv_path_LD="$LD" # Let the user override the test with a path.
101fi]) 110fi])
102LD="$acl_cv_path_LD" 111LD="$acl_cv_path_LD"
103if test -n "$LD"; then 112if test -n "$LD"; then
104 AC_MSG_RESULT($LD) 113 AC_MSG_RESULT([$LD])
105else 114else
106 AC_MSG_RESULT(no) 115 AC_MSG_RESULT([no])
107fi 116fi
108test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) 117test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
109AC_LIB_PROG_LD_GNU 118AC_LIB_PROG_LD_GNU
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
index f95b7ba88..3522d994d 100644
--- a/m4/lib-link.m4
+++ b/m4/lib-link.m4
@@ -1,58 +1,66 @@
1# lib-link.m4 serial 9 (gettext-0.16) 1# lib-link.m4 serial 26 (gettext-0.18.2)
2dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2014 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.50) 9AC_PREREQ([2.54])
10 10
11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and 11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12dnl the libraries corresponding to explicit and implicit dependencies. 12dnl the libraries corresponding to explicit and implicit dependencies.
13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and 13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
14dnl augments the CPPFLAGS variable. 14dnl augments the CPPFLAGS variable.
15dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
16dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
15AC_DEFUN([AC_LIB_LINKFLAGS], 17AC_DEFUN([AC_LIB_LINKFLAGS],
16[ 18[
17 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) 19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18 AC_REQUIRE([AC_LIB_RPATH]) 20 AC_REQUIRE([AC_LIB_RPATH])
19 define([Name],[translit([$1],[./-], [___])]) 21 pushdef([Name],[m4_translit([$1],[./+-], [____])])
20 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 22 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
21 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 23 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
22 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ 24 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
23 AC_LIB_LINKFLAGS_BODY([$1], [$2]) 25 AC_LIB_LINKFLAGS_BODY([$1], [$2])
24 ac_cv_lib[]Name[]_libs="$LIB[]NAME" 26 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
25 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" 27 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
26 ac_cv_lib[]Name[]_cppflags="$INC[]NAME" 28 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
29 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
27 ]) 30 ])
28 LIB[]NAME="$ac_cv_lib[]Name[]_libs" 31 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
29 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" 32 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
30 INC[]NAME="$ac_cv_lib[]Name[]_cppflags" 33 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
34 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
31 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
32 AC_SUBST([LIB]NAME) 36 AC_SUBST([LIB]NAME)
33 AC_SUBST([LTLIB]NAME) 37 AC_SUBST([LTLIB]NAME)
38 AC_SUBST([LIB]NAME[_PREFIX])
34 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the 39 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
35 dnl results of this search when this library appears as a dependency. 40 dnl results of this search when this library appears as a dependency.
36 HAVE_LIB[]NAME=yes 41 HAVE_LIB[]NAME=yes
37 undefine([Name]) 42 popdef([NAME])
38 undefine([NAME]) 43 popdef([Name])
39]) 44])
40 45
41dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) 46dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
42dnl searches for libname and the libraries corresponding to explicit and 47dnl searches for libname and the libraries corresponding to explicit and
43dnl implicit dependencies, together with the specified include files and 48dnl implicit dependencies, together with the specified include files and
44dnl the ability to compile and link the specified testcode. If found, it 49dnl the ability to compile and link the specified testcode. The missing-message
45dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and 50dnl defaults to 'no' and may contain additional hints for the user.
46dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and 51dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
52dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
47dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs 53dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
48dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. 54dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
55dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
56dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
49AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], 57AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
50[ 58[
51 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) 59 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
52 AC_REQUIRE([AC_LIB_RPATH]) 60 AC_REQUIRE([AC_LIB_RPATH])
53 define([Name],[translit([$1],[./-], [___])]) 61 pushdef([Name],[m4_translit([$1],[./+-], [____])])
54 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 62 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
55 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 63 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
56 64
57 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME 65 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
58 dnl accordingly. 66 dnl accordingly.
@@ -66,13 +74,26 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
66 74
67 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ 75 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
68 ac_save_LIBS="$LIBS" 76 ac_save_LIBS="$LIBS"
69 LIBS="$LIBS $LIB[]NAME" 77 dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
70 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) 78 dnl because these -l options might require -L options that are present in
79 dnl LIBS. -l options benefit only from the -L options listed before it.
80 dnl Otherwise, add it to the front of LIBS, because it may be a static
81 dnl library that depends on another static library that is present in LIBS.
82 dnl Static libraries benefit only from the static libraries listed after
83 dnl it.
84 case " $LIB[]NAME" in
85 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
86 *) LIBS="$LIB[]NAME $LIBS" ;;
87 esac
88 AC_LINK_IFELSE(
89 [AC_LANG_PROGRAM([[$3]], [[$4]])],
90 [ac_cv_lib[]Name=yes],
91 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
71 LIBS="$ac_save_LIBS" 92 LIBS="$ac_save_LIBS"
72 ]) 93 ])
73 if test "$ac_cv_lib[]Name" = yes; then 94 if test "$ac_cv_lib[]Name" = yes; then
74 HAVE_LIB[]NAME=yes 95 HAVE_LIB[]NAME=yes
75 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) 96 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
76 AC_MSG_CHECKING([how to link with lib[]$1]) 97 AC_MSG_CHECKING([how to link with lib[]$1])
77 AC_MSG_RESULT([$LIB[]NAME]) 98 AC_MSG_RESULT([$LIB[]NAME])
78 else 99 else
@@ -82,17 +103,25 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
82 CPPFLAGS="$ac_save_CPPFLAGS" 103 CPPFLAGS="$ac_save_CPPFLAGS"
83 LIB[]NAME= 104 LIB[]NAME=
84 LTLIB[]NAME= 105 LTLIB[]NAME=
106 LIB[]NAME[]_PREFIX=
85 fi 107 fi
86 AC_SUBST([HAVE_LIB]NAME) 108 AC_SUBST([HAVE_LIB]NAME)
87 AC_SUBST([LIB]NAME) 109 AC_SUBST([LIB]NAME)
88 AC_SUBST([LTLIB]NAME) 110 AC_SUBST([LTLIB]NAME)
89 undefine([Name]) 111 AC_SUBST([LIB]NAME[_PREFIX])
90 undefine([NAME]) 112 popdef([NAME])
113 popdef([Name])
91]) 114])
92 115
93dnl Determine the platform dependent parameters needed to use rpath: 116dnl Determine the platform dependent parameters needed to use rpath:
94dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, 117dnl acl_libext,
95dnl hardcode_direct, hardcode_minus_L. 118dnl acl_shlibext,
119dnl acl_libname_spec,
120dnl acl_library_names_spec,
121dnl acl_hardcode_libdir_flag_spec,
122dnl acl_hardcode_libdir_separator,
123dnl acl_hardcode_direct,
124dnl acl_hardcode_minus_L.
96AC_DEFUN([AC_LIB_RPATH], 125AC_DEFUN([AC_LIB_RPATH],
97[ 126[
98 dnl Tell automake >= 1.10 to complain if config.rpath is missing. 127 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
@@ -101,7 +130,7 @@ AC_DEFUN([AC_LIB_RPATH],
101 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld 130 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
102 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host 131 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
103 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir 132 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
104 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ 133 AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
105 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ 134 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
106 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh 135 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
107 . ./conftest.sh 136 . ./conftest.sh
@@ -109,35 +138,66 @@ AC_DEFUN([AC_LIB_RPATH],
109 acl_cv_rpath=done 138 acl_cv_rpath=done
110 ]) 139 ])
111 wl="$acl_cv_wl" 140 wl="$acl_cv_wl"
112 libext="$acl_cv_libext" 141 acl_libext="$acl_cv_libext"
113 shlibext="$acl_cv_shlibext" 142 acl_shlibext="$acl_cv_shlibext"
114 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" 143 acl_libname_spec="$acl_cv_libname_spec"
115 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" 144 acl_library_names_spec="$acl_cv_library_names_spec"
116 hardcode_direct="$acl_cv_hardcode_direct" 145 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
117 hardcode_minus_L="$acl_cv_hardcode_minus_L" 146 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
147 acl_hardcode_direct="$acl_cv_hardcode_direct"
148 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
118 dnl Determine whether the user wants rpath handling at all. 149 dnl Determine whether the user wants rpath handling at all.
119 AC_ARG_ENABLE(rpath, 150 AC_ARG_ENABLE([rpath],
120 [ --disable-rpath do not hardcode runtime library paths], 151 [ --disable-rpath do not hardcode runtime library paths],
121 :, enable_rpath=yes) 152 :, enable_rpath=yes)
122]) 153])
123 154
155dnl AC_LIB_FROMPACKAGE(name, package)
156dnl declares that libname comes from the given package. The configure file
157dnl will then not have a --with-libname-prefix option but a
158dnl --with-package-prefix option. Several libraries can come from the same
159dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
160dnl macro call that searches for libname.
161AC_DEFUN([AC_LIB_FROMPACKAGE],
162[
163 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
164 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
165 define([acl_frompackage_]NAME, [$2])
166 popdef([NAME])
167 pushdef([PACK],[$2])
168 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
169 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
170 define([acl_libsinpackage_]PACKUP,
171 m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
172 popdef([PACKUP])
173 popdef([PACK])
174])
175
124dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and 176dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
125dnl the libraries corresponding to explicit and implicit dependencies. 177dnl the libraries corresponding to explicit and implicit dependencies.
126dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. 178dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
179dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
180dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
127AC_DEFUN([AC_LIB_LINKFLAGS_BODY], 181AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
128[ 182[
129 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) 183 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
130 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 184 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
131 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 185 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
186 pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
187 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
188 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
189 pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
190 dnl Autoconf >= 2.61 supports dots in --with options.
191 pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
132 dnl By default, look in $includedir and $libdir. 192 dnl By default, look in $includedir and $libdir.
133 use_additional=yes 193 use_additional=yes
134 AC_LIB_WITH_FINAL_PREFIX([ 194 AC_LIB_WITH_FINAL_PREFIX([
135 eval additional_includedir=\"$includedir\" 195 eval additional_includedir=\"$includedir\"
136 eval additional_libdir=\"$libdir\" 196 eval additional_libdir=\"$libdir\"
137 ]) 197 ])
138 AC_LIB_ARG_WITH([lib$1-prefix], 198 AC_ARG_WITH(P_A_C_K[-prefix],
139[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib 199[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
140 --without-lib$1-prefix don't search for lib$1 in includedir and libdir], 200 --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
141[ 201[
142 if test "X$withval" = "Xno"; then 202 if test "X$withval" = "Xno"; then
143 use_additional=no 203 use_additional=no
@@ -150,6 +210,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
150 else 210 else
151 additional_includedir="$withval/include" 211 additional_includedir="$withval/include"
152 additional_libdir="$withval/$acl_libdirstem" 212 additional_libdir="$withval/$acl_libdirstem"
213 if test "$acl_libdirstem2" != "$acl_libdirstem" \
214 && ! test -d "$withval/$acl_libdirstem"; then
215 additional_libdir="$withval/$acl_libdirstem2"
216 fi
153 fi 217 fi
154 fi 218 fi
155]) 219])
@@ -158,6 +222,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
158 LIB[]NAME= 222 LIB[]NAME=
159 LTLIB[]NAME= 223 LTLIB[]NAME=
160 INC[]NAME= 224 INC[]NAME=
225 LIB[]NAME[]_PREFIX=
226 dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
227 dnl computed. So it has to be reset here.
228 HAVE_LIB[]NAME=
161 rpathdirs= 229 rpathdirs=
162 ltrpathdirs= 230 ltrpathdirs=
163 names_already_handled= 231 names_already_handled=
@@ -177,7 +245,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
177 names_already_handled="$names_already_handled $name" 245 names_already_handled="$names_already_handled $name"
178 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS 246 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
179 dnl or AC_LIB_HAVE_LINKFLAGS call. 247 dnl or AC_LIB_HAVE_LINKFLAGS call.
180 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` 248 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
181 eval value=\"\$HAVE_LIB$uppername\" 249 eval value=\"\$HAVE_LIB$uppername\"
182 if test -n "$value"; then 250 if test -n "$value"; then
183 if test "$value" = yes; then 251 if test "$value" = yes; then
@@ -197,27 +265,53 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
197 found_la= 265 found_la=
198 found_so= 266 found_so=
199 found_a= 267 found_a=
268 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
269 if test -n "$acl_shlibext"; then
270 shrext=".$acl_shlibext" # typically: shrext=.so
271 else
272 shrext=
273 fi
200 if test $use_additional = yes; then 274 if test $use_additional = yes; then
201 if test -n "$shlibext" \ 275 dir="$additional_libdir"
202 && { test -f "$additional_libdir/lib$name.$shlibext" \ 276 dnl The same code as in the loop below:
203 || { test "$shlibext" = dll \ 277 dnl First look for a shared library.
204 && test -f "$additional_libdir/lib$name.dll.a"; }; }; then 278 if test -n "$acl_shlibext"; then
205 found_dir="$additional_libdir" 279 if test -f "$dir/$libname$shrext"; then
206 if test -f "$additional_libdir/lib$name.$shlibext"; then 280 found_dir="$dir"
207 found_so="$additional_libdir/lib$name.$shlibext" 281 found_so="$dir/$libname$shrext"
208 else 282 else
209 found_so="$additional_libdir/lib$name.dll.a" 283 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
284 ver=`(cd "$dir" && \
285 for f in "$libname$shrext".*; do echo "$f"; done \
286 | sed -e "s,^$libname$shrext\\\\.,," \
287 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
288 | sed 1q ) 2>/dev/null`
289 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
290 found_dir="$dir"
291 found_so="$dir/$libname$shrext.$ver"
292 fi
293 else
294 eval library_names=\"$acl_library_names_spec\"
295 for f in $library_names; do
296 if test -f "$dir/$f"; then
297 found_dir="$dir"
298 found_so="$dir/$f"
299 break
300 fi
301 done
302 fi
210 fi 303 fi
211 if test -f "$additional_libdir/lib$name.la"; then 304 fi
212 found_la="$additional_libdir/lib$name.la" 305 dnl Then look for a static library.
306 if test "X$found_dir" = "X"; then
307 if test -f "$dir/$libname.$acl_libext"; then
308 found_dir="$dir"
309 found_a="$dir/$libname.$acl_libext"
213 fi 310 fi
214 else 311 fi
215 if test -f "$additional_libdir/lib$name.$libext"; then 312 if test "X$found_dir" != "X"; then
216 found_dir="$additional_libdir" 313 if test -f "$dir/$libname.la"; then
217 found_a="$additional_libdir/lib$name.$libext" 314 found_la="$dir/$libname.la"
218 if test -f "$additional_libdir/lib$name.la"; then
219 found_la="$additional_libdir/lib$name.la"
220 fi
221 fi 315 fi
222 fi 316 fi
223 fi 317 fi
@@ -227,26 +321,44 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
227 case "$x" in 321 case "$x" in
228 -L*) 322 -L*)
229 dir=`echo "X$x" | sed -e 's/^X-L//'` 323 dir=`echo "X$x" | sed -e 's/^X-L//'`
230 if test -n "$shlibext" \ 324 dnl First look for a shared library.
231 && { test -f "$dir/lib$name.$shlibext" \ 325 if test -n "$acl_shlibext"; then
232 || { test "$shlibext" = dll \ 326 if test -f "$dir/$libname$shrext"; then
233 && test -f "$dir/lib$name.dll.a"; }; }; then 327 found_dir="$dir"
234 found_dir="$dir" 328 found_so="$dir/$libname$shrext"
235 if test -f "$dir/lib$name.$shlibext"; then
236 found_so="$dir/lib$name.$shlibext"
237 else 329 else
238 found_so="$dir/lib$name.dll.a" 330 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
239 fi 331 ver=`(cd "$dir" && \
240 if test -f "$dir/lib$name.la"; then 332 for f in "$libname$shrext".*; do echo "$f"; done \
241 found_la="$dir/lib$name.la" 333 | sed -e "s,^$libname$shrext\\\\.,," \
334 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
335 | sed 1q ) 2>/dev/null`
336 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
337 found_dir="$dir"
338 found_so="$dir/$libname$shrext.$ver"
339 fi
340 else
341 eval library_names=\"$acl_library_names_spec\"
342 for f in $library_names; do
343 if test -f "$dir/$f"; then
344 found_dir="$dir"
345 found_so="$dir/$f"
346 break
347 fi
348 done
349 fi
242 fi 350 fi
243 else 351 fi
244 if test -f "$dir/lib$name.$libext"; then 352 dnl Then look for a static library.
353 if test "X$found_dir" = "X"; then
354 if test -f "$dir/$libname.$acl_libext"; then
245 found_dir="$dir" 355 found_dir="$dir"
246 found_a="$dir/lib$name.$libext" 356 found_a="$dir/$libname.$acl_libext"
247 if test -f "$dir/lib$name.la"; then 357 fi
248 found_la="$dir/lib$name.la" 358 fi
249 fi 359 if test "X$found_dir" != "X"; then
360 if test -f "$dir/$libname.la"; then
361 found_la="$dir/$libname.la"
250 fi 362 fi
251 fi 363 fi
252 ;; 364 ;;
@@ -263,7 +375,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
263 dnl Linking with a shared library. We attempt to hardcode its 375 dnl Linking with a shared library. We attempt to hardcode its
264 dnl directory into the executable's runpath, unless it's the 376 dnl directory into the executable's runpath, unless it's the
265 dnl standard /usr/lib. 377 dnl standard /usr/lib.
266 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then 378 if test "$enable_rpath" = no \
379 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
380 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
267 dnl No hardcoding is needed. 381 dnl No hardcoding is needed.
268 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 382 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
269 else 383 else
@@ -282,12 +396,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
282 ltrpathdirs="$ltrpathdirs $found_dir" 396 ltrpathdirs="$ltrpathdirs $found_dir"
283 fi 397 fi
284 dnl The hardcoding into $LIBNAME is system dependent. 398 dnl The hardcoding into $LIBNAME is system dependent.
285 if test "$hardcode_direct" = yes; then 399 if test "$acl_hardcode_direct" = yes; then
286 dnl Using DIR/libNAME.so during linking hardcodes DIR into the 400 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
287 dnl resulting binary. 401 dnl resulting binary.
288 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 402 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
289 else 403 else
290 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then 404 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
291 dnl Use an explicit option to hardcode DIR into the resulting 405 dnl Use an explicit option to hardcode DIR into the resulting
292 dnl binary. 406 dnl binary.
293 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 407 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
@@ -318,13 +432,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
318 if test -z "$haveit"; then 432 if test -z "$haveit"; then
319 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" 433 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
320 fi 434 fi
321 if test "$hardcode_minus_L" != no; then 435 if test "$acl_hardcode_minus_L" != no; then
322 dnl FIXME: Not sure whether we should use 436 dnl FIXME: Not sure whether we should use
323 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" 437 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
324 dnl here. 438 dnl here.
325 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 439 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
326 else 440 else
327 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH 441 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
328 dnl here, because this doesn't fit in flags passed to the 442 dnl here, because this doesn't fit in flags passed to the
329 dnl compiler. So give up. No hardcoding. This affects only 443 dnl compiler. So give up. No hardcoding. This affects only
330 dnl very old systems. 444 dnl very old systems.
@@ -351,6 +465,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
351 case "$found_dir" in 465 case "$found_dir" in
352 */$acl_libdirstem | */$acl_libdirstem/) 466 */$acl_libdirstem | */$acl_libdirstem/)
353 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` 467 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
468 if test "$name" = '$1'; then
469 LIB[]NAME[]_PREFIX="$basedir"
470 fi
471 additional_includedir="$basedir/include"
472 ;;
473 */$acl_libdirstem2 | */$acl_libdirstem2/)
474 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
475 if test "$name" = '$1'; then
476 LIB[]NAME[]_PREFIX="$basedir"
477 fi
354 additional_includedir="$basedir/include" 478 additional_includedir="$basedir/include"
355 ;; 479 ;;
356 esac 480 esac
@@ -411,9 +535,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
411 dnl 3. if it's already present in $LDFLAGS or the already 535 dnl 3. if it's already present in $LDFLAGS or the already
412 dnl constructed $LIBNAME, 536 dnl constructed $LIBNAME,
413 dnl 4. if it doesn't exist as a directory. 537 dnl 4. if it doesn't exist as a directory.
414 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then 538 if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
539 && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
415 haveit= 540 haveit=
416 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then 541 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
542 || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
417 if test -n "$GCC"; then 543 if test -n "$GCC"; then
418 case $host_os in 544 case $host_os in
419 linux* | gnu* | k*bsd*-gnu) haveit=yes;; 545 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
@@ -512,18 +638,18 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
512 done 638 done
513 done 639 done
514 if test "X$rpathdirs" != "X"; then 640 if test "X$rpathdirs" != "X"; then
515 if test -n "$hardcode_libdir_separator"; then 641 if test -n "$acl_hardcode_libdir_separator"; then
516 dnl Weird platform: only the last -rpath option counts, the user must 642 dnl Weird platform: only the last -rpath option counts, the user must
517 dnl pass all path elements in one option. We can arrange that for a 643 dnl pass all path elements in one option. We can arrange that for a
518 dnl single library, but not when more than one $LIBNAMEs are used. 644 dnl single library, but not when more than one $LIBNAMEs are used.
519 alldirs= 645 alldirs=
520 for found_dir in $rpathdirs; do 646 for found_dir in $rpathdirs; do
521 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" 647 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
522 done 648 done
523 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. 649 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
524 acl_save_libdir="$libdir" 650 acl_save_libdir="$libdir"
525 libdir="$alldirs" 651 libdir="$alldirs"
526 eval flag=\"$hardcode_libdir_flag_spec\" 652 eval flag=\"$acl_hardcode_libdir_flag_spec\"
527 libdir="$acl_save_libdir" 653 libdir="$acl_save_libdir"
528 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" 654 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
529 else 655 else
@@ -531,7 +657,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
531 for found_dir in $rpathdirs; do 657 for found_dir in $rpathdirs; do
532 acl_save_libdir="$libdir" 658 acl_save_libdir="$libdir"
533 libdir="$found_dir" 659 libdir="$found_dir"
534 eval flag=\"$hardcode_libdir_flag_spec\" 660 eval flag=\"$acl_hardcode_libdir_flag_spec\"
535 libdir="$acl_save_libdir" 661 libdir="$acl_save_libdir"
536 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" 662 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
537 done 663 done
@@ -544,6 +670,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
544 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" 670 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
545 done 671 done
546 fi 672 fi
673 popdef([P_A_C_K])
674 popdef([PACKLIBS])
675 popdef([PACKUP])
676 popdef([PACK])
677 popdef([NAME])
547]) 678])
548 679
549dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, 680dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
@@ -580,7 +711,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
580 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) 711 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
581 $1= 712 $1=
582 if test "$enable_rpath" != no; then 713 if test "$enable_rpath" != no; then
583 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then 714 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
584 dnl Use an explicit option to hardcode directories into the resulting 715 dnl Use an explicit option to hardcode directories into the resulting
585 dnl binary. 716 dnl binary.
586 rpathdirs= 717 rpathdirs=
@@ -589,7 +720,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
589 if test -n "$next"; then 720 if test -n "$next"; then
590 dir="$next" 721 dir="$next"
591 dnl No need to hardcode the standard /usr/lib. 722 dnl No need to hardcode the standard /usr/lib.
592 if test "X$dir" != "X/usr/$acl_libdirstem"; then 723 if test "X$dir" != "X/usr/$acl_libdirstem" \
724 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
593 rpathdirs="$rpathdirs $dir" 725 rpathdirs="$rpathdirs $dir"
594 fi 726 fi
595 next= 727 next=
@@ -598,7 +730,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
598 -L) next=yes ;; 730 -L) next=yes ;;
599 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` 731 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
600 dnl No need to hardcode the standard /usr/lib. 732 dnl No need to hardcode the standard /usr/lib.
601 if test "X$dir" != "X/usr/$acl_libdirstem"; then 733 if test "X$dir" != "X/usr/$acl_libdirstem" \
734 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
602 rpathdirs="$rpathdirs $dir" 735 rpathdirs="$rpathdirs $dir"
603 fi 736 fi
604 next= ;; 737 next= ;;
@@ -614,16 +747,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
614 done 747 done
615 else 748 else
616 dnl The linker is used for linking directly. 749 dnl The linker is used for linking directly.
617 if test -n "$hardcode_libdir_separator"; then 750 if test -n "$acl_hardcode_libdir_separator"; then
618 dnl Weird platform: only the last -rpath option counts, the user 751 dnl Weird platform: only the last -rpath option counts, the user
619 dnl must pass all path elements in one option. 752 dnl must pass all path elements in one option.
620 alldirs= 753 alldirs=
621 for dir in $rpathdirs; do 754 for dir in $rpathdirs; do
622 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir" 755 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
623 done 756 done
624 acl_save_libdir="$libdir" 757 acl_save_libdir="$libdir"
625 libdir="$alldirs" 758 libdir="$alldirs"
626 eval flag=\"$hardcode_libdir_flag_spec\" 759 eval flag=\"$acl_hardcode_libdir_flag_spec\"
627 libdir="$acl_save_libdir" 760 libdir="$acl_save_libdir"
628 $1="$flag" 761 $1="$flag"
629 else 762 else
@@ -631,7 +764,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
631 for dir in $rpathdirs; do 764 for dir in $rpathdirs; do
632 acl_save_libdir="$libdir" 765 acl_save_libdir="$libdir"
633 libdir="$dir" 766 libdir="$dir"
634 eval flag=\"$hardcode_libdir_flag_spec\" 767 eval flag=\"$acl_hardcode_libdir_flag_spec\"
635 libdir="$acl_save_libdir" 768 libdir="$acl_save_libdir"
636 $1="${$1}${$1:+ }$flag" 769 $1="${$1}${$1:+ }$flag"
637 done 770 done
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
index a8684e17e..31f49e40a 100644
--- a/m4/lib-prefix.m4
+++ b/m4/lib-prefix.m4
@@ -1,5 +1,5 @@
1# lib-prefix.m4 serial 5 (gettext-0.15) 1# lib-prefix.m4 serial 7 (gettext-0.18)
2dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2005, 2008-2014 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.
@@ -153,33 +153,72 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
153 prefix="$acl_save_prefix" 153 prefix="$acl_save_prefix"
154]) 154])
155 155
156dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing 156dnl AC_LIB_PREPARE_MULTILIB creates
157dnl the basename of the libdir, either "lib" or "lib64". 157dnl - a variable acl_libdirstem, containing the basename of the libdir, either
158dnl "lib" or "lib64" or "lib/64",
159dnl - a variable acl_libdirstem2, as a secondary possible value for
160dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
161dnl "lib/amd64".
158AC_DEFUN([AC_LIB_PREPARE_MULTILIB], 162AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
159[ 163[
160 dnl There is no formal standard regarding lib and lib64. The current 164 dnl There is no formal standard regarding lib and lib64.
161 dnl practice is that on a system supporting 32-bit and 64-bit instruction 165 dnl On glibc systems, the current practice is that on a system supporting
162 dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit 166 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
163 dnl libraries go under $prefix/lib. We determine the compiler's default 167 dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
164 dnl mode by looking at the compiler's library search path. If at least 168 dnl the compiler's default mode by looking at the compiler's library search
165 dnl of its elements ends in /lib64 or points to a directory whose absolute 169 dnl path. If at least one of its elements ends in /lib64 or points to a
166 dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the 170 dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
167 dnl default, namely "lib". 171 dnl Otherwise we use the default, namely "lib".
172 dnl On Solaris systems, the current practice is that on a system supporting
173 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
174 dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
175 dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
176 AC_REQUIRE([AC_CANONICAL_HOST])
168 acl_libdirstem=lib 177 acl_libdirstem=lib
169 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` 178 acl_libdirstem2=
170 if test -n "$searchpath"; then 179 case "$host_os" in
171 acl_save_IFS="${IFS= }"; IFS=":" 180 solaris*)
172 for searchdir in $searchpath; do 181 dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
173 if test -d "$searchdir"; then 182 dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
174 case "$searchdir" in 183 dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
175 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; 184 dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
176 *) searchdir=`cd "$searchdir" && pwd` 185 dnl symlink is missing, so we set acl_libdirstem2 too.
177 case "$searchdir" in 186 AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
178 */lib64 ) acl_libdirstem=lib64 ;; 187 [AC_EGREP_CPP([sixtyfour bits], [
179 esac ;; 188#ifdef _LP64
189sixtyfour bits
190#endif
191 ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
192 ])
193 if test $gl_cv_solaris_64bit = yes; then
194 acl_libdirstem=lib/64
195 case "$host_cpu" in
196 sparc*) acl_libdirstem2=lib/sparcv9 ;;
197 i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
180 esac 198 esac
181 fi 199 fi
182 done 200 ;;
183 IFS="$acl_save_IFS" 201 *)
184 fi 202 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
203 if test -n "$searchpath"; then
204 acl_save_IFS="${IFS= }"; IFS=":"
205 for searchdir in $searchpath; do
206 if test -d "$searchdir"; then
207 case "$searchdir" in
208 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
209 */../ | */.. )
210 # Better ignore directories of this form. They are misleading.
211 ;;
212 *) searchdir=`cd "$searchdir" && pwd`
213 case "$searchdir" in
214 */lib64 ) acl_libdirstem=lib64 ;;
215 esac ;;
216 esac
217 fi
218 done
219 IFS="$acl_save_IFS"
220 fi
221 ;;
222 esac
223 test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
185]) 224])
diff --git a/m4/lock.m4 b/m4/lock.m4
index 0224f2ff8..73a3c54ce 100644
--- a/m4/lock.m4
+++ b/m4/lock.m4
@@ -1,311 +1,42 @@
1# lock.m4 serial 6 (gettext-0.16) 1# lock.m4 serial 13 (gettext-0.18.2)
2dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2014 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
9dnl Tests for a multithreading library to be used. 9AC_DEFUN([gl_LOCK],
10dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
11dnl USE_PTH_THREADS, USE_WIN32_THREADS
12dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
13dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
14dnl libtool).
15dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
16dnl programs that really need multithread functionality. The difference
17dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
18dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread".
19dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
20dnl multithread-safe programs.
21
22AC_DEFUN([gl_LOCK_EARLY],
23[
24 AC_REQUIRE([gl_LOCK_EARLY_BODY])
25])
26
27dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once.
28
29AC_DEFUN([gl_LOCK_EARLY_BODY],
30[
31 dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
32 dnl influences the result of the autoconf tests that test for *_unlocked
33 dnl declarations, on AIX 5 at least. Therefore it must come early.
34 AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
35 AC_BEFORE([$0], [gl_ARGP])dnl
36
37 AC_REQUIRE([AC_CANONICAL_HOST])
38 AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
39 dnl Check for multithreading.
40 AC_ARG_ENABLE(threads,
41AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
42AC_HELP_STRING([--disable-threads], [build without multithread safety]),
43 [gl_use_threads=$enableval],
44 [case "$host_os" in
45 dnl Disable multithreading by default on OSF/1, because it interferes
46 dnl with fork()/exec(): When msgexec is linked with -lpthread, its child
47 dnl process gets an endless segmentation fault inside execvp().
48 osf*) gl_use_threads=no ;;
49 *) gl_use_threads=yes ;;
50 esac
51 ])
52 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
53 # For using <pthread.h>:
54 case "$host_os" in
55 osf*)
56 # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
57 # groks <pthread.h>. cc also understands the flag -pthread, but
58 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
59 # 2. putting a flag into CPPFLAGS that has an effect on the linker
60 # causes the AC_TRY_LINK test below to succeed unexpectedly,
61 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
62 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
63 ;;
64 esac
65 # Some systems optimize for single-threaded programs by default, and
66 # need special flags to disable these optimizations. For example, the
67 # definition of 'errno' in <errno.h>.
68 case "$host_os" in
69 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
70 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
71 esac
72 fi
73])
74
75dnl The guts of gl_LOCK. Needs to be expanded only once.
76
77AC_DEFUN([gl_LOCK_BODY],
78[ 10[
79 AC_REQUIRE([gl_LOCK_EARLY_BODY]) 11 AC_REQUIRE([gl_THREADLIB])
80 gl_threads_api=none 12 if test "$gl_threads_api" = posix; then
81 LIBTHREAD= 13 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the
82 LTLIBTHREAD= 14 # pthread_rwlock_* functions.
83 LIBMULTITHREAD= 15 AC_CHECK_TYPE([pthread_rwlock_t],
84 LTLIBMULTITHREAD= 16 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
85 if test "$gl_use_threads" != no; then 17 [Define if the POSIX multithreading library has read/write locks.])],
86 dnl Check whether the compiler and linker support weak declarations. 18 [],
87 AC_MSG_CHECKING([whether imported symbols can be declared weak]) 19 [#include <pthread.h>])
88 gl_have_weak=no 20 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
89 AC_TRY_LINK([extern void xyzzy (); 21 AC_COMPILE_IFELSE([
90#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes]) 22 AC_LANG_PROGRAM(
91 AC_MSG_RESULT([$gl_have_weak]) 23 [[#include <pthread.h>]],
92 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then 24 [[
93 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that 25#if __FreeBSD__ == 4
94 # it groks <pthread.h>. It's added above, in gl_LOCK_EARLY_BODY.
95 AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
96 if test "$gl_have_pthread_h" = yes; then
97 # Other possible tests:
98 # -lpthreads (FSU threads, PCthreads)
99 # -lgthreads
100 gl_have_pthread=
101 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
102 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
103 # the second one only in libpthread, and lock.c needs it.
104 AC_TRY_LINK([#include <pthread.h>],
105 [pthread_mutex_lock((pthread_mutex_t*)0);
106 pthread_mutexattr_init((pthread_mutexattr_t*)0);],
107 [gl_have_pthread=yes])
108 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
109 # since it is defined as a macro on OSF/1.)
110 if test -n "$gl_have_pthread"; then
111 # The program links fine without libpthread. But it may actually
112 # need to link with libpthread in order to create multiple threads.
113 AC_CHECK_LIB(pthread, pthread_kill,
114 [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
115 # On Solaris and HP-UX, most pthread functions exist also in libc.
116 # Therefore pthread_in_use() needs to actually try to create a
117 # thread: pthread_create from libc will fail, whereas
118 # pthread_create will actually create a thread.
119 case "$host_os" in
120 solaris* | hpux*)
121 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], 1,
122 [Define if the pthread_in_use() detection is hard.])
123 esac
124 ])
125 else
126 # Some library is needed. Try libpthread and libc_r.
127 AC_CHECK_LIB(pthread, pthread_kill,
128 [gl_have_pthread=yes
129 LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
130 LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread])
131 if test -z "$gl_have_pthread"; then
132 # For FreeBSD 4.
133 AC_CHECK_LIB(c_r, pthread_kill,
134 [gl_have_pthread=yes
135 LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
136 LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r])
137 fi
138 fi
139 if test -n "$gl_have_pthread"; then
140 gl_threads_api=posix
141 AC_DEFINE([USE_POSIX_THREADS], 1,
142 [Define if the POSIX multithreading library can be used.])
143 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
144 if test $gl_have_weak = yes; then
145 AC_DEFINE([USE_POSIX_THREADS_WEAK], 1,
146 [Define if references to the POSIX multithreading library should be made weak.])
147 LIBTHREAD=
148 LTLIBTHREAD=
149 fi
150 fi
151 # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
152 # pthread_rwlock_* functions.
153 AC_CHECK_TYPE([pthread_rwlock_t],
154 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], 1,
155 [Define if the POSIX multithreading library has read/write locks.])],
156 [],
157 [#include <pthread.h>])
158 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
159 AC_TRY_COMPILE([#include <pthread.h>],
160 [#if __FreeBSD__ == 4
161error "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."
162#else 30#else
163int x = (int)PTHREAD_MUTEX_RECURSIVE; 31int x = (int)PTHREAD_MUTEX_RECURSIVE;
164return !x; 32return !x;
165#endif], 33#endif
166 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1, 34 ]])],
167 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) 35 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
168 fi 36 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
169 fi
170 fi
171 if test -z "$gl_have_pthread"; then
172 if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then
173 gl_have_solaristhread=
174 gl_save_LIBS="$LIBS"
175 LIBS="$LIBS -lthread"
176 AC_TRY_LINK([#include <thread.h>
177#include <synch.h>],
178 [thr_self();],
179 [gl_have_solaristhread=yes])
180 LIBS="$gl_save_LIBS"
181 if test -n "$gl_have_solaristhread"; then
182 gl_threads_api=solaris
183 LIBTHREAD=-lthread
184 LTLIBTHREAD=-lthread
185 LIBMULTITHREAD="$LIBTHREAD"
186 LTLIBMULTITHREAD="$LTLIBTHREAD"
187 AC_DEFINE([USE_SOLARIS_THREADS], 1,
188 [Define if the old Solaris multithreading library can be used.])
189 if test $gl_have_weak = yes; then
190 AC_DEFINE([USE_SOLARIS_THREADS_WEAK], 1,
191 [Define if references to the old Solaris multithreading library should be made weak.])
192 LIBTHREAD=
193 LTLIBTHREAD=
194 fi
195 fi
196 fi
197 fi
198 if test "$gl_use_threads" = pth; then
199 gl_save_CPPFLAGS="$CPPFLAGS"
200 AC_LIB_LINKFLAGS(pth)
201 gl_have_pth=
202 gl_save_LIBS="$LIBS"
203 LIBS="$LIBS -lpth"
204 AC_TRY_LINK([#include <pth.h>], [pth_self();], gl_have_pth=yes)
205 LIBS="$gl_save_LIBS"
206 if test -n "$gl_have_pth"; then
207 gl_threads_api=pth
208 LIBTHREAD="$LIBPTH"
209 LTLIBTHREAD="$LTLIBPTH"
210 LIBMULTITHREAD="$LIBTHREAD"
211 LTLIBMULTITHREAD="$LTLIBTHREAD"
212 AC_DEFINE([USE_PTH_THREADS], 1,
213 [Define if the GNU Pth multithreading library can be used.])
214 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
215 if test $gl_have_weak = yes; then
216 AC_DEFINE([USE_PTH_THREADS_WEAK], 1,
217 [Define if references to the GNU Pth multithreading library should be made weak.])
218 LIBTHREAD=
219 LTLIBTHREAD=
220 fi
221 fi
222 else
223 CPPFLAGS="$gl_save_CPPFLAGS"
224 fi
225 fi
226 if test -z "$gl_have_pthread"; then
227 if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then
228 if { case "$host_os" in
229 mingw*) true;;
230 *) false;;
231 esac
232 }; then
233 gl_threads_api=win32
234 AC_DEFINE([USE_WIN32_THREADS], 1,
235 [Define if the Win32 multithreading API can be used.])
236 fi
237 fi
238 fi
239 fi 37 fi
240 AC_MSG_CHECKING([for multithread API to use])
241 AC_MSG_RESULT([$gl_threads_api])
242 AC_SUBST(LIBTHREAD)
243 AC_SUBST(LTLIBTHREAD)
244 AC_SUBST(LIBMULTITHREAD)
245 AC_SUBST(LTLIBMULTITHREAD)
246])
247
248AC_DEFUN([gl_LOCK],
249[
250 AC_REQUIRE([gl_LOCK_EARLY])
251 AC_REQUIRE([gl_LOCK_BODY])
252 gl_PREREQ_LOCK 38 gl_PREREQ_LOCK
253]) 39])
254 40
255# Prerequisites of lib/lock.c. 41# Prerequisites of lib/glthread/lock.c.
256AC_DEFUN([gl_PREREQ_LOCK], [ 42AC_DEFUN([gl_PREREQ_LOCK], [:])
257 AC_REQUIRE([AC_C_INLINE])
258])
259
260dnl Survey of platforms:
261dnl
262dnl Platform Available Compiler Supports test-lock
263dnl flavours option weak result
264dnl --------------- --------- --------- -------- ---------
265dnl Linux 2.4/glibc posix -lpthread Y OK
266dnl
267dnl GNU Hurd/glibc posix
268dnl
269dnl FreeBSD 5.3 posix -lc_r Y
270dnl posix -lkse ? Y
271dnl posix -lpthread ? Y
272dnl posix -lthr Y
273dnl
274dnl FreeBSD 5.2 posix -lc_r Y
275dnl posix -lkse Y
276dnl posix -lthr Y
277dnl
278dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
279dnl
280dnl NetBSD 1.6 --
281dnl
282dnl OpenBSD 3.4 posix -lpthread Y OK
283dnl
284dnl MacOS X 10.[123] posix -lpthread Y OK
285dnl
286dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
287dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
288dnl
289dnl HP-UX 11 posix -lpthread N (cc) OK
290dnl Y (gcc)
291dnl
292dnl IRIX 6.5 posix -lpthread Y 0.5
293dnl
294dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
295dnl
296dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
297dnl -lpthread (gcc) Y
298dnl
299dnl Cygwin posix -lpthread Y OK
300dnl
301dnl Any of the above pth -lpth 0.0
302dnl
303dnl Mingw win32 N OK
304dnl
305dnl BeOS 5 --
306dnl
307dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
308dnl turned off:
309dnl OK if all three tests terminate OK,
310dnl 0.5 if the first test terminates OK but the second one loops endlessly,
311dnl 0.0 if the first test already loops endlessly.
diff --git a/m4/longlong.m4 b/m4/longlong.m4
index 3716c09f6..eefb37c45 100644
--- a/m4/longlong.m4
+++ b/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 8 1# longlong.m4 serial 17
2dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007, 2009-2014 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,42 +7,107 @@ 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.60, but can be removed once we 10# This fixes a bug in Autoconf 2.61, and can be faster
11# assume 2.61 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), AC_TYPE_LONG_LONG_INT will not be 14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
15# defined. In this case you can treat 'long long int' like 'long int'. 15# defined. In this case you can treat 'long long int' like 'long int'.
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_LANG_PROGRAM( 22 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
22 [[long long int ll = 9223372036854775807ll; 23 ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
23 long long int nll = -9223372036854775807LL; 24 if test $ac_cv_type_long_long_int = yes; then
24 typedef int a[((-9223372036854775807LL < 0 25 dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
25 && 0 < 9223372036854775807ll) 26 dnl If cross compiling, assume the bug is not important, since
26 ? 1 : -1)]; 27 dnl nobody cross compiles for this platform as far as we know.
27 int i = 63;]], 28 AC_RUN_IFELSE(
28 [[long long int llmax = 9223372036854775807ll; 29 [AC_LANG_PROGRAM(
29 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) 30 [[@%:@include <limits.h>
30 | (llmax / ll) | (llmax % ll));]])], 31 @%:@ifndef LLONG_MAX
31 [ac_cv_type_long_long_int=yes], 32 @%:@ define HALF \
32 [ac_cv_type_long_long_int=no])]) 33 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
34 @%:@ define LLONG_MAX (HALF - 1 + HALF)
35 @%:@endif]],
36 [[long long int n = 1;
37 int i;
38 for (i = 0; ; i++)
39 {
40 long long int m = n << i;
41 if (m >> i != n)
42 return 1;
43 if (LLONG_MAX / 2 < m)
44 break;
45 }
46 return 0;]])],
47 [],
48 [ac_cv_type_long_long_int=no],
49 [:])
50 fi
51 fi])
33 if test $ac_cv_type_long_long_int = yes; then 52 if test $ac_cv_type_long_long_int = yes; then
34 AC_DEFINE([HAVE_LONG_LONG_INT], 1, 53 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
35 [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'.])
36 fi 55 fi
37]) 56])
38 57
39# This macro is obsolescent and should go away soon. 58# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
40AC_DEFUN([gl_AC_TYPE_LONG_LONG], 59# This fixes a bug in Autoconf 2.61, and can be faster
60# than what's in Autoconf 2.62 through 2.68.
61
62# Note: If the type 'unsigned long long int' exists but is only 32 bits
63# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
64# will not be defined. In this case you can treat 'unsigned long long int'
65# like 'unsigned long int'.
66
67AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
41[ 68[
42 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 69 AC_CACHE_CHECK([for unsigned long long int],
43 ac_cv_type_long_long=$ac_cv_type_long_long_int 70 [ac_cv_type_unsigned_long_long_int],
44 if test $ac_cv_type_long_long = yes; then 71 [ac_cv_type_unsigned_long_long_int=yes
45 AC_DEFINE(HAVE_LONG_LONG, 1, 72 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
46 [Define if you have the 'long long' type.]) 73 AC_LINK_IFELSE(
74 [_AC_TYPE_LONG_LONG_SNIPPET],
75 [],
76 [ac_cv_type_unsigned_long_long_int=no])
77 fi])
78 if test $ac_cv_type_unsigned_long_long_int = yes; then
79 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
80 [Define to 1 if the system has the type 'unsigned long long int'.])
47 fi 81 fi
48]) 82])
83
84# Expands to a C program that can be used to test for simultaneous support
85# of 'long long' and 'unsigned long long'. We don't want to say that
86# 'long long' is available if 'unsigned long long' is not, or vice versa,
87# because too many programs rely on the symmetry between signed and unsigned
88# integer types (excluding 'bool').
89AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
90[
91 AC_LANG_PROGRAM(
92 [[/* For now, do not test the preprocessor; as of 2007 there are too many
93 implementations with broken preprocessors. Perhaps this can
94 be revisited in 2012. In the meantime, code should not expect
95 #if to work with literals wider than 32 bits. */
96 /* Test literals. */
97 long long int ll = 9223372036854775807ll;
98 long long int nll = -9223372036854775807LL;
99 unsigned long long int ull = 18446744073709551615ULL;
100 /* Test constant expressions. */
101 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
102 ? 1 : -1)];
103 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
104 ? 1 : -1)];
105 int i = 63;]],
106 [[/* Test availability of runtime routines for shift and division. */
107 long long int llmax = 9223372036854775807ll;
108 unsigned long long int ullmax = 18446744073709551615ull;
109 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
110 | (llmax / ll) | (llmax % ll)
111 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
112 | (ullmax / ull) | (ullmax % ull));]])
113])
diff --git a/m4/nls.m4 b/m4/nls.m4
index 7967cc2f9..53cdc8be8 100644
--- a/m4/nls.m4
+++ b/m4/nls.m4
@@ -1,5 +1,6 @@
1# nls.m4 serial 3 (gettext-0.15) 1# nls.m4 serial 5 (gettext-0.18)
2dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014 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.
@@ -17,15 +18,15 @@ dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 18dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. 19dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19 20
20AC_PREREQ(2.50) 21AC_PREREQ([2.50])
21 22
22AC_DEFUN([AM_NLS], 23AC_DEFUN([AM_NLS],
23[ 24[
24 AC_MSG_CHECKING([whether NLS is requested]) 25 AC_MSG_CHECKING([whether NLS is requested])
25 dnl Default is enabled NLS 26 dnl Default is enabled NLS
26 AC_ARG_ENABLE(nls, 27 AC_ARG_ENABLE([nls],
27 [ --disable-nls do not use Native Language Support], 28 [ --disable-nls do not use Native Language Support],
28 USE_NLS=$enableval, USE_NLS=yes) 29 USE_NLS=$enableval, USE_NLS=yes)
29 AC_MSG_RESULT($USE_NLS) 30 AC_MSG_RESULT([$USE_NLS])
30 AC_SUBST(USE_NLS) 31 AC_SUBST([USE_NLS])
31]) 32])
diff --git a/m4/printf-posix.m4 b/m4/printf-posix.m4
index af10170af..3be95c130 100644
--- a/m4/printf-posix.m4
+++ b/m4/printf-posix.m4
@@ -1,5 +1,5 @@
1# printf-posix.m4 serial 2 (gettext-0.13.1) 1# printf-posix.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2003 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2014 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,19 +26,22 @@ 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],
31#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ 32 [
33 AC_EGREP_CPP([notposix], [
34#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
32 notposix 35 notposix
33#endif 36#endif
34 ], gt_cv_func_printf_posix="guessing no", 37 ],
35 gt_cv_func_printf_posix="guessing yes") 38 [gt_cv_func_printf_posix="guessing no"],
36 ]) 39 [gt_cv_func_printf_posix="guessing yes"])
40 ])
37 ]) 41 ])
38 case $gt_cv_func_printf_posix in 42 case $gt_cv_func_printf_posix in
39 *yes) 43 *yes)
40 AC_DEFINE(HAVE_POSIX_PRINTF, 1, 44 AC_DEFINE([HAVE_POSIX_PRINTF], [1],
41 [Define if your printf() function supports format strings with positions.]) 45 [Define if your printf() function supports format strings with positions.])
42 ;; 46 ;;
43 esac 47 esac
diff --git a/m4/progtest.m4 b/m4/progtest.m4
index a56365cd3..b499f79cf 100644
--- a/m4/progtest.m4
+++ b/m4/progtest.m4
@@ -1,5 +1,5 @@
1# progtest.m4 serial 4 (gettext-0.14.2) 1# progtest.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2005, 2008-2014 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.
@@ -16,7 +16,7 @@ dnl They are *not* in the public domain.
16dnl Authors: 16dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1996. 17dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
18 18
19AC_PREREQ(2.50) 19AC_PREREQ([2.50])
20 20
21# Search path for a program which passes the given test. 21# Search path for a program which passes the given test.
22 22
@@ -27,15 +27,14 @@ AC_DEFUN([AM_PATH_PROG_WITH_TEST],
27# Prepare PATH_SEPARATOR. 27# Prepare PATH_SEPARATOR.
28# The user is always right. 28# The user is always right.
29if test "${PATH_SEPARATOR+set}" != set; then 29if test "${PATH_SEPARATOR+set}" != set; then
30 echo "#! /bin/sh" >conf$$.sh 30 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
31 echo "exit 0" >>conf$$.sh 31 # contains only /bin. Note that ksh looks also at the FPATH variable,
32 chmod +x conf$$.sh 32 # so we have to set that as well for the test.
33 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 33 PATH_SEPARATOR=:
34 PATH_SEPARATOR=';' 34 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
35 else 35 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
36 PATH_SEPARATOR=: 36 || PATH_SEPARATOR=';'
37 fi 37 }
38 rm -f conf$$.sh
39fi 38fi
40 39
41# Find out how to test for executable files. Don't use a zero-byte file, 40# Find out how to test for executable files. Don't use a zero-byte file,
@@ -55,7 +54,7 @@ rm -f conf$$.file
55# Extract the first word of "$2", so it can be a program name with args. 54# Extract the first word of "$2", so it can be a program name with args.
56set dummy $2; ac_word=[$]2 55set dummy $2; ac_word=[$]2
57AC_MSG_CHECKING([for $ac_word]) 56AC_MSG_CHECKING([for $ac_word])
58AC_CACHE_VAL(ac_cv_path_$1, 57AC_CACHE_VAL([ac_cv_path_$1],
59[case "[$]$1" in 58[case "[$]$1" in
60 [[\\/]]* | ?:[[\\/]]*) 59 [[\\/]]* | ?:[[\\/]]*)
61 ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 60 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
@@ -84,9 +83,9 @@ ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
84esac])dnl 83esac])dnl
85$1="$ac_cv_path_$1" 84$1="$ac_cv_path_$1"
86if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 85if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
87 AC_MSG_RESULT([$]$1) 86 AC_MSG_RESULT([$][$1])
88else 87else
89 AC_MSG_RESULT(no) 88 AC_MSG_RESULT([no])
90fi 89fi
91AC_SUBST($1)dnl 90AC_SUBST([$1])dnl
92]) 91])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
index bfba811eb..7e192d5e9 100644
--- a/m4/size_max.m4
+++ b/m4/size_max.m4
@@ -1,5 +1,5 @@
1# size_max.m4 serial 5 1# size_max.m4 serial 10
2dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2006, 2008-2014 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,10 +8,9 @@ dnl From Bruno Haible.
8 8
9AC_DEFUN([gl_SIZE_MAX], 9AC_DEFUN([gl_SIZE_MAX],
10[ 10[
11 AC_CHECK_HEADERS(stdint.h) 11 AC_CHECK_HEADERS([stdint.h])
12 dnl First test whether the system already has SIZE_MAX. 12 dnl First test whether the system already has SIZE_MAX.
13 AC_MSG_CHECKING([for SIZE_MAX]) 13 AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
14 AC_CACHE_VAL([gl_cv_size_max], [
15 gl_cv_size_max= 14 gl_cv_size_max=
16 AC_EGREP_CPP([Found it], [ 15 AC_EGREP_CPP([Found it], [
17#include <limits.h> 16#include <limits.h>
@@ -21,24 +20,28 @@ AC_DEFUN([gl_SIZE_MAX],
21#ifdef SIZE_MAX 20#ifdef SIZE_MAX
22Found it 21Found it
23#endif 22#endif
24], gl_cv_size_max=yes) 23], [gl_cv_size_max=yes])
25 if test -z "$gl_cv_size_max"; then 24 if test -z "$gl_cv_size_max"; then
26 dnl Define it ourselves. Here we assume that the type 'size_t' is not wider 25 dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
27 dnl than the type 'unsigned long'. Try hard to find a definition that can 26 dnl than the type 'unsigned long'. Try hard to find a definition that can
28 dnl be used in a preprocessor #if, i.e. doesn't contain a cast. 27 dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
29 _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, 28 AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
30 [#include <stddef.h> 29 [#include <stddef.h>
31#include <limits.h>], size_t_bits_minus_1=) 30#include <limits.h>], [size_t_bits_minus_1=])
32 _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, 31 AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
33 [#include <stddef.h>], fits_in_uint=) 32 [#include <stddef.h>], [fits_in_uint=])
34 if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then 33 if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
35 if test $fits_in_uint = 1; then 34 if test $fits_in_uint = 1; then
36 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
37 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'.
38 AC_TRY_COMPILE([#include <stddef.h> 37 AC_COMPILE_IFELSE(
39 extern size_t foo; 38 [AC_LANG_PROGRAM(
40 extern unsigned long foo; 39 [[#include <stddef.h>
41 ], [], fits_in_uint=0) 40 extern size_t foo;
41 extern unsigned long foo;
42 ]],
43 [[]])],
44 [fits_in_uint=0])
42 fi 45 fi
43 dnl We cannot use 'expr' to simplify this expression, because 'expr' 46 dnl We cannot use 'expr' to simplify this expression, because 'expr'
44 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
@@ -54,9 +57,23 @@ Found it
54 fi 57 fi
55 fi 58 fi
56 ]) 59 ])
57 AC_MSG_RESULT([$gl_cv_size_max])
58 if test "$gl_cv_size_max" != yes; then 60 if test "$gl_cv_size_max" != yes; then
59 AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], 61 AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
60 [Define as the maximum value of type 'size_t', if the system doesn't define it.]) 62 [Define as the maximum value of type 'size_t', if the system doesn't define it.])
61 fi 63 fi
64 dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
65 dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
66 dnl #define by AC_DEFINE_UNQUOTED.
67 AH_VERBATIM([SIZE_MAX],
68[/* Define as the maximum value of type 'size_t', if the system doesn't define
69 it. */
70#ifndef SIZE_MAX
71# undef SIZE_MAX
72#endif])
73])
74
75dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
76dnl Remove this when we can assume autoconf >= 2.61.
77m4_ifdef([AC_COMPUTE_INT], [], [
78 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
62]) 79])
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4
index db9a8ac4c..7fc2ce9a8 100644
--- a/m4/stdint_h.m4
+++ b/m4/stdint_h.m4
@@ -1,5 +1,5 @@
1# stdint_h.m4 serial 6 1# stdint_h.m4 serial 9
2dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2014 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,15 +11,16 @@ dnl From Paul Eggert.
11 11
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>,
24 and declares uintmax_t. ]) 25 and declares uintmax_t. ])
25 fi 26 fi
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
new file mode 100644
index 000000000..dc9a3d8e8
--- /dev/null
+++ b/m4/threadlib.m4
@@ -0,0 +1,389 @@
1# threadlib.m4 serial 11 (gettext-0.18.2)
2dnl Copyright (C) 2005-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9dnl gl_THREADLIB
10dnl ------------
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.
17dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
18dnl USE_PTH_THREADS, USE_WINDOWS_THREADS
19dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
20dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
21dnl libtool).
22dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
23dnl programs that really need multithread functionality. The difference
24dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
25dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not.
26dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
27dnl multithread-safe programs.
28
29AC_DEFUN([gl_THREADLIB_EARLY],
30[
31 AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
32])
33
34dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once.
35
36AC_DEFUN([gl_THREADLIB_EARLY_BODY],
37[
38 dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
39 dnl influences the result of the autoconf tests that test for *_unlocked
40 dnl declarations, on AIX 5 at least. Therefore it must come early.
41 AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
42 AC_BEFORE([$0], [gl_ARGP])dnl
43
44 AC_REQUIRE([AC_CANONICAL_HOST])
45 dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems.
46 dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
47 dnl AC_GNU_SOURCE.
48 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
49 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
50 [AC_REQUIRE([AC_GNU_SOURCE])])
51 dnl Check for multithreading.
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=])])
55 AC_ARG_ENABLE([threads],
56AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
57AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
58 [gl_use_threads=$enableval],
59 [if test -n "$gl_use_threads_default"; then
60 gl_use_threads="$gl_use_threads_default"
61 else
62changequote(,)dnl
63 case "$host_os" in
64 dnl Disable multithreading by default on OSF/1, because it interferes
65 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
66 dnl child process gets an endless segmentation fault inside execvp().
67 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
68 dnl bugs that lead to endless loops or crashes. See
69 dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
70 osf*) gl_use_threads=no ;;
71 cygwin*)
72 case `uname -r` in
73 1.[0-5].*) gl_use_threads=no ;;
74 *) gl_use_threads=yes ;;
75 esac
76 ;;
77 *) gl_use_threads=yes ;;
78 esac
79changequote([,])dnl
80 fi
81 ])
82 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
83 # For using <pthread.h>:
84 case "$host_os" in
85 osf*)
86 # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
87 # groks <pthread.h>. cc also understands the flag -pthread, but
88 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
89 # 2. putting a flag into CPPFLAGS that has an effect on the linker
90 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
91 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
92 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
93 ;;
94 esac
95 # Some systems optimize for single-threaded programs by default, and
96 # need special flags to disable these optimizations. For example, the
97 # definition of 'errno' in <errno.h>.
98 case "$host_os" in
99 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
100 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
101 esac
102 fi
103])
104
105dnl The guts of gl_THREADLIB. Needs to be expanded only once.
106
107AC_DEFUN([gl_THREADLIB_BODY],
108[
109 AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
110 gl_threads_api=none
111 LIBTHREAD=
112 LTLIBTHREAD=
113 LIBMULTITHREAD=
114 LTLIBMULTITHREAD=
115 if test "$gl_use_threads" != no; then
116 dnl Check whether the compiler and linker support weak declarations.
117 AC_CACHE_CHECK([whether imported symbols can be declared weak],
118 [gl_cv_have_weak],
119 [gl_cv_have_weak=no
120 dnl First, test whether the compiler accepts it syntactically.
121 AC_LINK_IFELSE(
122 [AC_LANG_PROGRAM(
123 [[extern void xyzzy ();
124#pragma weak xyzzy]],
125 [[xyzzy();]])],
126 [gl_cv_have_weak=maybe])
127 if test $gl_cv_have_weak = maybe; then
128 dnl Second, test whether it actually works. On Cygwin 1.7.2, with
129 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
130 AC_RUN_IFELSE(
131 [AC_LANG_SOURCE([[
132#include <stdio.h>
133#pragma weak fputs
134int main ()
135{
136 return (fputs == NULL);
137}]])],
138 [gl_cv_have_weak=yes],
139 [gl_cv_have_weak=no],
140 [dnl When cross-compiling, assume that only ELF platforms support
141 dnl weak symbols.
142 AC_EGREP_CPP([Extensible Linking Format],
143 [#ifdef __ELF__
144 Extensible Linking Format
145 #endif
146 ],
147 [gl_cv_have_weak="guessing yes"],
148 [gl_cv_have_weak="guessing no"])
149 ])
150 fi
151 ])
152 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
153 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
154 # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY.
155 AC_CHECK_HEADER([pthread.h],
156 [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
157 if test "$gl_have_pthread_h" = yes; then
158 # Other possible tests:
159 # -lpthreads (FSU threads, PCthreads)
160 # -lgthreads
161 gl_have_pthread=
162 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
163 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
164 # the second one only in libpthread, and lock.c needs it.
165 #
166 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
167 # needs -pthread for some reason. See:
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
187 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
188 # since it is defined as a macro on OSF/1.)
189 if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then
190 # The program links fine without libpthread. But it may actually
191 # need to link with libpthread in order to create multiple threads.
192 AC_CHECK_LIB([pthread], [pthread_kill],
193 [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
194 # On Solaris and HP-UX, most pthread functions exist also in libc.
195 # Therefore pthread_in_use() needs to actually try to create a
196 # thread: pthread_create from libc will fail, whereas
197 # pthread_create will actually create a thread.
198 case "$host_os" in
199 solaris* | hpux*)
200 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
201 [Define if the pthread_in_use() detection is hard.])
202 esac
203 ])
204 elif test -z "$gl_have_pthread"; then
205 # Some library is needed. Try libpthread and libc_r.
206 AC_CHECK_LIB([pthread], [pthread_kill],
207 [gl_have_pthread=yes
208 LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
209 LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread])
210 if test -z "$gl_have_pthread"; then
211 # For FreeBSD 4.
212 AC_CHECK_LIB([c_r], [pthread_kill],
213 [gl_have_pthread=yes
214 LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
215 LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r])
216 fi
217 fi
218 if test -n "$gl_have_pthread"; then
219 gl_threads_api=posix
220 AC_DEFINE([USE_POSIX_THREADS], [1],
221 [Define if the POSIX multithreading library can be used.])
222 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
223 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
224 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
225 [Define if references to the POSIX multithreading library should be made weak.])
226 LIBTHREAD=
227 LTLIBTHREAD=
228 fi
229 fi
230 fi
231 fi
232 fi
233 if test -z "$gl_have_pthread"; then
234 if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then
235 gl_have_solaristhread=
236 gl_save_LIBS="$LIBS"
237 LIBS="$LIBS -lthread"
238 AC_LINK_IFELSE(
239 [AC_LANG_PROGRAM(
240 [[
241#include <thread.h>
242#include <synch.h>
243 ]],
244 [[thr_self();]])],
245 [gl_have_solaristhread=yes])
246 LIBS="$gl_save_LIBS"
247 if test -n "$gl_have_solaristhread"; then
248 gl_threads_api=solaris
249 LIBTHREAD=-lthread
250 LTLIBTHREAD=-lthread
251 LIBMULTITHREAD="$LIBTHREAD"
252 LTLIBMULTITHREAD="$LTLIBTHREAD"
253 AC_DEFINE([USE_SOLARIS_THREADS], [1],
254 [Define if the old Solaris multithreading library can be used.])
255 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
256 AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1],
257 [Define if references to the old Solaris multithreading library should be made weak.])
258 LIBTHREAD=
259 LTLIBTHREAD=
260 fi
261 fi
262 fi
263 fi
264 if test "$gl_use_threads" = pth; then
265 gl_save_CPPFLAGS="$CPPFLAGS"
266 AC_LIB_LINKFLAGS([pth])
267 gl_have_pth=
268 gl_save_LIBS="$LIBS"
269 LIBS="$LIBS $LIBPTH"
270 AC_LINK_IFELSE(
271 [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])],
272 [gl_have_pth=yes])
273 LIBS="$gl_save_LIBS"
274 if test -n "$gl_have_pth"; then
275 gl_threads_api=pth
276 LIBTHREAD="$LIBPTH"
277 LTLIBTHREAD="$LTLIBPTH"
278 LIBMULTITHREAD="$LIBTHREAD"
279 LTLIBMULTITHREAD="$LTLIBTHREAD"
280 AC_DEFINE([USE_PTH_THREADS], [1],
281 [Define if the GNU Pth multithreading library can be used.])
282 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
283 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
284 AC_DEFINE([USE_PTH_THREADS_WEAK], [1],
285 [Define if references to the GNU Pth multithreading library should be made weak.])
286 LIBTHREAD=
287 LTLIBTHREAD=
288 fi
289 fi
290 else
291 CPPFLAGS="$gl_save_CPPFLAGS"
292 fi
293 fi
294 if test -z "$gl_have_pthread"; then
295 case "$gl_use_threads" in
296 yes | windows | win32) # The 'win32' is for backward compatibility.
297 if { case "$host_os" in
298 mingw*) true;;
299 *) false;;
300 esac
301 }; then
302 gl_threads_api=windows
303 AC_DEFINE([USE_WINDOWS_THREADS], [1],
304 [Define if the native Windows multithreading API can be used.])
305 fi
306 ;;
307 esac
308 fi
309 fi
310 AC_MSG_CHECKING([for multithread API to use])
311 AC_MSG_RESULT([$gl_threads_api])
312 AC_SUBST([LIBTHREAD])
313 AC_SUBST([LTLIBTHREAD])
314 AC_SUBST([LIBMULTITHREAD])
315 AC_SUBST([LTLIBMULTITHREAD])
316])
317
318AC_DEFUN([gl_THREADLIB],
319[
320 AC_REQUIRE([gl_THREADLIB_EARLY])
321 AC_REQUIRE([gl_THREADLIB_BODY])
322])
323
324
325dnl gl_DISABLE_THREADS
326dnl ------------------
327dnl Sets the gl_THREADLIB default so that threads are not used by default.
328dnl The user can still override it at installation time, by using the
329dnl configure option '--enable-threads'.
330
331AC_DEFUN([gl_DISABLE_THREADS], [
332 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
333])
334
335
336dnl Survey of platforms:
337dnl
338dnl Platform Available Compiler Supports test-lock
339dnl flavours option weak result
340dnl --------------- --------- --------- -------- ---------
341dnl Linux 2.4/glibc posix -lpthread Y OK
342dnl
343dnl GNU Hurd/glibc posix
344dnl
345dnl Ubuntu 14.04 posix -pthread Y OK
346dnl
347dnl FreeBSD 5.3 posix -lc_r Y
348dnl posix -lkse ? Y
349dnl posix -lpthread ? Y
350dnl posix -lthr Y
351dnl
352dnl FreeBSD 5.2 posix -lc_r Y
353dnl posix -lkse Y
354dnl posix -lthr Y
355dnl
356dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
357dnl
358dnl NetBSD 1.6 --
359dnl
360dnl OpenBSD 3.4 posix -lpthread Y OK
361dnl
362dnl Mac OS X 10.[123] posix -lpthread Y OK
363dnl
364dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
365dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
366dnl
367dnl HP-UX 11 posix -lpthread N (cc) OK
368dnl Y (gcc)
369dnl
370dnl IRIX 6.5 posix -lpthread Y 0.5
371dnl
372dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
373dnl
374dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
375dnl -lpthread (gcc) Y
376dnl
377dnl Cygwin posix -lpthread Y OK
378dnl
379dnl Any of the above pth -lpth 0.0
380dnl
381dnl Mingw windows N OK
382dnl
383dnl BeOS 5 --
384dnl
385dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
386dnl turned off:
387dnl OK if all three tests terminate OK,
388dnl 0.5 if the first test terminates OK but the second one loops endlessly,
389dnl 0.0 if the first test already loops endlessly.
diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4
index bf83ed746..0a94f17fb 100644
--- a/m4/uintmax_t.m4
+++ b/m4/uintmax_t.m4
@@ -1,12 +1,12 @@
1# uintmax_t.m4 serial 9 1# uintmax_t.m4 serial 12
2dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2007-2014 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 Paul Eggert. 7dnl From Paul Eggert.
8 8
9AC_PREREQ(2.13) 9AC_PREREQ([2.13])
10 10
11# Define uintmax_t to 'unsigned long' or 'unsigned long long' 11# Define uintmax_t to 'unsigned long' or 'unsigned long long'
12# if it is not already defined in <stdint.h> or <inttypes.h>. 12# if it is not already defined in <stdint.h> or <inttypes.h>.
@@ -16,15 +16,15 @@ AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
16 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 16 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
17 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 17 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
18 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then 18 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
19 AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) 19 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
20 test $ac_cv_type_unsigned_long_long = yes \ 20 test $ac_cv_type_unsigned_long_long_int = yes \
21 && ac_type='unsigned long long' \ 21 && ac_type='unsigned long long' \
22 || ac_type='unsigned long' 22 || ac_type='unsigned long'
23 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, 23 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
24 [Define to unsigned long or unsigned long long 24 [Define to unsigned long or unsigned long long
25 if <stdint.h> and <inttypes.h> don't define.]) 25 if <stdint.h> and <inttypes.h> don't define.])
26 else 26 else
27 AC_DEFINE(HAVE_UINTMAX_T, 1, 27 AC_DEFINE([HAVE_UINTMAX_T], [1],
28 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.]) 28 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
29 fi 29 fi
30]) 30])
diff --git a/m4/visibility.m4 b/m4/visibility.m4
index 2ff6330aa..552e39772 100644
--- a/m4/visibility.m4
+++ b/m4/visibility.m4
@@ -1,5 +1,5 @@
1# visibility.m4 serial 1 (gettext-0.15) 1# visibility.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2005 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008, 2010-2014 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
@@ -26,18 +26,43 @@ AC_DEFUN([gl_VISIBILITY],
26 CFLAG_VISIBILITY= 26 CFLAG_VISIBILITY=
27 HAVE_VISIBILITY=0 27 HAVE_VISIBILITY=0
28 if test -n "$GCC"; then 28 if test -n "$GCC"; then
29 dnl First, check whether -Werror can be added to the command line, or
30 dnl whether it leads to an error because of some other option that the
31 dnl user has put into $CC $CFLAGS $CPPFLAGS.
32 AC_MSG_CHECKING([whether the -Werror option is usable])
33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [
34 gl_save_CFLAGS="$CFLAGS"
35 CFLAGS="$CFLAGS -Werror"
36 AC_COMPILE_IFELSE(
37 [AC_LANG_PROGRAM([[]], [[]])],
38 [gl_cv_cc_vis_werror=yes],
39 [gl_cv_cc_vis_werror=no])
40 CFLAGS="$gl_save_CFLAGS"])
41 AC_MSG_RESULT([$gl_cv_cc_vis_werror])
42 dnl Now check whether visibility declarations are supported.
29 AC_MSG_CHECKING([for simple visibility declarations]) 43 AC_MSG_CHECKING([for simple visibility declarations])
30 AC_CACHE_VAL(gl_cv_cc_visibility, [ 44 AC_CACHE_VAL([gl_cv_cc_visibility], [
31 gl_save_CFLAGS="$CFLAGS" 45 gl_save_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS -fvisibility=hidden" 46 CFLAGS="$CFLAGS -fvisibility=hidden"
33 AC_TRY_COMPILE( 47 dnl We use the option -Werror and a function dummyfunc, because on some
34 [extern __attribute__((__visibility__("hidden"))) int hiddenvar; 48 dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
35 extern __attribute__((__visibility__("default"))) int exportedvar; 49 dnl "visibility attribute not supported in this configuration; ignored"
36 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 50 dnl at the first function definition in every compilation unit, and we
37 extern __attribute__((__visibility__("default"))) int exportedfunc (void);], 51 dnl don't want to use the option in this case.
38 [], 52 if test $gl_cv_cc_vis_werror = yes; then
39 gl_cv_cc_visibility=yes, 53 CFLAGS="$CFLAGS -Werror"
40 gl_cv_cc_visibility=no) 54 fi
55 AC_COMPILE_IFELSE(
56 [AC_LANG_PROGRAM(
57 [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
58 extern __attribute__((__visibility__("default"))) int exportedvar;
59 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
60 extern __attribute__((__visibility__("default"))) int exportedfunc (void);
61 void dummyfunc (void) {}
62 ]],
63 [[]])],
64 [gl_cv_cc_visibility=yes],
65 [gl_cv_cc_visibility=no])
41 CFLAGS="$gl_save_CFLAGS"]) 66 CFLAGS="$gl_save_CFLAGS"])
42 AC_MSG_RESULT([$gl_cv_cc_visibility]) 67 AC_MSG_RESULT([$gl_cv_cc_visibility])
43 if test $gl_cv_cc_visibility = yes; then 68 if test $gl_cv_cc_visibility = yes; then
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
index b8fff9c86..9b07b0709 100644
--- a/m4/wint_t.m4
+++ b/m4/wint_t.m4
@@ -1,5 +1,5 @@
1# wint_t.m4 serial 1 (gettext-0.12) 1# wint_t.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2003 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2014 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,11 +10,23 @@ dnl Prerequisite: AC_PROG_CC
10 10
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([#include <wchar.h> 14 [AC_COMPILE_IFELSE(
15 wint_t foo = (wchar_t)'\0';], , 15 [AC_LANG_PROGRAM(
16 gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) 16 [[
17/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
18 <wchar.h>.
19 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
20 before <wchar.h>. */
21#include <stddef.h>
22#include <stdio.h>
23#include <time.h>
24#include <wchar.h>
25 wint_t foo = (wchar_t)'\0';]],
26 [[]])],
27 [gt_cv_c_wint_t=yes],
28 [gt_cv_c_wint_t=no])])
17 if test $gt_cv_c_wint_t = yes; then 29 if test $gt_cv_c_wint_t = yes; then
18 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.])
19 fi 31 fi
20]) 32])
diff --git a/m4/xsize.m4 b/m4/xsize.m4
index 85bb721e4..3af23ec75 100644
--- a/m4/xsize.m4
+++ b/m4/xsize.m4
@@ -1,5 +1,5 @@
1# xsize.m4 serial 3 1# xsize.m4 serial 5
2dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. 2dnl Copyright (C) 2003-2004, 2008-2014 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]) 11 AC_CHECK_HEADERS([stdint.h])
12 AC_CHECK_HEADERS(stdint.h)
13]) 12])