build/autoconf/pkg.m4

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 # PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
michael@0 6 # defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
michael@0 7 # also defines GSTUFF_PKG_ERRORS on error
michael@0 8 AC_DEFUN([PKG_CHECK_MODULES],
michael@0 9 [succeeded=no
michael@0 10
michael@0 11 if test -z "$PKG_CONFIG"; then
michael@0 12 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
michael@0 13 fi
michael@0 14
michael@0 15 if test "$PKG_CONFIG" = "no" ; then
michael@0 16 echo "*** The pkg-config script could not be found. Make sure it is"
michael@0 17 echo "*** in your path, or set the PKG_CONFIG environment variable"
michael@0 18 echo "*** to the full path to pkg-config."
michael@0 19 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
michael@0 20 else
michael@0 21 PKG_CONFIG_MIN_VERSION=0.9.0
michael@0 22 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
michael@0 23 AC_MSG_CHECKING(for $2)
michael@0 24
michael@0 25 if $PKG_CONFIG --exists "$2" ; then
michael@0 26 AC_MSG_RESULT(yes)
michael@0 27 succeeded=yes
michael@0 28
michael@0 29 AC_MSG_CHECKING($1_CFLAGS)
michael@0 30 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
michael@0 31 AC_MSG_RESULT($$1_CFLAGS)
michael@0 32
michael@0 33 AC_MSG_CHECKING($1_LIBS)
michael@0 34 ## Remove evil flags like -Wl,--export-dynamic
michael@0 35 $1_LIBS="`$PKG_CONFIG --libs \"$2\" |sed s/-Wl,--export-dynamic//g`"
michael@0 36 AC_MSG_RESULT($$1_LIBS)
michael@0 37 else
michael@0 38 $1_CFLAGS=""
michael@0 39 $1_LIBS=""
michael@0 40 ## If we have a custom action on failure, don't print errors, but
michael@0 41 ## do set a variable so people can do so.
michael@0 42 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
michael@0 43 ifelse([$4], ,echo $$1_PKG_ERRORS,)
michael@0 44 fi
michael@0 45
michael@0 46 AC_SUBST($1_CFLAGS)
michael@0 47 AC_SUBST($1_LIBS)
michael@0 48 else
michael@0 49 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
michael@0 50 echo "*** See http://www.freedesktop.org/software/pkgconfig"
michael@0 51 fi
michael@0 52 fi
michael@0 53
michael@0 54 if test $succeeded = yes; then
michael@0 55 ifelse([$3], , :, [$3])
michael@0 56 else
michael@0 57 if test "$COMPILE_ENVIRONMENT"; then
michael@0 58 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])
michael@0 59 fi
michael@0 60 fi
michael@0 61 ])
michael@0 62
michael@0 63

mercurial