CXXFLAGS="$lyx_opt"
fi
if test $with_warnings = yes ; then
- CXXFLAGS="$CXXFLAGS -ansi -Wall"
- # a small hack to avoid problems with headers
- echo '#undef __STRICT_ANSI__' >>confdefs.h
+ CXXFLAGS="$CXXFLAGS -ansi -pedantic -Wall"
fi
else
GXX=
fi
])dnl
-dnl We do not use this one anymore.
-dnl AC_DEFUN(LYX_GXX_STRENGTH_REDUCE,[
-dnl #check for the strength reduction bug of gcc
-dnl if test x$GXX = xyes && test $cross_compiling = no ; then
-dnl AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
-dnl AC_TRY_RUN([
-dnl int main(void) {
-dnl static int Array[[3]];
-dnl unsigned int B = 3;
-dnl int i;
-dnl for(i=0; i<B; i++) Array[[i]] = i - 3;
-dnl exit( Array[[1]] != -2 );
-dnl }],
-dnl ac_cv_c_gcc_strength_bug="no",
-dnl ac_cv_c_gcc_strength_bug="yes",
-dnl ac_cv_c_gcc_strength_bug="yes") )
-dnl if test "$ac_cv_c_gcc_strength_bug" = "yes"
-dnl then
-dnl CXXFLAGS="$CXXFLAGS -fno-strength-reduce"
-dnl fi
-dnl fi
-dnl ])dnl
dnl Usage: LYX_CXX_RTTI : checks whether the C++ compiler
dnl supports RTTI
AC_CACHE_CHECK(for broken STL stack template,lyx_cv_broken_stack,
[AC_TRY_COMPILE([
#include <stack>
+using std::stack;
],[
stack<int> stakk;
stakk.push(0);
fi])
+dnl Usage: LYX_CXX_STL_MODERN_STREAMS : checks whether the C++ compiler
+dnl supports modern STL streams
+AC_DEFUN(LYX_CXX_STL_MODERN_STREAMS,[
+AC_CACHE_CHECK(for modern STL streams,lyx_cv_modern_streams,
+ [AC_TRY_COMPILE([
+#include <fstream>
+],[
+ std::streambuf * test = std::cerr.rdbuf();
+ test->pubsync();
+],lyx_cv_modern_streams=yes,lyx_cv_modern_streams=no)
+])
+if test $lyx_cv_modern_streams = yes ; then
+ AC_DEFINE(MODERN_STL_STREAMS, 1,
+ [Define if you have modern standard-compliant STL streams])
+fi])
+
+
dnl Usage: LYX_CXX_STL_STRING : checks whether the C++ compiler
-dnl has a working stl string container
+dnl has a working stl string container, the check is really stupid
+dnl and could need some improvement.
AC_DEFUN(LYX_CXX_STL_STRING,[
-AC_ARG_WITH(included-string,
-[ --with-included-string use LyX string class instead of STL string],,
-[AC_CHECK_HEADER(std/bastring.h,
- [with_included_string=yes],
- [with_included_string=no])])
-if test x$with_included_string = xyes ; then
- AC_DEFINE(USE_INCLUDED_STRING, 1,
- [Define to use the LString class bundled with LyX])
- lyx_flags="$lyx_flags included-string"
-fi])
+ AC_REQUIRE([LYX_PROG_CXX])
+ AC_MSG_CHECKING(whether the included std::string should be used)
+ AC_ARG_WITH(included-string,[
+ --with-included-string use LyX string class instead of STL string
+ ],[
+ with_included_string=$withval
+ ],[
+ AC_TRY_COMPILE([
+ #include <string>
+ using std::string;
+ ],[
+ string a("hello there");
+ a.clear();
+ a = "hey";
+ a.erase();
+ ],[
+ with_included_string=no
+ ],[
+ with_included_string=yes
+
+ ])
+ ])
+ if test x$with_included_string = xyes ; then
+ AC_DEFINE(USE_INCLUDED_STRING, 1,
+ [Define to use the lyxstring class bundled with LyX.])
+ lyx_flags="$lyx_flags included-string"
+ fi
+ AM_CONDITIONAL(USE_LYXSTRING, test x$with_included_string = xyes)
+ AC_MSG_RESULT([$with_included_string])
+])
dnl LYX_CXX_MUTABLE
AC_MSG_RESULT([$ac_partial_specialization])
])
+
dnl Usage: LYX_CXX_NAMESPACES : checks whether the C++ compiler
dnl has a correct namespace handling and define CXX_WORKING_NAMESPACES
dnl if true. This macro does not do a thourough test, but it should be
[Define if your C++ compiler has correct support for namespaces])
fi])
+
dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler
dnl provides wrappers for C headers and use our alternate version otherwise.
AC_DEFUN(LYX_CXX_CHEADERS,[
AC_CACHE_CHECK(for C headers wrappers,lyx_cv_cxx_cheaders,
[AC_TRY_CPP([
+#include <clocale>
#include <cctype>
#include <cerrno>
#include <cmath>
ac_cv_target_system_type="$target"
])
+
dnl We use this until autoconf fixes its version.
AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for select()])