summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-01-31 15:36:15 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-01-31 15:36:15 +0100
commitf1d177d730edc36c47a1c152464931ea873af958 (patch)
tree7602d9cb35d26e445218e25fbf004476c1312b9d
parent34c6fae0ca405cddf2d60e76d785fc520d336582 (diff)
downloadmonitoring-plugins-f1d177d730edc36c47a1c152464931ea873af958.tar.gz
remove gl/c++defs, replace gl/gettext with gl/gettext-h
-rw-r--r--gl/Makefile.am27
-rw-r--r--gl/m4/gettext.m4386
-rw-r--r--gl/m4/gnulib-cache.m46
-rw-r--r--gl/m4/gnulib-comp.m417
-rw-r--r--gl/m4/host-cpu-c-abi.m4678
-rw-r--r--gl/m4/iconv.m4293
-rw-r--r--gl/m4/intl-thread-locale.m4219
-rw-r--r--gl/m4/intlmacosx.m465
-rw-r--r--gl/m4/lib-ld.m4168
-rw-r--r--gl/m4/lib-link.m4813
-rw-r--r--gl/m4/lib-prefix.m4323
-rw-r--r--gl/m4/nls.m432
-rw-r--r--gl/m4/po.m4450
-rw-r--r--gl/m4/progtest.m491
14 files changed, 3 insertions, 3565 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 3865bf78..dcebd4aa 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -33,7 +33,6 @@
33# --no-libtool \ 33# --no-libtool \
34# --macro-prefix=gl \ 34# --macro-prefix=gl \
35# --no-vc-files \ 35# --no-vc-files \
36# --no-vc-files \
37# base64 \ 36# base64 \
38# crypto/sha256 \ 37# crypto/sha256 \
39# dirname \ 38# dirname \
@@ -44,7 +43,7 @@
44# gethostname \ 43# gethostname \
45# getloadavg \ 44# getloadavg \
46# getopt-gnu \ 45# getopt-gnu \
47# gettext \ 46# gettext-h \
48# idpriv-droptemp \ 47# idpriv-droptemp \
49# mountlist \ 48# mountlist \
50# regex \ 49# regex \
@@ -703,23 +702,6 @@ libgnu_a_SOURCES += getprogname.h getprogname.c
703 702
704## end gnulib module getprogname 703## end gnulib module getprogname
705 704
706## begin gnulib module gettext
707
708# If your project uses "gettextize --intl" to put a source-code
709# copy of libintl into the package, every Makefile.am needs
710# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
711# Here's one way to do this:
712#AM_CPPFLAGS += -I$(top_builddir)/intl
713# This option has no effect when the user disables NLS (because then
714# the intl directory contains no libintl.h file). This option is not
715# enabled by default because the intl directory might not exist if
716# your project does not use "gettext --intl", and some compilers
717# complain about -I options applied to nonexistent directories.
718
719EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
720
721## end gnulib module gettext
722
723## begin gnulib module gettext-h 705## begin gnulib module gettext-h
724 706
725libgnu_a_SOURCES += gettext.h 707libgnu_a_SOURCES += gettext.h
@@ -767,13 +749,6 @@ EXTRA_DIST += hard-locale.h
767 749
768## end gnulib module hard-locale 750## end gnulib module hard-locale
769 751
770## begin gnulib module havelib
771
772
773EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
774
775## end gnulib module havelib
776
777## begin gnulib module ialloc 752## begin gnulib module ialloc
778 753
779libgnu_a_SOURCES += ialloc.c 754libgnu_a_SOURCES += ialloc.c
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
deleted file mode 100644
index a0eda3d8..00000000
--- a/gl/m4/gettext.m4
+++ /dev/null
@@ -1,386 +0,0 @@
1# gettext.m4 serial 71 (gettext-0.20.2)
2dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Lesser General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Lesser General Public License, and the rest of the GNU
13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
19
20dnl Macro to add for using GNU gettext.
21
22dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
24dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
25dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
26dnl If INTLSYMBOL is 'use-libtool', then a libtool library
27dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
28dnl depending on --{enable,disable}-{shared,static} and on the presence of
29dnl AM-DISABLE-SHARED).
30dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
31dnl implementations (in libc or libintl) without the ngettext() function
32dnl will be ignored. If NEEDSYMBOL is specified and is
33dnl 'need-formatstring-macros', then GNU gettext implementations that don't
34dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
35dnl INTLDIR is used to find the intl libraries. If empty,
36dnl the value '$(top_builddir)/intl/' is used.
37dnl
38dnl The result of the configuration is one of three cases:
39dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
40dnl and used.
41dnl Catalog format: GNU --> install in $(datadir)
42dnl Catalog extension: .mo after installation, .gmo in source tree
43dnl 2) GNU gettext has been found in the system's C library.
44dnl Catalog format: GNU --> install in $(datadir)
45dnl Catalog extension: .mo after installation, .gmo in source tree
46dnl 3) No internationalization, always use English msgid.
47dnl Catalog format: none
48dnl Catalog extension: none
49dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
50dnl The use of .gmo is historical (it was needed to avoid overwriting the
51dnl GNU format catalogs when building on a platform with an X/Open gettext),
52dnl but we keep it in order not to force irrelevant filename changes on the
53dnl maintainers.
54dnl
55AC_DEFUN([AM_GNU_GETTEXT],
56[
57 dnl Argument checking.
58 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
59 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
60])])])])
61 ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
62 [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
63])])
64 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
65 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
66])])])])
67 define([gt_included_intl],
68 ifelse([$1], [external], [no], [yes]))
69 gt_NEEDS_INIT
70 AM_GNU_GETTEXT_NEED([$2])
71
72 AC_REQUIRE([AM_PO_SUBDIRS])dnl
73 ifelse(gt_included_intl, yes, [
74 AC_REQUIRE([AM_INTL_SUBDIR])dnl
75 ])
76
77 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
78 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
79 AC_REQUIRE([AC_LIB_RPATH])
80
81 dnl Sometimes libintl requires libiconv, so first search for libiconv.
82 dnl Ideally we would do this search only after the
83 dnl if test "$USE_NLS" = "yes"; then
84 dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
85 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
86 dnl the configure script would need to contain the same shell code
87 dnl again, outside any 'if'. There are two solutions:
88 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
89 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
90 dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
91 ifelse(gt_included_intl, yes, , [
92 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93 ])
94
95 dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
96 gt_INTL_MACOSX
97
98 dnl Set USE_NLS.
99 AC_REQUIRE([AM_NLS])
100
101 ifelse(gt_included_intl, yes, [
102 BUILD_INCLUDED_LIBINTL=no
103 USE_INCLUDED_LIBINTL=no
104 ])
105 LIBINTL=
106 LTLIBINTL=
107 POSUB=
108
109 dnl Add a version number to the cache macros.
110 case " $gt_needs " in
111 *" need-formatstring-macros "*) gt_api_version=3 ;;
112 *" need-ngettext "*) gt_api_version=2 ;;
113 *) gt_api_version=1 ;;
114 esac
115 gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
116 gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
117
118 dnl If we use NLS figure out what method
119 if test "$USE_NLS" = "yes"; then
120 gt_use_preinstalled_gnugettext=no
121 ifelse(gt_included_intl, yes, [
122 AC_MSG_CHECKING([whether included gettext is requested])
123 AC_ARG_WITH([included-gettext],
124 [ --with-included-gettext use the GNU gettext library included here],
125 nls_cv_force_use_gnu_gettext=$withval,
126 nls_cv_force_use_gnu_gettext=no)
127 AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
128
129 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
130 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
131 ])
132 dnl User does not insist on using GNU NLS library. Figure out what
133 dnl to use. If GNU gettext is available we use this. Else we have
134 dnl to fall back to GNU NLS library.
135
136 if test $gt_api_version -ge 3; then
137 gt_revision_test_code='
138#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
139#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
140#endif
141changequote(,)dnl
142typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
143changequote([,])dnl
144'
145 else
146 gt_revision_test_code=
147 fi
148 if test $gt_api_version -ge 2; then
149 gt_expression_test_code=' + * ngettext ("", "", 0)'
150 else
151 gt_expression_test_code=
152 fi
153
154 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
155 [AC_LINK_IFELSE(
156 [AC_LANG_PROGRAM(
157 [[
158#include <libintl.h>
159#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
160extern int _nl_msg_cat_cntr;
161extern int *_nl_domain_bindings;
162#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
163#else
164#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
165#endif
166$gt_revision_test_code
167 ]],
168 [[
169bindtextdomain ("", "");
170return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
171 ]])],
172 [eval "$gt_func_gnugettext_libc=yes"],
173 [eval "$gt_func_gnugettext_libc=no"])])
174
175 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
176 dnl Sometimes libintl requires libiconv, so first search for libiconv.
177 ifelse(gt_included_intl, yes, , [
178 AM_ICONV_LINK
179 ])
180 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
181 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
182 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
183 dnl even if libiconv doesn't exist.
184 AC_LIB_LINKFLAGS_BODY([intl])
185 AC_CACHE_CHECK([for GNU gettext in libintl],
186 [$gt_func_gnugettext_libintl],
187 [gt_save_CPPFLAGS="$CPPFLAGS"
188 CPPFLAGS="$CPPFLAGS $INCINTL"
189 gt_save_LIBS="$LIBS"
190 LIBS="$LIBS $LIBINTL"
191 dnl Now see whether libintl exists and does not depend on libiconv.
192 AC_LINK_IFELSE(
193 [AC_LANG_PROGRAM(
194 [[
195#include <libintl.h>
196#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
197extern int _nl_msg_cat_cntr;
198extern
199#ifdef __cplusplus
200"C"
201#endif
202const char *_nl_expand_alias (const char *);
203#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
204#else
205#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
206#endif
207$gt_revision_test_code
208 ]],
209 [[
210bindtextdomain ("", "");
211return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
212 ]])],
213 [eval "$gt_func_gnugettext_libintl=yes"],
214 [eval "$gt_func_gnugettext_libintl=no"])
215 dnl Now see whether libintl exists and depends on libiconv.
216 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
217 LIBS="$LIBS $LIBICONV"
218 AC_LINK_IFELSE(
219 [AC_LANG_PROGRAM(
220 [[
221#include <libintl.h>
222#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
223extern int _nl_msg_cat_cntr;
224extern
225#ifdef __cplusplus
226"C"
227#endif
228const char *_nl_expand_alias (const char *);
229#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
230#else
231#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
232#endif
233$gt_revision_test_code
234 ]],
235 [[
236bindtextdomain ("", "");
237return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
238 ]])],
239 [LIBINTL="$LIBINTL $LIBICONV"
240 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
241 eval "$gt_func_gnugettext_libintl=yes"
242 ])
243 fi
244 CPPFLAGS="$gt_save_CPPFLAGS"
245 LIBS="$gt_save_LIBS"])
246 fi
247
248 dnl If an already present or preinstalled GNU gettext() is found,
249 dnl use it. But if this macro is used in GNU gettext, and GNU
250 dnl gettext is already preinstalled in libintl, we update this
251 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
252 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
253 || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
254 && test "$PACKAGE" != gettext-runtime \
255 && test "$PACKAGE" != gettext-tools; }; then
256 gt_use_preinstalled_gnugettext=yes
257 else
258 dnl Reset the values set by searching for libintl.
259 LIBINTL=
260 LTLIBINTL=
261 INCINTL=
262 fi
263
264 ifelse(gt_included_intl, yes, [
265 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
266 dnl GNU gettext is not found in the C library.
267 dnl Fall back on included GNU gettext library.
268 nls_cv_use_gnu_gettext=yes
269 fi
270 fi
271
272 if test "$nls_cv_use_gnu_gettext" = "yes"; then
273 dnl Mark actions used to generate GNU NLS library.
274 BUILD_INCLUDED_LIBINTL=yes
275 USE_INCLUDED_LIBINTL=yes
276 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
277 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
278 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
279 fi
280
281 CATOBJEXT=
282 if test "$gt_use_preinstalled_gnugettext" = "yes" \
283 || test "$nls_cv_use_gnu_gettext" = "yes"; then
284 dnl Mark actions to use GNU gettext tools.
285 CATOBJEXT=.gmo
286 fi
287 ])
288
289 if test -n "$INTL_MACOSX_LIBS"; then
290 if test "$gt_use_preinstalled_gnugettext" = "yes" \
291 || test "$nls_cv_use_gnu_gettext" = "yes"; then
292 dnl Some extra flags are needed during linking.
293 LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
294 LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
295 fi
296 fi
297
298 if test "$gt_use_preinstalled_gnugettext" = "yes" \
299 || test "$nls_cv_use_gnu_gettext" = "yes"; then
300 AC_DEFINE([ENABLE_NLS], [1],
301 [Define to 1 if translation of program messages to the user's native language
302 is requested.])
303 else
304 USE_NLS=no
305 fi
306 fi
307
308 AC_MSG_CHECKING([whether to use NLS])
309 AC_MSG_RESULT([$USE_NLS])
310 if test "$USE_NLS" = "yes"; then
311 AC_MSG_CHECKING([where the gettext function comes from])
312 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
313 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
314 gt_source="external libintl"
315 else
316 gt_source="libc"
317 fi
318 else
319 gt_source="included intl directory"
320 fi
321 AC_MSG_RESULT([$gt_source])
322 fi
323
324 if test "$USE_NLS" = "yes"; then
325
326 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
327 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
328 AC_MSG_CHECKING([how to link with libintl])
329 AC_MSG_RESULT([$LIBINTL])
330 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
331 fi
332
333 dnl For backward compatibility. Some packages may be using this.
334 AC_DEFINE([HAVE_GETTEXT], [1],
335 [Define if the GNU gettext() function is already present or preinstalled.])
336 AC_DEFINE([HAVE_DCGETTEXT], [1],
337 [Define if the GNU dcgettext() function is already present or preinstalled.])
338 fi
339
340 dnl We need to process the po/ directory.
341 POSUB=po
342 fi
343
344 ifelse(gt_included_intl, yes, [
345 dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
346 dnl because some of the testsuite requires it.
347 BUILD_INCLUDED_LIBINTL=yes
348
349 dnl Make all variables we use known to autoconf.
350 AC_SUBST([BUILD_INCLUDED_LIBINTL])
351 AC_SUBST([USE_INCLUDED_LIBINTL])
352 AC_SUBST([CATOBJEXT])
353 ])
354
355 dnl For backward compatibility. Some Makefiles may be using this.
356 INTLLIBS="$LIBINTL"
357 AC_SUBST([INTLLIBS])
358
359 dnl Make all documented variables known to autoconf.
360 AC_SUBST([LIBINTL])
361 AC_SUBST([LTLIBINTL])
362 AC_SUBST([POSUB])
363])
364
365
366dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
367m4_define([gt_NEEDS_INIT],
368[
369 m4_divert_text([DEFAULTS], [gt_needs=])
370 m4_define([gt_NEEDS_INIT], [])
371])
372
373
374dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
375AC_DEFUN([AM_GNU_GETTEXT_NEED],
376[
377 m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
378])
379
380
381dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
382AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
383
384
385dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
386AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 4e5055e4..267f0692 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -38,7 +38,6 @@
38# --no-libtool \ 38# --no-libtool \
39# --macro-prefix=gl \ 39# --macro-prefix=gl \
40# --no-vc-files \ 40# --no-vc-files \
41# --no-vc-files \
42# base64 \ 41# base64 \
43# crypto/sha256 \ 42# crypto/sha256 \
44# dirname \ 43# dirname \
@@ -49,7 +48,7 @@
49# gethostname \ 48# gethostname \
50# getloadavg \ 49# getloadavg \
51# getopt-gnu \ 50# getopt-gnu \
52# gettext \ 51# gettext-h \
53# idpriv-droptemp \ 52# idpriv-droptemp \
54# mountlist \ 53# mountlist \
55# regex \ 54# regex \
@@ -65,7 +64,6 @@
65# Specification in the form of a few gnulib-tool.m4 macro invocations: 64# Specification in the form of a few gnulib-tool.m4 macro invocations:
66gl_LOCAL_DIR([]) 65gl_LOCAL_DIR([])
67gl_MODULES([ 66gl_MODULES([
68 --no-vc-files
69 base64 67 base64
70 crypto/sha256 68 crypto/sha256
71 dirname 69 dirname
@@ -76,7 +74,7 @@ gl_MODULES([
76 gethostname 74 gethostname
77 getloadavg 75 getloadavg
78 getopt-gnu 76 getopt-gnu
79 gettext 77 gettext-h
80 idpriv-droptemp 78 idpriv-droptemp
81 mountlist 79 mountlist
82 regex 80 regex
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index e6501b95..4764622e 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -101,11 +101,9 @@ AC_DEFUN([gl_EARLY],
101 # Code from module getopt-gnu: 101 # Code from module getopt-gnu:
102 # Code from module getopt-posix: 102 # Code from module getopt-posix:
103 # Code from module getprogname: 103 # Code from module getprogname:
104 # Code from module gettext:
105 # Code from module gettext-h: 104 # Code from module gettext-h:
106 # Code from module glibc-internal/dynarray: 105 # Code from module glibc-internal/dynarray:
107 # Code from module hard-locale: 106 # Code from module hard-locale:
108 # Code from module havelib:
109 # Code from module hostent: 107 # Code from module hostent:
110 # Code from module ialloc: 108 # Code from module ialloc:
111 # Code from module idpriv-droptemp: 109 # Code from module idpriv-droptemp:
@@ -429,15 +427,12 @@ AC_DEFUN([gl_INIT],
429 ]) 427 ])
430 gl_UNISTD_MODULE_INDICATOR([getopt-posix]) 428 gl_UNISTD_MODULE_INDICATOR([getopt-posix])
431 gl_FUNC_GETPROGNAME 429 gl_FUNC_GETPROGNAME
432 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
433 AM_GNU_GETTEXT_VERSION([0.20])
434 AC_SUBST([LIBINTL]) 430 AC_SUBST([LIBINTL])
435 AC_SUBST([LTLIBINTL]) 431 AC_SUBST([LTLIBINTL])
436 AC_PROG_MKDIR_P 432 AC_PROG_MKDIR_P
437 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) 433 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
438 LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" 434 LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL"
439 AC_SUBST([LIB_HARD_LOCALE]) 435 AC_SUBST([LIB_HARD_LOCALE])
440 AC_DEFUN([gl_HAVE_MODULE_HAVELIB])
441 gl_HOSTENT 436 gl_HOSTENT
442 gl_IDPRIV 437 gl_IDPRIV
443 gl_FUNC_INET_NTOP 438 gl_FUNC_INET_NTOP
@@ -977,7 +972,6 @@ AC_DEFUN([gltests_LIBSOURCES], [
977# This macro records the list of files which have been installed by 972# This macro records the list of files which have been installed by
978# gnulib-tool and may be removed by future gnulib-tool invocations. 973# gnulib-tool and may be removed by future gnulib-tool invocations.
979AC_DEFUN([gl_FILE_LIST], [ 974AC_DEFUN([gl_FILE_LIST], [
980 build-aux/config.rpath
981 lib/_Noreturn.h 975 lib/_Noreturn.h
982 lib/af_alg.c 976 lib/af_alg.c
983 lib/af_alg.h 977 lib/af_alg.h
@@ -1254,25 +1248,17 @@ AC_DEFUN([gl_FILE_LIST], [
1254 m4/getloadavg.m4 1248 m4/getloadavg.m4
1255 m4/getopt.m4 1249 m4/getopt.m4
1256 m4/getprogname.m4 1250 m4/getprogname.m4
1257 m4/gettext.m4
1258 m4/gl-openssl.m4 1251 m4/gl-openssl.m4
1259 m4/gnulib-common.m4 1252 m4/gnulib-common.m4
1260 m4/host-cpu-c-abi.m4
1261 m4/hostent.m4 1253 m4/hostent.m4
1262 m4/iconv.m4
1263 m4/idpriv.m4 1254 m4/idpriv.m4
1264 m4/include_next.m4 1255 m4/include_next.m4
1265 m4/inet_ntop.m4 1256 m4/inet_ntop.m4
1266 m4/intl-thread-locale.m4
1267 m4/intlmacosx.m4
1268 m4/intmax_t.m4 1257 m4/intmax_t.m4
1269 m4/inttypes.m4 1258 m4/inttypes.m4
1270 m4/inttypes_h.m4 1259 m4/inttypes_h.m4
1271 m4/langinfo_h.m4 1260 m4/langinfo_h.m4
1272 m4/largefile.m4 1261 m4/largefile.m4
1273 m4/lib-ld.m4
1274 m4/lib-link.m4
1275 m4/lib-prefix.m4
1276 m4/limits-h.m4 1262 m4/limits-h.m4
1277 m4/localcharset.m4 1263 m4/localcharset.m4
1278 m4/locale-fr.m4 1264 m4/locale-fr.m4
@@ -1301,7 +1287,6 @@ AC_DEFUN([gl_FILE_LIST], [
1301 m4/netdb_h.m4 1287 m4/netdb_h.m4
1302 m4/netinet_in_h.m4 1288 m4/netinet_in_h.m4
1303 m4/nl_langinfo.m4 1289 m4/nl_langinfo.m4
1304 m4/nls.m4
1305 m4/nocrash.m4 1290 m4/nocrash.m4
1306 m4/off_t.m4 1291 m4/off_t.m4
1307 m4/open-cloexec.m4 1292 m4/open-cloexec.m4
@@ -1309,9 +1294,7 @@ AC_DEFUN([gl_FILE_LIST], [
1309 m4/open.m4 1294 m4/open.m4
1310 m4/pathmax.m4 1295 m4/pathmax.m4
1311 m4/pid_t.m4 1296 m4/pid_t.m4
1312 m4/po.m4
1313 m4/printf.m4 1297 m4/printf.m4
1314 m4/progtest.m4
1315 m4/pthread_rwlock_rdlock.m4 1298 m4/pthread_rwlock_rdlock.m4
1316 m4/realloc.m4 1299 m4/realloc.m4
1317 m4/reallocarray.m4 1300 m4/reallocarray.m4
diff --git a/gl/m4/host-cpu-c-abi.m4 b/gl/m4/host-cpu-c-abi.m4
deleted file mode 100644
index 134f2283..00000000
--- a/gl/m4/host-cpu-c-abi.m4
+++ /dev/null
@@ -1,678 +0,0 @@
1# host-cpu-c-abi.m4 serial 15
2dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible and Sam Steingold.
8
9dnl Sets the HOST_CPU variable to the canonical name of the CPU.
10dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
11dnl C language ABI (application binary interface).
12dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
13dnl config.h.
14dnl
15dnl This canonical name can be used to select a particular assembly language
16dnl source file that will interoperate with C code on the given host.
17dnl
18dnl For example:
19dnl * 'i386' and 'sparc' are different canonical names, because code for i386
20dnl will not run on SPARC CPUs and vice versa. They have different
21dnl instruction sets.
22dnl * 'sparc' and 'sparc64' are different canonical names, because code for
23dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
24dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
25dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
26dnl mode, but not both.
27dnl * 'mips' and 'mipsn32' are different canonical names, because they use
28dnl different argument passing and return conventions for C functions, and
29dnl although the instruction set of 'mips' is a large subset of the
30dnl instruction set of 'mipsn32'.
31dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
32dnl different sizes for the C types like 'int' and 'void *', and although
33dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
34dnl * The same canonical name is used for different endiannesses. You can
35dnl determine the endianness through preprocessor symbols:
36dnl - 'arm': test __ARMEL__.
37dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
38dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN.
39dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
40dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
41dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
42dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
43dnl assembly language source files use such instructions, you will
44dnl need to make the distinction.
45dnl - Speed of execution of the common instruction set is reasonable across
46dnl the entire family of CPUs. If you have assembly language source files
47dnl that are optimized for particular CPU types (like GNU gmp has), you
48dnl will need to make the distinction.
49dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
50AC_DEFUN([gl_HOST_CPU_C_ABI],
51[
52 AC_REQUIRE([AC_CANONICAL_HOST])
53 AC_REQUIRE([gl_C_ASM])
54 AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
55 [case "$host_cpu" in
56
57changequote(,)dnl
58 i[34567]86 )
59changequote([,])dnl
60 gl_cv_host_cpu_c_abi=i386
61 ;;
62
63 x86_64 )
64 # On x86_64 systems, the C compiler may be generating code in one of
65 # these ABIs:
66 # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
67 # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
68 # with native Windows (mingw, MSVC).
69 # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
70 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
71 AC_COMPILE_IFELSE(
72 [AC_LANG_SOURCE(
73 [[#if (defined __x86_64__ || defined __amd64__ \
74 || defined _M_X64 || defined _M_AMD64)
75 int ok;
76 #else
77 error fail
78 #endif
79 ]])],
80 [AC_COMPILE_IFELSE(
81 [AC_LANG_SOURCE(
82 [[#if defined __ILP32__ || defined _ILP32
83 int ok;
84 #else
85 error fail
86 #endif
87 ]])],
88 [gl_cv_host_cpu_c_abi=x86_64-x32],
89 [gl_cv_host_cpu_c_abi=x86_64])],
90 [gl_cv_host_cpu_c_abi=i386])
91 ;;
92
93changequote(,)dnl
94 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
95changequote([,])dnl
96 gl_cv_host_cpu_c_abi=alpha
97 ;;
98
99 arm* | aarch64 )
100 # Assume arm with EABI.
101 # On arm64 systems, the C compiler may be generating code in one of
102 # these ABIs:
103 # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
104 # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
105 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
106 AC_COMPILE_IFELSE(
107 [AC_LANG_SOURCE(
108 [[#ifdef __aarch64__
109 int ok;
110 #else
111 error fail
112 #endif
113 ]])],
114 [AC_COMPILE_IFELSE(
115 [AC_LANG_SOURCE(
116 [[#if defined __ILP32__ || defined _ILP32
117 int ok;
118 #else
119 error fail
120 #endif
121 ]])],
122 [gl_cv_host_cpu_c_abi=arm64-ilp32],
123 [gl_cv_host_cpu_c_abi=arm64])],
124 [# Don't distinguish little-endian and big-endian arm, since they
125 # don't require different machine code for simple operations and
126 # since the user can distinguish them through the preprocessor
127 # defines __ARMEL__ vs. __ARMEB__.
128 # But distinguish arm which passes floating-point arguments and
129 # return values in integer registers (r0, r1, ...) - this is
130 # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
131 # passes them in float registers (s0, s1, ...) and double registers
132 # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
133 # sets the preprocessor defines __ARM_PCS (for the first case) and
134 # __ARM_PCS_VFP (for the second case), but older GCC does not.
135 echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
136 # Look for a reference to the register d0 in the .s file.
137 AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
138 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
139 gl_cv_host_cpu_c_abi=armhf
140 else
141 gl_cv_host_cpu_c_abi=arm
142 fi
143 rm -f conftest*
144 ])
145 ;;
146
147 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
148 # On hppa, the C compiler may be generating 32-bit code or 64-bit
149 # code. In the latter case, it defines _LP64 and __LP64__.
150 AC_COMPILE_IFELSE(
151 [AC_LANG_SOURCE(
152 [[#ifdef __LP64__
153 int ok;
154 #else
155 error fail
156 #endif
157 ]])],
158 [gl_cv_host_cpu_c_abi=hppa64],
159 [gl_cv_host_cpu_c_abi=hppa])
160 ;;
161
162 ia64* )
163 # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
164 # 32-bit code. In the latter case, it defines _ILP32.
165 AC_COMPILE_IFELSE(
166 [AC_LANG_SOURCE(
167 [[#ifdef _ILP32
168 int ok;
169 #else
170 error fail
171 #endif
172 ]])],
173 [gl_cv_host_cpu_c_abi=ia64-ilp32],
174 [gl_cv_host_cpu_c_abi=ia64])
175 ;;
176
177 mips* )
178 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
179 # at 32.
180 AC_COMPILE_IFELSE(
181 [AC_LANG_SOURCE(
182 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
183 int ok;
184 #else
185 error fail
186 #endif
187 ]])],
188 [gl_cv_host_cpu_c_abi=mips64],
189 [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
190 # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
191 # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
192 # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
193 AC_COMPILE_IFELSE(
194 [AC_LANG_SOURCE(
195 [[#if (_MIPS_SIM == _ABIN32)
196 int ok;
197 #else
198 error fail
199 #endif
200 ]])],
201 [gl_cv_host_cpu_c_abi=mipsn32],
202 [gl_cv_host_cpu_c_abi=mips])])
203 ;;
204
205 powerpc* )
206 # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
207 # No need to distinguish them here; the caller may distinguish
208 # them based on the OS.
209 # On powerpc64 systems, the C compiler may still be generating
210 # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
211 # be generating 64-bit code.
212 AC_COMPILE_IFELSE(
213 [AC_LANG_SOURCE(
214 [[#if defined __powerpc64__ || defined __LP64__
215 int ok;
216 #else
217 error fail
218 #endif
219 ]])],
220 [# On powerpc64, there are two ABIs on Linux: The AIX compatible
221 # one and the ELFv2 one. The latter defines _CALL_ELF=2.
222 AC_COMPILE_IFELSE(
223 [AC_LANG_SOURCE(
224 [[#if defined _CALL_ELF && _CALL_ELF == 2
225 int ok;
226 #else
227 error fail
228 #endif
229 ]])],
230 [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
231 [gl_cv_host_cpu_c_abi=powerpc64])
232 ],
233 [gl_cv_host_cpu_c_abi=powerpc])
234 ;;
235
236 rs6000 )
237 gl_cv_host_cpu_c_abi=powerpc
238 ;;
239
240 riscv32 | riscv64 )
241 # There are 2 architectures (with variants): rv32* and rv64*.
242 AC_COMPILE_IFELSE(
243 [AC_LANG_SOURCE(
244 [[#if __riscv_xlen == 64
245 int ok;
246 #else
247 error fail
248 #endif
249 ]])],
250 [cpu=riscv64],
251 [cpu=riscv32])
252 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
253 # Size of 'long' and 'void *':
254 AC_COMPILE_IFELSE(
255 [AC_LANG_SOURCE(
256 [[#if defined __LP64__
257 int ok;
258 #else
259 error fail
260 #endif
261 ]])],
262 [main_abi=lp64],
263 [main_abi=ilp32])
264 # Float ABIs:
265 # __riscv_float_abi_double:
266 # 'float' and 'double' are passed in floating-point registers.
267 # __riscv_float_abi_single:
268 # 'float' are passed in floating-point registers.
269 # __riscv_float_abi_soft:
270 # No values are passed in floating-point registers.
271 AC_COMPILE_IFELSE(
272 [AC_LANG_SOURCE(
273 [[#if defined __riscv_float_abi_double
274 int ok;
275 #else
276 error fail
277 #endif
278 ]])],
279 [float_abi=d],
280 [AC_COMPILE_IFELSE(
281 [AC_LANG_SOURCE(
282 [[#if defined __riscv_float_abi_single
283 int ok;
284 #else
285 error fail
286 #endif
287 ]])],
288 [float_abi=f],
289 [float_abi=''])
290 ])
291 gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
292 ;;
293
294 s390* )
295 # On s390x, the C compiler may be generating 64-bit (= s390x) code
296 # or 31-bit (= s390) code.
297 AC_COMPILE_IFELSE(
298 [AC_LANG_SOURCE(
299 [[#if defined __LP64__ || defined __s390x__
300 int ok;
301 #else
302 error fail
303 #endif
304 ]])],
305 [gl_cv_host_cpu_c_abi=s390x],
306 [gl_cv_host_cpu_c_abi=s390])
307 ;;
308
309 sparc | sparc64 )
310 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
311 # C compiler still generates 32-bit code.
312 AC_COMPILE_IFELSE(
313 [AC_LANG_SOURCE(
314 [[#if defined __sparcv9 || defined __arch64__
315 int ok;
316 #else
317 error fail
318 #endif
319 ]])],
320 [gl_cv_host_cpu_c_abi=sparc64],
321 [gl_cv_host_cpu_c_abi=sparc])
322 ;;
323
324 *)
325 gl_cv_host_cpu_c_abi="$host_cpu"
326 ;;
327 esac
328 ])
329
330 dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
331 HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
332 HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
333 AC_SUBST([HOST_CPU])
334 AC_SUBST([HOST_CPU_C_ABI])
335
336 # This was
337 # AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
338 # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
339 # earlier, but KAI C++ 3.2d doesn't like this.
340 sed -e 's/-/_/g' >> confdefs.h <<EOF
341#ifndef __${HOST_CPU}__
342#define __${HOST_CPU}__ 1
343#endif
344#ifndef __${HOST_CPU_C_ABI}__
345#define __${HOST_CPU_C_ABI}__ 1
346#endif
347EOF
348 AH_TOP([/* CPU and C ABI indicator */
349#ifndef __i386__
350#undef __i386__
351#endif
352#ifndef __x86_64_x32__
353#undef __x86_64_x32__
354#endif
355#ifndef __x86_64__
356#undef __x86_64__
357#endif
358#ifndef __alpha__
359#undef __alpha__
360#endif
361#ifndef __arm__
362#undef __arm__
363#endif
364#ifndef __armhf__
365#undef __armhf__
366#endif
367#ifndef __arm64_ilp32__
368#undef __arm64_ilp32__
369#endif
370#ifndef __arm64__
371#undef __arm64__
372#endif
373#ifndef __hppa__
374#undef __hppa__
375#endif
376#ifndef __hppa64__
377#undef __hppa64__
378#endif
379#ifndef __ia64_ilp32__
380#undef __ia64_ilp32__
381#endif
382#ifndef __ia64__
383#undef __ia64__
384#endif
385#ifndef __loongarch64__
386#undef __loongarch64__
387#endif
388#ifndef __m68k__
389#undef __m68k__
390#endif
391#ifndef __mips__
392#undef __mips__
393#endif
394#ifndef __mipsn32__
395#undef __mipsn32__
396#endif
397#ifndef __mips64__
398#undef __mips64__
399#endif
400#ifndef __powerpc__
401#undef __powerpc__
402#endif
403#ifndef __powerpc64__
404#undef __powerpc64__
405#endif
406#ifndef __powerpc64_elfv2__
407#undef __powerpc64_elfv2__
408#endif
409#ifndef __riscv32__
410#undef __riscv32__
411#endif
412#ifndef __riscv64__
413#undef __riscv64__
414#endif
415#ifndef __riscv32_ilp32__
416#undef __riscv32_ilp32__
417#endif
418#ifndef __riscv32_ilp32f__
419#undef __riscv32_ilp32f__
420#endif
421#ifndef __riscv32_ilp32d__
422#undef __riscv32_ilp32d__
423#endif
424#ifndef __riscv64_ilp32__
425#undef __riscv64_ilp32__
426#endif
427#ifndef __riscv64_ilp32f__
428#undef __riscv64_ilp32f__
429#endif
430#ifndef __riscv64_ilp32d__
431#undef __riscv64_ilp32d__
432#endif
433#ifndef __riscv64_lp64__
434#undef __riscv64_lp64__
435#endif
436#ifndef __riscv64_lp64f__
437#undef __riscv64_lp64f__
438#endif
439#ifndef __riscv64_lp64d__
440#undef __riscv64_lp64d__
441#endif
442#ifndef __s390__
443#undef __s390__
444#endif
445#ifndef __s390x__
446#undef __s390x__
447#endif
448#ifndef __sh__
449#undef __sh__
450#endif
451#ifndef __sparc__
452#undef __sparc__
453#endif
454#ifndef __sparc64__
455#undef __sparc64__
456#endif
457])
458
459])
460
461
462dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
463dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
464dnl one, or to 'unknown' if unknown.
465dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
466AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
467[
468 AC_REQUIRE([AC_CANONICAL_HOST])
469 AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
470 [if test -n "$gl_cv_host_cpu_c_abi"; then
471 case "$gl_cv_host_cpu_c_abi" in
472 i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
473 gl_cv_host_cpu_c_abi_32bit=yes ;;
474 x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
475 gl_cv_host_cpu_c_abi_32bit=no ;;
476 *)
477 gl_cv_host_cpu_c_abi_32bit=unknown ;;
478 esac
479 else
480 case "$host_cpu" in
481
482 # CPUs that only support a 32-bit ABI.
483 arc \
484 | bfin \
485 | cris* \
486 | csky \
487 | epiphany \
488 | ft32 \
489 | h8300 \
490 | m68k \
491 | microblaze | microblazeel \
492 | nds32 | nds32le | nds32be \
493 | nios2 | nios2eb | nios2el \
494 | or1k* \
495 | or32 \
496 | sh | sh[1234] | sh[1234]e[lb] \
497 | tic6x \
498 | xtensa* )
499 gl_cv_host_cpu_c_abi_32bit=yes
500 ;;
501
502 # CPUs that only support a 64-bit ABI.
503changequote(,)dnl
504 alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
505 | mmix )
506changequote([,])dnl
507 gl_cv_host_cpu_c_abi_32bit=no
508 ;;
509
510changequote(,)dnl
511 i[34567]86 )
512changequote([,])dnl
513 gl_cv_host_cpu_c_abi_32bit=yes
514 ;;
515
516 x86_64 )
517 # On x86_64 systems, the C compiler may be generating code in one of
518 # these ABIs:
519 # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
520 # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
521 # with native Windows (mingw, MSVC).
522 # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
523 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
524 AC_COMPILE_IFELSE(
525 [AC_LANG_SOURCE(
526 [[#if (defined __x86_64__ || defined __amd64__ \
527 || defined _M_X64 || defined _M_AMD64) \
528 && !(defined __ILP32__ || defined _ILP32)
529 int ok;
530 #else
531 error fail
532 #endif
533 ]])],
534 [gl_cv_host_cpu_c_abi_32bit=no],
535 [gl_cv_host_cpu_c_abi_32bit=yes])
536 ;;
537
538 arm* | aarch64 )
539 # Assume arm with EABI.
540 # On arm64 systems, the C compiler may be generating code in one of
541 # these ABIs:
542 # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
543 # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
544 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
545 AC_COMPILE_IFELSE(
546 [AC_LANG_SOURCE(
547 [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32)
548 int ok;
549 #else
550 error fail
551 #endif
552 ]])],
553 [gl_cv_host_cpu_c_abi_32bit=no],
554 [gl_cv_host_cpu_c_abi_32bit=yes])
555 ;;
556
557 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
558 # On hppa, the C compiler may be generating 32-bit code or 64-bit
559 # code. In the latter case, it defines _LP64 and __LP64__.
560 AC_COMPILE_IFELSE(
561 [AC_LANG_SOURCE(
562 [[#ifdef __LP64__
563 int ok;
564 #else
565 error fail
566 #endif
567 ]])],
568 [gl_cv_host_cpu_c_abi_32bit=no],
569 [gl_cv_host_cpu_c_abi_32bit=yes])
570 ;;
571
572 ia64* )
573 # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
574 # 32-bit code. In the latter case, it defines _ILP32.
575 AC_COMPILE_IFELSE(
576 [AC_LANG_SOURCE(
577 [[#ifdef _ILP32
578 int ok;
579 #else
580 error fail
581 #endif
582 ]])],
583 [gl_cv_host_cpu_c_abi_32bit=yes],
584 [gl_cv_host_cpu_c_abi_32bit=no])
585 ;;
586
587 mips* )
588 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
589 # at 32.
590 AC_COMPILE_IFELSE(
591 [AC_LANG_SOURCE(
592 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
593 int ok;
594 #else
595 error fail
596 #endif
597 ]])],
598 [gl_cv_host_cpu_c_abi_32bit=no],
599 [gl_cv_host_cpu_c_abi_32bit=yes])
600 ;;
601
602 powerpc* )
603 # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
604 # No need to distinguish them here; the caller may distinguish
605 # them based on the OS.
606 # On powerpc64 systems, the C compiler may still be generating
607 # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
608 # be generating 64-bit code.
609 AC_COMPILE_IFELSE(
610 [AC_LANG_SOURCE(
611 [[#if defined __powerpc64__ || defined __LP64__
612 int ok;
613 #else
614 error fail
615 #endif
616 ]])],
617 [gl_cv_host_cpu_c_abi_32bit=no],
618 [gl_cv_host_cpu_c_abi_32bit=yes])
619 ;;
620
621 rs6000 )
622 gl_cv_host_cpu_c_abi_32bit=yes
623 ;;
624
625 riscv32 | riscv64 )
626 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
627 # Size of 'long' and 'void *':
628 AC_COMPILE_IFELSE(
629 [AC_LANG_SOURCE(
630 [[#if defined __LP64__
631 int ok;
632 #else
633 error fail
634 #endif
635 ]])],
636 [gl_cv_host_cpu_c_abi_32bit=no],
637 [gl_cv_host_cpu_c_abi_32bit=yes])
638 ;;
639
640 s390* )
641 # On s390x, the C compiler may be generating 64-bit (= s390x) code
642 # or 31-bit (= s390) code.
643 AC_COMPILE_IFELSE(
644 [AC_LANG_SOURCE(
645 [[#if defined __LP64__ || defined __s390x__
646 int ok;
647 #else
648 error fail
649 #endif
650 ]])],
651 [gl_cv_host_cpu_c_abi_32bit=no],
652 [gl_cv_host_cpu_c_abi_32bit=yes])
653 ;;
654
655 sparc | sparc64 )
656 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
657 # C compiler still generates 32-bit code.
658 AC_COMPILE_IFELSE(
659 [AC_LANG_SOURCE(
660 [[#if defined __sparcv9 || defined __arch64__
661 int ok;
662 #else
663 error fail
664 #endif
665 ]])],
666 [gl_cv_host_cpu_c_abi_32bit=no],
667 [gl_cv_host_cpu_c_abi_32bit=yes])
668 ;;
669
670 *)
671 gl_cv_host_cpu_c_abi_32bit=unknown
672 ;;
673 esac
674 fi
675 ])
676
677 HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
678])
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
deleted file mode 100644
index ff5d5261..00000000
--- a/gl/m4/iconv.m4
+++ /dev/null
@@ -1,293 +0,0 @@
1# iconv.m4 serial 26
2dnl Copyright (C) 2000-2002, 2007-2014, 2016-2023 Free Software Foundation,
3dnl Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl From Bruno Haible.
9
10AC_PREREQ([2.64])
11
12dnl Note: AM_ICONV is documented in the GNU gettext manual
13dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>.
14dnl Don't make changes that are incompatible with that documentation!
15
16AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
17[
18 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20 AC_REQUIRE([AC_LIB_RPATH])
21
22 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
23 dnl accordingly.
24 AC_LIB_LINKFLAGS_BODY([iconv])
25])
26
27AC_DEFUN([AM_ICONV_LINK],
28[
29 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
30 dnl those with the standalone portable GNU libiconv installed).
31 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
32
33 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
34 dnl accordingly.
35 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
36
37 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
38 dnl because if the user has installed libiconv and not disabled its use
39 dnl via --without-libiconv-prefix, he wants to use it. The first
40 dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
41 am_save_CPPFLAGS="$CPPFLAGS"
42 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
43
44 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
45 am_cv_func_iconv="no, consider installing GNU libiconv"
46 am_cv_lib_iconv=no
47 AC_LINK_IFELSE(
48 [AC_LANG_PROGRAM(
49 [[
50#include <stdlib.h>
51#include <iconv.h>
52 ]],
53 [[iconv_t cd = iconv_open("","");
54 iconv(cd,NULL,NULL,NULL,NULL);
55 iconv_close(cd);]])],
56 [am_cv_func_iconv=yes])
57 if test "$am_cv_func_iconv" != yes; then
58 am_save_LIBS="$LIBS"
59 LIBS="$LIBS $LIBICONV"
60 AC_LINK_IFELSE(
61 [AC_LANG_PROGRAM(
62 [[
63#include <stdlib.h>
64#include <iconv.h>
65 ]],
66 [[iconv_t cd = iconv_open("","");
67 iconv(cd,NULL,NULL,NULL,NULL);
68 iconv_close(cd);]])],
69 [am_cv_lib_iconv=yes]
70 [am_cv_func_iconv=yes])
71 LIBS="$am_save_LIBS"
72 fi
73 ])
74 if test "$am_cv_func_iconv" = yes; then
75 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
76 dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
77 dnl Solaris 10.
78 am_save_LIBS="$LIBS"
79 if test $am_cv_lib_iconv = yes; then
80 LIBS="$LIBS $LIBICONV"
81 fi
82 am_cv_func_iconv_works=no
83 for ac_iconv_const in '' 'const'; do
84 AC_RUN_IFELSE(
85 [AC_LANG_PROGRAM(
86 [[
87#include <iconv.h>
88#include <string.h>
89
90#ifndef ICONV_CONST
91# define ICONV_CONST $ac_iconv_const
92#endif
93 ]],
94 [[int result = 0;
95 /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from
96 successful returns. This is even documented in
97 <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */
98 {
99 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
100 if (cd_utf8_to_88591 != (iconv_t)(-1))
101 {
102 static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
103 char buf[10];
104 ICONV_CONST char *inptr = input;
105 size_t inbytesleft = strlen (input);
106 char *outptr = buf;
107 size_t outbytesleft = sizeof (buf);
108 size_t res = iconv (cd_utf8_to_88591,
109 &inptr, &inbytesleft,
110 &outptr, &outbytesleft);
111 if (res == 0)
112 result |= 1;
113 iconv_close (cd_utf8_to_88591);
114 }
115 }
116 /* Test against Solaris 10 bug: Failures are not distinguishable from
117 successful returns. */
118 {
119 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
120 if (cd_ascii_to_88591 != (iconv_t)(-1))
121 {
122 static ICONV_CONST char input[] = "\263";
123 char buf[10];
124 ICONV_CONST char *inptr = input;
125 size_t inbytesleft = strlen (input);
126 char *outptr = buf;
127 size_t outbytesleft = sizeof (buf);
128 size_t res = iconv (cd_ascii_to_88591,
129 &inptr, &inbytesleft,
130 &outptr, &outbytesleft);
131 if (res == 0)
132 result |= 2;
133 iconv_close (cd_ascii_to_88591);
134 }
135 }
136 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
137 {
138 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
139 if (cd_88591_to_utf8 != (iconv_t)(-1))
140 {
141 static ICONV_CONST char input[] = "\304";
142 static char buf[2] = { (char)0xDE, (char)0xAD };
143 ICONV_CONST char *inptr = input;
144 size_t inbytesleft = 1;
145 char *outptr = buf;
146 size_t outbytesleft = 1;
147 size_t res = iconv (cd_88591_to_utf8,
148 &inptr, &inbytesleft,
149 &outptr, &outbytesleft);
150 if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
151 result |= 4;
152 iconv_close (cd_88591_to_utf8);
153 }
154 }
155#if 0 /* This bug could be worked around by the caller. */
156 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
157 {
158 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
159 if (cd_88591_to_utf8 != (iconv_t)(-1))
160 {
161 static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
162 char buf[50];
163 ICONV_CONST char *inptr = input;
164 size_t inbytesleft = strlen (input);
165 char *outptr = buf;
166 size_t outbytesleft = sizeof (buf);
167 size_t res = iconv (cd_88591_to_utf8,
168 &inptr, &inbytesleft,
169 &outptr, &outbytesleft);
170 if ((int)res > 0)
171 result |= 8;
172 iconv_close (cd_88591_to_utf8);
173 }
174 }
175#endif
176 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
177 provided. */
178 {
179 /* Try standardized names. */
180 iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
181 /* Try IRIX, OSF/1 names. */
182 iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
183 /* Try AIX names. */
184 iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
185 /* Try HP-UX names. */
186 iconv_t cd4 = iconv_open ("utf8", "eucJP");
187 if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
188 && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
189 result |= 16;
190 if (cd1 != (iconv_t)(-1))
191 iconv_close (cd1);
192 if (cd2 != (iconv_t)(-1))
193 iconv_close (cd2);
194 if (cd3 != (iconv_t)(-1))
195 iconv_close (cd3);
196 if (cd4 != (iconv_t)(-1))
197 iconv_close (cd4);
198 }
199 return result;
200]])],
201 [am_cv_func_iconv_works=yes], ,
202 [case "$host_os" in
203 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
204 *) am_cv_func_iconv_works="guessing yes" ;;
205 esac])
206 test "$am_cv_func_iconv_works" = no || break
207 done
208 LIBS="$am_save_LIBS"
209 ])
210 case "$am_cv_func_iconv_works" in
211 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
212 *) am_func_iconv=yes ;;
213 esac
214 else
215 am_func_iconv=no am_cv_lib_iconv=no
216 fi
217 if test "$am_func_iconv" = yes; then
218 AC_DEFINE([HAVE_ICONV], [1],
219 [Define if you have the iconv() function and it works.])
220 fi
221 if test "$am_cv_lib_iconv" = yes; then
222 AC_MSG_CHECKING([how to link with libiconv])
223 AC_MSG_RESULT([$LIBICONV])
224 else
225 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
226 dnl either.
227 CPPFLAGS="$am_save_CPPFLAGS"
228 LIBICONV=
229 LTLIBICONV=
230 fi
231 AC_SUBST([LIBICONV])
232 AC_SUBST([LTLIBICONV])
233])
234
235dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like
236dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
237AC_DEFUN_ONCE([AM_ICONV],
238[
239 AM_ICONV_LINK
240 if test "$am_cv_func_iconv" = yes; then
241 AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature],
242 [gl_cv_iconv_nonconst],
243 [AC_COMPILE_IFELSE(
244 [AC_LANG_PROGRAM(
245 [[
246#include <stdlib.h>
247#include <iconv.h>
248extern
249#ifdef __cplusplus
250"C"
251#endif
252size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
253 ]],
254 [[]])],
255 [gl_cv_iconv_nonconst=yes],
256 [gl_cv_iconv_nonconst=no])
257 ])
258 else
259 dnl When compiling GNU libiconv on a system that does not have iconv yet,
260 dnl pick the POSIX compliant declaration without 'const'.
261 gl_cv_iconv_nonconst=yes
262 fi
263 if test $gl_cv_iconv_nonconst = yes; then
264 iconv_arg1=""
265 else
266 iconv_arg1="const"
267 fi
268 AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1],
269 [Define as const if the declaration of iconv() needs const.])
270 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
271 m4_ifdef([gl_ICONV_H_DEFAULTS],
272 [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
273 if test $gl_cv_iconv_nonconst != yes; then
274 ICONV_CONST="const"
275 fi
276 ])
277
278 dnl A summary result, for those packages which want to print a summary at the
279 dnl end of the configuration.
280 if test "$am_func_iconv" = yes; then
281 if test -n "$LIBICONV"; then
282 am_cv_func_iconv_summary='yes, in libiconv'
283 else
284 am_cv_func_iconv_summary='yes, in libc'
285 fi
286 else
287 if test "$am_cv_func_iconv" = yes; then
288 am_cv_func_iconv_summary='not working, consider installing GNU libiconv'
289 else
290 am_cv_func_iconv_summary='no, consider installing GNU libiconv'
291 fi
292 fi
293])
diff --git a/gl/m4/intl-thread-locale.m4 b/gl/m4/intl-thread-locale.m4
deleted file mode 100644
index c2318995..00000000
--- a/gl/m4/intl-thread-locale.m4
+++ /dev/null
@@ -1,219 +0,0 @@
1# intl-thread-locale.m4 serial 9
2dnl Copyright (C) 2015-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Lesser General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Lesser General Public License, and the rest of the GNU
13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t).
17dnl Sets gt_nameless_locales.
18AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME],
19[
20 AC_REQUIRE([AC_CANONICAL_HOST])
21
22 dnl Persuade Solaris <locale.h> to define 'locale_t'.
23 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
24
25 dnl Test whether uselocale() exists and works at all.
26 gt_FUNC_USELOCALE
27
28 dnl On OpenBSD >= 6.2, the locale_t type and the uselocale(), newlocale(),
29 dnl duplocale(), freelocale() functions exist but are effectively useless,
30 dnl because the locale_t value depends only on the LC_CTYPE category of the
31 dnl locale and furthermore contains only one bit of information (it
32 dnl distinguishes the "C" locale from the *.UTF-8 locales). See
33 dnl <https://cvsweb.openbsd.org/src/lib/libc/locale/newlocale.c?rev=1.1&content-type=text/x-cvsweb-markup>.
34 dnl In the setlocale() implementation they have thought about the programs
35 dnl that use the API ("Even though only LC_CTYPE has any effect in the
36 dnl OpenBSD base system, store complete information about the global locale,
37 dnl such that third-party software can access it"), but for uselocale()
38 dnl they did not think about the programs.
39 dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work.
40 dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support.
41 case "$gt_cv_func_uselocale_works" in
42 *yes)
43 AC_CHECK_HEADERS_ONCE([xlocale.h])
44 AC_CACHE_CHECK([for fake locale system (OpenBSD)],
45 [gt_cv_locale_fake],
46 [AC_RUN_IFELSE(
47 [AC_LANG_SOURCE([[
48#include <locale.h>
49#if HAVE_XLOCALE_H
50# include <xlocale.h>
51#endif
52int main ()
53{
54 locale_t loc1, loc2;
55 if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1;
56 if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1;
57 loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0);
58 loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0);
59 return !(loc1 == loc2);
60}]])],
61 [gt_cv_locale_fake=yes],
62 [gt_cv_locale_fake=no],
63 [dnl Guess the locale system is fake only on OpenBSD.
64 case "$host_os" in
65 openbsd*) gt_cv_locale_fake="guessing yes" ;;
66 *) gt_cv_locale_fake="guessing no" ;;
67 esac
68 ])
69 ])
70 ;;
71 *) gt_cv_locale_fake=no ;;
72 esac
73 case "$gt_cv_locale_fake" in
74 *yes)
75 gt_fake_locales=yes
76 AC_DEFINE([HAVE_FAKE_LOCALES], [1],
77 [Define if the locale_t type contains insufficient information, as on OpenBSD.])
78 ;;
79 *)
80 gt_fake_locales=no
81 ;;
82 esac
83
84 case "$gt_cv_func_uselocale_works" in
85 *yes)
86 AC_CACHE_CHECK([for Solaris 11.4 locale system],
87 [gt_cv_locale_solaris114],
88 [case "$host_os" in
89 solaris*)
90 dnl Test whether <locale.h> defines locale_t as a typedef of
91 dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a
92 dnl typedef of 'struct _locale *').
93 dnl Another possible test would be to include <sys/localedef.h>
94 dnl and test whether it defines the _LC_core_data_locale_t type.
95 dnl This type was added in Solaris 11.4.
96 AC_COMPILE_IFELSE(
97 [AC_LANG_PROGRAM([[
98 #include <locale.h>
99 struct _LC_locale_t *x;
100 locale_t y;
101 ]],
102 [[*y = x;]])],
103 [gt_cv_locale_solaris114=yes],
104 [gt_cv_locale_solaris114=no])
105 ;;
106 *) gt_cv_locale_solaris114=no ;;
107 esac
108 ])
109 ;;
110 *) gt_cv_locale_solaris114=no ;;
111 esac
112 if test $gt_cv_locale_solaris114 = yes; then
113 AC_DEFINE([HAVE_SOLARIS114_LOCALES], [1],
114 [Define if the locale_t type is as on Solaris 11.4.])
115 fi
116
117 dnl Solaris 12 will maybe provide getlocalename_l. If it does, it will
118 dnl improve the implementation of gl_locale_name_thread(), by removing
119 dnl the use of undocumented structures.
120 case "$gt_cv_func_uselocale_works" in
121 *yes)
122 AC_CHECK_FUNCS([getlocalename_l])
123 ;;
124 esac
125
126 dnl This code is for platforms where the locale_t type does not provide access
127 dnl to the name of each locale category. This code has the drawback that it
128 dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale',
129 dnl which is a problem for GNU libunistring. Therefore try hard to avoid
130 dnl enabling this code!
131 gt_nameless_locales=no
132 case "$host_os" in
133 dnl It's needed on AIX 7.2.
134 aix*)
135 gt_nameless_locales=yes
136 AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
137 [Define if the locale_t type does not contain the name of each locale category.])
138 ;;
139 esac
140
141 dnl We cannot support uselocale() on platforms where the locale_t type is
142 dnl fake. So, set
143 dnl gt_good_uselocale = gt_working_uselocale && !gt_fake_locales.
144 if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then
145 gt_good_uselocale=yes
146 AC_DEFINE([HAVE_GOOD_USELOCALE], [1],
147 [Define if the uselocale exists, may be safely called, and returns sufficient information.])
148 else
149 gt_good_uselocale=no
150 fi
151
152 dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c
153 dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale
154 dnl names.
155 if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then
156 gt_localename_enhances_locale_funcs=yes
157 LOCALENAME_ENHANCE_LOCALE_FUNCS=1
158 AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1],
159 [Define if localename.c overrides newlocale(), duplocale(), freelocale().])
160 else
161 gt_localename_enhances_locale_funcs=no
162 fi
163])
164
165dnl Tests whether uselocale() exists and is usable.
166dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE.
167AC_DEFUN([gt_FUNC_USELOCALE],
168[
169 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
170
171 dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'.
172 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
173
174 AC_CHECK_FUNCS_ONCE([uselocale])
175
176 dnl On AIX 7.2, the uselocale() function is not documented and leads to
177 dnl crashes in subsequent setlocale() invocations.
178 dnl In 2019, some versions of z/OS lack the locale_t type and have a broken
179 dnl uselocale function.
180 if test $ac_cv_func_uselocale = yes; then
181 AC_CHECK_HEADERS_ONCE([xlocale.h])
182 AC_CACHE_CHECK([whether uselocale works],
183 [gt_cv_func_uselocale_works],
184 [AC_RUN_IFELSE(
185 [AC_LANG_SOURCE([[
186#include <locale.h>
187#if HAVE_XLOCALE_H
188# include <xlocale.h>
189#endif
190locale_t loc1;
191int main ()
192{
193 uselocale (NULL);
194 setlocale (LC_ALL, "en_US.UTF-8");
195 return 0;
196}]])],
197 [gt_cv_func_uselocale_works=yes],
198 [gt_cv_func_uselocale_works=no],
199 [# Guess no on AIX and z/OS, yes otherwise.
200 case "$host_os" in
201 aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;;
202 *) gt_cv_func_uselocale_works="guessing yes" ;;
203 esac
204 ])
205 ])
206 else
207 gt_cv_func_uselocale_works=no
208 fi
209 case "$gt_cv_func_uselocale_works" in
210 *yes)
211 gt_working_uselocale=yes
212 AC_DEFINE([HAVE_WORKING_USELOCALE], [1],
213 [Define if the uselocale function exists and may safely be called.])
214 ;;
215 *)
216 gt_working_uselocale=no
217 ;;
218 esac
219])
diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4
deleted file mode 100644
index 81eefd75..00000000
--- a/gl/m4/intlmacosx.m4
+++ /dev/null
@@ -1,65 +0,0 @@
1# intlmacosx.m4 serial 8 (gettext-0.20.2)
2dnl Copyright (C) 2004-2014, 2016, 2019-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Lesser General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Lesser General Public License, and the rest of the GNU
13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Checks for special options needed on Mac OS X.
17dnl Defines INTL_MACOSX_LIBS.
18AC_DEFUN([gt_INTL_MACOSX],
19[
20 dnl Check for API introduced in Mac OS X 10.4.
21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
22 [gt_cv_func_CFPreferencesCopyAppValue],
23 [gt_save_LIBS="$LIBS"
24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
25 AC_LINK_IFELSE(
26 [AC_LANG_PROGRAM(
27 [[#include <CoreFoundation/CFPreferences.h>]],
28 [[CFPreferencesCopyAppValue(NULL, NULL)]])],
29 [gt_cv_func_CFPreferencesCopyAppValue=yes],
30 [gt_cv_func_CFPreferencesCopyAppValue=no])
31 LIBS="$gt_save_LIBS"])
32 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
33 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
34 [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
35 fi
36 dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
37 dnl because in macOS 10.13.4 it has the following behaviour:
38 dnl When two or more languages are specified in the
39 dnl "System Preferences > Language & Region > Preferred Languages" panel,
40 dnl it returns en_CC where CC is the territory (even when English is not among
41 dnl the preferred languages!). What we want instead is what
42 dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
43 dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
44 dnl first among the preferred languages and CC is the territory.
45 AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
46 [gt_save_LIBS="$LIBS"
47 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
48 AC_LINK_IFELSE(
49 [AC_LANG_PROGRAM(
50 [[#include <CoreFoundation/CFLocale.h>]],
51 [[CFLocaleCopyPreferredLanguages();]])],
52 [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
53 [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
54 LIBS="$gt_save_LIBS"])
55 if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
56 AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
57 [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
58 fi
59 INTL_MACOSX_LIBS=
60 if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
61 || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
62 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
63 fi
64 AC_SUBST([INTL_MACOSX_LIBS])
65])
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
deleted file mode 100644
index 6bc1886f..00000000
--- a/gl/m4/lib-ld.m4
+++ /dev/null
@@ -1,168 +0,0 @@
1# lib-ld.m4 serial 10
2dnl Copyright (C) 1996-2003, 2009-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Subroutines of libtool.m4,
8dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
9dnl collision with libtool.m4.
10
11dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
12AC_DEFUN([AC_LIB_PROG_LD_GNU],
13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
14[# I'd rather use --version here, but apparently some GNU lds only accept -v.
15case `$LD -v 2>&1 </dev/null` in
16*GNU* | *'with BFD'*)
17 acl_cv_prog_gnu_ld=yes
18 ;;
19*)
20 acl_cv_prog_gnu_ld=no
21 ;;
22esac])
23with_gnu_ld=$acl_cv_prog_gnu_ld
24])
25
26dnl From libtool-2.4. Sets the variable LD.
27AC_DEFUN([AC_LIB_PROG_LD],
28[AC_REQUIRE([AC_PROG_CC])dnl
29AC_REQUIRE([AC_CANONICAL_HOST])dnl
30
31AC_ARG_WITH([gnu-ld],
32 [AS_HELP_STRING([--with-gnu-ld],
33 [assume the C compiler uses GNU ld [default=no]])],
34 [test "$withval" = no || with_gnu_ld=yes],
35 [with_gnu_ld=no])dnl
36
37# Prepare PATH_SEPARATOR.
38# The user is always right.
39if test "${PATH_SEPARATOR+set}" != set; then
40 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
41 # contains only /bin. Note that ksh looks also at the FPATH variable,
42 # so we have to set that as well for the test.
43 PATH_SEPARATOR=:
44 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
45 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
46 || PATH_SEPARATOR=';'
47 }
48fi
49
50if test -n "$LD"; then
51 AC_MSG_CHECKING([for ld])
52elif test "$GCC" = yes; then
53 AC_MSG_CHECKING([for ld used by $CC])
54elif test "$with_gnu_ld" = yes; then
55 AC_MSG_CHECKING([for GNU ld])
56else
57 AC_MSG_CHECKING([for non-GNU ld])
58fi
59if test -n "$LD"; then
60 # Let the user override the test with a path.
61 :
62else
63 AC_CACHE_VAL([acl_cv_path_LD],
64 [
65 acl_cv_path_LD= # Final result of this test
66 ac_prog=ld # Program to search in $PATH
67 if test "$GCC" = yes; then
68 # Check if gcc -print-prog-name=ld gives a path.
69 case $host in
70 *-*-mingw*)
71 # gcc leaves a trailing carriage return which upsets mingw
72 acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
73 *)
74 acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
75 esac
76 case $acl_output in
77 # Accept absolute paths.
78 [[\\/]]* | ?:[[\\/]]*)
79 re_direlt='/[[^/]][[^/]]*/\.\./'
80 # Canonicalize the pathname of ld
81 acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
82 while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
83 acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
84 done
85 # Got the pathname. No search in PATH is needed.
86 acl_cv_path_LD="$acl_output"
87 ac_prog=
88 ;;
89 "")
90 # If it fails, then pretend we aren't using GCC.
91 ;;
92 *)
93 # If it is relative, then search for the first ld in PATH.
94 with_gnu_ld=unknown
95 ;;
96 esac
97 fi
98 if test -n "$ac_prog"; then
99 # Search for $ac_prog in $PATH.
100 acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
101 for ac_dir in $PATH; do
102 IFS="$acl_save_ifs"
103 test -z "$ac_dir" && ac_dir=.
104 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
105 acl_cv_path_LD="$ac_dir/$ac_prog"
106 # Check to see if the program is GNU ld. I'd rather use --version,
107 # but apparently some variants of GNU ld only accept -v.
108 # Break only if it was the GNU/non-GNU ld that we prefer.
109 case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
110 *GNU* | *'with BFD'*)
111 test "$with_gnu_ld" != no && break
112 ;;
113 *)
114 test "$with_gnu_ld" != yes && break
115 ;;
116 esac
117 fi
118 done
119 IFS="$acl_save_ifs"
120 fi
121 case $host in
122 *-*-aix*)
123 AC_COMPILE_IFELSE(
124 [AC_LANG_SOURCE(
125 [[#if defined __powerpc64__ || defined __LP64__
126 int ok;
127 #else
128 error fail
129 #endif
130 ]])],
131 [# The compiler produces 64-bit code. Add option '-b64' so that the
132 # linker groks 64-bit object files.
133 case "$acl_cv_path_LD " in
134 *" -b64 "*) ;;
135 *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
136 esac
137 ], [])
138 ;;
139 sparc64-*-netbsd*)
140 AC_COMPILE_IFELSE(
141 [AC_LANG_SOURCE(
142 [[#if defined __sparcv9 || defined __arch64__
143 int ok;
144 #else
145 error fail
146 #endif
147 ]])],
148 [],
149 [# The compiler produces 32-bit code. Add option '-m elf32_sparc'
150 # so that the linker groks 32-bit object files.
151 case "$acl_cv_path_LD " in
152 *" -m elf32_sparc "*) ;;
153 *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
154 esac
155 ])
156 ;;
157 esac
158 ])
159 LD="$acl_cv_path_LD"
160fi
161if test -n "$LD"; then
162 AC_MSG_RESULT([$LD])
163else
164 AC_MSG_RESULT([no])
165 AC_MSG_ERROR([no acceptable ld found in \$PATH])
166fi
167AC_LIB_PROG_LD_GNU
168])
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
deleted file mode 100644
index 653e34f8..00000000
--- a/gl/m4/lib-link.m4
+++ /dev/null
@@ -1,813 +0,0 @@
1# lib-link.m4 serial 33
2dnl Copyright (C) 2001-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9AC_PREREQ([2.61])
10
11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12dnl the libraries corresponding to explicit and implicit dependencies.
13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
14dnl augments the CPPFLAGS variable.
15dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
16dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
17AC_DEFUN([AC_LIB_LINKFLAGS],
18[
19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20 AC_REQUIRE([AC_LIB_RPATH])
21 pushdef([Name],[m4_translit([$1],[./+-], [____])])
22 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
23 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
24 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
25 AC_LIB_LINKFLAGS_BODY([$1], [$2])
26 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
27 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
28 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
29 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
30 ])
31 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
32 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
33 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
34 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
36 AC_SUBST([LIB]NAME)
37 AC_SUBST([LTLIB]NAME)
38 AC_SUBST([LIB]NAME[_PREFIX])
39 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
40 dnl results of this search when this library appears as a dependency.
41 HAVE_LIB[]NAME=yes
42 popdef([NAME])
43 popdef([Name])
44])
45
46dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
47dnl searches for libname and the libraries corresponding to explicit and
48dnl implicit dependencies, together with the specified include files and
49dnl the ability to compile and link the specified testcode. The missing-message
50dnl defaults to 'no' and may contain additional hints for the user.
51dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
52dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
53dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
54dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
55dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
56dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
57AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
58[
59 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
60 AC_REQUIRE([AC_LIB_RPATH])
61 pushdef([Name],[m4_translit([$1],[./+-], [____])])
62 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
63 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
64
65 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
66 dnl accordingly.
67 AC_LIB_LINKFLAGS_BODY([$1], [$2])
68
69 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
70 dnl because if the user has installed lib[]Name and not disabled its use
71 dnl via --without-lib[]Name-prefix, he wants to use it.
72 ac_save_CPPFLAGS="$CPPFLAGS"
73 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
74
75 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
76 ac_save_LIBS="$LIBS"
77 dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
78 dnl because these -l options might require -L options that are present in
79 dnl LIBS. -l options benefit only from the -L options listed before it.
80 dnl Otherwise, add it to the front of LIBS, because it may be a static
81 dnl library that depends on another static library that is present in LIBS.
82 dnl Static libraries benefit only from the static libraries listed after
83 dnl it.
84 case " $LIB[]NAME" in
85 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
86 *) LIBS="$LIB[]NAME $LIBS" ;;
87 esac
88 AC_LINK_IFELSE(
89 [AC_LANG_PROGRAM([[$3]], [[$4]])],
90 [ac_cv_lib[]Name=yes],
91 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
92 LIBS="$ac_save_LIBS"
93 ])
94 if test "$ac_cv_lib[]Name" = yes; then
95 HAVE_LIB[]NAME=yes
96 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
97 AC_MSG_CHECKING([how to link with lib[]$1])
98 AC_MSG_RESULT([$LIB[]NAME])
99 else
100 HAVE_LIB[]NAME=no
101 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
102 dnl $INC[]NAME either.
103 CPPFLAGS="$ac_save_CPPFLAGS"
104 LIB[]NAME=
105 LTLIB[]NAME=
106 LIB[]NAME[]_PREFIX=
107 fi
108 AC_SUBST([HAVE_LIB]NAME)
109 AC_SUBST([LIB]NAME)
110 AC_SUBST([LTLIB]NAME)
111 AC_SUBST([LIB]NAME[_PREFIX])
112 popdef([NAME])
113 popdef([Name])
114])
115
116dnl Determine the platform dependent parameters needed to use rpath:
117dnl acl_libext,
118dnl acl_shlibext,
119dnl acl_libname_spec,
120dnl acl_library_names_spec,
121dnl acl_hardcode_libdir_flag_spec,
122dnl acl_hardcode_libdir_separator,
123dnl acl_hardcode_direct,
124dnl acl_hardcode_minus_L.
125AC_DEFUN([AC_LIB_RPATH],
126[
127 dnl Complain if config.rpath is missing.
128 AC_REQUIRE_AUX_FILE([config.rpath])
129 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
130 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
131 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
132 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
133 AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
134 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
135 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
136 . ./conftest.sh
137 rm -f ./conftest.sh
138 acl_cv_rpath=done
139 ])
140 wl="$acl_cv_wl"
141 acl_libext="$acl_cv_libext"
142 acl_shlibext="$acl_cv_shlibext"
143 acl_libname_spec="$acl_cv_libname_spec"
144 acl_library_names_spec="$acl_cv_library_names_spec"
145 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
146 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
147 acl_hardcode_direct="$acl_cv_hardcode_direct"
148 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
149 dnl Determine whether the user wants rpath handling at all.
150 AC_ARG_ENABLE([rpath],
151 [ --disable-rpath do not hardcode runtime library paths],
152 :, enable_rpath=yes)
153])
154
155dnl AC_LIB_FROMPACKAGE(name, package)
156dnl declares that libname comes from the given package. The configure file
157dnl will then not have a --with-libname-prefix option but a
158dnl --with-package-prefix option. Several libraries can come from the same
159dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
160dnl macro call that searches for libname.
161AC_DEFUN([AC_LIB_FROMPACKAGE],
162[
163 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
164 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
165 define([acl_frompackage_]NAME, [$2])
166 popdef([NAME])
167 pushdef([PACK],[$2])
168 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
169 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
170 define([acl_libsinpackage_]PACKUP,
171 m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
172 popdef([PACKUP])
173 popdef([PACK])
174])
175
176dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
177dnl the libraries corresponding to explicit and implicit dependencies.
178dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
179dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
180dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
181AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
182[
183 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
184 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
185 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
186 pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
187 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
188 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
189 pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
190 dnl By default, look in $includedir and $libdir.
191 use_additional=yes
192 AC_LIB_WITH_FINAL_PREFIX([
193 eval additional_includedir=\"$includedir\"
194 eval additional_libdir=\"$libdir\"
195 eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
196 eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
197 ])
198 AC_ARG_WITH(PACK[-prefix],
199[[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib
200 --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]],
201[
202 if test "X$withval" = "Xno"; then
203 use_additional=no
204 else
205 if test "X$withval" = "X"; then
206 AC_LIB_WITH_FINAL_PREFIX([
207 eval additional_includedir=\"$includedir\"
208 eval additional_libdir=\"$libdir\"
209 eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
210 eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
211 ])
212 else
213 additional_includedir="$withval/include"
214 additional_libdir="$withval/$acl_libdirstem"
215 additional_libdir2="$withval/$acl_libdirstem2"
216 additional_libdir3="$withval/$acl_libdirstem3"
217 fi
218 fi
219])
220 if test "X$additional_libdir2" = "X$additional_libdir"; then
221 additional_libdir2=
222 fi
223 if test "X$additional_libdir3" = "X$additional_libdir"; then
224 additional_libdir3=
225 fi
226 dnl Search the library and its dependencies in $additional_libdir and
227 dnl $LDFLAGS. Using breadth-first-seach.
228 LIB[]NAME=
229 LTLIB[]NAME=
230 INC[]NAME=
231 LIB[]NAME[]_PREFIX=
232 dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
233 dnl computed. So it has to be reset here.
234 HAVE_LIB[]NAME=
235 rpathdirs=
236 ltrpathdirs=
237 names_already_handled=
238 names_next_round='$1 $2'
239 while test -n "$names_next_round"; do
240 names_this_round="$names_next_round"
241 names_next_round=
242 for name in $names_this_round; do
243 already_handled=
244 for n in $names_already_handled; do
245 if test "$n" = "$name"; then
246 already_handled=yes
247 break
248 fi
249 done
250 if test -z "$already_handled"; then
251 names_already_handled="$names_already_handled $name"
252 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
253 dnl or AC_LIB_HAVE_LINKFLAGS call.
254 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
255 eval value=\"\$HAVE_LIB$uppername\"
256 if test -n "$value"; then
257 if test "$value" = yes; then
258 eval value=\"\$LIB$uppername\"
259 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
260 eval value=\"\$LTLIB$uppername\"
261 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
262 else
263 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
264 dnl that this library doesn't exist. So just drop it.
265 :
266 fi
267 else
268 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
269 dnl and the already constructed $LIBNAME/$LTLIBNAME.
270 found_dir=
271 found_la=
272 found_so=
273 found_a=
274 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
275 if test -n "$acl_shlibext"; then
276 shrext=".$acl_shlibext" # typically: shrext=.so
277 else
278 shrext=
279 fi
280 if test $use_additional = yes; then
281 for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do
282 if test "X$found_dir" = "X"; then
283 eval dir=\$$additional_libdir_variable
284 if test -n "$dir"; then
285 dnl The same code as in the loop below:
286 dnl First look for a shared library.
287 if test -n "$acl_shlibext"; then
288 if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
289 found_dir="$dir"
290 found_so="$dir/$libname$shrext"
291 else
292 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
293 ver=`(cd "$dir" && \
294 for f in "$libname$shrext".*; do echo "$f"; done \
295 | sed -e "s,^$libname$shrext\\\\.,," \
296 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
297 | sed 1q ) 2>/dev/null`
298 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
299 found_dir="$dir"
300 found_so="$dir/$libname$shrext.$ver"
301 fi
302 else
303 eval library_names=\"$acl_library_names_spec\"
304 for f in $library_names; do
305 if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
306 found_dir="$dir"
307 found_so="$dir/$f"
308 break
309 fi
310 done
311 fi
312 fi
313 fi
314 dnl Then look for a static library.
315 if test "X$found_dir" = "X"; then
316 if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
317 found_dir="$dir"
318 found_a="$dir/$libname.$acl_libext"
319 fi
320 fi
321 if test "X$found_dir" != "X"; then
322 if test -f "$dir/$libname.la"; then
323 found_la="$dir/$libname.la"
324 fi
325 fi
326 fi
327 fi
328 done
329 fi
330 if test "X$found_dir" = "X"; then
331 for x in $LDFLAGS $LTLIB[]NAME; do
332 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
333 case "$x" in
334 -L*)
335 dir=`echo "X$x" | sed -e 's/^X-L//'`
336 dnl First look for a shared library.
337 if test -n "$acl_shlibext"; then
338 if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
339 found_dir="$dir"
340 found_so="$dir/$libname$shrext"
341 else
342 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
343 ver=`(cd "$dir" && \
344 for f in "$libname$shrext".*; do echo "$f"; done \
345 | sed -e "s,^$libname$shrext\\\\.,," \
346 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
347 | sed 1q ) 2>/dev/null`
348 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
349 found_dir="$dir"
350 found_so="$dir/$libname$shrext.$ver"
351 fi
352 else
353 eval library_names=\"$acl_library_names_spec\"
354 for f in $library_names; do
355 if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
356 found_dir="$dir"
357 found_so="$dir/$f"
358 break
359 fi
360 done
361 fi
362 fi
363 fi
364 dnl Then look for a static library.
365 if test "X$found_dir" = "X"; then
366 if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
367 found_dir="$dir"
368 found_a="$dir/$libname.$acl_libext"
369 fi
370 fi
371 if test "X$found_dir" != "X"; then
372 if test -f "$dir/$libname.la"; then
373 found_la="$dir/$libname.la"
374 fi
375 fi
376 ;;
377 esac
378 if test "X$found_dir" != "X"; then
379 break
380 fi
381 done
382 fi
383 if test "X$found_dir" != "X"; then
384 dnl Found the library.
385 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
386 if test "X$found_so" != "X"; then
387 dnl Linking with a shared library. We attempt to hardcode its
388 dnl directory into the executable's runpath, unless it's the
389 dnl standard /usr/lib.
390 if test "$enable_rpath" = no \
391 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
392 || test "X$found_dir" = "X/usr/$acl_libdirstem2" \
393 || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then
394 dnl No hardcoding is needed.
395 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
396 else
397 dnl Use an explicit option to hardcode DIR into the resulting
398 dnl binary.
399 dnl Potentially add DIR to ltrpathdirs.
400 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
401 haveit=
402 for x in $ltrpathdirs; do
403 if test "X$x" = "X$found_dir"; then
404 haveit=yes
405 break
406 fi
407 done
408 if test -z "$haveit"; then
409 ltrpathdirs="$ltrpathdirs $found_dir"
410 fi
411 dnl The hardcoding into $LIBNAME is system dependent.
412 if test "$acl_hardcode_direct" = yes; then
413 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
414 dnl resulting binary.
415 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
416 else
417 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
418 dnl Use an explicit option to hardcode DIR into the resulting
419 dnl binary.
420 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
421 dnl Potentially add DIR to rpathdirs.
422 dnl The rpathdirs will be appended to $LIBNAME at the end.
423 haveit=
424 for x in $rpathdirs; do
425 if test "X$x" = "X$found_dir"; then
426 haveit=yes
427 break
428 fi
429 done
430 if test -z "$haveit"; then
431 rpathdirs="$rpathdirs $found_dir"
432 fi
433 else
434 dnl Rely on "-L$found_dir".
435 dnl But don't add it if it's already contained in the LDFLAGS
436 dnl or the already constructed $LIBNAME
437 haveit=
438 for x in $LDFLAGS $LIB[]NAME; do
439 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
440 if test "X$x" = "X-L$found_dir"; then
441 haveit=yes
442 break
443 fi
444 done
445 if test -z "$haveit"; then
446 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
447 fi
448 if test "$acl_hardcode_minus_L" != no; then
449 dnl FIXME: Not sure whether we should use
450 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
451 dnl here.
452 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
453 else
454 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
455 dnl here, because this doesn't fit in flags passed to the
456 dnl compiler. So give up. No hardcoding. This affects only
457 dnl very old systems.
458 dnl FIXME: Not sure whether we should use
459 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
460 dnl here.
461 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
462 fi
463 fi
464 fi
465 fi
466 else
467 if test "X$found_a" != "X"; then
468 dnl Linking with a static library.
469 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
470 else
471 dnl We shouldn't come here, but anyway it's good to have a
472 dnl fallback.
473 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
474 fi
475 fi
476 dnl Assume the include files are nearby.
477 additional_includedir=
478 case "$found_dir" in
479 */$acl_libdirstem | */$acl_libdirstem/)
480 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
481 if test "$name" = '$1'; then
482 LIB[]NAME[]_PREFIX="$basedir"
483 fi
484 additional_includedir="$basedir/include"
485 ;;
486 */$acl_libdirstem2 | */$acl_libdirstem2/)
487 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
488 if test "$name" = '$1'; then
489 LIB[]NAME[]_PREFIX="$basedir"
490 fi
491 additional_includedir="$basedir/include"
492 ;;
493 */$acl_libdirstem3 | */$acl_libdirstem3/)
494 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'`
495 if test "$name" = '$1'; then
496 LIB[]NAME[]_PREFIX="$basedir"
497 fi
498 additional_includedir="$basedir/include"
499 ;;
500 esac
501 if test "X$additional_includedir" != "X"; then
502 dnl Potentially add $additional_includedir to $INCNAME.
503 dnl But don't add it
504 dnl 1. if it's the standard /usr/include,
505 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
506 dnl 3. if it's already present in $CPPFLAGS or the already
507 dnl constructed $INCNAME,
508 dnl 4. if it doesn't exist as a directory.
509 if test "X$additional_includedir" != "X/usr/include"; then
510 haveit=
511 if test "X$additional_includedir" = "X/usr/local/include"; then
512 if test -n "$GCC"; then
513 case $host_os in
514 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
515 esac
516 fi
517 fi
518 if test -z "$haveit"; then
519 for x in $CPPFLAGS $INC[]NAME; do
520 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
521 if test "X$x" = "X-I$additional_includedir"; then
522 haveit=yes
523 break
524 fi
525 done
526 if test -z "$haveit"; then
527 if test -d "$additional_includedir"; then
528 dnl Really add $additional_includedir to $INCNAME.
529 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
530 fi
531 fi
532 fi
533 fi
534 fi
535 dnl Look for dependencies.
536 if test -n "$found_la"; then
537 dnl Read the .la file. It defines the variables
538 dnl dlname, library_names, old_library, dependency_libs, current,
539 dnl age, revision, installed, dlopen, dlpreopen, libdir.
540 save_libdir="$libdir"
541 case "$found_la" in
542 */* | *\\*) . "$found_la" ;;
543 *) . "./$found_la" ;;
544 esac
545 libdir="$save_libdir"
546 dnl We use only dependency_libs.
547 for dep in $dependency_libs; do
548 case "$dep" in
549 -L*)
550 dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
551 dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME.
552 dnl But don't add it
553 dnl 1. if it's the standard /usr/lib,
554 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
555 dnl 3. if it's already present in $LDFLAGS or the already
556 dnl constructed $LIBNAME,
557 dnl 4. if it doesn't exist as a directory.
558 if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \
559 && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \
560 && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then
561 haveit=
562 if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \
563 || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \
564 || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then
565 if test -n "$GCC"; then
566 case $host_os in
567 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
568 esac
569 fi
570 fi
571 if test -z "$haveit"; then
572 haveit=
573 for x in $LDFLAGS $LIB[]NAME; do
574 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
575 if test "X$x" = "X-L$dependency_libdir"; then
576 haveit=yes
577 break
578 fi
579 done
580 if test -z "$haveit"; then
581 if test -d "$dependency_libdir"; then
582 dnl Really add $dependency_libdir to $LIBNAME.
583 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir"
584 fi
585 fi
586 haveit=
587 for x in $LDFLAGS $LTLIB[]NAME; do
588 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
589 if test "X$x" = "X-L$dependency_libdir"; then
590 haveit=yes
591 break
592 fi
593 done
594 if test -z "$haveit"; then
595 if test -d "$dependency_libdir"; then
596 dnl Really add $dependency_libdir to $LTLIBNAME.
597 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir"
598 fi
599 fi
600 fi
601 fi
602 ;;
603 -R*)
604 dir=`echo "X$dep" | sed -e 's/^X-R//'`
605 if test "$enable_rpath" != no; then
606 dnl Potentially add DIR to rpathdirs.
607 dnl The rpathdirs will be appended to $LIBNAME at the end.
608 haveit=
609 for x in $rpathdirs; do
610 if test "X$x" = "X$dir"; then
611 haveit=yes
612 break
613 fi
614 done
615 if test -z "$haveit"; then
616 rpathdirs="$rpathdirs $dir"
617 fi
618 dnl Potentially add DIR to ltrpathdirs.
619 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
620 haveit=
621 for x in $ltrpathdirs; do
622 if test "X$x" = "X$dir"; then
623 haveit=yes
624 break
625 fi
626 done
627 if test -z "$haveit"; then
628 ltrpathdirs="$ltrpathdirs $dir"
629 fi
630 fi
631 ;;
632 -l*)
633 dnl Handle this in the next round.
634 dnl But on GNU systems, ignore -lc options, because
635 dnl - linking with libc is the default anyway,
636 dnl - linking with libc.a may produce an error
637 dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie"
638 dnl or may produce an executable that always crashes, see
639 dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>.
640 dep=`echo "X$dep" | sed -e 's/^X-l//'`
641 if test "X$dep" != Xc \
642 || case $host_os in
643 linux* | gnu* | k*bsd*-gnu) false ;;
644 *) true ;;
645 esac; then
646 names_next_round="$names_next_round $dep"
647 fi
648 ;;
649 *.la)
650 dnl Handle this in the next round. Throw away the .la's
651 dnl directory; it is already contained in a preceding -L
652 dnl option.
653 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
654 ;;
655 *)
656 dnl Most likely an immediate library name.
657 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
658 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
659 ;;
660 esac
661 done
662 fi
663 else
664 dnl Didn't find the library; assume it is in the system directories
665 dnl known to the linker and runtime loader. (All the system
666 dnl directories known to the linker should also be known to the
667 dnl runtime loader, otherwise the system is severely misconfigured.)
668 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
669 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
670 fi
671 fi
672 fi
673 done
674 done
675 if test "X$rpathdirs" != "X"; then
676 if test -n "$acl_hardcode_libdir_separator"; then
677 dnl Weird platform: only the last -rpath option counts, the user must
678 dnl pass all path elements in one option. We can arrange that for a
679 dnl single library, but not when more than one $LIBNAMEs are used.
680 alldirs=
681 for found_dir in $rpathdirs; do
682 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
683 done
684 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
685 acl_save_libdir="$libdir"
686 libdir="$alldirs"
687 eval flag=\"$acl_hardcode_libdir_flag_spec\"
688 libdir="$acl_save_libdir"
689 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
690 else
691 dnl The -rpath options are cumulative.
692 for found_dir in $rpathdirs; do
693 acl_save_libdir="$libdir"
694 libdir="$found_dir"
695 eval flag=\"$acl_hardcode_libdir_flag_spec\"
696 libdir="$acl_save_libdir"
697 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
698 done
699 fi
700 fi
701 if test "X$ltrpathdirs" != "X"; then
702 dnl When using libtool, the option that works for both libraries and
703 dnl executables is -R. The -R options are cumulative.
704 for found_dir in $ltrpathdirs; do
705 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
706 done
707 fi
708 popdef([PACKLIBS])
709 popdef([PACKUP])
710 popdef([PACK])
711 popdef([NAME])
712])
713
714dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
715dnl unless already present in VAR.
716dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
717dnl contains two or three consecutive elements that belong together.
718AC_DEFUN([AC_LIB_APPENDTOVAR],
719[
720 for element in [$2]; do
721 haveit=
722 for x in $[$1]; do
723 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
724 if test "X$x" = "X$element"; then
725 haveit=yes
726 break
727 fi
728 done
729 if test -z "$haveit"; then
730 [$1]="${[$1]}${[$1]:+ }$element"
731 fi
732 done
733])
734
735dnl For those cases where a variable contains several -L and -l options
736dnl referring to unknown libraries and directories, this macro determines the
737dnl necessary additional linker options for the runtime path.
738dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
739dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
740dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
741dnl otherwise linking without libtool is assumed.
742AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
743[
744 AC_REQUIRE([AC_LIB_RPATH])
745 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
746 $1=
747 if test "$enable_rpath" != no; then
748 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
749 dnl Use an explicit option to hardcode directories into the resulting
750 dnl binary.
751 rpathdirs=
752 next=
753 for opt in $2; do
754 if test -n "$next"; then
755 dir="$next"
756 dnl No need to hardcode the standard /usr/lib.
757 if test "X$dir" != "X/usr/$acl_libdirstem" \
758 && test "X$dir" != "X/usr/$acl_libdirstem2" \
759 && test "X$dir" != "X/usr/$acl_libdirstem3"; then
760 rpathdirs="$rpathdirs $dir"
761 fi
762 next=
763 else
764 case $opt in
765 -L) next=yes ;;
766 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
767 dnl No need to hardcode the standard /usr/lib.
768 if test "X$dir" != "X/usr/$acl_libdirstem" \
769 && test "X$dir" != "X/usr/$acl_libdirstem2" \
770 && test "X$dir" != "X/usr/$acl_libdirstem3"; then
771 rpathdirs="$rpathdirs $dir"
772 fi
773 next= ;;
774 *) next= ;;
775 esac
776 fi
777 done
778 if test "X$rpathdirs" != "X"; then
779 if test -n ""$3""; then
780 dnl libtool is used for linking. Use -R options.
781 for dir in $rpathdirs; do
782 $1="${$1}${$1:+ }-R$dir"
783 done
784 else
785 dnl The linker is used for linking directly.
786 if test -n "$acl_hardcode_libdir_separator"; then
787 dnl Weird platform: only the last -rpath option counts, the user
788 dnl must pass all path elements in one option.
789 alldirs=
790 for dir in $rpathdirs; do
791 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
792 done
793 acl_save_libdir="$libdir"
794 libdir="$alldirs"
795 eval flag=\"$acl_hardcode_libdir_flag_spec\"
796 libdir="$acl_save_libdir"
797 $1="$flag"
798 else
799 dnl The -rpath options are cumulative.
800 for dir in $rpathdirs; do
801 acl_save_libdir="$libdir"
802 libdir="$dir"
803 eval flag=\"$acl_hardcode_libdir_flag_spec\"
804 libdir="$acl_save_libdir"
805 $1="${$1}${$1:+ }$flag"
806 done
807 fi
808 fi
809 fi
810 fi
811 fi
812 AC_SUBST([$1])
813])
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4
deleted file mode 100644
index aefe7f71..00000000
--- a/gl/m4/lib-prefix.m4
+++ /dev/null
@@ -1,323 +0,0 @@
1# lib-prefix.m4 serial 20
2dnl Copyright (C) 2001-2005, 2008-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
10dnl to access previously installed libraries. The basic assumption is that
11dnl a user will want packages to use other packages he previously installed
12dnl with the same --prefix option.
13dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
14dnl libraries, but is otherwise very convenient.
15AC_DEFUN([AC_LIB_PREFIX],
16[
17 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
18 AC_REQUIRE([AC_PROG_CC])
19 AC_REQUIRE([AC_CANONICAL_HOST])
20 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
21 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
22 dnl By default, look in $includedir and $libdir.
23 use_additional=yes
24 AC_LIB_WITH_FINAL_PREFIX([
25 eval additional_includedir=\"$includedir\"
26 eval additional_libdir=\"$libdir\"
27 ])
28 AC_ARG_WITH([lib-prefix],
29[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
30 --without-lib-prefix don't search for libraries in includedir and libdir]],
31[
32 if test "X$withval" = "Xno"; then
33 use_additional=no
34 else
35 if test "X$withval" = "X"; then
36 AC_LIB_WITH_FINAL_PREFIX([
37 eval additional_includedir=\"$includedir\"
38 eval additional_libdir=\"$libdir\"
39 ])
40 else
41 additional_includedir="$withval/include"
42 additional_libdir="$withval/$acl_libdirstem"
43 fi
44 fi
45])
46 if test $use_additional = yes; then
47 dnl Potentially add $additional_includedir to $CPPFLAGS.
48 dnl But don't add it
49 dnl 1. if it's the standard /usr/include,
50 dnl 2. if it's already present in $CPPFLAGS,
51 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
52 dnl 4. if it doesn't exist as a directory.
53 if test "X$additional_includedir" != "X/usr/include"; then
54 haveit=
55 for x in $CPPFLAGS; do
56 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
57 if test "X$x" = "X-I$additional_includedir"; then
58 haveit=yes
59 break
60 fi
61 done
62 if test -z "$haveit"; then
63 if test "X$additional_includedir" = "X/usr/local/include"; then
64 if test -n "$GCC"; then
65 case $host_os in
66 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
67 esac
68 fi
69 fi
70 if test -z "$haveit"; then
71 if test -d "$additional_includedir"; then
72 dnl Really add $additional_includedir to $CPPFLAGS.
73 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
74 fi
75 fi
76 fi
77 fi
78 dnl Potentially add $additional_libdir to $LDFLAGS.
79 dnl But don't add it
80 dnl 1. if it's the standard /usr/lib,
81 dnl 2. if it's already present in $LDFLAGS,
82 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
83 dnl 4. if it doesn't exist as a directory.
84 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
85 haveit=
86 for x in $LDFLAGS; do
87 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
88 if test "X$x" = "X-L$additional_libdir"; then
89 haveit=yes
90 break
91 fi
92 done
93 if test -z "$haveit"; then
94 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
95 if test -n "$GCC"; then
96 case $host_os in
97 linux*) haveit=yes;;
98 esac
99 fi
100 fi
101 if test -z "$haveit"; then
102 if test -d "$additional_libdir"; then
103 dnl Really add $additional_libdir to $LDFLAGS.
104 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
105 fi
106 fi
107 fi
108 fi
109 fi
110])
111
112dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
113dnl acl_final_exec_prefix, containing the values to which $prefix and
114dnl $exec_prefix will expand at the end of the configure script.
115AC_DEFUN([AC_LIB_PREPARE_PREFIX],
116[
117 dnl Unfortunately, prefix and exec_prefix get only finally determined
118 dnl at the end of configure.
119 if test "X$prefix" = "XNONE"; then
120 acl_final_prefix="$ac_default_prefix"
121 else
122 acl_final_prefix="$prefix"
123 fi
124 if test "X$exec_prefix" = "XNONE"; then
125 acl_final_exec_prefix='${prefix}'
126 else
127 acl_final_exec_prefix="$exec_prefix"
128 fi
129 acl_save_prefix="$prefix"
130 prefix="$acl_final_prefix"
131 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
132 prefix="$acl_save_prefix"
133])
134
135dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
136dnl variables prefix and exec_prefix bound to the values they will have
137dnl at the end of the configure script.
138AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
139[
140 acl_save_prefix="$prefix"
141 prefix="$acl_final_prefix"
142 acl_save_exec_prefix="$exec_prefix"
143 exec_prefix="$acl_final_exec_prefix"
144 $1
145 exec_prefix="$acl_save_exec_prefix"
146 prefix="$acl_save_prefix"
147])
148
149dnl AC_LIB_PREPARE_MULTILIB creates
150dnl - a function acl_is_expected_elfclass, that tests whether standard input
151dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
152dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
153dnl the basename of the libdir to try in turn, either "lib" or "lib64" or
154dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
155AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
156[
157 dnl There is no formal standard regarding lib, lib32, and lib64.
158 dnl On most glibc systems, the current practice is that on a system supporting
159 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
160 dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
161 dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
162 dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
163 dnl We determine the compiler's default mode by looking at the compiler's
164 dnl library search path. If at least one of its elements ends in /lib64 or
165 dnl points to a directory whose absolute pathname ends in /lib64, we use that
166 dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
167 dnl namely "lib".
168 dnl On Solaris systems, the current practice is that on a system supporting
169 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
170 dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
171 dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
172 AC_REQUIRE([AC_CANONICAL_HOST])
173 AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
174
175 AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
176 [AC_EGREP_CPP([Extensible Linking Format],
177 [#if defined __ELF__ || (defined __linux__ && defined __EDG__)
178 Extensible Linking Format
179 #endif
180 ],
181 [gl_cv_elf=yes],
182 [gl_cv_elf=no])
183 ])
184 if test $gl_cv_elf = yes; then
185 # Extract the ELF class of a file (5th byte) in decimal.
186 # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
187 if od -A x < /dev/null >/dev/null 2>/dev/null; then
188 # Use POSIX od.
189 func_elfclass ()
190 {
191 od -A n -t d1 -j 4 -N 1
192 }
193 else
194 # Use BSD hexdump.
195 func_elfclass ()
196 {
197 dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
198 echo
199 }
200 fi
201 # Use 'expr', not 'test', to compare the values of func_elfclass, because on
202 # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002,
203 # not 1 or 2.
204changequote(,)dnl
205 case $HOST_CPU_C_ABI_32BIT in
206 yes)
207 # 32-bit ABI.
208 acl_is_expected_elfclass ()
209 {
210 expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null
211 }
212 ;;
213 no)
214 # 64-bit ABI.
215 acl_is_expected_elfclass ()
216 {
217 expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null
218 }
219 ;;
220 *)
221 # Unknown.
222 acl_is_expected_elfclass ()
223 {
224 :
225 }
226 ;;
227 esac
228changequote([,])dnl
229 else
230 acl_is_expected_elfclass ()
231 {
232 :
233 }
234 fi
235
236 dnl Allow the user to override the result by setting acl_cv_libdirstems.
237 AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
238 [acl_cv_libdirstems],
239 [dnl Try 'lib' first, because that's the default for libdir in GNU, see
240 dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
241 acl_libdirstem=lib
242 acl_libdirstem2=
243 acl_libdirstem3=
244 case "$host_os" in
245 solaris*)
246 dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
247 dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
248 dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
249 dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
250 dnl symlink is missing, so we set acl_libdirstem2 too.
251 if test $HOST_CPU_C_ABI_32BIT = no; then
252 acl_libdirstem2=lib/64
253 case "$host_cpu" in
254 sparc*) acl_libdirstem3=lib/sparcv9 ;;
255 i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
256 esac
257 fi
258 ;;
259 *)
260 dnl If $CC generates code for a 32-bit ABI, the libraries are
261 dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
262 dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
263 dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
264 dnl Find the compiler's search path. However, non-system compilers
265 dnl sometimes have odd library search paths. But we can't simply invoke
266 dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
267 dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
268 searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
269 | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
270 if test $HOST_CPU_C_ABI_32BIT != no; then
271 # 32-bit or unknown ABI.
272 if test -d /usr/lib32; then
273 acl_libdirstem2=lib32
274 fi
275 fi
276 if test $HOST_CPU_C_ABI_32BIT != yes; then
277 # 64-bit or unknown ABI.
278 if test -d /usr/lib64; then
279 acl_libdirstem3=lib64
280 fi
281 fi
282 if test -n "$searchpath"; then
283 acl_save_IFS="${IFS= }"; IFS=":"
284 for searchdir in $searchpath; do
285 if test -d "$searchdir"; then
286 case "$searchdir" in
287 */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
288 */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
289 */../ | */.. )
290 # Better ignore directories of this form. They are misleading.
291 ;;
292 *) searchdir=`cd "$searchdir" && pwd`
293 case "$searchdir" in
294 */lib32 ) acl_libdirstem2=lib32 ;;
295 */lib64 ) acl_libdirstem3=lib64 ;;
296 esac ;;
297 esac
298 fi
299 done
300 IFS="$acl_save_IFS"
301 if test $HOST_CPU_C_ABI_32BIT = yes; then
302 # 32-bit ABI.
303 acl_libdirstem3=
304 fi
305 if test $HOST_CPU_C_ABI_32BIT = no; then
306 # 64-bit ABI.
307 acl_libdirstem2=
308 fi
309 fi
310 ;;
311 esac
312 test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
313 test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
314 acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
315 ])
316 dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
317 dnl acl_libdirstem3.
318changequote(,)dnl
319 acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
320 acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
321 acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
322changequote([,])dnl
323])
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4
deleted file mode 100644
index 65724481..00000000
--- a/gl/m4/nls.m4
+++ /dev/null
@@ -1,32 +0,0 @@
1# nls.m4 serial 6 (gettext-0.20.2)
2dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2023 Free
3dnl Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl
8dnl This file can be used in projects which are not available under
9dnl the GNU General Public License or the GNU Lesser General Public
10dnl License but which still want to provide support for the GNU gettext
11dnl functionality.
12dnl Please note that the actual code of the GNU gettext library is covered
13dnl by the GNU Lesser General Public License, and the rest of the GNU
14dnl gettext package is covered by the GNU General Public License.
15dnl They are *not* in the public domain.
16
17dnl Authors:
18dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
19dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
20
21AC_PREREQ([2.50])
22
23AC_DEFUN([AM_NLS],
24[
25 AC_MSG_CHECKING([whether NLS is requested])
26 dnl Default is enabled NLS
27 AC_ARG_ENABLE([nls],
28 [ --disable-nls do not use Native Language Support],
29 USE_NLS=$enableval, USE_NLS=yes)
30 AC_MSG_RESULT([$USE_NLS])
31 AC_SUBST([USE_NLS])
32])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
deleted file mode 100644
index 26a5a6f5..00000000
--- a/gl/m4/po.m4
+++ /dev/null
@@ -1,450 +0,0 @@
1# po.m4 serial 31 (gettext-0.20.2)
2dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Lesser General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Lesser General Public License, and the rest of the GNU
13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19
20AC_PREREQ([2.60])
21
22dnl Checks for all prerequisites of the po subdirectory.
23AC_DEFUN([AM_PO_SUBDIRS],
24[
25 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
26 AC_REQUIRE([AC_PROG_INSTALL])dnl
27 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
28 AC_REQUIRE([AC_PROG_SED])dnl
29 AC_REQUIRE([AM_NLS])dnl
30
31 dnl Release version of the gettext macros. This is used to ensure that
32 dnl the gettext macros and po/Makefile.in.in are in sync.
33 AC_SUBST([GETTEXT_MACRO_VERSION], [0.20])
34
35 dnl Perform the following tests also if --disable-nls has been given,
36 dnl because they are needed for "make dist" to work.
37
38 dnl Search for GNU msgfmt in the PATH.
39 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
40 dnl The second test excludes FreeBSD msgfmt.
41 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
42 [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
43 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
44 :)
45 AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
46
47 dnl Test whether it is GNU msgfmt >= 0.15.
48changequote(,)dnl
49 case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
50 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
51 *) GMSGFMT_015=$GMSGFMT ;;
52 esac
53changequote([,])dnl
54 AC_SUBST([GMSGFMT_015])
55
56 dnl Search for GNU xgettext 0.12 or newer in the PATH.
57 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
58 dnl The second test excludes FreeBSD xgettext.
59 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
60 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
61 (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
62 :)
63 dnl Remove leftover from FreeBSD xgettext call.
64 rm -f messages.po
65
66 dnl Test whether it is GNU xgettext >= 0.15.
67changequote(,)dnl
68 case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
69 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
70 *) XGETTEXT_015=$XGETTEXT ;;
71 esac
72changequote([,])dnl
73 AC_SUBST([XGETTEXT_015])
74
75 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
76 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
77 [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
78
79 dnl Test whether it is GNU msgmerge >= 0.20.
80 if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then
81 MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt'
82 else
83 dnl Test whether it is GNU msgmerge >= 0.12.
84 if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then
85 MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet'
86 else
87 dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is
88 dnl slow. But this is not a big problem, as such old gettext versions are
89 dnl hardly in use any more.
90 MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet'
91 fi
92 fi
93 AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
94
95 dnl Support for AM_XGETTEXT_OPTION.
96 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
97 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
98
99 AC_CONFIG_COMMANDS([po-directories], [[
100 for ac_file in $CONFIG_FILES; do
101 # Support "outfile[:infile[:infile...]]"
102 case "$ac_file" in
103 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
104 esac
105 # PO directories have a Makefile.in generated from Makefile.in.in.
106 case "$ac_file" in */Makefile.in)
107 # Adjust a relative srcdir.
108 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
109 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
110 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
111 # In autoconf-2.13 it is called $ac_given_srcdir.
112 # In autoconf-2.50 it is called $srcdir.
113 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
114 case "$ac_given_srcdir" in
115 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
116 /*) top_srcdir="$ac_given_srcdir" ;;
117 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
118 esac
119 # Treat a directory as a PO directory if and only if it has a
120 # POTFILES.in file. This allows packages to have multiple PO
121 # directories under different names or in different locations.
122 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
123 rm -f "$ac_dir/POTFILES"
124 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
125 gt_tab=`printf '\t'`
126 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
127 POMAKEFILEDEPS="POTFILES.in"
128 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
129 # on $ac_dir but don't depend on user-specified configuration
130 # parameters.
131 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
132 # The LINGUAS file contains the set of available languages.
133 if test -n "$OBSOLETE_ALL_LINGUAS"; then
134 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
135 fi
136 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
137 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
138 else
139 # The set of available languages was given in configure.in.
140 ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
141 fi
142 # Compute POFILES
143 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
144 # Compute UPDATEPOFILES
145 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
146 # Compute DUMMYPOFILES
147 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
148 # Compute GMOFILES
149 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
150 case "$ac_given_srcdir" in
151 .) srcdirpre= ;;
152 *) srcdirpre='$(srcdir)/' ;;
153 esac
154 POFILES=
155 UPDATEPOFILES=
156 DUMMYPOFILES=
157 GMOFILES=
158 for lang in $ALL_LINGUAS; do
159 POFILES="$POFILES $srcdirpre$lang.po"
160 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
161 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
162 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
163 done
164 # CATALOGS depends on both $ac_dir and the user's LINGUAS
165 # environment variable.
166 INST_LINGUAS=
167 if test -n "$ALL_LINGUAS"; then
168 for presentlang in $ALL_LINGUAS; do
169 useit=no
170 if test "%UNSET%" != "$LINGUAS"; then
171 desiredlanguages="$LINGUAS"
172 else
173 desiredlanguages="$ALL_LINGUAS"
174 fi
175 for desiredlang in $desiredlanguages; do
176 # Use the presentlang catalog if desiredlang is
177 # a. equal to presentlang, or
178 # b. a variant of presentlang (because in this case,
179 # presentlang can be used as a fallback for messages
180 # which are not translated in the desiredlang catalog).
181 case "$desiredlang" in
182 "$presentlang"*) useit=yes;;
183 esac
184 done
185 if test $useit = yes; then
186 INST_LINGUAS="$INST_LINGUAS $presentlang"
187 fi
188 done
189 fi
190 CATALOGS=
191 if test -n "$INST_LINGUAS"; then
192 for lang in $INST_LINGUAS; do
193 CATALOGS="$CATALOGS $lang.gmo"
194 done
195 fi
196 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
197 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
198 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
199 if test -f "$f"; then
200 case "$f" in
201 *.orig | *.bak | *~) ;;
202 *) cat "$f" >> "$ac_dir/Makefile" ;;
203 esac
204 fi
205 done
206 fi
207 ;;
208 esac
209 done]],
210 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
211 # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS.
212 OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS"
213 # Capture the value of LINGUAS because we need it to compute CATALOGS.
214 LINGUAS="${LINGUAS-%UNSET%}"
215 ])
216])
217
218dnl Postprocesses a Makefile in a directory containing PO files.
219AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
220[
221 # When this code is run, in config.status, two variables have already been
222 # set:
223 # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
224 # - LINGUAS is the value of the environment variable LINGUAS at configure
225 # time.
226
227changequote(,)dnl
228 # Adjust a relative srcdir.
229 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
230 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
231 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
232 # In autoconf-2.13 it is called $ac_given_srcdir.
233 # In autoconf-2.50 it is called $srcdir.
234 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
235 case "$ac_given_srcdir" in
236 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
237 /*) top_srcdir="$ac_given_srcdir" ;;
238 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
239 esac
240
241 # Find a way to echo strings without interpreting backslash.
242 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
243 gt_echo='echo'
244 else
245 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
246 gt_echo='printf %s\n'
247 else
248 echo_func () {
249 cat <<EOT
250$*
251EOT
252 }
253 gt_echo='echo_func'
254 fi
255 fi
256
257 # A sed script that extracts the value of VARIABLE from a Makefile.
258 tab=`printf '\t'`
259 sed_x_variable='
260# Test if the hold space is empty.
261x
262s/P/P/
263x
264ta
265# Yes it was empty. Look if we have the expected variable definition.
266/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
267 # Seen the first line of the variable definition.
268 s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
269 ba
270}
271bd
272:a
273# Here we are processing a line from the variable definition.
274# Remove comment, more precisely replace it with a space.
275s/#.*$/ /
276# See if the line ends in a backslash.
277tb
278:b
279s/\\$//
280# Print the line, without the trailing backslash.
281p
282tc
283# There was no trailing backslash. The end of the variable definition is
284# reached. Clear the hold space.
285s/^.*$//
286x
287bd
288:c
289# A trailing backslash means that the variable definition continues in the
290# next line. Put a nonempty string into the hold space to indicate this.
291s/^.*$/P/
292x
293:d
294'
295changequote([,])dnl
296
297 # Set POTFILES to the value of the Makefile variable POTFILES.
298 sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
299 POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
300 # Compute POTFILES_DEPS as
301 # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
302 POTFILES_DEPS=
303 for file in $POTFILES; do
304 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
305 done
306 POMAKEFILEDEPS=""
307
308 if test -n "$OBSOLETE_ALL_LINGUAS"; then
309 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
310 fi
311 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
312 # The LINGUAS file contains the set of available languages.
313 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
314 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
315 else
316 # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
317 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
318 ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
319 fi
320 # Compute POFILES
321 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
322 # Compute UPDATEPOFILES
323 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
324 # Compute DUMMYPOFILES
325 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
326 # Compute GMOFILES
327 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
328 # Compute PROPERTIESFILES
329 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties)
330 # Compute CLASSFILES
331 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class)
332 # Compute QMFILES
333 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
334 # Compute MSGFILES
335 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
336 # Compute RESOURCESDLLFILES
337 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
338 case "$ac_given_srcdir" in
339 .) srcdirpre= ;;
340 *) srcdirpre='$(srcdir)/' ;;
341 esac
342 POFILES=
343 UPDATEPOFILES=
344 DUMMYPOFILES=
345 GMOFILES=
346 PROPERTIESFILES=
347 CLASSFILES=
348 QMFILES=
349 MSGFILES=
350 RESOURCESDLLFILES=
351 for lang in $ALL_LINGUAS; do
352 POFILES="$POFILES $srcdirpre$lang.po"
353 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
354 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
355 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
356 PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties"
357 CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class"
358 QMFILES="$QMFILES $srcdirpre$lang.qm"
359 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
360 MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
361 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
362 RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
363 done
364 # CATALOGS depends on both $ac_dir and the user's LINGUAS
365 # environment variable.
366 INST_LINGUAS=
367 if test -n "$ALL_LINGUAS"; then
368 for presentlang in $ALL_LINGUAS; do
369 useit=no
370 if test "%UNSET%" != "$LINGUAS"; then
371 desiredlanguages="$LINGUAS"
372 else
373 desiredlanguages="$ALL_LINGUAS"
374 fi
375 for desiredlang in $desiredlanguages; do
376 # Use the presentlang catalog if desiredlang is
377 # a. equal to presentlang, or
378 # b. a variant of presentlang (because in this case,
379 # presentlang can be used as a fallback for messages
380 # which are not translated in the desiredlang catalog).
381 case "$desiredlang" in
382 "$presentlang"*) useit=yes;;
383 esac
384 done
385 if test $useit = yes; then
386 INST_LINGUAS="$INST_LINGUAS $presentlang"
387 fi
388 done
389 fi
390 CATALOGS=
391 JAVACATALOGS=
392 QTCATALOGS=
393 TCLCATALOGS=
394 CSHARPCATALOGS=
395 if test -n "$INST_LINGUAS"; then
396 for lang in $INST_LINGUAS; do
397 CATALOGS="$CATALOGS $lang.gmo"
398 JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
399 QTCATALOGS="$QTCATALOGS $lang.qm"
400 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
401 TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
402 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
403 CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
404 done
405 fi
406
407 sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
408 tab=`printf '\t'`
409 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
410 # Add dependencies that cannot be formulated as a simple suffix rule.
411 for lang in $ALL_LINGUAS; do
412 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
413 cat >> "$ac_file.tmp" <<EOF
414$frobbedlang.msg: $lang.po
415${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
416${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
417EOF
418 done
419 fi
420 if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
421 # Add dependencies that cannot be formulated as a simple suffix rule.
422 for lang in $ALL_LINGUAS; do
423 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
424 cat >> "$ac_file.tmp" <<EOF
425$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
426${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
427${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
428EOF
429 done
430 fi
431 if test -n "$POMAKEFILEDEPS"; then
432 cat >> "$ac_file.tmp" <<EOF
433Makefile: $POMAKEFILEDEPS
434EOF
435 fi
436 mv "$ac_file.tmp" "$ac_file"
437])
438
439dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
440AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
441[
442 XGETTEXT_EXTRA_OPTIONS=
443])
444
445dnl Registers an option to be passed to xgettext in the po subdirectory.
446AC_DEFUN([AM_XGETTEXT_OPTION],
447[
448 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
449 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
450])
diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4
deleted file mode 100644
index 906567bb..00000000
--- a/gl/m4/progtest.m4
+++ /dev/null
@@ -1,91 +0,0 @@
1# progtest.m4 serial 9 (gettext-0.21.1)
2dnl Copyright (C) 1996-2003, 2005, 2008-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Lesser General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Lesser General Public License, and the rest of the GNU
13dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
18
19AC_PREREQ([2.53])
20
21# Search path for a program which passes the given test.
22
23dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
24dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
25AC_DEFUN([AM_PATH_PROG_WITH_TEST],
26[
27# Prepare PATH_SEPARATOR.
28# The user is always right.
29if test "${PATH_SEPARATOR+set}" != set; then
30 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
31 # contains only /bin. Note that ksh looks also at the FPATH variable,
32 # so we have to set that as well for the test.
33 PATH_SEPARATOR=:
34 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
35 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
36 || PATH_SEPARATOR=';'
37 }
38fi
39
40# Find out how to test for executable files. Don't use a zero-byte file,
41# as systems may use methods other than mode bits to determine executability.
42cat >conf$$.file <<_ASEOF
43#! /bin/sh
44exit 0
45_ASEOF
46chmod +x conf$$.file
47if test -x conf$$.file >/dev/null 2>&1; then
48 ac_executable_p="test -x"
49else
50 ac_executable_p="test -f"
51fi
52rm -f conf$$.file
53
54# Extract the first word of "$2", so it can be a program name with args.
55set dummy $2; ac_word=[$]2
56AC_MSG_CHECKING([for $ac_word])
57AC_CACHE_VAL([ac_cv_path_$1],
58[case "[$]$1" in
59 [[\\/]]* | ?:[[\\/]]*)
60 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
61 ;;
62 *)
63 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
64 for ac_dir in m4_if([$5], , $PATH, [$5]); do
65 IFS="$ac_save_IFS"
66 test -z "$ac_dir" && ac_dir=.
67 for ac_exec_ext in '' $ac_executable_extensions; do
68 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
69 echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
70 if [$3]; then
71 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
72 break 2
73 fi
74 fi
75 done
76 done
77 IFS="$ac_save_IFS"
78dnl If no 4th arg is given, leave the cache variable unset,
79dnl so AC_PATH_PROGS will keep looking.
80m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
81])dnl
82 ;;
83esac])dnl
84$1="$ac_cv_path_$1"
85if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
86 AC_MSG_RESULT([$][$1])
87else
88 AC_MSG_RESULT([no])
89fi
90AC_SUBST([$1])dnl
91])