Mercurial > octave
changeset 31982:86eb373a6c64 stable
build: Check whether using STL from LLVM or Apple (bug #63930).
* m4/acinclude.m4 (OCTAVE_LLVM_LIBCXX): Some Octave features that rely on the
STL don't work correctly with libc++ from LLVM or Apple. Add a check that
allows referring to the used STL on build and run time.
* configure.ac: Run new DEFUN.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 06 Apr 2023 09:29:24 +0200 |
parents | 1f7958de177f |
children | ee187a104701 |
files | configure.ac m4/acinclude.m4 |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Apr 07 12:18:28 2023 -0700 +++ b/configure.ac Thu Apr 06 09:29:24 2023 +0200 @@ -541,6 +541,10 @@ AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE], [Define to the type of octave_idx_type (64 or 32 bit signed integer).]) +### Check for LLVM or Apple libc++ library. + +OCTAVE_LLVM_LIBCXX + ### Check for pthread library. AX_PTHREAD
--- a/m4/acinclude.m4 Fri Apr 07 12:18:28 2023 -0700 +++ b/m4/acinclude.m4 Thu Apr 06 09:29:24 2023 +0200 @@ -254,6 +254,33 @@ fi ]) dnl +dnl Check for LLVM or Apple libc++ library. +dnl +AC_DEFUN([OCTAVE_LLVM_LIBCXX], [ + AC_CACHE_CHECK([whether using STL from LLVM or Apple], + [octave_cv_llvm_libcxx], + [AC_LANG_PUSH(C++) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + // Include any header from the STL + #include <iostream> + ]], [[ + #if defined (_LIBCPP_VERSION) + return (0); + #else + return (1); + #endif + ]])], + octave_cv_llvm_libcxx=yes, + octave_cv_llvm_libcxx=no, + octave_cv_llvm_libcxx=no) + AC_LANG_POP(C++) + ]) + if test $octave_cv_llvm_libcxx = yes; then + AC_DEFINE(HAVE_LLVM_LIBCXX, 1, + [Define to 1 if linking to LLVM or Apple libc++.]) + fi +]) +dnl dnl Check whether std::pmr::polymorphic_allocator is available. dnl AC_DEFUN([OCTAVE_CHECK_STD_PMR_POLYMORPHIC_ALLOCATOR], [