@@ -2116,9 +2116,9 @@ AC_DEFUN([AM_NLS],
21162116 AC_SUBST ( [ USE_NLS] )
21172117] )
21182118
2119- dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
2120- dnl serial 11 (pkg-config-0.29.1)
2121- dnl
2119+ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
2120+ # serial 11 (pkg-config-0.29.1)
2121+
21222122dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
21232123dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
21242124dnl
@@ -2392,6 +2392,74 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
23922392AS_VAR_IF ( [ $1 ] , [ ""] , [ $5 ] , [ $4 ] ) dnl
23932393] ) dnl PKG_CHECK_VAR
23942394
2395+ dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
2396+ dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
2397+ dnl [DESCRIPTION], [DEFAULT])
2398+ dnl ------------------------------------------
2399+ dnl
2400+ dnl Prepare a "--with-" configure option using the lowercase
2401+ dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
2402+ dnl PKG_CHECK_MODULES in a single macro.
2403+ AC_DEFUN ( [ PKG_WITH_MODULES] ,
2404+ [
2405+ m4_pushdef ( [ with_arg] , m4_tolower ( [ $1 ] ) )
2406+
2407+ m4_pushdef ( [ description] ,
2408+ [ m4_default ( [ $5 ] , [ build with ] with_arg [ support] ) ] )
2409+
2410+ m4_pushdef ( [ def_arg] , [ m4_default ( [ $6 ] , [ auto] ) ] )
2411+ m4_pushdef ( [ def_action_if_found] , [ AS_TR_SH ( [ with_] with_arg ) =yes] )
2412+ m4_pushdef ( [ def_action_if_not_found] , [ AS_TR_SH ( [ with_] with_arg ) =no] )
2413+
2414+ m4_case ( def_arg ,
2415+ [ yes] ,[ m4_pushdef ( [ with_without] , [ --without-] with_arg ) ] ,
2416+ [ m4_pushdef ( [ with_without] ,[ --with-] with_arg ) ] )
2417+
2418+ AC_ARG_WITH ( with_arg ,
2419+ AS_HELP_STRING ( with_without , description [ @<:@ default=] def_arg [ @:>@ ] ) ,,
2420+ [ AS_TR_SH ( [ with_] with_arg ) =def_arg] )
2421+
2422+ AS_CASE ( [ $AS_TR_SH ( [ with_] with_arg ) ] ,
2423+ [ yes] ,[ PKG_CHECK_MODULES([ $1 ] ,[ $2 ] ,$3 ,$4 )] ,
2424+ [ auto] ,[ PKG_CHECK_MODULES([ $1 ] ,[ $2 ] ,
2425+ [ m4_n ( [ def_action_if_found] ) $3 ] ,
2426+ [ m4_n ( [ def_action_if_not_found] ) $4 ] )] )
2427+
2428+ m4_popdef ( [ with_arg] )
2429+ m4_popdef ( [ description] )
2430+ m4_popdef ( [ def_arg] )
2431+
2432+ ] ) dnl PKG_WITH_MODULES
2433+
2434+ dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
2435+ dnl [DESCRIPTION], [DEFAULT])
2436+ dnl -----------------------------------------------
2437+ dnl
2438+ dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
2439+ dnl check._[VARIABLE-PREFIX] is exported as make variable.
2440+ AC_DEFUN ( [ PKG_HAVE_WITH_MODULES] ,
2441+ [
2442+ PKG_WITH_MODULES([ $1 ] ,[ $2 ] ,,,[ $3 ] ,[ $4 ] )
2443+
2444+ AM_CONDITIONAL([ HAVE_] [ $1 ] ,
2445+ [ test "$AS_TR_SH ( [ with_] m4_tolower ( [ $1 ] ) ) " = "yes"] )
2446+ ] ) dnl PKG_HAVE_WITH_MODULES
2447+
2448+ dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
2449+ dnl [DESCRIPTION], [DEFAULT])
2450+ dnl ------------------------------------------------------
2451+ dnl
2452+ dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
2453+ dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
2454+ dnl and preprocessor variable.
2455+ AC_DEFUN ( [ PKG_HAVE_DEFINE_WITH_MODULES] ,
2456+ [
2457+ PKG_HAVE_WITH_MODULES([ $1 ] ,[ $2 ] ,[ $3 ] ,[ $4 ] )
2458+
2459+ AS_IF ( [ test "$AS_TR_SH ( [ with_] m4_tolower ( [ $1 ] ) ) " = "yes"] ,
2460+ [ AC_DEFINE ( [ HAVE_] [ $1 ] , 1 , [ Enable ] m4_tolower ( [ $1 ] ) [ support] ) ] )
2461+ ] ) dnl PKG_HAVE_DEFINE_WITH_MODULES
2462+
23952463# po.m4 serial 24 (gettext-0.19)
23962464dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc.
23972465dnl This file is free software; the Free Software Foundation
0 commit comments