Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
cbd54ef3
Commit
cbd54ef3
authored
Jun 14, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically add -stdlib=libc++ if system C++ library doesn't support C++11 (needed on OSX).
parent
642f8f42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
ax_cxx_compile_stdcxx_11.m4
c++/m4/ax_cxx_compile_stdcxx_11.m4
+43
-0
No files found.
c++/m4/ax_cxx_compile_stdcxx_11.m4
View file @
cbd54ef3
...
...
@@ -16,10 +16,16 @@
# If neither is specified, you get whatever works, with preference for an
# extended mode.
#
# Additionally, check if the standard library supports C++11. If not,
# try adding -stdlib=libc++ to see if that fixes it. This is needed e.g.
# on Mac OSX 10.8, which ships with a very old libstdc++ but a relatively
# new libc++.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Kenton Varda <temporal@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
...
...
@@ -45,6 +51,13 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
check_type&& cr = static_cast<check_type&&>(c);
])
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody_lib], [
#include <initializer_list>
#include <unordered_map>
#include <atomic>
#include <thread>
])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
m4_if([$1], [], [],
[$1], [ext], [],
...
...
@@ -103,5 +116,35 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
else
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++11 library features by default,
ax_cv_cxx_compile_cxx11_lib,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody_lib])],
[ax_cv_cxx_compile_cxx11_lib=yes],
[ax_cv_cxx_compile_cxx11_lib=no])
])
if test x$ax_cv_cxx_compile_cxx11_lib = xyes; then
ac_success=yes
else
# Try with -stdlib=libc++
AC_CACHE_CHECK(whether $CXX supports C++11 library features with -stdlib=libc++,
ax_cv_cxx_compile_cxx11_lib_libcxx,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody_lib])],
[eval ax_cv_cxx_compile_cxx11_lib_libcxx=yes],
[eval ax_cv_cxx_compile_cxx11_lib_libcxx=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x$ax_cv_cxx_compile_cxx11_lib_libcxx = xyes; then
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
ac_success=yes
break
fi
fi
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A C++ library support for C++11 features is required.])
fi
fi
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment