tsuna / boost.m4

M4 macros to use Boost with the autotools
http://wiki.github.com/tsuna/boost.m4/
GNU General Public License v3.0
87 stars 52 forks source link

Perform sed and -mt code checks in C++ mode #51

Closed rkennedy closed 10 years ago

rkennedy commented 10 years ago

The default language is C, but since Boost is inherently a C++ library, it makes sense to invoke the C++ compiler for all Boost-related Autoconf tests, even if no C++ code is actually being compiled.

This change wraps the call to _BOOST_SED_CPP when detecting Boost's version, as well as the code for detecting the environment's multithreading status in _BOOST_GUESS_WHETHER_TO_USE_MT.

This has an added side effect, which is that when not using Libtool, there's no dependency on C at all — the CC, CFLAGS, and CPP macros don't affect the configure script. Technically, Boost.m4 depends on Libtool, but in my experience, the only thing it uses is the $libext variable, and then only when searching for a static library to link with. I can circumvent the full Libtool dependency by simply setting $libext directly (usually to a, but to lib on Windows compilers). This allows for faster configurations since we don't have to detect and test the capabilities of a C compiler that will never actually be used.

Even when Libtool is used (as recommended), I think it's still better to perform the version and multithreading checks in C++ mode since they should really be testing C++ headers and C++ compiler settings, even when the analogous C values would most likely be the same.

tsuna commented 10 years ago

I merged this as tsuna/boost.m4@9c52a7dfd710a09dc8e1c7de90e483536bcadcc5, thanks for the change. I modified your commit slightly so that _BOOST_SED_CPP itself does the AC_LANG_PUSH / AC_LANG_POP, hope this makes sense to you too.