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__
])
+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<vector>], [
+#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])
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]),,
;;
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)