summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/absolute-header.m444
-rw-r--r--gl/m4/alloca.m450
-rw-r--r--gl/m4/arpa_inet_h.m418
-rw-r--r--gl/m4/c-strtod.m453
-rw-r--r--gl/m4/cloexec.m410
-rw-r--r--gl/m4/codeset.m421
-rw-r--r--gl/m4/dirname.m418
-rw-r--r--gl/m4/dos.m471
-rw-r--r--gl/m4/double-slash-root.m438
-rw-r--r--gl/m4/eoverflow.m470
-rw-r--r--gl/m4/error.m422
-rw-r--r--gl/m4/exitfail.m413
-rw-r--r--gl/m4/extensions.m458
-rw-r--r--gl/m4/fcntl-safer.m411
-rw-r--r--gl/m4/fstypename.m422
-rw-r--r--gl/m4/fsusage.m4265
-rw-r--r--gl/m4/getaddrinfo.m488
-rw-r--r--gl/m4/gethostname.m418
-rw-r--r--gl/m4/getloadavg.m4155
-rw-r--r--gl/m4/getopt.m483
-rw-r--r--gl/m4/gettext.m4419
-rw-r--r--gl/m4/glibc2.m430
-rw-r--r--gl/m4/glibc21.m430
-rw-r--r--gl/m4/gnulib-cache.m430
-rw-r--r--gl/m4/gnulib-common.m422
-rw-r--r--gl/m4/gnulib-comp.m4326
-rw-r--r--gl/m4/gnulib-tool.m433
-rw-r--r--gl/m4/iconv.m4101
-rw-r--r--gl/m4/inet_ntop.m419
-rw-r--r--gl/m4/inline.m440
-rw-r--r--gl/m4/intdiv0.m470
-rw-r--r--gl/m4/intl.m4259
-rw-r--r--gl/m4/intldir.m419
-rw-r--r--gl/m4/intmax.m433
-rw-r--r--gl/m4/intmax_t.m461
-rw-r--r--gl/m4/inttypes-pri.m436
-rw-r--r--gl/m4/inttypes_h.m426
-rw-r--r--gl/m4/lcmessage.m430
-rw-r--r--gl/m4/lib-ld.m4110
-rw-r--r--gl/m4/lib-link.m4709
-rw-r--r--gl/m4/lib-prefix.m4185
-rw-r--r--gl/m4/lock.m4311
-rw-r--r--gl/m4/longdouble.m431
-rw-r--r--gl/m4/longlong.m472
-rw-r--r--gl/m4/ls-mntd-fs.m4337
-rw-r--r--gl/m4/mbchar.m414
-rw-r--r--gl/m4/mbiter.m417
-rw-r--r--gl/m4/mbrtowc.m431
-rw-r--r--gl/m4/memchr.m418
-rw-r--r--gl/m4/minmax.m441
-rw-r--r--gl/m4/mountlist.m423
-rw-r--r--gl/m4/netinet_in_h.m418
-rw-r--r--gl/m4/nls.m431
-rw-r--r--gl/m4/onceonly_2_57.m486
-rw-r--r--gl/m4/po.m4428
-rw-r--r--gl/m4/printf-posix.m444
-rw-r--r--gl/m4/progtest.m492
-rw-r--r--gl/m4/regex.m4198
-rw-r--r--gl/m4/safe-read.m418
-rw-r--r--gl/m4/safe-write.m418
-rw-r--r--gl/m4/size_max.m468
-rw-r--r--gl/m4/snprintf.m415
-rw-r--r--gl/m4/socklen.m452
-rw-r--r--gl/m4/sockpfaf.m458
-rw-r--r--gl/m4/ssize_t.m421
-rw-r--r--gl/m4/stdbool.m4115
-rw-r--r--gl/m4/stdint.m4369
-rw-r--r--gl/m4/stdint_h.m426
-rw-r--r--gl/m4/strcase.m439
-rw-r--r--gl/m4/strdup.m415
-rw-r--r--gl/m4/strndup.m448
-rw-r--r--gl/m4/strnlen.m427
-rw-r--r--gl/m4/sys_socket_h.m423
-rw-r--r--gl/m4/uintmax_t.m430
-rw-r--r--gl/m4/ulonglong.m448
-rw-r--r--gl/m4/unistd-safer.m413
-rw-r--r--gl/m4/unistd_h.m432
-rw-r--r--gl/m4/vasnprintf.m457
-rw-r--r--gl/m4/vasprintf.m433
-rw-r--r--gl/m4/visibility.m452
-rw-r--r--gl/m4/vsnprintf.m415
-rw-r--r--gl/m4/wchar.m429
-rw-r--r--gl/m4/wchar_t.m420
-rw-r--r--gl/m4/wctype.m441
-rw-r--r--gl/m4/wcwidth.m430
-rw-r--r--gl/m4/wint_t.m428
-rw-r--r--gl/m4/xalloc.m424
-rw-r--r--gl/m4/xsize.m413
-rw-r--r--gl/m4/xstrndup.m415
89 files changed, 6900 insertions, 0 deletions
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4
new file mode 100644
index 00000000..c649df08
--- /dev/null
+++ b/gl/m4/absolute-header.m4
@@ -0,0 +1,44 @@
1# absolute-header.m4 serial 6
2dnl Copyright (C) 2006 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 Derek Price.
8
9# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
10# ---------------------------------------
11# Find the absolute name of a header file, assuming the header exists.
12# If the header were sys/inttypes.h, this macro would define
13# ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
14# in config.h
15# (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
16# The three "///" are to pacify Sun C 5.8, which otherwise would say
17# "warning: #include of /usr/include/... may be non-portable".
18# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
19AC_DEFUN([gl_ABSOLUTE_HEADER],
20[AC_LANG_PREPROC_REQUIRE()dnl
21AC_FOREACH([gl_HEADER_NAME], [$1],
22 [AS_VAR_PUSHDEF([gl_absolute_header],
23 [gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
24 AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
25 m4_quote(m4_defn([gl_absolute_header])),
26 [AS_VAR_PUSHDEF([ac_header_exists],
27 [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
28 AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
29 if test AS_VAR_GET(ac_header_exists) = yes; then
30 AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
31dnl eval is necessary to expand ac_cpp.
32dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
33 AS_VAR_SET(gl_absolute_header,
34[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
35sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
36 fi
37 AS_VAR_POPDEF([ac_header_exists])dnl
38 ])dnl
39 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
40 ["AS_VAR_GET(gl_absolute_header)"],
41 [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
42 AS_VAR_POPDEF([gl_absolute_header])dnl
43])dnl
44])# gl_ABSOLUTE_HEADER
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
new file mode 100644
index 00000000..eb62e0e7
--- /dev/null
+++ b/gl/m4/alloca.m4
@@ -0,0 +1,50 @@
1# alloca.m4 serial 7
2dnl Copyright (C) 2002-2004, 2006 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
7AC_DEFUN([gl_FUNC_ALLOCA],
8[
9 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
10 AC_REQUIRE([AC_PROG_CPP])
11 AC_REQUIRE([AC_PROG_EGREP])
12
13 AC_REQUIRE([AC_FUNC_ALLOCA])
14 if test $ac_cv_func_alloca_works = no; then
15 gl_PREREQ_ALLOCA
16 fi
17
18 # Define an additional variable used in the Makefile substitution.
19 if test $ac_cv_working_alloca_h = yes; then
20 AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
21 AC_EGREP_CPP([Need own alloca], [
22#if defined __GNUC__ || defined _AIX || defined _MSC_VER
23 Need own alloca
24#endif
25 ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
26 ])
27 if test $gl_cv_rpl_alloca = yes; then
28 dnl OK, alloca can be implemented through a compiler built-in.
29 AC_DEFINE([HAVE_ALLOCA], 1,
30 [Define to 1 if you have 'alloca' after including <alloca.h>,
31 a header that may be supplied by this distribution.])
32 ALLOCA_H=alloca.h
33 else
34 dnl alloca exists as a library function, i.e. it is slow and probably
35 dnl a memory leak. Don't define HAVE_ALLOCA in this case.
36 ALLOCA_H=
37 fi
38 else
39 ALLOCA_H=alloca.h
40 fi
41 AC_SUBST([ALLOCA_H])
42
43 AC_DEFINE(HAVE_ALLOCA_H, 1,
44 [Define HAVE_ALLOCA_H for backward compatibility with older code
45 that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
46])
47
48# Prerequisites of lib/alloca.c.
49# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
50AC_DEFUN([gl_PREREQ_ALLOCA], [:])
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
new file mode 100644
index 00000000..d01d0984
--- /dev/null
+++ b/gl/m4/arpa_inet_h.m4
@@ -0,0 +1,18 @@
1# arpa_inet_h.m4 serial 1
2dnl Copyright (C) 2006 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 Simon Josefsson
8
9AC_DEFUN([gl_HEADER_ARPA_INET],
10[
11 AC_CHECK_HEADERS_ONCE([arpa/inet.h])
12 if test $ac_cv_header_arpa_inet_h = yes; then
13 ARPA_INET_H=''
14 else
15 ARPA_INET_H='arpa/inet.h'
16 fi
17 AC_SUBST(ARPA_INET_H)
18])
diff --git a/gl/m4/c-strtod.m4 b/gl/m4/c-strtod.m4
new file mode 100644
index 00000000..7f206c71
--- /dev/null
+++ b/gl/m4/c-strtod.m4
@@ -0,0 +1,53 @@
1# c-strtod.m4 serial 9
2
3# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# Written by Paul Eggert.
9
10AC_DEFUN([gl_C99_STRTOLD],
11[
12 AC_CACHE_CHECK([whether strtold conforms to C99],
13 [gl_cv_func_c99_strtold],
14 [AC_LINK_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[/* On HP-UX before 11.23, strtold returns a struct instead of
17 long double. Reject implementations like that, by requiring
18 compatibility with the C99 prototype. */
19 #include <stdlib.h>
20 static long double (*p) (char const *, char **) = strtold;
21 static long double
22 test (char const *nptr, char **endptr)
23 {
24 long double r;
25 r = strtold (nptr, endptr);
26 return r;
27 }]],
28 [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
29 [gl_cv_func_c99_strtold=yes],
30 [gl_cv_func_c99_strtold=no])])
31 if test $gl_cv_func_c99_strtold = yes; then
32 AC_DEFINE([HAVE_C99_STRTOLD], 1, [Define to 1 if strtold conforms to C99.])
33 fi
34])
35
36AC_DEFUN([gl_C_STRTOD],
37[
38 AC_LIBOBJ([c-strtod])
39
40 dnl Prerequisites of lib/c-strtod.c.
41 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
42 :
43])
44
45AC_DEFUN([gl_C_STRTOLD],
46[
47 AC_LIBOBJ([c-strtold])
48
49 dnl Prerequisites of lib/c-strtold.c.
50 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
51 AC_REQUIRE([gl_C99_STRTOLD])
52 :
53])
diff --git a/gl/m4/cloexec.m4 b/gl/m4/cloexec.m4
new file mode 100644
index 00000000..4c4e26a1
--- /dev/null
+++ b/gl/m4/cloexec.m4
@@ -0,0 +1,10 @@
1#serial 6
2dnl Copyright (C) 2004, 2005, 2006 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
7AC_DEFUN([gl_CLOEXEC],
8[
9 AC_LIBOBJ([cloexec])
10])
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4
new file mode 100644
index 00000000..223955b4
--- /dev/null
+++ b/gl/m4/codeset.m4
@@ -0,0 +1,21 @@
1# codeset.m4 serial 2 (gettext-0.16)
2dnl Copyright (C) 2000-2002, 2006 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
9AC_DEFUN([AM_LANGINFO_CODESET],
10[
11 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
12 [AC_TRY_LINK([#include <langinfo.h>],
13 [char* cs = nl_langinfo(CODESET); return !cs;],
14 am_cv_langinfo_codeset=yes,
15 am_cv_langinfo_codeset=no)
16 ])
17 if test $am_cv_langinfo_codeset = yes; then
18 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
19 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
20 fi
21])
diff --git a/gl/m4/dirname.m4 b/gl/m4/dirname.m4
new file mode 100644
index 00000000..e35da965
--- /dev/null
+++ b/gl/m4/dirname.m4
@@ -0,0 +1,18 @@
1#serial 7 -*- autoconf -*-
2dnl Copyright (C) 2002-2006 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
7AC_DEFUN([gl_DIRNAME],
8[
9 AC_LIBOBJ([basename])
10 AC_LIBOBJ([dirname])
11 AC_LIBOBJ([stripslash])
12
13 dnl Prerequisites of lib/dirname.h.
14 AC_REQUIRE([gl_AC_DOS])
15 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
16
17 dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c.
18])
diff --git a/gl/m4/dos.m4 b/gl/m4/dos.m4
new file mode 100644
index 00000000..dd59571c
--- /dev/null
+++ b/gl/m4/dos.m4
@@ -0,0 +1,71 @@
1#serial 10 -*- autoconf -*-
2
3# Define some macros required for proper operation of code in lib/*.c
4# on MSDOS/Windows systems.
5
6# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# From Jim Meyering.
12
13AC_DEFUN([gl_AC_DOS],
14 [
15 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
16 [
17 AC_TRY_COMPILE([],
18 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
19neither MSDOS nor Windows
20#endif],
21 [ac_cv_win_or_dos=yes],
22 [ac_cv_win_or_dos=no])
23 ])
24
25 if test x"$ac_cv_win_or_dos" = xyes; then
26 ac_fs_accepts_drive_letter_prefix=1
27 ac_fs_backslash_is_file_name_separator=1
28 AC_CACHE_CHECK([whether drive letter can start relative path],
29 [ac_cv_drive_letter_can_be_relative],
30 [
31 AC_TRY_COMPILE([],
32 [#if defined __CYGWIN__
33drive letters are always absolute
34#endif],
35 [ac_cv_drive_letter_can_be_relative=yes],
36 [ac_cv_drive_letter_can_be_relative=no])
37 ])
38 if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
39 ac_fs_drive_letter_can_be_relative=1
40 else
41 ac_fs_drive_letter_can_be_relative=0
42 fi
43 else
44 ac_fs_accepts_drive_letter_prefix=0
45 ac_fs_backslash_is_file_name_separator=0
46 ac_fs_drive_letter_can_be_relative=0
47 fi
48
49 AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
50 $ac_fs_accepts_drive_letter_prefix,
51 [Define on systems for which file names may have a so-called
52 `drive letter' prefix, define this to compute the length of that
53 prefix, including the colon.])
54
55 AH_VERBATIM(ISSLASH,
56 [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
57# define ISSLASH(C) ((C) == '/' || (C) == '\\')
58#else
59# define ISSLASH(C) ((C) == '/')
60#endif])
61
62 AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
63 $ac_fs_backslash_is_file_name_separator,
64 [Define if the backslash character may also serve as a file name
65 component separator.])
66
67 AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
68 $ac_fs_drive_letter_can_be_relative,
69 [Define if a drive letter prefix denotes a relative path if it is
70 not followed by a file name component separator.])
71 ])
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4
new file mode 100644
index 00000000..69d60d01
--- /dev/null
+++ b/gl/m4/double-slash-root.m4
@@ -0,0 +1,38 @@
1# double-slash-root.m4 serial 2 -*- Autoconf -*-
2dnl Copyright (C) 2006 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
7AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
8[
9 AC_REQUIRE([AC_CANONICAL_HOST])
10 AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
11 [ if test x"$cross_compiling" = xyes ; then
12 # When cross-compiling, there is no way to tell whether // is special
13 # short of a list of hosts. However, the only known hosts to date
14 # that have a distinct // are Apollo DomainOS (too old to port to),
15 # Cygwin, and z/OS. If anyone knows of another system for which // has
16 # special semantics and is distinct from /, please report it to
17 # <bug-gnulib@gnu.org>.
18 case $host in
19 *-cygwin | i370-ibm-openedition)
20 gl_cv_double_slash_root=yes ;;
21 *)
22 # Be optimistic and assume that / and // are the same when we
23 # don't know.
24 gl_cv_double_slash_root='unknown, assuming no' ;;
25 esac
26 else
27 set x `ls -di / //`
28 if test $[2] = $[4] && wc //dev/null >/dev/null 2>&1; then
29 gl_cv_double_slash_root=no
30 else
31 gl_cv_double_slash_root=yes
32 fi
33 fi])
34 if test "$gl_cv_double_slash_root" = yes; then
35 AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], 1,
36 [Define to 1 if // is a file system root distinct from /.])
37 fi
38])
diff --git a/gl/m4/eoverflow.m4 b/gl/m4/eoverflow.m4
new file mode 100644
index 00000000..3bffd10e
--- /dev/null
+++ b/gl/m4/eoverflow.m4
@@ -0,0 +1,70 @@
1# eoverflow.m4 serial 2
2dnl Copyright (C) 2004, 2006 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
9# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
10# POSIX. But some systems (like AIX 3) don't define it, and some systems
11# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
12
13# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
14# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
15# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
16# value.
17
18AC_DEFUN([gl_EOVERFLOW],
19[
20 AC_REQUIRE([AC_PROG_CC])dnl
21
22 AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
23 AC_EGREP_CPP(yes,[
24#include <errno.h>
25#ifdef EOVERFLOW
26yes
27#endif
28 ], have_eoverflow=1)
29 if test -n "$have_eoverflow"; then
30 dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
31 ac_cv_decl_EOVERFLOW=yes
32 else
33 AC_EGREP_CPP(yes,[
34#define _XOPEN_SOURCE_EXTENDED 1
35#include <errno.h>
36#ifdef EOVERFLOW
37yes
38#endif
39 ], have_eoverflow=1)
40 if test -n "$have_eoverflow"; then
41 dnl EOVERFLOW exists but is hidden.
42 dnl Define it to the same value.
43 AC_COMPUTE_INT([ac_cv_decl_EOVERFLOW], [EOVERFLOW], [
44#define _XOPEN_SOURCE_EXTENDED 1
45#include <errno.h>
46/* The following two lines are a workaround against an autoconf-2.52 bug. */
47#include <stdio.h>
48#include <stdlib.h>
49])
50 else
51 dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
52 dnl don't define it as EINVAL, because snprintf() callers want to
53 dnl distinguish EINVAL and EOVERFLOW.
54 ac_cv_decl_EOVERFLOW=E2BIG
55 fi
56 fi
57 ])
58 if test "$ac_cv_decl_EOVERFLOW" != yes; then
59 AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
60 [Define as good substitute value for EOVERFLOW.])
61 EOVERFLOW="$ac_cv_decl_EOVERFLOW"
62 AC_SUBST(EOVERFLOW)
63 fi
64])
65
66dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
67dnl Remove this when we can assume autoconf >= 2.61.
68m4_ifdef([AC_COMPUTE_INT], [], [
69 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
70])
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
new file mode 100644
index 00000000..7c7746e2
--- /dev/null
+++ b/gl/m4/error.m4
@@ -0,0 +1,22 @@
1#serial 11
2
3# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software
4# Foundation, Inc.
5#
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10AC_DEFUN([gl_ERROR],
11[
12 AC_FUNC_ERROR_AT_LINE
13 dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
14 gl_PREREQ_ERROR
15])
16
17# Prerequisites of lib/error.c.
18AC_DEFUN([gl_PREREQ_ERROR],
19[
20 AC_REQUIRE([AC_FUNC_STRERROR_R])
21 :
22])
diff --git a/gl/m4/exitfail.m4 b/gl/m4/exitfail.m4
new file mode 100644
index 00000000..b7a691e5
--- /dev/null
+++ b/gl/m4/exitfail.m4
@@ -0,0 +1,13 @@
1# exitfail.m4 serial 6
2dnl Copyright (C) 2002, 2003, 2005, 2006 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
7AC_DEFUN([gl_EXITFAIL],
8[
9 AC_LIBOBJ([exitfail])
10
11 dnl No prerequisites of lib/exitfail.c.
12 :
13])
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
new file mode 100644
index 00000000..143a9e54
--- /dev/null
+++ b/gl/m4/extensions.m4
@@ -0,0 +1,58 @@
1# serial 4 -*- Autoconf -*-
2# Enable extensions on systems that normally disable them.
3
4# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
10# Autoconf. Perhaps we can remove this once we can assume Autoconf
11# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
12# enough in this area it's likely we'll need to redefine
13# AC_USE_SYSTEM_EXTENSIONS for quite some time.
14
15# AC_USE_SYSTEM_EXTENSIONS
16# ------------------------
17# Enable extensions on systems that normally disable them,
18# typically due to standards-conformance issues.
19AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
20[
21 AC_BEFORE([$0], [AC_COMPILE_IFELSE])
22 AC_BEFORE([$0], [AC_RUN_IFELSE])
23
24 AC_REQUIRE([AC_GNU_SOURCE])
25 AC_REQUIRE([AC_AIX])
26 AC_REQUIRE([AC_MINIX])
27
28 AH_VERBATIM([__EXTENSIONS__],
29[/* Enable extensions on Solaris. */
30#ifndef __EXTENSIONS__
31# undef __EXTENSIONS__
32#endif
33#ifndef _POSIX_PTHREAD_SEMANTICS
34# undef _POSIX_PTHREAD_SEMANTICS
35#endif
36#ifndef _TANDEM_SOURCE
37# undef _TANDEM_SOURCE
38#endif])
39 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
40 [ac_cv_safe_to_define___extensions__],
41 [AC_COMPILE_IFELSE(
42 [AC_LANG_PROGRAM([
43# define __EXTENSIONS__ 1
44 AC_INCLUDES_DEFAULT])],
45 [ac_cv_safe_to_define___extensions__=yes],
46 [ac_cv_safe_to_define___extensions__=no])])
47 test $ac_cv_safe_to_define___extensions__ = yes &&
48 AC_DEFINE([__EXTENSIONS__])
49 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
50 AC_DEFINE([_TANDEM_SOURCE])
51])
52
53# gl_USE_SYSTEM_EXTENSIONS
54# ------------------------
55# Enable extensions on systems that normally disable them,
56# typically due to standards-conformance issues.
57AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
58 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
diff --git a/gl/m4/fcntl-safer.m4 b/gl/m4/fcntl-safer.m4
new file mode 100644
index 00000000..3475b0a7
--- /dev/null
+++ b/gl/m4/fcntl-safer.m4
@@ -0,0 +1,11 @@
1#serial 5
2dnl Copyright (C) 2005-2007 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
7AC_DEFUN([gl_FCNTL_SAFER],
8[
9 AC_LIBOBJ([open-safer])
10 AC_LIBOBJ([creat-safer])
11])
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4
new file mode 100644
index 00000000..aa676f3a
--- /dev/null
+++ b/gl/m4/fstypename.m4
@@ -0,0 +1,22 @@
1#serial 6
2
3dnl From Jim Meyering.
4dnl
5dnl See if struct statfs has the f_fstypename member.
6dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
7dnl
8
9# Copyright (C) 1998, 1999, 2001, 2004, 2006 Free Software Foundation, Inc.
10# This file is free software; the Free Software Foundation
11# gives unlimited permission to copy and/or distribute it,
12# with or without modifications, as long as this notice is preserved.
13
14AC_DEFUN([gl_FSTYPENAME],
15[
16 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,
17 [
18 #include <sys/types.h>
19 #include <sys/param.h>
20 #include <sys/mount.h>
21 ])
22])
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4
new file mode 100644
index 00000000..08bf06c9
--- /dev/null
+++ b/gl/m4/fsusage.m4
@@ -0,0 +1,265 @@
1#serial 22
2# Obtaining file system usage information.
3
4# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
5# Foundation, Inc.
6#
7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# Written by Jim Meyering.
12
13AC_DEFUN([gl_FSUSAGE],
14[
15 AC_CHECK_HEADERS_ONCE(sys/param.h)
16 AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h)
17 AC_CHECK_HEADERS(sys/mount.h, [], [],
18 [AC_INCLUDES_DEFAULT
19 [#if HAVE_SYS_PARAM_H
20 #include <sys/param.h>
21 #endif]])
22 gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
23 if test $gl_cv_fs_space = yes; then
24 AC_LIBOBJ(fsusage)
25 gl_PREREQ_FSUSAGE_EXTRA
26 fi
27])
28
29# Try to determine how a program can obtain file system usage information.
30# If successful, define the appropriate symbol (see fsusage.c) and
31# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
32#
33# gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
34
35AC_DEFUN([gl_FILE_SYSTEM_USAGE],
36[
37
38AC_MSG_NOTICE([checking how to get file system space usage])
39ac_fsusage_space=no
40
41# Perform only the link test since it seems there are no variants of the
42# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
43# because that got a false positive on SCO OSR5. Adding the declaration
44# of a `struct statvfs' causes this test to fail (as it should) on such
45# systems. That system is reported to work fine with STAT_STATFS4 which
46# is what it gets when this test fails.
47if test $ac_fsusage_space = no; then
48 # SVR4
49 AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
50 [AC_TRY_LINK([#include <sys/types.h>
51#if defined __GLIBC__ && !defined __BEOS__
52Do not use statvfs on systems with GNU libc, because that function stats
53all preceding entries in /proc/mounts, and that makes df hang if even
54one of the corresponding file systems is hard-mounted, but not available.
55statvfs in GNU libc on BeOS operates differently: it only makes a system
56call.
57#endif
58#include <sys/statvfs.h>],
59 [struct statvfs fsd; statvfs (0, &fsd);],
60 fu_cv_sys_stat_statvfs=yes,
61 fu_cv_sys_stat_statvfs=no)])
62 if test $fu_cv_sys_stat_statvfs = yes; then
63 ac_fsusage_space=yes
64 AC_DEFINE(STAT_STATVFS, 1,
65 [ Define if there is a function named statvfs. (SVR4)])
66 fi
67fi
68
69if test $ac_fsusage_space = no; then
70 # DEC Alpha running OSF/1
71 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
72 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
73 [AC_TRY_RUN([
74#include <sys/param.h>
75#include <sys/types.h>
76#include <sys/mount.h>
77 int
78 main ()
79 {
80 struct statfs fsd;
81 fsd.f_fsize = 0;
82 return statfs (".", &fsd, sizeof (struct statfs)) != 0;
83 }],
84 fu_cv_sys_stat_statfs3_osf1=yes,
85 fu_cv_sys_stat_statfs3_osf1=no,
86 fu_cv_sys_stat_statfs3_osf1=no)])
87 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
88 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
89 ac_fsusage_space=yes
90 AC_DEFINE(STAT_STATFS3_OSF1, 1,
91 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
92 fi
93fi
94
95if test $ac_fsusage_space = no; then
96# AIX
97 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
98member (AIX, 4.3BSD)])
99 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
100 [AC_TRY_RUN([
101#ifdef HAVE_SYS_PARAM_H
102#include <sys/param.h>
103#endif
104#ifdef HAVE_SYS_MOUNT_H
105#include <sys/mount.h>
106#endif
107#ifdef HAVE_SYS_VFS_H
108#include <sys/vfs.h>
109#endif
110 int
111 main ()
112 {
113 struct statfs fsd;
114 fsd.f_bsize = 0;
115 return statfs (".", &fsd) != 0;
116 }],
117 fu_cv_sys_stat_statfs2_bsize=yes,
118 fu_cv_sys_stat_statfs2_bsize=no,
119 fu_cv_sys_stat_statfs2_bsize=no)])
120 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
121 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
122 ac_fsusage_space=yes
123 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
124[ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
125 (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
126 fi
127fi
128
129if test $ac_fsusage_space = no; then
130# SVR3
131 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
132 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
133 [AC_TRY_RUN([#include <sys/types.h>
134#include <sys/statfs.h>
135 int
136 main ()
137 {
138 struct statfs fsd;
139 return statfs (".", &fsd, sizeof fsd, 0) != 0;
140 }],
141 fu_cv_sys_stat_statfs4=yes,
142 fu_cv_sys_stat_statfs4=no,
143 fu_cv_sys_stat_statfs4=no)])
144 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
145 if test $fu_cv_sys_stat_statfs4 = yes; then
146 ac_fsusage_space=yes
147 AC_DEFINE(STAT_STATFS4, 1,
148 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
149 fi
150fi
151
152if test $ac_fsusage_space = no; then
153# 4.4BSD and NetBSD
154 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
155member (4.4BSD and NetBSD)])
156 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
157 [AC_TRY_RUN([#include <sys/types.h>
158#ifdef HAVE_SYS_PARAM_H
159#include <sys/param.h>
160#endif
161#ifdef HAVE_SYS_MOUNT_H
162#include <sys/mount.h>
163#endif
164 int
165 main ()
166 {
167 struct statfs fsd;
168 fsd.f_fsize = 0;
169 return statfs (".", &fsd) != 0;
170 }],
171 fu_cv_sys_stat_statfs2_fsize=yes,
172 fu_cv_sys_stat_statfs2_fsize=no,
173 fu_cv_sys_stat_statfs2_fsize=no)])
174 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
175 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
176 ac_fsusage_space=yes
177 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
178[ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
179 (4.4BSD, NetBSD)])
180 fi
181fi
182
183if test $ac_fsusage_space = no; then
184 # Ultrix
185 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
186 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
187 [AC_TRY_RUN([#include <sys/types.h>
188#ifdef HAVE_SYS_PARAM_H
189#include <sys/param.h>
190#endif
191#ifdef HAVE_SYS_MOUNT_H
192#include <sys/mount.h>
193#endif
194#ifdef HAVE_SYS_FS_TYPES_H
195#include <sys/fs_types.h>
196#endif
197 int
198 main ()
199 {
200 struct fs_data fsd;
201 /* Ultrix's statfs returns 1 for success,
202 0 for not mounted, -1 for failure. */
203 return statfs (".", &fsd) != 1;
204 }],
205 fu_cv_sys_stat_fs_data=yes,
206 fu_cv_sys_stat_fs_data=no,
207 fu_cv_sys_stat_fs_data=no)])
208 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
209 if test $fu_cv_sys_stat_fs_data = yes; then
210 ac_fsusage_space=yes
211 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
212[ Define if statfs takes 2 args and the second argument has
213 type struct fs_data. (Ultrix)])
214 fi
215fi
216
217if test $ac_fsusage_space = no; then
218 # SVR2
219 AC_TRY_CPP([#include <sys/filsys.h>
220 ],
221 AC_DEFINE(STAT_READ_FILSYS, 1,
222 [Define if there is no specific function for reading file systems usage
223 information and you have the <sys/filsys.h> header file. (SVR2)])
224 ac_fsusage_space=yes)
225fi
226
227AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
228
229])
230
231
232# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
233# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
234# enable the work-around code in fsusage.c.
235AC_DEFUN([gl_STATFS_TRUNCATES],
236[
237 AC_MSG_CHECKING([for statfs that truncates block counts])
238 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
239 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
240#if !defined(sun) && !defined(__sun)
241choke -- this is a workaround for a Sun-specific problem
242#endif
243#include <sys/types.h>
244#include <sys/vfs.h>]],
245 [[struct statfs t; long c = *(t.f_spare);
246 if (c) return 0;]])],
247 [fu_cv_sys_truncating_statfs=yes],
248 [fu_cv_sys_truncating_statfs=no])])
249 if test $fu_cv_sys_truncating_statfs = yes; then
250 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
251 [Define if the block counts reported by statfs may be truncated to 2GB
252 and the correct values may be stored in the f_spare array.
253 (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
254 SunOS 4.1.1 seems not to be affected.)])
255 fi
256 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
257])
258
259
260# Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
261AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
262[
263 AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h)
264 gl_STATFS_TRUNCATES
265])
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
new file mode 100644
index 00000000..db285d94
--- /dev/null
+++ b/gl/m4/getaddrinfo.m4
@@ -0,0 +1,88 @@
1# getaddrinfo.m4 serial 11
2dnl Copyright (C) 2004, 2005, 2006 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
7AC_DEFUN([gl_GETADDRINFO],
8[
9 AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
10
11 AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
12 AC_CHECK_FUNCS(getaddrinfo,, [
13 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
14 gl_cv_w32_getaddrinfo, [
15 gl_cv_w32_getaddrinfo=no
16 am_save_LIBS="$LIBS"
17 LIBS="$LIBS -lws2_32"
18 AC_TRY_LINK([
19#ifdef HAVE_WS2TCPIP_H
20#include <ws2tcpip.h>
21#endif
22], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
23 LIBS="$am_save_LIBS"])
24 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
25 LIBS="$LIBS -lws2_32"
26 else
27 AC_LIBOBJ(getaddrinfo)
28 fi
29 ])
30
31 AC_REPLACE_FUNCS(gai_strerror)
32 gl_PREREQ_GETADDRINFO
33])
34
35# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
36AC_DEFUN([gl_PREREQ_GETADDRINFO], [
37 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
38 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
39 AC_CHECK_FUNCS(gethostbyname,, [
40 AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32,
41 gl_cv_w32_gethostbyname, [
42 gl_cv_w32_gethostbyname=no
43 am_save_LIBS="$LIBS"
44 LIBS="$LIBS -lws2_32"
45 AC_TRY_LINK([
46#ifdef HAVE_WINSOCK2_H
47#include <winsock2.h>
48#endif
49], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes)
50 LIBS="$am_save_LIBS"])
51 if test "$gl_cv_w32_gethostbyname" = "yes"; then
52 LIBS="$LIBS -lws2_32"
53 fi
54 ])
55 AC_REQUIRE([AC_C_RESTRICT])
56 AC_REQUIRE([gl_SOCKET_FAMILIES])
57 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
58 AC_REQUIRE([AC_C_INLINE])
59 AC_REQUIRE([AC_GNU_SOURCE])
60 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
61 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
62 /* sys/types.h is not needed according to POSIX, but the
63 sys/socket.h in i386-unknown-freebsd4.10 and
64 powerpc-apple-darwin5.5 required it. */
65#include <sys/types.h>
66#ifdef HAVE_SYS_SOCKET_H
67#include <sys/socket.h>
68#endif
69#ifdef HAVE_NETDB_H
70#include <netdb.h>
71#endif
72#ifdef HAVE_WS2TCPIP_H
73#include <ws2tcpip.h>
74#endif
75])
76 AC_CHECK_TYPES([struct addrinfo],,,[
77#include <sys/types.h>
78#ifdef HAVE_SYS_SOCKET_H
79#include <sys/socket.h>
80#endif
81#ifdef HAVE_NETDB_H
82#include <netdb.h>
83#endif
84#ifdef HAVE_WS2TCPIP_H
85#include <ws2tcpip.h>
86#endif
87])
88])
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4
new file mode 100644
index 00000000..1e9749d3
--- /dev/null
+++ b/gl/m4/gethostname.m4
@@ -0,0 +1,18 @@
1# gethostname.m4 serial 2
2dnl Copyright (C) 2002 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
7AC_DEFUN([gl_FUNC_GETHOSTNAME],
8[
9 AC_REPLACE_FUNCS(gethostname)
10 if test $ac_cv_func_gethostname = no; then
11 gl_PREREQ_GETHOSTNAME
12 fi
13])
14
15# Prerequisites of lib/gethostname.c.
16AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
17 AC_CHECK_FUNCS(uname)
18])
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
new file mode 100644
index 00000000..82437291
--- /dev/null
+++ b/gl/m4/getloadavg.m4
@@ -0,0 +1,155 @@
1# Check for getloadavg.
2
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003,
4# 2006 Free Software Foundation, Inc.
5
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
11# New applications should use gl_GETLOADAVG instead.
12
13# gl_GETLOADAVG(LIBOBJDIR)
14# ------------------------
15AC_DEFUN([gl_GETLOADAVG],
16[gl_have_func=no # yes means we've found a way to get the load average.
17
18# Make sure getloadavg.c is where it belongs, at configure-time.
19test -f "$srcdir/$1/getloadavg.c" ||
20 AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
21
22gl_save_LIBS=$LIBS
23
24# Check for getloadavg, but be sure not to touch the cache variable.
25(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && gl_have_func=yes
26
27# On HPUX9, an unprivileged user can get load averages through this function.
28AC_CHECK_FUNCS(pstat_getdynamic)
29
30# Solaris has libkstat which does not require root.
31AC_CHECK_LIB(kstat, kstat_open)
32test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
33
34# Some systems with -lutil have (and need) -lkvm as well, some do not.
35# On Solaris, -lkvm requires nlist from -lelf, so check that first
36# to get the right answer into the cache.
37# For kstat on solaris, we need libelf to force the definition of SVR4 below.
38if test $gl_have_func = no; then
39 AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
40fi
41if test $gl_have_func = no; then
42 AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
43 # Check for the 4.4BSD definition of getloadavg.
44 AC_CHECK_LIB(util, getloadavg,
45 [LIBS="-lutil $LIBS" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes])
46fi
47
48if test $gl_have_func = no; then
49 # There is a commonly available library for RS/6000 AIX.
50 # Since it is not a standard part of AIX, it might be installed locally.
51 gl_getloadavg_LIBS=$LIBS
52 LIBS="-L/usr/local/lib $LIBS"
53 AC_CHECK_LIB(getloadavg, getloadavg,
54 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
55fi
56
57# Make sure it is really in the library, if we think we found it,
58# otherwise set up the replacement function.
59AC_CHECK_FUNCS(getloadavg, [],
60 [gl_PREREQ_GETLOADAVG])
61
62# Some definitions of getloadavg require that the program be installed setgid.
63AC_CACHE_CHECK(whether getloadavg requires setgid,
64 gl_cv_func_getloadavg_setgid,
65[AC_EGREP_CPP([Yowza Am I SETGID yet],
66[#define CONFIGURING_GETLOADAVG
67#include "$srcdir/$1/getloadavg.c"
68#ifdef LDAV_PRIVILEGED
69Yowza Am I SETGID yet
70#endif
71],
72 gl_cv_func_getloadavg_setgid=yes,
73 gl_cv_func_getloadavg_setgid=no)])
74if test $gl_cv_func_getloadavg_setgid = yes; then
75 NEED_SETGID=true
76 AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
77 [Define to 1 if the `getloadavg' function needs to be run setuid
78 or setgid.])
79else
80 NEED_SETGID=false
81fi
82AC_SUBST(NEED_SETGID)dnl
83
84if test $gl_cv_func_getloadavg_setgid = yes; then
85 AC_CACHE_CHECK(group of /dev/kmem, gl_cv_group_kmem,
86[ # On Solaris, /dev/kmem is a symlink. Get info on the real file.
87 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
88 # If we got an error (system does not support symlinks), try without -L.
89 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
90 gl_cv_group_kmem=`echo $ac_ls_output \
91 | sed -ne ['s/[ ][ ]*/ /g
92 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
93 / /s/.* //;p']`
94])
95 AC_SUBST(KMEM_GROUP, $gl_cv_group_kmem)dnl
96fi
97if test "x$gl_save_LIBS" = x; then
98 GETLOADAVG_LIBS=$LIBS
99else
100 GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
101fi
102LIBS=$gl_save_LIBS
103
104AC_SUBST(GETLOADAVG_LIBS)dnl
105])# gl_GETLOADAVG
106
107
108# gl_PREREQ_GETLOADAVG
109# --------------------
110# Set up the AC_LIBOBJ replacement of `getloadavg'.
111AC_DEFUN([gl_PREREQ_GETLOADAVG],
112[AC_LIBOBJ(getloadavg)
113AC_DEFINE(C_GETLOADAVG, 1, [Define to 1 if using `getloadavg.c'.])
114# Figure out what our getloadavg.c needs.
115gl_have_func=no
116AC_CHECK_HEADER(sys/dg_sys_info.h,
117[gl_have_func=yes
118 AC_DEFINE(DGUX, 1, [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
119 AC_CHECK_LIB(dgc, dg_sys_info)])
120
121# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
122# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
123# Irix 4.0.5F has the header but not the library.
124if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then
125 gl_have_func=yes
126 AC_DEFINE(SVR4, 1, [Define to 1 on System V Release 4.])
127fi
128
129if test $gl_have_func = no; then
130 AC_CHECK_HEADER(inq_stats/cpustats.h,
131 [gl_have_func=yes
132 AC_DEFINE(UMAX, 1, [Define to 1 for Encore UMAX.])
133 AC_DEFINE(UMAX4_3, 1,
134 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
135 instead of <sys/cpustats.h>.])])
136fi
137
138if test $gl_have_func = no; then
139 AC_CHECK_HEADER(sys/cpustats.h,
140 [gl_have_func=yes; AC_DEFINE(UMAX)])
141fi
142
143if test $gl_have_func = no; then
144 AC_CHECK_HEADERS(mach/mach.h)
145fi
146
147AC_CHECK_HEADERS(nlist.h,
148[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
149 [AC_DEFINE(NLIST_NAME_UNION, 1,
150 [Define to 1 if your `struct nlist' has an
151 `n_un' member. Obsolete, depend on
152 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
153 [@%:@include <nlist.h>])
154])dnl
155])# gl_PREREQ_GETLOADAVG
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
new file mode 100644
index 00000000..c0a73b2c
--- /dev/null
+++ b/gl/m4/getopt.m4
@@ -0,0 +1,83 @@
1# getopt.m4 serial 13
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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
7# The getopt module assume you want GNU getopt, with getopt_long etc,
8# rather than vanilla POSIX getopt. This means your code should
9# always include <getopt.h> for the getopt prototypes.
10
11AC_DEFUN([gl_GETOPT_SUBSTITUTE],
12[
13 AC_LIBOBJ([getopt])
14 AC_LIBOBJ([getopt1])
15 gl_GETOPT_SUBSTITUTE_HEADER
16 gl_PREREQ_GETOPT
17])
18
19AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
20[
21 GETOPT_H=getopt.h
22 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
23 [Define to rpl_ if the getopt replacement functions and variables
24 should be used.])
25 AC_SUBST([GETOPT_H])
26])
27
28AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
29[
30 if test -z "$GETOPT_H"; then
31 AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
32 fi
33
34 if test -z "$GETOPT_H"; then
35 AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
36 fi
37
38 dnl BSD getopt_long uses an incompatible method to reset option processing,
39 dnl and (as of 2004-10-15) mishandles optional option-arguments.
40 if test -z "$GETOPT_H"; then
41 AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
42 fi
43
44 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
45 dnl option string (as of 2005-05-05).
46 if test -z "$GETOPT_H"; then
47 AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
48 [AC_RUN_IFELSE(
49 [AC_LANG_PROGRAM([#include <getopt.h>],
50 [[
51 char *myargv[3];
52 myargv[0] = "conftest";
53 myargv[1] = "-+";
54 myargv[2] = 0;
55 return getopt (2, myargv, "+a") != '?';
56 ]])],
57 [gl_cv_func_gnu_getopt=yes],
58 [gl_cv_func_gnu_getopt=no],
59 [dnl cross compiling - pessimistically guess based on decls
60 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
61 dnl option string (as of 2005-05-05).
62 AC_CHECK_DECL([getopt_clip],
63 [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
64 [#include <getopt.h>])])])
65 if test "$gl_cv_func_gnu_getopt" = "no"; then
66 GETOPT_H=getopt.h
67 fi
68 fi
69])
70
71AC_DEFUN([gl_GETOPT_IFELSE],
72[
73 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
74 AS_IF([test -n "$GETOPT_H"], [$1], [$2])
75])
76
77AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
78
79# Prerequisites of lib/getopt*.
80AC_DEFUN([gl_PREREQ_GETOPT],
81[
82 AC_CHECK_DECLS_ONCE([getenv])
83])
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
new file mode 100644
index 00000000..91c345e9
--- /dev/null
+++ b/gl/m4/gettext.m4
@@ -0,0 +1,419 @@
1# gettext.m4 serial 59 (gettext-0.16.1)
2dnl Copyright (C) 1995-2006 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006.
19
20dnl Macro to add for using GNU gettext.
21
22dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
24dnl default (if it is not specified or empty) is 'no-libtool'.
25dnl INTLSYMBOL should be 'external' for packages with no intl directory,
26dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
27dnl If INTLSYMBOL is 'use-libtool', then a libtool library
28dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
29dnl depending on --{enable,disable}-{shared,static} and on the presence of
30dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
31dnl $(top_builddir)/intl/libintl.a will be created.
32dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
33dnl implementations (in libc or libintl) without the ngettext() function
34dnl will be ignored. If NEEDSYMBOL is specified and is
35dnl 'need-formatstring-macros', then GNU gettext implementations that don't
36dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
37dnl INTLDIR is used to find the intl libraries. If empty,
38dnl the value `$(top_builddir)/intl/' is used.
39dnl
40dnl The result of the configuration is one of three cases:
41dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
42dnl and used.
43dnl Catalog format: GNU --> install in $(datadir)
44dnl Catalog extension: .mo after installation, .gmo in source tree
45dnl 2) GNU gettext has been found in the system's C library.
46dnl Catalog format: GNU --> install in $(datadir)
47dnl Catalog extension: .mo after installation, .gmo in source tree
48dnl 3) No internationalization, always use English msgid.
49dnl Catalog format: none
50dnl Catalog extension: none
51dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
52dnl The use of .gmo is historical (it was needed to avoid overwriting the
53dnl GNU format catalogs when building on a platform with an X/Open gettext),
54dnl but we keep it in order not to force irrelevant filename changes on the
55dnl maintainers.
56dnl
57AC_DEFUN([AM_GNU_GETTEXT],
58[
59 dnl Argument checking.
60 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
61 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
62])])])])])
63 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
64 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
65])])])])
66 define([gt_included_intl],
67 ifelse([$1], [external],
68 ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
69 [yes]))
70 define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
71 gt_NEEDS_INIT
72 AM_GNU_GETTEXT_NEED([$2])
73
74 AC_REQUIRE([AM_PO_SUBDIRS])dnl
75 ifelse(gt_included_intl, yes, [
76 AC_REQUIRE([AM_INTL_SUBDIR])dnl
77 ])
78
79 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
80 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
81 AC_REQUIRE([AC_LIB_RPATH])
82
83 dnl Sometimes libintl requires libiconv, so first search for libiconv.
84 dnl Ideally we would do this search only after the
85 dnl if test "$USE_NLS" = "yes"; then
86 dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
87 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
88 dnl the configure script would need to contain the same shell code
89 dnl again, outside any 'if'. There are two solutions:
90 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
91 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
92 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
93 dnl documented, we avoid it.
94 ifelse(gt_included_intl, yes, , [
95 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
96 ])
97
98 dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
99 gt_INTL_MACOSX
100
101 dnl Set USE_NLS.
102 AC_REQUIRE([AM_NLS])
103
104 ifelse(gt_included_intl, yes, [
105 BUILD_INCLUDED_LIBINTL=no
106 USE_INCLUDED_LIBINTL=no
107 ])
108 LIBINTL=
109 LTLIBINTL=
110 POSUB=
111
112 dnl Add a version number to the cache macros.
113 case " $gt_needs " in
114 *" need-formatstring-macros "*) gt_api_version=3 ;;
115 *" need-ngettext "*) gt_api_version=2 ;;
116 *) gt_api_version=1 ;;
117 esac
118 gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
119 gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
120
121 dnl If we use NLS figure out what method
122 if test "$USE_NLS" = "yes"; then
123 gt_use_preinstalled_gnugettext=no
124 ifelse(gt_included_intl, yes, [
125 AC_MSG_CHECKING([whether included gettext is requested])
126 AC_ARG_WITH(included-gettext,
127 [ --with-included-gettext use the GNU gettext library included here],
128 nls_cv_force_use_gnu_gettext=$withval,
129 nls_cv_force_use_gnu_gettext=no)
130 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
131
132 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
133 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
134 ])
135 dnl User does not insist on using GNU NLS library. Figure out what
136 dnl to use. If GNU gettext is available we use this. Else we have
137 dnl to fall back to GNU NLS library.
138
139 if test $gt_api_version -ge 3; then
140 gt_revision_test_code='
141#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
142#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
143#endif
144changequote(,)dnl
145typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
146changequote([,])dnl
147'
148 else
149 gt_revision_test_code=
150 fi
151 if test $gt_api_version -ge 2; then
152 gt_expression_test_code=' + * ngettext ("", "", 0)'
153 else
154 gt_expression_test_code=
155 fi
156
157 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
158 [AC_TRY_LINK([#include <libintl.h>
159$gt_revision_test_code
160extern int _nl_msg_cat_cntr;
161extern int *_nl_domain_bindings;],
162 [bindtextdomain ("", "");
163return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
164 [eval "$gt_func_gnugettext_libc=yes"],
165 [eval "$gt_func_gnugettext_libc=no"])])
166
167 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
168 dnl Sometimes libintl requires libiconv, so first search for libiconv.
169 ifelse(gt_included_intl, yes, , [
170 AM_ICONV_LINK
171 ])
172 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
173 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
174 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
175 dnl even if libiconv doesn't exist.
176 AC_LIB_LINKFLAGS_BODY([intl])
177 AC_CACHE_CHECK([for GNU gettext in libintl],
178 [$gt_func_gnugettext_libintl],
179 [gt_save_CPPFLAGS="$CPPFLAGS"
180 CPPFLAGS="$CPPFLAGS $INCINTL"
181 gt_save_LIBS="$LIBS"
182 LIBS="$LIBS $LIBINTL"
183 dnl Now see whether libintl exists and does not depend on libiconv.
184 AC_TRY_LINK([#include <libintl.h>
185$gt_revision_test_code
186extern int _nl_msg_cat_cntr;
187extern
188#ifdef __cplusplus
189"C"
190#endif
191const char *_nl_expand_alias (const char *);],
192 [bindtextdomain ("", "");
193return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
194 [eval "$gt_func_gnugettext_libintl=yes"],
195 [eval "$gt_func_gnugettext_libintl=no"])
196 dnl Now see whether libintl exists and depends on libiconv.
197 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
198 LIBS="$LIBS $LIBICONV"
199 AC_TRY_LINK([#include <libintl.h>
200$gt_revision_test_code
201extern int _nl_msg_cat_cntr;
202extern
203#ifdef __cplusplus
204"C"
205#endif
206const char *_nl_expand_alias (const char *);],
207 [bindtextdomain ("", "");
208return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
209 [LIBINTL="$LIBINTL $LIBICONV"
210 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
211 eval "$gt_func_gnugettext_libintl=yes"
212 ])
213 fi
214 CPPFLAGS="$gt_save_CPPFLAGS"
215 LIBS="$gt_save_LIBS"])
216 fi
217
218 dnl If an already present or preinstalled GNU gettext() is found,
219 dnl use it. But if this macro is used in GNU gettext, and GNU
220 dnl gettext is already preinstalled in libintl, we update this
221 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
222 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
223 || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
224 && test "$PACKAGE" != gettext-runtime \
225 && test "$PACKAGE" != gettext-tools; }; then
226 gt_use_preinstalled_gnugettext=yes
227 else
228 dnl Reset the values set by searching for libintl.
229 LIBINTL=
230 LTLIBINTL=
231 INCINTL=
232 fi
233
234 ifelse(gt_included_intl, yes, [
235 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
236 dnl GNU gettext is not found in the C library.
237 dnl Fall back on included GNU gettext library.
238 nls_cv_use_gnu_gettext=yes
239 fi
240 fi
241
242 if test "$nls_cv_use_gnu_gettext" = "yes"; then
243 dnl Mark actions used to generate GNU NLS library.
244 BUILD_INCLUDED_LIBINTL=yes
245 USE_INCLUDED_LIBINTL=yes
246 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
247 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
248 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
249 fi
250
251 CATOBJEXT=
252 if test "$gt_use_preinstalled_gnugettext" = "yes" \
253 || test "$nls_cv_use_gnu_gettext" = "yes"; then
254 dnl Mark actions to use GNU gettext tools.
255 CATOBJEXT=.gmo
256 fi
257 ])
258
259 if test -n "$INTL_MACOSX_LIBS"; then
260 if test "$gt_use_preinstalled_gnugettext" = "yes" \
261 || test "$nls_cv_use_gnu_gettext" = "yes"; then
262 dnl Some extra flags are needed during linking.
263 LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
264 LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
265 fi
266 fi
267
268 if test "$gt_use_preinstalled_gnugettext" = "yes" \
269 || test "$nls_cv_use_gnu_gettext" = "yes"; then
270 AC_DEFINE(ENABLE_NLS, 1,
271 [Define to 1 if translation of program messages to the user's native language
272 is requested.])
273 else
274 USE_NLS=no
275 fi
276 fi
277
278 AC_MSG_CHECKING([whether to use NLS])
279 AC_MSG_RESULT([$USE_NLS])
280 if test "$USE_NLS" = "yes"; then
281 AC_MSG_CHECKING([where the gettext function comes from])
282 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
283 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
284 gt_source="external libintl"
285 else
286 gt_source="libc"
287 fi
288 else
289 gt_source="included intl directory"
290 fi
291 AC_MSG_RESULT([$gt_source])
292 fi
293
294 if test "$USE_NLS" = "yes"; then
295
296 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
297 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
298 AC_MSG_CHECKING([how to link with libintl])
299 AC_MSG_RESULT([$LIBINTL])
300 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
301 fi
302
303 dnl For backward compatibility. Some packages may be using this.
304 AC_DEFINE(HAVE_GETTEXT, 1,
305 [Define if the GNU gettext() function is already present or preinstalled.])
306 AC_DEFINE(HAVE_DCGETTEXT, 1,
307 [Define if the GNU dcgettext() function is already present or preinstalled.])
308 fi
309
310 dnl We need to process the po/ directory.
311 POSUB=po
312 fi
313
314 ifelse(gt_included_intl, yes, [
315 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
316 dnl to 'yes' because some of the testsuite requires it.
317 if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
318 BUILD_INCLUDED_LIBINTL=yes
319 fi
320
321 dnl Make all variables we use known to autoconf.
322 AC_SUBST(BUILD_INCLUDED_LIBINTL)
323 AC_SUBST(USE_INCLUDED_LIBINTL)
324 AC_SUBST(CATOBJEXT)
325
326 dnl For backward compatibility. Some configure.ins may be using this.
327 nls_cv_header_intl=
328 nls_cv_header_libgt=
329
330 dnl For backward compatibility. Some Makefiles may be using this.
331 DATADIRNAME=share
332 AC_SUBST(DATADIRNAME)
333
334 dnl For backward compatibility. Some Makefiles may be using this.
335 INSTOBJEXT=.mo
336 AC_SUBST(INSTOBJEXT)
337
338 dnl For backward compatibility. Some Makefiles may be using this.
339 GENCAT=gencat
340 AC_SUBST(GENCAT)
341
342 dnl For backward compatibility. Some Makefiles may be using this.
343 INTLOBJS=
344 if test "$USE_INCLUDED_LIBINTL" = yes; then
345 INTLOBJS="\$(GETTOBJS)"
346 fi
347 AC_SUBST(INTLOBJS)
348
349 dnl Enable libtool support if the surrounding package wishes it.
350 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
351 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
352 ])
353
354 dnl For backward compatibility. Some Makefiles may be using this.
355 INTLLIBS="$LIBINTL"
356 AC_SUBST(INTLLIBS)
357
358 dnl Make all documented variables known to autoconf.
359 AC_SUBST(LIBINTL)
360 AC_SUBST(LTLIBINTL)
361 AC_SUBST(POSUB)
362])
363
364
365dnl Checks for special options needed on MacOS X.
366dnl Defines INTL_MACOSX_LIBS.
367AC_DEFUN([gt_INTL_MACOSX],
368[
369 dnl Check for API introduced in MacOS X 10.2.
370 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
371 gt_cv_func_CFPreferencesCopyAppValue,
372 [gt_save_LIBS="$LIBS"
373 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
374 AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
375 [CFPreferencesCopyAppValue(NULL, NULL)],
376 [gt_cv_func_CFPreferencesCopyAppValue=yes],
377 [gt_cv_func_CFPreferencesCopyAppValue=no])
378 LIBS="$gt_save_LIBS"])
379 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
380 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
381 [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
382 fi
383 dnl Check for API introduced in MacOS X 10.3.
384 AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
385 [gt_save_LIBS="$LIBS"
386 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
387 AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
388 [gt_cv_func_CFLocaleCopyCurrent=yes],
389 [gt_cv_func_CFLocaleCopyCurrent=no])
390 LIBS="$gt_save_LIBS"])
391 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
392 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
393 [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
394 fi
395 INTL_MACOSX_LIBS=
396 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
397 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
398 fi
399 AC_SUBST([INTL_MACOSX_LIBS])
400])
401
402
403dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
404m4_define([gt_NEEDS_INIT],
405[
406 m4_divert_text([DEFAULTS], [gt_needs=])
407 m4_define([gt_NEEDS_INIT], [])
408])
409
410
411dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
412AC_DEFUN([AM_GNU_GETTEXT_NEED],
413[
414 m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
415])
416
417
418dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
419AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/gl/m4/glibc2.m4 b/gl/m4/glibc2.m4
new file mode 100644
index 00000000..e8f5bfe6
--- /dev/null
+++ b/gl/m4/glibc2.m4
@@ -0,0 +1,30 @@
1# glibc2.m4 serial 1
2dnl Copyright (C) 2000-2002, 2004 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
7# Test for the GNU C Library, version 2.0 or newer.
8# From Bruno Haible.
9
10AC_DEFUN([gt_GLIBC2],
11 [
12 AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer,
13 ac_cv_gnu_library_2,
14 [AC_EGREP_CPP([Lucky GNU user],
15 [
16#include <features.h>
17#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ >= 2)
19 Lucky GNU user
20 #endif
21#endif
22 ],
23 ac_cv_gnu_library_2=yes,
24 ac_cv_gnu_library_2=no)
25 ]
26 )
27 AC_SUBST(GLIBC2)
28 GLIBC2="$ac_cv_gnu_library_2"
29 ]
30)
diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4
new file mode 100644
index 00000000..d95fd986
--- /dev/null
+++ b/gl/m4/glibc21.m4
@@ -0,0 +1,30 @@
1# glibc21.m4 serial 3
2dnl Copyright (C) 2000-2002, 2004 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
7# Test for the GNU C Library, version 2.1 or newer.
8# From Bruno Haible.
9
10AC_DEFUN([gl_GLIBC21],
11 [
12 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
13 ac_cv_gnu_library_2_1,
14 [AC_EGREP_CPP([Lucky GNU user],
15 [
16#include <features.h>
17#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
19 Lucky GNU user
20 #endif
21#endif
22 ],
23 ac_cv_gnu_library_2_1=yes,
24 ac_cv_gnu_library_2_1=no)
25 ]
26 )
27 AC_SUBST(GLIBC21)
28 GLIBC21="$ac_cv_gnu_library_2_1"
29 ]
30)
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
new file mode 100644
index 00000000..e78c8604
--- /dev/null
+++ b/gl/m4/gnulib-cache.m4
@@ -0,0 +1,30 @@
1# Copyright (C) 2004-2007 Free Software Foundation, Inc.
2#
3# This file is free software, distributed under the terms of the GNU
4# General Public License. As a special exception to the GNU General
5# Public License, this file may be distributed as part of a program
6# that contains a configuration script generated by Autoconf, under
7# the same distribution terms as the rest of that program.
8#
9# Generated by gnulib-tool.
10#
11# This file represents the specification of how gnulib-tool is used.
12# It acts as a cache: It is written and read by gnulib-tool.
13# In projects using CVS, this file is meant to be stored in CVS,
14# like the configure.ac and various Makefile.am files.
15
16
17# Specification in the form of a command-line invocation:
18# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf
19
20# Specification in the form of a few gnulib-tool.m4 macro invocations:
21gl_LOCAL_DIR([])
22gl_MODULES([dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf])
23gl_AVOID([])
24gl_SOURCE_BASE([gl])
25gl_M4_BASE([gl/m4])
26gl_DOC_BASE([doc])
27gl_TESTS_BASE([tests])
28gl_LIB([libgnu])
29gl_MAKEFILE_NAME([])
30gl_MACRO_PREFIX([gl])
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
new file mode 100644
index 00000000..53980108
--- /dev/null
+++ b/gl/m4/gnulib-common.m4
@@ -0,0 +1,22 @@
1# gnulib-common.m4 serial 2
2dnl Copyright (C) 2007 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
7# gl_MODULE_INDICATOR([modulename])
8# defines a C macro indicating the presence of the given module.
9AC_DEFUN([gl_MODULE_INDICATOR],
10[
11 AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
12 [Define to 1 when using the gnulib module ]$1[.])
13])
14
15# AC_PROG_MKDIR_P
16# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
17# Remove this macro when we can assume autoconf >= 2.60.
18m4_ifdef([AC_PROG_MKDIR_P], [], [
19 AC_DEFUN([AC_PROG_MKDIR_P],
20 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
21 MKDIR_P='$(mkdir_p)'
22 AC_SUBST([MKDIR_P])])])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
new file mode 100644
index 00000000..ed4da7d9
--- /dev/null
+++ b/gl/m4/gnulib-comp.m4
@@ -0,0 +1,326 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2004-2007 Free Software Foundation, Inc.
3#
4# This file is free software, distributed under the terms of the GNU
5# General Public License. As a special exception to the GNU General
6# Public License, this file may be distributed as part of a program
7# that contains a configuration script generated by Autoconf, under
8# the same distribution terms as the rest of that program.
9#
10# Generated by gnulib-tool.
11#
12# This file represents the compiled summary of the specification in
13# gnulib-cache.m4. It lists the computed macro invocations that need
14# to be invoked from configure.ac.
15# In projects using CVS, this file can be treated like other built files.
16
17
18# This macro should be invoked from ./configure.in, in the section
19# "Checks for programs", right after AC_PROG_CC, and certainly before
20# any checks for libraries, header files, types and library functions.
21AC_DEFUN([gl_EARLY],
22[
23 m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
24 m4_pattern_allow([^gl_ES$])dnl a valid locale name
25 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
26 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
27 AC_REQUIRE([AC_PROG_RANLIB])
28 AC_REQUIRE([AC_GNU_SOURCE])
29 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
30 AC_REQUIRE([gl_LOCK_EARLY])
31])
32
33# This macro should be invoked from ./configure.in, in the section
34# "Check for header files, types and library functions".
35AC_DEFUN([gl_INIT],
36[
37 m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
38 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
39 m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
40 AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
41 gl_cond_libtool=false
42 gl_libdeps=
43 gl_ltlibdeps=
44 gl_source_base='gl'
45 gl_FUNC_ALLOCA
46 gl_HEADER_ARPA_INET
47 gl_C_STRTOD
48 gl_CLOEXEC
49 gl_DIRNAME
50 gl_DOUBLE_SLASH_ROOT
51 gl_ERROR
52 gl_EXITFAIL
53 dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
54 gl_FCNTL_SAFER
55 gl_MODULE_INDICATOR([fcntl-safer])
56 gl_FSUSAGE
57 gl_GETADDRINFO
58 gl_FUNC_GETHOSTNAME
59 gl_GETLOADAVG([$gl_source_base])
60 gl_GETOPT
61 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
62 AM_GNU_GETTEXT_VERSION([0.15])
63 gl_INET_NTOP
64 gl_INLINE
65 AC_FUNC_MALLOC
66 gl_MBCHAR
67 gl_MBITER
68 gl_FUNC_MEMCHR
69 gl_MINMAX
70 gl_MOUNTLIST
71 gl_HEADER_NETINET_IN
72 gl_REGEX
73 gl_SAFE_READ
74 gl_SAFE_WRITE
75 gl_SIZE_MAX
76 gl_FUNC_SNPRINTF
77 gl_TYPE_SOCKLEN_T
78 gt_TYPE_SSIZE_T
79 AM_STDBOOL_H
80 gl_STDINT_H
81 gl_STRCASE
82 gl_FUNC_STRDUP
83 gl_FUNC_STRNDUP
84 gl_FUNC_STRNLEN
85 gl_HEADER_SYS_SOCKET
86 AC_PROG_MKDIR_P
87 gl_HEADER_UNISTD
88 gl_UNISTD_SAFER
89 gl_FUNC_VASNPRINTF
90 gl_FUNC_VASPRINTF
91 gl_FUNC_VSNPRINTF
92 gl_WCHAR_H
93 gl_WCTYPE_H
94 gl_FUNC_WCWIDTH
95 gl_XALLOC
96 gl_XSIZE
97 gl_XSTRNDUP
98 LIBGNU_LIBDEPS="$gl_libdeps"
99 AC_SUBST([LIBGNU_LIBDEPS])
100 LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
101 AC_SUBST([LIBGNU_LTLIBDEPS])
102 m4_popdef([AC_LIBSOURCES])
103 m4_popdef([AC_REPLACE_FUNCS])
104 m4_popdef([AC_LIBOBJ])
105 AC_CONFIG_COMMANDS_PRE([
106 gl_libobjs=
107 gl_ltlibobjs=
108 if test -n "$gl_LIBOBJS"; then
109 # Remove the extension.
110 sed_drop_objext='s/\.o$//;s/\.obj$//'
111 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
112 gl_libobjs="$gl_libobjs $i.$ac_objext"
113 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
114 done
115 fi
116 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
117 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
118 ])
119])
120
121# Like AC_LIBOBJ, except that the module name goes
122# into gl_LIBOBJS instead of into LIBOBJS.
123AC_DEFUN([gl_LIBOBJ],
124 [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"])
125
126# Like AC_REPLACE_FUNCS, except that the module name goes
127# into gl_LIBOBJS instead of into LIBOBJS.
128AC_DEFUN([gl_REPLACE_FUNCS],
129 [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])])
130
131# Like AC_LIBSOURCES, except that it does nothing.
132# We rely on EXTRA_lib..._SOURCES instead.
133AC_DEFUN([gl_LIBSOURCES],
134 [])
135
136# This macro records the list of files which have been installed by
137# gnulib-tool and may be removed by future gnulib-tool invocations.
138AC_DEFUN([gl_FILE_LIST], [
139 build-aux/config.rpath
140 lib/alloca.c
141 lib/alloca_.h
142 lib/asnprintf.c
143 lib/asprintf.c
144 lib/basename.c
145 lib/c-strtod.c
146 lib/c-strtod.h
147 lib/cloexec.c
148 lib/cloexec.h
149 lib/creat-safer.c
150 lib/dirname.c
151 lib/dirname.h
152 lib/dup-safer.c
153 lib/error.c
154 lib/error.h
155 lib/exit.h
156 lib/exitfail.c
157 lib/exitfail.h
158 lib/fcntl--.h
159 lib/fcntl-safer.h
160 lib/fd-safer.c
161 lib/fsusage.c
162 lib/fsusage.h
163 lib/full-read.c
164 lib/full-read.h
165 lib/full-write.c
166 lib/full-write.h
167 lib/gai_strerror.c
168 lib/getaddrinfo.c
169 lib/getaddrinfo.h
170 lib/gethostname.c
171 lib/getloadavg.c
172 lib/getopt.c
173 lib/getopt1.c
174 lib/getopt_.h
175 lib/getopt_int.h
176 lib/gettext.h
177 lib/inet_ntop.c
178 lib/inet_ntop.h
179 lib/intprops.h
180 lib/malloc.c
181 lib/mbchar.c
182 lib/mbchar.h
183 lib/mbuiter.h
184 lib/memchr.c
185 lib/minmax.h
186 lib/mountlist.c
187 lib/mountlist.h
188 lib/open-safer.c
189 lib/pipe-safer.c
190 lib/printf-args.c
191 lib/printf-args.h
192 lib/printf-parse.c
193 lib/printf-parse.h
194 lib/regcomp.c
195 lib/regex.c
196 lib/regex.h
197 lib/regex_internal.c
198 lib/regex_internal.h
199 lib/regexec.c
200 lib/safe-read.c
201 lib/safe-read.h
202 lib/safe-write.c
203 lib/safe-write.h
204 lib/size_max.h
205 lib/snprintf.c
206 lib/snprintf.h
207 lib/socket_.h
208 lib/stdbool_.h
209 lib/stdint_.h
210 lib/strcase.h
211 lib/strcasecmp.c
212 lib/strdup.c
213 lib/strdup.h
214 lib/stripslash.c
215 lib/strncasecmp.c
216 lib/strndup.c
217 lib/strndup.h
218 lib/strnlen.c
219 lib/strnlen.h
220 lib/strnlen1.c
221 lib/strnlen1.h
222 lib/unistd--.h
223 lib/unistd-safer.h
224 lib/unistd_.h
225 lib/vasnprintf.c
226 lib/vasnprintf.h
227 lib/vasprintf.c
228 lib/vasprintf.h
229 lib/vsnprintf.c
230 lib/vsnprintf.h
231 lib/wchar_.h
232 lib/wctype_.h
233 lib/wcwidth.h
234 lib/xalloc-die.c
235 lib/xalloc.h
236 lib/xmalloc.c
237 lib/xsize.h
238 lib/xstrndup.c
239 lib/xstrndup.h
240 m4/absolute-header.m4
241 m4/alloca.m4
242 m4/arpa_inet_h.m4
243 m4/c-strtod.m4
244 m4/cloexec.m4
245 m4/codeset.m4
246 m4/dirname.m4
247 m4/dos.m4
248 m4/double-slash-root.m4
249 m4/eoverflow.m4
250 m4/error.m4
251 m4/exitfail.m4
252 m4/extensions.m4
253 m4/fcntl-safer.m4
254 m4/fstypename.m4
255 m4/fsusage.m4
256 m4/getaddrinfo.m4
257 m4/gethostname.m4
258 m4/getloadavg.m4
259 m4/getopt.m4
260 m4/gettext.m4
261 m4/glibc2.m4
262 m4/glibc21.m4
263 m4/gnulib-common.m4
264 m4/iconv.m4
265 m4/inet_ntop.m4
266 m4/inline.m4
267 m4/intdiv0.m4
268 m4/intl.m4
269 m4/intldir.m4
270 m4/intmax.m4
271 m4/intmax_t.m4
272 m4/inttypes-pri.m4
273 m4/inttypes_h.m4
274 m4/lcmessage.m4
275 m4/lib-ld.m4
276 m4/lib-link.m4
277 m4/lib-prefix.m4
278 m4/lock.m4
279 m4/longdouble.m4
280 m4/longlong.m4
281 m4/ls-mntd-fs.m4
282 m4/mbchar.m4
283 m4/mbiter.m4
284 m4/mbrtowc.m4
285 m4/memchr.m4
286 m4/minmax.m4
287 m4/mountlist.m4
288 m4/netinet_in_h.m4
289 m4/nls.m4
290 m4/onceonly_2_57.m4
291 m4/po.m4
292 m4/printf-posix.m4
293 m4/progtest.m4
294 m4/regex.m4
295 m4/safe-read.m4
296 m4/safe-write.m4
297 m4/size_max.m4
298 m4/snprintf.m4
299 m4/socklen.m4
300 m4/sockpfaf.m4
301 m4/ssize_t.m4
302 m4/stdbool.m4
303 m4/stdint.m4
304 m4/stdint_h.m4
305 m4/strcase.m4
306 m4/strdup.m4
307 m4/strndup.m4
308 m4/strnlen.m4
309 m4/sys_socket_h.m4
310 m4/uintmax_t.m4
311 m4/ulonglong.m4
312 m4/unistd-safer.m4
313 m4/unistd_h.m4
314 m4/vasnprintf.m4
315 m4/vasprintf.m4
316 m4/visibility.m4
317 m4/vsnprintf.m4
318 m4/wchar.m4
319 m4/wchar_t.m4
320 m4/wctype.m4
321 m4/wcwidth.m4
322 m4/wint_t.m4
323 m4/xalloc.m4
324 m4/xsize.m4
325 m4/xstrndup.m4
326])
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4
new file mode 100644
index 00000000..ef593203
--- /dev/null
+++ b/gl/m4/gnulib-tool.m4
@@ -0,0 +1,33 @@
1# gnulib-tool.m4 serial 1
2dnl Copyright (C) 2004-2005 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 The following macros need not be invoked explicitly.
8dnl Invoking them does nothing except to declare default arguments
9dnl for "gnulib-tool --import".
10
11dnl Usage: gl_MODULES([module1 module2 ...])
12AC_DEFUN([gl_MODULES], [])
13
14dnl Usage: gl_AVOID([module1 module2 ...])
15AC_DEFUN([gl_AVOID], [])
16
17dnl Usage: gl_SOURCE_BASE([DIR])
18AC_DEFUN([gl_SOURCE_BASE], [])
19
20dnl Usage: gl_M4_BASE([DIR])
21AC_DEFUN([gl_M4_BASE], [])
22
23dnl Usage: gl_LIB([LIBNAME])
24AC_DEFUN([gl_LIB], [])
25
26dnl Usage: gl_LGPL
27AC_DEFUN([gl_LGPL], [])
28
29dnl Usage: gl_LIBTOOL
30AC_DEFUN([gl_LIBTOOL], [])
31
32dnl Usage: gl_MACRO_PREFIX([PREFIX])
33AC_DEFUN([gl_MACRO_PREFIX], [])
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
new file mode 100644
index 00000000..654c4158
--- /dev/null
+++ b/gl/m4/iconv.m4
@@ -0,0 +1,101 @@
1# iconv.m4 serial AM4 (gettext-0.11.3)
2dnl Copyright (C) 2000-2002 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
9AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
10[
11 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
12 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
13 AC_REQUIRE([AC_LIB_RPATH])
14
15 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
16 dnl accordingly.
17 AC_LIB_LINKFLAGS_BODY([iconv])
18])
19
20AC_DEFUN([AM_ICONV_LINK],
21[
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).
24
25 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
26 dnl accordingly.
27 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
28
29 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 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 am_save_CPPFLAGS="$CPPFLAGS"
34 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
35
36 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
37 am_cv_func_iconv="no, consider installing GNU libiconv"
38 am_cv_lib_iconv=no
39 AC_TRY_LINK([#include <stdlib.h>
40#include <iconv.h>],
41 [iconv_t cd = iconv_open("","");
42 iconv(cd,NULL,NULL,NULL,NULL);
43 iconv_close(cd);],
44 am_cv_func_iconv=yes)
45 if test "$am_cv_func_iconv" != yes; then
46 am_save_LIBS="$LIBS"
47 LIBS="$LIBS $LIBICONV"
48 AC_TRY_LINK([#include <stdlib.h>
49#include <iconv.h>],
50 [iconv_t cd = iconv_open("","");
51 iconv(cd,NULL,NULL,NULL,NULL);
52 iconv_close(cd);],
53 am_cv_lib_iconv=yes
54 am_cv_func_iconv=yes)
55 LIBS="$am_save_LIBS"
56 fi
57 ])
58 if test "$am_cv_func_iconv" = yes; then
59 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
60 fi
61 if test "$am_cv_lib_iconv" = yes; then
62 AC_MSG_CHECKING([how to link with libiconv])
63 AC_MSG_RESULT([$LIBICONV])
64 else
65 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
66 dnl either.
67 CPPFLAGS="$am_save_CPPFLAGS"
68 LIBICONV=
69 LTLIBICONV=
70 fi
71 AC_SUBST(LIBICONV)
72 AC_SUBST(LTLIBICONV)
73])
74
75AC_DEFUN([AM_ICONV],
76[
77 AM_ICONV_LINK
78 if test "$am_cv_func_iconv" = yes; then
79 AC_MSG_CHECKING([for iconv declaration])
80 AC_CACHE_VAL(am_cv_proto_iconv, [
81 AC_TRY_COMPILE([
82#include <stdlib.h>
83#include <iconv.h>
84extern
85#ifdef __cplusplus
86"C"
87#endif
88#if defined(__STDC__) || defined(__cplusplus)
89size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
90#else
91size_t iconv();
92#endif
93], [], am_cv_proto_iconv_arg1="", 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);"])
95 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
96 AC_MSG_RESULT([$]{ac_t:-
97 }[$]am_cv_proto_iconv)
98 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
99 [Define as const if the declaration of iconv() needs const.])
100 fi
101])
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
new file mode 100644
index 00000000..bb02d229
--- /dev/null
+++ b/gl/m4/inet_ntop.m4
@@ -0,0 +1,19 @@
1# inet_ntop.m4 serial 3
2dnl Copyright (C) 2005, 2006 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
7AC_DEFUN([gl_INET_NTOP],
8[
9 AC_REPLACE_FUNCS(inet_ntop)
10 gl_PREREQ_INET_NTOP
11])
12
13# Prerequisites of lib/inet_ntop.h and lib/inet_ntop.c.
14AC_DEFUN([gl_PREREQ_INET_NTOP], [
15 AC_CHECK_HEADERS_ONCE([netinet/in.h arpa/inet.h])
16 AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
17 AC_REQUIRE([gl_SOCKET_FAMILIES])
18 AC_REQUIRE([AC_C_RESTRICT])
19])
diff --git a/gl/m4/inline.m4 b/gl/m4/inline.m4
new file mode 100644
index 00000000..a07076cd
--- /dev/null
+++ b/gl/m4/inline.m4
@@ -0,0 +1,40 @@
1# inline.m4 serial 3
2dnl Copyright (C) 2006 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 Test for the 'inline' keyword or equivalent.
8dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
9dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an
10dnl equivalent is effectively supported, i.e. if the compiler is likely to
11dnl drop unused 'static inline' functions.
12AC_DEFUN([gl_INLINE],
13[
14 AC_REQUIRE([AC_C_INLINE])
15 AC_CACHE_CHECK([whether the compiler generally respects inline],
16 [gl_cv_c_inline_effective],
17 [if test $ac_cv_c_inline = no; then
18 gl_cv_c_inline_effective=no
19 else
20 dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
21 dnl specified.
22 dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
23 dnl depends on optimization flags, which can be in CFLAGS.
24 dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
25 AC_COMPILE_IFELSE(
26 [AC_LANG_PROGRAM([[]],
27 [[#ifdef __NO_INLINE__
28 #error "inline is not effective"
29 #endif]])],
30 [gl_cv_c_inline_effective=yes],
31 [gl_cv_c_inline_effective=no])
32 fi
33 ])
34 if test $gl_cv_c_inline_effective = yes; then
35 AC_DEFINE([HAVE_INLINE], 1,
36 [Define to 1 if the compiler supports one of the keywords
37 'inline', '__inline__', '__inline' and effectively inlines
38 functions marked as such.])
39 fi
40])
diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4
new file mode 100644
index 00000000..b8d78176
--- /dev/null
+++ b/gl/m4/intdiv0.m4
@@ -0,0 +1,70 @@
1# intdiv0.m4 serial 1 (gettext-0.11.3)
2dnl Copyright (C) 2002 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
9AC_DEFUN([gt_INTDIV0],
10[
11 AC_REQUIRE([AC_PROG_CC])dnl
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl
13
14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
15 gt_cv_int_divbyzero_sigfpe,
16 [
17 AC_TRY_RUN([
18#include <stdlib.h>
19#include <signal.h>
20
21static void
22#ifdef __cplusplus
23sigfpe_handler (int sig)
24#else
25sigfpe_handler (sig) int sig;
26#endif
27{
28 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
29 exit (sig != SIGFPE);
30}
31
32int x = 1;
33int y = 0;
34int z;
35int nan;
36
37int main ()
38{
39 signal (SIGFPE, sigfpe_handler);
40/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
41#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
42 signal (SIGTRAP, sigfpe_handler);
43#endif
44/* Linux/SPARC yields signal SIGILL. */
45#if defined (__sparc__) && defined (__linux__)
46 signal (SIGILL, sigfpe_handler);
47#endif
48
49 z = x / y;
50 nan = y / y;
51 exit (1);
52}
53], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
54 [
55 # Guess based on the CPU.
56 case "$host_cpu" in
57 alpha* | i[34567]86 | m68k | s390*)
58 gt_cv_int_divbyzero_sigfpe="guessing yes";;
59 *)
60 gt_cv_int_divbyzero_sigfpe="guessing no";;
61 esac
62 ])
63 ])
64 case "$gt_cv_int_divbyzero_sigfpe" in
65 *yes) value=1;;
66 *) value=0;;
67 esac
68 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
69 [Define if integer division by zero raises signal SIGFPE.])
70])
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
new file mode 100644
index 00000000..dcefb118
--- /dev/null
+++ b/gl/m4/intl.m4
@@ -0,0 +1,259 @@
1# intl.m4 serial 3 (gettext-0.16)
2dnl Copyright (C) 1995-2006 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006.
19
20AC_PREREQ(2.52)
21
22dnl Checks for all prerequisites of the intl subdirectory,
23dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
24dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
25AC_DEFUN([AM_INTL_SUBDIR],
26[
27 AC_REQUIRE([AC_PROG_INSTALL])dnl
28 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
29 AC_REQUIRE([AC_PROG_CC])dnl
30 AC_REQUIRE([AC_CANONICAL_HOST])dnl
31 AC_REQUIRE([gt_GLIBC2])dnl
32 AC_REQUIRE([AC_PROG_RANLIB])dnl
33 AC_REQUIRE([gl_VISIBILITY])dnl
34 AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
36 AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
37 AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
38 AC_REQUIRE([gt_TYPE_WINT_T])dnl
39 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
40 AC_REQUIRE([gt_TYPE_INTMAX_T])
41 AC_REQUIRE([gt_PRINTF_POSIX])
42 AC_REQUIRE([gl_GLIBC21])dnl
43 AC_REQUIRE([gl_XSIZE])dnl
44 AC_REQUIRE([gt_INTL_MACOSX])dnl
45
46 AC_CHECK_TYPE([ptrdiff_t], ,
47 [AC_DEFINE([ptrdiff_t], [long],
48 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
49 ])
50 AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
51 AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen])
52
53 dnl Use the _snprintf function only if it is declared (because on NetBSD it
54 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
55 gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
56 gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
57
58 dnl Use the *_unlocked functions only if they are declared.
59 dnl (because some of them were defined without being declared in Solaris
60 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
61 dnl on Solaris 2.5.1 to run on Solaris 2.6).
62 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
63 gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
64
65 case $gt_cv_func_printf_posix in
66 *yes) HAVE_POSIX_PRINTF=1 ;;
67 *) HAVE_POSIX_PRINTF=0 ;;
68 esac
69 AC_SUBST([HAVE_POSIX_PRINTF])
70 if test "$ac_cv_func_asprintf" = yes; then
71 HAVE_ASPRINTF=1
72 else
73 HAVE_ASPRINTF=0
74 fi
75 AC_SUBST([HAVE_ASPRINTF])
76 if test "$ac_cv_func_snprintf" = yes; then
77 HAVE_SNPRINTF=1
78 else
79 HAVE_SNPRINTF=0
80 fi
81 AC_SUBST([HAVE_SNPRINTF])
82 if test "$ac_cv_func_wprintf" = yes; then
83 HAVE_WPRINTF=1
84 else
85 HAVE_WPRINTF=0
86 fi
87 AC_SUBST([HAVE_WPRINTF])
88
89 AM_LANGINFO_CODESET
90 gt_LC_MESSAGES
91
92 dnl Compilation on mingw and Cygwin needs special Makefile rules, because
93 dnl 1. when we install a shared library, we must arrange to export
94 dnl auxiliary pointer variables for every exported variable,
95 dnl 2. when we install a shared library and a static library simultaneously,
96 dnl the include file specifies __declspec(dllimport) and therefore we
97 dnl must arrange to define the auxiliary pointer variables for the
98 dnl exported variables _also_ in the static library.
99 if test "$enable_shared" = yes; then
100 case "$host_os" in
101 cygwin*) is_woe32dll=yes ;;
102 *) is_woe32dll=no ;;
103 esac
104 else
105 is_woe32dll=no
106 fi
107 WOE32DLL=$is_woe32dll
108 AC_SUBST([WOE32DLL])
109
110 dnl Rename some macros and functions used for locking.
111 AH_BOTTOM([
112#define __libc_lock_t gl_lock_t
113#define __libc_lock_define gl_lock_define
114#define __libc_lock_define_initialized gl_lock_define_initialized
115#define __libc_lock_init gl_lock_init
116#define __libc_lock_lock gl_lock_lock
117#define __libc_lock_unlock gl_lock_unlock
118#define __libc_lock_recursive_t gl_recursive_lock_t
119#define __libc_lock_define_recursive gl_recursive_lock_define
120#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
121#define __libc_lock_init_recursive gl_recursive_lock_init
122#define __libc_lock_lock_recursive gl_recursive_lock_lock
123#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
124#define glthread_in_use libintl_thread_in_use
125#define glthread_lock_init libintl_lock_init
126#define glthread_lock_lock libintl_lock_lock
127#define glthread_lock_unlock libintl_lock_unlock
128#define glthread_lock_destroy libintl_lock_destroy
129#define glthread_rwlock_init libintl_rwlock_init
130#define glthread_rwlock_rdlock libintl_rwlock_rdlock
131#define glthread_rwlock_wrlock libintl_rwlock_wrlock
132#define glthread_rwlock_unlock libintl_rwlock_unlock
133#define glthread_rwlock_destroy libintl_rwlock_destroy
134#define glthread_recursive_lock_init libintl_recursive_lock_init
135#define glthread_recursive_lock_lock libintl_recursive_lock_lock
136#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
137#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
138#define glthread_once libintl_once
139#define glthread_once_call libintl_once_call
140#define glthread_once_singlethreaded libintl_once_singlethreaded
141])
142])
143
144
145dnl Checks for the core files of the intl subdirectory:
146dnl dcigettext.c
147dnl eval-plural.h
148dnl explodename.c
149dnl finddomain.c
150dnl gettextP.h
151dnl gmo.h
152dnl hash-string.h hash-string.c
153dnl l10nflist.c
154dnl libgnuintl.h.in (except the *printf stuff)
155dnl loadinfo.h
156dnl loadmsgcat.c
157dnl localealias.c
158dnl log.c
159dnl plural-exp.h plural-exp.c
160dnl plural.y
161dnl Used by libglocale.
162AC_DEFUN([gt_INTL_SUBDIR_CORE],
163[
164 AC_REQUIRE([AC_C_INLINE])dnl
165 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
166 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
167 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
168 AC_REQUIRE([AC_FUNC_MMAP])dnl
169 AC_REQUIRE([gt_INTDIV0])dnl
170 AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
171 AC_REQUIRE([gt_INTTYPES_PRI])dnl
172 AC_REQUIRE([gl_LOCK])dnl
173
174 AC_TRY_LINK(
175 [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
176 [],
177 [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
178 [Define to 1 if the compiler understands __builtin_expect.])])
179
180 AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
181 AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
182 stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
183 argz_next __fsetlocking])
184
185 dnl Use the *_unlocked functions only if they are declared.
186 dnl (because some of them were defined without being declared in Solaris
187 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
188 dnl on Solaris 2.5.1 to run on Solaris 2.6).
189 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
190 gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
191 gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
192
193 AM_ICONV
194
195 dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined,
196 dnl and a _NL_LOCALE_NAME macro always.
197 AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
198 [AC_TRY_LINK([#include <langinfo.h>
199#include <locale.h>],
200 [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));],
201 gt_cv_nl_locale_name=yes,
202 gt_cv_nl_locale_name=no)
203 ])
204 if test $gt_cv_nl_locale_name = yes; then
205 AC_DEFINE(HAVE_NL_LOCALE_NAME, 1,
206 [Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.])
207 fi
208
209 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
210 dnl because plural.y uses bison specific features. It requires at least
211 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
212 dnl compile.
213 dnl bison is only needed for the maintainer (who touches plural.y). But in
214 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
215 dnl the rule in general Makefile. Now, some people carelessly touch the
216 dnl files or have a broken "make" program, hence the plural.c rule will
217 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
218 dnl present or too old.
219 AC_CHECK_PROGS([INTLBISON], [bison])
220 if test -z "$INTLBISON"; then
221 ac_verc_fail=yes
222 else
223 dnl Found it, now check the version.
224 AC_MSG_CHECKING([version of bison])
225changequote(<<,>>)dnl
226 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
227 case $ac_prog_version in
228 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
229 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
230changequote([,])dnl
231 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
232 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
233 esac
234 AC_MSG_RESULT([$ac_prog_version])
235 fi
236 if test $ac_verc_fail = yes; then
237 INTLBISON=:
238 fi
239])
240
241
242dnl gt_CHECK_DECL(FUNC, INCLUDES)
243dnl Check whether a function is declared.
244AC_DEFUN([gt_CHECK_DECL],
245[
246 AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
247 [AC_TRY_COMPILE([$2], [
248#ifndef $1
249 char *p = (char *) $1;
250#endif
251], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
252 if test $ac_cv_have_decl_$1 = yes; then
253 gt_value=1
254 else
255 gt_value=0
256 fi
257 AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
258 [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
259])
diff --git a/gl/m4/intldir.m4 b/gl/m4/intldir.m4
new file mode 100644
index 00000000..7a28843f
--- /dev/null
+++ b/gl/m4/intldir.m4
@@ -0,0 +1,19 @@
1# intldir.m4 serial 1 (gettext-0.16)
2dnl Copyright (C) 2006 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
16AC_PREREQ(2.52)
17
18dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory.
19AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], [])
diff --git a/gl/m4/intmax.m4 b/gl/m4/intmax.m4
new file mode 100644
index 00000000..ce7a8a49
--- /dev/null
+++ b/gl/m4/intmax.m4
@@ -0,0 +1,33 @@
1# intmax.m4 serial 3 (gettext-0.16)
2dnl Copyright (C) 2002-2005 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.
8dnl Test whether the system has the 'intmax_t' type, but don't attempt to
9dnl find a replacement if it is lacking.
10
11AC_DEFUN([gt_TYPE_INTMAX_T],
12[
13 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
14 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
15 AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
16 [AC_TRY_COMPILE([
17#include <stddef.h>
18#include <stdlib.h>
19#if HAVE_STDINT_H_WITH_UINTMAX
20#include <stdint.h>
21#endif
22#if HAVE_INTTYPES_H_WITH_UINTMAX
23#include <inttypes.h>
24#endif
25], [intmax_t x = -1;
26 return !x;],
27 gt_cv_c_intmax_t=yes,
28 gt_cv_c_intmax_t=no)])
29 if test $gt_cv_c_intmax_t = yes; then
30 AC_DEFINE(HAVE_INTMAX_T, 1,
31 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
32 fi
33])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
new file mode 100644
index 00000000..17c7b0ae
--- /dev/null
+++ b/gl/m4/intmax_t.m4
@@ -0,0 +1,61 @@
1# intmax_t.m4 serial 5
2dnl Copyright (C) 1997-2004, 2006 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 Paul Eggert.
8
9AC_PREREQ(2.13)
10
11# Define intmax_t to 'long' or 'long long'
12# if it is not already defined in <stdint.h> or <inttypes.h>.
13
14AC_DEFUN([gl_AC_TYPE_INTMAX_T],
15[
16 dnl For simplicity, we assume that a header file defines 'intmax_t' if and
17 dnl only if it defines 'uintmax_t'.
18 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
19 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
20 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
21 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
22 test $ac_cv_type_long_long = yes \
23 && ac_type='long long' \
24 || ac_type='long'
25 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
26 [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
27 else
28 AC_DEFINE(HAVE_INTMAX_T, 1,
29 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
30 fi
31])
32
33dnl An alternative would be to explicitly test for 'intmax_t'.
34
35AC_DEFUN([gt_AC_TYPE_INTMAX_T],
36[
37 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
38 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
39 AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
40 [AC_TRY_COMPILE([
41#include <stddef.h>
42#include <stdlib.h>
43#if HAVE_STDINT_H_WITH_UINTMAX
44#include <stdint.h>
45#endif
46#if HAVE_INTTYPES_H_WITH_UINTMAX
47#include <inttypes.h>
48#endif
49], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
50 if test $gt_cv_c_intmax_t = yes; then
51 AC_DEFINE(HAVE_INTMAX_T, 1,
52 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
53 else
54 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
55 test $ac_cv_type_long_long = yes \
56 && ac_type='long long' \
57 || ac_type='long'
58 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
59 [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
60 fi
61])
diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4
new file mode 100644
index 00000000..7c7f8940
--- /dev/null
+++ b/gl/m4/inttypes-pri.m4
@@ -0,0 +1,36 @@
1# inttypes-pri.m4 serial 4 (gettext-0.16)
2dnl Copyright (C) 1997-2002, 2006 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
9AC_PREREQ(2.52)
10
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.
13
14AC_DEFUN([gt_INTTYPES_PRI],
15[
16 AC_CHECK_HEADERS([inttypes.h])
17 if test $ac_cv_header_inttypes_h = yes; then
18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
19 gt_cv_inttypes_pri_broken,
20 [
21 AC_TRY_COMPILE([#include <inttypes.h>
22#ifdef PRId32
23char *p = PRId32;
24#endif
25], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
26 ])
27 fi
28 if test "$gt_cv_inttypes_pri_broken" = yes; then
29 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
30 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
31 PRI_MACROS_BROKEN=1
32 else
33 PRI_MACROS_BROKEN=0
34 fi
35 AC_SUBST([PRI_MACROS_BROKEN])
36])
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4
new file mode 100644
index 00000000..edc8ecb2
--- /dev/null
+++ b/gl/m4/inttypes_h.m4
@@ -0,0 +1,26 @@
1# inttypes_h.m4 serial 7
2dnl Copyright (C) 1997-2004, 2006 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 Paul Eggert.
8
9# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
10# doesn't clash with <sys/types.h>, and declares uintmax_t.
11
12AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
13[
14 AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
15 [AC_TRY_COMPILE(
16 [#include <sys/types.h>
17#include <inttypes.h>],
18 [uintmax_t i = (uintmax_t) -1; return !i;],
19 gl_cv_header_inttypes_h=yes,
20 gl_cv_header_inttypes_h=no)])
21 if test $gl_cv_header_inttypes_h = yes; then
22 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
23 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
24 and declares uintmax_t. ])
25 fi
26])
diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4
new file mode 100644
index 00000000..19aa77e4
--- /dev/null
+++ b/gl/m4/lcmessage.m4
@@ -0,0 +1,30 @@
1# lcmessage.m4 serial 4 (gettext-0.14.2)
2dnl Copyright (C) 1995-2002, 2004-2005 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
18
19# Check whether LC_MESSAGES is available in <locale.h>.
20
21AC_DEFUN([gt_LC_MESSAGES],
22[
23 AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES,
24 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
25 gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)])
26 if test $gt_cv_val_LC_MESSAGES = yes; then
27 AC_DEFINE(HAVE_LC_MESSAGES, 1,
28 [Define if your <locale.h> file defines LC_MESSAGES.])
29 fi
30])
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
new file mode 100644
index 00000000..96c4e2c3
--- /dev/null
+++ b/gl/m4/lib-ld.m4
@@ -0,0 +1,110 @@
1# lib-ld.m4 serial 3 (gettext-0.13)
2dnl Copyright (C) 1996-2003 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 Subroutines of libtool.m4,
8dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
9dnl with libtool.m4.
10
11dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
12AC_DEFUN([AC_LIB_PROG_LD_GNU],
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.
15case `$LD -v 2>&1 </dev/null` in
16*GNU* | *'with BFD'*)
17 acl_cv_prog_gnu_ld=yes ;;
18*)
19 acl_cv_prog_gnu_ld=no ;;
20esac])
21with_gnu_ld=$acl_cv_prog_gnu_ld
22])
23
24dnl From libtool-1.4. Sets the variable LD.
25AC_DEFUN([AC_LIB_PROG_LD],
26[AC_ARG_WITH(gnu-ld,
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
31# Prepare PATH_SEPARATOR.
32# The user is always right.
33if test "${PATH_SEPARATOR+set}" != set; then
34 echo "#! /bin/sh" >conf$$.sh
35 echo "exit 0" >>conf$$.sh
36 chmod +x conf$$.sh
37 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
38 PATH_SEPARATOR=';'
39 else
40 PATH_SEPARATOR=:
41 fi
42 rm -f conf$$.sh
43fi
44ac_prog=ld
45if test "$GCC" = yes; then
46 # Check if gcc -print-prog-name=ld gives a path.
47 AC_MSG_CHECKING([for ld used by GCC])
48 case $host in
49 *-*-mingw*)
50 # gcc leaves a trailing carriage return which upsets mingw
51 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
52 *)
53 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
54 esac
55 case $ac_prog in
56 # Accept absolute paths.
57 [[\\/]* | [A-Za-z]:[\\/]*)]
58 [re_direlt='/[^/][^/]*/\.\./']
59 # Canonicalize the path of ld
60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
63 done
64 test -z "$LD" && LD="$ac_prog"
65 ;;
66 "")
67 # If it fails, then pretend we aren't using GCC.
68 ac_prog=ld
69 ;;
70 *)
71 # If it is relative, then search for the first ld in PATH.
72 with_gnu_ld=unknown
73 ;;
74 esac
75elif test "$with_gnu_ld" = yes; then
76 AC_MSG_CHECKING([for GNU ld])
77else
78 AC_MSG_CHECKING([for non-GNU ld])
79fi
80AC_CACHE_VAL(acl_cv_path_LD,
81[if test -z "$LD"; then
82 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
83 for ac_dir in $PATH; do
84 test -z "$ac_dir" && ac_dir=.
85 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"
87 # Check to see if the program is GNU ld. I'd rather use --version,
88 # but apparently some GNU ld's only accept -v.
89 # 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
91 *GNU* | *'with BFD'*)
92 test "$with_gnu_ld" != no && break ;;
93 *)
94 test "$with_gnu_ld" != yes && break ;;
95 esac
96 fi
97 done
98 IFS="$ac_save_ifs"
99else
100 acl_cv_path_LD="$LD" # Let the user override the test with a path.
101fi])
102LD="$acl_cv_path_LD"
103if test -n "$LD"; then
104 AC_MSG_RESULT($LD)
105else
106 AC_MSG_RESULT(no)
107fi
108test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
109AC_LIB_PROG_LD_GNU
110])
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
new file mode 100644
index 00000000..f157d983
--- /dev/null
+++ b/gl/m4/lib-link.m4
@@ -0,0 +1,709 @@
1# lib-link.m4 serial 13 (gettext-0.16.2)
2dnl Copyright (C) 2001-2007 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
9AC_PREREQ(2.54)
10
11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12dnl the libraries corresponding to explicit and implicit dependencies.
13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
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.
17AC_DEFUN([AC_LIB_LINKFLAGS],
18[
19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20 AC_REQUIRE([AC_LIB_RPATH])
21 define([Name],[translit([$1],[./-], [___])])
22 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
23 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
24 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
25 AC_LIB_LINKFLAGS_BODY([$1], [$2])
26 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
27 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
28 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
29 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
30 ])
31 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
32 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
33 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
34 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
36 AC_SUBST([LIB]NAME)
37 AC_SUBST([LTLIB]NAME)
38 AC_SUBST([LIB]NAME[_PREFIX])
39 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
40 dnl results of this search when this library appears as a dependency.
41 HAVE_LIB[]NAME=yes
42 undefine([Name])
43 undefine([NAME])
44])
45
46dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
47dnl searches for libname and the libraries corresponding to explicit and
48dnl implicit dependencies, together with the specified include files and
49dnl the ability to compile and link the specified testcode. If found, it
50dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
51dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
52dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
53dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
54dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
55dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
56AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
57[
58 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
59 AC_REQUIRE([AC_LIB_RPATH])
60 define([Name],[translit([$1],[./-], [___])])
61 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
62 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
63
64 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
65 dnl accordingly.
66 AC_LIB_LINKFLAGS_BODY([$1], [$2])
67
68 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
69 dnl because if the user has installed lib[]Name and not disabled its use
70 dnl via --without-lib[]Name-prefix, he wants to use it.
71 ac_save_CPPFLAGS="$CPPFLAGS"
72 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
73
74 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
75 ac_save_LIBS="$LIBS"
76 LIBS="$LIBS $LIB[]NAME"
77 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
78 LIBS="$ac_save_LIBS"
79 ])
80 if test "$ac_cv_lib[]Name" = yes; then
81 HAVE_LIB[]NAME=yes
82 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
83 AC_MSG_CHECKING([how to link with lib[]$1])
84 AC_MSG_RESULT([$LIB[]NAME])
85 else
86 HAVE_LIB[]NAME=no
87 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
88 dnl $INC[]NAME either.
89 CPPFLAGS="$ac_save_CPPFLAGS"
90 LIB[]NAME=
91 LTLIB[]NAME=
92 LIB[]NAME[]_PREFIX=
93 fi
94 AC_SUBST([HAVE_LIB]NAME)
95 AC_SUBST([LIB]NAME)
96 AC_SUBST([LTLIB]NAME)
97 AC_SUBST([LIB]NAME[_PREFIX])
98 undefine([Name])
99 undefine([NAME])
100])
101
102dnl Determine the platform dependent parameters needed to use rpath:
103dnl acl_libext,
104dnl acl_shlibext,
105dnl acl_hardcode_libdir_flag_spec,
106dnl acl_hardcode_libdir_separator,
107dnl acl_hardcode_direct,
108dnl acl_hardcode_minus_L.
109AC_DEFUN([AC_LIB_RPATH],
110[
111 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
112 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
113 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
114 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
115 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
116 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
117 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
118 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
119 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
120 . ./conftest.sh
121 rm -f ./conftest.sh
122 acl_cv_rpath=done
123 ])
124 wl="$acl_cv_wl"
125 acl_libext="$acl_cv_libext"
126 acl_shlibext="$acl_cv_shlibext"
127 acl_libname_spec="$acl_cv_libname_spec"
128 acl_library_names_spec="$acl_cv_library_names_spec"
129 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
130 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
131 acl_hardcode_direct="$acl_cv_hardcode_direct"
132 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
133 dnl Determine whether the user wants rpath handling at all.
134 AC_ARG_ENABLE(rpath,
135 [ --disable-rpath do not hardcode runtime library paths],
136 :, enable_rpath=yes)
137])
138
139dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
140dnl the libraries corresponding to explicit and implicit dependencies.
141dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
142dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
143dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
144AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
145[
146 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
147 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
148 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
149 dnl Autoconf >= 2.61 supports dots in --with options.
150 define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
151 dnl By default, look in $includedir and $libdir.
152 use_additional=yes
153 AC_LIB_WITH_FINAL_PREFIX([
154 eval additional_includedir=\"$includedir\"
155 eval additional_libdir=\"$libdir\"
156 ])
157 AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
158[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
159 --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
160[
161 if test "X$withval" = "Xno"; then
162 use_additional=no
163 else
164 if test "X$withval" = "X"; then
165 AC_LIB_WITH_FINAL_PREFIX([
166 eval additional_includedir=\"$includedir\"
167 eval additional_libdir=\"$libdir\"
168 ])
169 else
170 additional_includedir="$withval/include"
171 additional_libdir="$withval/$acl_libdirstem"
172 fi
173 fi
174])
175 dnl Search the library and its dependencies in $additional_libdir and
176 dnl $LDFLAGS. Using breadth-first-seach.
177 LIB[]NAME=
178 LTLIB[]NAME=
179 INC[]NAME=
180 LIB[]NAME[]_PREFIX=
181 rpathdirs=
182 ltrpathdirs=
183 names_already_handled=
184 names_next_round='$1 $2'
185 while test -n "$names_next_round"; do
186 names_this_round="$names_next_round"
187 names_next_round=
188 for name in $names_this_round; do
189 already_handled=
190 for n in $names_already_handled; do
191 if test "$n" = "$name"; then
192 already_handled=yes
193 break
194 fi
195 done
196 if test -z "$already_handled"; then
197 names_already_handled="$names_already_handled $name"
198 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
199 dnl or AC_LIB_HAVE_LINKFLAGS call.
200 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
201 eval value=\"\$HAVE_LIB$uppername\"
202 if test -n "$value"; then
203 if test "$value" = yes; then
204 eval value=\"\$LIB$uppername\"
205 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
206 eval value=\"\$LTLIB$uppername\"
207 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
208 else
209 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
210 dnl that this library doesn't exist. So just drop it.
211 :
212 fi
213 else
214 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
215 dnl and the already constructed $LIBNAME/$LTLIBNAME.
216 found_dir=
217 found_la=
218 found_so=
219 found_a=
220 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
221 if test -n "$acl_shlibext"; then
222 shrext=".$acl_shlibext" # typically: shrext=.so
223 else
224 shrext=
225 fi
226 if test $use_additional = yes; then
227 dir="$additional_libdir"
228 dnl The same code as in the loop below:
229 dnl First look for a shared library.
230 if test -n "$acl_shlibext"; then
231 if test -f "$dir/$libname$shrext"; then
232 found_dir="$dir"
233 found_so="$dir/$libname$shrext"
234 else
235 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
236 ver=`(cd "$dir" && \
237 for f in "$libname$shrext".*; do echo "$f"; done \
238 | sed -e "s,^$libname$shrext\\\\.,," \
239 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
240 | sed 1q ) 2>/dev/null`
241 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
242 found_dir="$dir"
243 found_so="$dir/$libname$shrext.$ver"
244 fi
245 else
246 eval library_names=\"$acl_library_names_spec\"
247 for f in $library_names; do
248 if test -f "$dir/$f"; then
249 found_dir="$dir"
250 found_so="$dir/$f"
251 break
252 fi
253 done
254 fi
255 fi
256 fi
257 dnl Then look for a static library.
258 if test "X$found_dir" = "X"; then
259 if test -f "$dir/$libname.$acl_libext"; then
260 found_dir="$dir"
261 found_a="$dir/$libname.$acl_libext"
262 fi
263 fi
264 if test "X$found_dir" != "X"; then
265 if test -f "$dir/$libname.la"; then
266 found_la="$dir/$libname.la"
267 fi
268 fi
269 fi
270 if test "X$found_dir" = "X"; then
271 for x in $LDFLAGS $LTLIB[]NAME; do
272 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
273 case "$x" in
274 -L*)
275 dir=`echo "X$x" | sed -e 's/^X-L//'`
276 dnl First look for a shared library.
277 if test -n "$acl_shlibext"; then
278 if test -f "$dir/$libname$shrext"; then
279 found_dir="$dir"
280 found_so="$dir/$libname$shrext"
281 else
282 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
283 ver=`(cd "$dir" && \
284 for f in "$libname$shrext".*; do echo "$f"; done \
285 | sed -e "s,^$libname$shrext\\\\.,," \
286 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
287 | sed 1q ) 2>/dev/null`
288 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
289 found_dir="$dir"
290 found_so="$dir/$libname$shrext.$ver"
291 fi
292 else
293 eval library_names=\"$acl_library_names_spec\"
294 for f in $library_names; do
295 if test -f "$dir/$f"; then
296 found_dir="$dir"
297 found_so="$dir/$f"
298 break
299 fi
300 done
301 fi
302 fi
303 fi
304 dnl Then look for a static library.
305 if test "X$found_dir" = "X"; then
306 if test -f "$dir/$libname.$acl_libext"; then
307 found_dir="$dir"
308 found_a="$dir/$libname.$acl_libext"
309 fi
310 fi
311 if test "X$found_dir" != "X"; then
312 if test -f "$dir/$libname.la"; then
313 found_la="$dir/$libname.la"
314 fi
315 fi
316 ;;
317 esac
318 if test "X$found_dir" != "X"; then
319 break
320 fi
321 done
322 fi
323 if test "X$found_dir" != "X"; then
324 dnl Found the library.
325 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
326 if test "X$found_so" != "X"; then
327 dnl Linking with a shared library. We attempt to hardcode its
328 dnl directory into the executable's runpath, unless it's the
329 dnl standard /usr/lib.
330 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
331 dnl No hardcoding is needed.
332 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
333 else
334 dnl Use an explicit option to hardcode DIR into the resulting
335 dnl binary.
336 dnl Potentially add DIR to ltrpathdirs.
337 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
338 haveit=
339 for x in $ltrpathdirs; do
340 if test "X$x" = "X$found_dir"; then
341 haveit=yes
342 break
343 fi
344 done
345 if test -z "$haveit"; then
346 ltrpathdirs="$ltrpathdirs $found_dir"
347 fi
348 dnl The hardcoding into $LIBNAME is system dependent.
349 if test "$acl_hardcode_direct" = yes; then
350 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
351 dnl resulting binary.
352 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
353 else
354 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
355 dnl Use an explicit option to hardcode DIR into the resulting
356 dnl binary.
357 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
358 dnl Potentially add DIR to rpathdirs.
359 dnl The rpathdirs will be appended to $LIBNAME at the end.
360 haveit=
361 for x in $rpathdirs; do
362 if test "X$x" = "X$found_dir"; then
363 haveit=yes
364 break
365 fi
366 done
367 if test -z "$haveit"; then
368 rpathdirs="$rpathdirs $found_dir"
369 fi
370 else
371 dnl Rely on "-L$found_dir".
372 dnl But don't add it if it's already contained in the LDFLAGS
373 dnl or the already constructed $LIBNAME
374 haveit=
375 for x in $LDFLAGS $LIB[]NAME; do
376 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
377 if test "X$x" = "X-L$found_dir"; then
378 haveit=yes
379 break
380 fi
381 done
382 if test -z "$haveit"; then
383 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
384 fi
385 if test "$acl_hardcode_minus_L" != no; then
386 dnl FIXME: Not sure whether we should use
387 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
388 dnl here.
389 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
390 else
391 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
392 dnl here, because this doesn't fit in flags passed to the
393 dnl compiler. So give up. No hardcoding. This affects only
394 dnl very old systems.
395 dnl FIXME: Not sure whether we should use
396 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
397 dnl here.
398 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
399 fi
400 fi
401 fi
402 fi
403 else
404 if test "X$found_a" != "X"; then
405 dnl Linking with a static library.
406 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
407 else
408 dnl We shouldn't come here, but anyway it's good to have a
409 dnl fallback.
410 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
411 fi
412 fi
413 dnl Assume the include files are nearby.
414 additional_includedir=
415 case "$found_dir" in
416 */$acl_libdirstem | */$acl_libdirstem/)
417 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
418 LIB[]NAME[]_PREFIX="$basedir"
419 additional_includedir="$basedir/include"
420 ;;
421 esac
422 if test "X$additional_includedir" != "X"; then
423 dnl Potentially add $additional_includedir to $INCNAME.
424 dnl But don't add it
425 dnl 1. if it's the standard /usr/include,
426 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
427 dnl 3. if it's already present in $CPPFLAGS or the already
428 dnl constructed $INCNAME,
429 dnl 4. if it doesn't exist as a directory.
430 if test "X$additional_includedir" != "X/usr/include"; then
431 haveit=
432 if test "X$additional_includedir" = "X/usr/local/include"; then
433 if test -n "$GCC"; then
434 case $host_os in
435 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
436 esac
437 fi
438 fi
439 if test -z "$haveit"; then
440 for x in $CPPFLAGS $INC[]NAME; do
441 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
442 if test "X$x" = "X-I$additional_includedir"; then
443 haveit=yes
444 break
445 fi
446 done
447 if test -z "$haveit"; then
448 if test -d "$additional_includedir"; then
449 dnl Really add $additional_includedir to $INCNAME.
450 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
451 fi
452 fi
453 fi
454 fi
455 fi
456 dnl Look for dependencies.
457 if test -n "$found_la"; then
458 dnl Read the .la file. It defines the variables
459 dnl dlname, library_names, old_library, dependency_libs, current,
460 dnl age, revision, installed, dlopen, dlpreopen, libdir.
461 save_libdir="$libdir"
462 case "$found_la" in
463 */* | *\\*) . "$found_la" ;;
464 *) . "./$found_la" ;;
465 esac
466 libdir="$save_libdir"
467 dnl We use only dependency_libs.
468 for dep in $dependency_libs; do
469 case "$dep" in
470 -L*)
471 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
472 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
473 dnl But don't add it
474 dnl 1. if it's the standard /usr/lib,
475 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
476 dnl 3. if it's already present in $LDFLAGS or the already
477 dnl constructed $LIBNAME,
478 dnl 4. if it doesn't exist as a directory.
479 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
480 haveit=
481 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
482 if test -n "$GCC"; then
483 case $host_os in
484 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
485 esac
486 fi
487 fi
488 if test -z "$haveit"; then
489 haveit=
490 for x in $LDFLAGS $LIB[]NAME; do
491 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
492 if test "X$x" = "X-L$additional_libdir"; then
493 haveit=yes
494 break
495 fi
496 done
497 if test -z "$haveit"; then
498 if test -d "$additional_libdir"; then
499 dnl Really add $additional_libdir to $LIBNAME.
500 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
501 fi
502 fi
503 haveit=
504 for x in $LDFLAGS $LTLIB[]NAME; do
505 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
506 if test "X$x" = "X-L$additional_libdir"; then
507 haveit=yes
508 break
509 fi
510 done
511 if test -z "$haveit"; then
512 if test -d "$additional_libdir"; then
513 dnl Really add $additional_libdir to $LTLIBNAME.
514 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
515 fi
516 fi
517 fi
518 fi
519 ;;
520 -R*)
521 dir=`echo "X$dep" | sed -e 's/^X-R//'`
522 if test "$enable_rpath" != no; then
523 dnl Potentially add DIR to rpathdirs.
524 dnl The rpathdirs will be appended to $LIBNAME at the end.
525 haveit=
526 for x in $rpathdirs; do
527 if test "X$x" = "X$dir"; then
528 haveit=yes
529 break
530 fi
531 done
532 if test -z "$haveit"; then
533 rpathdirs="$rpathdirs $dir"
534 fi
535 dnl Potentially add DIR to ltrpathdirs.
536 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
537 haveit=
538 for x in $ltrpathdirs; do
539 if test "X$x" = "X$dir"; then
540 haveit=yes
541 break
542 fi
543 done
544 if test -z "$haveit"; then
545 ltrpathdirs="$ltrpathdirs $dir"
546 fi
547 fi
548 ;;
549 -l*)
550 dnl Handle this in the next round.
551 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
552 ;;
553 *.la)
554 dnl Handle this in the next round. Throw away the .la's
555 dnl directory; it is already contained in a preceding -L
556 dnl option.
557 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
558 ;;
559 *)
560 dnl Most likely an immediate library name.
561 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
562 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
563 ;;
564 esac
565 done
566 fi
567 else
568 dnl Didn't find the library; assume it is in the system directories
569 dnl known to the linker and runtime loader. (All the system
570 dnl directories known to the linker should also be known to the
571 dnl runtime loader, otherwise the system is severely misconfigured.)
572 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
573 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
574 fi
575 fi
576 fi
577 done
578 done
579 if test "X$rpathdirs" != "X"; then
580 if test -n "$acl_hardcode_libdir_separator"; then
581 dnl Weird platform: only the last -rpath option counts, the user must
582 dnl pass all path elements in one option. We can arrange that for a
583 dnl single library, but not when more than one $LIBNAMEs are used.
584 alldirs=
585 for found_dir in $rpathdirs; do
586 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
587 done
588 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
589 acl_save_libdir="$libdir"
590 libdir="$alldirs"
591 eval flag=\"$acl_hardcode_libdir_flag_spec\"
592 libdir="$acl_save_libdir"
593 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
594 else
595 dnl The -rpath options are cumulative.
596 for found_dir in $rpathdirs; do
597 acl_save_libdir="$libdir"
598 libdir="$found_dir"
599 eval flag=\"$acl_hardcode_libdir_flag_spec\"
600 libdir="$acl_save_libdir"
601 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
602 done
603 fi
604 fi
605 if test "X$ltrpathdirs" != "X"; then
606 dnl When using libtool, the option that works for both libraries and
607 dnl executables is -R. The -R options are cumulative.
608 for found_dir in $ltrpathdirs; do
609 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
610 done
611 fi
612])
613
614dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
615dnl unless already present in VAR.
616dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
617dnl contains two or three consecutive elements that belong together.
618AC_DEFUN([AC_LIB_APPENDTOVAR],
619[
620 for element in [$2]; do
621 haveit=
622 for x in $[$1]; do
623 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
624 if test "X$x" = "X$element"; then
625 haveit=yes
626 break
627 fi
628 done
629 if test -z "$haveit"; then
630 [$1]="${[$1]}${[$1]:+ }$element"
631 fi
632 done
633])
634
635dnl For those cases where a variable contains several -L and -l options
636dnl referring to unknown libraries and directories, this macro determines the
637dnl necessary additional linker options for the runtime path.
638dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
639dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
640dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
641dnl otherwise linking without libtool is assumed.
642AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
643[
644 AC_REQUIRE([AC_LIB_RPATH])
645 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
646 $1=
647 if test "$enable_rpath" != no; then
648 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
649 dnl Use an explicit option to hardcode directories into the resulting
650 dnl binary.
651 rpathdirs=
652 next=
653 for opt in $2; do
654 if test -n "$next"; then
655 dir="$next"
656 dnl No need to hardcode the standard /usr/lib.
657 if test "X$dir" != "X/usr/$acl_libdirstem"; then
658 rpathdirs="$rpathdirs $dir"
659 fi
660 next=
661 else
662 case $opt in
663 -L) next=yes ;;
664 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
665 dnl No need to hardcode the standard /usr/lib.
666 if test "X$dir" != "X/usr/$acl_libdirstem"; then
667 rpathdirs="$rpathdirs $dir"
668 fi
669 next= ;;
670 *) next= ;;
671 esac
672 fi
673 done
674 if test "X$rpathdirs" != "X"; then
675 if test -n ""$3""; then
676 dnl libtool is used for linking. Use -R options.
677 for dir in $rpathdirs; do
678 $1="${$1}${$1:+ }-R$dir"
679 done
680 else
681 dnl The linker is used for linking directly.
682 if test -n "$acl_hardcode_libdir_separator"; then
683 dnl Weird platform: only the last -rpath option counts, the user
684 dnl must pass all path elements in one option.
685 alldirs=
686 for dir in $rpathdirs; do
687 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
688 done
689 acl_save_libdir="$libdir"
690 libdir="$alldirs"
691 eval flag=\"$acl_hardcode_libdir_flag_spec\"
692 libdir="$acl_save_libdir"
693 $1="$flag"
694 else
695 dnl The -rpath options are cumulative.
696 for dir in $rpathdirs; do
697 acl_save_libdir="$libdir"
698 libdir="$dir"
699 eval flag=\"$acl_hardcode_libdir_flag_spec\"
700 libdir="$acl_save_libdir"
701 $1="${$1}${$1:+ }$flag"
702 done
703 fi
704 fi
705 fi
706 fi
707 fi
708 AC_SUBST([$1])
709])
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4
new file mode 100644
index 00000000..a8684e17
--- /dev/null
+++ b/gl/m4/lib-prefix.m4
@@ -0,0 +1,185 @@
1# lib-prefix.m4 serial 5 (gettext-0.15)
2dnl Copyright (C) 2001-2005 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 AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
10dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
11dnl require excessive bracketing.
12ifdef([AC_HELP_STRING],
13[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
14[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
15
16dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
17dnl to access previously installed libraries. The basic assumption is that
18dnl a user will want packages to use other packages he previously installed
19dnl with the same --prefix option.
20dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
21dnl libraries, but is otherwise very convenient.
22AC_DEFUN([AC_LIB_PREFIX],
23[
24 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
25 AC_REQUIRE([AC_PROG_CC])
26 AC_REQUIRE([AC_CANONICAL_HOST])
27 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
28 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
29 dnl By default, look in $includedir and $libdir.
30 use_additional=yes
31 AC_LIB_WITH_FINAL_PREFIX([
32 eval additional_includedir=\"$includedir\"
33 eval additional_libdir=\"$libdir\"
34 ])
35 AC_LIB_ARG_WITH([lib-prefix],
36[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
37 --without-lib-prefix don't search for libraries in includedir and libdir],
38[
39 if test "X$withval" = "Xno"; then
40 use_additional=no
41 else
42 if test "X$withval" = "X"; then
43 AC_LIB_WITH_FINAL_PREFIX([
44 eval additional_includedir=\"$includedir\"
45 eval additional_libdir=\"$libdir\"
46 ])
47 else
48 additional_includedir="$withval/include"
49 additional_libdir="$withval/$acl_libdirstem"
50 fi
51 fi
52])
53 if test $use_additional = yes; then
54 dnl Potentially add $additional_includedir to $CPPFLAGS.
55 dnl But don't add it
56 dnl 1. if it's the standard /usr/include,
57 dnl 2. if it's already present in $CPPFLAGS,
58 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
59 dnl 4. if it doesn't exist as a directory.
60 if test "X$additional_includedir" != "X/usr/include"; then
61 haveit=
62 for x in $CPPFLAGS; do
63 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
64 if test "X$x" = "X-I$additional_includedir"; then
65 haveit=yes
66 break
67 fi
68 done
69 if test -z "$haveit"; then
70 if test "X$additional_includedir" = "X/usr/local/include"; then
71 if test -n "$GCC"; then
72 case $host_os in
73 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
74 esac
75 fi
76 fi
77 if test -z "$haveit"; then
78 if test -d "$additional_includedir"; then
79 dnl Really add $additional_includedir to $CPPFLAGS.
80 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
81 fi
82 fi
83 fi
84 fi
85 dnl Potentially add $additional_libdir to $LDFLAGS.
86 dnl But don't add it
87 dnl 1. if it's the standard /usr/lib,
88 dnl 2. if it's already present in $LDFLAGS,
89 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
90 dnl 4. if it doesn't exist as a directory.
91 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
92 haveit=
93 for x in $LDFLAGS; do
94 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
95 if test "X$x" = "X-L$additional_libdir"; then
96 haveit=yes
97 break
98 fi
99 done
100 if test -z "$haveit"; then
101 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
102 if test -n "$GCC"; then
103 case $host_os in
104 linux*) haveit=yes;;
105 esac
106 fi
107 fi
108 if test -z "$haveit"; then
109 if test -d "$additional_libdir"; then
110 dnl Really add $additional_libdir to $LDFLAGS.
111 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
112 fi
113 fi
114 fi
115 fi
116 fi
117])
118
119dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
120dnl acl_final_exec_prefix, containing the values to which $prefix and
121dnl $exec_prefix will expand at the end of the configure script.
122AC_DEFUN([AC_LIB_PREPARE_PREFIX],
123[
124 dnl Unfortunately, prefix and exec_prefix get only finally determined
125 dnl at the end of configure.
126 if test "X$prefix" = "XNONE"; then
127 acl_final_prefix="$ac_default_prefix"
128 else
129 acl_final_prefix="$prefix"
130 fi
131 if test "X$exec_prefix" = "XNONE"; then
132 acl_final_exec_prefix='${prefix}'
133 else
134 acl_final_exec_prefix="$exec_prefix"
135 fi
136 acl_save_prefix="$prefix"
137 prefix="$acl_final_prefix"
138 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
139 prefix="$acl_save_prefix"
140])
141
142dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
143dnl variables prefix and exec_prefix bound to the values they will have
144dnl at the end of the configure script.
145AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
146[
147 acl_save_prefix="$prefix"
148 prefix="$acl_final_prefix"
149 acl_save_exec_prefix="$exec_prefix"
150 exec_prefix="$acl_final_exec_prefix"
151 $1
152 exec_prefix="$acl_save_exec_prefix"
153 prefix="$acl_save_prefix"
154])
155
156dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
157dnl the basename of the libdir, either "lib" or "lib64".
158AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
159[
160 dnl There is no formal standard regarding lib and lib64. The current
161 dnl practice is that on a system supporting 32-bit and 64-bit instruction
162 dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
163 dnl libraries go under $prefix/lib. We determine the compiler's default
164 dnl mode by looking at the compiler's library search path. If at least
165 dnl of its elements ends in /lib64 or points to a directory whose absolute
166 dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
167 dnl default, namely "lib".
168 acl_libdirstem=lib
169 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
170 if test -n "$searchpath"; then
171 acl_save_IFS="${IFS= }"; IFS=":"
172 for searchdir in $searchpath; do
173 if test -d "$searchdir"; then
174 case "$searchdir" in
175 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
176 *) searchdir=`cd "$searchdir" && pwd`
177 case "$searchdir" in
178 */lib64 ) acl_libdirstem=lib64 ;;
179 esac ;;
180 esac
181 fi
182 done
183 IFS="$acl_save_IFS"
184 fi
185])
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
new file mode 100644
index 00000000..0224f2ff
--- /dev/null
+++ b/gl/m4/lock.m4
@@ -0,0 +1,311 @@
1# lock.m4 serial 6 (gettext-0.16)
2dnl Copyright (C) 2005-2006 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 Tests for a multithreading library to be used.
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[
79 AC_REQUIRE([gl_LOCK_EARLY_BODY])
80 gl_threads_api=none
81 LIBTHREAD=
82 LTLIBTHREAD=
83 LIBMULTITHREAD=
84 LTLIBMULTITHREAD=
85 if test "$gl_use_threads" != no; then
86 dnl Check whether the compiler and linker support weak declarations.
87 AC_MSG_CHECKING([whether imported symbols can be declared weak])
88 gl_have_weak=no
89 AC_TRY_LINK([extern void xyzzy ();
90#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes])
91 AC_MSG_RESULT([$gl_have_weak])
92 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
93 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
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."
162#else
163int x = (int)PTHREAD_MUTEX_RECURSIVE;
164return !x;
165#endif],
166 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
167 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
168 fi
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
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
253])
254
255# Prerequisites of lib/lock.c.
256AC_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/gl/m4/longdouble.m4 b/gl/m4/longdouble.m4
new file mode 100644
index 00000000..25590f47
--- /dev/null
+++ b/gl/m4/longdouble.m4
@@ -0,0 +1,31 @@
1# longdouble.m4 serial 2 (gettext-0.15)
2dnl Copyright (C) 2002-2003, 2006 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.
8dnl Test whether the compiler supports the 'long double' type.
9dnl Prerequisite: AC_PROG_CC
10
11dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
12dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
13
14AC_DEFUN([gt_TYPE_LONGDOUBLE],
15[
16 AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
17 [if test "$GCC" = yes; then
18 gt_cv_c_long_double=yes
19 else
20 AC_TRY_COMPILE([
21 /* The Stardent Vistra knows sizeof(long double), but does not support it. */
22 long double foo = 0.0;
23 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
24 int array [2*(sizeof(long double) >= sizeof(double)) - 1];
25 ], ,
26 gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
27 fi])
28 if test $gt_cv_c_long_double = yes; then
29 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
30 fi
31])
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
new file mode 100644
index 00000000..1f9e862e
--- /dev/null
+++ b/gl/m4/longlong.m4
@@ -0,0 +1,72 @@
1# longlong.m4 serial 10
2dnl Copyright (C) 1999-2006 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 Paul Eggert.
8
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
11# assume 2.61 everywhere.
12
13# Note: If the type 'long long int' exists but is only 32 bits large
14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
15# defined. In this case you can treat 'long long int' like 'long int'.
16
17AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE(
21 [AC_LANG_PROGRAM(
22 [[long long int ll = 9223372036854775807ll;
23 long long int nll = -9223372036854775807LL;
24 typedef int a[((-9223372036854775807LL < 0
25 && 0 < 9223372036854775807ll)
26 ? 1 : -1)];
27 int i = 63;]],
28 [[long long int llmax = 9223372036854775807ll;
29 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
30 | (llmax / ll) | (llmax % ll));]])],
31 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
32 dnl If cross compiling, assume the bug isn't important, since
33 dnl nobody cross compiles for this platform as far as we know.
34 AC_RUN_IFELSE(
35 [AC_LANG_PROGRAM(
36 [[@%:@include <limits.h>
37 @%:@ifndef LLONG_MAX
38 @%:@ define HALF \
39 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
40 @%:@ define LLONG_MAX (HALF - 1 + HALF)
41 @%:@endif]],
42 [[long long int n = 1;
43 int i;
44 for (i = 0; ; i++)
45 {
46 long long int m = n << i;
47 if (m >> i != n)
48 return 1;
49 if (LLONG_MAX / 2 < m)
50 break;
51 }
52 return 0;]])],
53 [ac_cv_type_long_long_int=yes],
54 [ac_cv_type_long_long_int=no],
55 [ac_cv_type_long_long_int=yes])],
56 [ac_cv_type_long_long_int=no])])
57 if test $ac_cv_type_long_long_int = yes; then
58 AC_DEFINE([HAVE_LONG_LONG_INT], 1,
59 [Define to 1 if the system has the type `long long int'.])
60 fi
61])
62
63# This macro is obsolescent and should go away soon.
64AC_DEFUN([gl_AC_TYPE_LONG_LONG],
65[
66 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
67 ac_cv_type_long_long=$ac_cv_type_long_long_int
68 if test $ac_cv_type_long_long = yes; then
69 AC_DEFINE(HAVE_LONG_LONG, 1,
70 [Define if you have the 'long long' type.])
71 fi
72])
diff --git a/gl/m4/ls-mntd-fs.m4 b/gl/m4/ls-mntd-fs.m4
new file mode 100644
index 00000000..21ac4e74
--- /dev/null
+++ b/gl/m4/ls-mntd-fs.m4
@@ -0,0 +1,337 @@
1#serial 26
2# How to list mounted file systems.
3
4# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
5# Foundation, Inc.
6#
7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11dnl From Jim Meyering.
12dnl
13dnl This is not pretty. I've just taken the autoconf code and wrapped
14dnl it in an AC_DEFUN and made some other fixes.
15dnl
16
17# Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf
18# through Autoconf 2.59. We can remove this once we assume Autoconf 2.60
19# or later.
20AC_DEFUN([AC_FUNC_GETMNTENT],
21[# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4,
22# -lseq on Dynix/PTX, -lgen on Unixware.
23AC_SEARCH_LIBS(getmntent, [sun seq gen])
24AC_CHECK_FUNCS(getmntent)
25])
26
27# gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
28AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
29 [
30AC_CHECK_FUNCS(listmntent getmntinfo)
31AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h)
32
33# We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
34# NGROUPS (as the array dimension for a struct member) without a definition.
35AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
36
37AC_CHECK_HEADERS(sys/mount.h, [], [],
38 [AC_INCLUDES_DEFAULT
39 [#if HAVE_SYS_PARAM_H
40 #include <sys/param.h>
41 #endif]])
42
43AC_CHECK_HEADERS(mntent.h sys/fs_types.h)
44 getfsstat_includes="\
45$ac_includes_default
46#if HAVE_SYS_PARAM_H
47# include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
48#endif
49#if HAVE_SYS_UCRED_H
50# include <grp.h> /* needed for definition of NGROUPS */
51# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
52#endif
53#if HAVE_SYS_MOUNT_H
54# include <sys/mount.h>
55#endif
56#if HAVE_SYS_FS_TYPES_H
57# include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
58#endif
59"
60AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
61
62# Determine how to get the list of mounted file systems.
63ac_list_mounted_fs=
64
65# If the getmntent function is available but not in the standard library,
66# make sure LIBS contains the appropriate -l option.
67AC_FUNC_GETMNTENT
68
69# This test must precede the ones for getmntent because Unicos-9 is
70# reported to have the getmntent function, but its support is incompatible
71# with other getmntent implementations.
72
73# NOTE: Normally, I wouldn't use a check for system type as I've done for
74# `CRAY' below since that goes against the whole autoconf philosophy. But
75# I think there is too great a chance that some non-Cray system has a
76# function named listmntent to risk the false positive.
77
78if test -z "$ac_list_mounted_fs"; then
79 # Cray UNICOS 9
80 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
81 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
82 [fu_cv_sys_mounted_cray_listmntent=no
83 AC_EGREP_CPP(yes,
84 [#ifdef _CRAY
85yes
86#endif
87 ], [test $ac_cv_func_listmntent = yes \
88 && fu_cv_sys_mounted_cray_listmntent=yes]
89 )
90 ]
91 )
92 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
93 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
94 ac_list_mounted_fs=found
95 AC_DEFINE(MOUNTED_LISTMNTENT, 1,
96 [Define if there is a function named listmntent that can be used to
97 list all mounted file systems. (UNICOS)])
98 fi
99fi
100
101if test -z "$ac_list_mounted_fs"; then
102 # AIX.
103 AC_MSG_CHECKING([for mntctl function and struct vmount])
104 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
105 [AC_TRY_CPP([#include <fshelp.h>],
106 fu_cv_sys_mounted_vmount=yes,
107 fu_cv_sys_mounted_vmount=no)])
108 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
109 if test $fu_cv_sys_mounted_vmount = yes; then
110 ac_list_mounted_fs=found
111 AC_DEFINE(MOUNTED_VMOUNT, 1,
112 [Define if there is a function named mntctl that can be used to read
113 the list of mounted file systems, and there is a system header file
114 that declares `struct vmount.' (AIX)])
115 fi
116fi
117
118if test $ac_cv_func_getmntent = yes; then
119
120 # This system has the getmntent function.
121 # Determine whether it's the one-argument variant or the two-argument one.
122
123 if test -z "$ac_list_mounted_fs"; then
124 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
125 AC_MSG_CHECKING([for one-argument getmntent function])
126 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
127 [AC_TRY_COMPILE([
128/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
129#include <stdio.h>
130
131#include <mntent.h>
132#if !defined MOUNTED
133# if defined _PATH_MOUNTED /* GNU libc */
134# define MOUNTED _PATH_MOUNTED
135# endif
136# if defined MNT_MNTTAB /* HP-UX. */
137# define MOUNTED MNT_MNTTAB
138# endif
139# if defined MNTTABNAME /* Dynix. */
140# define MOUNTED MNTTABNAME
141# endif
142#endif
143],
144 [ struct mntent *mnt = 0; char *table = MOUNTED;
145 if (sizeof mnt && sizeof table) return 0;],
146 fu_cv_sys_mounted_getmntent1=yes,
147 fu_cv_sys_mounted_getmntent1=no)])
148 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
149 if test $fu_cv_sys_mounted_getmntent1 = yes; then
150 ac_list_mounted_fs=found
151 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
152 [Define if there is a function named getmntent for reading the list
153 of mounted file systems, and that function takes a single argument.
154 (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
155 fi
156 fi
157
158 if test -z "$ac_list_mounted_fs"; then
159 # SVR4
160 AC_MSG_CHECKING([for two-argument getmntent function])
161 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
162 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
163 fu_cv_sys_mounted_getmntent2=yes,
164 fu_cv_sys_mounted_getmntent2=no)])
165 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
166 if test $fu_cv_sys_mounted_getmntent2 = yes; then
167 ac_list_mounted_fs=found
168 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
169 [Define if there is a function named getmntent for reading the list of
170 mounted file systems, and that function takes two arguments. (SVR4)])
171 AC_CHECK_FUNCS(hasmntopt)
172 fi
173 fi
174
175fi
176
177if test -z "$ac_list_mounted_fs"; then
178 # DEC Alpha running OSF/1, and Apple Darwin 1.3.
179 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
180
181 AC_MSG_CHECKING([for getfsstat function])
182 AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
183 [AC_TRY_LINK([
184#include <sys/types.h>
185#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
186# define FS_TYPE(Ent) ((Ent).f_fstypename)
187#else
188# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
189#endif
190]$getfsstat_includes
191,
192 [struct statfs *stats;
193 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
194 char *t = FS_TYPE (*stats); ],
195 fu_cv_sys_mounted_getfsstat=yes,
196 fu_cv_sys_mounted_getfsstat=no)])
197 AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
198 if test $fu_cv_sys_mounted_getfsstat = yes; then
199 ac_list_mounted_fs=found
200 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
201 [Define if there is a function named getfsstat for reading the
202 list of mounted file systems. (DEC Alpha running OSF/1)])
203 fi
204fi
205
206if test -z "$ac_list_mounted_fs"; then
207 # SVR3
208 AC_MSG_CHECKING([for FIXME existence of three headers])
209 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
210 [AC_TRY_CPP([
211#include <sys/statfs.h>
212#include <sys/fstyp.h>
213#include <mnttab.h>],
214 fu_cv_sys_mounted_fread_fstyp=yes,
215 fu_cv_sys_mounted_fread_fstyp=no)])
216 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
217 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
218 ac_list_mounted_fs=found
219 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
220 [Define if (like SVR2) there is no specific function for reading the
221 list of mounted file systems, and your system has these header files:
222 <sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
223 fi
224fi
225
226if test -z "$ac_list_mounted_fs"; then
227 # 4.4BSD and DEC OSF/1.
228 AC_MSG_CHECKING([for getmntinfo function])
229 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
230 [
231 test "$ac_cv_func_getmntinfo" = yes \
232 && fu_cv_sys_mounted_getmntinfo=yes \
233 || fu_cv_sys_mounted_getmntinfo=no
234 ])
235 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
236 if test $fu_cv_sys_mounted_getmntinfo = yes; then
237 AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
238 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2,
239 [
240 AC_TRY_COMPILE([
241#if HAVE_SYS_PARAM_H
242# include <sys/param.h>
243#endif
244#include <sys/types.h>
245#if HAVE_SYS_MOUNT_H
246# include <sys/mount.h>
247#endif
248#if HAVE_SYS_STATVFS_H
249# include <sys/statvfs.h>
250#endif
251extern int getmntinfo (struct statfs **, int);
252 ], [],
253 [fu_cv_sys_mounted_getmntinfo2=no],
254 [fu_cv_sys_mounted_getmntinfo2=yes])
255 ])
256 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2])
257 if test $fu_cv_sys_mounted_getmntinfo2 = no; then
258 ac_list_mounted_fs=found
259 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
260 [Define if there is a function named getmntinfo for reading the
261 list of mounted file systems and it returns an array of
262 'struct statfs'. (4.4BSD, Darwin)])
263 else
264 ac_list_mounted_fs=found
265 AC_DEFINE(MOUNTED_GETMNTINFO2, 1,
266 [Define if there is a function named getmntinfo for reading the
267 list of mounted file systems and it returns an array of
268 'struct statvfs'. (NetBSD 3.0)])
269 fi
270 fi
271fi
272
273if test -z "$ac_list_mounted_fs"; then
274 # Ultrix
275 AC_MSG_CHECKING([for getmnt function])
276 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
277 [AC_TRY_CPP([
278#include <sys/fs_types.h>
279#include <sys/mount.h>],
280 fu_cv_sys_mounted_getmnt=yes,
281 fu_cv_sys_mounted_getmnt=no)])
282 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
283 if test $fu_cv_sys_mounted_getmnt = yes; then
284 ac_list_mounted_fs=found
285 AC_DEFINE(MOUNTED_GETMNT, 1,
286 [Define if there is a function named getmnt for reading the list of
287 mounted file systems. (Ultrix)])
288 fi
289fi
290
291if test -z "$ac_list_mounted_fs"; then
292 # BeOS
293 AC_CHECK_FUNCS(next_dev fs_stat_dev)
294 AC_CHECK_HEADERS(fs_info.h)
295 AC_MSG_CHECKING([for BEOS mounted file system support functions])
296 if test $ac_cv_header_fs_info_h = yes \
297 && test $ac_cv_func_next_dev = yes \
298 && test $ac_cv_func_fs_stat_dev = yes; then
299 fu_result=yes
300 else
301 fu_result=no
302 fi
303 AC_MSG_RESULT($fu_result)
304 if test $fu_result = yes; then
305 ac_list_mounted_fs=found
306 AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
307 [Define if there are functions named next_dev and fs_stat_dev for
308 reading the list of mounted file systems. (BeOS)])
309 fi
310fi
311
312if test -z "$ac_list_mounted_fs"; then
313 # SVR2
314 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
315 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
316 [AC_TRY_CPP([#include <mnttab.h>],
317 fu_cv_sys_mounted_fread=yes,
318 fu_cv_sys_mounted_fread=no)])
319 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
320 if test $fu_cv_sys_mounted_fread = yes; then
321 ac_list_mounted_fs=found
322 AC_DEFINE(MOUNTED_FREAD, 1,
323 [Define if there is no specific function for reading the list of
324 mounted file systems. fread will be used to read /etc/mnttab.
325 (SVR2) ])
326 fi
327fi
328
329if test -z "$ac_list_mounted_fs"; then
330 AC_MSG_ERROR([could not determine how to read list of mounted file systems])
331 # FIXME -- no need to abort building the whole package
332 # Can't build mountlist.c or anything that needs its functions
333fi
334
335AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
336
337 ])
diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4
new file mode 100644
index 00000000..5380941b
--- /dev/null
+++ b/gl/m4/mbchar.m4
@@ -0,0 +1,14 @@
1# mbchar.m4 serial 5
2dnl Copyright (C) 2005-2007 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 autoconf tests required for use of mbchar.m4
8dnl From Bruno Haible.
9
10AC_DEFUN([gl_MBCHAR],
11[
12 AC_REQUIRE([AC_GNU_SOURCE])
13 AC_LIBOBJ([mbchar])
14])
diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4
new file mode 100644
index 00000000..7d51af10
--- /dev/null
+++ b/gl/m4/mbiter.m4
@@ -0,0 +1,17 @@
1# mbiter.m4 serial 2
2dnl Copyright (C) 2005 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 autoconf tests required for use of mbiter.h
8dnl From Bruno Haible.
9
10AC_DEFUN([gl_MBITER],
11[
12 AC_REQUIRE([AC_TYPE_MBSTATE_T])
13 dnl The following line is that so the user can test HAVE_MBRTOWC before
14 dnl #include "mbiter.h" or "mbuiter.h".
15 AC_REQUIRE([gl_FUNC_MBRTOWC])
16 :
17])
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
new file mode 100644
index 00000000..a3bd9114
--- /dev/null
+++ b/gl/m4/mbrtowc.m4
@@ -0,0 +1,31 @@
1# mbrtowc.m4 serial 8
2dnl Copyright (C) 2001-2002, 2004-2005 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 Paul Eggert
8
9dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
10dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
11
12AC_DEFUN([gl_FUNC_MBRTOWC],
13[
14 dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
15 AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
16 gl_cv_func_mbrtowc,
17 [AC_LINK_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[#include <wchar.h>]],
20 [[wchar_t wc;
21 char const s[] = "";
22 size_t n = 1;
23 mbstate_t state;
24 return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
25 gl_cv_func_mbrtowc=yes,
26 gl_cv_func_mbrtowc=no)])
27 if test $gl_cv_func_mbrtowc = yes; then
28 AC_DEFINE([HAVE_MBRTOWC], 1,
29 [Define to 1 if mbrtowc and mbstate_t are properly declared.])
30 fi
31])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
new file mode 100644
index 00000000..91b8636e
--- /dev/null
+++ b/gl/m4/memchr.m4
@@ -0,0 +1,18 @@
1# memchr.m4 serial 4
2dnl Copyright (C) 2002, 2003, 2004 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
7AC_DEFUN([gl_FUNC_MEMCHR],
8[
9 AC_REPLACE_FUNCS(memchr)
10 if test $ac_cv_func_memchr = no; then
11 gl_PREREQ_MEMCHR
12 fi
13])
14
15# Prerequisites of lib/memchr.c.
16AC_DEFUN([gl_PREREQ_MEMCHR], [
17 AC_CHECK_HEADERS(bp-sym.h)
18])
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
new file mode 100644
index 00000000..bbd1ba0b
--- /dev/null
+++ b/gl/m4/minmax.m4
@@ -0,0 +1,41 @@
1# minmax.m4 serial 2
2dnl Copyright (C) 2005 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
7AC_PREREQ(2.52)
8
9AC_DEFUN([gl_MINMAX],
10[
11 AC_REQUIRE([gl_PREREQ_MINMAX])
12])
13
14# Prerequisites of lib/minmax.h.
15AC_DEFUN([gl_PREREQ_MINMAX],
16[
17 gl_MINMAX_IN_HEADER([limits.h])
18 gl_MINMAX_IN_HEADER([sys/param.h])
19])
20
21dnl gl_MINMAX_IN_HEADER(HEADER)
22dnl The parameter has to be a literal header name; it cannot be macro,
23dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
24dnl invocations with a literal macro name.)
25AC_DEFUN([gl_MINMAX_IN_HEADER],
26[
27 m4_pushdef([header], AS_TR_SH([$1]))
28 m4_pushdef([HEADER], AS_TR_CPP([$1]))
29 AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
30 [gl_cv_minmax_in_]header,
31 [AC_TRY_COMPILE([#include <$1>
32int x = MIN (42, 17);], [],
33 [gl_cv_minmax_in_]header[=yes],
34 [gl_cv_minmax_in_]header[=no])])
35 if test $gl_cv_minmax_in_[]header = yes; then
36 AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
37 [Define to 1 if <$1> defines the MIN and MAX macros.])
38 fi
39 m4_popdef([HEADER])
40 m4_popdef([header])
41])
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4
new file mode 100644
index 00000000..c25f44e7
--- /dev/null
+++ b/gl/m4/mountlist.m4
@@ -0,0 +1,23 @@
1#serial 9
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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
7AC_DEFUN([gl_MOUNTLIST],
8[
9 gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes],
10 [gl_cv_list_mounted_fs=no])
11 if test $gl_cv_list_mounted_fs = yes; then
12 AC_LIBOBJ(mountlist)
13 gl_PREREQ_MOUNTLIST_EXTRA
14 fi
15])
16
17# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS.
18AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
19[
20 dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
21 AC_CHECK_HEADERS(sys/mntent.h)
22 gl_FSTYPENAME
23])
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
new file mode 100644
index 00000000..d73531a0
--- /dev/null
+++ b/gl/m4/netinet_in_h.m4
@@ -0,0 +1,18 @@
1# netinet_in_h.m4 serial 1
2dnl Copyright (C) 2006 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 Simon Josefsson
8
9AC_DEFUN([gl_HEADER_NETINET_IN],
10[
11 AC_CHECK_HEADERS_ONCE([netinet/in.h])
12 if test $ac_cv_header_netinet_in_h = yes; then
13 NETINET_IN_H=''
14 else
15 NETINET_IN_H='netinet/in.h'
16 fi
17 AC_SUBST(NETINET_IN_H)
18])
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4
new file mode 100644
index 00000000..7967cc2f
--- /dev/null
+++ b/gl/m4/nls.m4
@@ -0,0 +1,31 @@
1# nls.m4 serial 3 (gettext-0.15)
2dnl Copyright (C) 1995-2003, 2005-2006 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19
20AC_PREREQ(2.50)
21
22AC_DEFUN([AM_NLS],
23[
24 AC_MSG_CHECKING([whether NLS is requested])
25 dnl Default is enabled NLS
26 AC_ARG_ENABLE(nls,
27 [ --disable-nls do not use Native Language Support],
28 USE_NLS=$enableval, USE_NLS=yes)
29 AC_MSG_RESULT($USE_NLS)
30 AC_SUBST(USE_NLS)
31])
diff --git a/gl/m4/onceonly_2_57.m4 b/gl/m4/onceonly_2_57.m4
new file mode 100644
index 00000000..15884b3e
--- /dev/null
+++ b/gl/m4/onceonly_2_57.m4
@@ -0,0 +1,86 @@
1# onceonly_2_57.m4 serial 4
2dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU
4dnl General Public License. As a special exception to the GNU General
5dnl Public License, this file may be distributed as part of a program
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8
9dnl This file defines some "once only" variants of standard autoconf macros.
10dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
11dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
12dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
13dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
14dnl The advantage is that the check for each of the headers/functions/decls
15dnl will be put only once into the 'configure' file. It keeps the size of
16dnl the 'configure' file down, and avoids redundant output when 'configure'
17dnl is run.
18dnl The drawback is that the checks cannot be conditionalized. If you write
19dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
20dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
21dnl empty, and the check will be inserted before the body of the AC_DEFUNed
22dnl function.
23
24dnl This is like onceonly.m4, except that it uses diversions to named sections
25dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
26dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
27dnl size reduction is ca. 9%.
28
29dnl Autoconf version 2.57 or newer is recommended.
30AC_PREREQ(2.57)
31
32# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
33# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
34AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
35 :
36 AC_FOREACH([gl_HEADER_NAME], [$1], [
37 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
38 [./-], [___])), [
39 m4_divert_text([INIT_PREPARE],
40 [gl_header_list="$gl_header_list gl_HEADER_NAME"])
41 gl_HEADERS_EXPANSION
42 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
43 [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
44 ])
45 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
46 [./-], [___])))
47 ])
48])
49m4_define([gl_HEADERS_EXPANSION], [
50 m4_divert_text([DEFAULTS], [gl_header_list=])
51 AC_CHECK_HEADERS([$gl_header_list])
52 m4_define([gl_HEADERS_EXPANSION], [])
53])
54
55# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
56# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
57AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
58 :
59 AC_FOREACH([gl_FUNC_NAME], [$1], [
60 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
61 m4_divert_text([INIT_PREPARE],
62 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
63 gl_FUNCS_EXPANSION
64 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
65 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
66 ])
67 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
68 ])
69])
70m4_define([gl_FUNCS_EXPANSION], [
71 m4_divert_text([DEFAULTS], [gl_func_list=])
72 AC_CHECK_FUNCS([$gl_func_list])
73 m4_define([gl_FUNCS_EXPANSION], [])
74])
75
76# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
77# AC_CHECK_DECLS(DECL1, DECL2, ...).
78AC_DEFUN([AC_CHECK_DECLS_ONCE], [
79 :
80 AC_FOREACH([gl_DECL_NAME], [$1], [
81 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
82 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
83 ])
84 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
85 ])
86])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
new file mode 100644
index 00000000..00133ef3
--- /dev/null
+++ b/gl/m4/po.m4
@@ -0,0 +1,428 @@
1# po.m4 serial 13 (gettext-0.15)
2dnl Copyright (C) 1995-2006 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19
20AC_PREREQ(2.50)
21
22dnl Checks for all prerequisites of the po subdirectory.
23AC_DEFUN([AM_PO_SUBDIRS],
24[
25 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
26 AC_REQUIRE([AC_PROG_INSTALL])dnl
27 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
28 AC_REQUIRE([AM_NLS])dnl
29
30 dnl Perform the following tests also if --disable-nls has been given,
31 dnl because they are needed for "make dist" to work.
32
33 dnl Search for GNU msgfmt in the PATH.
34 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
35 dnl The second test excludes FreeBSD msgfmt.
36 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
37 [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
38 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
39 :)
40 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
41
42 dnl Test whether it is GNU msgfmt >= 0.15.
43changequote(,)dnl
44 case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
45 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
46 *) MSGFMT_015=$MSGFMT ;;
47 esac
48changequote([,])dnl
49 AC_SUBST([MSGFMT_015])
50changequote(,)dnl
51 case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
52 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
53 *) GMSGFMT_015=$GMSGFMT ;;
54 esac
55changequote([,])dnl
56 AC_SUBST([GMSGFMT_015])
57
58 dnl Search for GNU xgettext 0.12 or newer in the PATH.
59 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
60 dnl The second test excludes FreeBSD xgettext.
61 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
62 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
63 (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
64 :)
65 dnl Remove leftover from FreeBSD xgettext call.
66 rm -f messages.po
67
68 dnl Test whether it is GNU xgettext >= 0.15.
69changequote(,)dnl
70 case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
71 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
72 *) XGETTEXT_015=$XGETTEXT ;;
73 esac
74changequote([,])dnl
75 AC_SUBST([XGETTEXT_015])
76
77 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
78 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
79 [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
80
81 dnl Installation directories.
82 dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
83 dnl have to define it here, so that it can be used in po/Makefile.
84 test -n "$localedir" || localedir='${datadir}/locale'
85 AC_SUBST([localedir])
86
87 AC_CONFIG_COMMANDS([po-directories], [[
88 for ac_file in $CONFIG_FILES; do
89 # Support "outfile[:infile[:infile...]]"
90 case "$ac_file" in
91 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
92 esac
93 # PO directories have a Makefile.in generated from Makefile.in.in.
94 case "$ac_file" in */Makefile.in)
95 # Adjust a relative srcdir.
96 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
97 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
98 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
99 # In autoconf-2.13 it is called $ac_given_srcdir.
100 # In autoconf-2.50 it is called $srcdir.
101 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
102 case "$ac_given_srcdir" in
103 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
104 /*) top_srcdir="$ac_given_srcdir" ;;
105 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
106 esac
107 # Treat a directory as a PO directory if and only if it has a
108 # POTFILES.in file. This allows packages to have multiple PO
109 # directories under different names or in different locations.
110 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
111 rm -f "$ac_dir/POTFILES"
112 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
113 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
114 POMAKEFILEDEPS="POTFILES.in"
115 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
116 # on $ac_dir but don't depend on user-specified configuration
117 # parameters.
118 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
119 # The LINGUAS file contains the set of available languages.
120 if test -n "$OBSOLETE_ALL_LINGUAS"; then
121 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
122 fi
123 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
124 # Hide the ALL_LINGUAS assigment from automake < 1.5.
125 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
126 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
127 else
128 # The set of available languages was given in configure.in.
129 # Hide the ALL_LINGUAS assigment from automake < 1.5.
130 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
131 fi
132 # Compute POFILES
133 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
134 # Compute UPDATEPOFILES
135 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
136 # Compute DUMMYPOFILES
137 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
138 # Compute GMOFILES
139 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
140 case "$ac_given_srcdir" in
141 .) srcdirpre= ;;
142 *) srcdirpre='$(srcdir)/' ;;
143 esac
144 POFILES=
145 UPDATEPOFILES=
146 DUMMYPOFILES=
147 GMOFILES=
148 for lang in $ALL_LINGUAS; do
149 POFILES="$POFILES $srcdirpre$lang.po"
150 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
151 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
152 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
153 done
154 # CATALOGS depends on both $ac_dir and the user's LINGUAS
155 # environment variable.
156 INST_LINGUAS=
157 if test -n "$ALL_LINGUAS"; then
158 for presentlang in $ALL_LINGUAS; do
159 useit=no
160 if test "%UNSET%" != "$LINGUAS"; then
161 desiredlanguages="$LINGUAS"
162 else
163 desiredlanguages="$ALL_LINGUAS"
164 fi
165 for desiredlang in $desiredlanguages; do
166 # Use the presentlang catalog if desiredlang is
167 # a. equal to presentlang, or
168 # b. a variant of presentlang (because in this case,
169 # presentlang can be used as a fallback for messages
170 # which are not translated in the desiredlang catalog).
171 case "$desiredlang" in
172 "$presentlang"*) useit=yes;;
173 esac
174 done
175 if test $useit = yes; then
176 INST_LINGUAS="$INST_LINGUAS $presentlang"
177 fi
178 done
179 fi
180 CATALOGS=
181 if test -n "$INST_LINGUAS"; then
182 for lang in $INST_LINGUAS; do
183 CATALOGS="$CATALOGS $lang.gmo"
184 done
185 fi
186 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
187 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
188 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
189 if test -f "$f"; then
190 case "$f" in
191 *.orig | *.bak | *~) ;;
192 *) cat "$f" >> "$ac_dir/Makefile" ;;
193 esac
194 fi
195 done
196 fi
197 ;;
198 esac
199 done]],
200 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
201 # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
202 # from automake < 1.5.
203 eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
204 # Capture the value of LINGUAS because we need it to compute CATALOGS.
205 LINGUAS="${LINGUAS-%UNSET%}"
206 ])
207])
208
209dnl Postprocesses a Makefile in a directory containing PO files.
210AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
211[
212 # When this code is run, in config.status, two variables have already been
213 # set:
214 # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
215 # - LINGUAS is the value of the environment variable LINGUAS at configure
216 # time.
217
218changequote(,)dnl
219 # Adjust a relative srcdir.
220 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
221 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
222 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
223 # In autoconf-2.13 it is called $ac_given_srcdir.
224 # In autoconf-2.50 it is called $srcdir.
225 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
226 case "$ac_given_srcdir" in
227 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
228 /*) top_srcdir="$ac_given_srcdir" ;;
229 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
230 esac
231
232 # Find a way to echo strings without interpreting backslash.
233 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
234 gt_echo='echo'
235 else
236 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
237 gt_echo='printf %s\n'
238 else
239 echo_func () {
240 cat <<EOT
241$*
242EOT
243 }
244 gt_echo='echo_func'
245 fi
246 fi
247
248 # A sed script that extracts the value of VARIABLE from a Makefile.
249 sed_x_variable='
250# Test if the hold space is empty.
251x
252s/P/P/
253x
254ta
255# Yes it was empty. Look if we have the expected variable definition.
256/^[ ]*VARIABLE[ ]*=/{
257 # Seen the first line of the variable definition.
258 s/^[ ]*VARIABLE[ ]*=//
259 ba
260}
261bd
262:a
263# Here we are processing a line from the variable definition.
264# Remove comment, more precisely replace it with a space.
265s/#.*$/ /
266# See if the line ends in a backslash.
267tb
268:b
269s/\\$//
270# Print the line, without the trailing backslash.
271p
272tc
273# There was no trailing backslash. The end of the variable definition is
274# reached. Clear the hold space.
275s/^.*$//
276x
277bd
278:c
279# A trailing backslash means that the variable definition continues in the
280# next line. Put a nonempty string into the hold space to indicate this.
281s/^.*$/P/
282x
283:d
284'
285changequote([,])dnl
286
287 # Set POTFILES to the value of the Makefile variable POTFILES.
288 sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
289 POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
290 # Compute POTFILES_DEPS as
291 # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
292 POTFILES_DEPS=
293 for file in $POTFILES; do
294 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
295 done
296 POMAKEFILEDEPS=""
297
298 if test -n "$OBSOLETE_ALL_LINGUAS"; then
299 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
300 fi
301 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
302 # The LINGUAS file contains the set of available languages.
303 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
304 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
305 else
306 # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
307 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
308 ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
309 fi
310 # Hide the ALL_LINGUAS assigment from automake < 1.5.
311 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
312 # Compute POFILES
313 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
314 # Compute UPDATEPOFILES
315 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
316 # Compute DUMMYPOFILES
317 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
318 # Compute GMOFILES
319 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
320 # Compute PROPERTIESFILES
321 # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
322 # Compute CLASSFILES
323 # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
324 # Compute QMFILES
325 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
326 # Compute MSGFILES
327 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
328 # Compute RESOURCESDLLFILES
329 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
330 case "$ac_given_srcdir" in
331 .) srcdirpre= ;;
332 *) srcdirpre='$(srcdir)/' ;;
333 esac
334 POFILES=
335 UPDATEPOFILES=
336 DUMMYPOFILES=
337 GMOFILES=
338 PROPERTIESFILES=
339 CLASSFILES=
340 QMFILES=
341 MSGFILES=
342 RESOURCESDLLFILES=
343 for lang in $ALL_LINGUAS; do
344 POFILES="$POFILES $srcdirpre$lang.po"
345 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
346 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
347 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
348 PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
349 CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
350 QMFILES="$QMFILES $srcdirpre$lang.qm"
351 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
352 MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
353 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
354 RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
355 done
356 # CATALOGS depends on both $ac_dir and the user's LINGUAS
357 # environment variable.
358 INST_LINGUAS=
359 if test -n "$ALL_LINGUAS"; then
360 for presentlang in $ALL_LINGUAS; do
361 useit=no
362 if test "%UNSET%" != "$LINGUAS"; then
363 desiredlanguages="$LINGUAS"
364 else
365 desiredlanguages="$ALL_LINGUAS"
366 fi
367 for desiredlang in $desiredlanguages; do
368 # Use the presentlang catalog if desiredlang is
369 # a. equal to presentlang, or
370 # b. a variant of presentlang (because in this case,
371 # presentlang can be used as a fallback for messages
372 # which are not translated in the desiredlang catalog).
373 case "$desiredlang" in
374 "$presentlang"*) useit=yes;;
375 esac
376 done
377 if test $useit = yes; then
378 INST_LINGUAS="$INST_LINGUAS $presentlang"
379 fi
380 done
381 fi
382 CATALOGS=
383 JAVACATALOGS=
384 QTCATALOGS=
385 TCLCATALOGS=
386 CSHARPCATALOGS=
387 if test -n "$INST_LINGUAS"; then
388 for lang in $INST_LINGUAS; do
389 CATALOGS="$CATALOGS $lang.gmo"
390 JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
391 QTCATALOGS="$QTCATALOGS $lang.qm"
392 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
393 TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
394 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
395 CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
396 done
397 fi
398
399 sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
400 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
401 # Add dependencies that cannot be formulated as a simple suffix rule.
402 for lang in $ALL_LINGUAS; do
403 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
404 cat >> "$ac_file.tmp" <<EOF
405$frobbedlang.msg: $lang.po
406 @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
407 \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
408EOF
409 done
410 fi
411 if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
412 # Add dependencies that cannot be formulated as a simple suffix rule.
413 for lang in $ALL_LINGUAS; do
414 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
415 cat >> "$ac_file.tmp" <<EOF
416$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
417 @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
418 \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
419EOF
420 done
421 fi
422 if test -n "$POMAKEFILEDEPS"; then
423 cat >> "$ac_file.tmp" <<EOF
424Makefile: $POMAKEFILEDEPS
425EOF
426 fi
427 mv "$ac_file.tmp" "$ac_file"
428])
diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4
new file mode 100644
index 00000000..af10170a
--- /dev/null
+++ b/gl/m4/printf-posix.m4
@@ -0,0 +1,44 @@
1# printf-posix.m4 serial 2 (gettext-0.13.1)
2dnl Copyright (C) 2003 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.
8dnl Test whether the printf() function supports POSIX/XSI format strings with
9dnl positions.
10
11AC_DEFUN([gt_PRINTF_POSIX],
12[
13 AC_REQUIRE([AC_PROG_CC])
14 AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
15 gt_cv_func_printf_posix,
16 [
17 AC_TRY_RUN([
18#include <stdio.h>
19#include <string.h>
20/* The string "%2$d %1$d", with dollar characters protected from the shell's
21 dollar expansion (possibly an autoconf bug). */
22static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
23static char buf[100];
24int main ()
25{
26 sprintf (buf, format, 33, 55);
27 return (strcmp (buf, "55 33") != 0);
28}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
29 [
30 AC_EGREP_CPP(notposix, [
31#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
32 notposix
33#endif
34 ], gt_cv_func_printf_posix="guessing no",
35 gt_cv_func_printf_posix="guessing yes")
36 ])
37 ])
38 case $gt_cv_func_printf_posix in
39 *yes)
40 AC_DEFINE(HAVE_POSIX_PRINTF, 1,
41 [Define if your printf() function supports format strings with positions.])
42 ;;
43 esac
44])
diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4
new file mode 100644
index 00000000..a56365cd
--- /dev/null
+++ b/gl/m4/progtest.m4
@@ -0,0 +1,92 @@
1# progtest.m4 serial 4 (gettext-0.14.2)
2dnl Copyright (C) 1996-2003, 2005 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 Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
18
19AC_PREREQ(2.50)
20
21# Search path for a program which passes the given test.
22
23dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
24dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
25AC_DEFUN([AM_PATH_PROG_WITH_TEST],
26[
27# Prepare PATH_SEPARATOR.
28# The user is always right.
29if test "${PATH_SEPARATOR+set}" != set; then
30 echo "#! /bin/sh" >conf$$.sh
31 echo "exit 0" >>conf$$.sh
32 chmod +x conf$$.sh
33 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
34 PATH_SEPARATOR=';'
35 else
36 PATH_SEPARATOR=:
37 fi
38 rm -f conf$$.sh
39fi
40
41# Find out how to test for executable files. Don't use a zero-byte file,
42# as systems may use methods other than mode bits to determine executability.
43cat >conf$$.file <<_ASEOF
44#! /bin/sh
45exit 0
46_ASEOF
47chmod +x conf$$.file
48if test -x conf$$.file >/dev/null 2>&1; then
49 ac_executable_p="test -x"
50else
51 ac_executable_p="test -f"
52fi
53rm -f conf$$.file
54
55# Extract the first word of "$2", so it can be a program name with args.
56set dummy $2; ac_word=[$]2
57AC_MSG_CHECKING([for $ac_word])
58AC_CACHE_VAL(ac_cv_path_$1,
59[case "[$]$1" in
60 [[\\/]]* | ?:[[\\/]]*)
61 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
62 ;;
63 *)
64 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
65 for ac_dir in ifelse([$5], , $PATH, [$5]); do
66 IFS="$ac_save_IFS"
67 test -z "$ac_dir" && ac_dir=.
68 for ac_exec_ext in '' $ac_executable_extensions; do
69 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
70 echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
71 if [$3]; then
72 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
73 break 2
74 fi
75 fi
76 done
77 done
78 IFS="$ac_save_IFS"
79dnl If no 4th arg is given, leave the cache variable unset,
80dnl so AC_PATH_PROGS will keep looking.
81ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
82])dnl
83 ;;
84esac])dnl
85$1="$ac_cv_path_$1"
86if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
87 AC_MSG_RESULT([$]$1)
88else
89 AC_MSG_RESULT(no)
90fi
91AC_SUBST($1)dnl
92])
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4
new file mode 100644
index 00000000..25da645e
--- /dev/null
+++ b/gl/m4/regex.m4
@@ -0,0 +1,198 @@
1#serial 42
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
4# 2006, 2007 Free Software Foundation, Inc.
5#
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10dnl Initially derived from code in GNU grep.
11dnl Mostly written by Jim Meyering.
12
13AC_PREREQ([2.50])
14
15AC_DEFUN([gl_REGEX],
16[
17 AC_CHECK_HEADERS_ONCE([locale.h])
18
19 AC_ARG_WITH([included-regex],
20 [AC_HELP_STRING([--without-included-regex],
21 [don't compile regex; this is the default on
22 systems with recent-enough versions of the GNU C
23 Library (use with caution on other systems)])])
24
25 case $with_included_regex in #(
26 yes|no) ac_use_included_regex=$with_included_regex
27 ;;
28 '')
29 # If the system regex support is good enough that it passes the
30 # following run test, then default to *not* using the included regex.c.
31 # If cross compiling, assume the test would fail and use the included
32 # regex.c. The first failing regular expression is from `Spencer ere
33 # test #75' in grep-2.3.
34 AC_CACHE_CHECK([for working re_compile_pattern],
35 [gl_cv_func_re_compile_pattern_working],
36 [AC_RUN_IFELSE(
37 [AC_LANG_PROGRAM(
38 [AC_INCLUDES_DEFAULT
39 #if HAVE_LOCALE_H
40 #include <locale.h>
41 #endif
42 #include <limits.h>
43 #include <regex.h>
44 ],
45 [[static struct re_pattern_buffer regex;
46 unsigned char folded_chars[UCHAR_MAX + 1];
47 int i;
48 const char *s;
49 struct re_registers regs;
50
51 #if HAVE_LOCALE_H
52 /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
53 This test needs valgrind to catch the bug on Debian
54 GNU/Linux 3.1 x86, but it might catch the bug better
55 on other platforms and it shouldn't hurt to try the
56 test here. */
57 if (setlocale (LC_ALL, "en_US.UTF-8"))
58 {
59 static char const pat[] = "insert into";
60 static char const data[] =
61 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
62 re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
63 | RE_ICASE);
64 memset (&regex, 0, sizeof regex);
65 s = re_compile_pattern (pat, sizeof pat - 1, &regex);
66 if (s)
67 return 1;
68 if (re_search (&regex, data, sizeof data - 1,
69 0, sizeof data - 1, &regs)
70 != -1)
71 return 1;
72 if (! setlocale (LC_ALL, "C"))
73 return 1;
74 }
75 #endif
76
77 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
78 memset (&regex, 0, sizeof (regex));
79 for (i = 0; i <= UCHAR_MAX; i++)
80 folded_chars[i] = i;
81 regex.translate = folded_chars;
82 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
83 /* This should fail with _Invalid character class name_ error. */
84 if (!s)
85 exit (1);
86
87 /* This should succeed, but does not for e.g. glibc-2.1.3. */
88 memset (&regex, 0, sizeof (regex));
89 s = re_compile_pattern ("{1", 2, &regex);
90
91 if (s)
92 exit (1);
93
94 /* The following example is derived from a problem report
95 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
96 memset (&regex, 0, sizeof (regex));
97 s = re_compile_pattern ("[an\371]*n", 7, &regex);
98 if (s)
99 exit (1);
100
101 /* This should match, but does not for e.g. glibc-2.2.1. */
102 if (re_match (&regex, "an", 2, 0, &regs) != 2)
103 exit (1);
104
105 memset (&regex, 0, sizeof (regex));
106 s = re_compile_pattern ("x", 1, &regex);
107 if (s)
108 exit (1);
109
110 /* The version of regex.c in e.g. GNU libc-2.2.93 did not
111 work with a negative RANGE argument. */
112 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
113 exit (1);
114
115 /* The version of regex.c in older versions of gnulib
116 ignored RE_ICASE. Detect that problem too. */
117 memset (&regex, 0, sizeof (regex));
118 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
119 s = re_compile_pattern ("x", 1, &regex);
120 if (s)
121 exit (1);
122
123 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
124 exit (1);
125
126 /* REG_STARTEND was added to glibc on 2004-01-15.
127 Reject older versions. */
128 if (! REG_STARTEND)
129 exit (1);
130
131 /* Reject hosts whose regoff_t values are too narrow.
132 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
133 and 32-bit int. */
134 if (sizeof (regoff_t) < sizeof (ptrdiff_t)
135 || sizeof (regoff_t) < sizeof (ssize_t))
136 exit (1);
137
138 exit (0);]])],
139 [gl_cv_func_re_compile_pattern_working=yes],
140 [gl_cv_func_re_compile_pattern_working=no],
141 dnl When crosscompiling, assume it is not working.
142 [gl_cv_func_re_compile_pattern_working=no])])
143 case $gl_cv_func_re_compile_pattern_working in #(
144 yes) ac_use_included_regex=no;; #(
145 no) ac_use_included_regex=yes;;
146 esac
147 ;;
148 *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex])
149 ;;
150 esac
151
152 if test $ac_use_included_regex = yes; then
153 AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
154 [Define if you want regoff_t to be at least as wide POSIX requires.])
155 AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
156 [Define to rpl_re_syntax_options if the replacement should be used.])
157 AC_DEFINE([re_set_syntax], [rpl_re_set_syntax],
158 [Define to rpl_re_set_syntax if the replacement should be used.])
159 AC_DEFINE([re_compile_pattern], [rpl_re_compile_pattern],
160 [Define to rpl_re_compile_pattern if the replacement should be used.])
161 AC_DEFINE([re_compile_fastmap], [rpl_re_compile_fastmap],
162 [Define to rpl_re_compile_fastmap if the replacement should be used.])
163 AC_DEFINE([re_search], [rpl_re_search],
164 [Define to rpl_re_search if the replacement should be used.])
165 AC_DEFINE([re_search_2], [rpl_re_search_2],
166 [Define to rpl_re_search_2 if the replacement should be used.])
167 AC_DEFINE([re_match], [rpl_re_match],
168 [Define to rpl_re_match if the replacement should be used.])
169 AC_DEFINE([re_match_2], [rpl_re_match_2],
170 [Define to rpl_re_match_2 if the replacement should be used.])
171 AC_DEFINE([re_set_registers], [rpl_re_set_registers],
172 [Define to rpl_re_set_registers if the replacement should be used.])
173 AC_DEFINE([re_comp], [rpl_re_comp],
174 [Define to rpl_re_comp if the replacement should be used.])
175 AC_DEFINE([re_exec], [rpl_re_exec],
176 [Define to rpl_re_exec if the replacement should be used.])
177 AC_DEFINE([regcomp], [rpl_regcomp],
178 [Define to rpl_regcomp if the replacement should be used.])
179 AC_DEFINE([regexec], [rpl_regexec],
180 [Define to rpl_regexec if the replacement should be used.])
181 AC_DEFINE([regerror], [rpl_regerror],
182 [Define to rpl_regerror if the replacement should be used.])
183 AC_DEFINE([regfree], [rpl_regfree],
184 [Define to rpl_regfree if the replacement should be used.])
185 AC_LIBOBJ([regex])
186 gl_PREREQ_REGEX
187 fi
188])
189
190# Prerequisites of lib/regex.c and lib/regex_internal.c.
191AC_DEFUN([gl_PREREQ_REGEX],
192[
193 AC_REQUIRE([AC_GNU_SOURCE])
194 AC_REQUIRE([AC_C_RESTRICT])
195 AC_REQUIRE([AM_LANGINFO_CODESET])
196 AC_CHECK_FUNCS_ONCE([iswctype mbrtowc mempcpy wcrtomb wcscoll])
197 AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
198])
diff --git a/gl/m4/safe-read.m4 b/gl/m4/safe-read.m4
new file mode 100644
index 00000000..7a89d0a6
--- /dev/null
+++ b/gl/m4/safe-read.m4
@@ -0,0 +1,18 @@
1# safe-read.m4 serial 5
2dnl Copyright (C) 2002, 2003, 2005, 2006 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
7AC_DEFUN([gl_SAFE_READ],
8[
9 AC_LIBOBJ([safe-read])
10
11 gl_PREREQ_SAFE_READ
12])
13
14# Prerequisites of lib/safe-read.c.
15AC_DEFUN([gl_PREREQ_SAFE_READ],
16[
17 AC_REQUIRE([gt_TYPE_SSIZE_T])
18])
diff --git a/gl/m4/safe-write.m4 b/gl/m4/safe-write.m4
new file mode 100644
index 00000000..db119ffa
--- /dev/null
+++ b/gl/m4/safe-write.m4
@@ -0,0 +1,18 @@
1# safe-write.m4 serial 3
2dnl Copyright (C) 2002, 2005, 2006 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
7AC_DEFUN([gl_SAFE_WRITE],
8[
9 AC_LIBOBJ([safe-write])
10
11 gl_PREREQ_SAFE_WRITE
12])
13
14# Prerequisites of lib/safe-write.c.
15AC_DEFUN([gl_PREREQ_SAFE_WRITE],
16[
17 gl_PREREQ_SAFE_READ
18])
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4
new file mode 100644
index 00000000..6cb48689
--- /dev/null
+++ b/gl/m4/size_max.m4
@@ -0,0 +1,68 @@
1# size_max.m4 serial 6
2dnl Copyright (C) 2003, 2005-2006 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
9AC_DEFUN([gl_SIZE_MAX],
10[
11 AC_CHECK_HEADERS(stdint.h)
12 dnl First test whether the system already has SIZE_MAX.
13 AC_MSG_CHECKING([for SIZE_MAX])
14 AC_CACHE_VAL([gl_cv_size_max], [
15 gl_cv_size_max=
16 AC_EGREP_CPP([Found it], [
17#include <limits.h>
18#if HAVE_STDINT_H
19#include <stdint.h>
20#endif
21#ifdef SIZE_MAX
22Found it
23#endif
24], gl_cv_size_max=yes)
25 if test -z "$gl_cv_size_max"; then
26 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
28 dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
29 AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
30 [#include <stddef.h>
31#include <limits.h>], size_t_bits_minus_1=)
32 AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
33 [#include <stddef.h>], fits_in_uint=)
34 if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
35 if test $fits_in_uint = 1; then
36 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'.
38 AC_TRY_COMPILE([#include <stddef.h>
39 extern size_t foo;
40 extern unsigned long foo;
41 ], [], fits_in_uint=0)
42 fi
43 dnl We cannot use 'expr' to simplify this expression, because 'expr'
44 dnl works only with 'long' integers in the host environment, while we
45 dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
46 if test $fits_in_uint = 1; then
47 gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
48 else
49 gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
50 fi
51 else
52 dnl Shouldn't happen, but who knows...
53 gl_cv_size_max='((size_t)~(size_t)0)'
54 fi
55 fi
56 ])
57 AC_MSG_RESULT([$gl_cv_size_max])
58 if test "$gl_cv_size_max" != yes; then
59 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.])
61 fi
62])
63
64dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
65dnl Remove this when we can assume autoconf >= 2.61.
66m4_ifdef([AC_COMPUTE_INT], [], [
67 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
68])
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
new file mode 100644
index 00000000..432e0375
--- /dev/null
+++ b/gl/m4/snprintf.m4
@@ -0,0 +1,15 @@
1# snprintf.m4 serial 2
2dnl Copyright (C) 2002, 2003, 2004 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
7AC_DEFUN([gl_FUNC_SNPRINTF],
8[
9 AC_REPLACE_FUNCS(snprintf)
10 AC_CHECK_DECLS_ONCE(snprintf)
11 gl_PREREQ_SNPRINTF
12])
13
14# Prerequisites of lib/snprintf.c.
15AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
new file mode 100644
index 00000000..5e3765a6
--- /dev/null
+++ b/gl/m4/socklen.m4
@@ -0,0 +1,52 @@
1# socklen.m4 serial 4
2dnl Copyright (C) 2005, 2006 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 Albert Chin, Windows fixes from Simon Josefsson.
8
9dnl Check for socklen_t: historically on BSD it is an int, and in
10dnl POSIX 1g it is a type of its own, but some platforms use different
11dnl types for the argument to getsockopt, getpeername, etc. So we
12dnl have to test to find something that will work.
13
14dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
15dnl it there first. That file is included by gnulib's socket_.h, which
16dnl all users of this module should include. Cygwin must not include
17dnl ws2tcpip.h.
18AC_DEFUN([gl_TYPE_SOCKLEN_T],
19 [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
20 AC_CHECK_TYPE([socklen_t], ,
21 [AC_MSG_CHECKING([for socklen_t equivalent])
22 AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
23 [# Systems have either "struct sockaddr *" or
24 # "void *" as the second argument to getpeername
25 gl_cv_socklen_t_equiv=
26 for arg2 in "struct sockaddr" void; do
27 for t in int size_t "unsigned int" "long int" "unsigned long int"; do
28 AC_TRY_COMPILE(
29 [#include <sys/types.h>
30 #include <sys/socket.h>
31
32 int getpeername (int, $arg2 *, $t *);],
33 [$t len;
34 getpeername (0, 0, &len);],
35 [gl_cv_socklen_t_equiv="$t"])
36 test "$gl_cv_socklen_t_equiv" != "" && break
37 done
38 test "$gl_cv_socklen_t_equiv" != "" && break
39 done
40 ])
41 if test "$gl_cv_socklen_t_equiv" = ""; then
42 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
43 fi
44 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
45 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
46 [type to use in place of socklen_t if not defined])],
47 [#include <sys/types.h>
48 #if HAVE_SYS_SOCKET_H
49 # include <sys/socket.h>
50 #elif HAVE_WS2TCPIP_H
51 # include <ws2tcpip.h>
52 #endif])])
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
new file mode 100644
index 00000000..25d9755c
--- /dev/null
+++ b/gl/m4/sockpfaf.m4
@@ -0,0 +1,58 @@
1# sockpfaf.m4 serial 5
2dnl Copyright (C) 2004, 2006 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 Test for some common socket protocol families (PF_INET, PF_INET6, ...)
8dnl and some common address families (AF_INET, AF_INET6, ...).
9dnl This test assumes that a system supports an address family if and only if
10dnl it supports the corresponding protocol family.
11
12dnl From Bruno Haible.
13
14AC_DEFUN([gl_SOCKET_FAMILIES],
15[
16 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
17 AC_CHECK_HEADERS_ONCE([netinet/in.h])
18
19 AC_MSG_CHECKING(for IPv4 sockets)
20 AC_CACHE_VAL(gl_cv_socket_ipv4,
21 [AC_TRY_COMPILE([#include <sys/types.h>
22#ifdef HAVE_SYS_SOCKET_H
23#include <sys/socket.h>
24#endif
25#ifdef HAVE_NETINET_IN_H
26#include <netinet/in.h>
27#endif
28#ifdef HAVE_WINSOCK2_H
29#include <winsock2.h>
30#endif],
31[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
32 if (&x && &y && &z) return 0;],
33 gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
34 AC_MSG_RESULT($gl_cv_socket_ipv4)
35 if test $gl_cv_socket_ipv4 = yes; then
36 AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if <sys/socket.h> defines AF_INET.])
37 fi
38
39 AC_MSG_CHECKING(for IPv6 sockets)
40 AC_CACHE_VAL(gl_cv_socket_ipv6,
41 [AC_TRY_COMPILE([#include <sys/types.h>
42#ifdef HAVE_SYS_SOCKET_H
43#include <sys/socket.h>
44#endif
45#ifdef HAVE_NETINET_IN_H
46#include <netinet/in.h>
47#endif
48#ifdef HAVE_WINSOCK2_H
49#include <winsock2.h>
50#endif],
51[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
52 if (&x && &y && &z) return 0;],
53 gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
54 AC_MSG_RESULT($gl_cv_socket_ipv6)
55 if test $gl_cv_socket_ipv6 = yes; then
56 AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if <sys/socket.h> defines AF_INET6.])
57 fi
58])
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4
new file mode 100644
index 00000000..4eaef93c
--- /dev/null
+++ b/gl/m4/ssize_t.m4
@@ -0,0 +1,21 @@
1# ssize_t.m4 serial 4 (gettext-0.15)
2dnl Copyright (C) 2001-2003, 2006 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.
8dnl Test whether ssize_t is defined.
9
10AC_DEFUN([gt_TYPE_SSIZE_T],
11[
12 AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
13 [AC_TRY_COMPILE([#include <sys/types.h>],
14 [int x = sizeof (ssize_t *) + sizeof (ssize_t);
15 return !x;],
16 [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
17 if test $gt_cv_ssize_t = no; then
18 AC_DEFINE([ssize_t], [int],
19 [Define as a signed type of the same size as size_t.])
20 fi
21])
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
new file mode 100644
index 00000000..2204ecd9
--- /dev/null
+++ b/gl/m4/stdbool.m4
@@ -0,0 +1,115 @@
1# Check for stdbool.h that conforms to C99.
2
3dnl Copyright (C) 2002-2006 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
8# Prepare for substituting <stdbool.h> if it is not supported.
9
10AC_DEFUN([AM_STDBOOL_H],
11[
12 AC_REQUIRE([AC_HEADER_STDBOOL])
13
14 # Define two additional variables used in the Makefile substitution.
15
16 if test "$ac_cv_header_stdbool_h" = yes; then
17 STDBOOL_H=''
18 else
19 STDBOOL_H='stdbool.h'
20 fi
21 AC_SUBST([STDBOOL_H])
22
23 if test "$ac_cv_type__Bool" = yes; then
24 HAVE__BOOL=1
25 else
26 HAVE__BOOL=0
27 fi
28 AC_SUBST([HAVE__BOOL])
29])
30
31# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
32AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
33
34# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf
35# have this macro built-in.
36
37AC_DEFUN([AC_HEADER_STDBOOL],
38 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
39 [ac_cv_header_stdbool_h],
40 [AC_TRY_COMPILE(
41 [
42 #include <stdbool.h>
43 #ifndef bool
44 "error: bool is not defined"
45 #endif
46 #ifndef false
47 "error: false is not defined"
48 #endif
49 #if false
50 "error: false is not 0"
51 #endif
52 #ifndef true
53 "error: true is not defined"
54 #endif
55 #if true != 1
56 "error: true is not 1"
57 #endif
58 #ifndef __bool_true_false_are_defined
59 "error: __bool_true_false_are_defined is not defined"
60 #endif
61
62 struct s { _Bool s: 1; _Bool t; } s;
63
64 char a[true == 1 ? 1 : -1];
65 char b[false == 0 ? 1 : -1];
66 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
67 char d[(bool) 0.5 == true ? 1 : -1];
68 bool e = &s;
69 char f[(_Bool) 0.0 == false ? 1 : -1];
70 char g[true];
71 char h[sizeof (_Bool)];
72 char i[sizeof s.t];
73 enum { j = false, k = true, l = false * true, m = true * 256 };
74 _Bool n[m];
75 char o[sizeof n == m * sizeof n[0] ? 1 : -1];
76 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
77 #if defined __xlc__ || defined __GNUC__
78 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
79 reported by James Lemley on 2005-10-05; see
80 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
81 This test is not quite right, since xlc is allowed to
82 reject this program, as the initializer for xlcbug is
83 not one of the forms that C requires support for.
84 However, doing the test right would require a run-time
85 test, and that would make cross-compilation harder.
86 Let us hope that IBM fixes the xlc bug, and also adds
87 support for this kind of constant expression. In the
88 meantime, this test will reject xlc, which is OK, since
89 our stdbool.h substitute should suffice. We also test
90 this with GCC, where it should work, to detect more
91 quickly whether someone messes up the test in the
92 future. */
93 char digs[] = "0123456789";
94 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
95 #endif
96 /* Catch a bug in an HP-UX C compiler. See
97 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
98 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
99 */
100 _Bool q = true;
101 _Bool *pq = &q;
102 ],
103 [
104 *pq |= q;
105 *pq |= ! q;
106 /* Refer to every declared value, to avoid compiler optimizations. */
107 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
108 + !m + !n + !o + !p + !q + !pq);
109 ],
110 [ac_cv_header_stdbool_h=yes],
111 [ac_cv_header_stdbool_h=no])])
112 AC_CHECK_TYPES([_Bool])
113 if test $ac_cv_header_stdbool_h = yes; then
114 AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
115 fi])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
new file mode 100644
index 00000000..1a4b4a6a
--- /dev/null
+++ b/gl/m4/stdint.m4
@@ -0,0 +1,369 @@
1# stdint.m4 serial 22
2dnl Copyright (C) 2001-2002, 2004-2007 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 Paul Eggert and Bruno Haible.
8dnl Test whether <stdint.h> is supported or must be substituted.
9
10AC_DEFUN([gl_STDINT_H],
11[
12 AC_PREREQ(2.59)dnl
13
14 dnl Check for long long int and unsigned long long int.
15 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
16 if test $ac_cv_type_long_long_int = yes; then
17 HAVE_LONG_LONG_INT=1
18 else
19 HAVE_LONG_LONG_INT=0
20 fi
21 AC_SUBST([HAVE_LONG_LONG_INT])
22 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
23 if test $ac_cv_type_unsigned_long_long_int = yes; then
24 HAVE_UNSIGNED_LONG_LONG_INT=1
25 else
26 HAVE_UNSIGNED_LONG_LONG_INT=0
27 fi
28 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
29
30 dnl Check for <inttypes.h>.
31 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
32 if test $ac_cv_header_inttypes_h = yes; then
33 HAVE_INTTYPES_H=1
34 else
35 HAVE_INTTYPES_H=0
36 fi
37 AC_SUBST([HAVE_INTTYPES_H])
38
39 dnl Check for <sys/types.h>.
40 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
41 if test $ac_cv_header_sys_types_h = yes; then
42 HAVE_SYS_TYPES_H=1
43 else
44 HAVE_SYS_TYPES_H=0
45 fi
46 AC_SUBST([HAVE_SYS_TYPES_H])
47
48 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h.
49 if test $ac_cv_header_stdint_h = yes; then
50 gl_ABSOLUTE_HEADER([stdint.h])
51 ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\"
52 HAVE_STDINT_H=1
53 else
54 ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\"
55 HAVE_STDINT_H=0
56 fi
57 AC_SUBST([ABSOLUTE_STDINT_H])
58 AC_SUBST([HAVE_STDINT_H])
59
60 dnl Now see whether we need a substitute <stdint.h>. Use
61 dnl ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during
62 dnl a "config.status --recheck" if a stdint.h has been
63 dnl created in the build directory.
64 if test $ac_cv_header_stdint_h = yes; then
65 AC_CACHE_CHECK([whether stdint.h conforms to C99],
66 [gl_cv_header_working_stdint_h],
67 [gl_cv_header_working_stdint_h=no
68 AC_COMPILE_IFELSE([
69 AC_LANG_PROGRAM([[
70#include <stddef.h>
71#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
72#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
73#include ABSOLUTE_STDINT_H
74#ifdef INT8_MAX
75int8_t a1 = INT8_MAX;
76int8_t a1min = INT8_MIN;
77#endif
78#ifdef INT16_MAX
79int16_t a2 = INT16_MAX;
80int16_t a2min = INT16_MIN;
81#endif
82#ifdef INT32_MAX
83int32_t a3 = INT32_MAX;
84int32_t a3min = INT32_MIN;
85#endif
86#ifdef INT64_MAX
87int64_t a4 = INT64_MAX;
88int64_t a4min = INT64_MIN;
89#endif
90#ifdef UINT8_MAX
91uint8_t b1 = UINT8_MAX;
92#else
93typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
94#endif
95#ifdef UINT16_MAX
96uint16_t b2 = UINT16_MAX;
97#endif
98#ifdef UINT32_MAX
99uint32_t b3 = UINT32_MAX;
100#endif
101#ifdef UINT64_MAX
102uint64_t b4 = UINT64_MAX;
103#endif
104int_least8_t c1 = INT8_C (0x7f);
105int_least8_t c1max = INT_LEAST8_MAX;
106int_least8_t c1min = INT_LEAST8_MIN;
107int_least16_t c2 = INT16_C (0x7fff);
108int_least16_t c2max = INT_LEAST16_MAX;
109int_least16_t c2min = INT_LEAST16_MIN;
110int_least32_t c3 = INT32_C (0x7fffffff);
111int_least32_t c3max = INT_LEAST32_MAX;
112int_least32_t c3min = INT_LEAST32_MIN;
113int_least64_t c4 = INT64_C (0x7fffffffffffffff);
114int_least64_t c4max = INT_LEAST64_MAX;
115int_least64_t c4min = INT_LEAST64_MIN;
116uint_least8_t d1 = UINT8_C (0xff);
117uint_least8_t d1max = UINT_LEAST8_MAX;
118uint_least16_t d2 = UINT16_C (0xffff);
119uint_least16_t d2max = UINT_LEAST16_MAX;
120uint_least32_t d3 = UINT32_C (0xffffffff);
121uint_least32_t d3max = UINT_LEAST32_MAX;
122uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
123uint_least64_t d4max = UINT_LEAST64_MAX;
124int_fast8_t e1 = INT_FAST8_MAX;
125int_fast8_t e1min = INT_FAST8_MIN;
126int_fast16_t e2 = INT_FAST16_MAX;
127int_fast16_t e2min = INT_FAST16_MIN;
128int_fast32_t e3 = INT_FAST32_MAX;
129int_fast32_t e3min = INT_FAST32_MIN;
130int_fast64_t e4 = INT_FAST64_MAX;
131int_fast64_t e4min = INT_FAST64_MIN;
132uint_fast8_t f1 = UINT_FAST8_MAX;
133uint_fast16_t f2 = UINT_FAST16_MAX;
134uint_fast32_t f3 = UINT_FAST32_MAX;
135uint_fast64_t f4 = UINT_FAST64_MAX;
136#ifdef INTPTR_MAX
137intptr_t g = INTPTR_MAX;
138intptr_t gmin = INTPTR_MIN;
139#endif
140#ifdef UINTPTR_MAX
141uintptr_t h = UINTPTR_MAX;
142#endif
143intmax_t i = INTMAX_MAX;
144uintmax_t j = UINTMAX_MAX;
145struct s {
146 int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1;
147 int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1;
148 int check_SIZE: 0 < SIZE_MAX ? 1 : -1;
149 int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1;
150 int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1;
151
152 /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
153 int check_UINT8_C:
154 (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
155 int check_UINT16_C:
156 (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
157
158 /* Detect bugs in OpenBSD 3.9 stdint.h. */
159#ifdef UINT8_MAX
160 int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
161#endif
162#ifdef UINT16_MAX
163 int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
164#endif
165#ifdef UINT32_MAX
166 int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
167#endif
168#ifdef UINT64_MAX
169 int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
170#endif
171 int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
172 int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
173 int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
174 int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
175 int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
176 int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
177 int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
178 int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
179 int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
180 int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
181 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
182};
183 ]])],
184 [gl_cv_header_working_stdint_h=yes])])
185 fi
186 if test "$gl_cv_header_working_stdint_h" = yes; then
187 STDINT_H=
188 else
189 dnl Check for <sys/inttypes.h>, and for
190 dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
191 AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
192 if test $ac_cv_header_sys_inttypes_h = yes; then
193 HAVE_SYS_INTTYPES_H=1
194 else
195 HAVE_SYS_INTTYPES_H=0
196 fi
197 AC_SUBST([HAVE_SYS_INTTYPES_H])
198 if test $ac_cv_header_sys_bitypes_h = yes; then
199 HAVE_SYS_BITYPES_H=1
200 else
201 HAVE_SYS_BITYPES_H=0
202 fi
203 AC_SUBST([HAVE_SYS_BITYPES_H])
204
205 gl_STDINT_TYPE_PROPERTIES
206 STDINT_H=stdint.h
207 fi
208 AC_SUBST(STDINT_H)
209])
210
211dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
212dnl Determine the size of each of the given types in bits.
213AC_DEFUN([gl_STDINT_BITSIZEOF],
214[
215 dnl Use a shell loop, to avoid bloating configure, and
216 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
217 dnl config.h.in,
218 dnl - extra AC_SUBST calls, so that the right substitutions are made.
219 AC_FOREACH([gltype], [$1],
220 [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
221 [Define to the number of bits in type ']gltype['.])])
222 for gltype in $1 ; do
223 AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
224 [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
225 [$2
226#include <limits.h>], [result=unknown])
227 eval gl_cv_bitsizeof_${gltype}=\$result
228 ])
229 eval result=\$gl_cv_bitsizeof_${gltype}
230 if test $result = unknown; then
231 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
232 dnl do a syntax check even on unused #if conditions and give an error
233 dnl on valid C code like this:
234 dnl #if 0
235 dnl # if > 32
236 dnl # endif
237 dnl #endif
238 result=0
239 fi
240 GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
241 AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
242 eval BITSIZEOF_${GLTYPE}=\$result
243 done
244 AC_FOREACH([gltype], [$1],
245 [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
246])
247
248dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
249dnl Determine the signedness of each of the given types.
250dnl Define HAVE_SIGNED_TYPE if type is signed.
251AC_DEFUN([gl_CHECK_TYPES_SIGNED],
252[
253 dnl Use a shell loop, to avoid bloating configure, and
254 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
255 dnl config.h.in,
256 dnl - extra AC_SUBST calls, so that the right substitutions are made.
257 AC_FOREACH([gltype], [$1],
258 [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
259 [Define to 1 if ']gltype[' is a signed integer type.])])
260 for gltype in $1 ; do
261 AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
262 [AC_COMPILE_IFELSE(
263 [AC_LANG_PROGRAM([$2[
264 int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
265 result=yes, result=no)
266 eval gl_cv_type_${gltype}_signed=\$result
267 ])
268 eval result=\$gl_cv_type_${gltype}_signed
269 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
270 if test "$result" = yes; then
271 AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
272 eval HAVE_SIGNED_${GLTYPE}=1
273 else
274 eval HAVE_SIGNED_${GLTYPE}=0
275 fi
276 done
277 AC_FOREACH([gltype], [$1],
278 [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
279])
280
281dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
282dnl Determine the suffix to use for integer constants of the given types.
283dnl Define t_SUFFIX for each such type.
284AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
285[
286 dnl Use a shell loop, to avoid bloating configure, and
287 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
288 dnl config.h.in,
289 dnl - extra AC_SUBST calls, so that the right substitutions are made.
290 AC_FOREACH([gltype], [$1],
291 [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
292 [Define to l, ll, u, ul, ull, etc., as suitable for
293 constants of type ']gltype['.])])
294 for gltype in $1 ; do
295 AC_CACHE_CHECK([for $gltype integer literal suffix],
296 [gl_cv_type_${gltype}_suffix],
297 [eval gl_cv_type_${gltype}_suffix=no
298 eval result=\$gl_cv_type_${gltype}_signed
299 if test "$result" = yes; then
300 glsufu=
301 else
302 glsufu=u
303 fi
304 for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
305 case $glsuf in
306 '') gltype1='int';;
307 l) gltype1='long int';;
308 ll) gltype1='long long int';;
309 i64) gltype1='__int64';;
310 u) gltype1='unsigned int';;
311 ul) gltype1='unsigned long int';;
312 ull) gltype1='unsigned long long int';;
313 ui64)gltype1='unsigned __int64';;
314 esac
315 AC_COMPILE_IFELSE(
316 [AC_LANG_PROGRAM([$2
317 extern $gltype foo;
318 extern $gltype1 foo;])],
319 [eval gl_cv_type_${gltype}_suffix=\$glsuf])
320 eval result=\$gl_cv_type_${gltype}_suffix
321 test "$result" != no && break
322 done])
323 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
324 eval result=\$gl_cv_type_${gltype}_suffix
325 test "$result" = no && result=
326 eval ${GLTYPE}_SUFFIX=\$result
327 AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
328 done
329 AC_FOREACH([gltype], [$1],
330 [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
331])
332
333dnl gl_STDINT_INCLUDES
334AC_DEFUN([gl_STDINT_INCLUDES],
335[[
336 /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
337 included before <wchar.h>. */
338 #include <stddef.h>
339 #include <signal.h>
340 #include <stdio.h>
341 #include <time.h>
342 #include <wchar.h>
343]])
344
345dnl gl_STDINT_TYPE_PROPERTIES
346dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
347dnl of interest to stdint_.h.
348AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
349[
350 gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
351 [gl_STDINT_INCLUDES])
352 gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
353 [gl_STDINT_INCLUDES])
354 gl_cv_type_ptrdiff_t_signed=yes
355 gl_cv_type_size_t_signed=no
356 gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
357 [gl_STDINT_INCLUDES])
358])
359
360dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
361dnl Remove this when we can assume autoconf >= 2.61.
362m4_ifdef([AC_COMPUTE_INT], [], [
363 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
364])
365
366# Hey Emacs!
367# Local Variables:
368# indent-tabs-mode: nil
369# End:
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
new file mode 100644
index 00000000..db9a8ac4
--- /dev/null
+++ b/gl/m4/stdint_h.m4
@@ -0,0 +1,26 @@
1# stdint_h.m4 serial 6
2dnl Copyright (C) 1997-2004, 2006 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 Paul Eggert.
8
9# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
10# doesn't clash with <sys/types.h>, and declares uintmax_t.
11
12AC_DEFUN([gl_AC_HEADER_STDINT_H],
13[
14 AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
15 [AC_TRY_COMPILE(
16 [#include <sys/types.h>
17#include <stdint.h>],
18 [uintmax_t i = (uintmax_t) -1; return !i;],
19 gl_cv_header_stdint_h=yes,
20 gl_cv_header_stdint_h=no)])
21 if test $gl_cv_header_stdint_h = yes; then
22 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
23 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
24 and declares uintmax_t. ])
25 fi
26])
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4
new file mode 100644
index 00000000..ae827907
--- /dev/null
+++ b/gl/m4/strcase.m4
@@ -0,0 +1,39 @@
1# strcase.m4 serial 4
2dnl Copyright (C) 2002, 2005-2006 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
7AC_DEFUN([gl_STRCASE],
8[
9 gl_FUNC_STRCASECMP
10 gl_FUNC_STRNCASECMP
11])
12
13AC_DEFUN([gl_FUNC_STRCASECMP],
14[
15 dnl No known system has a strcasecmp() function that works correctly in
16 dnl multibyte locales. Therefore we use our version always.
17 AC_LIBOBJ(strcasecmp)
18 gl_PREREQ_STRCASECMP
19])
20
21AC_DEFUN([gl_FUNC_STRNCASECMP],
22[
23 AC_REPLACE_FUNCS(strncasecmp)
24 AC_CHECK_DECLS(strncasecmp)
25 if test $ac_cv_func_strncasecmp = no; then
26 gl_PREREQ_STRNCASECMP
27 fi
28])
29
30# Prerequisites of lib/strcasecmp.c.
31AC_DEFUN([gl_PREREQ_STRCASECMP], [
32 AC_REQUIRE([gl_FUNC_MBRTOWC])
33 :
34])
35
36# Prerequisites of lib/strncasecmp.c.
37AC_DEFUN([gl_PREREQ_STRNCASECMP], [
38 :
39])
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
new file mode 100644
index 00000000..f7786e94
--- /dev/null
+++ b/gl/m4/strdup.m4
@@ -0,0 +1,15 @@
1# strdup.m4 serial 7
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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
7AC_DEFUN([gl_FUNC_STRDUP],
8[
9 AC_REPLACE_FUNCS(strdup)
10 AC_CHECK_DECLS_ONCE(strdup)
11 gl_PREREQ_STRDUP
12])
13
14# Prerequisites of lib/strdup.c.
15AC_DEFUN([gl_PREREQ_STRDUP], [:])
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
new file mode 100644
index 00000000..dd5780b6
--- /dev/null
+++ b/gl/m4/strndup.m4
@@ -0,0 +1,48 @@
1# strndup.m4 serial 11
2dnl Copyright (C) 2002-2003, 2005-2006 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
7AC_DEFUN([gl_FUNC_STRNDUP],
8[
9 dnl Persuade glibc <string.h> to declare strndup().
10 AC_REQUIRE([AC_GNU_SOURCE])
11
12 AC_CHECK_DECLS_ONCE([strndup])
13
14 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
15 AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup,
16 [AC_RUN_IFELSE([
17 AC_LANG_PROGRAM([#include <string.h>
18 #include <stdlib.h>], [[
19#ifndef HAVE_DECL_STRNDUP
20 extern char *strndup (const char *, size_t);
21#endif
22 char *s;
23 s = strndup ("some longer string", 15);
24 free (s);
25 s = strndup ("shorter string", 13);
26 return s[13] != '\0';]])],
27 [gl_cv_func_strndup=yes],
28 [gl_cv_func_strndup=no],
29 [AC_CHECK_FUNC([strndup],
30 [AC_EGREP_CPP([too risky], [
31#ifdef _AIX
32 too risky
33#endif
34 ],
35 [gl_cv_func_strndup=no],
36 [gl_cv_func_strndup=yes])],
37 [gl_cv_func_strndup=no])])])
38 if test $gl_cv_func_strndup = yes; then
39 AC_DEFINE([HAVE_STRNDUP], 1,
40 [Define if you have the strndup() function and it works.])
41 else
42 AC_LIBOBJ([strndup])
43 gl_PREREQ_STRNDUP
44 fi
45])
46
47# Prerequisites of lib/strndup.c.
48AC_DEFUN([gl_PREREQ_STRNDUP], [:])
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4
new file mode 100644
index 00000000..0213a8ae
--- /dev/null
+++ b/gl/m4/strnlen.m4
@@ -0,0 +1,27 @@
1# strnlen.m4 serial 6
2dnl Copyright (C) 2002-2003, 2005, 2006 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
7AC_DEFUN([gl_FUNC_STRNLEN],
8[
9 dnl Persuade glibc <string.h> to declare strnlen().
10 AC_REQUIRE([AC_GNU_SOURCE])
11
12 AC_FUNC_STRNLEN
13 if test $ac_cv_func_strnlen_working = no; then
14 # This is necessary because automake-1.6.1 doens't understand
15 # that the above use of AC_FUNC_STRNLEN means we may have to use
16 # lib/strnlen.c.
17 #AC_LIBOBJ(strnlen)
18 AC_DEFINE(strnlen, rpl_strnlen,
19 [Define to rpl_strnlen if the replacement function should be used.])
20 gl_PREREQ_STRNLEN
21 fi
22])
23
24# Prerequisites of lib/strnlen.c.
25AC_DEFUN([gl_PREREQ_STRNLEN], [
26 AC_CHECK_DECLS_ONCE(strnlen)
27])
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
new file mode 100644
index 00000000..d3e45b48
--- /dev/null
+++ b/gl/m4/sys_socket_h.m4
@@ -0,0 +1,23 @@
1# sys_socket_h.m4 serial 2
2dnl Copyright (C) 2005, 2006 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 Simon Josefsson.
8
9AC_DEFUN([gl_HEADER_SYS_SOCKET],
10[
11 AC_CHECK_HEADERS_ONCE([sys/socket.h])
12 if test $ac_cv_header_sys_socket_h = yes; then
13 SYS_SOCKET_H=''
14 else
15 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
16 dnl the check for those headers unconditional; yet cygwin reports
17 dnl that the headers are present but cannot be compiled (since on
18 dnl cygwin, all socket information should come from sys/socket.h).
19 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
20 SYS_SOCKET_H='sys/socket.h'
21 fi
22 AC_SUBST(SYS_SOCKET_H)
23])
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4
new file mode 100644
index 00000000..bf83ed74
--- /dev/null
+++ b/gl/m4/uintmax_t.m4
@@ -0,0 +1,30 @@
1# uintmax_t.m4 serial 9
2dnl Copyright (C) 1997-2004 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 Paul Eggert.
8
9AC_PREREQ(2.13)
10
11# Define uintmax_t to 'unsigned long' or 'unsigned long long'
12# if it is not already defined in <stdint.h> or <inttypes.h>.
13
14AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
15[
16 AC_REQUIRE([gl_AC_HEADER_INTTYPES_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
19 AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
20 test $ac_cv_type_unsigned_long_long = yes \
21 && ac_type='unsigned long long' \
22 || ac_type='unsigned long'
23 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
24 [Define to unsigned long or unsigned long long
25 if <stdint.h> and <inttypes.h> don't define.])
26 else
27 AC_DEFINE(HAVE_UINTMAX_T, 1,
28 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
29 fi
30])
diff --git a/gl/m4/ulonglong.m4 b/gl/m4/ulonglong.m4
new file mode 100644
index 00000000..9fae98e3
--- /dev/null
+++ b/gl/m4/ulonglong.m4
@@ -0,0 +1,48 @@
1# ulonglong.m4 serial 6
2dnl Copyright (C) 1999-2006 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 Paul Eggert.
8
9# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
10# This fixes a bug in Autoconf 2.60, but can be removed once we
11# assume 2.61 everywhere.
12
13# Note: If the type 'unsigned long long int' exists but is only 32 bits
14# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
15# will not be defined. In this case you can treat 'unsigned long long int'
16# like 'unsigned long int'.
17
18AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
19[
20 AC_CACHE_CHECK([for unsigned long long int],
21 [ac_cv_type_unsigned_long_long_int],
22 [AC_LINK_IFELSE(
23 [AC_LANG_PROGRAM(
24 [[unsigned long long int ull = 18446744073709551615ULL;
25 typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
26 ? 1 : -1)];
27 int i = 63;]],
28 [[unsigned long long int ullmax = 18446744073709551615ull;
29 return (ull << 63 | ull >> 63 | ull << i | ull >> i
30 | ullmax / ull | ullmax % ull);]])],
31 [ac_cv_type_unsigned_long_long_int=yes],
32 [ac_cv_type_unsigned_long_long_int=no])])
33 if test $ac_cv_type_unsigned_long_long_int = yes; then
34 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
35 [Define to 1 if the system has the type `unsigned long long int'.])
36 fi
37])
38
39# This macro is obsolescent and should go away soon.
40AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
41[
42 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
43 ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
44 if test $ac_cv_type_unsigned_long_long = yes; then
45 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
46 [Define if you have the 'unsigned long long' type.])
47 fi
48])
diff --git a/gl/m4/unistd-safer.m4 b/gl/m4/unistd-safer.m4
new file mode 100644
index 00000000..09adf931
--- /dev/null
+++ b/gl/m4/unistd-safer.m4
@@ -0,0 +1,13 @@
1#serial 8
2dnl Copyright (C) 2002, 2005, 2006 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
7AC_DEFUN([gl_UNISTD_SAFER],
8[
9 AC_CHECK_FUNCS_ONCE([pipe])
10 AC_LIBOBJ([dup-safer])
11 AC_LIBOBJ([fd-safer])
12 AC_LIBOBJ([pipe-safer])
13])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
new file mode 100644
index 00000000..9d499dfe
--- /dev/null
+++ b/gl/m4/unistd_h.m4
@@ -0,0 +1,32 @@
1# unistd_h.m4 serial 3
2dnl Copyright (C) 2006 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 Simon Josefsson
8
9AC_DEFUN([gl_HEADER_UNISTD],
10[
11 AC_CHECK_HEADERS([unistd.h], [
12 UNISTD_H=''
13 ], [
14 UNISTD_H='unistd.h'
15 ])
16 AC_SUBST(UNISTD_H)
17 dnl This module decides to build unistd.h if it is missing.
18 dnl The fchdir module decides to build unistd.h if fchdir() is missing.
19 dnl Therefore check for the prerequisites of lib/unistd.h always.
20 gl_PREREQ_UNISTD
21])
22
23dnl Prerequisites of lib/unistd.h.
24AC_DEFUN([gl_PREREQ_UNISTD],
25[
26 AC_CHECK_HEADERS_ONCE([unistd.h])
27 if test $ac_cv_header_unistd_h = yes; then
28 gl_ABSOLUTE_HEADER([unistd.h])
29 ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\"
30 fi
31 AC_SUBST([ABSOLUTE_UNISTD_H])
32])
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
new file mode 100644
index 00000000..72c9a13e
--- /dev/null
+++ b/gl/m4/vasnprintf.m4
@@ -0,0 +1,57 @@
1# vasnprintf.m4 serial 7
2dnl Copyright (C) 2002-2004, 2006 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
7AC_DEFUN([gl_FUNC_VASNPRINTF],
8[
9 AC_REQUIRE([gl_EOVERFLOW])
10 AC_REPLACE_FUNCS(vasnprintf)
11 if test $ac_cv_func_vasnprintf = no; then
12 AC_LIBOBJ(printf-args)
13 AC_LIBOBJ(printf-parse)
14 AC_LIBOBJ(asnprintf)
15 gl_PREREQ_PRINTF_ARGS
16 gl_PREREQ_PRINTF_PARSE
17 gl_PREREQ_VASNPRINTF
18 gl_PREREQ_ASNPRINTF
19 fi
20])
21
22# Prequisites of lib/printf-args.h, lib/printf-args.c.
23AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
24[
25 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
26 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
27 AC_REQUIRE([gt_TYPE_WCHAR_T])
28 AC_REQUIRE([gt_TYPE_WINT_T])
29])
30
31# Prequisites of lib/printf-parse.h, lib/printf-parse.c.
32AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
33[
34 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
35 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
36 AC_REQUIRE([gt_TYPE_WCHAR_T])
37 AC_REQUIRE([gt_TYPE_WINT_T])
38 AC_REQUIRE([AC_TYPE_SIZE_T])
39 AC_CHECK_TYPES(ptrdiff_t)
40 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
41])
42
43# Prerequisites of lib/vasnprintf.c.
44AC_DEFUN([gl_PREREQ_VASNPRINTF],
45[
46 AC_REQUIRE([AC_FUNC_ALLOCA])
47 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
48 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
49 AC_REQUIRE([gt_TYPE_WCHAR_T])
50 AC_REQUIRE([gt_TYPE_WINT_T])
51 AC_CHECK_FUNCS(snprintf wcslen)
52])
53
54# Prerequisites of lib/asnprintf.c.
55AC_DEFUN([gl_PREREQ_ASNPRINTF],
56[
57])
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4
new file mode 100644
index 00000000..18ca6327
--- /dev/null
+++ b/gl/m4/vasprintf.m4
@@ -0,0 +1,33 @@
1# vasprintf.m4 serial 2
2dnl Copyright (C) 2002-2003, 2006 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
7AC_DEFUN([gl_FUNC_VASPRINTF],
8[
9 AC_REPLACE_FUNCS(vasprintf)
10 if test $ac_cv_func_vasprintf = no; then
11 AC_LIBOBJ(asprintf)
12 gl_PREREQ_VASPRINTF_H
13 gl_PREREQ_VASPRINTF
14 gl_PREREQ_ASPRINTF
15 fi
16])
17
18# Prerequisites of lib/vasprintf.h.
19AC_DEFUN([gl_PREREQ_VASPRINTF_H],
20[
21 dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf().
22 AC_REQUIRE([AC_GNU_SOURCE])
23])
24
25# Prerequisites of lib/vasprintf.c.
26AC_DEFUN([gl_PREREQ_VASPRINTF],
27[
28])
29
30# Prerequisites of lib/asprintf.c.
31AC_DEFUN([gl_PREREQ_ASPRINTF],
32[
33])
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
new file mode 100644
index 00000000..2ff6330a
--- /dev/null
+++ b/gl/m4/visibility.m4
@@ -0,0 +1,52 @@
1# visibility.m4 serial 1 (gettext-0.15)
2dnl Copyright (C) 2005 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 Tests whether the compiler supports the command-line option
10dnl -fvisibility=hidden and the function and variable attributes
11dnl __attribute__((__visibility__("hidden"))) and
12dnl __attribute__((__visibility__("default"))).
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
15dnl MacOS X.
16dnl Does *not* test for __visibility__("internal") - which has processor
17dnl dependent semantics.
18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
19dnl "really only recommended for legacy code".
20dnl Set the variable CFLAG_VISIBILITY.
21dnl Defines and sets the variable HAVE_VISIBILITY.
22
23AC_DEFUN([gl_VISIBILITY],
24[
25 AC_REQUIRE([AC_PROG_CC])
26 CFLAG_VISIBILITY=
27 HAVE_VISIBILITY=0
28 if test -n "$GCC"; then
29 AC_MSG_CHECKING([for simple visibility declarations])
30 AC_CACHE_VAL(gl_cv_cc_visibility, [
31 gl_save_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS -fvisibility=hidden"
33 AC_TRY_COMPILE(
34 [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
35 extern __attribute__((__visibility__("default"))) int exportedvar;
36 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
37 extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
38 [],
39 gl_cv_cc_visibility=yes,
40 gl_cv_cc_visibility=no)
41 CFLAGS="$gl_save_CFLAGS"])
42 AC_MSG_RESULT([$gl_cv_cc_visibility])
43 if test $gl_cv_cc_visibility = yes; then
44 CFLAG_VISIBILITY="-fvisibility=hidden"
45 HAVE_VISIBILITY=1
46 fi
47 fi
48 AC_SUBST([CFLAG_VISIBILITY])
49 AC_SUBST([HAVE_VISIBILITY])
50 AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
51 [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
52])
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
new file mode 100644
index 00000000..cb8a9b18
--- /dev/null
+++ b/gl/m4/vsnprintf.m4
@@ -0,0 +1,15 @@
1# vsnprintf.m4 serial 2
2dnl Copyright (C) 2002, 2003, 2004 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
7AC_DEFUN([gl_FUNC_VSNPRINTF],
8[
9 AC_REPLACE_FUNCS(vsnprintf)
10 AC_CHECK_DECLS_ONCE(vsnprintf)
11 gl_PREREQ_VSNPRINTF
12])
13
14# Prerequisites of lib/vsnprintf.c.
15AC_DEFUN([gl_PREREQ_VSNPRINTF], [:])
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4
new file mode 100644
index 00000000..068f22d3
--- /dev/null
+++ b/gl/m4/wchar.m4
@@ -0,0 +1,29 @@
1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2
3dnl Copyright (C) 2007 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
8dnl Written by Eric Blake.
9
10# wchar.m4 serial 1
11
12AC_DEFUN([gl_WCHAR_H],
13[
14 AC_CACHE_CHECK([whether <wchar.h> is standalone],
15 [gl_cv_header_wchar_h_standalone],
16 [AC_COMPILE_IFELSE([[#include <wchar.h>
17wchar_t w;]],
18 [gl_cv_header_wchar_h_standalone=yes],
19 [gl_cv_header_wchar_h_standalone=no])])
20 if test $gl_cv_header_wchar_h_standalone = yes; then
21 WCHAR_H=
22 else
23 gl_ABSOLUTE_HEADER([wchar.h])
24 ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\"
25 WCHAR_H=wchar.h
26 fi
27 AC_SUBST([ABSOLUTE_WCHAR_H])
28 AC_SUBST([WCHAR_H])
29])
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
new file mode 100644
index 00000000..cde2129a
--- /dev/null
+++ b/gl/m4/wchar_t.m4
@@ -0,0 +1,20 @@
1# wchar_t.m4 serial 1 (gettext-0.12)
2dnl Copyright (C) 2002-2003 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.
8dnl Test whether <stddef.h> has the 'wchar_t' type.
9dnl Prerequisite: AC_PROG_CC
10
11AC_DEFUN([gt_TYPE_WCHAR_T],
12[
13 AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
14 [AC_TRY_COMPILE([#include <stddef.h>
15 wchar_t foo = (wchar_t)'\0';], ,
16 gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
17 if test $gt_cv_c_wchar_t = yes; then
18 AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
19 fi
20])
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4
new file mode 100644
index 00000000..62994c62
--- /dev/null
+++ b/gl/m4/wctype.m4
@@ -0,0 +1,41 @@
1dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
2
3dnl Copyright (C) 2006, 2007 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
8dnl Written by Paul Eggert.
9
10AC_DEFUN([gl_WCTYPE_H],
11[
12 AC_CHECK_FUNCS_ONCE([iswcntrl])
13 AC_CHECK_HEADERS_ONCE([wctype.h])
14 AC_REQUIRE([AC_C_INLINE])
15
16 AC_REQUIRE([gt_TYPE_WINT_T])
17 if test $gt_cv_c_wint_t = yes; then
18 HAVE_WINT_T=1
19 else
20 HAVE_WINT_T=0
21 fi
22 AC_SUBST([HAVE_WINT_T])
23
24 WCTYPE_H=wctype.h
25 if test $ac_cv_header_wctype_h = yes; then
26 if test "$ac_cv_func_iswcntrl" = yes; then
27 WCTYPE_H=
28 fi
29 dnl Compute ABSOLUTE_WCTYPE_H even if WCTYPE_H is empty,
30 dnl for the benefit of builds from non-distclean directories.
31 gl_ABSOLUTE_HEADER([wctype.h])
32 ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\"
33 HAVE_WCTYPE_H=1
34 else
35 ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\"
36 HAVE_WCTYPE_H=0
37 fi
38 AC_SUBST([ABSOLUTE_WCTYPE_H])
39 AC_SUBST([HAVE_WCTYPE_H])
40 AC_SUBST([WCTYPE_H])
41])
diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4
new file mode 100644
index 00000000..b4834991
--- /dev/null
+++ b/gl/m4/wcwidth.m4
@@ -0,0 +1,30 @@
1# wcwidth.m4 serial 8
2dnl Copyright (C) 2006, 2007 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
7AC_DEFUN([gl_FUNC_WCWIDTH],
8[
9 dnl Persuade glibc <wchar.h> to declare wcwidth().
10 AC_REQUIRE([AC_GNU_SOURCE])
11
12 AC_REQUIRE([AC_C_INLINE])
13 AC_REQUIRE([gt_TYPE_WCHAR_T])
14 AC_REQUIRE([gt_TYPE_WINT_T])
15
16 AC_CHECK_HEADERS_ONCE([wchar.h])
17 AC_CHECK_FUNCS_ONCE([wcwidth])
18
19 AC_CHECK_DECLS([wcwidth], [], [], [
20/* AIX 3.2.5 declares wcwidth in <string.h>. */
21#include <string.h>
22/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
23 <wchar.h>.
24 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
25 before <wchar.h>. */
26#include <stddef.h>
27#include <stdio.h>
28#include <time.h>
29#include <wchar.h>
30])])
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
new file mode 100644
index 00000000..3706c047
--- /dev/null
+++ b/gl/m4/wint_t.m4
@@ -0,0 +1,28 @@
1# wint_t.m4 serial 2 (gettext-0.12)
2dnl Copyright (C) 2003, 2007 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.
8dnl Test whether <wchar.h> has the 'wint_t' type.
9dnl Prerequisite: AC_PROG_CC
10
11AC_DEFUN([gt_TYPE_WINT_T],
12[
13 AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
14 [AC_TRY_COMPILE([
15/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
16 <wchar.h>.
17 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
18 before <wchar.h>. */
19#include <stddef.h>
20#include <stdio.h>
21#include <time.h>
22#include <wchar.h>
23 wint_t foo = (wchar_t)'\0';], ,
24 gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
25 if test $gt_cv_c_wint_t = yes; then
26 AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
27 fi
28])
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4
new file mode 100644
index 00000000..837a948c
--- /dev/null
+++ b/gl/m4/xalloc.m4
@@ -0,0 +1,24 @@
1# xalloc.m4 serial 16
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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
7AC_DEFUN([gl_XALLOC],
8[
9 AC_LIBOBJ([xmalloc])
10
11 gl_PREREQ_XALLOC
12 gl_PREREQ_XMALLOC
13])
14
15# Prerequisites of lib/xalloc.h.
16AC_DEFUN([gl_PREREQ_XALLOC], [
17 AC_REQUIRE([gl_INLINE])
18 :
19])
20
21# Prerequisites of lib/xmalloc.c.
22AC_DEFUN([gl_PREREQ_XMALLOC], [
23 :
24])
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4
new file mode 100644
index 00000000..85bb721e
--- /dev/null
+++ b/gl/m4/xsize.m4
@@ -0,0 +1,13 @@
1# xsize.m4 serial 3
2dnl Copyright (C) 2003-2004 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
7AC_DEFUN([gl_XSIZE],
8[
9 dnl Prerequisites of lib/xsize.h.
10 AC_REQUIRE([gl_SIZE_MAX])
11 AC_REQUIRE([AC_C_INLINE])
12 AC_CHECK_HEADERS(stdint.h)
13])
diff --git a/gl/m4/xstrndup.m4 b/gl/m4/xstrndup.m4
new file mode 100644
index 00000000..8a30ab15
--- /dev/null
+++ b/gl/m4/xstrndup.m4
@@ -0,0 +1,15 @@
1# xstrndup.m4 serial 2
2dnl Copyright (C) 2003 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
7AC_DEFUN([gl_XSTRNDUP],
8[
9 gl_PREREQ_XSTRNDUP
10])
11
12# Prerequisites of lib/xstrndup.c.
13AC_DEFUN([gl_PREREQ_XSTRNDUP], [
14 :
15])