summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2004-12-15 20:51:47 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2004-12-15 20:51:47 +0000
commit6fff4bcdcf97412a6d1422991ea9fe5e8a203e75 (patch)
tree6494851815282f4b27829a7f10b8ca522aa7668e /m4
parent82d1989d3245791c9fac22ca848f5497f261c10b (diff)
downloadmonitoring-plugins-6fff4bcdcf97412a6d1422991ea9fe5e8a203e75.tar.gz
Moving m4 files from lib/
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1028 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am.in12
-rw-r--r--m4/afs.m413
-rw-r--r--m4/codeset.m423
-rw-r--r--m4/error.m415
-rw-r--r--m4/exitfail.m413
-rw-r--r--m4/extensions.m429
-rw-r--r--m4/fstypename.m432
-rw-r--r--m4/fsusage.m4246
-rw-r--r--m4/getopt.m413
-rw-r--r--m4/gettext.m4587
-rw-r--r--m4/glibc21.m432
-rw-r--r--m4/iconv.m4103
-rw-r--r--m4/intdiv0.m472
-rw-r--r--m4/inttypes-pri.m432
-rw-r--r--m4/inttypes.m427
-rw-r--r--m4/inttypes_h.m428
-rw-r--r--m4/isc-posix.m426
-rw-r--r--m4/lcmessage.m432
-rw-r--r--m4/lib-ld.m497
-rw-r--r--m4/lib-link.m4554
-rw-r--r--m4/lib-prefix.m4148
-rw-r--r--m4/ls-mntd-fs.m4282
-rw-r--r--m4/malloc.m425
-rw-r--r--m4/mountlist.m426
-rw-r--r--m4/np_coreutils.m417
-rw-r--r--m4/onceonly.m463
-rw-r--r--m4/progtest.m459
-rw-r--r--m4/realloc.m425
-rw-r--r--m4/stdint_h.m428
-rw-r--r--m4/uintmax_t.m429
-rw-r--r--m4/ulonglong.m423
-rw-r--r--m4/unlocked-io.m422
-rw-r--r--m4/xalloc.m432
33 files changed, 2765 insertions, 0 deletions
diff --git a/m4/Makefile.am.in b/m4/Makefile.am.in
new file mode 100644
index 00000000..f5e1931d
--- /dev/null
+++ b/m4/Makefile.am.in
@@ -0,0 +1,12 @@
1## This is a template from which Makefile.am is generated. -*-Makefile-*-
2
3Makefile.am: Makefile.am.in
4 rm -f $@ $@t
5 (echo "## Process this file with automake to produce Makefile.in."; \
6 echo EXTRA_DIST =; \
7 echo "EXTRA_DIST += Makefile.am.in"; \
8 ls -1 *.m4 | sed 's/^/EXTRA_DIST += /'; echo ) \
9 >> $@t
10 sed -n '/^Makefile\.am:/,$$p' $@.in >> $@t
11 chmod a-w $@t
12 mv $@t $@
diff --git a/m4/afs.m4 b/m4/afs.m4
new file mode 100644
index 00000000..9e7d7731
--- /dev/null
+++ b/m4/afs.m4
@@ -0,0 +1,13 @@
1#serial 5
2
3AC_DEFUN([jm_AFS],
4 [
5 AC_MSG_CHECKING(for AFS)
6 if test -d /afs; then
7 AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
8 ac_result=yes
9 else
10 ac_result=no
11 fi
12 AC_MSG_RESULT($ac_result)
13 ])
diff --git a/m4/codeset.m4 b/m4/codeset.m4
new file mode 100644
index 00000000..59535ebc
--- /dev/null
+++ b/m4/codeset.m4
@@ -0,0 +1,23 @@
1# codeset.m4 serial AM1 (gettext-0.10.40)
2dnl Copyright (C) 2000-2002 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 From Bruno Haible.
10
11AC_DEFUN([AM_LANGINFO_CODESET],
12[
13 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
14 [AC_TRY_LINK([#include <langinfo.h>],
15 [char* cs = nl_langinfo(CODESET);],
16 am_cv_langinfo_codeset=yes,
17 am_cv_langinfo_codeset=no)
18 ])
19 if test $am_cv_langinfo_codeset = yes; then
20 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
21 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
22 fi
23])
diff --git a/m4/error.m4 b/m4/error.m4
new file mode 100644
index 00000000..0bc2e689
--- /dev/null
+++ b/m4/error.m4
@@ -0,0 +1,15 @@
1#serial 9
2
3AC_DEFUN([gl_ERROR],
4[
5 AC_FUNC_ERROR_AT_LINE
6 dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
7 jm_PREREQ_ERROR
8])
9
10# Prerequisites of lib/error.c.
11AC_DEFUN([jm_PREREQ_ERROR],
12[
13 AC_REQUIRE([AC_FUNC_STRERROR_R])
14 :
15])
diff --git a/m4/exitfail.m4 b/m4/exitfail.m4
new file mode 100644
index 00000000..fa5b1493
--- /dev/null
+++ b/m4/exitfail.m4
@@ -0,0 +1,13 @@
1# exitfail.m4 serial 3
2dnl Copyright (C) 2002, 2003 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
9AC_DEFUN([gl_EXITFAIL],
10[
11 dnl No prerequisites of lib/exitfail.c.
12 :
13])
diff --git a/m4/extensions.m4 b/m4/extensions.m4
new file mode 100644
index 00000000..58bc0beb
--- /dev/null
+++ b/m4/extensions.m4
@@ -0,0 +1,29 @@
1# Enable extensions on systems that normally disable them.
2
3# Copyright (C) 2003 Free Software Foundation, Inc.
4
5# This file is free software, distributed under the terms of the GNU
6# General Public License. As a special exception to the GNU General
7# Public License, this file may be distributed as part of a program
8# that contains a configuration script generated by Autoconf, under
9# the same distribution terms as the rest of that program.
10
11# gl_USE_SYSTEM_EXTENSIONS
12# ------------------------
13# Enable extensions on systems that normally disable them,
14# typically due to standards-conformance issues.
15AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
16 AC_BEFORE([$0], [AC_COMPILE_IFELSE])
17 AC_BEFORE([$0], [AC_RUN_IFELSE])
18
19 AC_REQUIRE([AC_GNU_SOURCE])
20 AC_REQUIRE([AC_AIX])
21 AC_REQUIRE([AC_MINIX])
22
23 AH_VERBATIM([__EXTENSIONS__],
24[/* Enable extensions on Solaris. */
25#ifndef __EXTENSIONS__
26# undef __EXTENSIONS__
27#endif])
28 AC_DEFINE([__EXTENSIONS__])
29])
diff --git a/m4/fstypename.m4 b/m4/fstypename.m4
new file mode 100644
index 00000000..75723a14
--- /dev/null
+++ b/m4/fstypename.m4
@@ -0,0 +1,32 @@
1#serial 3
2
3dnl From Jim Meyering.
4dnl
5dnl See if struct statfs has the f_fstypename member.
6dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
7dnl
8
9AC_DEFUN([jm_FSTYPENAME],
10 [
11 AC_CACHE_CHECK([for f_fstypename in struct statfs],
12 fu_cv_sys_f_fstypename_in_statfs,
13 [
14 AC_TRY_COMPILE(
15 [
16#include <sys/param.h>
17#include <sys/types.h>
18#include <sys/mount.h>
19 ],
20 [struct statfs s; int i = sizeof s.f_fstypename;],
21 fu_cv_sys_f_fstypename_in_statfs=yes,
22 fu_cv_sys_f_fstypename_in_statfs=no
23 )
24 ]
25 )
26
27 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
28 AC_DEFINE(HAVE_F_FSTYPENAME_IN_STATFS, 1,
29 [Define if struct statfs has the f_fstypename member.])
30 fi
31 ]
32)
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
new file mode 100644
index 00000000..a0ab1e15
--- /dev/null
+++ b/m4/fsusage.m4
@@ -0,0 +1,246 @@
1#serial 11
2
3# From fileutils/configure.in
4
5AC_DEFUN([gl_FSUSAGE],
6[
7 AC_CHECK_HEADERS_ONCE(sys/param.h)
8 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
9 jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
10 if test $gl_cv_fs_space = yes; then
11 AC_LIBOBJ(fsusage)
12 gl_PREREQ_FSUSAGE_EXTRA
13 fi
14])
15
16# Try to determine how a program can obtain filesystem usage information.
17# If successful, define the appropriate symbol (see fsusage.c) and
18# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
19#
20# jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
21
22AC_DEFUN([jm_FILE_SYSTEM_USAGE],
23[
24
25echo "checking how to get filesystem space usage..."
26ac_fsusage_space=no
27
28# Perform only the link test since it seems there are no variants of the
29# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
30# because that got a false positive on SCO OSR5. Adding the declaration
31# of a `struct statvfs' causes this test to fail (as it should) on such
32# systems. That system is reported to work fine with STAT_STATFS4 which
33# is what it gets when this test fails.
34if test $ac_fsusage_space = no; then
35 # SVR4
36 AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
37 [AC_TRY_LINK([#include <sys/types.h>
38#ifdef __GLIBC__
39Do not use statvfs on systems with GNU libc, because that function stats
40all preceding entries in /proc/mounts, and that makes df hang if even
41one of the corresponding file systems is hard-mounted, but not available.
42#endif
43#include <sys/statvfs.h>],
44 [struct statvfs fsd; statvfs (0, &fsd);],
45 fu_cv_sys_stat_statvfs=yes,
46 fu_cv_sys_stat_statvfs=no)])
47 if test $fu_cv_sys_stat_statvfs = yes; then
48 ac_fsusage_space=yes
49 AC_DEFINE(STAT_STATVFS, 1,
50 [ Define if there is a function named statvfs. (SVR4)])
51 fi
52fi
53
54if test $ac_fsusage_space = no; then
55 # DEC Alpha running OSF/1
56 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
57 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
58 [AC_TRY_RUN([
59#include <sys/param.h>
60#include <sys/types.h>
61#include <sys/mount.h>
62 main ()
63 {
64 struct statfs fsd;
65 fsd.f_fsize = 0;
66 exit (statfs (".", &fsd, sizeof (struct statfs)));
67 }],
68 fu_cv_sys_stat_statfs3_osf1=yes,
69 fu_cv_sys_stat_statfs3_osf1=no,
70 fu_cv_sys_stat_statfs3_osf1=no)])
71 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
72 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
73 ac_fsusage_space=yes
74 AC_DEFINE(STAT_STATFS3_OSF1, 1,
75 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
76 fi
77fi
78
79if test $ac_fsusage_space = no; then
80# AIX
81 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
82member (AIX, 4.3BSD)])
83 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
84 [AC_TRY_RUN([
85#ifdef HAVE_SYS_PARAM_H
86#include <sys/param.h>
87#endif
88#ifdef HAVE_SYS_MOUNT_H
89#include <sys/mount.h>
90#endif
91#ifdef HAVE_SYS_VFS_H
92#include <sys/vfs.h>
93#endif
94 main ()
95 {
96 struct statfs fsd;
97 fsd.f_bsize = 0;
98 exit (statfs (".", &fsd));
99 }],
100 fu_cv_sys_stat_statfs2_bsize=yes,
101 fu_cv_sys_stat_statfs2_bsize=no,
102 fu_cv_sys_stat_statfs2_bsize=no)])
103 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
104 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
105 ac_fsusage_space=yes
106 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
107[ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
108 (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
109 fi
110fi
111
112if test $ac_fsusage_space = no; then
113# SVR3
114 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
115 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
116 [AC_TRY_RUN([#include <sys/types.h>
117#include <sys/statfs.h>
118 main ()
119 {
120 struct statfs fsd;
121 exit (statfs (".", &fsd, sizeof fsd, 0));
122 }],
123 fu_cv_sys_stat_statfs4=yes,
124 fu_cv_sys_stat_statfs4=no,
125 fu_cv_sys_stat_statfs4=no)])
126 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
127 if test $fu_cv_sys_stat_statfs4 = yes; then
128 ac_fsusage_space=yes
129 AC_DEFINE(STAT_STATFS4, 1,
130 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
131 fi
132fi
133
134if test $ac_fsusage_space = no; then
135# 4.4BSD and NetBSD
136 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
137member (4.4BSD and NetBSD)])
138 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
139 [AC_TRY_RUN([#include <sys/types.h>
140#ifdef HAVE_SYS_PARAM_H
141#include <sys/param.h>
142#endif
143#ifdef HAVE_SYS_MOUNT_H
144#include <sys/mount.h>
145#endif
146 main ()
147 {
148 struct statfs fsd;
149 fsd.f_fsize = 0;
150 exit (statfs (".", &fsd));
151 }],
152 fu_cv_sys_stat_statfs2_fsize=yes,
153 fu_cv_sys_stat_statfs2_fsize=no,
154 fu_cv_sys_stat_statfs2_fsize=no)])
155 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
156 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
157 ac_fsusage_space=yes
158 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
159[ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
160 (4.4BSD, NetBSD)])
161 fi
162fi
163
164if test $ac_fsusage_space = no; then
165 # Ultrix
166 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
167 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
168 [AC_TRY_RUN([#include <sys/types.h>
169#ifdef HAVE_SYS_PARAM_H
170#include <sys/param.h>
171#endif
172#ifdef HAVE_SYS_MOUNT_H
173#include <sys/mount.h>
174#endif
175#ifdef HAVE_SYS_FS_TYPES_H
176#include <sys/fs_types.h>
177#endif
178 main ()
179 {
180 struct fs_data fsd;
181 /* Ultrix's statfs returns 1 for success,
182 0 for not mounted, -1 for failure. */
183 exit (statfs (".", &fsd) != 1);
184 }],
185 fu_cv_sys_stat_fs_data=yes,
186 fu_cv_sys_stat_fs_data=no,
187 fu_cv_sys_stat_fs_data=no)])
188 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
189 if test $fu_cv_sys_stat_fs_data = yes; then
190 ac_fsusage_space=yes
191 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
192[ Define if statfs takes 2 args and the second argument has
193 type struct fs_data. (Ultrix)])
194 fi
195fi
196
197if test $ac_fsusage_space = no; then
198 # SVR2
199 AC_TRY_CPP([#include <sys/filsys.h>
200 ],
201 AC_DEFINE(STAT_READ_FILSYS, 1,
202 [Define if there is no specific function for reading filesystems usage
203 information and you have the <sys/filsys.h> header file. (SVR2)])
204 ac_fsusage_space=yes)
205fi
206
207AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
208
209])
210
211
212# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
213# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
214# enable the work-around code in fsusage.c.
215AC_DEFUN([jm_STATFS_TRUNCATES],
216[
217 AC_MSG_CHECKING([for statfs that truncates block counts])
218 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
219 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
220#if !defined(sun) && !defined(__sun)
221choke -- this is a workaround for a Sun-specific problem
222#endif
223#include <sys/types.h>
224#include <sys/vfs.h>]],
225 [[struct statfs t; long c = *(t.f_spare);]])],
226 [fu_cv_sys_truncating_statfs=yes],
227 [fu_cv_sys_truncating_statfs=no])])
228 if test $fu_cv_sys_truncating_statfs = yes; then
229 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
230 [Define if the block counts reported by statfs may be truncated to 2GB
231 and the correct values may be stored in the f_spare array.
232 (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
233 SunOS 4.1.1 seems not to be affected.)])
234 fi
235 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
236])
237
238
239# Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE.
240AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
241[
242 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
243 AC_CHECK_HEADERS_ONCE(fcntl.h)
244 AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h)
245 jm_STATFS_TRUNCATES
246])
diff --git a/m4/getopt.m4 b/m4/getopt.m4
new file mode 100644
index 00000000..df602b98
--- /dev/null
+++ b/m4/getopt.m4
@@ -0,0 +1,13 @@
1# getopt.m4 serial 2
2dnl Copyright (C) 2002, 2003 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
9AC_DEFUN([gl_GETOPT],
10[
11 dnl Prerequisites of lib/getopt.c.
12 :
13])
diff --git a/m4/gettext.m4 b/m4/gettext.m4
new file mode 100644
index 00000000..45cad855
--- /dev/null
+++ b/m4/gettext.m4
@@ -0,0 +1,587 @@
1# gettext.m4 serial 17 (gettext-0.11.5)
2dnl Copyright (C) 1995-2002 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.
8dnl
9dnl This file can can be used in projects which are not available under
10dnl the GNU General Public License or the GNU Library General Public
11dnl License but which still want to provide support for the GNU gettext
12dnl functionality.
13dnl Please note that the actual code of the GNU gettext library is covered
14dnl by the GNU Library General Public License, and the rest of the GNU
15dnl gettext package package is covered by the GNU General Public License.
16dnl They are *not* in the public domain.
17
18dnl Authors:
19dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002.
21
22dnl Macro to add for using GNU gettext.
23
24dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
25dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
26dnl default (if it is not specified or empty) is 'no-libtool'.
27dnl INTLSYMBOL should be 'external' for packages with no intl directory,
28dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
29dnl If INTLSYMBOL is 'use-libtool', then a libtool library
30dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
31dnl depending on --{enable,disable}-{shared,static} and on the presence of
32dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
33dnl $(top_builddir)/intl/libintl.a will be created.
34dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
35dnl implementations (in libc or libintl) without the ngettext() function
36dnl will be ignored. If NEEDSYMBOL is specified and is
37dnl 'need-formatstring-macros', then GNU gettext implementations that don't
38dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
39dnl INTLDIR is used to find the intl libraries. If empty,
40dnl the value `$(top_builddir)/intl/' is used.
41dnl
42dnl The result of the configuration is one of three cases:
43dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
44dnl and used.
45dnl Catalog format: GNU --> install in $(datadir)
46dnl Catalog extension: .mo after installation, .gmo in source tree
47dnl 2) GNU gettext has been found in the system's C library.
48dnl Catalog format: GNU --> install in $(datadir)
49dnl Catalog extension: .mo after installation, .gmo in source tree
50dnl 3) No internationalization, always use English msgid.
51dnl Catalog format: none
52dnl Catalog extension: none
53dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
54dnl The use of .gmo is historical (it was needed to avoid overwriting the
55dnl GNU format catalogs when building on a platform with an X/Open gettext),
56dnl but we keep it in order not to force irrelevant filename changes on the
57dnl maintainers.
58dnl
59AC_DEFUN([AM_GNU_GETTEXT],
60[
61 dnl Argument checking.
62 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
63 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
64])])])])])
65 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67])])])])
68 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
69 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
70
71 AC_REQUIRE([AM_PO_SUBDIRS])dnl
72 ifelse(gt_included_intl, yes, [
73 AC_REQUIRE([AM_INTL_SUBDIR])dnl
74 ])
75
76 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
77 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
78 AC_REQUIRE([AC_LIB_RPATH])
79
80 dnl Sometimes libintl requires libiconv, so first search for libiconv.
81 dnl Ideally we would do this search only after the
82 dnl if test "$USE_NLS" = "yes"; then
83 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
84 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
85 dnl the configure script would need to contain the same shell code
86 dnl again, outside any 'if'. There are two solutions:
87 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
88 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
89 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
90 dnl documented, we avoid it.
91 ifelse(gt_included_intl, yes, , [
92 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93 ])
94
95 AC_MSG_CHECKING([whether NLS is requested])
96 dnl Default is enabled NLS
97 AC_ARG_ENABLE(nls,
98 [ --disable-nls do not use Native Language Support],
99 USE_NLS=$enableval, USE_NLS=yes)
100 AC_MSG_RESULT($USE_NLS)
101 AC_SUBST(USE_NLS)
102
103 ifelse(gt_included_intl, yes, [
104 BUILD_INCLUDED_LIBINTL=no
105 USE_INCLUDED_LIBINTL=no
106 ])
107 LIBINTL=
108 LTLIBINTL=
109 POSUB=
110
111 dnl If we use NLS figure out what method
112 if test "$USE_NLS" = "yes"; then
113 gt_use_preinstalled_gnugettext=no
114 ifelse(gt_included_intl, yes, [
115 AC_MSG_CHECKING([whether included gettext is requested])
116 AC_ARG_WITH(included-gettext,
117 [ --with-included-gettext use the GNU gettext library included here],
118 nls_cv_force_use_gnu_gettext=$withval,
119 nls_cv_force_use_gnu_gettext=no)
120 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
121
122 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
123 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
124 ])
125 dnl User does not insist on using GNU NLS library. Figure out what
126 dnl to use. If GNU gettext is available we use this. Else we have
127 dnl to fall back to GNU NLS library.
128
129 dnl Add a version number to the cache macros.
130 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
131 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
132 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
133
134 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
135 [AC_TRY_LINK([#include <libintl.h>
136]ifelse([$2], [need-formatstring-macros],
137[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
138#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
139#endif
140changequote(,)dnl
141typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
142changequote([,])dnl
143], [])[extern int _nl_msg_cat_cntr;
144extern int *_nl_domain_bindings;],
145 [bindtextdomain ("", "");
146return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
147 gt_cv_func_gnugettext_libc=yes,
148 gt_cv_func_gnugettext_libc=no)])
149
150 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
151 dnl Sometimes libintl requires libiconv, so first search for libiconv.
152 ifelse(gt_included_intl, yes, , [
153 AM_ICONV_LINK
154 ])
155 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
156 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
157 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
158 dnl even if libiconv doesn't exist.
159 AC_LIB_LINKFLAGS_BODY([intl])
160 AC_CACHE_CHECK([for GNU gettext in libintl],
161 gt_cv_func_gnugettext_libintl,
162 [gt_save_CPPFLAGS="$CPPFLAGS"
163 CPPFLAGS="$CPPFLAGS $INCINTL"
164 gt_save_LIBS="$LIBS"
165 LIBS="$LIBS $LIBINTL"
166 dnl Now see whether libintl exists and does not depend on libiconv.
167 AC_TRY_LINK([#include <libintl.h>
168]ifelse([$2], [need-formatstring-macros],
169[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
170#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
171#endif
172changequote(,)dnl
173typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
174changequote([,])dnl
175], [])[extern int _nl_msg_cat_cntr;
176extern
177#ifdef __cplusplus
178"C"
179#endif
180const char *_nl_expand_alias ();],
181 [bindtextdomain ("", "");
182return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
183 gt_cv_func_gnugettext_libintl=yes,
184 gt_cv_func_gnugettext_libintl=no)
185 dnl Now see whether libintl exists and depends on libiconv.
186 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
187 LIBS="$LIBS $LIBICONV"
188 AC_TRY_LINK([#include <libintl.h>
189]ifelse([$2], [need-formatstring-macros],
190[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
191#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
192#endif
193changequote(,)dnl
194typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
195changequote([,])dnl
196], [])[extern int _nl_msg_cat_cntr;
197extern
198#ifdef __cplusplus
199"C"
200#endif
201const char *_nl_expand_alias ();],
202 [bindtextdomain ("", "");
203return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
204 [LIBINTL="$LIBINTL $LIBICONV"
205 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
206 gt_cv_func_gnugettext_libintl=yes
207 ])
208 fi
209 CPPFLAGS="$gt_save_CPPFLAGS"
210 LIBS="$gt_save_LIBS"])
211 fi
212
213 dnl If an already present or preinstalled GNU gettext() is found,
214 dnl use it. But if this macro is used in GNU gettext, and GNU
215 dnl gettext is already preinstalled in libintl, we update this
216 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
217 if test "$gt_cv_func_gnugettext_libc" = "yes" \
218 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
219 && test "$PACKAGE" != gettext; }; then
220 gt_use_preinstalled_gnugettext=yes
221 else
222 dnl Reset the values set by searching for libintl.
223 LIBINTL=
224 LTLIBINTL=
225 INCINTL=
226 fi
227
228 ifelse(gt_included_intl, yes, [
229 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
230 dnl GNU gettext is not found in the C library.
231 dnl Fall back on included GNU gettext library.
232 nls_cv_use_gnu_gettext=yes
233 fi
234 fi
235
236 if test "$nls_cv_use_gnu_gettext" = "yes"; then
237 dnl Mark actions used to generate GNU NLS library.
238 INTLOBJS="\$(GETTOBJS)"
239 BUILD_INCLUDED_LIBINTL=yes
240 USE_INCLUDED_LIBINTL=yes
241 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
242 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
243 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
244 fi
245
246 if test "$gt_use_preinstalled_gnugettext" = "yes" \
247 || test "$nls_cv_use_gnu_gettext" = "yes"; then
248 dnl Mark actions to use GNU gettext tools.
249 CATOBJEXT=.gmo
250 fi
251 ])
252
253 if test "$gt_use_preinstalled_gnugettext" = "yes" \
254 || test "$nls_cv_use_gnu_gettext" = "yes"; then
255 AC_DEFINE(ENABLE_NLS, 1,
256 [Define to 1 if translation of program messages to the user's native language
257 is requested.])
258 else
259 USE_NLS=no
260 fi
261 fi
262
263 if test "$USE_NLS" = "yes"; then
264
265 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
266 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
267 AC_MSG_CHECKING([how to link with libintl])
268 AC_MSG_RESULT([$LIBINTL])
269 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
270 fi
271
272 dnl For backward compatibility. Some packages may be using this.
273 AC_DEFINE(HAVE_GETTEXT, 1,
274 [Define if the GNU gettext() function is already present or preinstalled.])
275 AC_DEFINE(HAVE_DCGETTEXT, 1,
276 [Define if the GNU dcgettext() function is already present or preinstalled.])
277 fi
278
279 dnl We need to process the po/ directory.
280 POSUB=po
281 fi
282
283 ifelse(gt_included_intl, yes, [
284 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
285 dnl to 'yes' because some of the testsuite requires it.
286 if test "$PACKAGE" = gettext; then
287 BUILD_INCLUDED_LIBINTL=yes
288 fi
289
290 dnl Make all variables we use known to autoconf.
291 AC_SUBST(BUILD_INCLUDED_LIBINTL)
292 AC_SUBST(USE_INCLUDED_LIBINTL)
293 AC_SUBST(CATOBJEXT)
294 AC_SUBST(INTLOBJS)
295
296 dnl For backward compatibility. Some configure.ins may be using this.
297 nls_cv_header_intl=
298 nls_cv_header_libgt=
299
300 dnl For backward compatibility. Some Makefiles may be using this.
301 DATADIRNAME=share
302 AC_SUBST(DATADIRNAME)
303
304 dnl For backward compatibility. Some Makefiles may be using this.
305 INSTOBJEXT=.mo
306 AC_SUBST(INSTOBJEXT)
307
308 dnl For backward compatibility. Some Makefiles may be using this.
309 GENCAT=gencat
310 AC_SUBST(GENCAT)
311
312 dnl Enable libtool support if the surrounding package wishes it.
313 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
314 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
315 ])
316
317 dnl For backward compatibility. Some Makefiles may be using this.
318 INTLLIBS="$LIBINTL"
319 AC_SUBST(INTLLIBS)
320
321 dnl Make all documented variables known to autoconf.
322 AC_SUBST(LIBINTL)
323 AC_SUBST(LTLIBINTL)
324 AC_SUBST(POSUB)
325])
326
327
328dnl Checks for all prerequisites of the po subdirectory,
329dnl except for USE_NLS.
330AC_DEFUN([AM_PO_SUBDIRS],
331[
332 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
333 AC_REQUIRE([AC_PROG_INSTALL])dnl
334 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
335
336 dnl Perform the following tests also if --disable-nls has been given,
337 dnl because they are needed for "make dist" to work.
338
339 dnl Search for GNU msgfmt in the PATH.
340 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
341 dnl The second test excludes FreeBSD msgfmt.
342 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
343 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
344 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
345 :)
346 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
347
348 dnl Search for GNU xgettext 0.11 or newer in the PATH.
349 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
350 dnl The second test excludes FreeBSD xgettext.
351 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
352 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
353 (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
354 :)
355 dnl Remove leftover from FreeBSD xgettext call.
356 rm -f messages.po
357
358 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
359 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
360 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
361
362 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
363 dnl Test whether we really found GNU msgfmt.
364 if test "$GMSGFMT" != ":"; then
365 dnl If it is no GNU msgfmt we define it as : so that the
366 dnl Makefiles still can work.
367 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
368 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
369 : ;
370 else
371 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
372 AC_MSG_RESULT(
373 [found $GMSGFMT program is not GNU msgfmt; ignore it])
374 GMSGFMT=":"
375 fi
376 fi
377
378 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
379 dnl Test whether we really found GNU xgettext.
380 if test "$XGETTEXT" != ":"; then
381 dnl If it is no GNU xgettext we define it as : so that the
382 dnl Makefiles still can work.
383 if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
384 (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
385 : ;
386 else
387 AC_MSG_RESULT(
388 [found xgettext program is not GNU xgettext; ignore it])
389 XGETTEXT=":"
390 fi
391 dnl Remove leftover from FreeBSD xgettext call.
392 rm -f messages.po
393 fi
394
395 AC_OUTPUT_COMMANDS([
396 for ac_file in $CONFIG_FILES; do
397 # Support "outfile[:infile[:infile...]]"
398 case "$ac_file" in
399 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
400 esac
401 # PO directories have a Makefile.in generated from Makefile.in.in.
402 case "$ac_file" in */Makefile.in)
403 # Adjust a relative srcdir.
404 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
405 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
406 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
407 # In autoconf-2.13 it is called $ac_given_srcdir.
408 # In autoconf-2.50 it is called $srcdir.
409 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
410 case "$ac_given_srcdir" in
411 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
412 /*) top_srcdir="$ac_given_srcdir" ;;
413 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
414 esac
415 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
416 rm -f "$ac_dir/POTFILES"
417 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
418 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
419 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
420 # on $ac_dir but don't depend on user-specified configuration
421 # parameters.
422 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
423 # The LINGUAS file contains the set of available languages.
424 if test -n "$ALL_LINGUAS"; then
425 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
426 fi
427 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
428 # Hide the ALL_LINGUAS assigment from automake.
429 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
430 fi
431 case "$ac_given_srcdir" in
432 .) srcdirpre= ;;
433 *) srcdirpre='$(srcdir)/' ;;
434 esac
435 POFILES=
436 GMOFILES=
437 UPDATEPOFILES=
438 DUMMYPOFILES=
439 for lang in $ALL_LINGUAS; do
440 POFILES="$POFILES $srcdirpre$lang.po"
441 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
442 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
443 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
444 done
445 # CATALOGS depends on both $ac_dir and the user's LINGUAS
446 # environment variable.
447 INST_LINGUAS=
448 if test -n "$ALL_LINGUAS"; then
449 for presentlang in $ALL_LINGUAS; do
450 useit=no
451 if test "%UNSET%" != "$LINGUAS"; then
452 desiredlanguages="$LINGUAS"
453 else
454 desiredlanguages="$ALL_LINGUAS"
455 fi
456 for desiredlang in $desiredlanguages; do
457 # Use the presentlang catalog if desiredlang is
458 # a. equal to presentlang, or
459 # b. a variant of presentlang (because in this case,
460 # presentlang can be used as a fallback for messages
461 # which are not translated in the desiredlang catalog).
462 case "$desiredlang" in
463 "$presentlang"*) useit=yes;;
464 esac
465 done
466 if test $useit = yes; then
467 INST_LINGUAS="$INST_LINGUAS $presentlang"
468 fi
469 done
470 fi
471 CATALOGS=
472 if test -n "$INST_LINGUAS"; then
473 for lang in $INST_LINGUAS; do
474 CATALOGS="$CATALOGS $lang.gmo"
475 done
476 fi
477 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
478 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
479 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
480 if test -f "$f"; then
481 case "$f" in
482 *.orig | *.bak | *~) ;;
483 *) cat "$f" >> "$ac_dir/Makefile" ;;
484 esac
485 fi
486 done
487 fi
488 ;;
489 esac
490 done],
491 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
492 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
493 # from automake.
494 eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
495 # Capture the value of LINGUAS because we need it to compute CATALOGS.
496 LINGUAS="${LINGUAS-%UNSET%}"
497 ])
498])
499
500
501dnl Checks for all prerequisites of the intl subdirectory,
502dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
503dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
504AC_DEFUN([AM_INTL_SUBDIR],
505[
506 AC_REQUIRE([AC_PROG_INSTALL])dnl
507 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
508 AC_REQUIRE([AC_PROG_CC])dnl
509 AC_REQUIRE([AC_CANONICAL_HOST])dnl
510 AC_REQUIRE([AC_PROG_RANLIB])dnl
511 AC_REQUIRE([AC_ISC_POSIX])dnl
512 AC_REQUIRE([AC_HEADER_STDC])dnl
513 AC_REQUIRE([AC_C_CONST])dnl
514 AC_REQUIRE([AC_C_INLINE])dnl
515 AC_REQUIRE([AC_TYPE_OFF_T])dnl
516 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
517 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
518 AC_REQUIRE([AC_FUNC_MMAP])dnl
519 AC_REQUIRE([jm_GLIBC21])dnl
520 AC_REQUIRE([gt_INTDIV0])dnl
521 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
522 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
523 AC_REQUIRE([gt_INTTYPES_PRI])dnl
524
525 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
526stdlib.h string.h unistd.h sys/param.h])
527 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
528geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
529strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
530
531 AM_ICONV
532 AM_LANGINFO_CODESET
533 if test $ac_cv_header_locale_h = yes; then
534 AM_LC_MESSAGES
535 fi
536
537 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
538 dnl because plural.y uses bison specific features. It requires at least
539 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
540 dnl compile.
541 dnl bison is only needed for the maintainer (who touches plural.y). But in
542 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
543 dnl the rule in general Makefile. Now, some people carelessly touch the
544 dnl files or have a broken "make" program, hence the plural.c rule will
545 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
546 dnl present or too old.
547 AC_CHECK_PROGS([INTLBISON], [bison])
548 if test -z "$INTLBISON"; then
549 ac_verc_fail=yes
550 else
551 dnl Found it, now check the version.
552 AC_MSG_CHECKING([version of bison])
553changequote(<<,>>)dnl
554 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
555 case $ac_prog_version in
556 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
557 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
558changequote([,])dnl
559 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
560 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
561 esac
562 AC_MSG_RESULT([$ac_prog_version])
563 fi
564 if test $ac_verc_fail = yes; then
565 INTLBISON=:
566 fi
567])
568
569
570AC_DEFUN([AM_MKINSTALLDIRS],
571[
572 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
573 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
574 dnl Try to locate is.
575 MKINSTALLDIRS=
576 if test -n "$ac_aux_dir"; then
577 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
578 fi
579 if test -z "$MKINSTALLDIRS"; then
580 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
581 fi
582 AC_SUBST(MKINSTALLDIRS)
583])
584
585
586dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
587AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
new file mode 100644
index 00000000..9c9f3db3
--- /dev/null
+++ b/m4/glibc21.m4
@@ -0,0 +1,32 @@
1# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2dnl Copyright (C) 2000-2002 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
9# Test for the GNU C Library, version 2.1 or newer.
10# From Bruno Haible.
11
12AC_DEFUN([jm_GLIBC21],
13 [
14 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
15 ac_cv_gnu_library_2_1,
16 [AC_EGREP_CPP([Lucky GNU user],
17 [
18#include <features.h>
19#ifdef __GNU_LIBRARY__
20 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
21 Lucky GNU user
22 #endif
23#endif
24 ],
25 ac_cv_gnu_library_2_1=yes,
26 ac_cv_gnu_library_2_1=no)
27 ]
28 )
29 AC_SUBST(GLIBC21)
30 GLIBC21="$ac_cv_gnu_library_2_1"
31 ]
32)
diff --git a/m4/iconv.m4 b/m4/iconv.m4
new file mode 100644
index 00000000..c5f35798
--- /dev/null
+++ b/m4/iconv.m4
@@ -0,0 +1,103 @@
1# iconv.m4 serial AM4 (gettext-0.11.3)
2dnl Copyright (C) 2000-2002 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 From Bruno Haible.
10
11AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
12[
13 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
14 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
15 AC_REQUIRE([AC_LIB_RPATH])
16
17 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
18 dnl accordingly.
19 AC_LIB_LINKFLAGS_BODY([iconv])
20])
21
22AC_DEFUN([AM_ICONV_LINK],
23[
24 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
25 dnl those with the standalone portable GNU libiconv installed).
26
27 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
28 dnl accordingly.
29 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
30
31 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
32 dnl because if the user has installed libiconv and not disabled its use
33 dnl via --without-libiconv-prefix, he wants to use it. The first
34 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
35 am_save_CPPFLAGS="$CPPFLAGS"
36 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
37
38 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
39 am_cv_func_iconv="no, consider installing GNU libiconv"
40 am_cv_lib_iconv=no
41 AC_TRY_LINK([#include <stdlib.h>
42#include <iconv.h>],
43 [iconv_t cd = iconv_open("","");
44 iconv(cd,NULL,NULL,NULL,NULL);
45 iconv_close(cd);],
46 am_cv_func_iconv=yes)
47 if test "$am_cv_func_iconv" != yes; then
48 am_save_LIBS="$LIBS"
49 LIBS="$LIBS $LIBICONV"
50 AC_TRY_LINK([#include <stdlib.h>
51#include <iconv.h>],
52 [iconv_t cd = iconv_open("","");
53 iconv(cd,NULL,NULL,NULL,NULL);
54 iconv_close(cd);],
55 am_cv_lib_iconv=yes
56 am_cv_func_iconv=yes)
57 LIBS="$am_save_LIBS"
58 fi
59 ])
60 if test "$am_cv_func_iconv" = yes; then
61 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
62 fi
63 if test "$am_cv_lib_iconv" = yes; then
64 AC_MSG_CHECKING([how to link with libiconv])
65 AC_MSG_RESULT([$LIBICONV])
66 else
67 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
68 dnl either.
69 CPPFLAGS="$am_save_CPPFLAGS"
70 LIBICONV=
71 LTLIBICONV=
72 fi
73 AC_SUBST(LIBICONV)
74 AC_SUBST(LTLIBICONV)
75])
76
77AC_DEFUN([AM_ICONV],
78[
79 AM_ICONV_LINK
80 if test "$am_cv_func_iconv" = yes; then
81 AC_MSG_CHECKING([for iconv declaration])
82 AC_CACHE_VAL(am_cv_proto_iconv, [
83 AC_TRY_COMPILE([
84#include <stdlib.h>
85#include <iconv.h>
86extern
87#ifdef __cplusplus
88"C"
89#endif
90#if defined(__STDC__) || defined(__cplusplus)
91size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
92#else
93size_t iconv();
94#endif
95], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
96 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);"])
97 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
98 AC_MSG_RESULT([$]{ac_t:-
99 }[$]am_cv_proto_iconv)
100 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
101 [Define as const if the declaration of iconv() needs const.])
102 fi
103])
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4
new file mode 100644
index 00000000..55dddcf1
--- /dev/null
+++ b/m4/intdiv0.m4
@@ -0,0 +1,72 @@
1# intdiv0.m4 serial 1 (gettext-0.11.3)
2dnl Copyright (C) 2002 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 From Bruno Haible.
10
11AC_DEFUN([gt_INTDIV0],
12[
13 AC_REQUIRE([AC_PROG_CC])dnl
14 AC_REQUIRE([AC_CANONICAL_HOST])dnl
15
16 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
17 gt_cv_int_divbyzero_sigfpe,
18 [
19 AC_TRY_RUN([
20#include <stdlib.h>
21#include <signal.h>
22
23static void
24#ifdef __cplusplus
25sigfpe_handler (int sig)
26#else
27sigfpe_handler (sig) int sig;
28#endif
29{
30 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
31 exit (sig != SIGFPE);
32}
33
34int x = 1;
35int y = 0;
36int z;
37int nan;
38
39int main ()
40{
41 signal (SIGFPE, sigfpe_handler);
42/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
43#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
44 signal (SIGTRAP, sigfpe_handler);
45#endif
46/* Linux/SPARC yields signal SIGILL. */
47#if defined (__sparc__) && defined (__linux__)
48 signal (SIGILL, sigfpe_handler);
49#endif
50
51 z = x / y;
52 nan = y / y;
53 exit (1);
54}
55], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
56 [
57 # Guess based on the CPU.
58 case "$host_cpu" in
59 alpha* | i[34567]86 | m68k | s390*)
60 gt_cv_int_divbyzero_sigfpe="guessing yes";;
61 *)
62 gt_cv_int_divbyzero_sigfpe="guessing no";;
63 esac
64 ])
65 ])
66 case "$gt_cv_int_divbyzero_sigfpe" in
67 *yes) value=1;;
68 *) value=0;;
69 esac
70 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
71 [Define if integer division by zero raises signal SIGFPE.])
72])
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4
new file mode 100644
index 00000000..fd007c31
--- /dev/null
+++ b/m4/inttypes-pri.m4
@@ -0,0 +1,32 @@
1# inttypes-pri.m4 serial 1 (gettext-0.11.4)
2dnl Copyright (C) 1997-2002 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 From Bruno Haible.
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_REQUIRE([gt_HEADER_INTTYPES_H])
17 if test $gt_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 fi
32])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
new file mode 100644
index 00000000..ab370ffe
--- /dev/null
+++ b/m4/inttypes.m4
@@ -0,0 +1,27 @@
1# inttypes.m4 serial 1 (gettext-0.11.4)
2dnl Copyright (C) 1997-2002 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 From Paul Eggert.
10
11# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
12# <sys/types.h>.
13
14AC_DEFUN([gt_HEADER_INTTYPES_H],
15[
16 AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
17 [
18 AC_TRY_COMPILE(
19 [#include <sys/types.h>
20#include <inttypes.h>],
21 [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
22 ])
23 if test $gt_cv_header_inttypes_h = yes; then
24 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
25 [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
26 fi
27])
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4
new file mode 100644
index 00000000..400a1118
--- /dev/null
+++ b/m4/inttypes_h.m4
@@ -0,0 +1,28 @@
1# inttypes_h.m4 serial 4 (gettext-0.11.4)
2dnl Copyright (C) 1997-2002 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 From Paul Eggert.
10
11# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
12# doesn't clash with <sys/types.h>, and declares uintmax_t.
13
14AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
15[
16 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
17 [AC_TRY_COMPILE(
18 [#include <sys/types.h>
19#include <inttypes.h>],
20 [uintmax_t i = (uintmax_t) -1;],
21 jm_ac_cv_header_inttypes_h=yes,
22 jm_ac_cv_header_inttypes_h=no)])
23 if test $jm_ac_cv_header_inttypes_h = yes; then
24 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
25[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
26 and declares uintmax_t. ])
27 fi
28])
diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4
new file mode 100644
index 00000000..1319dd1c
--- /dev/null
+++ b/m4/isc-posix.m4
@@ -0,0 +1,26 @@
1# isc-posix.m4 serial 2 (gettext-0.11.2)
2dnl Copyright (C) 1995-2002 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
9# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
10
11# This test replaces the one in autoconf.
12# Currently this macro should have the same name as the autoconf macro
13# because gettext's gettext.m4 (distributed in the automake package)
14# still uses it. Otherwise, the use in gettext.m4 makes autoheader
15# give these diagnostics:
16# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
17# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
18
19undefine([AC_ISC_POSIX])
20
21AC_DEFUN([AC_ISC_POSIX],
22 [
23 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
24 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
25 ]
26)
diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4
new file mode 100644
index 00000000..ffd4008b
--- /dev/null
+++ b/m4/lcmessage.m4
@@ -0,0 +1,32 @@
1# lcmessage.m4 serial 3 (gettext-0.11.3)
2dnl Copyright (C) 1995-2002 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.
8dnl
9dnl This file can can be used in projects which are not available under
10dnl the GNU General Public License or the GNU Library General Public
11dnl License but which still want to provide support for the GNU gettext
12dnl functionality.
13dnl Please note that the actual code of the GNU gettext library is covered
14dnl by the GNU Library General Public License, and the rest of the GNU
15dnl gettext package package is covered by the GNU General Public License.
16dnl They are *not* in the public domain.
17
18dnl Authors:
19dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
20
21# Check whether LC_MESSAGES is available in <locale.h>.
22
23AC_DEFUN([AM_LC_MESSAGES],
24[
25 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
26 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
27 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
28 if test $am_cv_val_LC_MESSAGES = yes; then
29 AC_DEFINE(HAVE_LC_MESSAGES, 1,
30 [Define if your <locale.h> file defines LC_MESSAGES.])
31 fi
32])
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
new file mode 100644
index 00000000..ddb57323
--- /dev/null
+++ b/m4/lib-ld.m4
@@ -0,0 +1,97 @@
1# lib-ld.m4 serial 1 (gettext-0.11)
2dnl Copyright (C) 1996-2002 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 Subroutines of libtool.m4,
10dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
11dnl with libtool.m4.
12
13dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
14AC_DEFUN([AC_LIB_PROG_LD_GNU],
15[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
16[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
17if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
18 acl_cv_prog_gnu_ld=yes
19else
20 acl_cv_prog_gnu_ld=no
21fi])
22with_gnu_ld=$acl_cv_prog_gnu_ld
23])
24
25dnl From libtool-1.4. Sets the variable LD.
26AC_DEFUN([AC_LIB_PROG_LD],
27[AC_ARG_WITH(gnu-ld,
28[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
29test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
30AC_REQUIRE([AC_PROG_CC])dnl
31AC_REQUIRE([AC_CANONICAL_HOST])dnl
32ac_prog=ld
33if test "$GCC" = yes; then
34 # Check if gcc -print-prog-name=ld gives a path.
35 AC_MSG_CHECKING([for ld used by GCC])
36 case $host in
37 *-*-mingw*)
38 # gcc leaves a trailing carriage return which upsets mingw
39 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
40 *)
41 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
42 esac
43 case $ac_prog in
44 # Accept absolute paths.
45 [[\\/]* | [A-Za-z]:[\\/]*)]
46 [re_direlt='/[^/][^/]*/\.\./']
47 # Canonicalize the path of ld
48 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
49 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
50 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
51 done
52 test -z "$LD" && LD="$ac_prog"
53 ;;
54 "")
55 # If it fails, then pretend we aren't using GCC.
56 ac_prog=ld
57 ;;
58 *)
59 # If it is relative, then search for the first ld in PATH.
60 with_gnu_ld=unknown
61 ;;
62 esac
63elif test "$with_gnu_ld" = yes; then
64 AC_MSG_CHECKING([for GNU ld])
65else
66 AC_MSG_CHECKING([for non-GNU ld])
67fi
68AC_CACHE_VAL(acl_cv_path_LD,
69[if test -z "$LD"; then
70 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
71 for ac_dir in $PATH; do
72 test -z "$ac_dir" && ac_dir=.
73 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
74 acl_cv_path_LD="$ac_dir/$ac_prog"
75 # Check to see if the program is GNU ld. I'd rather use --version,
76 # but apparently some GNU ld's only accept -v.
77 # Break only if it was the GNU/non-GNU ld that we prefer.
78 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
79 test "$with_gnu_ld" != no && break
80 else
81 test "$with_gnu_ld" != yes && break
82 fi
83 fi
84 done
85 IFS="$ac_save_ifs"
86else
87 acl_cv_path_LD="$LD" # Let the user override the test with a path.
88fi])
89LD="$acl_cv_path_LD"
90if test -n "$LD"; then
91 AC_MSG_RESULT($LD)
92else
93 AC_MSG_RESULT(no)
94fi
95test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
96AC_LIB_PROG_LD_GNU
97])
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
new file mode 100644
index 00000000..6b942510
--- /dev/null
+++ b/m4/lib-link.m4
@@ -0,0 +1,554 @@
1# lib-link.m4 serial 3 (gettext-0.11.3)
2dnl Copyright (C) 2001-2002 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 From Bruno Haible.
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.
15AC_DEFUN([AC_LIB_LINKFLAGS],
16[
17 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18 AC_REQUIRE([AC_LIB_RPATH])
19 define([Name],[translit([$1],[./-], [___])])
20 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
21 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
22 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
23 AC_LIB_LINKFLAGS_BODY([$1], [$2])
24 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
25 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
26 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
27 ])
28 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
29 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
30 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
31 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
32 AC_SUBST([LIB]NAME)
33 AC_SUBST([LTLIB]NAME)
34 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
35 dnl results of this search when this library appears as a dependency.
36 HAVE_LIB[]NAME=yes
37 undefine([Name])
38 undefine([NAME])
39])
40
41dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
42dnl searches for libname and the libraries corresponding to explicit and
43dnl implicit dependencies, together with the specified include files and
44dnl the ability to compile and link the specified testcode. If found, it
45dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
46dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
47dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
48dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
49AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
50[
51 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
52 AC_REQUIRE([AC_LIB_RPATH])
53 define([Name],[translit([$1],[./-], [___])])
54 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
55 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
56
57 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
58 dnl accordingly.
59 AC_LIB_LINKFLAGS_BODY([$1], [$2])
60
61 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
62 dnl because if the user has installed lib[]Name and not disabled its use
63 dnl via --without-lib[]Name-prefix, he wants to use it.
64 ac_save_CPPFLAGS="$CPPFLAGS"
65 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
66
67 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
68 ac_save_LIBS="$LIBS"
69 LIBS="$LIBS $LIB[]NAME"
70 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
71 LIBS="$ac_save_LIBS"
72 ])
73 if test "$ac_cv_lib[]Name" = yes; then
74 HAVE_LIB[]NAME=yes
75 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
76 AC_MSG_CHECKING([how to link with lib[]$1])
77 AC_MSG_RESULT([$LIB[]NAME])
78 else
79 HAVE_LIB[]NAME=no
80 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
81 dnl $INC[]NAME either.
82 CPPFLAGS="$ac_save_CPPFLAGS"
83 LIB[]NAME=
84 LTLIB[]NAME=
85 fi
86 AC_SUBST([HAVE_LIB]NAME)
87 AC_SUBST([LIB]NAME)
88 AC_SUBST([LTLIB]NAME)
89 undefine([Name])
90 undefine([NAME])
91])
92
93dnl Determine the platform dependent parameters needed to use rpath:
94dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
95dnl hardcode_direct, hardcode_minus_L,
96dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
97AC_DEFUN([AC_LIB_RPATH],
98[
99 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
100 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
101 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
102 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
103 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
104 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
105 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
106 . ./conftest.sh
107 rm -f ./conftest.sh
108 acl_cv_rpath=done
109 ])
110 wl="$acl_cv_wl"
111 libext="$acl_cv_libext"
112 shlibext="$acl_cv_shlibext"
113 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
114 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
115 hardcode_direct="$acl_cv_hardcode_direct"
116 hardcode_minus_L="$acl_cv_hardcode_minus_L"
117 sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
118 sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
119 dnl Determine whether the user wants rpath handling at all.
120 AC_ARG_ENABLE(rpath,
121 [ --disable-rpath do not hardcode runtime library paths],
122 :, enable_rpath=yes)
123])
124
125dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
126dnl the libraries corresponding to explicit and implicit dependencies.
127dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
128AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
129[
130 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
131 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
132 dnl By default, look in $includedir and $libdir.
133 use_additional=yes
134 AC_LIB_WITH_FINAL_PREFIX([
135 eval additional_includedir=\"$includedir\"
136 eval additional_libdir=\"$libdir\"
137 ])
138 AC_ARG_WITH([lib$1-prefix],
139[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
140 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
141[
142 if test "X$withval" = "Xno"; then
143 use_additional=no
144 else
145 if test "X$withval" = "X"; then
146 AC_LIB_WITH_FINAL_PREFIX([
147 eval additional_includedir=\"$includedir\"
148 eval additional_libdir=\"$libdir\"
149 ])
150 else
151 additional_includedir="$withval/include"
152 additional_libdir="$withval/lib"
153 fi
154 fi
155])
156 dnl Search the library and its dependencies in $additional_libdir and
157 dnl $LDFLAGS. Using breadth-first-seach.
158 LIB[]NAME=
159 LTLIB[]NAME=
160 INC[]NAME=
161 rpathdirs=
162 ltrpathdirs=
163 names_already_handled=
164 names_next_round='$1 $2'
165 while test -n "$names_next_round"; do
166 names_this_round="$names_next_round"
167 names_next_round=
168 for name in $names_this_round; do
169 already_handled=
170 for n in $names_already_handled; do
171 if test "$n" = "$name"; then
172 already_handled=yes
173 break
174 fi
175 done
176 if test -z "$already_handled"; then
177 names_already_handled="$names_already_handled $name"
178 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
179 dnl or AC_LIB_HAVE_LINKFLAGS call.
180 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
181 eval value=\"\$HAVE_LIB$uppername\"
182 if test -n "$value"; then
183 if test "$value" = yes; then
184 eval value=\"\$LIB$uppername\"
185 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
186 eval value=\"\$LTLIB$uppername\"
187 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
188 else
189 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
190 dnl that this library doesn't exist. So just drop it.
191 :
192 fi
193 else
194 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
195 dnl and the already constructed $LIBNAME/$LTLIBNAME.
196 found_dir=
197 found_la=
198 found_so=
199 found_a=
200 if test $use_additional = yes; then
201 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
202 found_dir="$additional_libdir"
203 found_so="$additional_libdir/lib$name.$shlibext"
204 if test -f "$additional_libdir/lib$name.la"; then
205 found_la="$additional_libdir/lib$name.la"
206 fi
207 else
208 if test -f "$additional_libdir/lib$name.$libext"; then
209 found_dir="$additional_libdir"
210 found_a="$additional_libdir/lib$name.$libext"
211 if test -f "$additional_libdir/lib$name.la"; then
212 found_la="$additional_libdir/lib$name.la"
213 fi
214 fi
215 fi
216 fi
217 if test "X$found_dir" = "X"; then
218 for x in $LDFLAGS $LTLIB[]NAME; do
219 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
220 case "$x" in
221 -L*)
222 dir=`echo "X$x" | sed -e 's/^X-L//'`
223 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
224 found_dir="$dir"
225 found_so="$dir/lib$name.$shlibext"
226 if test -f "$dir/lib$name.la"; then
227 found_la="$dir/lib$name.la"
228 fi
229 else
230 if test -f "$dir/lib$name.$libext"; then
231 found_dir="$dir"
232 found_a="$dir/lib$name.$libext"
233 if test -f "$dir/lib$name.la"; then
234 found_la="$dir/lib$name.la"
235 fi
236 fi
237 fi
238 ;;
239 esac
240 if test "X$found_dir" != "X"; then
241 break
242 fi
243 done
244 fi
245 if test "X$found_dir" != "X"; then
246 dnl Found the library.
247 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
248 if test "X$found_so" != "X"; then
249 dnl Linking with a shared library. We attempt to hardcode its
250 dnl directory into the executable's runpath, unless it's the
251 dnl standard /usr/lib.
252 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
253 dnl No hardcoding is needed.
254 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
255 else
256 dnl Use an explicit option to hardcode DIR into the resulting
257 dnl binary.
258 dnl Potentially add DIR to ltrpathdirs.
259 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
260 haveit=
261 for x in $ltrpathdirs; do
262 if test "X$x" = "X$found_dir"; then
263 haveit=yes
264 break
265 fi
266 done
267 if test -z "$haveit"; then
268 ltrpathdirs="$ltrpathdirs $found_dir"
269 fi
270 dnl The hardcoding into $LIBNAME is system dependent.
271 if test "$hardcode_direct" = yes; then
272 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
273 dnl resulting binary.
274 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
275 else
276 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
277 dnl Use an explicit option to hardcode DIR into the resulting
278 dnl binary.
279 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
280 dnl Potentially add DIR to rpathdirs.
281 dnl The rpathdirs will be appended to $LIBNAME at the end.
282 haveit=
283 for x in $rpathdirs; do
284 if test "X$x" = "X$found_dir"; then
285 haveit=yes
286 break
287 fi
288 done
289 if test -z "$haveit"; then
290 rpathdirs="$rpathdirs $found_dir"
291 fi
292 else
293 dnl Rely on "-L$found_dir".
294 dnl But don't add it if it's already contained in the LDFLAGS
295 dnl or the already constructed $LIBNAME
296 haveit=
297 for x in $LDFLAGS $LIB[]NAME; do
298 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
299 if test "X$x" = "X-L$found_dir"; then
300 haveit=yes
301 break
302 fi
303 done
304 if test -z "$haveit"; then
305 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
306 fi
307 if test "$hardcode_minus_L" != no; then
308 dnl FIXME: Not sure whether we should use
309 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
310 dnl here.
311 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
312 else
313 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
314 dnl here, because this doesn't fit in flags passed to the
315 dnl compiler. So give up. No hardcoding. This affects only
316 dnl very old systems.
317 dnl FIXME: Not sure whether we should use
318 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
319 dnl here.
320 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
321 fi
322 fi
323 fi
324 fi
325 else
326 if test "X$found_a" != "X"; then
327 dnl Linking with a static library.
328 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
329 else
330 dnl We shouldn't come here, but anyway it's good to have a
331 dnl fallback.
332 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
333 fi
334 fi
335 dnl Assume the include files are nearby.
336 additional_includedir=
337 case "$found_dir" in
338 */lib | */lib/)
339 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
340 additional_includedir="$basedir/include"
341 ;;
342 esac
343 if test "X$additional_includedir" != "X"; then
344 dnl Potentially add $additional_includedir to $INCNAME.
345 dnl But don't add it
346 dnl 1. if it's the standard /usr/include,
347 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
348 dnl 3. if it's already present in $CPPFLAGS or the already
349 dnl constructed $INCNAME,
350 dnl 4. if it doesn't exist as a directory.
351 if test "X$additional_includedir" != "X/usr/include"; then
352 haveit=
353 if test "X$additional_includedir" = "X/usr/local/include"; then
354 if test -n "$GCC"; then
355 case $host_os in
356 linux*) haveit=yes;;
357 esac
358 fi
359 fi
360 if test -z "$haveit"; then
361 for x in $CPPFLAGS $INC[]NAME; do
362 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
363 if test "X$x" = "X-I$additional_includedir"; then
364 haveit=yes
365 break
366 fi
367 done
368 if test -z "$haveit"; then
369 if test -d "$additional_includedir"; then
370 dnl Really add $additional_includedir to $INCNAME.
371 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
372 fi
373 fi
374 fi
375 fi
376 fi
377 dnl Look for dependencies.
378 if test -n "$found_la"; then
379 dnl Read the .la file. It defines the variables
380 dnl dlname, library_names, old_library, dependency_libs, current,
381 dnl age, revision, installed, dlopen, dlpreopen, libdir.
382 save_libdir="$libdir"
383 case "$found_la" in
384 */* | *\\*) . "$found_la" ;;
385 *) . "./$found_la" ;;
386 esac
387 libdir="$save_libdir"
388 dnl We use only dependency_libs.
389 for dep in $dependency_libs; do
390 case "$dep" in
391 -L*)
392 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
393 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
394 dnl But don't add it
395 dnl 1. if it's the standard /usr/lib,
396 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
397 dnl 3. if it's already present in $LDFLAGS or the already
398 dnl constructed $LIBNAME,
399 dnl 4. if it doesn't exist as a directory.
400 if test "X$additional_libdir" != "X/usr/lib"; then
401 haveit=
402 if test "X$additional_libdir" = "X/usr/local/lib"; then
403 if test -n "$GCC"; then
404 case $host_os in
405 linux*) haveit=yes;;
406 esac
407 fi
408 fi
409 if test -z "$haveit"; then
410 haveit=
411 for x in $LDFLAGS $LIB[]NAME; do
412 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
413 if test "X$x" = "X-L$additional_libdir"; then
414 haveit=yes
415 break
416 fi
417 done
418 if test -z "$haveit"; then
419 if test -d "$additional_libdir"; then
420 dnl Really add $additional_libdir to $LIBNAME.
421 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
422 fi
423 fi
424 haveit=
425 for x in $LDFLAGS $LTLIB[]NAME; do
426 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
427 if test "X$x" = "X-L$additional_libdir"; then
428 haveit=yes
429 break
430 fi
431 done
432 if test -z "$haveit"; then
433 if test -d "$additional_libdir"; then
434 dnl Really add $additional_libdir to $LTLIBNAME.
435 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
436 fi
437 fi
438 fi
439 fi
440 ;;
441 -R*)
442 dir=`echo "X$dep" | sed -e 's/^X-R//'`
443 if test "$enable_rpath" != no; then
444 dnl Potentially add DIR to rpathdirs.
445 dnl The rpathdirs will be appended to $LIBNAME at the end.
446 haveit=
447 for x in $rpathdirs; do
448 if test "X$x" = "X$dir"; then
449 haveit=yes
450 break
451 fi
452 done
453 if test -z "$haveit"; then
454 rpathdirs="$rpathdirs $dir"
455 fi
456 dnl Potentially add DIR to ltrpathdirs.
457 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
458 haveit=
459 for x in $ltrpathdirs; do
460 if test "X$x" = "X$dir"; then
461 haveit=yes
462 break
463 fi
464 done
465 if test -z "$haveit"; then
466 ltrpathdirs="$ltrpathdirs $dir"
467 fi
468 fi
469 ;;
470 -l*)
471 dnl Handle this in the next round.
472 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
473 ;;
474 *.la)
475 dnl Handle this in the next round. Throw away the .la's
476 dnl directory; it is already contained in a preceding -L
477 dnl option.
478 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
479 ;;
480 *)
481 dnl Most likely an immediate library name.
482 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
483 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
484 ;;
485 esac
486 done
487 fi
488 else
489 dnl Didn't find the library; assume it is in the system directories
490 dnl known to the linker and runtime loader. (All the system
491 dnl directories known to the linker should also be known to the
492 dnl runtime loader, otherwise the system is severely misconfigured.)
493 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
494 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
495 fi
496 fi
497 fi
498 done
499 done
500 if test "X$rpathdirs" != "X"; then
501 if test -n "$hardcode_libdir_separator"; then
502 dnl Weird platform: only the last -rpath option counts, the user must
503 dnl pass all path elements in one option. We can arrange that for a
504 dnl single library, but not when more than one $LIBNAMEs are used.
505 alldirs=
506 for found_dir in $rpathdirs; do
507 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
508 done
509 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
510 acl_save_libdir="$libdir"
511 libdir="$alldirs"
512 eval flag=\"$hardcode_libdir_flag_spec\"
513 libdir="$acl_save_libdir"
514 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
515 else
516 dnl The -rpath options are cumulative.
517 for found_dir in $rpathdirs; do
518 acl_save_libdir="$libdir"
519 libdir="$found_dir"
520 eval flag=\"$hardcode_libdir_flag_spec\"
521 libdir="$acl_save_libdir"
522 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
523 done
524 fi
525 fi
526 if test "X$ltrpathdirs" != "X"; then
527 dnl When using libtool, the option that works for both libraries and
528 dnl executables is -R. The -R options are cumulative.
529 for found_dir in $ltrpathdirs; do
530 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
531 done
532 fi
533])
534
535dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
536dnl unless already present in VAR.
537dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
538dnl contains two or three consecutive elements that belong together.
539AC_DEFUN([AC_LIB_APPENDTOVAR],
540[
541 for element in [$2]; do
542 haveit=
543 for x in $[$1]; do
544 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
545 if test "X$x" = "X$element"; then
546 haveit=yes
547 break
548 fi
549 done
550 if test -z "$haveit"; then
551 [$1]="${[$1]}${[$1]:+ }$element"
552 fi
553 done
554])
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
new file mode 100644
index 00000000..b8b79ab9
--- /dev/null
+++ b/m4/lib-prefix.m4
@@ -0,0 +1,148 @@
1# lib-prefix.m4 serial 1 (gettext-0.11)
2dnl Copyright (C) 2001-2002 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 From Bruno Haible.
10
11dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
12dnl to access previously installed libraries. The basic assumption is that
13dnl a user will want packages to use other packages he previously installed
14dnl with the same --prefix option.
15dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
16dnl libraries, but is otherwise very convenient.
17AC_DEFUN([AC_LIB_PREFIX],
18[
19 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
20 AC_REQUIRE([AC_PROG_CC])
21 AC_REQUIRE([AC_CANONICAL_HOST])
22 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
23 dnl By default, look in $includedir and $libdir.
24 use_additional=yes
25 AC_LIB_WITH_FINAL_PREFIX([
26 eval additional_includedir=\"$includedir\"
27 eval additional_libdir=\"$libdir\"
28 ])
29 AC_ARG_WITH([lib-prefix],
30[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
31 --without-lib-prefix don't search for libraries in includedir and libdir],
32[
33 if test "X$withval" = "Xno"; then
34 use_additional=no
35 else
36 if test "X$withval" = "X"; then
37 AC_LIB_WITH_FINAL_PREFIX([
38 eval additional_includedir=\"$includedir\"
39 eval additional_libdir=\"$libdir\"
40 ])
41 else
42 additional_includedir="$withval/include"
43 additional_libdir="$withval/lib"
44 fi
45 fi
46])
47 if test $use_additional = yes; then
48 dnl Potentially add $additional_includedir to $CPPFLAGS.
49 dnl But don't add it
50 dnl 1. if it's the standard /usr/include,
51 dnl 2. if it's already present in $CPPFLAGS,
52 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
53 dnl 4. if it doesn't exist as a directory.
54 if test "X$additional_includedir" != "X/usr/include"; then
55 haveit=
56 for x in $CPPFLAGS; do
57 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
58 if test "X$x" = "X-I$additional_includedir"; then
59 haveit=yes
60 break
61 fi
62 done
63 if test -z "$haveit"; then
64 if test "X$additional_includedir" = "X/usr/local/include"; then
65 if test -n "$GCC"; then
66 case $host_os in
67 linux*) haveit=yes;;
68 esac
69 fi
70 fi
71 if test -z "$haveit"; then
72 if test -d "$additional_includedir"; then
73 dnl Really add $additional_includedir to $CPPFLAGS.
74 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
75 fi
76 fi
77 fi
78 fi
79 dnl Potentially add $additional_libdir to $LDFLAGS.
80 dnl But don't add it
81 dnl 1. if it's the standard /usr/lib,
82 dnl 2. if it's already present in $LDFLAGS,
83 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
84 dnl 4. if it doesn't exist as a directory.
85 if test "X$additional_libdir" != "X/usr/lib"; then
86 haveit=
87 for x in $LDFLAGS; do
88 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
89 if test "X$x" = "X-L$additional_libdir"; then
90 haveit=yes
91 break
92 fi
93 done
94 if test -z "$haveit"; then
95 if test "X$additional_libdir" = "X/usr/local/lib"; then
96 if test -n "$GCC"; then
97 case $host_os in
98 linux*) haveit=yes;;
99 esac
100 fi
101 fi
102 if test -z "$haveit"; then
103 if test -d "$additional_libdir"; then
104 dnl Really add $additional_libdir to $LDFLAGS.
105 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
106 fi
107 fi
108 fi
109 fi
110 fi
111])
112
113dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
114dnl acl_final_exec_prefix, containing the values to which $prefix and
115dnl $exec_prefix will expand at the end of the configure script.
116AC_DEFUN([AC_LIB_PREPARE_PREFIX],
117[
118 dnl Unfortunately, prefix and exec_prefix get only finally determined
119 dnl at the end of configure.
120 if test "X$prefix" = "XNONE"; then
121 acl_final_prefix="$ac_default_prefix"
122 else
123 acl_final_prefix="$prefix"
124 fi
125 if test "X$exec_prefix" = "XNONE"; then
126 acl_final_exec_prefix='${prefix}'
127 else
128 acl_final_exec_prefix="$exec_prefix"
129 fi
130 acl_save_prefix="$prefix"
131 prefix="$acl_final_prefix"
132 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
133 prefix="$acl_save_prefix"
134])
135
136dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
137dnl variables prefix and exec_prefix bound to the values they will have
138dnl at the end of the configure script.
139AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
140[
141 acl_save_prefix="$prefix"
142 prefix="$acl_final_prefix"
143 acl_save_exec_prefix="$exec_prefix"
144 exec_prefix="$acl_final_exec_prefix"
145 $1
146 exec_prefix="$acl_save_exec_prefix"
147 prefix="$acl_save_prefix"
148])
diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4
new file mode 100644
index 00000000..c28466bb
--- /dev/null
+++ b/m4/ls-mntd-fs.m4
@@ -0,0 +1,282 @@
1#serial 14
2
3dnl From Jim Meyering.
4dnl
5dnl This is not pretty. I've just taken the autoconf code and wrapped
6dnl it in an AC_DEFUN.
7dnl
8
9# jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
10AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS],
11 [
12AC_CHECK_FUNCS(listmntent getmntinfo)
13AC_CHECK_HEADERS_ONCE(sys/param.h)
14
15# We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
16# NGROUPS (as the array dimension for a struct member) without a definition.
17AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
18
19AC_CHECK_HEADERS(mntent.h sys/mount.h sys/fs_types.h)
20 getfsstat_includes="\
21$ac_includes_default
22#if HAVE_SYS_PARAM_H
23# include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
24#endif
25#if HAVE_SYS_UCRED_H
26# include <grp.h> /* needed for definition of NGROUPS */
27# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
28#endif
29#if HAVE_SYS_MOUNT_H
30# include <sys/mount.h>
31#endif
32#if HAVE_SYS_FS_TYPES_H
33# include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
34#endif
35"
36AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
37
38# Determine how to get the list of mounted filesystems.
39ac_list_mounted_fs=
40
41# If the getmntent function is available but not in the standard library,
42# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
43AC_FUNC_GETMNTENT
44
45# This test must precede the ones for getmntent because Unicos-9 is
46# reported to have the getmntent function, but its support is incompatible
47# with other getmntent implementations.
48
49# NOTE: Normally, I wouldn't use a check for system type as I've done for
50# `CRAY' below since that goes against the whole autoconf philosophy. But
51# I think there is too great a chance that some non-Cray system has a
52# function named listmntent to risk the false positive.
53
54if test -z "$ac_list_mounted_fs"; then
55 # Cray UNICOS 9
56 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
57 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
58 [fu_cv_sys_mounted_cray_listmntent=no
59 AC_EGREP_CPP(yes,
60 [#ifdef _CRAY
61yes
62#endif
63 ], [test $ac_cv_func_listmntent = yes \
64 && fu_cv_sys_mounted_cray_listmntent=yes]
65 )
66 ]
67 )
68 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
69 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
70 ac_list_mounted_fs=found
71 AC_DEFINE(MOUNTED_LISTMNTENT, 1,
72 [Define if there is a function named listmntent that can be used to
73 list all mounted filesystems. (UNICOS)])
74 fi
75fi
76
77if test -z "$ac_list_mounted_fs"; then
78 # AIX.
79 AC_MSG_CHECKING([for mntctl function and struct vmount])
80 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
81 [AC_TRY_CPP([#include <fshelp.h>],
82 fu_cv_sys_mounted_vmount=yes,
83 fu_cv_sys_mounted_vmount=no)])
84 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
85 if test $fu_cv_sys_mounted_vmount = yes; then
86 ac_list_mounted_fs=found
87 AC_DEFINE(MOUNTED_VMOUNT, 1,
88 [Define if there is a function named mntctl that can be used to read
89 the list of mounted filesystems, and there is a system header file
90 that declares `struct vmount.' (AIX)])
91 fi
92fi
93
94if test $ac_cv_func_getmntent = yes; then
95
96 # This system has the getmntent function.
97 # Determine whether it's the one-argument variant or the two-argument one.
98
99 if test -z "$ac_list_mounted_fs"; then
100 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
101 AC_MSG_CHECKING([for one-argument getmntent function])
102 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
103 [AC_TRY_COMPILE([
104/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
105#include <stdio.h>
106
107#include <mntent.h>
108#if !defined MOUNTED
109# if defined _PATH_MOUNTED /* GNU libc */
110# define MOUNTED _PATH_MOUNTED
111# endif
112# if defined MNT_MNTTAB /* HP-UX. */
113# define MOUNTED MNT_MNTTAB
114# endif
115# if defined MNTTABNAME /* Dynix. */
116# define MOUNTED MNTTABNAME
117# endif
118#endif
119],
120 [ struct mntent *mnt = 0; char *table = MOUNTED; ],
121 fu_cv_sys_mounted_getmntent1=yes,
122 fu_cv_sys_mounted_getmntent1=no)])
123 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
124 if test $fu_cv_sys_mounted_getmntent1 = yes; then
125 ac_list_mounted_fs=found
126 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
127 [Define if there is a function named getmntent for reading the list
128 of mounted filesystems, and that function takes a single argument.
129 (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
130 fi
131 fi
132
133 if test -z "$ac_list_mounted_fs"; then
134 # SVR4
135 AC_MSG_CHECKING([for two-argument getmntent function])
136 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
137 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
138 fu_cv_sys_mounted_getmntent2=yes,
139 fu_cv_sys_mounted_getmntent2=no)])
140 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
141 if test $fu_cv_sys_mounted_getmntent2 = yes; then
142 ac_list_mounted_fs=found
143 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
144 [Define if there is a function named getmntent for reading the list of
145 mounted filesystems, and that function takes two arguments. (SVR4)])
146 fi
147 fi
148
149fi
150
151if test -z "$ac_list_mounted_fs"; then
152 # DEC Alpha running OSF/1, and Apple Darwin 1.3.
153 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
154
155 AC_MSG_CHECKING([for getfsstat function])
156 AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
157 [AC_TRY_LINK([
158#include <sys/types.h>
159#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
160# define FS_TYPE(Ent) ((Ent).f_fstypename)
161#else
162# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
163#endif
164]$getfsstat_includes
165,
166 [struct statfs *stats;
167 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
168 char *t = FS_TYPE (*stats); ],
169 fu_cv_sys_mounted_getfsstat=yes,
170 fu_cv_sys_mounted_getfsstat=no)])
171 AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
172 if test $fu_cv_sys_mounted_getfsstat = yes; then
173 ac_list_mounted_fs=found
174 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
175 [Define if there is a function named getfsstat for reading the
176 list of mounted filesystems. (DEC Alpha running OSF/1)])
177 fi
178fi
179
180if test -z "$ac_list_mounted_fs"; then
181 # SVR3
182 AC_MSG_CHECKING([for FIXME existence of three headers])
183 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
184 [AC_TRY_CPP([
185#include <sys/statfs.h>
186#include <sys/fstyp.h>
187#include <mnttab.h>],
188 fu_cv_sys_mounted_fread_fstyp=yes,
189 fu_cv_sys_mounted_fread_fstyp=no)])
190 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
191 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
192 ac_list_mounted_fs=found
193 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
194 [Define if (like SVR2) there is no specific function for reading the
195 list of mounted filesystems, and your system has these header files:
196 <sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
197 fi
198fi
199
200if test -z "$ac_list_mounted_fs"; then
201 # 4.4BSD and DEC OSF/1.
202 AC_MSG_CHECKING([for getmntinfo function])
203 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
204 [
205 test "$ac_cv_func_getmntinfo" = yes \
206 && fu_cv_sys_mounted_getmntinfo=yes \
207 || fu_cv_sys_mounted_getmntinfo=no
208 ])
209 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
210 if test $fu_cv_sys_mounted_getmntinfo = yes; then
211 ac_list_mounted_fs=found
212 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
213 [Define if there is a function named getmntinfo for reading the
214 list of mounted filesystems. (4.4BSD, Darwin)])
215 fi
216fi
217
218if test -z "$ac_list_mounted_fs"; then
219 # Ultrix
220 AC_MSG_CHECKING([for getmnt function])
221 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
222 [AC_TRY_CPP([
223#include <sys/fs_types.h>
224#include <sys/mount.h>],
225 fu_cv_sys_mounted_getmnt=yes,
226 fu_cv_sys_mounted_getmnt=no)])
227 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
228 if test $fu_cv_sys_mounted_getmnt = yes; then
229 ac_list_mounted_fs=found
230 AC_DEFINE(MOUNTED_GETMNT, 1,
231 [Define if there is a function named getmnt for reading the list of
232 mounted filesystems. (Ultrix)])
233 fi
234fi
235
236if test -z "$ac_list_mounted_fs"; then
237 # BeOS
238 AC_CHECK_FUNCS(next_dev fs_stat_dev)
239 AC_CHECK_HEADERS(fs_info.h)
240 AC_MSG_CHECKING([for BEOS mounted file system support functions])
241 if test $ac_cv_header_fs_info_h = yes \
242 && test $ac_cv_func_next_dev = yes \
243 && test $ac_cv_func_fs_stat_dev = yes; then
244 fu_result=yes
245 else
246 fu_result=no
247 fi
248 AC_MSG_RESULT($fu_result)
249 if test $fu_result = yes; then
250 ac_list_mounted_fs=found
251 AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
252 [Define if there are functions named next_dev and fs_stat_dev for
253 reading the list of mounted filesystems. (BeOS)])
254 fi
255fi
256
257if test -z "$ac_list_mounted_fs"; then
258 # SVR2
259 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
260 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
261 [AC_TRY_CPP([#include <mnttab.h>],
262 fu_cv_sys_mounted_fread=yes,
263 fu_cv_sys_mounted_fread=no)])
264 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
265 if test $fu_cv_sys_mounted_fread = yes; then
266 ac_list_mounted_fs=found
267 AC_DEFINE(MOUNTED_FREAD, 1,
268 [Define if there is no specific function for reading the list of
269 mounted filesystems. fread will be used to read /etc/mnttab.
270 (SVR2) ])
271 fi
272fi
273
274if test -z "$ac_list_mounted_fs"; then
275 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
276 # FIXME -- no need to abort building the whole package
277 # Can't build mountlist.c or anything that needs its functions
278fi
279
280AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
281
282 ])
diff --git a/m4/malloc.m4 b/m4/malloc.m4
new file mode 100644
index 00000000..2452acf0
--- /dev/null
+++ b/m4/malloc.m4
@@ -0,0 +1,25 @@
1# malloc.m4 serial 7
2dnl Copyright (C) 2002 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 From Jim Meyering.
10dnl Determine whether malloc accepts 0 as its argument.
11dnl If it doesn't, arrange to use the replacement function.
12
13AC_DEFUN([jm_FUNC_MALLOC],
14[
15 AC_REQUIRE([AC_FUNC_MALLOC])
16 dnl autoconf < 2.57 used the symbol ac_cv_func_malloc_works.
17 if test X"$ac_cv_func_malloc_0_nonnull" = Xno || test X"$ac_cv_func_malloc_works" = Xno; then
18 gl_PREREQ_MALLOC
19 fi
20])
21
22# Prerequisites of lib/malloc.c.
23AC_DEFUN([gl_PREREQ_MALLOC], [
24 :
25])
diff --git a/m4/mountlist.m4 b/m4/mountlist.m4
new file mode 100644
index 00000000..6a6b38c3
--- /dev/null
+++ b/m4/mountlist.m4
@@ -0,0 +1,26 @@
1# mountlist.m4 serial 2
2dnl Copyright (C) 2002, 2003 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
9AC_DEFUN([gl_MOUNTLIST],
10[
11 jm_LIST_MOUNTED_FILESYSTEMS([gl_cv_list_mounted_fs=yes],
12 [gl_cv_list_mounted_fs=no])
13 if test $gl_cv_list_mounted_fs = yes; then
14 AC_LIBOBJ(mountlist)
15 gl_PREREQ_MOUNTLIST_EXTRA
16 fi
17])
18
19# Prerequisites of lib/mountlist.c not done by jm_LIST_MOUNTED_FILESYSTEMS.
20AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
21[
22 dnl Note jm_LIST_MOUNTED_FILESYSTEMS checks for mntent.h, not sys/mntent.h.
23 AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
24 AC_CHECK_HEADERS(sys/mntent.h)
25 jm_FSTYPENAME
26])
diff --git a/m4/np_coreutils.m4 b/m4/np_coreutils.m4
new file mode 100644
index 00000000..3f87686f
--- /dev/null
+++ b/m4/np_coreutils.m4
@@ -0,0 +1,17 @@
1dnl These are for the libs and macros from coreutils
2dnl Currently utilising v5.2.1
3
4dnl We use jm_ for non Autoconf macros.
5m4_pattern_forbid([^np_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
6m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
7m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
8
9AC_DEFUN([np_COREUTILS],
10[
11 AC_REQUIRE([jm_AFS])
12 AC_REQUIRE([gl_EXITFAIL])
13 AC_REQUIRE([gl_XALLOC])
14 AC_REQUIRE([gl_MOUNTLIST])
15 AC_REQUIRE([gl_FSUSAGE])
16 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
17])
diff --git a/m4/onceonly.m4 b/m4/onceonly.m4
new file mode 100644
index 00000000..50b33f48
--- /dev/null
+++ b/m4/onceonly.m4
@@ -0,0 +1,63 @@
1# onceonly.m4 serial 3 (gettext-0.12)
2dnl Copyright (C) 2002, 2003 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_HEADER_STDC]) like AC_HEADER_STDC
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 Autoconf version 2.57 or newer is recommended.
25AC_PREREQ(2.54)
26
27# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
28# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
29AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
30 :
31 AC_FOREACH([gl_HEADER_NAME], [$1], [
32 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(m4_defn([gl_HEADER_NAME]),
33 [-./], [___])), [
34 AC_CHECK_HEADERS(gl_HEADER_NAME)
35 ])
36 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
37 [-./], [___])))
38 ])
39])
40
41# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
42# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
43AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
44 :
45 AC_FOREACH([gl_FUNC_NAME], [$1], [
46 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
47 AC_CHECK_FUNCS(m4_defn([gl_FUNC_NAME]))
48 ])
49 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
50 ])
51])
52
53# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
54# AC_CHECK_DECLS(DECL1, DECL2, ...).
55AC_DEFUN([AC_CHECK_DECLS_ONCE], [
56 :
57 AC_FOREACH([gl_DECL_NAME], [$1], [
58 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
59 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
60 ])
61 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
62 ])
63])
diff --git a/m4/progtest.m4 b/m4/progtest.m4
new file mode 100644
index 00000000..443c8e30
--- /dev/null
+++ b/m4/progtest.m4
@@ -0,0 +1,59 @@
1# progtest.m4 serial 2 (gettext-0.10.40)
2dnl Copyright (C) 1996-2002 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.
8dnl
9dnl This file can can be used in projects which are not available under
10dnl the GNU General Public License or the GNU Library General Public
11dnl License but which still want to provide support for the GNU gettext
12dnl functionality.
13dnl Please note that the actual code of the GNU gettext library is covered
14dnl by the GNU Library General Public License, and the rest of the GNU
15dnl gettext package package is covered by the GNU General Public License.
16dnl They are *not* in the public domain.
17
18dnl Authors:
19dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
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[# Extract the first word of "$2", so it can be a program name with args.
27set dummy $2; ac_word=[$]2
28AC_MSG_CHECKING([for $ac_word])
29AC_CACHE_VAL(ac_cv_path_$1,
30[case "[$]$1" in
31 /*)
32 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
33 ;;
34 *)
35 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
36 for ac_dir in ifelse([$5], , $PATH, [$5]); do
37 test -z "$ac_dir" && ac_dir=.
38 if test -f $ac_dir/$ac_word; then
39 if [$3]; then
40 ac_cv_path_$1="$ac_dir/$ac_word"
41 break
42 fi
43 fi
44 done
45 IFS="$ac_save_ifs"
46dnl If no 4th arg is given, leave the cache variable unset,
47dnl so AC_PATH_PROGS will keep looking.
48ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
49])dnl
50 ;;
51esac])dnl
52$1="$ac_cv_path_$1"
53if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
54 AC_MSG_RESULT([$]$1)
55else
56 AC_MSG_RESULT(no)
57fi
58AC_SUBST($1)dnl
59])
diff --git a/m4/realloc.m4 b/m4/realloc.m4
new file mode 100644
index 00000000..9f746f19
--- /dev/null
+++ b/m4/realloc.m4
@@ -0,0 +1,25 @@
1# realloc.m4 serial 7
2dnl Copyright (C) 2002 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 From Jim Meyering.
10dnl Determine whether realloc works when both arguments are 0.
11dnl If it doesn't, arrange to use the replacement function.
12
13AC_DEFUN([jm_FUNC_REALLOC],
14[
15 AC_REQUIRE([AC_FUNC_REALLOC])
16 dnl autoconf < 2.57 used the symbol ac_cv_func_realloc_works.
17 if test X"$ac_cv_func_realloc_0_nonnull" = Xno || test X"$ac_cv_func_realloc_works" = Xno; then
18 gl_PREREQ_REALLOC
19 fi
20])
21
22# Prerequisites of lib/realloc.c.
23AC_DEFUN([gl_PREREQ_REALLOC], [
24 :
25])
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4
new file mode 100644
index 00000000..4b5a4ac6
--- /dev/null
+++ b/m4/stdint_h.m4
@@ -0,0 +1,28 @@
1# stdint_h.m4 serial 2 (gettext-0.11.4)
2dnl Copyright (C) 1997-2002 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 From Paul Eggert.
10
11# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
12# doesn't clash with <sys/types.h>, and declares uintmax_t.
13
14AC_DEFUN([jm_AC_HEADER_STDINT_H],
15[
16 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
17 [AC_TRY_COMPILE(
18 [#include <sys/types.h>
19#include <stdint.h>],
20 [uintmax_t i = (uintmax_t) -1;],
21 jm_ac_cv_header_stdint_h=yes,
22 jm_ac_cv_header_stdint_h=no)])
23 if test $jm_ac_cv_header_stdint_h = yes; then
24 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
25[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
26 and declares uintmax_t. ])
27 fi
28])
diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4
new file mode 100644
index 00000000..ec3a8b92
--- /dev/null
+++ b/m4/uintmax_t.m4
@@ -0,0 +1,29 @@
1# uintmax_t.m4 serial 6 (gettext-0.11)
2dnl Copyright (C) 1997-2002 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 From Paul Eggert.
10
11AC_PREREQ(2.13)
12
13# Define uintmax_t to `unsigned long' or `unsigned long long'
14# if <inttypes.h> does not exist.
15
16AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
17[
18 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
19 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
20 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
21 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
22 test $ac_cv_type_unsigned_long_long = yes \
23 && ac_type='unsigned long long' \
24 || ac_type='unsigned long'
25 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
26 [Define to unsigned long or unsigned long long
27 if <inttypes.h> and <stdint.h> don't define.])
28 fi
29])
diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4
new file mode 100644
index 00000000..c375e474
--- /dev/null
+++ b/m4/ulonglong.m4
@@ -0,0 +1,23 @@
1# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
2dnl Copyright (C) 1999-2002 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 From Paul Eggert.
10
11AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
12[
13 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
14 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
15 [unsigned long long ullmax = (unsigned long long) -1;
16 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
17 ac_cv_type_unsigned_long_long=yes,
18 ac_cv_type_unsigned_long_long=no)])
19 if test $ac_cv_type_unsigned_long_long = yes; then
20 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
21 [Define if you have the unsigned long long type.])
22 fi
23])
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4
new file mode 100644
index 00000000..f8e98f1d
--- /dev/null
+++ b/m4/unlocked-io.m4
@@ -0,0 +1,22 @@
1#serial 8 -*- autoconf -*-
2
3dnl From Jim Meyering.
4dnl
5dnl See if the glibc *_unlocked I/O macros or functions are available.
6dnl Use only those *_unlocked macros or functions that are declared
7dnl (because some of them were declared in Solaris 2.5.1 but were removed
8dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
9dnl on Solaris 2.6).
10
11AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
12[
13 dnl Persuade glibc and Solaris <stdio.h> to declare
14 dnl fgets_unlocked(), fputs_unlocked() etc.
15 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
16
17 AC_CHECK_DECLS_ONCE(
18 [clearerr_unlocked feof_unlocked ferror_unlocked
19 fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
20 fread_unlocked fwrite_unlocked getc_unlocked
21 getchar_unlocked putc_unlocked putchar_unlocked])
22])
diff --git a/m4/xalloc.m4 b/m4/xalloc.m4
new file mode 100644
index 00000000..dec84177
--- /dev/null
+++ b/m4/xalloc.m4
@@ -0,0 +1,32 @@
1# xalloc.m4 serial 8
2dnl Copyright (C) 2002-2003 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
9AC_DEFUN([gl_XALLOC],
10[
11 gl_PREREQ_XALLOC
12 gl_PREREQ_XMALLOC
13 gl_PREREQ_XSTRDUP
14])
15
16# Prerequisites of lib/xalloc.h.
17AC_DEFUN([gl_PREREQ_XALLOC], [
18 :
19])
20
21# Prerequisites of lib/xmalloc.c.
22AC_DEFUN([gl_PREREQ_XMALLOC], [
23 AC_REQUIRE([AC_C_INLINE])
24 AC_REQUIRE([jm_FUNC_MALLOC])
25 AC_REQUIRE([jm_FUNC_REALLOC])
26 :
27])
28
29# Prerequisites of lib/xstrdup.c.
30AC_DEFUN([gl_PREREQ_XSTRDUP], [
31 :
32])