X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=33c59794162ebb9c0eff9e290876755ab6eb541a;hb=c1c439b94dd6d5802e9a48b8c4e45c13fad6f869;hp=de7506fbfcc8ceeeb38455a0a6e7101f84f07e28;hpb=dd2be1777f107276cbbfa4be5f15b5164af739af;p=lyx.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index de7506fbfc..33c5979416 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -143,7 +143,7 @@ rm -f conftest.C conftest.o conftest.obj || true dnl Usage: LYX_PROG_CLANG: set lyx_cv_prog_clang to yes if the compiler is clang. AC_DEFUN([LYX_PROG_CLANG], -[AC_CACHE_CHECK([for clang], +[AC_CACHE_CHECK([whether the compiler is clang], [lyx_cv_prog_clang], [AC_TRY_COMPILE([], [ #ifndef __clang__ @@ -154,6 +154,19 @@ AC_DEFUN([LYX_PROG_CLANG], ]) +dnl Usage: LYX_LIB_STDCXX: set lyx_cv_lib_stdcxx to yes if the STL library is libstdc++. +AC_DEFUN([LYX_LIB_STDCXX], +[AC_CACHE_CHECK([whether STL is libstdc++], + [lyx_cv_lib_stdcxx], +[AC_TRY_COMPILE([#include], [ +#if ! defined(__GLIBCXX__) && ! defined(__GLIBCPP__) + this is not libstdc++ +#endif +], +[lyx_cv_lib_stdcxx=yes], [lyx_cv_lib_stdcxx=no])]) +]) + + AC_DEFUN([LYX_PROG_CXX], [AC_MSG_CHECKING([for a good enough C++ compiler]) LYX_SEARCH_PROG(CXX, $CXX $CCC g++ gcc c++ CC cxx xlC cc++, [LYX_PROG_CXX_WORKS]) @@ -167,8 +180,17 @@ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) AC_LANG_PUSH(C++) LYX_PROG_CLANG +LYX_LIB_STDCXX AC_LANG_POP(C++) +if test $lyx_cv_lib_stdcxx = "yes" ; then + AC_DEFINE(STD_STRING_USES_COW, 1, [std::string uses copy-on-write]) +else + if test $lyx_cv_prog_clang = "yes" ; then + AC_DEFINE(USE_LLVM_LIBCPP, 1, [use libc++ provided by llvm instead of GNU libstdc++]) + fi +fi + ### We might want to get or shut warnings. AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings],[tell the compiler to display more warnings]),, @@ -320,8 +342,6 @@ if test x$GXX = xyes; then ;; esac fi - dnl FIXME: this should be conditional to the use of libstdc++ - AC_DEFINE(STD_STRING_USES_COW, 1, [std::string uses copy-on-write]) fi test "$lyx_pch_comp" = yes && lyx_flags="$lyx_flags pch" AM_CONDITIONAL(LYX_BUILD_PCH, test "$lyx_pch_comp" = yes)