01-14-06 03:40 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
gelbeiche <borstel@fliegenpilz.de> writes:
> I write a m4 macro and in this macro I try to detect
> a library with AC_CHECK_LIB.
> AC_CHECK_LIB($ax_lib, main, ...)
> where ax_lib is my library.
> The check fails because the generated code does not link
> against the library.
If you are using a C++ library, as the post implies, try something
along these lines to check if it's possible to instantiate a class
from the library:
saved_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} -lboost_program_options"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/program_options.hpp
>],
& #91;boost::program_options::variables_ma
p::variables_map dummy()])],
[AC_MSG_RESULT([yes])
BOOST_LIBS="-lboost_program_options"],
[AC_MSG_RESULT([no])
AC_MSG_FAILURE([libboost_program_options (Boost C++ Libraries) is not in
stalled, but is required by $PACKAGE])])
LDFLAGS="${saved_ldflags}"
AC_SUBST([BOOST_LIBS])
If you are doing it properly, you'd also replace the '#' with a
quadrigraph, though in this case it doesn't appear to be strictly
required. If you are mixing languages, you also want to wrap that
with AC_LANG_PUSH and AC_LANG_POP to make sure it uses the C++
variants of those macros.
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>
iD8DBQFDxZPgVcFcaSW/uEgRAtDZAJ4u5FsA5RpZE7To4/ZUc4b1plU9dACeJ5uI
MiXY4B3Pz2TfeDv6uhwbYIU=
=4qHH
-----END PGP SIGNATURE-----
[ Post a follow-up to this message ]
|