Hey there,

I maintain the LyX port on FreeBSD, and was recently contacted by a user
who was not able to built LyX with GCC 4.5 due to autoconf trying to use
gcc instead of g++ to build the source code used to link to boost (LyX
is built with --without-included-boost).

The patch below should fix the problem: AC_CHECK_LIB uses a C compiler,
so we need to manually set the language to C++ and call AC_LINK_IFELSE.

Index: config/lyxinclude.m4
===================================================================
--- config/lyxinclude.m4	(revision 39661)
+++ config/lyxinclude.m4	(working copy)
@@ -321,8 +321,17 @@
 	AM_CONDITIONAL(USE_INCLUDED_BOOST, test x$lyx_cv_with_included_boost = xyes)
 	AC_MSG_RESULT([$lyx_cv_with_included_boost])
 	if test x$lyx_cv_with_included_boost != xyes ; then
-		AC_CHECK_LIB(boost_signals, main, [lyx_boost_underscore=yes], [], [-lm])
-		AC_CHECK_LIB(boost_signals-mt, main, [lyx_boost_underscore_mt=yes], [], [-lm $LIBTHREAD])
+		AC_LANG_PUSH(C++)
+		SAVED_LDFLAGS=$LDFLAGS
+
+		LDFLAGS="$SAVED_LDFLAGS -lboost_signals -lm"
+		AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/signal.hpp>], [boost::signal<void ()> s;])], [lyx_boost_underscore=yes], [])
+		LDFLAGS="$SAVED_LDFLAGS -lboost_signals-mt -lm $LIBTHREAD"
+		AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/signal.hpp>], [boost::signal<void ()> s;])], [lyx_boost_underscore_mt=yes], [])
+
+		LDFLAGS=$SAVED_LDFLAGS
+		AC_LANG_POP(C++)
+
 		if test x$lyx_boost_underscore_mt = xyes ; then
 			BOOST_MT="-mt"
 		else

Reply via email to