Fix build when boost-libs is compiled with a newer (> 4.2 from base) gcc.

LyX originally uses the AC_CHECK_LIB macro to check for boost, however
this macro always calls a C compiler, even to check for a C++ library
such as boost. This made the test program built for this check to
always fail to link when boost was compiled witha recent enough
compiler.

A fix was submitted upstream [1], and this patch needs to be applied
meanwhile.

[1] http://article.gmane.org/gmane.editors.lyx.devel/138405

Reported by:	avg
Approved by:	avilla (mentor)
This commit is contained in:
Raphael Kubo da Costa 2011-09-17 02:49:28 +00:00
parent b5da654881
commit 57f8b9f10a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=281873

View File

@ -0,0 +1,103 @@
--- configure.orig 2011-09-12 19:17:15.000000000 -0300
+++ configure 2011-09-12 19:17:40.000000000 -0300
@@ -7307,73 +7317,56 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lyx_cv_with_included_boost" >&5
$as_echo "$lyx_cv_with_included_boost" >&6; }
if test x$lyx_cv_with_included_boost != xyes ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_signals" >&5
-$as_echo_n "checking for main in -lboost_signals... " >&6; }
-if test "${ac_cv_lib_boost_signals_main+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lboost_signals -lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ SAVED_LDFLAGS=$LDFLAGS
+ LDFLAGS="$SAVED_LDFLAGS -lboost_signals -lm"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <boost/signal.hpp>
int
main ()
{
-return main ();
+boost::signal<void ()> s;
;
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_boost_signals_main=yes
-else
- ac_cv_lib_boost_signals_main=no
+if ac_fn_cxx_try_link "$LINENO"; then :
+ lyx_boost_underscore=yes
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_signals_main" >&5
-$as_echo "$ac_cv_lib_boost_signals_main" >&6; }
-if test "x$ac_cv_lib_boost_signals_main" = x""yes; then :
- lyx_boost_underscore=yes
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_signals-mt" >&5
-$as_echo_n "checking for main in -lboost_signals-mt... " >&6; }
-if test "${ac_cv_lib_boost_signals_mt_main+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lboost_signals-mt -lm $LIBTHREAD $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ LDFLAGS="$SAVED_LDFLAGS -lboost_signals-mt -lm $LIBTHREAD"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-
+#include <boost/signal.hpp>
int
main ()
{
-return main ();
+boost::signal<void ()> s;
;
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_boost_signals_mt_main=yes
-else
- ac_cv_lib_boost_signals_mt_main=no
+if ac_fn_cxx_try_link "$LINENO"; then :
+ lyx_boost_underscore_mt=yes
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_signals_mt_main" >&5
-$as_echo "$ac_cv_lib_boost_signals_mt_main" >&6; }
-if test "x$ac_cv_lib_boost_signals_mt_main" = x""yes; then :
- lyx_boost_underscore_mt=yes
-fi
+
+ LDFLAGS=$SAVED_LDFLAGS
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
if test x$lyx_boost_underscore_mt = xyes ; then
BOOST_MT="-mt"