X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=0e9b426061af5f7d8dc276f24ec8679117c08450;hb=f6921d9161a03c6905c21d71d53f7499a4e7b6e2;hp=47a1997ff012f51bafd14fa222956936e85193ab;hpb=5173f2202471b946b28be55a423cc7ea586e8249;p=features.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 47a1997ff0..0e9b426061 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -142,12 +142,11 @@ dnl Usage: LYX_PROG_CLANG: set CLANG to yes if the compiler is clang. AC_DEFUN([LYX_PROG_CLANG], [AC_CACHE_CHECK([whether the compiler is clang], [lyx_cv_prog_clang], -[AC_TRY_COMPILE([], [ +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ #ifndef __clang__ this is not clang #endif -], -[lyx_cv_prog_clang=yes ; CLANG=yes], [lyx_cv_prog_clang=no ; CLANG=no])]) +]])],[lyx_cv_prog_clang=yes ; CLANG=yes],[lyx_cv_prog_clang=no ; CLANG=no])]) if test $CLANG = yes ; then AC_CACHE_CHECK([for clang version], [lyx_cv_clang_version], @@ -176,7 +175,7 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS], save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$flag $AM_CXXFLAGS $CXXFLAGS" dnl sample openmp source code to test - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ template struct check { @@ -199,8 +198,7 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS], check_type c; check_type&& cr = static_cast(c); - auto d = a;], [], - [lyx_cv_cxx11_flags=$flag; break]) + auto d = a;]], [[]])],[lyx_cv_cxx11_flags=$flag; break],[]) CXXFLAGS=$save_CXXFLAGS CPPFLAGS=$save_CPPFLAGS done]) @@ -225,20 +223,19 @@ AC_DEFUN([LYX_CXX_USE_REGEX], CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS" # The following code snippet has been taken taken from example in # http://stackoverflow.com/questions/8561850/compile-stdregex-iterator-with-gcc - AC_TRY_LINK( - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include #include typedef std::regex_iterator Myiter; - ], [ + ]], [[ const char *pat = "axayaz"; Myiter::regex_type rx("a"); Myiter next(pat, pat + strlen(pat), rx); Myiter end; - ], [lyx_std_regex=yes], [lyx_std_regex=no]) + ]])],[lyx_std_regex=yes],[lyx_std_regex=no]) CXXFLAGS=$save_CXXFLAGS CPPFLAGS=$save_CPPFLAGS AC_MSG_RESULT([$lyx_std_regex]) @@ -261,13 +258,12 @@ AC_DEFUN([LYX_CXX_USE_CALL_ONCE], CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS" - AC_TRY_LINK( - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include static std::once_flag flag; - ], [ + ]], [[ std::call_once(flag, [](){ return; }); - ], [lyx_std_call_once=yes], [lyx_std_call_once=no]) + ]])],[lyx_std_call_once=yes],[lyx_std_call_once=no]) CXXFLAGS=$save_CXXFLAGS CPPFLAGS=$save_CPPFLAGS AC_MSG_RESULT([$lyx_std_call_once]) @@ -283,12 +279,11 @@ dnl Usage: LYX_LIB_STDCXX: set lyx_cv_lib_stdcxx to yes if the STL library is li AC_DEFUN([LYX_LIB_STDCXX], [AC_CACHE_CHECK([whether STL is libstdc++], [lyx_cv_lib_stdcxx], -[AC_TRY_COMPILE([#include], [ +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include]], [[ #if ! defined(__GLIBCXX__) && ! defined(__GLIBCPP__) this is not libstdc++ #endif -], -[lyx_cv_lib_stdcxx=yes], [lyx_cv_lib_stdcxx=no])]) +]])],[lyx_cv_lib_stdcxx=yes],[lyx_cv_lib_stdcxx=no])]) ]) @@ -297,12 +292,11 @@ dnl if the STL library is GNU libstdc++ and the C++11 ABI is used. AC_DEFUN([LYX_LIB_STDCXX_CXX11_ABI], [AC_CACHE_CHECK([whether STL is libstdc++ using the C++11 ABI], [lyx_cv_lib_stdcxx_cxx11_abi], -[AC_TRY_COMPILE([#include], [ +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include]], [[ #if ! defined(_GLIBCXX_USE_CXX11_ABI) || ! _GLIBCXX_USE_CXX11_ABI this is not libstdc++ using the C++11 ABI #endif -], -[lyx_cv_lib_stdcxx_cxx11_abi=yes], [lyx_cv_lib_stdcxx_cxx11_abi=no])]) +]])],[lyx_cv_lib_stdcxx_cxx11_abi=yes],[lyx_cv_lib_stdcxx_cxx11_abi=no])]) ]) @@ -387,6 +381,10 @@ if test x$GXX = xyes; then if test x$CLANG = xno; then dnl Useful for global version info gxx_version=`${CXX} -dumpversion` + case $gxx_version in + *.*) ;; + *) gxx_version=`${CXX} -dumpfullversion` ;; + esac CXX_VERSION="($gxx_version)" else gxx_version=clang-$clang_version @@ -411,21 +409,27 @@ if test x$GXX = xyes; then dnl Warnings are for preprocessor too if test x$enable_warnings = xyes ; then AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra" - fi + 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]);; esac 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 @@ -605,6 +609,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], @@ -615,16 +634,16 @@ AC_DEFUN([LYX_CHECK_CALLSTACK_PRINTING], if test x"$lyx_cv_callstack_printing" = xyes; then AC_CACHE_CHECK([whether printing callstack is possible], [lyx_cv_callstack_printing], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include - ], [ + ]], [[ void* array[200]; size_t size = backtrace(array, 200); backtrace_symbols(array, size); int status = 0; abi::__cxa_demangle("abcd", 0, 0, &status); - ],, [lyx_cv_callstack_printing=no])]) + ]])],[],[lyx_cv_callstack_printing=no])]) fi if test x"$lyx_cv_callstack_printing" = xyes; then AC_DEFINE([LYX_CALLSTACK_PRINTING], 1, @@ -840,13 +859,12 @@ AC_DEFUN([AC_FUNC_MKDIR], [AC_CHECK_FUNCS([mkdir _mkdir]) AC_CACHE_CHECK([whether mkdir takes one argument], [ac_cv_mkdir_takes_one_arg], -[AC_TRY_COMPILE([ +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #if HAVE_UNISTD_H # include #endif -], [mkdir (".");], -[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])]) +]], [[mkdir (".");]])],[ac_cv_mkdir_takes_one_arg=yes],[ac_cv_mkdir_takes_one_arg=no])]) if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1, [Define if mkdir takes only one argument.]) @@ -881,7 +899,7 @@ AC_DEFUN([MSYS_AC_CANONICAL_PATH], dnl this is used by the macro blow to general a proper config.h.in entry m4_define([LYX_AH_CHECK_DECL], [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_$1), - [Define if you have the prototype for function `$1'])]) + [Define if you have the prototype for function `$1'])])dnl` dnl Check things are declared in headers to avoid errors or warnings. dnl Called like LYX_CHECK_DECL(function, header1 header2...) @@ -901,7 +919,7 @@ done]) dnl this is used by the macro below to generate a proper config.h.in entry m4_define([LYX_AH_CHECK_DEF], [AH_TEMPLATE(AS_TR_CPP(HAVE_DEF_$1), - [Define to 1 if `$1' is defined in `$2'])]) + [Define to 1 if `$1' is defined in `$2'])])dnl' dnl Check whether name is defined in header by using it in codesnippet. dnl Called like LYX_CHECK_DEF(name, header, codesnippet) @@ -914,9 +932,7 @@ AC_DEFUN([LYX_CHECK_DEF], save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS" AC_LANG_PUSH(C++) - AC_TRY_COMPILE([#include <$2>], [$3], - lyx_have_def_name=yes, - lyx_have_def_name=no) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$2>]], [[$3]])],[lyx_have_def_name=yes],[lyx_have_def_name=no]) AC_LANG_POP(C++) CXXFLAGS=$save_CXXFLAGS CPPFLAGS=$save_CPPFLAGS