1 # generated automatically by aclocal 1.16.5 -*- Autoconf -*-
3 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
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
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 # ===========================================================================
21 # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
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.)
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.)
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
41 # If you are only building threaded programs, you may wish to use these
42 # variables in your default LIBS, CFLAGS, and CC:
44 # LIBS="$PTHREAD_LIBS $LIBS"
45 # CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
46 # CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
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).
54 # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
55 # PTHREAD_PRIO_INHERIT symbol is defined when compiling with
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.
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.
70 # Updated for Autoconf 2.68 by Daniel Richard G.
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>
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.
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.
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/>.
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.
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.
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])
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.
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
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
136 CC="$ax_pthread_save_CC"
137 CFLAGS="$ax_pthread_save_CFLAGS"
138 LIBS="$ax_pthread_save_LIBS"
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).
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.
153 ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
155 # The ordering *is* (sometimes) important. Some notes on the
156 # individual items follow:
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)
179 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
180 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
182 ax_pthread_flags="-kthread lthread $ax_pthread_flags"
187 # From the cc(1) man page: "[-mt] Sets various -D flags to enable
188 # multi-threading and also sets -lpthread."
190 ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
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.)
200 AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
202 # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
203 AX_PTHREAD_ZOS_MISSING
206 [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
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).
219 ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
223 # Are we compiling with Clang?
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
236 [ax_cv_PTHREAD_CLANG=yes])
239 ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
242 # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
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
252 AS_IF([test "x$GCC" = "xyes"],
253 [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
255 # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
257 AS_IF([test "x$ax_pthread_clang" = "xyes"],
258 [ax_pthread_flags="-pthread,-lpthread -pthread"])
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
266 darwin* | hpux* | linux* | osf* | solaris*)
267 ax_pthread_check_macro="_REENTRANT"
271 ax_pthread_check_macro="_THREAD_SAFE"
275 ax_pthread_check_macro="--"
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)"])
283 if test "x$ax_pthread_ok" = "xno"; then
284 for ax_pthread_try_flag in $ax_pthread_flags; do
286 case $ax_pthread_try_flag in
288 AC_MSG_CHECKING([whether pthreads work without any flags])
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"])
298 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
299 PTHREAD_CFLAGS="$ax_pthread_try_flag"
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`"
310 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
311 PTHREAD_LIBS="-l$ax_pthread_try_flag"
315 ax_pthread_save_CFLAGS="$CFLAGS"
316 ax_pthread_save_LIBS="$LIBS"
317 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
318 LIBS="$PTHREAD_LIBS $LIBS"
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.
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"
334 static void *some_global = NULL;
335 static void routine(void *a)
337 /* To avoid any unused-parameter or
338 unused-but-set-parameter warning. */
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);
345 pthread_attr_init(&attr);
346 pthread_cleanup_push(routine, 0);
347 pthread_cleanup_pop(0) /* ; */])],
351 CFLAGS="$ax_pthread_save_CFLAGS"
352 LIBS="$ax_pthread_save_LIBS"
354 AC_MSG_RESULT([$ax_pthread_ok])
355 AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
363 # Clang needs special handling, because older versions handle the -pthread
364 # option in a rather... idiosyncratic way
366 if test "x$ax_pthread_clang" = "xyes"; then
368 # Clang takes -pthread; it has never supported any other flag
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.)
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.)
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.
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.
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.
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
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;}]])],
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"
427 case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
429 *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
432 fi # $ax_pthread_clang = yes
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"
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],
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
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
469 ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
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])
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;
483 [ax_cv_PTHREAD_PRIO_INHERIT=yes],
484 [ax_cv_PTHREAD_PRIO_INHERIT=no])
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
492 CFLAGS="$ax_pthread_save_CFLAGS"
493 LIBS="$ax_pthread_save_LIBS"
495 # More AIX lossage: compile with *_r variant
496 if test "x$GCC" != "xyes"; then
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
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"])])
509 AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
510 AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
519 test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
520 test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
522 AC_SUBST([PTHREAD_LIBS])
523 AC_SUBST([PTHREAD_CFLAGS])
524 AC_SUBST([PTHREAD_CC])
525 AC_SUBST([PTHREAD_CXX])
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])
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.
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
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.
554 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
555 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
557 dnl Macro to add for using GNU gettext.
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.
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
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
592 AC_DEFUN([AM_GNU_GETTEXT],
594 dnl Argument checking.
595 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
596 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
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.
601 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
602 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
604 define([gt_included_intl],
605 ifelse([$1], [external], [no], [yes]))
607 AM_GNU_GETTEXT_NEED([$2])
609 AC_REQUIRE([AM_PO_SUBDIRS])dnl
610 ifelse(gt_included_intl, yes, [
611 AC_REQUIRE([AM_INTL_SUBDIR])dnl
614 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
615 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
616 AC_REQUIRE([AC_LIB_RPATH])
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])
632 dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
638 ifelse(gt_included_intl, yes, [
639 BUILD_INCLUDED_LIBINTL=no
640 USE_INCLUDED_LIBINTL=no
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 ;;
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"
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])
666 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
667 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
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.
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)
679 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
683 gt_revision_test_code=
685 if test $gt_api_version -ge 2; then
686 gt_expression_test_code=' + * ngettext ("", "", 0)'
688 gt_expression_test_code=
691 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
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)
701 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
703 $gt_revision_test_code
706 bindtextdomain ("", "");
707 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
709 [eval "$gt_func_gnugettext_libc=yes"],
710 [eval "$gt_func_gnugettext_libc=no"])])
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, , [
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"
727 LIBS="$LIBS $LIBINTL"
728 dnl Now see whether libintl exists and does not depend on libiconv.
733 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
734 extern int _nl_msg_cat_cntr;
739 const char *_nl_expand_alias (const char *);
740 #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
742 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
744 $gt_revision_test_code
747 bindtextdomain ("", "");
748 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
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"
759 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
760 extern int _nl_msg_cat_cntr;
765 const char *_nl_expand_alias (const char *);
766 #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
768 #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
770 $gt_revision_test_code
773 bindtextdomain ("", "");
774 return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
776 [LIBINTL="$LIBINTL $LIBICONV"
777 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
778 eval "$gt_func_gnugettext_libintl=yes"
781 CPPFLAGS="$gt_save_CPPFLAGS"
782 LIBS="$gt_save_LIBS"])
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
795 dnl Reset the values set by searching for libintl.
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
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/ $//'`
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.
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"
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
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"
856 gt_source="included intl directory"
858 AC_MSG_RESULT([$gt_source])
861 if test "$USE_NLS" = "yes"; then
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])
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.])
877 dnl We need to process the po/ directory.
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
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])
892 dnl For backward compatibility. Some Makefiles may be using this.
896 dnl Make all documented variables known to autoconf.
898 AC_SUBST([LTLIBINTL])
903 dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
904 m4_define([gt_NEEDS_INIT],
906 m4_divert_text([DEFAULTS], [gt_needs=])
907 m4_define([gt_NEEDS_INIT], [])
911 dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
912 AC_DEFUN([AM_GNU_GETTEXT_NEED],
914 m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
918 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
919 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
922 dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
923 AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
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.
931 dnl From Bruno Haible and Sam Steingold.
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
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.
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],
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],
984 gl_cv_host_cpu_c_abi=i386
988 # On x86_64 systems, the C compiler may be generating code in one of
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.
997 [[#if (defined __x86_64__ || defined __amd64__ \
998 || defined _M_X64 || defined _M_AMD64)
1006 [[#if defined __ILP32__ || defined _ILP32
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])
1018 alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
1020 gl_cv_host_cpu_c_abi=alpha
1024 # Assume arm with EABI.
1025 # On arm64 systems, the C compiler may be generating code in one of
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.
1032 [[#ifdef __aarch64__
1040 [[#if defined __ILP32__ || defined _ILP32
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
1065 gl_cv_host_cpu_c_abi=arm
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__.
1082 [gl_cv_host_cpu_c_abi=hppa64],
1083 [gl_cv_host_cpu_c_abi=hppa])
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.
1097 [gl_cv_host_cpu_c_abi=ia64-ilp32],
1098 [gl_cv_host_cpu_c_abi=ia64])
1102 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
1106 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
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.
1119 [[#if (_MIPS_SIM == _ABIN32)
1125 [gl_cv_host_cpu_c_abi=mipsn32],
1126 [gl_cv_host_cpu_c_abi=mips])])
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.
1138 [[#if defined __powerpc64__ || defined _ARCH_PPC64
1144 [# On powerpc64, there are two ABIs on Linux: The AIX compatible
1145 # one and the ELFv2 one. The latter defines _CALL_ELF=2.
1148 [[#if defined _CALL_ELF && _CALL_ELF == 2
1154 [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
1155 [gl_cv_host_cpu_c_abi=powerpc64])
1157 [gl_cv_host_cpu_c_abi=powerpc])
1161 gl_cv_host_cpu_c_abi=powerpc
1165 # There are 2 architectures (with variants): rv32* and rv64*.
1168 [[#if __riscv_xlen == 64
1176 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
1177 # Size of 'long' and 'void *':
1180 [[#if defined __LP64__
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.
1197 [[#if defined __riscv_float_abi_double
1206 [[#if defined __riscv_float_abi_single
1215 gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
1219 # On s390x, the C compiler may be generating 64-bit (= s390x) code
1220 # or 31-bit (= s390) code.
1223 [[#if defined __LP64__ || defined __s390x__
1229 [gl_cv_host_cpu_c_abi=s390x],
1230 [gl_cv_host_cpu_c_abi=s390])
1234 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
1235 # C compiler still generates 32-bit code.
1238 [[#if defined __sparcv9 || defined __arch64__
1244 [gl_cv_host_cpu_c_abi=sparc64],
1245 [gl_cv_host_cpu_c_abi=sparc])
1249 gl_cv_host_cpu_c_abi="$host_cpu"
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])
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
1268 #ifndef __${HOST_CPU_C_ABI}__
1269 #define __${HOST_CPU_C_ABI}__ 1
1272 AH_TOP([/* CPU and C ABI indicator */
1276 #ifndef __x86_64_x32__
1277 #undef __x86_64_x32__
1291 #ifndef __arm64_ilp32__
1292 #undef __arm64_ilp32__
1303 #ifndef __ia64_ilp32__
1304 #undef __ia64_ilp32__
1324 #ifndef __powerpc64__
1325 #undef __powerpc64__
1327 #ifndef __powerpc64_elfv2__
1328 #undef __powerpc64_elfv2__
1336 #ifndef __riscv32_ilp32__
1337 #undef __riscv32_ilp32__
1339 #ifndef __riscv32_ilp32f__
1340 #undef __riscv32_ilp32f__
1342 #ifndef __riscv32_ilp32d__
1343 #undef __riscv32_ilp32d__
1345 #ifndef __riscv64_ilp32__
1346 #undef __riscv64_ilp32__
1348 #ifndef __riscv64_ilp32f__
1349 #undef __riscv64_ilp32f__
1351 #ifndef __riscv64_ilp32d__
1352 #undef __riscv64_ilp32d__
1354 #ifndef __riscv64_lp64__
1355 #undef __riscv64_lp64__
1357 #ifndef __riscv64_lp64f__
1358 #undef __riscv64_lp64f__
1360 #ifndef __riscv64_lp64d__
1361 #undef __riscv64_lp64d__
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],
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 ;;
1398 gl_cv_host_cpu_c_abi_32bit=unknown ;;
1403 # CPUs that only support a 32-bit ABI.
1412 | microblaze | microblazeel \
1413 | nds32 | nds32le | nds32be \
1414 | nios2 | nios2eb | nios2el \
1417 | sh | sh[1234] | sh[1234]e[lb] \
1420 gl_cv_host_cpu_c_abi_32bit=yes
1423 # CPUs that only support a 64-bit ABI.
1425 alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
1428 gl_cv_host_cpu_c_abi_32bit=no
1434 gl_cv_host_cpu_c_abi_32bit=yes
1438 # On x86_64 systems, the C compiler may be generating code in one of
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.
1447 [[#if (defined __x86_64__ || defined __amd64__ \
1448 || defined _M_X64 || defined _M_AMD64) \
1449 && !(defined __ILP32__ || defined _ILP32)
1455 [gl_cv_host_cpu_c_abi_32bit=no],
1456 [gl_cv_host_cpu_c_abi_32bit=yes])
1460 # Assume arm with EABI.
1461 # On arm64 systems, the C compiler may be generating code in one of
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.
1468 [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32)
1474 [gl_cv_host_cpu_c_abi_32bit=no],
1475 [gl_cv_host_cpu_c_abi_32bit=yes])
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__.
1489 [gl_cv_host_cpu_c_abi_32bit=no],
1490 [gl_cv_host_cpu_c_abi_32bit=yes])
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.
1504 [gl_cv_host_cpu_c_abi_32bit=yes],
1505 [gl_cv_host_cpu_c_abi_32bit=no])
1509 # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
1513 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
1519 [gl_cv_host_cpu_c_abi_32bit=no],
1520 [gl_cv_host_cpu_c_abi_32bit=yes])
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.
1532 [[#if defined __powerpc64__ || defined _ARCH_PPC64
1538 [gl_cv_host_cpu_c_abi_32bit=no],
1539 [gl_cv_host_cpu_c_abi_32bit=yes])
1543 gl_cv_host_cpu_c_abi_32bit=yes
1547 # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
1548 # Size of 'long' and 'void *':
1551 [[#if defined __LP64__
1557 [gl_cv_host_cpu_c_abi_32bit=no],
1558 [gl_cv_host_cpu_c_abi_32bit=yes])
1562 # On s390x, the C compiler may be generating 64-bit (= s390x) code
1563 # or 31-bit (= s390) code.
1566 [[#if defined __LP64__ || defined __s390x__
1572 [gl_cv_host_cpu_c_abi_32bit=no],
1573 [gl_cv_host_cpu_c_abi_32bit=yes])
1577 # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
1578 # C compiler still generates 32-bit code.
1581 [[#if defined __sparcv9 || defined __arch64__
1587 [gl_cv_host_cpu_c_abi_32bit=no],
1588 [gl_cv_host_cpu_c_abi_32bit=yes])
1592 gl_cv_host_cpu_c_abi_32bit=unknown
1598 HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
1601 # iconv.m4 serial 21
1602 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation,
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.
1608 dnl From Bruno Haible.
1610 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
1612 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1613 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1614 AC_REQUIRE([AC_LIB_RPATH])
1616 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1618 AC_LIB_LINKFLAGS_BODY([iconv])
1621 AC_DEFUN([AM_ICONV_LINK],
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
1627 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1629 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
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])
1638 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
1639 am_cv_func_iconv="no, consider installing GNU libiconv"
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"
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"
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,
1672 am_save_LIBS="$LIBS"
1673 if test $am_cv_lib_iconv = yes; then
1674 LIBS="$LIBS $LIBICONV"
1676 am_cv_func_iconv_works=no
1677 for ac_iconv_const in '' 'const'; do
1685 # define ICONV_CONST $ac_iconv_const
1689 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
1692 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
1693 if (cd_utf8_to_88591 != (iconv_t)(-1))
1695 static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
1697 ICONV_CONST char *inptr = input;
1698 size_t inbytesleft = strlen (input);
1700 size_t outbytesleft = sizeof (buf);
1701 size_t res = iconv (cd_utf8_to_88591,
1702 &inptr, &inbytesleft,
1703 &outptr, &outbytesleft);
1706 iconv_close (cd_utf8_to_88591);
1709 /* Test against Solaris 10 bug: Failures are not distinguishable from
1710 successful returns. */
1712 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
1713 if (cd_ascii_to_88591 != (iconv_t)(-1))
1715 static ICONV_CONST char input[] = "\263";
1717 ICONV_CONST char *inptr = input;
1718 size_t inbytesleft = strlen (input);
1720 size_t outbytesleft = sizeof (buf);
1721 size_t res = iconv (cd_ascii_to_88591,
1722 &inptr, &inbytesleft,
1723 &outptr, &outbytesleft);
1726 iconv_close (cd_ascii_to_88591);
1729 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
1731 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
1732 if (cd_88591_to_utf8 != (iconv_t)(-1))
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;
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)
1745 iconv_close (cd_88591_to_utf8);
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. */
1751 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
1752 if (cd_88591_to_utf8 != (iconv_t)(-1))
1754 static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
1756 ICONV_CONST char *inptr = input;
1757 size_t inbytesleft = strlen (input);
1759 size_t outbytesleft = sizeof (buf);
1760 size_t res = iconv (cd_88591_to_utf8,
1761 &inptr, &inbytesleft,
1762 &outptr, &outbytesleft);
1765 iconv_close (cd_88591_to_utf8);
1769 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
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))
1783 if (cd1 != (iconv_t)(-1))
1785 if (cd2 != (iconv_t)(-1))
1787 if (cd3 != (iconv_t)(-1))
1789 if (cd4 != (iconv_t)(-1))
1794 [am_cv_func_iconv_works=yes], ,
1796 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
1797 *) am_cv_func_iconv_works="guessing yes" ;;
1799 test "$am_cv_func_iconv_works" = no || break
1801 LIBS="$am_save_LIBS"
1803 case "$am_cv_func_iconv_works" in
1804 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
1805 *) am_func_iconv=yes ;;
1808 am_func_iconv=no am_cv_lib_iconv=no
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.])
1814 if test "$am_cv_lib_iconv" = yes; then
1815 AC_MSG_CHECKING([how to link with libiconv])
1816 AC_MSG_RESULT([$LIBICONV])
1818 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
1820 CPPFLAGS="$am_save_CPPFLAGS"
1824 AC_SUBST([LIBICONV])
1825 AC_SUBST([LTLIBICONV])
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"
1837 m4_define([gl_iconv_AC_DEFUN],
1838 m4_version_prereq([2.64],
1841 [m4_ifdef([gl_00GNULIB],
1846 gl_iconv_AC_DEFUN([AM_ICONV],
1849 if test "$am_cv_func_iconv" = yes; then
1850 AC_MSG_CHECKING([for iconv declaration])
1851 AC_CACHE_VAL([am_cv_proto_iconv], [
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);
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/( /(/'`
1873 $am_cv_proto_iconv])
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=""
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
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.
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
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.
1905 dnl Checks for special options needed on Mac OS X.
1906 dnl Defines INTL_MACOSX_LIBS.
1907 AC_DEFUN([gt_INTL_MACOSX],
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"
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.])
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"
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.])
1949 if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
1950 || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
1951 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
1953 AC_SUBST([INTL_MACOSX_LIBS])
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.
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.
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
1975 acl_cv_prog_gnu_ld=no
1978 with_gnu_ld=$acl_cv_prog_gnu_ld
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
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
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.
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=';'
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])
2012 AC_MSG_CHECKING([for non-GNU ld])
2014 if test -n "$LD"; then
2015 # Let the user override the test with a path.
2018 AC_CACHE_VAL([acl_cv_path_LD],
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.
2026 # gcc leaves a trailing carriage return which upsets mingw
2027 acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2029 acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
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%/%"`
2040 # Got the pathname. No search in PATH is needed.
2041 acl_cv_path_LD="$acl_output"
2045 # If it fails, then pretend we aren't using GCC.
2048 # If it is relative, then search for the first ld in PATH.
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
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
2069 test "$with_gnu_ld" != yes && break
2080 [[#if defined __powerpc64__ || defined _ARCH_PPC64
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
2090 *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
2097 [[#if defined __sparcv9 || defined __arch64__
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" ;;
2114 LD="$acl_cv_path_LD"
2116 if test -n "$LD"; then
2117 AC_MSG_RESULT([$LD])
2120 AC_MSG_ERROR([no acceptable ld found in \$PATH])
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.
2131 dnl From Bruno Haible.
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],
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"
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)
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.
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],
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____])])
2189 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2191 AC_LIB_LINKFLAGS_BODY([$1], [$2])
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)
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
2208 case " $LIB[]NAME" in
2209 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
2210 *) LIBS="$LIB[]NAME $LIBS" ;;
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"
2218 if test "$ac_cv_lib[]Name" = yes; then
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])
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"
2232 AC_SUBST([HAVE_LIB]NAME)
2234 AC_SUBST([LTLIB]NAME)
2235 AC_SUBST([LIB]NAME[_PREFIX])
2240 dnl Determine the platform dependent parameters needed to use rpath:
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],
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
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)
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],
2287 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
2288 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
2289 define([acl_frompackage_]NAME, [$2])
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])
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],
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.
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\"
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]],
2326 if test "X$withval" = "Xno"; then
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\"
2337 additional_includedir="$withval/include"
2338 additional_libdir="$withval/$acl_libdirstem"
2339 additional_libdir2="$withval/$acl_libdirstem2"
2340 additional_libdir3="$withval/$acl_libdirstem3"
2344 if test "X$additional_libdir2" = "X$additional_libdir"; then
2347 if test "X$additional_libdir3" = "X$additional_libdir"; then
2350 dnl Search the library and its dependencies in $additional_libdir and
2351 dnl $LDFLAGS. Using breadth-first-seach.
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.
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"
2366 for name in $names_this_round; do
2368 for n in $names_already_handled; do
2369 if test "$n" = "$name"; then
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"
2387 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
2388 dnl that this library doesn't exist. So just drop it.
2392 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
2393 dnl and the already constructed $LIBNAME/$LTLIBNAME.
2398 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
2399 if test -n "$acl_shlibext"; then
2400 shrext=".$acl_shlibext" # typically: shrext=.so
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
2414 found_so="$dir/$libname$shrext"
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
2424 found_so="$dir/$libname$shrext.$ver"
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
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
2442 found_a="$dir/$libname.$acl_libext"
2445 if test "X$found_dir" != "X"; then
2446 if test -f "$dir/$libname.la"; then
2447 found_la="$dir/$libname.la"
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\"])
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
2464 found_so="$dir/$libname$shrext"
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
2474 found_so="$dir/$libname$shrext.$ver"
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
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
2492 found_a="$dir/$libname.$acl_libext"
2495 if test "X$found_dir" != "X"; then
2496 if test -f "$dir/$libname.la"; then
2497 found_la="$dir/$libname.la"
2502 if test "X$found_dir" != "X"; then
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"
2521 dnl Use an explicit option to hardcode DIR into the resulting
2523 dnl Potentially add DIR to ltrpathdirs.
2524 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2526 for x in $ltrpathdirs; do
2527 if test "X$x" = "X$found_dir"; then
2532 if test -z "$haveit"; then
2533 ltrpathdirs="$ltrpathdirs $found_dir"
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"
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
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.
2548 for x in $rpathdirs; do
2549 if test "X$x" = "X$found_dir"; then
2554 if test -z "$haveit"; then
2555 rpathdirs="$rpathdirs $found_dir"
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
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
2569 if test -z "$haveit"; then
2570 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
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"
2576 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
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"
2585 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2591 if test "X$found_a" != "X"; then
2592 dnl Linking with a static library.
2593 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
2595 dnl We shouldn't come here, but anyway it's good to have a
2597 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
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"
2608 additional_includedir="$basedir/include"
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"
2615 additional_includedir="$basedir/include"
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"
2622 additional_includedir="$basedir/include"
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
2635 if test "X$additional_includedir" = "X/usr/local/include"; then
2636 if test -n "$GCC"; then
2638 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
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
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"
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"
2666 */* | *\\*) . "$found_la" ;;
2667 *) . "./$found_la" ;;
2669 libdir="$save_libdir"
2670 dnl We use only dependency_libs.
2671 for dep in $dependency_libs; do
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
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
2691 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2695 if test -z "$haveit"; then
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
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"
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
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"
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.
2733 for x in $rpathdirs; do
2734 if test "X$x" = "X$dir"; then
2739 if test -z "$haveit"; then
2740 rpathdirs="$rpathdirs $dir"
2742 dnl Potentially add DIR to ltrpathdirs.
2743 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2745 for x in $ltrpathdirs; do
2746 if test "X$x" = "X$dir"; then
2751 if test -z "$haveit"; then
2752 ltrpathdirs="$ltrpathdirs $dir"
2757 dnl Handle this in the next round.
2758 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
2761 dnl Handle this in the next round. Throw away the .la's
2762 dnl directory; it is already contained in a preceding -L
2764 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
2767 dnl Most likely an immediate library name.
2768 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
2769 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
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"
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.
2792 for found_dir in $rpathdirs; do
2793 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
2795 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
2796 acl_save_libdir="$libdir"
2798 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2799 libdir="$acl_save_libdir"
2800 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2802 dnl The -rpath options are cumulative.
2803 for found_dir in $rpathdirs; do
2804 acl_save_libdir="$libdir"
2806 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2807 libdir="$acl_save_libdir"
2808 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
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"
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],
2831 for element in [$2]; do
2834 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2835 if test "X$x" = "X$element"; then
2840 if test -z "$haveit"; then
2841 [$1]="${[$1]}${[$1]:+ }$element"
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],
2855 AC_REQUIRE([AC_LIB_RPATH])
2856 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
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
2865 if test -n "$next"; then
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"
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"
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"
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.
2901 for dir in $rpathdirs; do
2902 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
2904 acl_save_libdir="$libdir"
2906 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2907 libdir="$acl_save_libdir"
2910 dnl The -rpath options are cumulative.
2911 for dir in $rpathdirs; do
2912 acl_save_libdir="$libdir"
2914 eval flag=\"$acl_hardcode_libdir_flag_spec\"
2915 libdir="$acl_save_libdir"
2916 $1="${$1}${$1:+ }$flag"
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.
2932 dnl From Bruno Haible.
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],
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.
2949 AC_LIB_WITH_FINAL_PREFIX([
2950 eval additional_includedir=\"$includedir\"
2951 eval additional_libdir=\"$libdir\"
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]],
2957 if test "X$withval" = "Xno"; then
2960 if test "X$withval" = "X"; then
2961 AC_LIB_WITH_FINAL_PREFIX([
2962 eval additional_includedir=\"$includedir\"
2963 eval additional_libdir=\"$libdir\"
2966 additional_includedir="$withval/include"
2967 additional_libdir="$withval/$acl_libdirstem"
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
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
2987 if test -z "$haveit"; then
2988 if test "X$additional_includedir" = "X/usr/local/include"; then
2989 if test -n "$GCC"; then
2991 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
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"
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
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
3018 if test -z "$haveit"; then
3019 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
3020 if test -n "$GCC"; then
3022 linux*) haveit=yes;;
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"
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],
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"
3047 acl_final_prefix="$prefix"
3049 if test "X$exec_prefix" = "XNONE"; then
3050 acl_final_exec_prefix='${prefix}'
3052 acl_final_exec_prefix="$exec_prefix"
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"
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],
3065 acl_save_prefix="$prefix"
3066 prefix="$acl_final_prefix"
3067 acl_save_exec_prefix="$exec_prefix"
3068 exec_prefix="$acl_final_exec_prefix"
3070 exec_prefix="$acl_save_exec_prefix"
3071 prefix="$acl_save_prefix"
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],
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,
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])
3100 AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
3101 [AC_EGREP_CPP([Extensible Linking Format],
3103 Extensible Linking Format
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
3116 od -A n -t d1 -j 4 -N 1
3122 dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
3127 case $HOST_CPU_C_ABI_32BIT in
3130 acl_is_expected_elfclass ()
3132 test "`func_elfclass | sed -e 's/[ ]//g'`" = 1
3137 acl_is_expected_elfclass ()
3139 test "`func_elfclass | sed -e 's/[ ]//g'`" = 2
3144 acl_is_expected_elfclass ()
3152 acl_is_expected_elfclass ()
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>.
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
3176 sparc*) acl_libdirstem3=lib/sparcv9 ;;
3177 i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
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
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
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 ;;
3212 # Better ignore directories of this form. They are misleading.
3214 *) searchdir=`cd "$searchdir" && pwd`
3215 case "$searchdir" in
3216 */lib32 ) acl_libdirstem2=lib32 ;;
3217 */lib64 ) acl_libdirstem3=lib64 ;;
3223 if test $HOST_CPU_C_ABI_32BIT = yes; then
3227 if test $HOST_CPU_C_ABI_32BIT = no; then
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"
3238 dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
3239 dnl acl_libdirstem3.
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/,.*//'`
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.
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
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.
3264 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3265 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
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])
3280 # pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
3281 # serial 12 (pkg-config-0.29.2)
3283 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
3284 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
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.
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.
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.
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
3307 dnl PKG_PREREQ(MIN-VERSION)
3308 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.
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])])
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])])
3328 dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
3329 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])
3345 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
3346 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
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])
3358 ])dnl PKG_PROG_PKG_CONFIG
3360 dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3361 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.
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
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
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 ],
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
3405 _pkg_short_errors_supported=no
3407 ])dnl _PKG_SHORT_ERRORS_SUPPORTED
3410 dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
3411 dnl [ACTION-IF-NOT-FOUND])
3412 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
3424 AC_MSG_CHECKING([for $2])
3426 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
3427 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
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.])
3433 if test $pkg_failed = yes; then
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`
3439 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
3441 # Put the nasty error message in config.log where it belongs
3442 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
3444 m4_default([$4], [AC_MSG_ERROR(
3445 [Package requirements ($2) were not met:
3449 Consider adjusting the PKG_CONFIG_PATH environment variable if you
3450 installed software in a non-standard prefix.
3454 elif test $pkg_failed = untried; then
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
3463 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
3466 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
3467 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
3468 AC_MSG_RESULT([yes])
3471 ])dnl PKG_CHECK_MODULES
3474 dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
3475 dnl [ACTION-IF-NOT-FOUND])
3476 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.
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
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
3496 dnl PKG_INSTALLDIR([DIRECTORY])
3497 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
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
3518 dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
3519 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
3540 dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
3541 dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3542 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
3550 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
3551 AS_VAR_COPY([$1], [pkg_cv_][$1])
3553 AS_VAR_IF([$1], [""], [$5], [$4])dnl
3556 dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3557 dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3558 dnl [DESCRIPTION], [DEFAULT])
3559 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],
3566 m4_pushdef([with_arg], m4_tolower([$1]))
3568 m4_pushdef([description],
3569 [m4_default([$5], [build with ]with_arg[ support])])
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])
3576 [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3577 [m4_pushdef([with_without],[--with-]with_arg)])
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])
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])])
3589 m4_popdef([with_arg])
3590 m4_popdef([description])
3591 m4_popdef([def_arg])
3593 ])dnl PKG_WITH_MODULES
3595 dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3596 dnl [DESCRIPTION], [DEFAULT])
3597 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],
3603 PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3605 AM_CONDITIONAL([HAVE_][$1],
3606 [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3607 ])dnl PKG_HAVE_WITH_MODULES
3609 dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3610 dnl [DESCRIPTION], [DEFAULT])
3611 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],
3618 PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
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
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.
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
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.
3640 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3641 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3645 dnl Checks for all prerequisites of the po subdirectory.
3646 AC_DEFUN([AM_PO_SUBDIRS],
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
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])
3658 dnl Perform the following tests also if --disable-nls has been given,
3659 dnl because they are needed for "make dist" to work.
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)],
3668 AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
3670 dnl Test whether it is GNU msgfmt >= 0.15.
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 ;;
3677 AC_SUBST([GMSGFMT_015])
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)],
3686 dnl Remove leftover from FreeBSD xgettext call.
3689 dnl Test whether it is GNU xgettext >= 0.15.
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 ;;
3696 AC_SUBST([XGETTEXT_015])
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], :)
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'
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'
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'
3716 AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
3718 dnl Support for AM_XGETTEXT_OPTION.
3719 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
3720 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
3722 AC_CONFIG_COMMANDS([po-directories], [[
3723 for ac_file in $CONFIG_FILES; do
3724 # Support "outfile[:infile[:infile...]]"
3726 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
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" ;;
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
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"
3759 ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3760 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3762 # The set of available languages was given in configure.in.
3763 ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
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)
3772 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
3773 case "$ac_given_srcdir" in
3775 *) srcdirpre='$(srcdir)/' ;;
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"
3787 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3788 # environment variable.
3790 if test -n "$ALL_LINGUAS"; then
3791 for presentlang in $ALL_LINGUAS; do
3793 if test "%UNSET%" != "$LINGUAS"; then
3794 desiredlanguages="$LINGUAS"
3796 desiredlanguages="$ALL_LINGUAS"
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;;
3808 if test $useit = yes; then
3809 INST_LINGUAS="$INST_LINGUAS $presentlang"
3814 if test -n "$INST_LINGUAS"; then
3815 for lang in $INST_LINGUAS; do
3816 CATALOGS="$CATALOGS $lang.gmo"
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
3824 *.orig | *.bak | *~) ;;
3825 *) cat "$f" >> "$ac_dir/Makefile" ;;
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%}"
3841 dnl Postprocesses a Makefile in a directory containing PO files.
3842 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
3844 # When this code is run, in config.status, two variables have already been
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
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" ;;
3864 # Find a way to echo strings without interpreting backslash.
3865 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
3868 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
3869 gt_echo='printf %s\n'
3880 # A sed script that extracts the value of VARIABLE from a Makefile.
3883 # Test if the hold space is empty.
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}"' ]*=//
3896 # Here we are processing a line from the variable definition.
3897 # Remove comment, more precisely replace it with a space.
3899 # See if the line ends in a backslash.
3903 # Print the line, without the trailing backslash.
3906 # There was no trailing backslash. The end of the variable definition is
3907 # reached. Clear the hold space.
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.
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))
3926 for file in $POTFILES; do
3927 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
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"
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"
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"`
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)
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)
3956 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
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
3963 *) srcdirpre='$(srcdir)/' ;;
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"
3987 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3988 # environment variable.
3990 if test -n "$ALL_LINGUAS"; then
3991 for presentlang in $ALL_LINGUAS; do
3993 if test "%UNSET%" != "$LINGUAS"; then
3994 desiredlanguages="$LINGUAS"
3996 desiredlanguages="$ALL_LINGUAS"
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;;
4008 if test $useit = yes; then
4009 INST_LINGUAS="$INST_LINGUAS $presentlang"
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"
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"
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; }
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; }
4054 if test -n "$POMAKEFILEDEPS"; then
4055 cat >> "$ac_file.tmp" <<EOF
4056 Makefile: $POMAKEFILEDEPS
4059 mv "$ac_file.tmp" "$ac_file"
4062 dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
4063 AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
4065 XGETTEXT_EXTRA_OPTIONS=
4068 dnl Registers an option to be passed to xgettext in the po subdirectory.
4069 AC_DEFUN([AM_XGETTEXT_OPTION],
4071 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
4072 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
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.
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
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.
4091 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
4095 # Search path for a program which passes the given test.
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],
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.
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=';'
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
4120 chmod +x conf$$.file
4121 if test -x conf$$.file >/dev/null 2>&1; then
4122 ac_executable_p="test -x"
4124 ac_executable_p="test -f"
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],
4133 [[\\/]]* | ?:[[\\/]]*)
4134 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
4137 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
4138 for ac_dir in ifelse([$5], , $PATH, [$5]); do
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
4145 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
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"
4159 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
4160 AC_MSG_RESULT([$][$1])
4167 m4_include([acinclude.m4])