Merge #16870: build: update boost macros to latest upstream for improved error reporting

bb99c4e684bbd3053ecf7a789049b11b29260189 build: update boost macros to latest upstream (fanquake)

Pull request description:

  Fixes: #16803

  I opened an [upstream PR](https://github.com/autoconf-archive/autoconf-archive/pull/197) to improve the Boost error reporting, so pull the latest macros.

ACKs for top commit:
  laanwj:
    Code review ACK bb99c4e684bbd3053ecf7a789049b11b29260189
  jonatack:
    Sanity check ACK bb99c4e684bbd3053ecf7a789049b11b29260189, light code read, built and ran tests on Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux. Only tested the happy path.

Tree-SHA512: 34704ed623ac0085215fd874a23fde8f6e39a69fa20d78472b0c4d2306dc101c0571fa26c4c8821600746b94daaaf05faf6d15546899d588081c26357d29ec46
This commit is contained in:
fanquake 2019-09-21 09:29:16 +08:00 committed by pasta
parent 6b46bddf64
commit d3a9042e01
6 changed files with 94 additions and 81 deletions

View File

@ -33,7 +33,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 45 #serial 47
# example boost program (need to pass version) # example boost program (need to pass version)
m4_define([_AX_BOOST_BASE_PROGRAM], m4_define([_AX_BOOST_BASE_PROGRAM],
@ -113,6 +113,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
dnl are found, e.g. when only header-only libraries are installed! dnl are found, e.g. when only header-only libraries are installed!
AS_CASE([${host_cpu}], AS_CASE([${host_cpu}],
[x86_64],[libsubdirs="lib64 libx32 lib lib64"], [x86_64],[libsubdirs="lib64 libx32 lib lib64"],
[mips*64*],[libsubdirs="lib64 lib32 lib lib64"],
[ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64],[libsubdirs="lib64 lib lib64"], [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64],[libsubdirs="lib64 lib lib64"],
[libsubdirs="lib"] [libsubdirs="lib"]
) )

View File

@ -29,7 +29,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
AC_DEFUN([AX_BOOST_CHRONO], AC_DEFUN([AX_BOOST_CHRONO],
[ [
@ -105,7 +105,7 @@ AC_DEFUN([AX_BOOST_CHRONO],
fi fi
if test "x$ax_lib" = "x"; then if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!) AC_MSG_ERROR(Could not find a version of the Boost::Chrono library!)
fi fi
if test "x$link_chrono" = "xno"; then if test "x$link_chrono" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !) AC_MSG_ERROR(Could not link against $ax_lib !)

View File

@ -1,5 +1,5 @@
# =========================================================================== # ===========================================================================
# 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 @@
# 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 28
AC_DEFUN([AX_BOOST_FILESYSTEM], AC_DEFUN([AX_BOOST_FILESYSTEM],
[ [
@ -80,7 +80,6 @@ AC_DEFUN([AX_BOOST_FILESYSTEM],
if test "x$ax_cv_boost_filesystem" = "xyes"; then if test "x$ax_cv_boost_filesystem" = "xyes"; then
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
ax_lib=
if test "x$ax_boost_user_filesystem_lib" = "x"; then if test "x$ax_boost_user_filesystem_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
ax_lib=${libextension} ax_lib=${libextension}
@ -105,7 +104,7 @@ AC_DEFUN([AX_BOOST_FILESYSTEM],
fi fi
if test "x$ax_lib" = "x"; then if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the boost_filesystem library!) AC_MSG_ERROR(Could not find a version of the Boost::Filesystem library!)
fi fi
if test "x$link_filesystem" != "xyes"; then if test "x$link_filesystem" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !) AC_MSG_ERROR(Could not link against $ax_lib !)

View File

@ -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 19 #serial 20
AC_DEFUN([AX_BOOST_SYSTEM], AC_DEFUN([AX_BOOST_SYSTEM],
[ [
@ -108,7 +108,7 @@ AC_DEFUN([AX_BOOST_SYSTEM],
fi fi
if test "x$ax_lib" = "x"; then if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!) AC_MSG_ERROR(Could not find a version of the Boost::System library!)
fi fi
if test "x$link_system" = "xno"; then if test "x$link_system" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !) AC_MSG_ERROR(Could not link against $ax_lib !)

View File

@ -1,5 +1,5 @@
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html # https://www.gnu.org/software/autoconf-archive/ax_boost_thread.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
@ -30,73 +30,75 @@
# 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 32
AC_DEFUN([AX_BOOST_THREAD], AC_DEFUN([AX_BOOST_THREAD],
[ [
AC_ARG_WITH([boost-thread], AC_ARG_WITH([boost-thread],
AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@], AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@],
[use the Thread library from boost - it is possible to specify a certain library for the linker [use the Thread library from boost -
e.g. --with-boost-thread=boost_thread-gcc-mt ]), it is possible to specify a certain library for the linker
e.g. --with-boost-thread=boost_thread-gcc-mt ]),
[ [
if test "$withval" = "no"; then if test "$withval" = "yes"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes" want_boost="yes"
ax_boost_user_thread_lib="" ax_boost_user_thread_lib=""
else else
want_boost="yes" want_boost="yes"
ax_boost_user_thread_lib="$withval" ax_boost_user_thread_lib="$withval"
fi fi
], ],
[want_boost="yes"] [want_boost="yes"]
) )
if test "x$want_boost" = "xyes"; then if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD]) AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS" LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Thread library is available, AC_CACHE_CHECK(whether the Boost::Thread library is available,
ax_cv_boost_thread, ax_cv_boost_thread,
[AC_LANG_PUSH([C++]) [AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS CXXFLAGS_SAVE=$CXXFLAGS
if test "x$host_os" = "xsolaris" ; then if test "x$host_os" = "xsolaris" ; then
CXXFLAGS="-pthreads $CXXFLAGS" CXXFLAGS="-pthreads $CXXFLAGS"
elif test "x$host_os" = "xmingw32" ; then elif test "x$host_os" = "xmingw32" ; then
CXXFLAGS="-mthreads $CXXFLAGS" CXXFLAGS="-mthreads $CXXFLAGS"
else else
CXXFLAGS="-pthread $CXXFLAGS" CXXFLAGS="-pthread $CXXFLAGS"
fi fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]], AC_COMPILE_IFELSE([
[[boost::thread_group thrds; AC_LANG_PROGRAM(
return 0;]])], [[@%:@include <boost/thread/thread.hpp>]],
ax_cv_boost_thread=yes, ax_cv_boost_thread=no) [[boost::thread_group thrds;
CXXFLAGS=$CXXFLAGS_SAVE return 0;]])],
ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++]) AC_LANG_POP([C++])
]) ])
if test "x$ax_cv_boost_thread" = "xyes"; then if test "x$ax_cv_boost_thread" = "xyes"; then
if test "x$host_os" = "xsolaris" ; then if test "x$host_os" = "xsolaris" ; then
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS" BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
elif test "x$host_os" = "xmingw32" ; then elif test "x$host_os" = "xmingw32" ; then
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS" BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
else else
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS" BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
fi fi
AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) AC_DEFINE(HAVE_BOOST_THREAD,,
[define if the Boost::Thread library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS LDFLAGS_SAVE=$LDFLAGS
case "x$host_os" in case "x$host_os" in
*bsd* ) *bsd* )
LDFLAGS="-pthread $LDFLAGS" LDFLAGS="-pthread $LDFLAGS"
@ -104,47 +106,58 @@ AC_DEFUN([AX_BOOST_THREAD],
;; ;;
esac esac
if test "x$ax_boost_user_thread_lib" = "x"; then if test "x$ax_boost_user_thread_lib" = "x"; then
ax_lib=
for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
ax_lib=${libextension} ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit, AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], [link_thread="yes"; break],
[link_thread="no"]) [link_thread="no"])
done done
if test "x$link_thread" != "xyes"; then if test "x$link_thread" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do
ax_lib=${libextension} ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit, AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], [link_thread="yes"; break],
[link_thread="no"]) [link_thread="no"])
done done
fi fi
else else
for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
AC_CHECK_LIB($ax_lib, exit, AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], [link_thread="yes"; break],
[link_thread="no"]) [link_thread="no"])
done done
fi fi
if test "x$ax_lib" = "x"; then if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the boost_thread library!) AC_MSG_ERROR(Could not find a version of the Boost::Thread library!)
fi fi
if test "x$link_thread" = "xno"; then if test "x$link_thread" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !) AC_MSG_ERROR(Could not link against $ax_lib !)
else else
case "x$host_os" in BOOST_THREAD_LIB="-l$ax_lib"
*bsd* ) case "x$host_os" in
BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS" *bsd* )
break; BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
;; break;
esac ;;
xsolaris )
BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread"
break;
;;
xmingw32 )
break;
;;
* )
BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread"
break;
;;
esac
AC_SUBST(BOOST_THREAD_LIB)
fi
fi
fi CPPFLAGS="$CPPFLAGS_SAVED"
fi LDFLAGS="$LDFLAGS_SAVED"
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
]) ])

View File

@ -29,7 +29,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 21 #serial 22
AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK],
[ [
@ -124,7 +124,7 @@ AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK],
done done
fi fi
if test "x$ax_lib" = "x"; then if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!) AC_MSG_ERROR(Could not find a version of the Boost::Unit_Test_Framework library!)
fi fi
if test "x$link_unit_test_framework" != "xyes"; then if test "x$link_unit_test_framework" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !) AC_MSG_ERROR(Could not link against $ax_lib !)