X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=config%2Fpkg.m4;h=2d4d96109d5bd4068183a1a6d1c681cd7a4bd7cb;hb=HEAD;hp=b85cf3a3e27e15c345dd901a78be3f5b540c4430;hpb=bf89a84441f33f17f29ce238d9920f87a4d3b540;p=debian%2Fgnuradio diff --git a/config/pkg.m4 b/config/pkg.m4 index b85cf3a3..2d4d9610 100644 --- a/config/pkg.m4 +++ b/config/pkg.m4 @@ -1,6 +1,7 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . +# Copyright © 2008 Free Software Foundation, Inc. # # 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 @@ -96,18 +97,28 @@ fi[]dnl # # E.g., # PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -# defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -# also defines GSTUFF_PKG_ERRORS on error +# defines: +# +# GSTUFF_LIBS +# GSTUFF_CFLAGS +# GSTUFF_INCLUDEDIR +# GSTUFF_CPPFLAGS # the -I, -D and -U's out of CFLAGS +# +# see pkg-config man page also defines GSTUFF_PKG_ERRORS on error # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_DEFUN([PKG_CHECK_MODULES],[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl + AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_INCLUDEDIR], [includedir for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) @@ -116,11 +127,24 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) if test x$cross_compiling = xyes then - _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) + dnl _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) + _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) + dnl prune out any -L/lib or -L/usr/lib since they're pointing to the wrong filesystem root + _pkg_tmp= + for flag in [$]pkg_cv_[$1][_LIBS]; do + case $flag in + (-L/lib* | -L/usr/lib* ) ;; # ignore + (*) _pkg_tmp="$_pkg_tmp $flag" ;; + esac + done + pkg_cv_[$1][_LIBS]="$_pkg_tmp" else _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) fi +_PKG_CONFIG([$1][_INCLUDEDIR], [variable=includedir], [$2]) + + m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) @@ -160,6 +184,17 @@ To get pkg-config, see .])], else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + $1[]_INCLUDEDIR=$pkg_cv_[]$1[]_INCLUDEDIR + + $1[]_CPPFLAGS="" + for flag in $$1[]_CFLAGS; do + case $flag in + -I* | -D* | -U*) $1[]_CPPFLAGS="$$1[]_CPPFLAGS $flag" ;; + esac + done + pkg_cv_[]$1[]_CPPFLAGS=$$1[]_CPPFLAGS + AC_SUBST($1[]_CPPFLAGS) + AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl