]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - aclocal.m4
Update release notes, etc., for the 1.46.6 release
[thirdparty/e2fsprogs.git] / aclocal.m4
1 # generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2
3 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
4
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15 # ===========================================================================
16 # https://www.gnu.org/software/autoconf-archive/ax_pthread.html
17 # ===========================================================================
18 #
19 # SYNOPSIS
20 #
21 # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
22 #
23 # DESCRIPTION
24 #
25 # This macro figures out how to build C programs using POSIX threads. It
26 # sets the PTHREAD_LIBS output variable to the threads library and linker
27 # flags, and the PTHREAD_CFLAGS output variable to any special C compiler
28 # flags that are needed. (The user can also force certain compiler
29 # flags/libs to be tested by setting these environment variables.)
30 #
31 # Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
32 # needed for multi-threaded programs (defaults to the value of CC
33 # respectively CXX otherwise). (This is necessary on e.g. AIX to use the
34 # special cc_r/CC_r compiler alias.)
35 #
36 # NOTE: You are assumed to not only compile your program with these flags,
37 # but also to link with them as well. For example, you might link with
38 # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
39 # $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
40 #
41 # If you are only building threaded programs, you may wish to use these
42 # variables in your default LIBS, CFLAGS, and CC:
43 #
44 # LIBS="$PTHREAD_LIBS $LIBS"
45 # CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
46 # CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
47 # CC="$PTHREAD_CC"
48 # CXX="$PTHREAD_CXX"
49 #
50 # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
51 # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
52 # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
53 #
54 # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
55 # PTHREAD_PRIO_INHERIT symbol is defined when compiling with
56 # PTHREAD_CFLAGS.
57 #
58 # ACTION-IF-FOUND is a list of shell commands to run if a threads library
59 # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
60 # is not found. If ACTION-IF-FOUND is not specified, the default action
61 # will define HAVE_PTHREAD.
62 #
63 # Please let the authors know if this macro fails on any platform, or if
64 # you have any other suggestions or comments. This macro was based on work
65 # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
66 # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
67 # Alejandro Forero Cuervo to the autoconf macro repository. We are also
68 # grateful for the helpful feedback of numerous users.
69 #
70 # Updated for Autoconf 2.68 by Daniel Richard G.
71 #
72 # LICENSE
73 #
74 # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
75 # Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
76 # Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
77 #
78 # This program is free software: you can redistribute it and/or modify it
79 # under the terms of the GNU General Public License as published by the
80 # Free Software Foundation, either version 3 of the License, or (at your
81 # option) any later version.
82 #
83 # This program is distributed in the hope that it will be useful, but
84 # WITHOUT ANY WARRANTY; without even the implied warranty of
85 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
86 # Public License for more details.
87 #
88 # You should have received a copy of the GNU General Public License along
89 # with this program. If not, see <https://www.gnu.org/licenses/>.
90 #
91 # As a special exception, the respective Autoconf Macro's copyright owner
92 # gives unlimited permission to copy, distribute and modify the configure
93 # scripts that are the output of Autoconf when processing the Macro. You
94 # need not follow the terms of the GNU General Public License when using
95 # or distributing such scripts, even though portions of the text of the
96 # Macro appear in them. The GNU General Public License (GPL) does govern
97 # all other use of the material that constitutes the Autoconf Macro.
98 #
99 # This special exception to the GPL applies to versions of the Autoconf
100 # Macro released by the Autoconf Archive. When you make and distribute a
101 # modified version of the Autoconf Macro, you may extend this special
102 # exception to the GPL to apply to your modified version as well.
103
104 #serial 31
105
106 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
107 AC_DEFUN([AX_PTHREAD], [
108 AC_REQUIRE([AC_CANONICAL_HOST])
109 AC_REQUIRE([AC_PROG_CC])
110 AC_REQUIRE([AC_PROG_SED])
111 AC_LANG_PUSH([C])
112 ax_pthread_ok=no
113
114 # We used to check for pthread.h first, but this fails if pthread.h
115 # requires special compiler flags (e.g. on Tru64 or Sequent).
116 # It gets checked for in the link test anyway.
117
118 # First of all, check if the user has set any of the PTHREAD_LIBS,
119 # etcetera environment variables, and if threads linking works using
120 # them:
121 if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
122 ax_pthread_save_CC="$CC"
123 ax_pthread_save_CFLAGS="$CFLAGS"
124 ax_pthread_save_LIBS="$LIBS"
125 AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
126 AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
127 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
128 LIBS="$PTHREAD_LIBS $LIBS"
129 AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
130 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
131 AC_MSG_RESULT([$ax_pthread_ok])
132 if test "x$ax_pthread_ok" = "xno"; then
133 PTHREAD_LIBS=""
134 PTHREAD_CFLAGS=""
135 fi
136 CC="$ax_pthread_save_CC"
137 CFLAGS="$ax_pthread_save_CFLAGS"
138 LIBS="$ax_pthread_save_LIBS"
139 fi
140
141 # We must check for the threads library under a number of different
142 # names; the ordering is very important because some systems
143 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
144 # libraries is broken (non-POSIX).
145
146 # Create a list of thread flags to try. Items with a "," contain both
147 # C compiler flags (before ",") and linker flags (after ","). Other items
148 # starting with a "-" are C compiler flags, and remaining items are
149 # library names, except for "none" which indicates that we try without
150 # any flags at all, and "pthread-config" which is a program returning
151 # the flags for the Pth emulation library.
152
153 ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
154
155 # The ordering *is* (sometimes) important. Some notes on the
156 # individual items follow:
157
158 # pthreads: AIX (must check this before -lpthread)
159 # none: in case threads are in libc; should be tried before -Kthread and
160 # other compiler flags to prevent continual compiler warnings
161 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
162 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
163 # (Note: HP C rejects this with "bad form for `-t' option")
164 # -pthreads: Solaris/gcc (Note: HP C also rejects)
165 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
166 # doesn't hurt to check since this sometimes defines pthreads and
167 # -D_REENTRANT too), HP C (must be checked before -lpthread, which
168 # is present but should not be used directly; and before -mthreads,
169 # because the compiler interprets this as "-mt" + "-hreads")
170 # -mthreads: Mingw32/gcc, Lynx/gcc
171 # pthread: Linux, etcetera
172 # --thread-safe: KAI C++
173 # pthread-config: use pthread-config program (for GNU Pth library)
174
175 case $host_os in
176
177 freebsd*)
178
179 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
180 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
181
182 ax_pthread_flags="-kthread lthread $ax_pthread_flags"
183 ;;
184
185 hpux*)
186
187 # From the cc(1) man page: "[-mt] Sets various -D flags to enable
188 # multi-threading and also sets -lpthread."
189
190 ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
191 ;;
192
193 openedition*)
194
195 # IBM z/OS requires a feature-test macro to be defined in order to
196 # enable POSIX threads at all, so give the user a hint if this is
197 # not set. (We don't define these ourselves, as they can affect
198 # other portions of the system API in unpredictable ways.)
199
200 AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
201 [
202 # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
203 AX_PTHREAD_ZOS_MISSING
204 # endif
205 ],
206 [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
207 ;;
208
209 solaris*)
210
211 # On Solaris (at least, for some versions), libc contains stubbed
212 # (non-functional) versions of the pthreads routines, so link-based
213 # tests will erroneously succeed. (N.B.: The stubs are missing
214 # pthread_cleanup_push, or rather a function called by this macro,
215 # so we could check for that, but who knows whether they'll stub
216 # that too in a future libc.) So we'll check first for the
217 # standard Solaris way of linking pthreads (-mt -lpthread).
218
219 ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
220 ;;
221 esac
222
223 # Are we compiling with Clang?
224
225 AC_CACHE_CHECK([whether $CC is Clang],
226 [ax_cv_PTHREAD_CLANG],
227 [ax_cv_PTHREAD_CLANG=no
228 # Note that Autoconf sets GCC=yes for Clang as well as GCC
229 if test "x$GCC" = "xyes"; then
230 AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
231 [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
232 # if defined(__clang__) && defined(__llvm__)
233 AX_PTHREAD_CC_IS_CLANG
234 # endif
235 ],
236 [ax_cv_PTHREAD_CLANG=yes])
237 fi
238 ])
239 ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
240
241
242 # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
243
244 # Note that for GCC and Clang -pthread generally implies -lpthread,
245 # except when -nostdlib is passed.
246 # This is problematic using libtool to build C++ shared libraries with pthread:
247 # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
248 # [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
249 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
250 # To solve this, first try -pthread together with -lpthread for GCC
251
252 AS_IF([test "x$GCC" = "xyes"],
253 [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
254
255 # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
256
257 AS_IF([test "x$ax_pthread_clang" = "xyes"],
258 [ax_pthread_flags="-pthread,-lpthread -pthread"])
259
260
261 # The presence of a feature test macro requesting re-entrant function
262 # definitions is, on some systems, a strong hint that pthreads support is
263 # correctly enabled
264
265 case $host_os in
266 darwin* | hpux* | linux* | osf* | solaris*)
267 ax_pthread_check_macro="_REENTRANT"
268 ;;
269
270 aix*)
271 ax_pthread_check_macro="_THREAD_SAFE"
272 ;;
273
274 *)
275 ax_pthread_check_macro="--"
276 ;;
277 esac
278 AS_IF([test "x$ax_pthread_check_macro" = "x--"],
279 [ax_pthread_check_cond=0],
280 [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
281
282
283 if test "x$ax_pthread_ok" = "xno"; then
284 for ax_pthread_try_flag in $ax_pthread_flags; do
285
286 case $ax_pthread_try_flag in
287 none)
288 AC_MSG_CHECKING([whether pthreads work without any flags])
289 ;;
290
291 *,*)
292 PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
293 PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
294 AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
295 ;;
296
297 -*)
298 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
299 PTHREAD_CFLAGS="$ax_pthread_try_flag"
300 ;;
301
302 pthread-config)
303 AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
304 AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
305 PTHREAD_CFLAGS="`pthread-config --cflags`"
306 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
307 ;;
308
309 *)
310 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
311 PTHREAD_LIBS="-l$ax_pthread_try_flag"
312 ;;
313 esac
314
315 ax_pthread_save_CFLAGS="$CFLAGS"
316 ax_pthread_save_LIBS="$LIBS"
317 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
318 LIBS="$PTHREAD_LIBS $LIBS"
319
320 # Check for various functions. We must include pthread.h,
321 # since some functions may be macros. (On the Sequent, we
322 # need a special flag -Kthread to make this header compile.)
323 # We check for pthread_join because it is in -lpthread on IRIX
324 # while pthread_create is in libc. We check for pthread_attr_init
325 # due to DEC craziness with -lpthreads. We check for
326 # pthread_cleanup_push because it is one of the few pthread
327 # functions on Solaris that doesn't have a non-functional libc stub.
328 # We try pthread_create on general principles.
329
330 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
331 # if $ax_pthread_check_cond
332 # error "$ax_pthread_check_macro must be defined"
333 # endif
334 static void *some_global = NULL;
335 static void routine(void *a)
336 {
337 /* To avoid any unused-parameter or
338 unused-but-set-parameter warning. */
339 some_global = a;
340 }
341 static void *start_routine(void *a) { return a; }],
342 [pthread_t th; pthread_attr_t attr;
343 pthread_create(&th, 0, start_routine, 0);
344 pthread_join(th, 0);
345 pthread_attr_init(&attr);
346 pthread_cleanup_push(routine, 0);
347 pthread_cleanup_pop(0) /* ; */])],
348 [ax_pthread_ok=yes],
349 [])
350
351 CFLAGS="$ax_pthread_save_CFLAGS"
352 LIBS="$ax_pthread_save_LIBS"
353
354 AC_MSG_RESULT([$ax_pthread_ok])
355 AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
356
357 PTHREAD_LIBS=""
358 PTHREAD_CFLAGS=""
359 done
360 fi
361
362
363 # Clang needs special handling, because older versions handle the -pthread
364 # option in a rather... idiosyncratic way
365
366 if test "x$ax_pthread_clang" = "xyes"; then
367
368 # Clang takes -pthread; it has never supported any other flag
369
370 # (Note 1: This will need to be revisited if a system that Clang
371 # supports has POSIX threads in a separate library. This tends not
372 # to be the way of modern systems, but it's conceivable.)
373
374 # (Note 2: On some systems, notably Darwin, -pthread is not needed
375 # to get POSIX threads support; the API is always present and
376 # active. We could reasonably leave PTHREAD_CFLAGS empty. But
377 # -pthread does define _REENTRANT, and while the Darwin headers
378 # ignore this macro, third-party headers might not.)
379
380 # However, older versions of Clang make a point of warning the user
381 # that, in an invocation where only linking and no compilation is
382 # taking place, the -pthread option has no effect ("argument unused
383 # during compilation"). They expect -pthread to be passed in only
384 # when source code is being compiled.
385 #
386 # Problem is, this is at odds with the way Automake and most other
387 # C build frameworks function, which is that the same flags used in
388 # compilation (CFLAGS) are also used in linking. Many systems
389 # supported by AX_PTHREAD require exactly this for POSIX threads
390 # support, and in fact it is often not straightforward to specify a
391 # flag that is used only in the compilation phase and not in
392 # linking. Such a scenario is extremely rare in practice.
393 #
394 # Even though use of the -pthread flag in linking would only print
395 # a warning, this can be a nuisance for well-run software projects
396 # that build with -Werror. So if the active version of Clang has
397 # this misfeature, we search for an option to squash it.
398
399 AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
400 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
401 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
402 # Create an alternate version of $ac_link that compiles and
403 # links in two steps (.c -> .o, .o -> exe) instead of one
404 # (.c -> exe), because the warning occurs only in the second
405 # step
406 ax_pthread_save_ac_link="$ac_link"
407 ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
408 ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
409 ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
410 ax_pthread_save_CFLAGS="$CFLAGS"
411 for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
412 AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
413 CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
414 ac_link="$ax_pthread_save_ac_link"
415 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
416 [ac_link="$ax_pthread_2step_ac_link"
417 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
418 [break])
419 ])
420 done
421 ac_link="$ax_pthread_save_ac_link"
422 CFLAGS="$ax_pthread_save_CFLAGS"
423 AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
424 ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
425 ])
426
427 case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
428 no | unknown) ;;
429 *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
430 esac
431
432 fi # $ax_pthread_clang = yes
433
434
435
436 # Various other checks:
437 if test "x$ax_pthread_ok" = "xyes"; then
438 ax_pthread_save_CFLAGS="$CFLAGS"
439 ax_pthread_save_LIBS="$LIBS"
440 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
441 LIBS="$PTHREAD_LIBS $LIBS"
442
443 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
444 AC_CACHE_CHECK([for joinable pthread attribute],
445 [ax_cv_PTHREAD_JOINABLE_ATTR],
446 [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
447 for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
448 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
449 [int attr = $ax_pthread_attr; return attr /* ; */])],
450 [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
451 [])
452 done
453 ])
454 AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
455 test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
456 test "x$ax_pthread_joinable_attr_defined" != "xyes"],
457 [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
458 [$ax_cv_PTHREAD_JOINABLE_ATTR],
459 [Define to necessary symbol if this constant
460 uses a non-standard name on your system.])
461 ax_pthread_joinable_attr_defined=yes
462 ])
463
464 AC_CACHE_CHECK([whether more special flags are required for pthreads],
465 [ax_cv_PTHREAD_SPECIAL_FLAGS],
466 [ax_cv_PTHREAD_SPECIAL_FLAGS=no
467 case $host_os in
468 solaris*)
469 ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
470 ;;
471 esac
472 ])
473 AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
474 test "x$ax_pthread_special_flags_added" != "xyes"],
475 [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
476 ax_pthread_special_flags_added=yes])
477
478 AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
479 [ax_cv_PTHREAD_PRIO_INHERIT],
480 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
481 [[int i = PTHREAD_PRIO_INHERIT;
482 return i;]])],
483 [ax_cv_PTHREAD_PRIO_INHERIT=yes],
484 [ax_cv_PTHREAD_PRIO_INHERIT=no])
485 ])
486 AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
487 test "x$ax_pthread_prio_inherit_defined" != "xyes"],
488 [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
489 ax_pthread_prio_inherit_defined=yes
490 ])
491
492 CFLAGS="$ax_pthread_save_CFLAGS"
493 LIBS="$ax_pthread_save_LIBS"
494
495 # More AIX lossage: compile with *_r variant
496 if test "x$GCC" != "xyes"; then
497 case $host_os in
498 aix*)
499 AS_CASE(["x/$CC"],
500 [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
501 [#handle absolute path differently from PATH based program lookup
502 AS_CASE(["x$CC"],
503 [x/*],
504 [
505 AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
506 AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
507 ],
508 [
509 AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
510 AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
511 ]
512 )
513 ])
514 ;;
515 esac
516 fi
517 fi
518
519 test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
520 test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
521
522 AC_SUBST([PTHREAD_LIBS])
523 AC_SUBST([PTHREAD_CFLAGS])
524 AC_SUBST([PTHREAD_CC])
525 AC_SUBST([PTHREAD_CXX])
526
527 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
528 if test "x$ax_pthread_ok" = "xyes"; then
529 ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
530 :
531 else
532 ax_pthread_ok=no
533 $2
534 fi
535 AC_LANG_POP
536 ])dnl AX_PTHREAD
537
538 # gettext.m4 serial 71 (gettext-0.20.2)
539 dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
540 dnl This file is free software; the Free Software Foundation
541 dnl gives unlimited permission to copy and/or distribute it,
542 dnl with or without modifications, as long as this notice is preserved.
543 dnl
544 dnl This file can be used in projects which are not available under
545 dnl the GNU General Public License or the GNU Lesser General Public
546 dnl License but which still want to provide support for the GNU gettext
547 dnl functionality.
548 dnl Please note that the actual code of the GNU gettext library is covered
549 dnl by the GNU Lesser General Public License, and the rest of the GNU
550 dnl gettext package is covered by the GNU General Public License.
551 dnl They are *not* in the public domain.
552
553 dnl Authors:
554 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
555 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
556
557 dnl Macro to add for using GNU gettext.
558
559 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
560 dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
561 dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
562 dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
563 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
564 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
565 dnl depending on --{enable,disable}-{shared,static} and on the presence of
566 dnl AM-DISABLE-SHARED).
567 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
568 dnl implementations (in libc or libintl) without the ngettext() function
569 dnl will be ignored. If NEEDSYMBOL is specified and is
570 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
571 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
572 dnl INTLDIR is used to find the intl libraries. If empty,
573 dnl the value '$(top_builddir)/intl/' is used.
574 dnl
575 dnl The result of the configuration is one of three cases:
576 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
577 dnl and used.
578 dnl Catalog format: GNU --> install in $(datadir)
579 dnl Catalog extension: .mo after installation, .gmo in source tree
580 dnl 2) GNU gettext has been found in the system's C library.
581 dnl Catalog format: GNU --> install in $(datadir)
582 dnl Catalog extension: .mo after installation, .gmo in source tree
583 dnl 3) No internationalization, always use English msgid.
584 dnl Catalog format: none
585 dnl Catalog extension: none
586 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
587 dnl The use of .gmo is historical (it was needed to avoid overwriting the
588 dnl GNU format catalogs when building on a platform with an X/Open gettext),
589 dnl but we keep it in order not to force irrelevant filename changes on the
590 dnl maintainers.
591 dnl
592 AC_DEFUN([AM_GNU_GETTEXT],
593 [
594 dnl Argument checking.
595 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
596 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
597 ])])])])
598 ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
599 [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
600 ])])
601 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
602 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
603 ])])])])
604 define([gt_included_intl],
605 ifelse([$1], [external], [no], [yes]))
606 gt_NEEDS_INIT
607 AM_GNU_GETTEXT_NEED([$2])
608
609 AC_REQUIRE([AM_PO_SUBDIRS])dnl
610 ifelse(gt_included_intl, yes, [
611 AC_REQUIRE([AM_INTL_SUBDIR])dnl
612 ])
613
614 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
615 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
616 AC_REQUIRE([AC_LIB_RPATH])
617
618 dnl Sometimes libintl requires libiconv, so first search for libiconv.
619 dnl Ideally we would do this search only after the
620 dnl if test "$USE_NLS" = "yes"; then
621 dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
622 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
623 dnl the configure script would need to contain the same shell code
624 dnl again, outside any 'if'. There are two solutions:
625 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
626 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
627 dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
628 ifelse(gt_included_intl, yes, , [
629 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
630 ])
631
632 dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
633 gt_INTL_MACOSX
634
635 dnl Set USE_NLS.
636 AC_REQUIRE([AM_NLS])
637
638 ifelse(gt_included_intl, yes, [
639 BUILD_INCLUDED_LIBINTL=no
640 USE_INCLUDED_LIBINTL=no
641 ])
642 LIBINTL=
643 LTLIBINTL=
644 POSUB=
645
646 dnl Add a version number to the cache macros.
647 case " $gt_needs " in
648 *" need-formatstring-macros "*) gt_api_version=3 ;;
649 *" need-ngettext "*) gt_api_version=2 ;;
650 *) gt_api_version=1 ;;
651 esac
652 gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
653 gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
654
655 dnl If we use NLS figure out what method
656 if test "$USE_NLS" = "yes"; then
657 gt_use_preinstalled_gnugettext=no
658 ifelse(gt_included_intl, yes, [
659 AC_MSG_CHECKING([whether included gettext is requested])
660 AC_ARG_WITH([included-gettext],
661 [ --with-included-gettext use the GNU gettext library included here],
662 nls_cv_force_use_gnu_gettext=$withval,
663 nls_cv_force_use_gnu_gettext=no)
664 AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
665
666 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
667 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
668 ])
669 dnl User does not insist on using GNU NLS library. Figure out what
670 dnl to use. If GNU gettext is available we use this. Else we have
671 dnl to fall back to GNU NLS library.
672
673 if test $gt_api_version -ge 3; then
674 gt_revision_test_code='
675 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
676 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
677 #endif
678 changequote(,)dnl
679 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
680 changequote([,])dnl
681 '
682 else
683 gt_revision_test_code=
684 fi
685 if test $gt_api_version -ge 2; then
686 gt_expression_test_code=' + * ngettext ("", "", 0)'
687 else
688 gt_expression_test_code=
689 fi
690
691 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
692 [AC_LINK_IFELSE(
693 [AC_LANG_PROGRAM(
694 [[
695 #include <libintl.h>
696 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
697 extern int _nl_msg_cat_cntr;
698 extern int *_nl_domain_bindings;
699 #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
700 #else
701 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
702 #endif
703 $gt_revision_test_code
704 ]],
705 [[
706 bindtextdomain ("", "");
707 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
708 ]])],
709 [eval "$gt_func_gnugettext_libc=yes"],
710 [eval "$gt_func_gnugettext_libc=no"])])
711
712 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
713 dnl Sometimes libintl requires libiconv, so first search for libiconv.
714 ifelse(gt_included_intl, yes, , [
715 AM_ICONV_LINK
716 ])
717 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
718 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
719 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
720 dnl even if libiconv doesn't exist.
721 AC_LIB_LINKFLAGS_BODY([intl])
722 AC_CACHE_CHECK([for GNU gettext in libintl],
723 [$gt_func_gnugettext_libintl],
724 [gt_save_CPPFLAGS="$CPPFLAGS"
725 CPPFLAGS="$CPPFLAGS $INCINTL"
726 gt_save_LIBS="$LIBS"
727 LIBS="$LIBS $LIBINTL"
728 dnl Now see whether libintl exists and does not depend on libiconv.
729 AC_LINK_IFELSE(
730 [AC_LANG_PROGRAM(
731 [[
732 #include <libintl.h>
733 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
734 extern int _nl_msg_cat_cntr;
735 extern
736 #ifdef __cplusplus
737 "C"
738 #endif
739 const char *_nl_expand_alias (const char *);
740 #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
741 #else
742 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
743 #endif
744 $gt_revision_test_code
745 ]],
746 [[
747 bindtextdomain ("", "");
748 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
749 ]])],
750 [eval "$gt_func_gnugettext_libintl=yes"],
751 [eval "$gt_func_gnugettext_libintl=no"])
752 dnl Now see whether libintl exists and depends on libiconv.
753 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
754 LIBS="$LIBS $LIBICONV"
755 AC_LINK_IFELSE(
756 [AC_LANG_PROGRAM(
757 [[
758 #include <libintl.h>
759 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
760 extern int _nl_msg_cat_cntr;
761 extern
762 #ifdef __cplusplus
763 "C"
764 #endif
765 const char *_nl_expand_alias (const char *);
766 #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
767 #else
768 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
769 #endif
770 $gt_revision_test_code
771 ]],
772 [[
773 bindtextdomain ("", "");
774 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
775 ]])],
776 [LIBINTL="$LIBINTL $LIBICONV"
777 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
778 eval "$gt_func_gnugettext_libintl=yes"
779 ])
780 fi
781 CPPFLAGS="$gt_save_CPPFLAGS"
782 LIBS="$gt_save_LIBS"])
783 fi
784
785 dnl If an already present or preinstalled GNU gettext() is found,
786 dnl use it. But if this macro is used in GNU gettext, and GNU
787 dnl gettext is already preinstalled in libintl, we update this
788 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
789 if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
790 || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
791 && test "$PACKAGE" != gettext-runtime \
792 && test "$PACKAGE" != gettext-tools; }; then
793 gt_use_preinstalled_gnugettext=yes
794 else
795 dnl Reset the values set by searching for libintl.
796 LIBINTL=
797 LTLIBINTL=
798 INCINTL=
799 fi
800
801 ifelse(gt_included_intl, yes, [
802 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
803 dnl GNU gettext is not found in the C library.
804 dnl Fall back on included GNU gettext library.
805 nls_cv_use_gnu_gettext=yes
806 fi
807 fi
808
809 if test "$nls_cv_use_gnu_gettext" = "yes"; then
810 dnl Mark actions used to generate GNU NLS library.
811 BUILD_INCLUDED_LIBINTL=yes
812 USE_INCLUDED_LIBINTL=yes
813 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
814 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
815 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
816 fi
817
818 CATOBJEXT=
819 if test "$gt_use_preinstalled_gnugettext" = "yes" \
820 || test "$nls_cv_use_gnu_gettext" = "yes"; then
821 dnl Mark actions to use GNU gettext tools.
822 CATOBJEXT=.gmo
823 fi
824 ])
825
826 if test -n "$INTL_MACOSX_LIBS"; then
827 if test "$gt_use_preinstalled_gnugettext" = "yes" \
828 || test "$nls_cv_use_gnu_gettext" = "yes"; then
829 dnl Some extra flags are needed during linking.
830 LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
831 LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
832 fi
833 fi
834
835 if test "$gt_use_preinstalled_gnugettext" = "yes" \
836 || test "$nls_cv_use_gnu_gettext" = "yes"; then
837 AC_DEFINE([ENABLE_NLS], [1],
838 [Define to 1 if translation of program messages to the user's native language
839 is requested.])
840 else
841 USE_NLS=no
842 fi
843 fi
844
845 AC_MSG_CHECKING([whether to use NLS])
846 AC_MSG_RESULT([$USE_NLS])
847 if test "$USE_NLS" = "yes"; then
848 AC_MSG_CHECKING([where the gettext function comes from])
849 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
850 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
851 gt_source="external libintl"
852 else
853 gt_source="libc"
854 fi
855 else
856 gt_source="included intl directory"
857 fi
858 AC_MSG_RESULT([$gt_source])
859 fi
860
861 if test "$USE_NLS" = "yes"; then
862
863 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
864 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
865 AC_MSG_CHECKING([how to link with libintl])
866 AC_MSG_RESULT([$LIBINTL])
867 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
868 fi
869
870 dnl For backward compatibility. Some packages may be using this.
871 AC_DEFINE([HAVE_GETTEXT], [1],
872 [Define if the GNU gettext() function is already present or preinstalled.])
873 AC_DEFINE([HAVE_DCGETTEXT], [1],
874 [Define if the GNU dcgettext() function is already present or preinstalled.])
875 fi
876
877 dnl We need to process the po/ directory.
878 POSUB=po
879 fi
880
881 ifelse(gt_included_intl, yes, [
882 dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
883 dnl because some of the testsuite requires it.
884 BUILD_INCLUDED_LIBINTL=yes
885
886 dnl Make all variables we use known to autoconf.
887 AC_SUBST([BUILD_INCLUDED_LIBINTL])
888 AC_SUBST([USE_INCLUDED_LIBINTL])
889 AC_SUBST([CATOBJEXT])
890 ])
891
892 dnl For backward compatibility. Some Makefiles may be using this.
893 INTLLIBS="$LIBINTL"
894 AC_SUBST([INTLLIBS])
895
896 dnl Make all documented variables known to autoconf.
897 AC_SUBST([LIBINTL])
898 AC_SUBST([LTLIBINTL])
899 AC_SUBST([POSUB])
900 ])
901
902
903 dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
904 m4_define([gt_NEEDS_INIT],
905 [
906 m4_divert_text([DEFAULTS], [gt_needs=])
907 m4_define([gt_NEEDS_INIT], [])
908 ])
909
910
911 dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
912 AC_DEFUN([AM_GNU_GETTEXT_NEED],
913 [
914 m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
915 ])
916
917
918 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
919 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
920
921
922 dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
923 AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
924
925 # host-cpu-c-abi.m4 serial 13
926 dnl Copyright (C) 2002-2020 Free Software Foundation, Inc.
927 dnl This file is free software; the Free Software Foundation
928 dnl gives unlimited permission to copy and/or distribute it,
929 dnl with or without modifications, as long as this notice is preserved.
930
931 dnl From Bruno Haible and Sam Steingold.
932
933 dnl Sets the HOST_CPU variable to the canonical name of the CPU.
934 dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
935 dnl C language ABI (application binary interface).
936 dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
937 dnl config.h.
938 dnl
939 dnl This canonical name can be used to select a particular assembly language
940 dnl source file that will interoperate with C code on the given host.
941 dnl
942 dnl For example:
943 dnl * 'i386' and 'sparc' are different canonical names, because code for i386
944 dnl will not run on SPARC CPUs and vice versa. They have different
945 dnl instruction sets.
946 dnl * 'sparc' and 'sparc64' are different canonical names, because code for
947 dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
948 dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
949 dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
950 dnl mode, but not both.
951 dnl * 'mips' and 'mipsn32' are different canonical names, because they use
952 dnl different argument passing and return conventions for C functions, and
953 dnl although the instruction set of 'mips' is a large subset of the
954 dnl instruction set of 'mipsn32'.
955 dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
956 dnl different sizes for the C types like 'int' and 'void *', and although
957 dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
958 dnl * The same canonical name is used for different endiannesses. You can
959 dnl determine the endianness through preprocessor symbols:
960 dnl - 'arm': test __ARMEL__.
961 dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
962 dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN.
963 dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
964 dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
965 dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
966 dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
967 dnl assembly language source files use such instructions, you will
968 dnl need to make the distinction.
969 dnl - Speed of execution of the common instruction set is reasonable across
970 dnl the entire family of CPUs. If you have assembly language source files
971 dnl that are optimized for particular CPU types (like GNU gmp has), you
972 dnl will need to make the distinction.
973 dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
974 AC_DEFUN([gl_HOST_CPU_C_ABI],
975 [
976 AC_REQUIRE([AC_CANONICAL_HOST])
977 AC_REQUIRE([gl_C_ASM])
978 AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
979 [case "$host_cpu" in
980
981 changequote(,)dnl
982 i[34567]86 )
983 changequote([,])dnl
984 gl_cv_host_cpu_c_abi=i386
985 ;;
986
987 x86_64 )
988 # On x86_64 systems, the C compiler may be generating code in one of
989 # these ABIs:
990 # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
991 # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
992 # with native Windows (mingw, MSVC).
993 # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
994 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
995 AC_COMPILE_IFELSE(
996 [AC_LANG_SOURCE(
997 [[#if (defined __x86_64__ || defined __amd64__ \
998 || defined _M_X64 || defined _M_AMD64)
999 int ok;
1000 #else
1001 error fail
1002 #endif
1003 ]])],
1004 [AC_COMPILE_IFELSE(
1005 [AC_LANG_SOURCE(
1006 [[#if defined __ILP32__ || defined _ILP32
1007 int ok;
1008 #else
1009 error fail
1010 #endif
1011 ]])],
1012 [gl_cv_host_cpu_c_abi=x86_64-x32],
1013 [gl_cv_host_cpu_c_abi=x86_64])],
1014 [gl_cv_host_cpu_c_abi=i386])
1015 ;;
1016
1017 changequote(,)dnl
1018 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
1019 changequote([,])dnl
1020 gl_cv_host_cpu_c_abi=alpha
1021 ;;
1022
1023 arm* | aarch64 )
1024 # Assume arm with EABI.
1025 # On arm64 systems, the C compiler may be generating code in one of
1026 # these ABIs:
1027 # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
1028 # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
1029 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
1030 AC_COMPILE_IFELSE(
1031 [AC_LANG_SOURCE(
1032 [[#ifdef __aarch64__
1033 int ok;
1034 #else
1035 error fail
1036 #endif
1037 ]])],
1038 [AC_COMPILE_IFELSE(
1039 [AC_LANG_SOURCE(
1040 [[#if defined __ILP32__ || defined _ILP32
1041 int ok;
1042 #else
1043 error fail
1044 #endif
1045 ]])],
1046 [gl_cv_host_cpu_c_abi=arm64-ilp32],
1047 [gl_cv_host_cpu_c_abi=arm64])],
1048 [# Don't distinguish little-endian and big-endian arm, since they
1049 # don't require different machine code for simple operations and
1050 # since the user can distinguish them through the preprocessor
1051 # defines __ARMEL__ vs. __ARMEB__.
1052 # But distinguish arm which passes floating-point arguments and
1053 # return values in integer registers (r0, r1, ...) - this is
1054 # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
1055 # passes them in float registers (s0, s1, ...) and double registers
1056 # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
1057 # sets the preprocessor defines __ARM_PCS (for the first case) and
1058 # __ARM_PCS_VFP (for the second case), but older GCC does not.
1059 echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
1060 # Look for a reference to the register d0 in the .s file.
1061 AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
1062 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
1063 gl_cv_host_cpu_c_abi=armhf
1064 else
1065 gl_cv_host_cpu_c_abi=arm
1066 fi
1067 rm -f conftest*
1068 ])
1069 ;;
1070
1071 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
1072 # On hppa, the C compiler may be generating 32-bit code or 64-bit
1073 # code. In the latter case, it defines _LP64 and __LP64__.
1074 AC_COMPILE_IFELSE(
1075 [AC_LANG_SOURCE(
1076 [[#ifdef __LP64__
1077 int ok;
1078 #else
1079 error fail
1080 #endif
1081 ]])],
1082 [gl_cv_host_cpu_c_abi=hppa64],
1083 [gl_cv_host_cpu_c_abi=hppa])
1084 ;;
1085
1086 ia64* )
1087 # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
1088 # 32-bit code. In the latter case, it defines _ILP32.
1089 AC_COMPILE_IFELSE(
1090 [AC_LANG_SOURCE(
1091 [[#ifdef _ILP32
1092 int ok;
1093 #else
1094 error fail
1095 #endif
1096 ]])],
1097 [gl_cv_host_cpu_c_abi=ia64-ilp32],
1098 [gl_cv_host_cpu_c_abi=ia64])
1099 ;;
1100
1101 mips* )
1102 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
1103 # at 32.
1104 AC_COMPILE_IFELSE(
1105 [AC_LANG_SOURCE(
1106 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
1107 int ok;
1108 #else
1109 error fail
1110 #endif
1111 ]])],
1112 [gl_cv_host_cpu_c_abi=mips64],
1113 [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
1114 # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
1115 # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
1116 # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
1117 AC_COMPILE_IFELSE(
1118 [AC_LANG_SOURCE(
1119 [[#if (_MIPS_SIM == _ABIN32)
1120 int ok;
1121 #else
1122 error fail
1123 #endif
1124 ]])],
1125 [gl_cv_host_cpu_c_abi=mipsn32],
1126 [gl_cv_host_cpu_c_abi=mips])])
1127 ;;
1128
1129 powerpc* )
1130 # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
1131 # No need to distinguish them here; the caller may distinguish
1132 # them based on the OS.
1133 # On powerpc64 systems, the C compiler may still be generating
1134 # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
1135 # be generating 64-bit code.
1136 AC_COMPILE_IFELSE(
1137 [AC_LANG_SOURCE(
1138 [[#if defined __powerpc64__ || defined _ARCH_PPC64
1139 int ok;
1140 #else
1141 error fail
1142 #endif
1143 ]])],
1144 [# On powerpc64, there are two ABIs on Linux: The AIX compatible
1145 # one and the ELFv2 one. The latter defines _CALL_ELF=2.
1146 AC_COMPILE_IFELSE(
1147 [AC_LANG_SOURCE(
1148 [[#if defined _CALL_ELF && _CALL_ELF == 2
1149 int ok;
1150 #else
1151 error fail
1152 #endif
1153 ]])],
1154 [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
1155 [gl_cv_host_cpu_c_abi=powerpc64])
1156 ],
1157 [gl_cv_host_cpu_c_abi=powerpc])
1158 ;;
1159
1160 rs6000 )
1161 gl_cv_host_cpu_c_abi=powerpc
1162 ;;
1163
1164 riscv32 | riscv64 )
1165 # There are 2 architectures (with variants): rv32* and rv64*.
1166 AC_COMPILE_IFELSE(
1167 [AC_LANG_SOURCE(
1168 [[#if __riscv_xlen == 64
1169 int ok;
1170 #else
1171 error fail
1172 #endif
1173 ]])],
1174 [cpu=riscv64],
1175 [cpu=riscv32])
1176 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
1177 # Size of 'long' and 'void *':
1178 AC_COMPILE_IFELSE(
1179 [AC_LANG_SOURCE(
1180 [[#if defined __LP64__
1181 int ok;
1182 #else
1183 error fail
1184 #endif
1185 ]])],
1186 [main_abi=lp64],
1187 [main_abi=ilp32])
1188 # Float ABIs:
1189 # __riscv_float_abi_double:
1190 # 'float' and 'double' are passed in floating-point registers.
1191 # __riscv_float_abi_single:
1192 # 'float' are passed in floating-point registers.
1193 # __riscv_float_abi_soft:
1194 # No values are passed in floating-point registers.
1195 AC_COMPILE_IFELSE(
1196 [AC_LANG_SOURCE(
1197 [[#if defined __riscv_float_abi_double
1198 int ok;
1199 #else
1200 error fail
1201 #endif
1202 ]])],
1203 [float_abi=d],
1204 [AC_COMPILE_IFELSE(
1205 [AC_LANG_SOURCE(
1206 [[#if defined __riscv_float_abi_single
1207 int ok;
1208 #else
1209 error fail
1210 #endif
1211 ]])],
1212 [float_abi=f],
1213 [float_abi=''])
1214 ])
1215 gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
1216 ;;
1217
1218 s390* )
1219 # On s390x, the C compiler may be generating 64-bit (= s390x) code
1220 # or 31-bit (= s390) code.
1221 AC_COMPILE_IFELSE(
1222 [AC_LANG_SOURCE(
1223 [[#if defined __LP64__ || defined __s390x__
1224 int ok;
1225 #else
1226 error fail
1227 #endif
1228 ]])],
1229 [gl_cv_host_cpu_c_abi=s390x],
1230 [gl_cv_host_cpu_c_abi=s390])
1231 ;;
1232
1233 sparc | sparc64 )
1234 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
1235 # C compiler still generates 32-bit code.
1236 AC_COMPILE_IFELSE(
1237 [AC_LANG_SOURCE(
1238 [[#if defined __sparcv9 || defined __arch64__
1239 int ok;
1240 #else
1241 error fail
1242 #endif
1243 ]])],
1244 [gl_cv_host_cpu_c_abi=sparc64],
1245 [gl_cv_host_cpu_c_abi=sparc])
1246 ;;
1247
1248 *)
1249 gl_cv_host_cpu_c_abi="$host_cpu"
1250 ;;
1251 esac
1252 ])
1253
1254 dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
1255 HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
1256 HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
1257 AC_SUBST([HOST_CPU])
1258 AC_SUBST([HOST_CPU_C_ABI])
1259
1260 # This was
1261 # AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
1262 # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
1263 # earlier, but KAI C++ 3.2d doesn't like this.
1264 sed -e 's/-/_/g' >> confdefs.h <<EOF
1265 #ifndef __${HOST_CPU}__
1266 #define __${HOST_CPU}__ 1
1267 #endif
1268 #ifndef __${HOST_CPU_C_ABI}__
1269 #define __${HOST_CPU_C_ABI}__ 1
1270 #endif
1271 EOF
1272 AH_TOP([/* CPU and C ABI indicator */
1273 #ifndef __i386__
1274 #undef __i386__
1275 #endif
1276 #ifndef __x86_64_x32__
1277 #undef __x86_64_x32__
1278 #endif
1279 #ifndef __x86_64__
1280 #undef __x86_64__
1281 #endif
1282 #ifndef __alpha__
1283 #undef __alpha__
1284 #endif
1285 #ifndef __arm__
1286 #undef __arm__
1287 #endif
1288 #ifndef __armhf__
1289 #undef __armhf__
1290 #endif
1291 #ifndef __arm64_ilp32__
1292 #undef __arm64_ilp32__
1293 #endif
1294 #ifndef __arm64__
1295 #undef __arm64__
1296 #endif
1297 #ifndef __hppa__
1298 #undef __hppa__
1299 #endif
1300 #ifndef __hppa64__
1301 #undef __hppa64__
1302 #endif
1303 #ifndef __ia64_ilp32__
1304 #undef __ia64_ilp32__
1305 #endif
1306 #ifndef __ia64__
1307 #undef __ia64__
1308 #endif
1309 #ifndef __m68k__
1310 #undef __m68k__
1311 #endif
1312 #ifndef __mips__
1313 #undef __mips__
1314 #endif
1315 #ifndef __mipsn32__
1316 #undef __mipsn32__
1317 #endif
1318 #ifndef __mips64__
1319 #undef __mips64__
1320 #endif
1321 #ifndef __powerpc__
1322 #undef __powerpc__
1323 #endif
1324 #ifndef __powerpc64__
1325 #undef __powerpc64__
1326 #endif
1327 #ifndef __powerpc64_elfv2__
1328 #undef __powerpc64_elfv2__
1329 #endif
1330 #ifndef __riscv32__
1331 #undef __riscv32__
1332 #endif
1333 #ifndef __riscv64__
1334 #undef __riscv64__
1335 #endif
1336 #ifndef __riscv32_ilp32__
1337 #undef __riscv32_ilp32__
1338 #endif
1339 #ifndef __riscv32_ilp32f__
1340 #undef __riscv32_ilp32f__
1341 #endif
1342 #ifndef __riscv32_ilp32d__
1343 #undef __riscv32_ilp32d__
1344 #endif
1345 #ifndef __riscv64_ilp32__
1346 #undef __riscv64_ilp32__
1347 #endif
1348 #ifndef __riscv64_ilp32f__
1349 #undef __riscv64_ilp32f__
1350 #endif
1351 #ifndef __riscv64_ilp32d__
1352 #undef __riscv64_ilp32d__
1353 #endif
1354 #ifndef __riscv64_lp64__
1355 #undef __riscv64_lp64__
1356 #endif
1357 #ifndef __riscv64_lp64f__
1358 #undef __riscv64_lp64f__
1359 #endif
1360 #ifndef __riscv64_lp64d__
1361 #undef __riscv64_lp64d__
1362 #endif
1363 #ifndef __s390__
1364 #undef __s390__
1365 #endif
1366 #ifndef __s390x__
1367 #undef __s390x__
1368 #endif
1369 #ifndef __sh__
1370 #undef __sh__
1371 #endif
1372 #ifndef __sparc__
1373 #undef __sparc__
1374 #endif
1375 #ifndef __sparc64__
1376 #undef __sparc64__
1377 #endif
1378 ])
1379
1380 ])
1381
1382
1383 dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
1384 dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
1385 dnl one, or to 'unknown' if unknown.
1386 dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
1387 AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
1388 [
1389 AC_REQUIRE([AC_CANONICAL_HOST])
1390 AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
1391 [if test -n "$gl_cv_host_cpu_c_abi"; then
1392 case "$gl_cv_host_cpu_c_abi" in
1393 i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
1394 gl_cv_host_cpu_c_abi_32bit=yes ;;
1395 x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
1396 gl_cv_host_cpu_c_abi_32bit=no ;;
1397 *)
1398 gl_cv_host_cpu_c_abi_32bit=unknown ;;
1399 esac
1400 else
1401 case "$host_cpu" in
1402
1403 # CPUs that only support a 32-bit ABI.
1404 arc \
1405 | bfin \
1406 | cris* \
1407 | csky \
1408 | epiphany \
1409 | ft32 \
1410 | h8300 \
1411 | m68k \
1412 | microblaze | microblazeel \
1413 | nds32 | nds32le | nds32be \
1414 | nios2 | nios2eb | nios2el \
1415 | or1k* \
1416 | or32 \
1417 | sh | sh[1234] | sh[1234]e[lb] \
1418 | tic6x \
1419 | xtensa* )
1420 gl_cv_host_cpu_c_abi_32bit=yes
1421 ;;
1422
1423 # CPUs that only support a 64-bit ABI.
1424 changequote(,)dnl
1425 alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
1426 | mmix )
1427 changequote([,])dnl
1428 gl_cv_host_cpu_c_abi_32bit=no
1429 ;;
1430
1431 changequote(,)dnl
1432 i[34567]86 )
1433 changequote([,])dnl
1434 gl_cv_host_cpu_c_abi_32bit=yes
1435 ;;
1436
1437 x86_64 )
1438 # On x86_64 systems, the C compiler may be generating code in one of
1439 # these ABIs:
1440 # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
1441 # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
1442 # with native Windows (mingw, MSVC).
1443 # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
1444 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
1445 AC_COMPILE_IFELSE(
1446 [AC_LANG_SOURCE(
1447 [[#if (defined __x86_64__ || defined __amd64__ \
1448 || defined _M_X64 || defined _M_AMD64) \
1449 && !(defined __ILP32__ || defined _ILP32)
1450 int ok;
1451 #else
1452 error fail
1453 #endif
1454 ]])],
1455 [gl_cv_host_cpu_c_abi_32bit=no],
1456 [gl_cv_host_cpu_c_abi_32bit=yes])
1457 ;;
1458
1459 arm* | aarch64 )
1460 # Assume arm with EABI.
1461 # On arm64 systems, the C compiler may be generating code in one of
1462 # these ABIs:
1463 # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
1464 # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
1465 # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
1466 AC_COMPILE_IFELSE(
1467 [AC_LANG_SOURCE(
1468 [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32)
1469 int ok;
1470 #else
1471 error fail
1472 #endif
1473 ]])],
1474 [gl_cv_host_cpu_c_abi_32bit=no],
1475 [gl_cv_host_cpu_c_abi_32bit=yes])
1476 ;;
1477
1478 hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
1479 # On hppa, the C compiler may be generating 32-bit code or 64-bit
1480 # code. In the latter case, it defines _LP64 and __LP64__.
1481 AC_COMPILE_IFELSE(
1482 [AC_LANG_SOURCE(
1483 [[#ifdef __LP64__
1484 int ok;
1485 #else
1486 error fail
1487 #endif
1488 ]])],
1489 [gl_cv_host_cpu_c_abi_32bit=no],
1490 [gl_cv_host_cpu_c_abi_32bit=yes])
1491 ;;
1492
1493 ia64* )
1494 # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
1495 # 32-bit code. In the latter case, it defines _ILP32.
1496 AC_COMPILE_IFELSE(
1497 [AC_LANG_SOURCE(
1498 [[#ifdef _ILP32
1499 int ok;
1500 #else
1501 error fail
1502 #endif
1503 ]])],
1504 [gl_cv_host_cpu_c_abi_32bit=yes],
1505 [gl_cv_host_cpu_c_abi_32bit=no])
1506 ;;
1507
1508 mips* )
1509 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
1510 # at 32.
1511 AC_COMPILE_IFELSE(
1512 [AC_LANG_SOURCE(
1513 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
1514 int ok;
1515 #else
1516 error fail
1517 #endif
1518 ]])],
1519 [gl_cv_host_cpu_c_abi_32bit=no],
1520 [gl_cv_host_cpu_c_abi_32bit=yes])
1521 ;;
1522
1523 powerpc* )
1524 # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
1525 # No need to distinguish them here; the caller may distinguish
1526 # them based on the OS.
1527 # On powerpc64 systems, the C compiler may still be generating
1528 # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
1529 # be generating 64-bit code.
1530 AC_COMPILE_IFELSE(
1531 [AC_LANG_SOURCE(
1532 [[#if defined __powerpc64__ || defined _ARCH_PPC64
1533 int ok;
1534 #else
1535 error fail
1536 #endif
1537 ]])],
1538 [gl_cv_host_cpu_c_abi_32bit=no],
1539 [gl_cv_host_cpu_c_abi_32bit=yes])
1540 ;;
1541
1542 rs6000 )
1543 gl_cv_host_cpu_c_abi_32bit=yes
1544 ;;
1545
1546 riscv32 | riscv64 )
1547 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
1548 # Size of 'long' and 'void *':
1549 AC_COMPILE_IFELSE(
1550 [AC_LANG_SOURCE(
1551 [[#if defined __LP64__
1552 int ok;
1553 #else
1554 error fail
1555 #endif
1556 ]])],
1557 [gl_cv_host_cpu_c_abi_32bit=no],
1558 [gl_cv_host_cpu_c_abi_32bit=yes])
1559 ;;
1560
1561 s390* )
1562 # On s390x, the C compiler may be generating 64-bit (= s390x) code
1563 # or 31-bit (= s390) code.
1564 AC_COMPILE_IFELSE(
1565 [AC_LANG_SOURCE(
1566 [[#if defined __LP64__ || defined __s390x__
1567 int ok;
1568 #else
1569 error fail
1570 #endif
1571 ]])],
1572 [gl_cv_host_cpu_c_abi_32bit=no],
1573 [gl_cv_host_cpu_c_abi_32bit=yes])
1574 ;;
1575
1576 sparc | sparc64 )
1577 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
1578 # C compiler still generates 32-bit code.
1579 AC_COMPILE_IFELSE(
1580 [AC_LANG_SOURCE(
1581 [[#if defined __sparcv9 || defined __arch64__
1582 int ok;
1583 #else
1584 error fail
1585 #endif
1586 ]])],
1587 [gl_cv_host_cpu_c_abi_32bit=no],
1588 [gl_cv_host_cpu_c_abi_32bit=yes])
1589 ;;
1590
1591 *)
1592 gl_cv_host_cpu_c_abi_32bit=unknown
1593 ;;
1594 esac
1595 fi
1596 ])
1597
1598 HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
1599 ])
1600
1601 # iconv.m4 serial 21
1602 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation,
1603 dnl Inc.
1604 dnl This file is free software; the Free Software Foundation
1605 dnl gives unlimited permission to copy and/or distribute it,
1606 dnl with or without modifications, as long as this notice is preserved.
1607
1608 dnl From Bruno Haible.
1609
1610 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
1611 [
1612 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1613 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1614 AC_REQUIRE([AC_LIB_RPATH])
1615
1616 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1617 dnl accordingly.
1618 AC_LIB_LINKFLAGS_BODY([iconv])
1619 ])
1620
1621 AC_DEFUN([AM_ICONV_LINK],
1622 [
1623 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1624 dnl those with the standalone portable GNU libiconv installed).
1625 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1626
1627 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1628 dnl accordingly.
1629 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
1630
1631 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
1632 dnl because if the user has installed libiconv and not disabled its use
1633 dnl via --without-libiconv-prefix, he wants to use it. The first
1634 dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
1635 am_save_CPPFLAGS="$CPPFLAGS"
1636 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
1637
1638 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
1639 am_cv_func_iconv="no, consider installing GNU libiconv"
1640 am_cv_lib_iconv=no
1641 AC_LINK_IFELSE(
1642 [AC_LANG_PROGRAM(
1643 [[
1644 #include <stdlib.h>
1645 #include <iconv.h>
1646 ]],
1647 [[iconv_t cd = iconv_open("","");
1648 iconv(cd,NULL,NULL,NULL,NULL);
1649 iconv_close(cd);]])],
1650 [am_cv_func_iconv=yes])
1651 if test "$am_cv_func_iconv" != yes; then
1652 am_save_LIBS="$LIBS"
1653 LIBS="$LIBS $LIBICONV"
1654 AC_LINK_IFELSE(
1655 [AC_LANG_PROGRAM(
1656 [[
1657 #include <stdlib.h>
1658 #include <iconv.h>
1659 ]],
1660 [[iconv_t cd = iconv_open("","");
1661 iconv(cd,NULL,NULL,NULL,NULL);
1662 iconv_close(cd);]])],
1663 [am_cv_lib_iconv=yes]
1664 [am_cv_func_iconv=yes])
1665 LIBS="$am_save_LIBS"
1666 fi
1667 ])
1668 if test "$am_cv_func_iconv" = yes; then
1669 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
1670 dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
1671 dnl Solaris 10.
1672 am_save_LIBS="$LIBS"
1673 if test $am_cv_lib_iconv = yes; then
1674 LIBS="$LIBS $LIBICONV"
1675 fi
1676 am_cv_func_iconv_works=no
1677 for ac_iconv_const in '' 'const'; do
1678 AC_RUN_IFELSE(
1679 [AC_LANG_PROGRAM(
1680 [[
1681 #include <iconv.h>
1682 #include <string.h>
1683
1684 #ifndef ICONV_CONST
1685 # define ICONV_CONST $ac_iconv_const
1686 #endif
1687 ]],
1688 [[int result = 0;
1689 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
1690 returns. */
1691 {
1692 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
1693 if (cd_utf8_to_88591 != (iconv_t)(-1))
1694 {
1695 static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
1696 char buf[10];
1697 ICONV_CONST char *inptr = input;
1698 size_t inbytesleft = strlen (input);
1699 char *outptr = buf;
1700 size_t outbytesleft = sizeof (buf);
1701 size_t res = iconv (cd_utf8_to_88591,
1702 &inptr, &inbytesleft,
1703 &outptr, &outbytesleft);
1704 if (res == 0)
1705 result |= 1;
1706 iconv_close (cd_utf8_to_88591);
1707 }
1708 }
1709 /* Test against Solaris 10 bug: Failures are not distinguishable from
1710 successful returns. */
1711 {
1712 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
1713 if (cd_ascii_to_88591 != (iconv_t)(-1))
1714 {
1715 static ICONV_CONST char input[] = "\263";
1716 char buf[10];
1717 ICONV_CONST char *inptr = input;
1718 size_t inbytesleft = strlen (input);
1719 char *outptr = buf;
1720 size_t outbytesleft = sizeof (buf);
1721 size_t res = iconv (cd_ascii_to_88591,
1722 &inptr, &inbytesleft,
1723 &outptr, &outbytesleft);
1724 if (res == 0)
1725 result |= 2;
1726 iconv_close (cd_ascii_to_88591);
1727 }
1728 }
1729 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
1730 {
1731 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
1732 if (cd_88591_to_utf8 != (iconv_t)(-1))
1733 {
1734 static ICONV_CONST char input[] = "\304";
1735 static char buf[2] = { (char)0xDE, (char)0xAD };
1736 ICONV_CONST char *inptr = input;
1737 size_t inbytesleft = 1;
1738 char *outptr = buf;
1739 size_t outbytesleft = 1;
1740 size_t res = iconv (cd_88591_to_utf8,
1741 &inptr, &inbytesleft,
1742 &outptr, &outbytesleft);
1743 if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
1744 result |= 4;
1745 iconv_close (cd_88591_to_utf8);
1746 }
1747 }
1748 #if 0 /* This bug could be worked around by the caller. */
1749 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
1750 {
1751 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
1752 if (cd_88591_to_utf8 != (iconv_t)(-1))
1753 {
1754 static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
1755 char buf[50];
1756 ICONV_CONST char *inptr = input;
1757 size_t inbytesleft = strlen (input);
1758 char *outptr = buf;
1759 size_t outbytesleft = sizeof (buf);
1760 size_t res = iconv (cd_88591_to_utf8,
1761 &inptr, &inbytesleft,
1762 &outptr, &outbytesleft);
1763 if ((int)res > 0)
1764 result |= 8;
1765 iconv_close (cd_88591_to_utf8);
1766 }
1767 }
1768 #endif
1769 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
1770 provided. */
1771 {
1772 /* Try standardized names. */
1773 iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
1774 /* Try IRIX, OSF/1 names. */
1775 iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
1776 /* Try AIX names. */
1777 iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
1778 /* Try HP-UX names. */
1779 iconv_t cd4 = iconv_open ("utf8", "eucJP");
1780 if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
1781 && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
1782 result |= 16;
1783 if (cd1 != (iconv_t)(-1))
1784 iconv_close (cd1);
1785 if (cd2 != (iconv_t)(-1))
1786 iconv_close (cd2);
1787 if (cd3 != (iconv_t)(-1))
1788 iconv_close (cd3);
1789 if (cd4 != (iconv_t)(-1))
1790 iconv_close (cd4);
1791 }
1792 return result;
1793 ]])],
1794 [am_cv_func_iconv_works=yes], ,
1795 [case "$host_os" in
1796 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
1797 *) am_cv_func_iconv_works="guessing yes" ;;
1798 esac])
1799 test "$am_cv_func_iconv_works" = no || break
1800 done
1801 LIBS="$am_save_LIBS"
1802 ])
1803 case "$am_cv_func_iconv_works" in
1804 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
1805 *) am_func_iconv=yes ;;
1806 esac
1807 else
1808 am_func_iconv=no am_cv_lib_iconv=no
1809 fi
1810 if test "$am_func_iconv" = yes; then
1811 AC_DEFINE([HAVE_ICONV], [1],
1812 [Define if you have the iconv() function and it works.])
1813 fi
1814 if test "$am_cv_lib_iconv" = yes; then
1815 AC_MSG_CHECKING([how to link with libiconv])
1816 AC_MSG_RESULT([$LIBICONV])
1817 else
1818 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
1819 dnl either.
1820 CPPFLAGS="$am_save_CPPFLAGS"
1821 LIBICONV=
1822 LTLIBICONV=
1823 fi
1824 AC_SUBST([LIBICONV])
1825 AC_SUBST([LTLIBICONV])
1826 ])
1827
1828 dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
1829 dnl avoid warnings like
1830 dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
1831 dnl This is tricky because of the way 'aclocal' is implemented:
1832 dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
1833 dnl Otherwise aclocal's initial scan pass would miss the macro definition.
1834 dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
1835 dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
1836 dnl warnings.
1837 m4_define([gl_iconv_AC_DEFUN],
1838 m4_version_prereq([2.64],
1839 [[AC_DEFUN_ONCE(
1840 [$1], [$2])]],
1841 [m4_ifdef([gl_00GNULIB],
1842 [[AC_DEFUN_ONCE(
1843 [$1], [$2])]],
1844 [[AC_DEFUN(
1845 [$1], [$2])]])]))
1846 gl_iconv_AC_DEFUN([AM_ICONV],
1847 [
1848 AM_ICONV_LINK
1849 if test "$am_cv_func_iconv" = yes; then
1850 AC_MSG_CHECKING([for iconv declaration])
1851 AC_CACHE_VAL([am_cv_proto_iconv], [
1852 AC_COMPILE_IFELSE(
1853 [AC_LANG_PROGRAM(
1854 [[
1855 #include <stdlib.h>
1856 #include <iconv.h>
1857 extern
1858 #ifdef __cplusplus
1859 "C"
1860 #endif
1861 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
1862 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1863 #else
1864 size_t iconv();
1865 #endif
1866 ]],
1867 [[]])],
1868 [am_cv_proto_iconv_arg1=""],
1869 [am_cv_proto_iconv_arg1="const"])
1870 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
1871 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1872 AC_MSG_RESULT([
1873 $am_cv_proto_iconv])
1874 else
1875 dnl When compiling GNU libiconv on a system that does not have iconv yet,
1876 dnl pick the POSIX compliant declaration without 'const'.
1877 am_cv_proto_iconv_arg1=""
1878 fi
1879 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
1880 [Define as const if the declaration of iconv() needs const.])
1881 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
1882 m4_ifdef([gl_ICONV_H_DEFAULTS],
1883 [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
1884 if test -n "$am_cv_proto_iconv_arg1"; then
1885 ICONV_CONST="const"
1886 fi
1887 ])
1888 ])
1889
1890 # intlmacosx.m4 serial 8 (gettext-0.20.2)
1891 dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc.
1892 dnl This file is free software; the Free Software Foundation
1893 dnl gives unlimited permission to copy and/or distribute it,
1894 dnl with or without modifications, as long as this notice is preserved.
1895 dnl
1896 dnl This file can be used in projects which are not available under
1897 dnl the GNU General Public License or the GNU Lesser General Public
1898 dnl License but which still want to provide support for the GNU gettext
1899 dnl functionality.
1900 dnl Please note that the actual code of the GNU gettext library is covered
1901 dnl by the GNU Lesser General Public License, and the rest of the GNU
1902 dnl gettext package is covered by the GNU General Public License.
1903 dnl They are *not* in the public domain.
1904
1905 dnl Checks for special options needed on Mac OS X.
1906 dnl Defines INTL_MACOSX_LIBS.
1907 AC_DEFUN([gt_INTL_MACOSX],
1908 [
1909 dnl Check for API introduced in Mac OS X 10.4.
1910 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
1911 [gt_cv_func_CFPreferencesCopyAppValue],
1912 [gt_save_LIBS="$LIBS"
1913 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
1914 AC_LINK_IFELSE(
1915 [AC_LANG_PROGRAM(
1916 [[#include <CoreFoundation/CFPreferences.h>]],
1917 [[CFPreferencesCopyAppValue(NULL, NULL)]])],
1918 [gt_cv_func_CFPreferencesCopyAppValue=yes],
1919 [gt_cv_func_CFPreferencesCopyAppValue=no])
1920 LIBS="$gt_save_LIBS"])
1921 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
1922 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
1923 [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
1924 fi
1925 dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
1926 dnl because in macOS 10.13.4 it has the following behaviour:
1927 dnl When two or more languages are specified in the
1928 dnl "System Preferences > Language & Region > Preferred Languages" panel,
1929 dnl it returns en_CC where CC is the territory (even when English is not among
1930 dnl the preferred languages!). What we want instead is what
1931 dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
1932 dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
1933 dnl first among the preferred languages and CC is the territory.
1934 AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
1935 [gt_save_LIBS="$LIBS"
1936 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
1937 AC_LINK_IFELSE(
1938 [AC_LANG_PROGRAM(
1939 [[#include <CoreFoundation/CFLocale.h>]],
1940 [[CFLocaleCopyPreferredLanguages();]])],
1941 [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
1942 [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
1943 LIBS="$gt_save_LIBS"])
1944 if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
1945 AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
1946 [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
1947 fi
1948 INTL_MACOSX_LIBS=
1949 if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
1950 || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
1951 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
1952 fi
1953 AC_SUBST([INTL_MACOSX_LIBS])
1954 ])
1955
1956 # lib-ld.m4 serial 9
1957 dnl Copyright (C) 1996-2003, 2009-2020 Free Software Foundation, Inc.
1958 dnl This file is free software; the Free Software Foundation
1959 dnl gives unlimited permission to copy and/or distribute it,
1960 dnl with or without modifications, as long as this notice is preserved.
1961
1962 dnl Subroutines of libtool.m4,
1963 dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
1964 dnl collision with libtool.m4.
1965
1966 dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
1967 AC_DEFUN([AC_LIB_PROG_LD_GNU],
1968 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
1969 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
1970 case `$LD -v 2>&1 </dev/null` in
1971 *GNU* | *'with BFD'*)
1972 acl_cv_prog_gnu_ld=yes
1973 ;;
1974 *)
1975 acl_cv_prog_gnu_ld=no
1976 ;;
1977 esac])
1978 with_gnu_ld=$acl_cv_prog_gnu_ld
1979 ])
1980
1981 dnl From libtool-2.4. Sets the variable LD.
1982 AC_DEFUN([AC_LIB_PROG_LD],
1983 [AC_REQUIRE([AC_PROG_CC])dnl
1984 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1985
1986 AC_ARG_WITH([gnu-ld],
1987 [AS_HELP_STRING([--with-gnu-ld],
1988 [assume the C compiler uses GNU ld [default=no]])],
1989 [test "$withval" = no || with_gnu_ld=yes],
1990 [with_gnu_ld=no])dnl
1991
1992 # Prepare PATH_SEPARATOR.
1993 # The user is always right.
1994 if test "${PATH_SEPARATOR+set}" != set; then
1995 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
1996 # contains only /bin. Note that ksh looks also at the FPATH variable,
1997 # so we have to set that as well for the test.
1998 PATH_SEPARATOR=:
1999 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
2000 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
2001 || PATH_SEPARATOR=';'
2002 }
2003 fi
2004
2005 if test -n "$LD"; then
2006 AC_MSG_CHECKING([for ld])
2007 elif test "$GCC" = yes; then
2008 AC_MSG_CHECKING([for ld used by $CC])
2009 elif test "$with_gnu_ld" = yes; then
2010 AC_MSG_CHECKING([for GNU ld])
2011 else
2012 AC_MSG_CHECKING([for non-GNU ld])
2013 fi
2014 if test -n "$LD"; then
2015 # Let the user override the test with a path.
2016 :
2017 else
2018 AC_CACHE_VAL([acl_cv_path_LD],
2019 [
2020 acl_cv_path_LD= # Final result of this test
2021 ac_prog=ld # Program to search in $PATH
2022 if test "$GCC" = yes; then
2023 # Check if gcc -print-prog-name=ld gives a path.
2024 case $host in
2025 *-*-mingw*)
2026 # gcc leaves a trailing carriage return which upsets mingw
2027 acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2028 *)
2029 acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
2030 esac
2031 case $acl_output in
2032 # Accept absolute paths.
2033 [[\\/]]* | ?:[[\\/]]*)
2034 re_direlt='/[[^/]][[^/]]*/\.\./'
2035 # Canonicalize the pathname of ld
2036 acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
2037 while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
2038 acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
2039 done
2040 # Got the pathname. No search in PATH is needed.
2041 acl_cv_path_LD="$acl_output"
2042 ac_prog=
2043 ;;
2044 "")
2045 # If it fails, then pretend we aren't using GCC.
2046 ;;
2047 *)
2048 # If it is relative, then search for the first ld in PATH.
2049 with_gnu_ld=unknown
2050 ;;
2051 esac
2052 fi
2053 if test -n "$ac_prog"; then
2054 # Search for $ac_prog in $PATH.
2055 acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
2056 for ac_dir in $PATH; do
2057 IFS="$acl_save_ifs"
2058 test -z "$ac_dir" && ac_dir=.
2059 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2060 acl_cv_path_LD="$ac_dir/$ac_prog"
2061 # Check to see if the program is GNU ld. I'd rather use --version,
2062 # but apparently some variants of GNU ld only accept -v.
2063 # Break only if it was the GNU/non-GNU ld that we prefer.
2064 case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
2065 *GNU* | *'with BFD'*)
2066 test "$with_gnu_ld" != no && break
2067 ;;
2068 *)
2069 test "$with_gnu_ld" != yes && break
2070 ;;
2071 esac
2072 fi
2073 done
2074 IFS="$acl_save_ifs"
2075 fi
2076 case $host in
2077 *-*-aix*)
2078 AC_COMPILE_IFELSE(
2079 [AC_LANG_SOURCE(
2080 [[#if defined __powerpc64__ || defined _ARCH_PPC64
2081 int ok;
2082 #else
2083 error fail
2084 #endif
2085 ]])],
2086 [# The compiler produces 64-bit code. Add option '-b64' so that the
2087 # linker groks 64-bit object files.
2088 case "$acl_cv_path_LD " in
2089 *" -b64 "*) ;;
2090 *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
2091 esac
2092 ], [])
2093 ;;
2094 sparc64-*-netbsd*)
2095 AC_COMPILE_IFELSE(
2096 [AC_LANG_SOURCE(
2097 [[#if defined __sparcv9 || defined __arch64__
2098 int ok;
2099 #else
2100 error fail
2101 #endif
2102 ]])],
2103 [],
2104 [# The compiler produces 32-bit code. Add option '-m elf32_sparc'
2105 # so that the linker groks 32-bit object files.
2106 case "$acl_cv_path_LD " in
2107 *" -m elf32_sparc "*) ;;
2108 *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
2109 esac
2110 ])
2111 ;;
2112 esac
2113 ])
2114 LD="$acl_cv_path_LD"
2115 fi
2116 if test -n "$LD"; then
2117 AC_MSG_RESULT([$LD])
2118 else
2119 AC_MSG_RESULT([no])
2120 AC_MSG_ERROR([no acceptable ld found in \$PATH])
2121 fi
2122 AC_LIB_PROG_LD_GNU
2123 ])
2124
2125 # lib-link.m4 serial 31
2126 dnl Copyright (C) 2001-2020 Free Software Foundation, Inc.
2127 dnl This file is free software; the Free Software Foundation
2128 dnl gives unlimited permission to copy and/or distribute it,
2129 dnl with or without modifications, as long as this notice is preserved.
2130
2131 dnl From Bruno Haible.
2132
2133 AC_PREREQ([2.61])
2134
2135 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2136 dnl the libraries corresponding to explicit and implicit dependencies.
2137 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2138 dnl augments the CPPFLAGS variable.
2139 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
2140 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
2141 AC_DEFUN([AC_LIB_LINKFLAGS],
2142 [
2143 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2144 AC_REQUIRE([AC_LIB_RPATH])
2145 pushdef([Name],[m4_translit([$1],[./+-], [____])])
2146 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
2147 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2148 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2149 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2150 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2151 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2152 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2153 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
2154 ])
2155 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2156 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2157 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2158 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
2159 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2160 AC_SUBST([LIB]NAME)
2161 AC_SUBST([LTLIB]NAME)
2162 AC_SUBST([LIB]NAME[_PREFIX])
2163 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2164 dnl results of this search when this library appears as a dependency.
2165 HAVE_LIB[]NAME=yes
2166 popdef([NAME])
2167 popdef([Name])
2168 ])
2169
2170 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
2171 dnl searches for libname and the libraries corresponding to explicit and
2172 dnl implicit dependencies, together with the specified include files and
2173 dnl the ability to compile and link the specified testcode. The missing-message
2174 dnl defaults to 'no' and may contain additional hints for the user.
2175 dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
2176 dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2177 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2178 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2179 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
2180 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
2181 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2182 [
2183 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2184 AC_REQUIRE([AC_LIB_RPATH])
2185 pushdef([Name],[m4_translit([$1],[./+-], [____])])
2186 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
2187 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2188
2189 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2190 dnl accordingly.
2191 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2192
2193 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2194 dnl because if the user has installed lib[]Name and not disabled its use
2195 dnl via --without-lib[]Name-prefix, he wants to use it.
2196 ac_save_CPPFLAGS="$CPPFLAGS"
2197 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2198
2199 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2200 ac_save_LIBS="$LIBS"
2201 dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
2202 dnl because these -l options might require -L options that are present in
2203 dnl LIBS. -l options benefit only from the -L options listed before it.
2204 dnl Otherwise, add it to the front of LIBS, because it may be a static
2205 dnl library that depends on another static library that is present in LIBS.
2206 dnl Static libraries benefit only from the static libraries listed after
2207 dnl it.
2208 case " $LIB[]NAME" in
2209 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
2210 *) LIBS="$LIB[]NAME $LIBS" ;;
2211 esac
2212 AC_LINK_IFELSE(
2213 [AC_LANG_PROGRAM([[$3]], [[$4]])],
2214 [ac_cv_lib[]Name=yes],
2215 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
2216 LIBS="$ac_save_LIBS"
2217 ])
2218 if test "$ac_cv_lib[]Name" = yes; then
2219 HAVE_LIB[]NAME=yes
2220 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
2221 AC_MSG_CHECKING([how to link with lib[]$1])
2222 AC_MSG_RESULT([$LIB[]NAME])
2223 else
2224 HAVE_LIB[]NAME=no
2225 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2226 dnl $INC[]NAME either.
2227 CPPFLAGS="$ac_save_CPPFLAGS"
2228 LIB[]NAME=
2229 LTLIB[]NAME=
2230 LIB[]NAME[]_PREFIX=
2231 fi
2232 AC_SUBST([HAVE_LIB]NAME)
2233 AC_SUBST([LIB]NAME)
2234 AC_SUBST([LTLIB]NAME)
2235 AC_SUBST([LIB]NAME[_PREFIX])
2236 popdef([NAME])
2237 popdef([Name])
2238 ])
2239
2240 dnl Determine the platform dependent parameters needed to use rpath:
2241 dnl acl_libext,
2242 dnl acl_shlibext,
2243 dnl acl_libname_spec,
2244 dnl acl_library_names_spec,
2245 dnl acl_hardcode_libdir_flag_spec,
2246 dnl acl_hardcode_libdir_separator,
2247 dnl acl_hardcode_direct,
2248 dnl acl_hardcode_minus_L.
2249 AC_DEFUN([AC_LIB_RPATH],
2250 [
2251 dnl Complain if config.rpath is missing.
2252 AC_REQUIRE_AUX_FILE([config.rpath])
2253 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
2254 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
2255 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
2256 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
2257 AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
2258 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
2259 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
2260 . ./conftest.sh
2261 rm -f ./conftest.sh
2262 acl_cv_rpath=done
2263 ])
2264 wl="$acl_cv_wl"
2265 acl_libext="$acl_cv_libext"
2266 acl_shlibext="$acl_cv_shlibext"
2267 acl_libname_spec="$acl_cv_libname_spec"
2268 acl_library_names_spec="$acl_cv_library_names_spec"
2269 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
2270 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
2271 acl_hardcode_direct="$acl_cv_hardcode_direct"
2272 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
2273 dnl Determine whether the user wants rpath handling at all.
2274 AC_ARG_ENABLE([rpath],
2275 [ --disable-rpath do not hardcode runtime library paths],
2276 :, enable_rpath=yes)
2277 ])
2278
2279 dnl AC_LIB_FROMPACKAGE(name, package)
2280 dnl declares that libname comes from the given package. The configure file
2281 dnl will then not have a --with-libname-prefix option but a
2282 dnl --with-package-prefix option. Several libraries can come from the same
2283 dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
2284 dnl macro call that searches for libname.
2285 AC_DEFUN([AC_LIB_FROMPACKAGE],
2286 [
2287 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
2288 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2289 define([acl_frompackage_]NAME, [$2])
2290 popdef([NAME])
2291 pushdef([PACK],[$2])
2292 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
2293 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2294 define([acl_libsinpackage_]PACKUP,
2295 m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
2296 popdef([PACKUP])
2297 popdef([PACK])
2298 ])
2299
2300 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
2301 dnl the libraries corresponding to explicit and implicit dependencies.
2302 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
2303 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
2304 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
2305 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
2306 [
2307 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2308 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
2309 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2310 pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
2311 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
2312 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2313 pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
2314 dnl By default, look in $includedir and $libdir.
2315 use_additional=yes
2316 AC_LIB_WITH_FINAL_PREFIX([
2317 eval additional_includedir=\"$includedir\"
2318 eval additional_libdir=\"$libdir\"
2319 eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
2320 eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
2321 ])
2322 AC_ARG_WITH(PACK[-prefix],
2323 [[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
2324 --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
2325 [
2326 if test "X$withval" = "Xno"; then
2327 use_additional=no
2328 else
2329 if test "X$withval" = "X"; then
2330 AC_LIB_WITH_FINAL_PREFIX([
2331 eval additional_includedir=\"$includedir\"
2332 eval additional_libdir=\"$libdir\"
2333 eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
2334 eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
2335 ])
2336 else
2337 additional_includedir="$withval/include"
2338 additional_libdir="$withval/$acl_libdirstem"
2339 additional_libdir2="$withval/$acl_libdirstem2"
2340 additional_libdir3="$withval/$acl_libdirstem3"
2341 fi
2342 fi
2343 ])
2344 if test "X$additional_libdir2" = "X$additional_libdir"; then
2345 additional_libdir2=
2346 fi
2347 if test "X$additional_libdir3" = "X$additional_libdir"; then
2348 additional_libdir3=
2349 fi
2350 dnl Search the library and its dependencies in $additional_libdir and
2351 dnl $LDFLAGS. Using breadth-first-seach.
2352 LIB[]NAME=
2353 LTLIB[]NAME=
2354 INC[]NAME=
2355 LIB[]NAME[]_PREFIX=
2356 dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
2357 dnl computed. So it has to be reset here.
2358 HAVE_LIB[]NAME=
2359 rpathdirs=
2360 ltrpathdirs=
2361 names_already_handled=
2362 names_next_round='$1 $2'
2363 while test -n "$names_next_round"; do
2364 names_this_round="$names_next_round"
2365 names_next_round=
2366 for name in $names_this_round; do
2367 already_handled=
2368 for n in $names_already_handled; do
2369 if test "$n" = "$name"; then
2370 already_handled=yes
2371 break
2372 fi
2373 done
2374 if test -z "$already_handled"; then
2375 names_already_handled="$names_already_handled $name"
2376 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
2377 dnl or AC_LIB_HAVE_LINKFLAGS call.
2378 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
2379 eval value=\"\$HAVE_LIB$uppername\"
2380 if test -n "$value"; then
2381 if test "$value" = yes; then
2382 eval value=\"\$LIB$uppername\"
2383 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
2384 eval value=\"\$LTLIB$uppername\"
2385 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
2386 else
2387 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
2388 dnl that this library doesn't exist. So just drop it.
2389 :
2390 fi
2391 else
2392 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
2393 dnl and the already constructed $LIBNAME/$LTLIBNAME.
2394 found_dir=
2395 found_la=
2396 found_so=
2397 found_a=
2398 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
2399 if test -n "$acl_shlibext"; then
2400 shrext=".$acl_shlibext" # typically: shrext=.so
2401 else
2402 shrext=
2403 fi
2404 if test $use_additional = yes; then
2405 for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do
2406 if test "X$found_dir" = "X"; then
2407 eval dir=\$$additional_libdir_variable
2408 if test -n "$dir"; then
2409 dnl The same code as in the loop below:
2410 dnl First look for a shared library.
2411 if test -n "$acl_shlibext"; then
2412 if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
2413 found_dir="$dir"
2414 found_so="$dir/$libname$shrext"
2415 else
2416 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
2417 ver=`(cd "$dir" && \
2418 for f in "$libname$shrext".*; do echo "$f"; done \
2419 | sed -e "s,^$libname$shrext\\\\.,," \
2420 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
2421 | sed 1q ) 2>/dev/null`
2422 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
2423 found_dir="$dir"
2424 found_so="$dir/$libname$shrext.$ver"
2425 fi
2426 else
2427 eval library_names=\"$acl_library_names_spec\"
2428 for f in $library_names; do
2429 if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
2430 found_dir="$dir"
2431 found_so="$dir/$f"
2432 break
2433 fi
2434 done
2435 fi
2436 fi
2437 fi
2438 dnl Then look for a static library.
2439 if test "X$found_dir" = "X"; then
2440 if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
2441 found_dir="$dir"
2442 found_a="$dir/$libname.$acl_libext"
2443 fi
2444 fi
2445 if test "X$found_dir" != "X"; then
2446 if test -f "$dir/$libname.la"; then
2447 found_la="$dir/$libname.la"
2448 fi
2449 fi
2450 fi
2451 fi
2452 done
2453 fi
2454 if test "X$found_dir" = "X"; then
2455 for x in $LDFLAGS $LTLIB[]NAME; do
2456 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2457 case "$x" in
2458 -L*)
2459 dir=`echo "X$x" | sed -e 's/^X-L//'`
2460 dnl First look for a shared library.
2461 if test -n "$acl_shlibext"; then
2462 if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
2463 found_dir="$dir"
2464 found_so="$dir/$libname$shrext"
2465 else
2466 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
2467 ver=`(cd "$dir" && \
2468 for f in "$libname$shrext".*; do echo "$f"; done \
2469 | sed -e "s,^$libname$shrext\\\\.,," \
2470 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
2471 | sed 1q ) 2>/dev/null`
2472 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
2473 found_dir="$dir"
2474 found_so="$dir/$libname$shrext.$ver"
2475 fi
2476 else
2477 eval library_names=\"$acl_library_names_spec\"
2478 for f in $library_names; do
2479 if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
2480 found_dir="$dir"
2481 found_so="$dir/$f"
2482 break
2483 fi
2484 done
2485 fi
2486 fi
2487 fi
2488 dnl Then look for a static library.
2489 if test "X$found_dir" = "X"; then
2490 if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
2491 found_dir="$dir"
2492 found_a="$dir/$libname.$acl_libext"
2493 fi
2494 fi
2495 if test "X$found_dir" != "X"; then
2496 if test -f "$dir/$libname.la"; then
2497 found_la="$dir/$libname.la"
2498 fi
2499 fi
2500 ;;
2501 esac
2502 if test "X$found_dir" != "X"; then
2503 break
2504 fi
2505 done
2506 fi
2507 if test "X$found_dir" != "X"; then
2508 dnl Found the library.
2509 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
2510 if test "X$found_so" != "X"; then
2511 dnl Linking with a shared library. We attempt to hardcode its
2512 dnl directory into the executable's runpath, unless it's the
2513 dnl standard /usr/lib.
2514 if test "$enable_rpath" = no \
2515 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
2516 || test "X$found_dir" = "X/usr/$acl_libdirstem2" \
2517 || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then
2518 dnl No hardcoding is needed.
2519 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2520 else
2521 dnl Use an explicit option to hardcode DIR into the resulting
2522 dnl binary.
2523 dnl Potentially add DIR to ltrpathdirs.
2524 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2525 haveit=
2526 for x in $ltrpathdirs; do
2527 if test "X$x" = "X$found_dir"; then
2528 haveit=yes
2529 break
2530 fi
2531 done
2532 if test -z "$haveit"; then
2533 ltrpathdirs="$ltrpathdirs $found_dir"
2534 fi
2535 dnl The hardcoding into $LIBNAME is system dependent.
2536 if test "$acl_hardcode_direct" = yes; then
2537 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
2538 dnl resulting binary.
2539 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2540 else
2541 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
2542 dnl Use an explicit option to hardcode DIR into the resulting
2543 dnl binary.
2544 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2545 dnl Potentially add DIR to rpathdirs.
2546 dnl The rpathdirs will be appended to $LIBNAME at the end.
2547 haveit=
2548 for x in $rpathdirs; do
2549 if test "X$x" = "X$found_dir"; then
2550 haveit=yes
2551 break
2552 fi
2553 done
2554 if test -z "$haveit"; then
2555 rpathdirs="$rpathdirs $found_dir"
2556 fi
2557 else
2558 dnl Rely on "-L$found_dir".
2559 dnl But don't add it if it's already contained in the LDFLAGS
2560 dnl or the already constructed $LIBNAME
2561 haveit=
2562 for x in $LDFLAGS $LIB[]NAME; do
2563 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2564 if test "X$x" = "X-L$found_dir"; then
2565 haveit=yes
2566 break
2567 fi
2568 done
2569 if test -z "$haveit"; then
2570 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
2571 fi
2572 if test "$acl_hardcode_minus_L" != no; then
2573 dnl FIXME: Not sure whether we should use
2574 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2575 dnl here.
2576 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2577 else
2578 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
2579 dnl here, because this doesn't fit in flags passed to the
2580 dnl compiler. So give up. No hardcoding. This affects only
2581 dnl very old systems.
2582 dnl FIXME: Not sure whether we should use
2583 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2584 dnl here.
2585 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2586 fi
2587 fi
2588 fi
2589 fi
2590 else
2591 if test "X$found_a" != "X"; then
2592 dnl Linking with a static library.
2593 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
2594 else
2595 dnl We shouldn't come here, but anyway it's good to have a
2596 dnl fallback.
2597 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
2598 fi
2599 fi
2600 dnl Assume the include files are nearby.
2601 additional_includedir=
2602 case "$found_dir" in
2603 */$acl_libdirstem | */$acl_libdirstem/)
2604 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
2605 if test "$name" = '$1'; then
2606 LIB[]NAME[]_PREFIX="$basedir"
2607 fi
2608 additional_includedir="$basedir/include"
2609 ;;
2610 */$acl_libdirstem2 | */$acl_libdirstem2/)
2611 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
2612 if test "$name" = '$1'; then
2613 LIB[]NAME[]_PREFIX="$basedir"
2614 fi
2615 additional_includedir="$basedir/include"
2616 ;;
2617 */$acl_libdirstem3 | */$acl_libdirstem3/)
2618 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'`
2619 if test "$name" = '$1'; then
2620 LIB[]NAME[]_PREFIX="$basedir"
2621 fi
2622 additional_includedir="$basedir/include"
2623 ;;
2624 esac
2625 if test "X$additional_includedir" != "X"; then
2626 dnl Potentially add $additional_includedir to $INCNAME.
2627 dnl But don't add it
2628 dnl 1. if it's the standard /usr/include,
2629 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
2630 dnl 3. if it's already present in $CPPFLAGS or the already
2631 dnl constructed $INCNAME,
2632 dnl 4. if it doesn't exist as a directory.
2633 if test "X$additional_includedir" != "X/usr/include"; then
2634 haveit=
2635 if test "X$additional_includedir" = "X/usr/local/include"; then
2636 if test -n "$GCC"; then
2637 case $host_os in
2638 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2639 esac
2640 fi
2641 fi
2642 if test -z "$haveit"; then
2643 for x in $CPPFLAGS $INC[]NAME; do
2644 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2645 if test "X$x" = "X-I$additional_includedir"; then
2646 haveit=yes
2647 break
2648 fi
2649 done
2650 if test -z "$haveit"; then
2651 if test -d "$additional_includedir"; then
2652 dnl Really add $additional_includedir to $INCNAME.
2653 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
2654 fi
2655 fi
2656 fi
2657 fi
2658 fi
2659 dnl Look for dependencies.
2660 if test -n "$found_la"; then
2661 dnl Read the .la file. It defines the variables
2662 dnl dlname, library_names, old_library, dependency_libs, current,
2663 dnl age, revision, installed, dlopen, dlpreopen, libdir.
2664 save_libdir="$libdir"
2665 case "$found_la" in
2666 */* | *\\*) . "$found_la" ;;
2667 *) . "./$found_la" ;;
2668 esac
2669 libdir="$save_libdir"
2670 dnl We use only dependency_libs.
2671 for dep in $dependency_libs; do
2672 case "$dep" in
2673 -L*)
2674 dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
2675 dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME.
2676 dnl But don't add it
2677 dnl 1. if it's the standard /usr/lib,
2678 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
2679 dnl 3. if it's already present in $LDFLAGS or the already
2680 dnl constructed $LIBNAME,
2681 dnl 4. if it doesn't exist as a directory.
2682 if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \
2683 && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \
2684 && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then
2685 haveit=
2686 if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \
2687 || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \
2688 || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then
2689 if test -n "$GCC"; then
2690 case $host_os in
2691 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2692 esac
2693 fi
2694 fi
2695 if test -z "$haveit"; then
2696 haveit=
2697 for x in $LDFLAGS $LIB[]NAME; do
2698 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2699 if test "X$x" = "X-L$dependency_libdir"; then
2700 haveit=yes
2701 break
2702 fi
2703 done
2704 if test -z "$haveit"; then
2705 if test -d "$dependency_libdir"; then
2706 dnl Really add $dependency_libdir to $LIBNAME.
2707 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir"
2708 fi
2709 fi
2710 haveit=
2711 for x in $LDFLAGS $LTLIB[]NAME; do
2712 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2713 if test "X$x" = "X-L$dependency_libdir"; then
2714 haveit=yes
2715 break
2716 fi
2717 done
2718 if test -z "$haveit"; then
2719 if test -d "$dependency_libdir"; then
2720 dnl Really add $dependency_libdir to $LTLIBNAME.
2721 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir"
2722 fi
2723 fi
2724 fi
2725 fi
2726 ;;
2727 -R*)
2728 dir=`echo "X$dep" | sed -e 's/^X-R//'`
2729 if test "$enable_rpath" != no; then
2730 dnl Potentially add DIR to rpathdirs.
2731 dnl The rpathdirs will be appended to $LIBNAME at the end.
2732 haveit=
2733 for x in $rpathdirs; do
2734 if test "X$x" = "X$dir"; then
2735 haveit=yes
2736 break
2737 fi
2738 done
2739 if test -z "$haveit"; then
2740 rpathdirs="$rpathdirs $dir"
2741 fi
2742 dnl Potentially add DIR to ltrpathdirs.
2743 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2744 haveit=
2745 for x in $ltrpathdirs; do
2746 if test "X$x" = "X$dir"; then
2747 haveit=yes
2748 break
2749 fi
2750 done
2751 if test -z "$haveit"; then
2752 ltrpathdirs="$ltrpathdirs $dir"
2753 fi
2754 fi
2755 ;;
2756 -l*)
2757 dnl Handle this in the next round.
2758 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
2759 ;;
2760 *.la)
2761 dnl Handle this in the next round. Throw away the .la's
2762 dnl directory; it is already contained in a preceding -L
2763 dnl option.
2764 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
2765 ;;
2766 *)
2767 dnl Most likely an immediate library name.
2768 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
2769 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
2770 ;;
2771 esac
2772 done
2773 fi
2774 else
2775 dnl Didn't find the library; assume it is in the system directories
2776 dnl known to the linker and runtime loader. (All the system
2777 dnl directories known to the linker should also be known to the
2778 dnl runtime loader, otherwise the system is severely misconfigured.)
2779 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2780 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
2781 fi
2782 fi
2783 fi
2784 done
2785 done
2786 if test "X$rpathdirs" != "X"; then
2787 if test -n "$acl_hardcode_libdir_separator"; then
2788 dnl Weird platform: only the last -rpath option counts, the user must
2789 dnl pass all path elements in one option. We can arrange that for a
2790 dnl single library, but not when more than one $LIBNAMEs are used.
2791 alldirs=
2792 for found_dir in $rpathdirs; do
2793 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
2794 done
2795 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
2796 acl_save_libdir="$libdir"
2797 libdir="$alldirs"
2798 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2799 libdir="$acl_save_libdir"
2800 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2801 else
2802 dnl The -rpath options are cumulative.
2803 for found_dir in $rpathdirs; do
2804 acl_save_libdir="$libdir"
2805 libdir="$found_dir"
2806 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2807 libdir="$acl_save_libdir"
2808 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2809 done
2810 fi
2811 fi
2812 if test "X$ltrpathdirs" != "X"; then
2813 dnl When using libtool, the option that works for both libraries and
2814 dnl executables is -R. The -R options are cumulative.
2815 for found_dir in $ltrpathdirs; do
2816 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
2817 done
2818 fi
2819 popdef([PACKLIBS])
2820 popdef([PACKUP])
2821 popdef([PACK])
2822 popdef([NAME])
2823 ])
2824
2825 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
2826 dnl unless already present in VAR.
2827 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
2828 dnl contains two or three consecutive elements that belong together.
2829 AC_DEFUN([AC_LIB_APPENDTOVAR],
2830 [
2831 for element in [$2]; do
2832 haveit=
2833 for x in $[$1]; do
2834 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2835 if test "X$x" = "X$element"; then
2836 haveit=yes
2837 break
2838 fi
2839 done
2840 if test -z "$haveit"; then
2841 [$1]="${[$1]}${[$1]:+ }$element"
2842 fi
2843 done
2844 ])
2845
2846 dnl For those cases where a variable contains several -L and -l options
2847 dnl referring to unknown libraries and directories, this macro determines the
2848 dnl necessary additional linker options for the runtime path.
2849 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
2850 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
2851 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
2852 dnl otherwise linking without libtool is assumed.
2853 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
2854 [
2855 AC_REQUIRE([AC_LIB_RPATH])
2856 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2857 $1=
2858 if test "$enable_rpath" != no; then
2859 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
2860 dnl Use an explicit option to hardcode directories into the resulting
2861 dnl binary.
2862 rpathdirs=
2863 next=
2864 for opt in $2; do
2865 if test -n "$next"; then
2866 dir="$next"
2867 dnl No need to hardcode the standard /usr/lib.
2868 if test "X$dir" != "X/usr/$acl_libdirstem" \
2869 && test "X$dir" != "X/usr/$acl_libdirstem2" \
2870 && test "X$dir" != "X/usr/$acl_libdirstem3"; then
2871 rpathdirs="$rpathdirs $dir"
2872 fi
2873 next=
2874 else
2875 case $opt in
2876 -L) next=yes ;;
2877 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
2878 dnl No need to hardcode the standard /usr/lib.
2879 if test "X$dir" != "X/usr/$acl_libdirstem" \
2880 && test "X$dir" != "X/usr/$acl_libdirstem2" \
2881 && test "X$dir" != "X/usr/$acl_libdirstem3"; then
2882 rpathdirs="$rpathdirs $dir"
2883 fi
2884 next= ;;
2885 *) next= ;;
2886 esac
2887 fi
2888 done
2889 if test "X$rpathdirs" != "X"; then
2890 if test -n ""$3""; then
2891 dnl libtool is used for linking. Use -R options.
2892 for dir in $rpathdirs; do
2893 $1="${$1}${$1:+ }-R$dir"
2894 done
2895 else
2896 dnl The linker is used for linking directly.
2897 if test -n "$acl_hardcode_libdir_separator"; then
2898 dnl Weird platform: only the last -rpath option counts, the user
2899 dnl must pass all path elements in one option.
2900 alldirs=
2901 for dir in $rpathdirs; do
2902 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
2903 done
2904 acl_save_libdir="$libdir"
2905 libdir="$alldirs"
2906 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2907 libdir="$acl_save_libdir"
2908 $1="$flag"
2909 else
2910 dnl The -rpath options are cumulative.
2911 for dir in $rpathdirs; do
2912 acl_save_libdir="$libdir"
2913 libdir="$dir"
2914 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2915 libdir="$acl_save_libdir"
2916 $1="${$1}${$1:+ }$flag"
2917 done
2918 fi
2919 fi
2920 fi
2921 fi
2922 fi
2923 AC_SUBST([$1])
2924 ])
2925
2926 # lib-prefix.m4 serial 17
2927 dnl Copyright (C) 2001-2005, 2008-2020 Free Software Foundation, Inc.
2928 dnl This file is free software; the Free Software Foundation
2929 dnl gives unlimited permission to copy and/or distribute it,
2930 dnl with or without modifications, as long as this notice is preserved.
2931
2932 dnl From Bruno Haible.
2933
2934 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
2935 dnl to access previously installed libraries. The basic assumption is that
2936 dnl a user will want packages to use other packages he previously installed
2937 dnl with the same --prefix option.
2938 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
2939 dnl libraries, but is otherwise very convenient.
2940 AC_DEFUN([AC_LIB_PREFIX],
2941 [
2942 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
2943 AC_REQUIRE([AC_PROG_CC])
2944 AC_REQUIRE([AC_CANONICAL_HOST])
2945 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2946 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2947 dnl By default, look in $includedir and $libdir.
2948 use_additional=yes
2949 AC_LIB_WITH_FINAL_PREFIX([
2950 eval additional_includedir=\"$includedir\"
2951 eval additional_libdir=\"$libdir\"
2952 ])
2953 AC_ARG_WITH([lib-prefix],
2954 [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
2955 --without-lib-prefix don't search for libraries in includedir and libdir]],
2956 [
2957 if test "X$withval" = "Xno"; then
2958 use_additional=no
2959 else
2960 if test "X$withval" = "X"; then
2961 AC_LIB_WITH_FINAL_PREFIX([
2962 eval additional_includedir=\"$includedir\"
2963 eval additional_libdir=\"$libdir\"
2964 ])
2965 else
2966 additional_includedir="$withval/include"
2967 additional_libdir="$withval/$acl_libdirstem"
2968 fi
2969 fi
2970 ])
2971 if test $use_additional = yes; then
2972 dnl Potentially add $additional_includedir to $CPPFLAGS.
2973 dnl But don't add it
2974 dnl 1. if it's the standard /usr/include,
2975 dnl 2. if it's already present in $CPPFLAGS,
2976 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
2977 dnl 4. if it doesn't exist as a directory.
2978 if test "X$additional_includedir" != "X/usr/include"; then
2979 haveit=
2980 for x in $CPPFLAGS; do
2981 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2982 if test "X$x" = "X-I$additional_includedir"; then
2983 haveit=yes
2984 break
2985 fi
2986 done
2987 if test -z "$haveit"; then
2988 if test "X$additional_includedir" = "X/usr/local/include"; then
2989 if test -n "$GCC"; then
2990 case $host_os in
2991 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2992 esac
2993 fi
2994 fi
2995 if test -z "$haveit"; then
2996 if test -d "$additional_includedir"; then
2997 dnl Really add $additional_includedir to $CPPFLAGS.
2998 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
2999 fi
3000 fi
3001 fi
3002 fi
3003 dnl Potentially add $additional_libdir to $LDFLAGS.
3004 dnl But don't add it
3005 dnl 1. if it's the standard /usr/lib,
3006 dnl 2. if it's already present in $LDFLAGS,
3007 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
3008 dnl 4. if it doesn't exist as a directory.
3009 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
3010 haveit=
3011 for x in $LDFLAGS; do
3012 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3013 if test "X$x" = "X-L$additional_libdir"; then
3014 haveit=yes
3015 break
3016 fi
3017 done
3018 if test -z "$haveit"; then
3019 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
3020 if test -n "$GCC"; then
3021 case $host_os in
3022 linux*) haveit=yes;;
3023 esac
3024 fi
3025 fi
3026 if test -z "$haveit"; then
3027 if test -d "$additional_libdir"; then
3028 dnl Really add $additional_libdir to $LDFLAGS.
3029 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
3030 fi
3031 fi
3032 fi
3033 fi
3034 fi
3035 ])
3036
3037 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
3038 dnl acl_final_exec_prefix, containing the values to which $prefix and
3039 dnl $exec_prefix will expand at the end of the configure script.
3040 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
3041 [
3042 dnl Unfortunately, prefix and exec_prefix get only finally determined
3043 dnl at the end of configure.
3044 if test "X$prefix" = "XNONE"; then
3045 acl_final_prefix="$ac_default_prefix"
3046 else
3047 acl_final_prefix="$prefix"
3048 fi
3049 if test "X$exec_prefix" = "XNONE"; then
3050 acl_final_exec_prefix='${prefix}'
3051 else
3052 acl_final_exec_prefix="$exec_prefix"
3053 fi
3054 acl_save_prefix="$prefix"
3055 prefix="$acl_final_prefix"
3056 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
3057 prefix="$acl_save_prefix"
3058 ])
3059
3060 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
3061 dnl variables prefix and exec_prefix bound to the values they will have
3062 dnl at the end of the configure script.
3063 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
3064 [
3065 acl_save_prefix="$prefix"
3066 prefix="$acl_final_prefix"
3067 acl_save_exec_prefix="$exec_prefix"
3068 exec_prefix="$acl_final_exec_prefix"
3069 $1
3070 exec_prefix="$acl_save_exec_prefix"
3071 prefix="$acl_save_prefix"
3072 ])
3073
3074 dnl AC_LIB_PREPARE_MULTILIB creates
3075 dnl - a function acl_is_expected_elfclass, that tests whether standard input
3076 dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
3077 dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
3078 dnl the basename of the libdir to try in turn, either "lib" or "lib64" or
3079 dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
3080 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
3081 [
3082 dnl There is no formal standard regarding lib, lib32, and lib64.
3083 dnl On most glibc systems, the current practice is that on a system supporting
3084 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
3085 dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
3086 dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
3087 dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
3088 dnl We determine the compiler's default mode by looking at the compiler's
3089 dnl library search path. If at least one of its elements ends in /lib64 or
3090 dnl points to a directory whose absolute pathname ends in /lib64, we use that
3091 dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
3092 dnl namely "lib".
3093 dnl On Solaris systems, the current practice is that on a system supporting
3094 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
3095 dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
3096 dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
3097 AC_REQUIRE([AC_CANONICAL_HOST])
3098 AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
3099
3100 AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
3101 [AC_EGREP_CPP([Extensible Linking Format],
3102 [#ifdef __ELF__
3103 Extensible Linking Format
3104 #endif
3105 ],
3106 [gl_cv_elf=yes],
3107 [gl_cv_elf=no])
3108 ])
3109 if test $gl_cv_elf; then
3110 # Extract the ELF class of a file (5th byte) in decimal.
3111 # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
3112 if od -A x < /dev/null >/dev/null 2>/dev/null; then
3113 # Use POSIX od.
3114 func_elfclass ()
3115 {
3116 od -A n -t d1 -j 4 -N 1
3117 }
3118 else
3119 # Use BSD hexdump.
3120 func_elfclass ()
3121 {
3122 dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
3123 echo
3124 }
3125 fi
3126 changequote(,)dnl
3127 case $HOST_CPU_C_ABI_32BIT in
3128 yes)
3129 # 32-bit ABI.
3130 acl_is_expected_elfclass ()
3131 {
3132 test "`func_elfclass | sed -e 's/[ ]//g'`" = 1
3133 }
3134 ;;
3135 no)
3136 # 64-bit ABI.
3137 acl_is_expected_elfclass ()
3138 {
3139 test "`func_elfclass | sed -e 's/[ ]//g'`" = 2
3140 }
3141 ;;
3142 *)
3143 # Unknown.
3144 acl_is_expected_elfclass ()
3145 {
3146 :
3147 }
3148 ;;
3149 esac
3150 changequote([,])dnl
3151 else
3152 acl_is_expected_elfclass ()
3153 {
3154 :
3155 }
3156 fi
3157
3158 dnl Allow the user to override the result by setting acl_cv_libdirstems.
3159 AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
3160 [acl_cv_libdirstems],
3161 [dnl Try 'lib' first, because that's the default for libdir in GNU, see
3162 dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
3163 acl_libdirstem=lib
3164 acl_libdirstem2=
3165 acl_libdirstem3=
3166 case "$host_os" in
3167 solaris*)
3168 dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
3169 dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
3170 dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
3171 dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
3172 dnl symlink is missing, so we set acl_libdirstem2 too.
3173 if test $HOST_CPU_C_ABI_32BIT = no; then
3174 acl_libdirstem2=lib/64
3175 case "$host_cpu" in
3176 sparc*) acl_libdirstem3=lib/sparcv9 ;;
3177 i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
3178 esac
3179 fi
3180 ;;
3181 *)
3182 dnl If $CC generates code for a 32-bit ABI, the libraries are
3183 dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
3184 dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
3185 dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
3186 dnl Find the compiler's search path. However, non-system compilers
3187 dnl sometimes have odd library search paths. But we can't simply invoke
3188 dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
3189 dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
3190 searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
3191 | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
3192 if test $HOST_CPU_C_ABI_32BIT != no; then
3193 # 32-bit or unknown ABI.
3194 if test -d /usr/lib32; then
3195 acl_libdirstem2=lib32
3196 fi
3197 fi
3198 if test $HOST_CPU_C_ABI_32BIT != yes; then
3199 # 64-bit or unknown ABI.
3200 if test -d /usr/lib64; then
3201 acl_libdirstem3=lib64
3202 fi
3203 fi
3204 if test -n "$searchpath"; then
3205 acl_save_IFS="${IFS= }"; IFS=":"
3206 for searchdir in $searchpath; do
3207 if test -d "$searchdir"; then
3208 case "$searchdir" in
3209 */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
3210 */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
3211 */../ | */.. )
3212 # Better ignore directories of this form. They are misleading.
3213 ;;
3214 *) searchdir=`cd "$searchdir" && pwd`
3215 case "$searchdir" in
3216 */lib32 ) acl_libdirstem2=lib32 ;;
3217 */lib64 ) acl_libdirstem3=lib64 ;;
3218 esac ;;
3219 esac
3220 fi
3221 done
3222 IFS="$acl_save_IFS"
3223 if test $HOST_CPU_C_ABI_32BIT = yes; then
3224 # 32-bit ABI.
3225 acl_libdirstem3=
3226 fi
3227 if test $HOST_CPU_C_ABI_32BIT = no; then
3228 # 64-bit ABI.
3229 acl_libdirstem2=
3230 fi
3231 fi
3232 ;;
3233 esac
3234 test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
3235 test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
3236 acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
3237 ])
3238 dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
3239 dnl acl_libdirstem3.
3240 changequote(,)dnl
3241 acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
3242 acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
3243 acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
3244 changequote([,])dnl
3245 ])
3246
3247 # nls.m4 serial 6 (gettext-0.20.2)
3248 dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2020 Free
3249 dnl Software Foundation, Inc.
3250 dnl This file is free software; the Free Software Foundation
3251 dnl gives unlimited permission to copy and/or distribute it,
3252 dnl with or without modifications, as long as this notice is preserved.
3253 dnl
3254 dnl This file can be used in projects which are not available under
3255 dnl the GNU General Public License or the GNU Lesser General Public
3256 dnl License but which still want to provide support for the GNU gettext
3257 dnl functionality.
3258 dnl Please note that the actual code of the GNU gettext library is covered
3259 dnl by the GNU Lesser General Public License, and the rest of the GNU
3260 dnl gettext package is covered by the GNU General Public License.
3261 dnl They are *not* in the public domain.
3262
3263 dnl Authors:
3264 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3265 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3266
3267 AC_PREREQ([2.50])
3268
3269 AC_DEFUN([AM_NLS],
3270 [
3271 AC_MSG_CHECKING([whether NLS is requested])
3272 dnl Default is enabled NLS
3273 AC_ARG_ENABLE([nls],
3274 [ --disable-nls do not use Native Language Support],
3275 USE_NLS=$enableval, USE_NLS=yes)
3276 AC_MSG_RESULT([$USE_NLS])
3277 AC_SUBST([USE_NLS])
3278 ])
3279
3280 # pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
3281 # serial 12 (pkg-config-0.29.2)
3282
3283 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
3284 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
3285 dnl
3286 dnl This program is free software; you can redistribute it and/or modify
3287 dnl it under the terms of the GNU General Public License as published by
3288 dnl the Free Software Foundation; either version 2 of the License, or
3289 dnl (at your option) any later version.
3290 dnl
3291 dnl This program is distributed in the hope that it will be useful, but
3292 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
3293 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3294 dnl General Public License for more details.
3295 dnl
3296 dnl You should have received a copy of the GNU General Public License
3297 dnl along with this program; if not, write to the Free Software
3298 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3299 dnl 02111-1307, USA.
3300 dnl
3301 dnl As a special exception to the GNU General Public License, if you
3302 dnl distribute this file as part of a program that contains a
3303 dnl configuration script generated by Autoconf, you may include it under
3304 dnl the same distribution terms that you use for the rest of that
3305 dnl program.
3306
3307 dnl PKG_PREREQ(MIN-VERSION)
3308 dnl -----------------------
3309 dnl Since: 0.29
3310 dnl
3311 dnl Verify that the version of the pkg-config macros are at least
3312 dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
3313 dnl installed version of pkg-config, this checks the developer's version
3314 dnl of pkg.m4 when generating configure.
3315 dnl
3316 dnl To ensure that this macro is defined, also add:
3317 dnl m4_ifndef([PKG_PREREQ],
3318 dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
3319 dnl
3320 dnl See the "Since" comment for each macro you use to see what version
3321 dnl of the macros you require.
3322 m4_defun([PKG_PREREQ],
3323 [m4_define([PKG_MACROS_VERSION], [0.29.2])
3324 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
3325 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
3326 ])dnl PKG_PREREQ
3327
3328 dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
3329 dnl ----------------------------------
3330 dnl Since: 0.16
3331 dnl
3332 dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
3333 dnl first found in the path. Checks that the version of pkg-config found
3334 dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
3335 dnl used since that's the first version where most current features of
3336 dnl pkg-config existed.
3337 AC_DEFUN([PKG_PROG_PKG_CONFIG],
3338 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
3339 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
3340 m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
3341 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
3342 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
3343 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
3344
3345 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
3346 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
3347 fi
3348 if test -n "$PKG_CONFIG"; then
3349 _pkg_min_version=m4_default([$1], [0.9.0])
3350 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
3351 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
3352 AC_MSG_RESULT([yes])
3353 else
3354 AC_MSG_RESULT([no])
3355 PKG_CONFIG=""
3356 fi
3357 fi[]dnl
3358 ])dnl PKG_PROG_PKG_CONFIG
3359
3360 dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3361 dnl -------------------------------------------------------------------
3362 dnl Since: 0.18
3363 dnl
3364 dnl Check to see whether a particular set of modules exists. Similar to
3365 dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
3366 dnl
3367 dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3368 dnl only at the first occurrence in configure.ac, so if the first place
3369 dnl it's called might be skipped (such as if it is within an "if", you
3370 dnl have to call PKG_CHECK_EXISTS manually
3371 AC_DEFUN([PKG_CHECK_EXISTS],
3372 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
3373 if test -n "$PKG_CONFIG" && \
3374 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
3375 m4_default([$2], [:])
3376 m4_ifvaln([$3], [else
3377 $3])dnl
3378 fi])
3379
3380 dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
3381 dnl ---------------------------------------------
3382 dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
3383 dnl pkg_failed based on the result.
3384 m4_define([_PKG_CONFIG],
3385 [if test -n "$$1"; then
3386 pkg_cv_[]$1="$$1"
3387 elif test -n "$PKG_CONFIG"; then
3388 PKG_CHECK_EXISTS([$3],
3389 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
3390 test "x$?" != "x0" && pkg_failed=yes ],
3391 [pkg_failed=yes])
3392 else
3393 pkg_failed=untried
3394 fi[]dnl
3395 ])dnl _PKG_CONFIG
3396
3397 dnl _PKG_SHORT_ERRORS_SUPPORTED
3398 dnl ---------------------------
3399 dnl Internal check to see if pkg-config supports short errors.
3400 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
3401 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3402 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
3403 _pkg_short_errors_supported=yes
3404 else
3405 _pkg_short_errors_supported=no
3406 fi[]dnl
3407 ])dnl _PKG_SHORT_ERRORS_SUPPORTED
3408
3409
3410 dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
3411 dnl [ACTION-IF-NOT-FOUND])
3412 dnl --------------------------------------------------------------
3413 dnl Since: 0.4.0
3414 dnl
3415 dnl Note that if there is a possibility the first call to
3416 dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
3417 dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
3418 AC_DEFUN([PKG_CHECK_MODULES],
3419 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
3420 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
3421 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
3422
3423 pkg_failed=no
3424 AC_MSG_CHECKING([for $2])
3425
3426 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
3427 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
3428
3429 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
3430 and $1[]_LIBS to avoid the need to call pkg-config.
3431 See the pkg-config man page for more details.])
3432
3433 if test $pkg_failed = yes; then
3434 AC_MSG_RESULT([no])
3435 _PKG_SHORT_ERRORS_SUPPORTED
3436 if test $_pkg_short_errors_supported = yes; then
3437 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
3438 else
3439 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
3440 fi
3441 # Put the nasty error message in config.log where it belongs
3442 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
3443
3444 m4_default([$4], [AC_MSG_ERROR(
3445 [Package requirements ($2) were not met:
3446
3447 $$1_PKG_ERRORS
3448
3449 Consider adjusting the PKG_CONFIG_PATH environment variable if you
3450 installed software in a non-standard prefix.
3451
3452 _PKG_TEXT])[]dnl
3453 ])
3454 elif test $pkg_failed = untried; then
3455 AC_MSG_RESULT([no])
3456 m4_default([$4], [AC_MSG_FAILURE(
3457 [The pkg-config script could not be found or is too old. Make sure it
3458 is in your PATH or set the PKG_CONFIG environment variable to the full
3459 path to pkg-config.
3460
3461 _PKG_TEXT
3462
3463 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
3464 ])
3465 else
3466 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
3467 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
3468 AC_MSG_RESULT([yes])
3469 $3
3470 fi[]dnl
3471 ])dnl PKG_CHECK_MODULES
3472
3473
3474 dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
3475 dnl [ACTION-IF-NOT-FOUND])
3476 dnl ---------------------------------------------------------------------
3477 dnl Since: 0.29
3478 dnl
3479 dnl Checks for existence of MODULES and gathers its build flags with
3480 dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
3481 dnl and VARIABLE-PREFIX_LIBS from --libs.
3482 dnl
3483 dnl Note that if there is a possibility the first call to
3484 dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
3485 dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
3486 dnl configure.ac.
3487 AC_DEFUN([PKG_CHECK_MODULES_STATIC],
3488 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
3489 _save_PKG_CONFIG=$PKG_CONFIG
3490 PKG_CONFIG="$PKG_CONFIG --static"
3491 PKG_CHECK_MODULES($@)
3492 PKG_CONFIG=$_save_PKG_CONFIG[]dnl
3493 ])dnl PKG_CHECK_MODULES_STATIC
3494
3495
3496 dnl PKG_INSTALLDIR([DIRECTORY])
3497 dnl -------------------------
3498 dnl Since: 0.27
3499 dnl
3500 dnl Substitutes the variable pkgconfigdir as the location where a module
3501 dnl should install pkg-config .pc files. By default the directory is
3502 dnl $libdir/pkgconfig, but the default can be changed by passing
3503 dnl DIRECTORY. The user can override through the --with-pkgconfigdir
3504 dnl parameter.
3505 AC_DEFUN([PKG_INSTALLDIR],
3506 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
3507 m4_pushdef([pkg_description],
3508 [pkg-config installation directory @<:@]pkg_default[@:>@])
3509 AC_ARG_WITH([pkgconfigdir],
3510 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
3511 [with_pkgconfigdir=]pkg_default)
3512 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
3513 m4_popdef([pkg_default])
3514 m4_popdef([pkg_description])
3515 ])dnl PKG_INSTALLDIR
3516
3517
3518 dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
3519 dnl --------------------------------
3520 dnl Since: 0.27
3521 dnl
3522 dnl Substitutes the variable noarch_pkgconfigdir as the location where a
3523 dnl module should install arch-independent pkg-config .pc files. By
3524 dnl default the directory is $datadir/pkgconfig, but the default can be
3525 dnl changed by passing DIRECTORY. The user can override through the
3526 dnl --with-noarch-pkgconfigdir parameter.
3527 AC_DEFUN([PKG_NOARCH_INSTALLDIR],
3528 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
3529 m4_pushdef([pkg_description],
3530 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
3531 AC_ARG_WITH([noarch-pkgconfigdir],
3532 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
3533 [with_noarch_pkgconfigdir=]pkg_default)
3534 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
3535 m4_popdef([pkg_default])
3536 m4_popdef([pkg_description])
3537 ])dnl PKG_NOARCH_INSTALLDIR
3538
3539
3540 dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
3541 dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3542 dnl -------------------------------------------
3543 dnl Since: 0.28
3544 dnl
3545 dnl Retrieves the value of the pkg-config variable for the given module.
3546 AC_DEFUN([PKG_CHECK_VAR],
3547 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
3548 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
3549
3550 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
3551 AS_VAR_COPY([$1], [pkg_cv_][$1])
3552
3553 AS_VAR_IF([$1], [""], [$5], [$4])dnl
3554 ])dnl PKG_CHECK_VAR
3555
3556 dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3557 dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3558 dnl [DESCRIPTION], [DEFAULT])
3559 dnl ------------------------------------------
3560 dnl
3561 dnl Prepare a "--with-" configure option using the lowercase
3562 dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3563 dnl PKG_CHECK_MODULES in a single macro.
3564 AC_DEFUN([PKG_WITH_MODULES],
3565 [
3566 m4_pushdef([with_arg], m4_tolower([$1]))
3567
3568 m4_pushdef([description],
3569 [m4_default([$5], [build with ]with_arg[ support])])
3570
3571 m4_pushdef([def_arg], [m4_default([$6], [auto])])
3572 m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3573 m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3574
3575 m4_case(def_arg,
3576 [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3577 [m4_pushdef([with_without],[--with-]with_arg)])
3578
3579 AC_ARG_WITH(with_arg,
3580 AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3581 [AS_TR_SH([with_]with_arg)=def_arg])
3582
3583 AS_CASE([$AS_TR_SH([with_]with_arg)],
3584 [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3585 [auto],[PKG_CHECK_MODULES([$1],[$2],
3586 [m4_n([def_action_if_found]) $3],
3587 [m4_n([def_action_if_not_found]) $4])])
3588
3589 m4_popdef([with_arg])
3590 m4_popdef([description])
3591 m4_popdef([def_arg])
3592
3593 ])dnl PKG_WITH_MODULES
3594
3595 dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3596 dnl [DESCRIPTION], [DEFAULT])
3597 dnl -----------------------------------------------
3598 dnl
3599 dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3600 dnl check._[VARIABLE-PREFIX] is exported as make variable.
3601 AC_DEFUN([PKG_HAVE_WITH_MODULES],
3602 [
3603 PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3604
3605 AM_CONDITIONAL([HAVE_][$1],
3606 [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3607 ])dnl PKG_HAVE_WITH_MODULES
3608
3609 dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3610 dnl [DESCRIPTION], [DEFAULT])
3611 dnl ------------------------------------------------------
3612 dnl
3613 dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3614 dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3615 dnl and preprocessor variable.
3616 AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3617 [
3618 PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3619
3620 AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3621 [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3622 ])dnl PKG_HAVE_DEFINE_WITH_MODULES
3623
3624 # po.m4 serial 31 (gettext-0.20.2)
3625 dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
3626 dnl This file is free software; the Free Software Foundation
3627 dnl gives unlimited permission to copy and/or distribute it,
3628 dnl with or without modifications, as long as this notice is preserved.
3629 dnl
3630 dnl This file can be used in projects which are not available under
3631 dnl the GNU General Public License or the GNU Lesser General Public
3632 dnl License but which still want to provide support for the GNU gettext
3633 dnl functionality.
3634 dnl Please note that the actual code of the GNU gettext library is covered
3635 dnl by the GNU Lesser General Public License, and the rest of the GNU
3636 dnl gettext package is covered by the GNU General Public License.
3637 dnl They are *not* in the public domain.
3638
3639 dnl Authors:
3640 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3641 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3642
3643 AC_PREREQ([2.60])
3644
3645 dnl Checks for all prerequisites of the po subdirectory.
3646 AC_DEFUN([AM_PO_SUBDIRS],
3647 [
3648 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3649 AC_REQUIRE([AC_PROG_INSTALL])dnl
3650 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
3651 AC_REQUIRE([AC_PROG_SED])dnl
3652 AC_REQUIRE([AM_NLS])dnl
3653
3654 dnl Release version of the gettext macros. This is used to ensure that
3655 dnl the gettext macros and po/Makefile.in.in are in sync.
3656 AC_SUBST([GETTEXT_MACRO_VERSION], [0.20])
3657
3658 dnl Perform the following tests also if --disable-nls has been given,
3659 dnl because they are needed for "make dist" to work.
3660
3661 dnl Search for GNU msgfmt in the PATH.
3662 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3663 dnl The second test excludes FreeBSD msgfmt.
3664 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3665 [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
3666 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3667 :)
3668 AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
3669
3670 dnl Test whether it is GNU msgfmt >= 0.15.
3671 changequote(,)dnl
3672 case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
3673 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
3674 *) GMSGFMT_015=$GMSGFMT ;;
3675 esac
3676 changequote([,])dnl
3677 AC_SUBST([GMSGFMT_015])
3678
3679 dnl Search for GNU xgettext 0.12 or newer in the PATH.
3680 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3681 dnl The second test excludes FreeBSD xgettext.
3682 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3683 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
3684 (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)],
3685 :)
3686 dnl Remove leftover from FreeBSD xgettext call.
3687 rm -f messages.po
3688
3689 dnl Test whether it is GNU xgettext >= 0.15.
3690 changequote(,)dnl
3691 case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
3692 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
3693 *) XGETTEXT_015=$XGETTEXT ;;
3694 esac
3695 changequote([,])dnl
3696 AC_SUBST([XGETTEXT_015])
3697
3698 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3699 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3700 [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
3701
3702 dnl Test whether it is GNU msgmerge >= 0.20.
3703 if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then
3704 MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt'
3705 else
3706 dnl Test whether it is GNU msgmerge >= 0.12.
3707 if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then
3708 MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet'
3709 else
3710 dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is
3711 dnl slow. But this is not a big problem, as such old gettext versions are
3712 dnl hardly in use any more.
3713 MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet'
3714 fi
3715 fi
3716 AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
3717
3718 dnl Support for AM_XGETTEXT_OPTION.
3719 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
3720 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
3721
3722 AC_CONFIG_COMMANDS([po-directories], [[
3723 for ac_file in $CONFIG_FILES; do
3724 # Support "outfile[:infile[:infile...]]"
3725 case "$ac_file" in
3726 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3727 esac
3728 # PO directories have a Makefile.in generated from Makefile.in.in.
3729 case "$ac_file" in */Makefile.in)
3730 # Adjust a relative srcdir.
3731 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3732 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
3733 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3734 # In autoconf-2.13 it is called $ac_given_srcdir.
3735 # In autoconf-2.50 it is called $srcdir.
3736 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3737 case "$ac_given_srcdir" in
3738 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3739 /*) top_srcdir="$ac_given_srcdir" ;;
3740 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
3741 esac
3742 # Treat a directory as a PO directory if and only if it has a
3743 # POTFILES.in file. This allows packages to have multiple PO
3744 # directories under different names or in different locations.
3745 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3746 rm -f "$ac_dir/POTFILES"
3747 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3748 gt_tab=`printf '\t'`
3749 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"
3750 POMAKEFILEDEPS="POTFILES.in"
3751 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
3752 # on $ac_dir but don't depend on user-specified configuration
3753 # parameters.
3754 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3755 # The LINGUAS file contains the set of available languages.
3756 if test -n "$OBSOLETE_ALL_LINGUAS"; then
3757 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3758 fi
3759 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3760 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3761 else
3762 # The set of available languages was given in configure.in.
3763 ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
3764 fi
3765 # Compute POFILES
3766 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
3767 # Compute UPDATEPOFILES
3768 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
3769 # Compute DUMMYPOFILES
3770 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
3771 # Compute GMOFILES
3772 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
3773 case "$ac_given_srcdir" in
3774 .) srcdirpre= ;;
3775 *) srcdirpre='$(srcdir)/' ;;
3776 esac
3777 POFILES=
3778 UPDATEPOFILES=
3779 DUMMYPOFILES=
3780 GMOFILES=
3781 for lang in $ALL_LINGUAS; do
3782 POFILES="$POFILES $srcdirpre$lang.po"
3783 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3784 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3785 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3786 done
3787 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3788 # environment variable.
3789 INST_LINGUAS=
3790 if test -n "$ALL_LINGUAS"; then
3791 for presentlang in $ALL_LINGUAS; do
3792 useit=no
3793 if test "%UNSET%" != "$LINGUAS"; then
3794 desiredlanguages="$LINGUAS"
3795 else
3796 desiredlanguages="$ALL_LINGUAS"
3797 fi
3798 for desiredlang in $desiredlanguages; do
3799 # Use the presentlang catalog if desiredlang is
3800 # a. equal to presentlang, or
3801 # b. a variant of presentlang (because in this case,
3802 # presentlang can be used as a fallback for messages
3803 # which are not translated in the desiredlang catalog).
3804 case "$desiredlang" in
3805 "$presentlang"*) useit=yes;;
3806 esac
3807 done
3808 if test $useit = yes; then
3809 INST_LINGUAS="$INST_LINGUAS $presentlang"
3810 fi
3811 done
3812 fi
3813 CATALOGS=
3814 if test -n "$INST_LINGUAS"; then
3815 for lang in $INST_LINGUAS; do
3816 CATALOGS="$CATALOGS $lang.gmo"
3817 done
3818 fi
3819 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3820 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"
3821 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3822 if test -f "$f"; then
3823 case "$f" in
3824 *.orig | *.bak | *~) ;;
3825 *) cat "$f" >> "$ac_dir/Makefile" ;;
3826 esac
3827 fi
3828 done
3829 fi
3830 ;;
3831 esac
3832 done]],
3833 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3834 # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS.
3835 OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS"
3836 # Capture the value of LINGUAS because we need it to compute CATALOGS.
3837 LINGUAS="${LINGUAS-%UNSET%}"
3838 ])
3839 ])
3840
3841 dnl Postprocesses a Makefile in a directory containing PO files.
3842 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
3843 [
3844 # When this code is run, in config.status, two variables have already been
3845 # set:
3846 # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
3847 # - LINGUAS is the value of the environment variable LINGUAS at configure
3848 # time.
3849
3850 changequote(,)dnl
3851 # Adjust a relative srcdir.
3852 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3853 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
3854 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3855 # In autoconf-2.13 it is called $ac_given_srcdir.
3856 # In autoconf-2.50 it is called $srcdir.
3857 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3858 case "$ac_given_srcdir" in
3859 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3860 /*) top_srcdir="$ac_given_srcdir" ;;
3861 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
3862 esac
3863
3864 # Find a way to echo strings without interpreting backslash.
3865 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
3866 gt_echo='echo'
3867 else
3868 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
3869 gt_echo='printf %s\n'
3870 else
3871 echo_func () {
3872 cat <<EOT
3873 $*
3874 EOT
3875 }
3876 gt_echo='echo_func'
3877 fi
3878 fi
3879
3880 # A sed script that extracts the value of VARIABLE from a Makefile.
3881 tab=`printf '\t'`
3882 sed_x_variable='
3883 # Test if the hold space is empty.
3884 x
3885 s/P/P/
3886 x
3887 ta
3888 # Yes it was empty. Look if we have the expected variable definition.
3889 /^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
3890 # Seen the first line of the variable definition.
3891 s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
3892 ba
3893 }
3894 bd
3895 :a
3896 # Here we are processing a line from the variable definition.
3897 # Remove comment, more precisely replace it with a space.
3898 s/#.*$/ /
3899 # See if the line ends in a backslash.
3900 tb
3901 :b
3902 s/\\$//
3903 # Print the line, without the trailing backslash.
3904 p
3905 tc
3906 # There was no trailing backslash. The end of the variable definition is
3907 # reached. Clear the hold space.
3908 s/^.*$//
3909 x
3910 bd
3911 :c
3912 # A trailing backslash means that the variable definition continues in the
3913 # next line. Put a nonempty string into the hold space to indicate this.
3914 s/^.*$/P/
3915 x
3916 :d
3917 '
3918 changequote([,])dnl
3919
3920 # Set POTFILES to the value of the Makefile variable POTFILES.
3921 sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
3922 POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
3923 # Compute POTFILES_DEPS as
3924 # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
3925 POTFILES_DEPS=
3926 for file in $POTFILES; do
3927 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
3928 done
3929 POMAKEFILEDEPS=""
3930
3931 if test -n "$OBSOLETE_ALL_LINGUAS"; then
3932 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3933 fi
3934 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3935 # The LINGUAS file contains the set of available languages.
3936 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3937 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3938 else
3939 # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
3940 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
3941 ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
3942 fi
3943 # Compute POFILES
3944 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
3945 # Compute UPDATEPOFILES
3946 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
3947 # Compute DUMMYPOFILES
3948 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
3949 # Compute GMOFILES
3950 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
3951 # Compute PROPERTIESFILES
3952 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties)
3953 # Compute CLASSFILES
3954 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class)
3955 # Compute QMFILES
3956 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
3957 # Compute MSGFILES
3958 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
3959 # Compute RESOURCESDLLFILES
3960 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
3961 case "$ac_given_srcdir" in
3962 .) srcdirpre= ;;
3963 *) srcdirpre='$(srcdir)/' ;;
3964 esac
3965 POFILES=
3966 UPDATEPOFILES=
3967 DUMMYPOFILES=
3968 GMOFILES=
3969 PROPERTIESFILES=
3970 CLASSFILES=
3971 QMFILES=
3972 MSGFILES=
3973 RESOURCESDLLFILES=
3974 for lang in $ALL_LINGUAS; do
3975 POFILES="$POFILES $srcdirpre$lang.po"
3976 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3977 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3978 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3979 PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties"
3980 CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class"
3981 QMFILES="$QMFILES $srcdirpre$lang.qm"
3982 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
3983 MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
3984 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/'`
3985 RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
3986 done
3987 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3988 # environment variable.
3989 INST_LINGUAS=
3990 if test -n "$ALL_LINGUAS"; then
3991 for presentlang in $ALL_LINGUAS; do
3992 useit=no
3993 if test "%UNSET%" != "$LINGUAS"; then
3994 desiredlanguages="$LINGUAS"
3995 else
3996 desiredlanguages="$ALL_LINGUAS"
3997 fi
3998 for desiredlang in $desiredlanguages; do
3999 # Use the presentlang catalog if desiredlang is
4000 # a. equal to presentlang, or
4001 # b. a variant of presentlang (because in this case,
4002 # presentlang can be used as a fallback for messages
4003 # which are not translated in the desiredlang catalog).
4004 case "$desiredlang" in
4005 "$presentlang"*) useit=yes;;
4006 esac
4007 done
4008 if test $useit = yes; then
4009 INST_LINGUAS="$INST_LINGUAS $presentlang"
4010 fi
4011 done
4012 fi
4013 CATALOGS=
4014 JAVACATALOGS=
4015 QTCATALOGS=
4016 TCLCATALOGS=
4017 CSHARPCATALOGS=
4018 if test -n "$INST_LINGUAS"; then
4019 for lang in $INST_LINGUAS; do
4020 CATALOGS="$CATALOGS $lang.gmo"
4021 JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
4022 QTCATALOGS="$QTCATALOGS $lang.qm"
4023 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
4024 TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
4025 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/'`
4026 CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
4027 done
4028 fi
4029
4030 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"
4031 tab=`printf '\t'`
4032 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
4033 # Add dependencies that cannot be formulated as a simple suffix rule.
4034 for lang in $ALL_LINGUAS; do
4035 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
4036 cat >> "$ac_file.tmp" <<EOF
4037 $frobbedlang.msg: $lang.po
4038 ${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
4039 ${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
4040 EOF
4041 done
4042 fi
4043 if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
4044 # Add dependencies that cannot be formulated as a simple suffix rule.
4045 for lang in $ALL_LINGUAS; do
4046 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/'`
4047 cat >> "$ac_file.tmp" <<EOF
4048 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
4049 ${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
4050 ${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
4051 EOF
4052 done
4053 fi
4054 if test -n "$POMAKEFILEDEPS"; then
4055 cat >> "$ac_file.tmp" <<EOF
4056 Makefile: $POMAKEFILEDEPS
4057 EOF
4058 fi
4059 mv "$ac_file.tmp" "$ac_file"
4060 ])
4061
4062 dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
4063 AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
4064 [
4065 XGETTEXT_EXTRA_OPTIONS=
4066 ])
4067
4068 dnl Registers an option to be passed to xgettext in the po subdirectory.
4069 AC_DEFUN([AM_XGETTEXT_OPTION],
4070 [
4071 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
4072 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
4073 ])
4074
4075 # progtest.m4 serial 8 (gettext-0.20.2)
4076 dnl Copyright (C) 1996-2003, 2005, 2008-2020 Free Software Foundation, Inc.
4077 dnl This file is free software; the Free Software Foundation
4078 dnl gives unlimited permission to copy and/or distribute it,
4079 dnl with or without modifications, as long as this notice is preserved.
4080 dnl
4081 dnl This file can be used in projects which are not available under
4082 dnl the GNU General Public License or the GNU Lesser General Public
4083 dnl License but which still want to provide support for the GNU gettext
4084 dnl functionality.
4085 dnl Please note that the actual code of the GNU gettext library is covered
4086 dnl by the GNU Lesser General Public License, and the rest of the GNU
4087 dnl gettext package is covered by the GNU General Public License.
4088 dnl They are *not* in the public domain.
4089
4090 dnl Authors:
4091 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
4092
4093 AC_PREREQ([2.50])
4094
4095 # Search path for a program which passes the given test.
4096
4097 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
4098 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
4099 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
4100 [
4101 # Prepare PATH_SEPARATOR.
4102 # The user is always right.
4103 if test "${PATH_SEPARATOR+set}" != set; then
4104 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
4105 # contains only /bin. Note that ksh looks also at the FPATH variable,
4106 # so we have to set that as well for the test.
4107 PATH_SEPARATOR=:
4108 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
4109 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
4110 || PATH_SEPARATOR=';'
4111 }
4112 fi
4113
4114 # Find out how to test for executable files. Don't use a zero-byte file,
4115 # as systems may use methods other than mode bits to determine executability.
4116 cat >conf$$.file <<_ASEOF
4117 #! /bin/sh
4118 exit 0
4119 _ASEOF
4120 chmod +x conf$$.file
4121 if test -x conf$$.file >/dev/null 2>&1; then
4122 ac_executable_p="test -x"
4123 else
4124 ac_executable_p="test -f"
4125 fi
4126 rm -f conf$$.file
4127
4128 # Extract the first word of "$2", so it can be a program name with args.
4129 set dummy $2; ac_word=[$]2
4130 AC_MSG_CHECKING([for $ac_word])
4131 AC_CACHE_VAL([ac_cv_path_$1],
4132 [case "[$]$1" in
4133 [[\\/]]* | ?:[[\\/]]*)
4134 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
4135 ;;
4136 *)
4137 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
4138 for ac_dir in ifelse([$5], , $PATH, [$5]); do
4139 IFS="$ac_save_IFS"
4140 test -z "$ac_dir" && ac_dir=.
4141 for ac_exec_ext in '' $ac_executable_extensions; do
4142 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
4143 echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
4144 if [$3]; then
4145 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
4146 break 2
4147 fi
4148 fi
4149 done
4150 done
4151 IFS="$ac_save_IFS"
4152 dnl If no 4th arg is given, leave the cache variable unset,
4153 dnl so AC_PATH_PROGS will keep looking.
4154 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
4155 ])dnl
4156 ;;
4157 esac])dnl
4158 $1="$ac_cv_path_$1"
4159 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
4160 AC_MSG_RESULT([$][$1])
4161 else
4162 AC_MSG_RESULT([no])
4163 fi
4164 AC_SUBST([$1])dnl
4165 ])
4166
4167 m4_include([acinclude.m4])