• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2
3# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_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_c_float_words_bigendian.html
17# ===============================================================================
18#
19# SYNOPSIS
20#
21#   AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
22#
23# DESCRIPTION
24#
25#   Checks the ordering of words within a multi-word float. This check is
26#   necessary because on some systems (e.g. certain ARM systems), the float
27#   word ordering can be different from the byte ordering. In a multi-word
28#   float context, "big-endian" implies that the word containing the sign
29#   bit is found in the memory location with the lowest address. This
30#   implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
31#
32#   The endianness is detected by first compiling C code that contains a
33#   special double float value, then grepping the resulting object file for
34#   certain strings of ASCII values. The double is specially crafted to have
35#   a binary representation that corresponds with a simple string. In this
36#   implementation, the string "noonsees" was selected because the
37#   individual word values ("noon" and "sees") are palindromes, thus making
38#   this test byte-order agnostic. If grep finds the string "noonsees" in
39#   the object file, the target platform stores float words in big-endian
40#   order. If grep finds "seesnoon", float words are in little-endian order.
41#   If neither value is found, the user is instructed to specify the
42#   ordering.
43#
44#   Early versions of this macro (i.e., before serial 12) would not work
45#   when interprocedural optimization (via link-time optimization) was
46#   enabled. This would happen when, say, the GCC/clang "-flto" flag, or the
47#   ICC "-ipo" flag was used, for example. The problem was that under
48#   these conditions, the compiler did not allocate for and write the special
49#   float value in the data segment of the object file, since doing so might
50#   not prove optimal once more context was available. Thus, the special value
51#   (in platform-dependent binary form) could not be found in the object file,
52#   and the macro would fail.
53#
54#   The solution to the above problem was to:
55#
56#     1) Compile and link a whole test program rather than just compile an
57#        object file. This ensures that we reach the point where even an
58#        interprocedural optimizing compiler writes values to the data segment.
59#
60#     2) Add code that requires the compiler to write the special value to
61#        the data segment, as opposed to "optimizing away" the variable's
62#        allocation. This could be done via compiler keywords or options, but
63#        it's tricky to make this work for all versions of all compilers with
64#        all optimization settings. The chosen solution was to make the exit
65#        code of the test program depend on the storing of the special value
66#        in memory (in the data segment). Because the exit code can be
67#        verified, any compiler that aspires to be correct will produce a
68#        program binary that contains the value, which the macro can then find.
69#
70#   How does the exit code depend on the special value residing in memory?
71#   Memory, unlike variables and registers, can be addressed indirectly at run
72#   time. The exit code of this test program is a result of indirectly reading
73#   and writing to the memory region where the special value is supposed to
74#   reside. The actual memory addresses used and the values to be written are
75#   derived from the the program input ("argv") and are therefore not known at
76#   compile or link time. The compiler has no choice but to defer the
77#   computation to run time, and to prepare by allocating and populating the
78#   data segment with the special value. For further details, refer to the
79#   source code of the test program.
80#
81#   Note that the test program is never meant to be run. It only exists to host
82#   a double float value in a given platform's binary format. Thus, error
83#   handling is not included.
84#
85# LICENSE
86#
87#   Copyright (c) 2008, 2023 Daniel Amelang <dan@amelang.net>
88#
89#   Copying and distribution of this file, with or without modification, are
90#   permitted in any medium without royalty provided the copyright notice
91#   and this notice are preserved. This file is offered as-is, without any
92#   warranty.
93
94#serial 12
95
96AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
97  [AC_CACHE_CHECK(whether float word ordering is bigendian,
98                  ax_cv_c_float_words_bigendian, [
99
100ax_cv_c_float_words_bigendian=unknown
101AC_LINK_IFELSE([AC_LANG_SOURCE([[
102
103#include <stdlib.h>
104
105static double m[] = {9.090423496703681e+223, 0.0};
106
107int main (int argc, char *argv[])
108{
109    m[atoi (argv[1])] += atof (argv[2]);
110    return m[atoi (argv[3])] > 0.0;
111}
112
113]])], [
114
115if grep noonsees conftest$EXEEXT >/dev/null ; then
116  ax_cv_c_float_words_bigendian=yes
117fi
118if grep seesnoon conftest$EXEEXT >/dev/null ; then
119  if test "$ax_cv_c_float_words_bigendian" = unknown; then
120    ax_cv_c_float_words_bigendian=no
121  else
122    ax_cv_c_float_words_bigendian=unknown
123  fi
124fi
125
126])])
127
128case $ax_cv_c_float_words_bigendian in
129  yes)
130    m4_default([$1],
131      [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
132                 [Define to 1 if your system stores words within floats
133                  with the most significant word first])]) ;;
134  no)
135    $2 ;;
136  *)
137    m4_default([$3],
138      [AC_MSG_ERROR([
139
140Unknown float word ordering. You need to manually preset
141ax_cv_c_float_words_bigendian=no (or yes) according to your system.
142
143    ])]) ;;
144esac
145
146])# AX_C_FLOAT_WORDS_BIGENDIAN
147
148# ===========================================================================
149#  https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
150# ===========================================================================
151#
152# SYNOPSIS
153#
154#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
155#
156# DESCRIPTION
157#
158#   Check whether the given FLAG works with the current language's compiler
159#   or gives an error.  (Warnings, however, are ignored)
160#
161#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
162#   success/failure.
163#
164#   If EXTRA-FLAGS is defined, it is added to the current language's default
165#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
166#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
167#   force the compiler to issue an error when a bad flag is given.
168#
169#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
170#
171#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
172#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
173#
174# LICENSE
175#
176#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
177#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
178#
179#   Copying and distribution of this file, with or without modification, are
180#   permitted in any medium without royalty provided the copyright notice
181#   and this notice are preserved.  This file is offered as-is, without any
182#   warranty.
183
184#serial 6
185
186AC_DEFUN([AX_CHECK_COMPILE_FLAG],
187[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
188AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
189AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
190  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
191  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
192  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
193    [AS_VAR_SET(CACHEVAR,[yes])],
194    [AS_VAR_SET(CACHEVAR,[no])])
195  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
196AS_VAR_IF(CACHEVAR,yes,
197  [m4_default([$2], :)],
198  [m4_default([$3], :)])
199AS_VAR_POPDEF([CACHEVAR])dnl
200])dnl AX_CHECK_COMPILE_FLAGS
201
202# ===========================================================================
203#     https://www.gnu.org/software/autoconf-archive/ax_check_define.html
204# ===========================================================================
205#
206# SYNOPSIS
207#
208#   AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
209#   AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
210#
211# DESCRIPTION
212#
213#   Complements AC_CHECK_FUNC but it does not check for a function but for a
214#   define to exist. Consider a usage like:
215#
216#    AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500")
217#
218# LICENSE
219#
220#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
221#
222#   Copying and distribution of this file, with or without modification, are
223#   permitted in any medium without royalty provided the copyright notice
224#   and this notice are preserved.  This file is offered as-is, without any
225#   warranty.
226
227#serial 11
228
229AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
230AC_DEFUN([AC_CHECK_DEFINE],[
231AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl
232AC_CACHE_CHECK([for $1 defined], ac_var,
233AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
234  #ifdef $1
235  int ok;
236  (void)ok;
237  #else
238  choke me
239  #endif
240]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
241AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl
242AS_VAR_POPDEF([ac_var])dnl
243])
244
245AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE])
246AC_DEFUN([AX_CHECK_DEFINE],[
247AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl
248AC_CACHE_CHECK([for $2 defined in $1], ac_var,
249AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
250  #ifdef $2
251  int ok;
252  (void)ok;
253  #else
254  choke me
255  #endif
256]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
257AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl
258AS_VAR_POPDEF([ac_var])dnl
259])
260
261AC_DEFUN([AX_CHECK_FUNC],
262[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl
263AC_CACHE_CHECK([for $2], ac_var,
264dnl AC_LANG_FUNC_LINK_TRY
265[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1
266                #undef $2
267                char $2 ();],[
268                char (*f) () = $2;
269                return f != $2; ])],
270                [AS_VAR_SET(ac_var, yes)],
271                [AS_VAR_SET(ac_var, no)])])
272AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
273AS_VAR_POPDEF([ac_var])dnl
274])# AC_CHECK_FUNC
275
276# ===========================================================================
277#     https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
278# ===========================================================================
279#
280# SYNOPSIS
281#
282#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
283#
284# DESCRIPTION
285#
286#   Look for OpenSSL in a number of default spots, or in a user-selected
287#   spot (via --with-openssl).  Sets
288#
289#     OPENSSL_INCLUDES to the include directives required
290#     OPENSSL_LIBS to the -l directives required
291#     OPENSSL_LDFLAGS to the -L or -R flags required
292#
293#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
294#
295#   This macro sets OPENSSL_INCLUDES such that source files should use the
296#   openssl/ directory in include directives:
297#
298#     #include <openssl/hmac.h>
299#
300# LICENSE
301#
302#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
303#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
304#
305#   Copying and distribution of this file, with or without modification, are
306#   permitted in any medium without royalty provided the copyright notice
307#   and this notice are preserved. This file is offered as-is, without any
308#   warranty.
309
310#serial 11
311
312AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
313AC_DEFUN([AX_CHECK_OPENSSL], [
314    found=false
315    AC_ARG_WITH([openssl],
316        [AS_HELP_STRING([--with-openssl=DIR],
317            [root of the OpenSSL directory])],
318        [
319            case "$withval" in
320            "" | y | ye | yes | n | no)
321            AC_MSG_ERROR([Invalid --with-openssl value])
322              ;;
323            *) ssldirs="$withval"
324              ;;
325            esac
326        ], [
327            # if pkg-config is installed and openssl has installed a .pc file,
328            # then use that information and don't search ssldirs
329            AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
330            if test x"$PKG_CONFIG" != x""; then
331                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
332                if test $? = 0; then
333                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
334                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
335                    found=true
336                fi
337            fi
338
339            # no such luck; use some default ssldirs
340            if ! $found; then
341                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
342            fi
343        ]
344        )
345
346
347    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
348    # an 'openssl' subdirectory
349
350    if ! $found; then
351        OPENSSL_INCLUDES=
352        for ssldir in $ssldirs; do
353            AC_MSG_CHECKING([for include/openssl/ssl.h in $ssldir])
354            if test -f "$ssldir/include/openssl/ssl.h"; then
355                OPENSSL_INCLUDES="-I$ssldir/include"
356                OPENSSL_LDFLAGS="-L$ssldir/lib"
357                OPENSSL_LIBS="-lssl -lcrypto"
358                found=true
359                AC_MSG_RESULT([yes])
360                break
361            else
362                AC_MSG_RESULT([no])
363            fi
364        done
365
366        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
367        # it will just work!
368    fi
369
370    # try the preprocessor and linker with our new flags,
371    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
372
373    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
374    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
375        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
376
377    save_LIBS="$LIBS"
378    save_LDFLAGS="$LDFLAGS"
379    save_CPPFLAGS="$CPPFLAGS"
380    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
381    LIBS="$OPENSSL_LIBS $LIBS"
382    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
383    AC_LINK_IFELSE(
384        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
385        [
386            AC_MSG_RESULT([yes])
387            $1
388        ], [
389            AC_MSG_RESULT([no])
390            $2
391        ])
392    CPPFLAGS="$save_CPPFLAGS"
393    LDFLAGS="$save_LDFLAGS"
394    LIBS="$save_LIBS"
395
396    AC_SUBST([OPENSSL_INCLUDES])
397    AC_SUBST([OPENSSL_LIBS])
398    AC_SUBST([OPENSSL_LDFLAGS])
399])
400
401# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
402# serial 12 (pkg-config-0.29.2)
403
404dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
405dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
406dnl
407dnl This program is free software; you can redistribute it and/or modify
408dnl it under the terms of the GNU General Public License as published by
409dnl the Free Software Foundation; either version 2 of the License, or
410dnl (at your option) any later version.
411dnl
412dnl This program is distributed in the hope that it will be useful, but
413dnl WITHOUT ANY WARRANTY; without even the implied warranty of
414dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
415dnl General Public License for more details.
416dnl
417dnl You should have received a copy of the GNU General Public License
418dnl along with this program; if not, write to the Free Software
419dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
420dnl 02111-1307, USA.
421dnl
422dnl As a special exception to the GNU General Public License, if you
423dnl distribute this file as part of a program that contains a
424dnl configuration script generated by Autoconf, you may include it under
425dnl the same distribution terms that you use for the rest of that
426dnl program.
427
428dnl PKG_PREREQ(MIN-VERSION)
429dnl -----------------------
430dnl Since: 0.29
431dnl
432dnl Verify that the version of the pkg-config macros are at least
433dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
434dnl installed version of pkg-config, this checks the developer's version
435dnl of pkg.m4 when generating configure.
436dnl
437dnl To ensure that this macro is defined, also add:
438dnl m4_ifndef([PKG_PREREQ],
439dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
440dnl
441dnl See the "Since" comment for each macro you use to see what version
442dnl of the macros you require.
443m4_defun([PKG_PREREQ],
444[m4_define([PKG_MACROS_VERSION], [0.29.2])
445m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
446    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
447])dnl PKG_PREREQ
448
449dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
450dnl ----------------------------------
451dnl Since: 0.16
452dnl
453dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
454dnl first found in the path. Checks that the version of pkg-config found
455dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
456dnl used since that's the first version where most current features of
457dnl pkg-config existed.
458AC_DEFUN([PKG_PROG_PKG_CONFIG],
459[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
460m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
461m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
462AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
463AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
464AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
465
466if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
467	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
468fi
469if test -n "$PKG_CONFIG"; then
470	_pkg_min_version=m4_default([$1], [0.9.0])
471	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
472	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
473		AC_MSG_RESULT([yes])
474	else
475		AC_MSG_RESULT([no])
476		PKG_CONFIG=""
477	fi
478fi[]dnl
479])dnl PKG_PROG_PKG_CONFIG
480
481dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
482dnl -------------------------------------------------------------------
483dnl Since: 0.18
484dnl
485dnl Check to see whether a particular set of modules exists. Similar to
486dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
487dnl
488dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
489dnl only at the first occurence in configure.ac, so if the first place
490dnl it's called might be skipped (such as if it is within an "if", you
491dnl have to call PKG_CHECK_EXISTS manually
492AC_DEFUN([PKG_CHECK_EXISTS],
493[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
494if test -n "$PKG_CONFIG" && \
495    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
496  m4_default([$2], [:])
497m4_ifvaln([$3], [else
498  $3])dnl
499fi])
500
501dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
502dnl ---------------------------------------------
503dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
504dnl pkg_failed based on the result.
505m4_define([_PKG_CONFIG],
506[if test -n "$$1"; then
507    pkg_cv_[]$1="$$1"
508 elif test -n "$PKG_CONFIG"; then
509    PKG_CHECK_EXISTS([$3],
510                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
511		      test "x$?" != "x0" && pkg_failed=yes ],
512		     [pkg_failed=yes])
513 else
514    pkg_failed=untried
515fi[]dnl
516])dnl _PKG_CONFIG
517
518dnl _PKG_SHORT_ERRORS_SUPPORTED
519dnl ---------------------------
520dnl Internal check to see if pkg-config supports short errors.
521AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
522[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
523if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
524        _pkg_short_errors_supported=yes
525else
526        _pkg_short_errors_supported=no
527fi[]dnl
528])dnl _PKG_SHORT_ERRORS_SUPPORTED
529
530
531dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
532dnl   [ACTION-IF-NOT-FOUND])
533dnl --------------------------------------------------------------
534dnl Since: 0.4.0
535dnl
536dnl Note that if there is a possibility the first call to
537dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
538dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
539AC_DEFUN([PKG_CHECK_MODULES],
540[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
541AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
542AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
543
544pkg_failed=no
545AC_MSG_CHECKING([for $2])
546
547_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
548_PKG_CONFIG([$1][_LIBS], [libs], [$2])
549
550m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
551and $1[]_LIBS to avoid the need to call pkg-config.
552See the pkg-config man page for more details.])
553
554if test $pkg_failed = yes; then
555        AC_MSG_RESULT([no])
556        _PKG_SHORT_ERRORS_SUPPORTED
557        if test $_pkg_short_errors_supported = yes; then
558	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
559        else
560	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
561        fi
562	# Put the nasty error message in config.log where it belongs
563	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
564
565	m4_default([$4], [AC_MSG_ERROR(
566[Package requirements ($2) were not met:
567
568$$1_PKG_ERRORS
569
570Consider adjusting the PKG_CONFIG_PATH environment variable if you
571installed software in a non-standard prefix.
572
573_PKG_TEXT])[]dnl
574        ])
575elif test $pkg_failed = untried; then
576        AC_MSG_RESULT([no])
577	m4_default([$4], [AC_MSG_FAILURE(
578[The pkg-config script could not be found or is too old.  Make sure it
579is in your PATH or set the PKG_CONFIG environment variable to the full
580path to pkg-config.
581
582_PKG_TEXT
583
584To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
585        ])
586else
587	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
588	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
589        AC_MSG_RESULT([yes])
590	$3
591fi[]dnl
592])dnl PKG_CHECK_MODULES
593
594
595dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
596dnl   [ACTION-IF-NOT-FOUND])
597dnl ---------------------------------------------------------------------
598dnl Since: 0.29
599dnl
600dnl Checks for existence of MODULES and gathers its build flags with
601dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
602dnl and VARIABLE-PREFIX_LIBS from --libs.
603dnl
604dnl Note that if there is a possibility the first call to
605dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
606dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
607dnl configure.ac.
608AC_DEFUN([PKG_CHECK_MODULES_STATIC],
609[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
610_save_PKG_CONFIG=$PKG_CONFIG
611PKG_CONFIG="$PKG_CONFIG --static"
612PKG_CHECK_MODULES($@)
613PKG_CONFIG=$_save_PKG_CONFIG[]dnl
614])dnl PKG_CHECK_MODULES_STATIC
615
616
617dnl PKG_INSTALLDIR([DIRECTORY])
618dnl -------------------------
619dnl Since: 0.27
620dnl
621dnl Substitutes the variable pkgconfigdir as the location where a module
622dnl should install pkg-config .pc files. By default the directory is
623dnl $libdir/pkgconfig, but the default can be changed by passing
624dnl DIRECTORY. The user can override through the --with-pkgconfigdir
625dnl parameter.
626AC_DEFUN([PKG_INSTALLDIR],
627[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
628m4_pushdef([pkg_description],
629    [pkg-config installation directory @<:@]pkg_default[@:>@])
630AC_ARG_WITH([pkgconfigdir],
631    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
632    [with_pkgconfigdir=]pkg_default)
633AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
634m4_popdef([pkg_default])
635m4_popdef([pkg_description])
636])dnl PKG_INSTALLDIR
637
638
639dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
640dnl --------------------------------
641dnl Since: 0.27
642dnl
643dnl Substitutes the variable noarch_pkgconfigdir as the location where a
644dnl module should install arch-independent pkg-config .pc files. By
645dnl default the directory is $datadir/pkgconfig, but the default can be
646dnl changed by passing DIRECTORY. The user can override through the
647dnl --with-noarch-pkgconfigdir parameter.
648AC_DEFUN([PKG_NOARCH_INSTALLDIR],
649[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
650m4_pushdef([pkg_description],
651    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
652AC_ARG_WITH([noarch-pkgconfigdir],
653    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
654    [with_noarch_pkgconfigdir=]pkg_default)
655AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
656m4_popdef([pkg_default])
657m4_popdef([pkg_description])
658])dnl PKG_NOARCH_INSTALLDIR
659
660
661dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
662dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
663dnl -------------------------------------------
664dnl Since: 0.28
665dnl
666dnl Retrieves the value of the pkg-config variable for the given module.
667AC_DEFUN([PKG_CHECK_VAR],
668[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
669AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
670
671_PKG_CONFIG([$1], [variable="][$3]["], [$2])
672AS_VAR_COPY([$1], [pkg_cv_][$1])
673
674AS_VAR_IF([$1], [""], [$5], [$4])dnl
675])dnl PKG_CHECK_VAR
676
677# AM_CONDITIONAL                                            -*- Autoconf -*-
678
679# Copyright (C) 1997-2021 Free Software Foundation, Inc.
680#
681# This file is free software; the Free Software Foundation
682# gives unlimited permission to copy and/or distribute it,
683# with or without modifications, as long as this notice is preserved.
684
685# AM_CONDITIONAL(NAME, SHELL-CONDITION)
686# -------------------------------------
687# Define a conditional.
688AC_DEFUN([AM_CONDITIONAL],
689[AC_PREREQ([2.52])dnl
690 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
691       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
692AC_SUBST([$1_TRUE])dnl
693AC_SUBST([$1_FALSE])dnl
694_AM_SUBST_NOTMAKE([$1_TRUE])dnl
695_AM_SUBST_NOTMAKE([$1_FALSE])dnl
696m4_define([_AM_COND_VALUE_$1], [$2])dnl
697if $2; then
698  $1_TRUE=
699  $1_FALSE='#'
700else
701  $1_TRUE='#'
702  $1_FALSE=
703fi
704AC_CONFIG_COMMANDS_PRE(
705[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
706  AC_MSG_ERROR([[conditional "$1" was never defined.
707Usually this means the macro was only invoked conditionally.]])
708fi])])
709
710# Copyright (C) 2006-2021 Free Software Foundation, Inc.
711#
712# This file is free software; the Free Software Foundation
713# gives unlimited permission to copy and/or distribute it,
714# with or without modifications, as long as this notice is preserved.
715
716# _AM_SUBST_NOTMAKE(VARIABLE)
717# ---------------------------
718# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
719# This macro is traced by Automake.
720AC_DEFUN([_AM_SUBST_NOTMAKE])
721
722# AM_SUBST_NOTMAKE(VARIABLE)
723# --------------------------
724# Public sister of _AM_SUBST_NOTMAKE.
725AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
726
727