From: Julian Seward Date: Sat, 13 Dec 2008 16:45:19 +0000 (+0000) Subject: Make sure $mflag_primary is used in the tests for Boost and QtCore X-Git-Tag: svn/VALGRIND_3_4_0~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e33cdf7e4f43cf89e59b89e5f0d392a6924fbb2d;p=thirdparty%2Fvalgrind.git Make sure $mflag_primary is used in the tests for Boost and QtCore features. Also add a big comment explaining why this is important. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8821 --- diff --git a/configure.in b/configure.in index 18af87667c..ca14cbc964 100644 --- a/configure.in +++ b/configure.in @@ -785,71 +785,6 @@ AC_MSG_RESULT([no]) ]) -# Check whether the boost library 1.35 or later has been installed. -# The Boost.Threads library has undergone a major rewrite in version 1.35.0. - -AC_MSG_CHECKING([for boost]) - -AC_LANG(C++) -safe_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-lboost_thread-mt" - -AC_LINK_IFELSE( -[ -#include -static void thread_func(void) -{ } -int main(int argc, char** argv) -{ - boost::thread t(thread_func); - return 0; -} -], -[ -ac_have_boost_1_35=yes -AC_SUBST([BOOST_CFLAGS], []) -AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"]) -AC_MSG_RESULT([yes]) -], [ -ac_have_boost_1_35=no -AC_MSG_RESULT([no]) -]) - -CXXFLAGS=$safe_CXXFLAGS -AC_LANG(C) - -AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes]) - - -# does this compiler support -fopenmp, does it have the include file -# and does it have libgomp ? - -AC_MSG_CHECKING([for OpenMP]) - -safe_CFLAGS=$CFLAGS -CFLAGS="-fopenmp" - -AC_LINK_IFELSE( -[ -#include -int main(int argc, char** argv) -{ - omp_set_dynamic(0); - return 0; -} -], -[ -ac_have_openmp=yes -AC_MSG_RESULT([yes]) -], [ -ac_have_openmp=no -AC_MSG_RESULT([no]) -]) -CFLAGS=$safe_CFLAGS - -AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) - - # does this compiler support -maltivec and does it have the include file # ? @@ -1489,6 +1424,22 @@ CFLAGS=$saved_CFLAGS AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) +# There now follow some tests for QtCore, Boost, and OpenMP. These +# tests are present because Drd has some regression tests that use +# these packages. All regression test programs all compiled only +# for the primary target. And so it is important that the configure +# checks that follow, use the correct -m32 or -m64 flag for the +# primary target (called $mflag_primary). Otherwise, we can end up +# in a situation (eg) where, on amd64-linux, the test for Boost checks +# for usable 64-bit Boost facilities, but because we are doing a 32-bit +# only build (meaning, the primary target is x86-linux), the build +# of the regtest programs that use Boost fails, because they are +# build as 32-bit (IN THIS EXAMPLE). +# +# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES +# NEEDED BY THE REGRESSION TEST PROGRAMS. + + # The test below verifies whether the QtCore package been installed. # This test works as follows: # - If pkg-config was not installed at the time autogen.sh was run, @@ -1517,10 +1468,7 @@ ifdef( # programs with QtCore succeeds. AC_LANG(C++) safe_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS}" - if test x$vg_cv_only32bit = xyes; then - CXXFLAGS="${CXXFLAGS} -m32" - fi + CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary" AC_TRY_LINK( [#include ], [QMutex Mutex;], @@ -1551,7 +1499,7 @@ if test x$ac_have_qtcore = xyes; then AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)]) AC_LANG(C++) safe_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${QTCORE_CFLAGS}" + CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary" AC_TRY_COMPILE([ #include ], @@ -1573,6 +1521,71 @@ if test x$ac_have_qtcore = xyes; then fi +# Check whether the boost library 1.35 or later has been installed. +# The Boost.Threads library has undergone a major rewrite in version 1.35.0. + +AC_MSG_CHECKING([for boost]) + +AC_LANG(C++) +safe_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-lboost_thread-mt $mflag_primary" + +AC_LINK_IFELSE( +[ +#include +static void thread_func(void) +{ } +int main(int argc, char** argv) +{ + boost::thread t(thread_func); + return 0; +} +], +[ +ac_have_boost_1_35=yes +AC_SUBST([BOOST_CFLAGS], []) +AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"]) +AC_MSG_RESULT([yes]) +], [ +ac_have_boost_1_35=no +AC_MSG_RESULT([no]) +]) + +CXXFLAGS=$safe_CXXFLAGS +AC_LANG(C) + +AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes]) + + +# does this compiler support -fopenmp, does it have the include file +# and does it have libgomp ? + +AC_MSG_CHECKING([for OpenMP]) + +safe_CFLAGS=$CFLAGS +CFLAGS="-fopenmp" + +AC_LINK_IFELSE( +[ +#include +int main(int argc, char** argv) +{ + omp_set_dynamic(0); + return 0; +} +], +[ +ac_have_openmp=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_openmp=no +AC_MSG_RESULT([no]) +]) +CFLAGS=$safe_CFLAGS + +AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) + + # -------------------- ok. We're done. -------------------- AC_OUTPUT(