1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/pkg.m4 Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public 1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +# PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) 1.9 +# defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page 1.10 +# also defines GSTUFF_PKG_ERRORS on error 1.11 +AC_DEFUN([PKG_CHECK_MODULES], 1.12 +[succeeded=no 1.13 + 1.14 + if test -z "$PKG_CONFIG"; then 1.15 + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 1.16 + fi 1.17 + 1.18 + if test "$PKG_CONFIG" = "no" ; then 1.19 + echo "*** The pkg-config script could not be found. Make sure it is" 1.20 + echo "*** in your path, or set the PKG_CONFIG environment variable" 1.21 + echo "*** to the full path to pkg-config." 1.22 + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." 1.23 + else 1.24 + PKG_CONFIG_MIN_VERSION=0.9.0 1.25 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then 1.26 + AC_MSG_CHECKING(for $2) 1.27 + 1.28 + if $PKG_CONFIG --exists "$2" ; then 1.29 + AC_MSG_RESULT(yes) 1.30 + succeeded=yes 1.31 + 1.32 + AC_MSG_CHECKING($1_CFLAGS) 1.33 + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` 1.34 + AC_MSG_RESULT($$1_CFLAGS) 1.35 + 1.36 + AC_MSG_CHECKING($1_LIBS) 1.37 + ## Remove evil flags like -Wl,--export-dynamic 1.38 + $1_LIBS="`$PKG_CONFIG --libs \"$2\" |sed s/-Wl,--export-dynamic//g`" 1.39 + AC_MSG_RESULT($$1_LIBS) 1.40 + else 1.41 + $1_CFLAGS="" 1.42 + $1_LIBS="" 1.43 + ## If we have a custom action on failure, don't print errors, but 1.44 + ## do set a variable so people can do so. 1.45 + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 1.46 + ifelse([$4], ,echo $$1_PKG_ERRORS,) 1.47 + fi 1.48 + 1.49 + AC_SUBST($1_CFLAGS) 1.50 + AC_SUBST($1_LIBS) 1.51 + else 1.52 + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." 1.53 + echo "*** See http://www.freedesktop.org/software/pkgconfig" 1.54 + fi 1.55 + fi 1.56 + 1.57 + if test $succeeded = yes; then 1.58 + ifelse([$3], , :, [$3]) 1.59 + else 1.60 + if test "$COMPILE_ENVIRONMENT"; then 1.61 + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) 1.62 + fi 1.63 + fi 1.64 +]) 1.65 + 1.66 +