]> git.draconx.ca Git - dxcommon.git/blob - m4/pkg.m4
Add libpng detection macro.
[dxcommon.git] / m4 / pkg.m4
1 dnl Copyright © 2014 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
8
9 dnl DX_PKG_CONFIG(shell-variable, arguments,
10 dnl               [action-if-ok], [action-if-failed],
11 dnl               [action-if-not-available])
12 dnl
13 dnl Execute pkg-config with the given arguments, and store the output in
14 dnl the specified shell variable.  If successful, execute action-if-ok.  If
15 dnl unsuccessful, execute action-if-failed.  If pkg-config is not available,
16 dnl execute action-if-not-available.
17 AC_DEFUN([DX_PKG_CONFIG], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
18 AS_UNSET([$1])
19 AS_IF([test x"$PKG_CONFIG" = x""],
20         [m4_default([$5], [AS_SET_STATUS([2])])],
21         [DX_COMMAND_OUTPUT([$1], [$PKG_CONFIG --print-errors $2],
22                 [$3], [m4_default([$4], [AS_SET_STATUS([$?])])])])])