X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=fb6525c7adb33ab0c56fae5ae0a63ebaea0467d8;hb=a42c5e38800d747be8db1b508e94043a78ac8719;hp=9fe42e884747490912f170b7145d670a4feade83;hpb=44bbd0b0ef8450f4d88dfb8c3345118f2fd14dfc;p=lyx.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 9fe42e8847..fb6525c7ad 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -164,12 +164,16 @@ fi ]) -dnl Usage: LYX_CXX_CXX11_FLAGS: add to AM_CXXFLAGS the best flag that -selects C++11 mode; gives an error when C++11 mode is not found. +dnl Usage: LYX_CXX_CXX11_FLAGS(VERSION): add to AM_CXXFLAGS the best flag that +dnl selects C++11 mode; gives an error when C++11 mode is not found. +dnl VERSION is a list of years to try (e.g. 11 or {14,11}). AC_DEFUN([LYX_CXX_CXX11_FLAGS], -[AC_CACHE_CHECK([for at least C++11 mode], [lyx_cv_cxx11_flags], +[AC_CACHE_CHECK([for a good C++ mode], [lyx_cv_cxx11_flags], [lyx_cv_cxx11_flags=none - for flag in -std=c++14 -std=c++11 "" -std=gnu++14 -std=gnu++11 ; do + for flag in `eval echo -std=c++$1 default -std=gnu++$1` ; do + if test $flag = default ; then + flag= + fi save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" save_CXXFLAGS=$CXXFLAGS @@ -202,8 +206,8 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS], CXXFLAGS=$save_CXXFLAGS CPPFLAGS=$save_CPPFLAGS done]) - if test $lyx_cv_cxx11_flags = none ; then - AC_MSG_ERROR([Cannot find suitable C++11 mode for compiler $CXX]) + if test x$lyx_cv_cxx11_flags = xnone ; then + AC_MSG_ERROR([Cannot find suitable mode for compiler $CXX]) fi AM_CXXFLAGS="$lyx_cv_cxx11_flags $AM_CXXFLAGS" ]) @@ -304,9 +308,15 @@ AC_DEFUN([LYX_PROG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) +### We might want to force the C++ standard. +AC_ARG_ENABLE(cxx-mode, + AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 14, then 11)]),, + [enable_cxx_mode={14,11}] +) + AC_LANG_PUSH(C++) LYX_PROG_CLANG -LYX_CXX_CXX11_FLAGS +LYX_CXX_CXX11_FLAGS($enable_cxx_mode) LYX_LIB_STDCXX LYX_LIB_STDCXX_CXX11_ABI LYX_CXX_USE_REGEX @@ -408,10 +418,13 @@ if test x$GXX = xyes; then fi dnl Warnings are for preprocessor too if test x$enable_warnings = xyes ; then - case $gxx_version in - 9.*) AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra -Wno-deprecated-copy";; - *) AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra";; - esac + AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra" + dnl Shut off warning -Wdeprecated-copy, which triggers too much + dnl note that g++ always accepts -Wno-xxx, even when -Wxxx is an error. + AC_LANG_PUSH(C++) + AX_CHECK_COMPILE_FLAG([-Wno-deprecated-copy], + [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-deprecated-copy"], [], [-Werror]) + AC_LANG_POP(C++) fi case $gxx_version in 2.*|3.*|4.@<:@0-6@:>@) AC_MSG_ERROR([gcc >= 4.7 is required]);; @@ -419,14 +432,14 @@ if test x$GXX = xyes; then if test x$enable_stdlib_debug = xyes ; then dnl FIXME: for clang/libc++, one should define _LIBCPP_DEBUG2=0 dnl See http://clang-developers.42468.n3.nabble.com/libc-debug-mode-td3336742.html - case $gxx_version in - *) + if test x$lyx_cv_lib_stdcxx = xyes ; then lyx_flags="$lyx_flags stdlib-debug" AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode]) AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode]) AC_SUBST(STDLIB_DEBUG, "-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") - ;; - esac + else + enable_stdlib_debug=no + fi fi fi @@ -606,6 +619,21 @@ dnl prevent clash with system zlib that might be dragged in by other libs ]) +dnl Usage: LYX_BUILD_INCLUDED_DTL : select if the included dtl should +dnl be built and installed. +AC_DEFUN([LYX_BUILD_INCLUDED_DTL],[ + AC_MSG_CHECKING([whether to build dv2dt and dt2dv]) + AC_ARG_WITH(included-dtl, + [AS_HELP_STRING([--with-included-dtl], [build and install the dv2dt and dt2dv programs supplied with LyX])], + [lyx_cv_with_included_dtl=$withval], + [lyx_cv_with_included_dtl=no]) + AM_CONDITIONAL(BUILD_INCLUDED_DTL, test x$lyx_cv_with_included_dtl = xyes) + AC_MSG_RESULT([$lyx_cv_with_included_dtl]) + if test x$lyx_cv_with_included_dtl = xyes ; then + lyx_flags="$lyx_flags build-dtl" + fi]) + + dnl Usage: LYX_CHECK_CALLSTACK_PRINTING: define LYX_CALLSTACK_PRINTING if the dnl necessary APIs are available to print callstacks. AC_DEFUN([LYX_CHECK_CALLSTACK_PRINTING],