Add a m4 function to pkg.m4 and calls both AC_ARG_ENABLE AND PKG_CHECK_MODULES
Submitted by Petteri Räty
Assigned to Dan Nicholson @dbn
Description
I often up doing something like:
AC_ARG_ENABLE(<pkg>
, AC_HELP_STRING([--enable-<pkg>
], [enable <pkg>
support], [], [enable_<pkg>
=auto]))
PKG_CHECK_MODULES(<PKG>
, [<pkg>
>= <version>
],
[if test x"${enable_<pkg>
}" = x"yes" || test x"${enable_<pkg>
}" = x"auto"; then
AC_DEFINE(HAVE_<PKG>
, 1, [defined if <pkg>
is available])
fi],
[test x"${enable_<pkg>
}" = x"yes" && AC_MSG_ERROR(<pkg>
support needs <pkg>
>= <version>
installed)])
AC_SUBST(<PKG>
_CFLAGS)
AC_SUBST(<PKG_LIBS)
IMHO it would be create if pkg-config provide a PKG_ macro for this so that one
could just do
PKG_ARG_ENABLE([<pkg>
], [" >= <version>
"], AC_DEFINE(HAVE_<PKG>
, 1, [defined if <pkg>
is available])