Skip to content
Snippets Groups Projects
Verified Commit 81c43cca authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Update m4 macros from autoconf-archive

parent 967cd716
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com> ...@@ -34,6 +34,7 @@ Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
2015 Paul Norman <penorman@mac.com> 2015 Paul Norman <penorman@mac.com>
2015 Moritz Klammler <moritz@klammler.eu> 2015 Moritz Klammler <moritz@klammler.eu>
2016 Krzesimir Nowak <qdlacz@gmail.com>
License: FSFAP License: FSFAP
Files: m4/ax_latex_class.m4 m4/ax_tex_test.m4 Files: m4/ax_latex_class.m4 m4/ax_tex_test.m4
... ...
......
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html # https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
...@@ -33,7 +33,15 @@ ...@@ -33,7 +33,15 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 27 #serial 43
# example boost program (need to pass version)
m4_define([_AX_BOOST_BASE_PROGRAM],
[AC_LANG_PROGRAM([[
#include <boost/version.hpp>
]],[[
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
]])])
AC_DEFUN([AX_BOOST_BASE], AC_DEFUN([AX_BOOST_BASE],
[ [
...@@ -44,104 +52,121 @@ AC_ARG_WITH([boost], ...@@ -44,104 +52,121 @@ AC_ARG_WITH([boost],
or disable it (ARG=no) or disable it (ARG=no)
@<:@ARG=yes@:>@ ])], @<:@ARG=yes@:>@ ])],
[ [
if test "$withval" = "no"; then AS_CASE([$withval],
want_boost="no" [no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
elif test "$withval" = "yes"; then [yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
want_boost="yes" [want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
], ],
[want_boost="yes"]) [want_boost="yes"])
AC_ARG_WITH([boost-libdir], AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR], [AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), [Force given directory for boost libraries.
Note that this will override library path detection,
so use this parameter only if default library detection fails
and you know exactly where your boost libraries are located.])],
[ [
if test -d "$withval" AS_IF([test -d "$withval"],
then [_AX_BOOST_BASE_boost_lib_path="$withval"],
ac_boost_lib_path="$withval" [AC_MSG_ERROR([--with-boost-libdir expected directory name])])
else
AC_MSG_ERROR(--with-boost-libdir expected directory name)
fi
], ],
[ac_boost_lib_path=""] [_AX_BOOST_BASE_boost_lib_path=""])
)
if test "x$want_boost" = "xyes"; then BOOST_LDFLAGS=""
boost_lib_version_req=ifelse([$1], ,1.20.0,$1) BOOST_CPPFLAGS=""
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` AS_IF([test "x$want_boost" = "xyes"],
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` [_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` AC_SUBST(BOOST_CPPFLAGS)
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` AC_SUBST(BOOST_LDFLAGS)
if test "x$boost_lib_version_req_sub_minor" = "x" ; then ])
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` # convert a version string in $2 to numeric and affect to polymorphic var $1
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
[AC_MSG_ERROR([You should at least specify libboost major version])])
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
])
dnl Run the detection of boost should be run only if $want_boost
AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
_AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
succeeded=no succeeded=no
AC_REQUIRE([AC_CANONICAL_HOST])
dnl On 64-bit systems check for system libraries in both lib64 and lib. dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support). dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed! dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib" AS_CASE([${host_cpu}],
ax_arch=`uname -m` [x86_64],[libsubdirs="lib64 libx32 lib lib64"],
case $ax_arch in [ppc64|s390x|sparc64|aarch64|ppc64le],[libsubdirs="lib64 lib lib64"],
x86_64) [libsubdirs="lib"]
libsubdirs="lib64 libx32 lib lib64" )
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
libsubdirs="lib64 lib lib64"
;;
esac
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired. dnl are almost assuredly the ones desired.
AC_REQUIRE([AC_CANONICAL_HOST]) AS_CASE([${host_cpu}],
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs" [i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
[multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
case ${host_cpu} in )
i?86)
libsubdirs="lib/i386-${host_os} $libsubdirs"
;;
esac
dnl first we check the system location for boost libraries dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
BOOST_CPPFLAGS="-I$ac_boost_path/include" AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
for ac_boost_path_tmp in $libsubdirs; do AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then AC_MSG_RESULT([yes])
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
break for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
AC_MSG_RESULT([yes])
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
break;
],
[AC_MSG_RESULT([no])])
done],[
AC_MSG_RESULT([no])])
],[
if test X"$cross_compiling" = Xyes; then
search_libsubdirs=$multiarch_libsubdir
else
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
fi fi
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
for libsubdir in $search_libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done done
elif test "$cross_compiling" != yes; then BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
break; break;
fi fi
done done
fi ])
dnl overwrite ld flags if we have required special directory with dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter dnl --with-boost-libdir parameter
if test "$ac_boost_lib_path" != ""; then AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
BOOST_LDFLAGS="-L$ac_boost_lib_path" [BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
fi
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS export CPPFLAGS
...@@ -152,15 +177,7 @@ if test "x$want_boost" = "xyes"; then ...@@ -152,15 +177,7 @@ if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
succeeded=yes succeeded=yes
found_system=yes found_system=yes
...@@ -176,36 +193,46 @@ if test "x$want_boost" = "xyes"; then ...@@ -176,36 +193,46 @@ if test "x$want_boost" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED" CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS= BOOST_CPPFLAGS=
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
BOOST_LDFLAGS= BOOST_LDFLAGS=
fi
_version=0 _version=0
if test "$ac_boost_path" != ""; then if test -n "$_AX_BOOST_BASE_boost_path" ; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version` V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp _version=$_version_tmp
fi fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done done
dnl if nothing found search for layout used in Windows distributions dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then if test -z "$BOOST_CPPFLAGS"; then
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
BOOST_CPPFLAGS="-I$ac_boost_path" BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi fi
dnl if we found something and BOOST_LDFLAGS was unset before
dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
for libsubdir in $libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
fi fi
fi fi
else else
if test "$cross_compiling" != yes; then if test "x$cross_compiling" != "xyes" ; then
for ac_boost_path in /usr /usr/local /opt /opt/local ; do for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version` V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp _version=$_version_tmp
best_path=$ac_boost_path best_path=$_AX_BOOST_BASE_boost_path
fi fi
done done
fi fi
...@@ -213,7 +240,7 @@ if test "x$want_boost" = "xyes"; then ...@@ -213,7 +240,7 @@ if test "x$want_boost" = "xyes"; then
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done done
...@@ -221,7 +248,7 @@ if test "x$want_boost" = "xyes"; then ...@@ -221,7 +248,7 @@ if test "x$want_boost" = "xyes"; then
fi fi
fi fi
if test "x$BOOST_ROOT" != "x"; then if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done done
...@@ -230,7 +257,7 @@ if test "x$want_boost" = "xyes"; then ...@@ -230,7 +257,7 @@ if test "x$want_boost" = "xyes"; then
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version` V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
...@@ -245,15 +272,7 @@ if test "x$want_boost" = "xyes"; then ...@@ -245,15 +272,7 @@ if test "x$want_boost" = "xyes"; then
export LDFLAGS export LDFLAGS
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
succeeded=yes succeeded=yes
found_system=yes found_system=yes
...@@ -262,17 +281,15 @@ if test "x$want_boost" = "xyes"; then ...@@ -262,17 +281,15 @@ if test "x$want_boost" = "xyes"; then
AC_LANG_POP([C++]) AC_LANG_POP([C++])
fi fi
if test "$succeeded" != "yes" ; then if test "x$succeeded" != "xyes" ; then
if test "$_version" = "0" ; then if test "x$_version" = "x0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]]) AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi fi
# execute ACTION-IF-NOT-FOUND (if present): # execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3]) ifelse([$3], , :, [$3])
else else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present): # execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2]) ifelse([$2], , :, [$2])
...@@ -280,6 +297,5 @@ if test "x$want_boost" = "xyes"; then ...@@ -280,6 +297,5 @@ if test "x$want_boost" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED" CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED"
fi
]) ])
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html # https://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 26 #serial 27
AC_DEFUN([AX_BOOST_FILESYSTEM], AC_DEFUN([AX_BOOST_FILESYSTEM],
[ [
... ...
......
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html # https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 18 #serial 19
AC_DEFUN([AX_BOOST_SYSTEM], AC_DEFUN([AX_BOOST_SYSTEM],
[ [
... ...
......
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
...@@ -33,21 +33,23 @@ ...@@ -33,21 +33,23 @@
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com> # Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> # Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
# #
# Copying and distribution of this file, with or without modification, are # Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice # permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 4 #serial 7
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13). dnl (serial version number 13).
AX_REQUIRE_DEFINED([AC_MSG_WARN])
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [], m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [], [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [], m4_if([$2], [], [],
[$2], [ext], [], [$2], [ext], [],
...@@ -70,7 +72,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ...@@ -70,7 +72,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$2], [noext], [], [dnl m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then if test x$ac_success = xno; then
for switch in -std=gnu++$1 -std=gnu++0x; do for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar, $cachevar,
...@@ -96,7 +99,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ...@@ -96,7 +99,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl HP's aCC needs +std=c++11 according to: dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11" dnl Cray's crayCC needs "-h std=c++11"
for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar, $cachevar,
...@@ -115,6 +119,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ...@@ -115,6 +119,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
break break
fi fi
done done
if test x$ac_success = xyes; then
break
fi
done
fi]) fi])
AC_LANG_POP([C++]) AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ax_cxx_compile_cxx$1_required = xtrue; then
...@@ -131,6 +139,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ...@@ -131,6 +139,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
[define if the compiler supports basic C++$1 syntax]) [define if the compiler supports basic C++$1 syntax])
fi fi
AC_SUBST(HAVE_CXX$1) AC_SUBST(HAVE_CXX$1)
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
]) ])
...@@ -148,6 +157,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], ...@@ -148,6 +157,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
) )
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11 dnl Tests for new features in C++11
...@@ -518,7 +532,7 @@ namespace cxx14 ...@@ -518,7 +532,7 @@ namespace cxx14
} }
namespace test_digit_seperators namespace test_digit_separators
{ {
constexpr auto ten_million = 100'000'000; constexpr auto ten_million = 100'000'000;
...@@ -560,3 +574,409 @@ namespace cxx14 ...@@ -560,3 +574,409 @@ namespace cxx14
#endif // __cplusplus >= 201402L #endif // __cplusplus >= 201402L
]]) ]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus <= 201402L
#error "This is not a C++17 compiler"
#else
#if defined(__clang__)
#define REALLY_CLANG
#else
#if defined(__GNUC__)
#define REALLY_GCC
#endif
#endif
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
#if !defined(REALLY_CLANG)
namespace test_constexpr_lambdas
{
// TODO: test it with clang++ from git
constexpr int foo = [](){return 42;}();
}
#endif // !defined(REALLY_CLANG)
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
#if !defined(REALLY_CLANG)
namespace test_template_argument_deduction_for_class_templates
{
// TODO: test it with clang++ from git
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
#endif // !defined(REALLY_CLANG)
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
#if !defined(REALLY_CLANG)
namespace test_structured_bindings
{
// TODO: test it with clang++ from git
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
#endif // !defined(REALLY_CLANG)
#if !defined(REALLY_CLANG)
namespace test_exception_spec_type_system
{
// TODO: test it with clang++ from git
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
#endif // !defined(REALLY_CLANG)
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus <= 201402L
]])
# ============================================================================ # =============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
# ============================================================================ # =============================================================================
# #
# SYNOPSIS # SYNOPSIS
# #
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 4 #serial 5
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment