Bug in AX_BOOST_* macros

Jens Finkhäuser <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
Hi all!

I just found an annoying, but easy to fix bug in all of the AX_BOOST_*
macros.

Steps to reproduce
------------------

Run checks for more than one boost library, e.g.:

AX_BOOST_BASE([1.46.0])
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_THREAD

Make sure that the library file for boost program options is found,
but the library file for boost thread is missing.


Expected behaviour
------------------

The second macro errors out.


Actual behaviour
----------------

The second macro succeeds.


Bug description
---------------

AX_BOOST_PROGRAM_OPTIONS and AX_BOOST_THREAD (and all the other macros
I looked at briefly) all use the same variable $ax_lib to check for
the name of the library file to pass to the linker.

Running two macros after each other means that if the first macro
found a library file, the $ax_lib variable is already set before the
second macro is run. As a result, the second macro does not detect the
missing library file - instead, it assumes that the library it found
is the one from the first macro.


Proposed Fix
------------

Simply set $ax_lib to an empty value before the checks for the library
file are performed.

I've attached an example patch for AX_BOOST_THREAD.


Hope that helps,
  Jens

-- 
1.21 Jiggabytes of memory should be enough for anybody.
ax_boost_thread.patch (text/x-diff, 542 B)
diff --git a/m4/ax_boost_thread.m4 b/m4/ax_boost_thread.m4
index 79e12cd..d1fa817 100644
--- a/m4/ax_boost_thread.m4
+++ b/m4/ax_boost_thread.m4
@@ -103,6 +103,7 @@ AC_DEFUN([AX_BOOST_THREAD],
                           break;
                           ;;
                         esac
+            ax_lib=
             if test "x$ax_boost_user_thread_lib" = "x"; then
                 for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
                      ax_lib=${libextension}
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBCgAGBQJTKYb7AAoJEJ3L2gZ29FTgeyoH/0YoLII88sFNA06J0cx6n3Kq
orAPaMlvVcA8IScIwk9jkw3ADUdFutTSUorEfDw4zTCzeoikuWVW85TmgsMBKp+h
o0HKSds3sQ4sPHM1c27btrCO17KSNPV1EC+Fb6ix625HpFL+QwTom8EFCpkW6WJX
W7I445T1xu5AtoyURTTqMlkDwQkNExT9KgnJojTh3lB6cdVKpC2T6+fxs0H91ayS
xudxI/COvM21P54dPZ4lH8klpepA1FoMZjLPqaPQRucQ0Mi9svxvUnjjiOvvSZHw
e8nS7CkZ1A6dZQ869z6DFmtKlMorYMOJPcaiNi5j4vVZxW/pQeZxpMyE/eppGbg=
=wS10
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.