tools: Add cxx version detection m4 macro.

This commit is contained in:
Jason Volk 2019-12-01 13:10:38 -08:00
parent e938f56050
commit eb70e85bc3
2 changed files with 42 additions and 5 deletions

View File

@ -35,7 +35,6 @@ AC_PROG_MAKE_SET
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX([17], [gnu], [mandatory], 201703)
dnl ***************************************************************************
dnl
dnl Makefile tree
@ -82,14 +81,23 @@ dnl Platform
dnl
dnl
dnl Compiler brand and version detection
dnl Compiler brand
dnl
AM_CONDITIONAL([GCC], [[[[ $CXX = g\+\+* ]]]])
AM_CONDITIONAL([CLANG], [[[[ $CXX = clang* ]]]])
AM_CONDITIONAL([GCC], [[[[ $CXX = g\+\+* ]]]])
AM_CONDITIONAL([CLANG], [[[[ $CXX = clang* ]]]])
RB_DEFINE_UNQUOTED([CXX], ["$CXX"], [CXX Compiler])
dnl
dnl Compiler version
dnl
AX_CXX_VERSION
RB_DEFINE_UNQUOTED([CXX_VERSION], ["$CXX_VERSION"], [CXX Compiler Version])
AX_CXX_EPOCH
RB_DEFINE_UNQUOTED([CXX_EPOCH], [$CXX_EPOCH], [CXX Compiler Version (major nr)])
dnl
dnl Coarse operating system test macros
dnl

View File

@ -0,0 +1,29 @@
AC_SUBST([CXX_VERSION])
AC_DEFUN([AX_CXX_VERSION],
[
AC_CACHE_CHECK([cxx version], [ax_cv_cxx_version],
[
ax_cv_cxx_version="`$CXX -dumpfullversion`"
AS_IF([test "x$ax_cv_cxx_version" = "x"],
[
ax_cv_cxx_version=""
])
])
CXX_VERSION=$ax_cv_cxx_version
])
AC_SUBST([CXX_EPOCH])
AC_DEFUN([AX_CXX_EPOCH],
[
AC_CACHE_CHECK([cxx epoch], [ax_cv_cxx_epoch],
[
ax_cv_cxx_epoch="`$CXX -dumpversion`"
AS_IF([test "x$ax_cv_cxx_epoch" = "x"],
[
ax_cv_cxx_epoch=""
])
])
CXX_EPOCH=$ax_cv_cxx_epoch
])