• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
2
3# Copyright (C) 1996-2020 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# LICENSE
45#
46#   Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
47#
48#   Copying and distribution of this file, with or without modification, are
49#   permitted in any medium without royalty provided the copyright notice
50#   and this notice are preserved. This file is offered as-is, without any
51#   warranty.
52
53#serial 11
54
55AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
56  [AC_CACHE_CHECK(whether float word ordering is bigendian,
57                  ax_cv_c_float_words_bigendian, [
58
59ax_cv_c_float_words_bigendian=unknown
60AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
61
62double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
63
64]])], [
65
66if grep noonsees conftest.$ac_objext >/dev/null ; then
67  ax_cv_c_float_words_bigendian=yes
68fi
69if grep seesnoon conftest.$ac_objext >/dev/null ; then
70  if test "$ax_cv_c_float_words_bigendian" = unknown; then
71    ax_cv_c_float_words_bigendian=no
72  else
73    ax_cv_c_float_words_bigendian=unknown
74  fi
75fi
76
77])])
78
79case $ax_cv_c_float_words_bigendian in
80  yes)
81    m4_default([$1],
82      [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
83                 [Define to 1 if your system stores words within floats
84                  with the most significant word first])]) ;;
85  no)
86    $2 ;;
87  *)
88    m4_default([$3],
89      [AC_MSG_ERROR([
90
91Unknown float word ordering. You need to manually preset
92ax_cv_c_float_words_bigendian=no (or yes) according to your system.
93
94    ])]) ;;
95esac
96
97])# AX_C_FLOAT_WORDS_BIGENDIAN
98
99# ===========================================================================
100#  https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
101# ===========================================================================
102#
103# SYNOPSIS
104#
105#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
106#
107# DESCRIPTION
108#
109#   Check whether the given FLAG works with the current language's compiler
110#   or gives an error.  (Warnings, however, are ignored)
111#
112#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
113#   success/failure.
114#
115#   If EXTRA-FLAGS is defined, it is added to the current language's default
116#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
117#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
118#   force the compiler to issue an error when a bad flag is given.
119#
120#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
121#
122#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
123#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
124#
125# LICENSE
126#
127#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
128#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
129#
130#   Copying and distribution of this file, with or without modification, are
131#   permitted in any medium without royalty provided the copyright notice
132#   and this notice are preserved.  This file is offered as-is, without any
133#   warranty.
134
135#serial 6
136
137AC_DEFUN([AX_CHECK_COMPILE_FLAG],
138[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
139AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
140AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
141  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
142  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
143  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
144    [AS_VAR_SET(CACHEVAR,[yes])],
145    [AS_VAR_SET(CACHEVAR,[no])])
146  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
147AS_VAR_IF(CACHEVAR,yes,
148  [m4_default([$2], :)],
149  [m4_default([$3], :)])
150AS_VAR_POPDEF([CACHEVAR])dnl
151])dnl AX_CHECK_COMPILE_FLAGS
152
153# ===========================================================================
154#     https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
155# ===========================================================================
156#
157# SYNOPSIS
158#
159#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
160#
161# DESCRIPTION
162#
163#   Look for OpenSSL in a number of default spots, or in a user-selected
164#   spot (via --with-openssl).  Sets
165#
166#     OPENSSL_INCLUDES to the include directives required
167#     OPENSSL_LIBS to the -l directives required
168#     OPENSSL_LDFLAGS to the -L or -R flags required
169#
170#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
171#
172#   This macro sets OPENSSL_INCLUDES such that source files should use the
173#   openssl/ directory in include directives:
174#
175#     #include <openssl/hmac.h>
176#
177# LICENSE
178#
179#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
180#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
181#
182#   Copying and distribution of this file, with or without modification, are
183#   permitted in any medium without royalty provided the copyright notice
184#   and this notice are preserved. This file is offered as-is, without any
185#   warranty.
186
187#serial 10
188
189AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
190AC_DEFUN([AX_CHECK_OPENSSL], [
191    found=false
192    AC_ARG_WITH([openssl],
193        [AS_HELP_STRING([--with-openssl=DIR],
194            [root of the OpenSSL directory])],
195        [
196            case "$withval" in
197            "" | y | ye | yes | n | no)
198            AC_MSG_ERROR([Invalid --with-openssl value])
199              ;;
200            *) ssldirs="$withval"
201              ;;
202            esac
203        ], [
204            # if pkg-config is installed and openssl has installed a .pc file,
205            # then use that information and don't search ssldirs
206            AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
207            if test x"$PKG_CONFIG" != x""; then
208                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
209                if test $? = 0; then
210                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
211                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
212                    found=true
213                fi
214            fi
215
216            # no such luck; use some default ssldirs
217            if ! $found; then
218                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
219            fi
220        ]
221        )
222
223
224    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
225    # an 'openssl' subdirectory
226
227    if ! $found; then
228        OPENSSL_INCLUDES=
229        for ssldir in $ssldirs; do
230            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
231            if test -f "$ssldir/include/openssl/ssl.h"; then
232                OPENSSL_INCLUDES="-I$ssldir/include"
233                OPENSSL_LDFLAGS="-L$ssldir/lib"
234                OPENSSL_LIBS="-lssl -lcrypto"
235                found=true
236                AC_MSG_RESULT([yes])
237                break
238            else
239                AC_MSG_RESULT([no])
240            fi
241        done
242
243        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
244        # it will just work!
245    fi
246
247    # try the preprocessor and linker with our new flags,
248    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
249
250    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
251    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
252        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
253
254    save_LIBS="$LIBS"
255    save_LDFLAGS="$LDFLAGS"
256    save_CPPFLAGS="$CPPFLAGS"
257    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
258    LIBS="$OPENSSL_LIBS $LIBS"
259    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
260    AC_LINK_IFELSE(
261        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
262        [
263            AC_MSG_RESULT([yes])
264            $1
265        ], [
266            AC_MSG_RESULT([no])
267            $2
268        ])
269    CPPFLAGS="$save_CPPFLAGS"
270    LDFLAGS="$save_LDFLAGS"
271    LIBS="$save_LIBS"
272
273    AC_SUBST([OPENSSL_INCLUDES])
274    AC_SUBST([OPENSSL_LIBS])
275    AC_SUBST([OPENSSL_LDFLAGS])
276])
277
278# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
279# serial 11 (pkg-config-0.29.1)
280
281dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
282dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
283dnl
284dnl This program is free software; you can redistribute it and/or modify
285dnl it under the terms of the GNU General Public License as published by
286dnl the Free Software Foundation; either version 2 of the License, or
287dnl (at your option) any later version.
288dnl
289dnl This program is distributed in the hope that it will be useful, but
290dnl WITHOUT ANY WARRANTY; without even the implied warranty of
291dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
292dnl General Public License for more details.
293dnl
294dnl You should have received a copy of the GNU General Public License
295dnl along with this program; if not, write to the Free Software
296dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
297dnl 02111-1307, USA.
298dnl
299dnl As a special exception to the GNU General Public License, if you
300dnl distribute this file as part of a program that contains a
301dnl configuration script generated by Autoconf, you may include it under
302dnl the same distribution terms that you use for the rest of that
303dnl program.
304
305dnl PKG_PREREQ(MIN-VERSION)
306dnl -----------------------
307dnl Since: 0.29
308dnl
309dnl Verify that the version of the pkg-config macros are at least
310dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
311dnl installed version of pkg-config, this checks the developer's version
312dnl of pkg.m4 when generating configure.
313dnl
314dnl To ensure that this macro is defined, also add:
315dnl m4_ifndef([PKG_PREREQ],
316dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
317dnl
318dnl See the "Since" comment for each macro you use to see what version
319dnl of the macros you require.
320m4_defun([PKG_PREREQ],
321[m4_define([PKG_MACROS_VERSION], [0.29.1])
322m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
323    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
324])dnl PKG_PREREQ
325
326dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
327dnl ----------------------------------
328dnl Since: 0.16
329dnl
330dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
331dnl first found in the path. Checks that the version of pkg-config found
332dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
333dnl used since that's the first version where most current features of
334dnl pkg-config existed.
335AC_DEFUN([PKG_PROG_PKG_CONFIG],
336[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
337m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
338m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
339AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
340AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
341AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
342
343if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
344	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
345fi
346if test -n "$PKG_CONFIG"; then
347	_pkg_min_version=m4_default([$1], [0.9.0])
348	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
349	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
350		AC_MSG_RESULT([yes])
351	else
352		AC_MSG_RESULT([no])
353		PKG_CONFIG=""
354	fi
355fi[]dnl
356])dnl PKG_PROG_PKG_CONFIG
357
358dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
359dnl -------------------------------------------------------------------
360dnl Since: 0.18
361dnl
362dnl Check to see whether a particular set of modules exists. Similar to
363dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
364dnl
365dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
366dnl only at the first occurence in configure.ac, so if the first place
367dnl it's called might be skipped (such as if it is within an "if", you
368dnl have to call PKG_CHECK_EXISTS manually
369AC_DEFUN([PKG_CHECK_EXISTS],
370[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
371if test -n "$PKG_CONFIG" && \
372    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
373  m4_default([$2], [:])
374m4_ifvaln([$3], [else
375  $3])dnl
376fi])
377
378dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
379dnl ---------------------------------------------
380dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
381dnl pkg_failed based on the result.
382m4_define([_PKG_CONFIG],
383[if test -n "$$1"; then
384    pkg_cv_[]$1="$$1"
385 elif test -n "$PKG_CONFIG"; then
386    PKG_CHECK_EXISTS([$3],
387                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
388		      test "x$?" != "x0" && pkg_failed=yes ],
389		     [pkg_failed=yes])
390 else
391    pkg_failed=untried
392fi[]dnl
393])dnl _PKG_CONFIG
394
395dnl _PKG_SHORT_ERRORS_SUPPORTED
396dnl ---------------------------
397dnl Internal check to see if pkg-config supports short errors.
398AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
399[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
400if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
401        _pkg_short_errors_supported=yes
402else
403        _pkg_short_errors_supported=no
404fi[]dnl
405])dnl _PKG_SHORT_ERRORS_SUPPORTED
406
407
408dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
409dnl   [ACTION-IF-NOT-FOUND])
410dnl --------------------------------------------------------------
411dnl Since: 0.4.0
412dnl
413dnl Note that if there is a possibility the first call to
414dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
415dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
416AC_DEFUN([PKG_CHECK_MODULES],
417[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
418AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
419AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
420
421pkg_failed=no
422AC_MSG_CHECKING([for $1])
423
424_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
425_PKG_CONFIG([$1][_LIBS], [libs], [$2])
426
427m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
428and $1[]_LIBS to avoid the need to call pkg-config.
429See the pkg-config man page for more details.])
430
431if test $pkg_failed = yes; then
432   	AC_MSG_RESULT([no])
433        _PKG_SHORT_ERRORS_SUPPORTED
434        if test $_pkg_short_errors_supported = yes; then
435	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
436        else
437	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
438        fi
439	# Put the nasty error message in config.log where it belongs
440	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
441
442	m4_default([$4], [AC_MSG_ERROR(
443[Package requirements ($2) were not met:
444
445$$1_PKG_ERRORS
446
447Consider adjusting the PKG_CONFIG_PATH environment variable if you
448installed software in a non-standard prefix.
449
450_PKG_TEXT])[]dnl
451        ])
452elif test $pkg_failed = untried; then
453     	AC_MSG_RESULT([no])
454	m4_default([$4], [AC_MSG_FAILURE(
455[The pkg-config script could not be found or is too old.  Make sure it
456is in your PATH or set the PKG_CONFIG environment variable to the full
457path to pkg-config.
458
459_PKG_TEXT
460
461To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
462        ])
463else
464	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
465	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
466        AC_MSG_RESULT([yes])
467	$3
468fi[]dnl
469])dnl PKG_CHECK_MODULES
470
471
472dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
473dnl   [ACTION-IF-NOT-FOUND])
474dnl ---------------------------------------------------------------------
475dnl Since: 0.29
476dnl
477dnl Checks for existence of MODULES and gathers its build flags with
478dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
479dnl and VARIABLE-PREFIX_LIBS from --libs.
480dnl
481dnl Note that if there is a possibility the first call to
482dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
483dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
484dnl configure.ac.
485AC_DEFUN([PKG_CHECK_MODULES_STATIC],
486[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
487_save_PKG_CONFIG=$PKG_CONFIG
488PKG_CONFIG="$PKG_CONFIG --static"
489PKG_CHECK_MODULES($@)
490PKG_CONFIG=$_save_PKG_CONFIG[]dnl
491])dnl PKG_CHECK_MODULES_STATIC
492
493
494dnl PKG_INSTALLDIR([DIRECTORY])
495dnl -------------------------
496dnl Since: 0.27
497dnl
498dnl Substitutes the variable pkgconfigdir as the location where a module
499dnl should install pkg-config .pc files. By default the directory is
500dnl $libdir/pkgconfig, but the default can be changed by passing
501dnl DIRECTORY. The user can override through the --with-pkgconfigdir
502dnl parameter.
503AC_DEFUN([PKG_INSTALLDIR],
504[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
505m4_pushdef([pkg_description],
506    [pkg-config installation directory @<:@]pkg_default[@:>@])
507AC_ARG_WITH([pkgconfigdir],
508    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
509    [with_pkgconfigdir=]pkg_default)
510AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
511m4_popdef([pkg_default])
512m4_popdef([pkg_description])
513])dnl PKG_INSTALLDIR
514
515
516dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
517dnl --------------------------------
518dnl Since: 0.27
519dnl
520dnl Substitutes the variable noarch_pkgconfigdir as the location where a
521dnl module should install arch-independent pkg-config .pc files. By
522dnl default the directory is $datadir/pkgconfig, but the default can be
523dnl changed by passing DIRECTORY. The user can override through the
524dnl --with-noarch-pkgconfigdir parameter.
525AC_DEFUN([PKG_NOARCH_INSTALLDIR],
526[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
527m4_pushdef([pkg_description],
528    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
529AC_ARG_WITH([noarch-pkgconfigdir],
530    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
531    [with_noarch_pkgconfigdir=]pkg_default)
532AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
533m4_popdef([pkg_default])
534m4_popdef([pkg_description])
535])dnl PKG_NOARCH_INSTALLDIR
536
537
538dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
539dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
540dnl -------------------------------------------
541dnl Since: 0.28
542dnl
543dnl Retrieves the value of the pkg-config variable for the given module.
544AC_DEFUN([PKG_CHECK_VAR],
545[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
546AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
547
548_PKG_CONFIG([$1], [variable="][$3]["], [$2])
549AS_VAR_COPY([$1], [pkg_cv_][$1])
550
551AS_VAR_IF([$1], [""], [$5], [$4])dnl
552])dnl PKG_CHECK_VAR
553
554dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
555dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
556dnl   [DESCRIPTION], [DEFAULT])
557dnl ------------------------------------------
558dnl
559dnl Prepare a "--with-" configure option using the lowercase
560dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
561dnl PKG_CHECK_MODULES in a single macro.
562AC_DEFUN([PKG_WITH_MODULES],
563[
564m4_pushdef([with_arg], m4_tolower([$1]))
565
566m4_pushdef([description],
567           [m4_default([$5], [build with ]with_arg[ support])])
568
569m4_pushdef([def_arg], [m4_default([$6], [auto])])
570m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
571m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
572
573m4_case(def_arg,
574            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
575            [m4_pushdef([with_without],[--with-]with_arg)])
576
577AC_ARG_WITH(with_arg,
578     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
579    [AS_TR_SH([with_]with_arg)=def_arg])
580
581AS_CASE([$AS_TR_SH([with_]with_arg)],
582            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
583            [auto],[PKG_CHECK_MODULES([$1],[$2],
584                                        [m4_n([def_action_if_found]) $3],
585                                        [m4_n([def_action_if_not_found]) $4])])
586
587m4_popdef([with_arg])
588m4_popdef([description])
589m4_popdef([def_arg])
590
591])dnl PKG_WITH_MODULES
592
593dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
594dnl   [DESCRIPTION], [DEFAULT])
595dnl -----------------------------------------------
596dnl
597dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
598dnl check._[VARIABLE-PREFIX] is exported as make variable.
599AC_DEFUN([PKG_HAVE_WITH_MODULES],
600[
601PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
602
603AM_CONDITIONAL([HAVE_][$1],
604               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
605])dnl PKG_HAVE_WITH_MODULES
606
607dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
608dnl   [DESCRIPTION], [DEFAULT])
609dnl ------------------------------------------------------
610dnl
611dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
612dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
613dnl and preprocessor variable.
614AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
615[
616PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
617
618AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
619        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
620])dnl PKG_HAVE_DEFINE_WITH_MODULES
621
622