@@ -67,7 +67,7 @@ AS_VAR_POPDEF([CACHEVAR])dnl
6767] ) dnl AX_CHECK_COMPILE_FLAGS
6868
6969# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
70- # serial 12 (pkg-config-0.29.2 )
70+ # serial 11 (pkg-config-0.29.1 )
7171
7272dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7373dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
109109dnl See the "Since" comment for each macro you use to see what version
110110dnl of the macros you require.
111111m4_defun([ PKG_PREREQ] ,
112- [ m4_define ( [ PKG_MACROS_VERSION] , [ 0.29.2 ] )
112+ [ m4_define ( [ PKG_MACROS_VERSION] , [ 0.29.1 ] )
113113m4_if ( m4_version_compare ( PKG_MACROS_VERSION , [ $1 ] ) , - 1 ,
114114 [ m4_fatal ( [ pkg.m4 version $1 or higher is required but ] PKG_MACROS_VERSION [ found] ) ] )
115115] )dnl PKG_PREREQ
@@ -210,7 +210,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
210210AC_ARG_VAR ( [ $1 ] [ _LIBS] , [ linker flags for $1 , overriding pkg-config] ) dnl
211211
212212pkg_failed=no
213- AC_MSG_CHECKING ( [ for $2 ] )
213+ AC_MSG_CHECKING ( [ for $1 ] )
214214
215215_PKG_CONFIG([ $1 ] [ _CFLAGS] , [ cflags] , [ $2 ] )
216216_PKG_CONFIG([ $1 ] [ _LIBS] , [ libs] , [ $2 ] )
@@ -220,11 +220,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
220220See the pkg-config man page for more details.] )
221221
222222if test $pkg_failed = yes; then
223- AC_MSG_RESULT ( [ no] )
223+ AC_MSG_RESULT ( [ no] )
224224 _PKG_SHORT_ERRORS_SUPPORTED
225225 if test $_pkg_short_errors_supported = yes; then
226226 $1 [ ] _PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2 " 2>&1`
227- else
227+ else
228228 $1 [ ] _PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2 " 2>&1`
229229 fi
230230# Put the nasty error message in config.log where it belongs
@@ -241,7 +241,7 @@ installed software in a non-standard prefix.
241241_PKG_TEXT] ) [ ] dnl
242242 ] )
243243elif test $pkg_failed = untried; then
244- AC_MSG_RESULT ( [ no] )
244+ AC_MSG_RESULT ( [ no] )
245245m4_default ( [ $4 ] , [ AC_MSG_FAILURE (
246246[ The pkg-config script could not be found or is too old. Make sure it
247247is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -342,5 +342,73 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
342342AS_VAR_IF ( [ $1 ] , [ ""] , [ $5 ] , [ $4 ] ) dnl
343343] ) dnl PKG_CHECK_VAR
344344
345+ dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
346+ dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
347+ dnl [DESCRIPTION], [DEFAULT])
348+ dnl ------------------------------------------
349+ dnl
350+ dnl Prepare a "--with-" configure option using the lowercase
351+ dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
352+ dnl PKG_CHECK_MODULES in a single macro.
353+ AC_DEFUN ( [ PKG_WITH_MODULES] ,
354+ [
355+ m4_pushdef ( [ with_arg] , m4_tolower ( [ $1 ] ) )
356+
357+ m4_pushdef ( [ description] ,
358+ [ m4_default ( [ $5 ] , [ build with ] with_arg [ support] ) ] )
359+
360+ m4_pushdef ( [ def_arg] , [ m4_default ( [ $6 ] , [ auto] ) ] )
361+ m4_pushdef ( [ def_action_if_found] , [ AS_TR_SH ( [ with_] with_arg ) =yes] )
362+ m4_pushdef ( [ def_action_if_not_found] , [ AS_TR_SH ( [ with_] with_arg ) =no] )
363+
364+ m4_case ( def_arg ,
365+ [ yes] ,[ m4_pushdef ( [ with_without] , [ --without-] with_arg ) ] ,
366+ [ m4_pushdef ( [ with_without] ,[ --with-] with_arg ) ] )
367+
368+ AC_ARG_WITH ( with_arg ,
369+ AS_HELP_STRING ( with_without , description [ @<:@ default=] def_arg [ @:>@ ] ) ,,
370+ [ AS_TR_SH ( [ with_] with_arg ) =def_arg] )
371+
372+ AS_CASE ( [ $AS_TR_SH ( [ with_] with_arg ) ] ,
373+ [ yes] ,[ PKG_CHECK_MODULES([ $1 ] ,[ $2 ] ,$3 ,$4 )] ,
374+ [ auto] ,[ PKG_CHECK_MODULES([ $1 ] ,[ $2 ] ,
375+ [ m4_n ( [ def_action_if_found] ) $3 ] ,
376+ [ m4_n ( [ def_action_if_not_found] ) $4 ] )] )
377+
378+ m4_popdef ( [ with_arg] )
379+ m4_popdef ( [ description] )
380+ m4_popdef ( [ def_arg] )
381+
382+ ] ) dnl PKG_WITH_MODULES
383+
384+ dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
385+ dnl [DESCRIPTION], [DEFAULT])
386+ dnl -----------------------------------------------
387+ dnl
388+ dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
389+ dnl check._[VARIABLE-PREFIX] is exported as make variable.
390+ AC_DEFUN ( [ PKG_HAVE_WITH_MODULES] ,
391+ [
392+ PKG_WITH_MODULES([ $1 ] ,[ $2 ] ,,,[ $3 ] ,[ $4 ] )
393+
394+ AM_CONDITIONAL([ HAVE_] [ $1 ] ,
395+ [ test "$AS_TR_SH ( [ with_] m4_tolower ( [ $1 ] ) ) " = "yes"] )
396+ ] ) dnl PKG_HAVE_WITH_MODULES
397+
398+ dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
399+ dnl [DESCRIPTION], [DEFAULT])
400+ dnl ------------------------------------------------------
401+ dnl
402+ dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
403+ dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
404+ dnl and preprocessor variable.
405+ AC_DEFUN ( [ PKG_HAVE_DEFINE_WITH_MODULES] ,
406+ [
407+ PKG_HAVE_WITH_MODULES([ $1 ] ,[ $2 ] ,[ $3 ] ,[ $4 ] )
408+
409+ AS_IF ( [ test "$AS_TR_SH ( [ with_] m4_tolower ( [ $1 ] ) ) " = "yes"] ,
410+ [ AC_DEFINE ( [ HAVE_] [ $1 ] , 1 , [ Enable ] m4_tolower ( [ $1 ] ) [ support] ) ] )
411+ ] ) dnl PKG_HAVE_DEFINE_WITH_MODULES
412+
345413m4_include ( [ m4/ax_c_float_words_bigendian.m4] )
346414m4_include ( [ m4/ax_check_openssl.m4] )
0 commit comments