-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checks for new-enough clang++, g++ and libstdc++ versions.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2015 Stellar Development Foundation and contributors. Licensed | ||
# under the ISC License. See the COPYING file at the top-level directory of | ||
# this distribution or at http://opensource.org/licenses/ISC | ||
|
||
AC_DEFUN([AX_FRESH_COMPILER], | ||
[ | ||
# Check for compiler versions. We need g++ >= 4.9 and/or clang++ >= 3.5 | ||
AC_LANG_PUSH([C++]) | ||
case "${CXX}" in | ||
*clang*) | ||
AC_MSG_CHECKING([for clang >= 3.5]) | ||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | ||
#if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 5) | ||
#error old clang++ | ||
#endif | ||
#if defined(__apple_build_version__) | ||
#if __clang_major__ < 6 | ||
#error old clang++ | ||
#endif | ||
#endif | ||
)], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR([clang++ is < required version 3.5])]) | ||
;; | ||
*g++*) | ||
AC_MSG_CHECKING([for g++ >= 4.9]) | ||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | ||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) | ||
#error old g++ | ||
#endif | ||
)], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR([g++ is < required version 4.9])]) | ||
;; | ||
esac | ||
# Even if we have clang++ >= 3.5 we need to be sure we don't have an | ||
# old/broken libstdc++, which we often get if there's an old g++ install | ||
# kicking around. Unfortunately there's no way to test this directly; we | ||
# try a handful of tell-tale C++11 features completed in 4.9 instead. | ||
AC_MSG_CHECKING([for a sufficiently-new libstdc++]) | ||
AC_COMPILE_IFELSE([ | ||
AC_LANG_PROGRAM( | ||
[ | ||
[#include <cstddef>] | ||
[#include <new>] | ||
[#include <exception>] | ||
], | ||
[ | ||
auto a = sizeof(std::max_align_t); | ||
auto b = std::get_new_handler(); | ||
auto c = std::get_terminate(); | ||
auto d = std::get_unexpected(); | ||
] | ||
)], | ||
[AC_MSG_RESULT(yes)], | ||
[AC_MSG_ERROR([missing new C++11 features, probably libstdc++ < 4.9]) | ||
]) | ||
AC_LANG_POP([C++]) | ||
]) |
a367060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from jedmccaleb
at graydon@a367060
a367060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging graydon/stellar-core/autoconf-get-picky-about-compilers = a367060 into auto
a367060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
graydon/stellar-core/autoconf-get-picky-about-compilers = a367060 merged ok, testing candidate = 4048c30
a367060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: https://magnum.travis-ci.com/stellar/stellar-core/builds/10630480
a367060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 4048c30