Getting at Libs.private from autoconf
David Evans
David.Evans at cl.cam.ac.uk
Thu Feb 5 07:06:02 PST 2009
Hi, all.
Libs.private is nice but there doesn't seem to b a clean way of
getting at --libs --shared from autoconf. How about defining
foo_STATICLIBS to do this? Something like
*** pkg.m4.orig 2009-02-05 13:34:12.000000000 +0000
--- pkg.m4 2009-02-05 14:15:21.000000000 +0000
***************
*** 105,119 ****
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])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
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$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.])
if test $pkg_failed = yes; then
--- 105,121 ----
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])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][_STATICLIBS], [linker flags for $1 for static linking, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+ _PKG_CONFIG([$1][_STATICLIBS], [libs --static], [$2])
! m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS,
! $1[]_LIBS, and $1[]_STATICLIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
***************
*** 151,156 ****
--- 153,159 ----
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ $1[]_STATICLIBS=$pkg_cv_[]$1[]_STATICLIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
fi[]dnl
Tested on version 0.22.
--
David Evans David.Evans at cl.cam.ac.uk
Research Associate http://www.cl.cam.ac.uk/~de239
Computer Laboratory, University of Cambridge
More information about the pkg-config
mailing list