# with_pkg.m4 - Macros to ease the usage of pkg-config. -*- Autoconf -*- # # Copyright © 2008 Luca Barbato , # Diego Pettenò # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, # [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], # [DESCRIPTION], [DEFAULT]) # # AC_DEFUN([PKG_WITH_MODULES], [AC_REQUIRE([PKG_CHECK_MODULES]) m4_define([with_arg], m4_tolower($1)) dnl Default description m4_define([description],ifelse([$5], , [build with ]with_arg[ support], [$5])) dnl Disabled by default m4_define([def_arg],ifelse([$6], , [no], [$6])) AC_ARG_WITH(with_arg, AS_HELP_STRING([--with-]with_arg, description[ @<:@default=]def_arg[@:>@]),, AS_TR_SH([with_]with_arg)=def_arg) AM_CONDITIONAL([WITH_][$1], [test "AS_TR_SH([with_]with_arg)" = "yes"]) if test "$AS_TR_SH([with_]with_arg)" = "yes"; then PKG_CHECK_MODULES([$1],[$2],[$3],[$4]) fi m4_undefine([with_arg]) m4_undefine([description]) m4_undefine([def_arg]) ]) dnl PKG_WITH_MODULES