diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index e215ad4b..160fc510 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -4,74 +4,15 @@ env: LLHTTP_VERSION: "v9.2.1" RESTINIO_VERSION: "0.7.8.1" EXPECTED_LITE_URL: "https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp" - UBUNTU_FULL_DEPS: "libncurses5-dev libreadline-dev nettle-dev libasio-dev libgnutls28-dev libuv1-dev python3-pip python3-dev python3-setuptools libcppunit-dev libjsoncpp-dev autotools-dev autoconf libfmt-dev libmsgpack-dev libargon2-dev" + UBUNTU_FULL_DEPS: "libncurses5-dev libreadline-dev nettle-dev libasio-dev libgnutls28-dev libuv1-dev python3-pip python3-dev python3-setuptools libcppunit-dev libjsoncpp-dev libfmt-dev libmsgpack-dev libargon2-dev" UBUNTU_MESON_DEPS: "ninja-build libncurses5-dev libreadline-dev nettle-dev libasio-dev libgnutls28-dev libuv1-dev python3-dev python3-setuptools python3-pip libcppunit-dev libjsoncpp-dev libfmt-dev libmsgpack-dev libargon2-dev" UBUNTU_MINIMAL_DEPS: "libncurses5-dev libreadline-dev nettle-dev libfmt-dev libgnutls28-dev libcppunit-dev libmsgpack-dev libargon2-dev" - DEBIAN12_DEPS: "git autotools-dev autoconf libtool m4 automake pkg-config wget cmake libncurses5-dev libreadline-dev nettle-dev libasio-dev libgnutls28-dev libuv1-dev python3-pip python3-dev python3-setuptools libcppunit-dev libjsoncpp-dev libfmt-dev libmsgpack-dev libargon2-dev" + DEBIAN12_DEPS: "git libtool pkg-config wget cmake libncurses5-dev libreadline-dev nettle-dev libasio-dev libgnutls28-dev libuv1-dev python3-pip python3-dev python3-setuptools libcppunit-dev libjsoncpp-dev libfmt-dev libmsgpack-dev libargon2-dev" on: [push, pull_request] jobs: - build-ubuntu: - name: Ubuntu/GCC Autotools build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Install Dependencies - run: | - echo "Installing Ubuntu full dependencies:" - sudo apt-get update - sudo apt-get install -y $UBUNTU_FULL_DEPS - - - name: Install Cython - run: sudo pip3 install Cython - - - name: Build llhttp dependency - run: | - mkdir llhttp - wget "https://github.com/nodejs/llhttp/archive/refs/tags/release/${LLHTTP_VERSION}.tar.gz" -O llhttp.tar.gz - tar -xzf llhttp.tar.gz -C llhttp --strip-components=1 - cd llhttp && cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j2 && sudo make install - cd ../ && rm -rf llhttp* - - - name: Install expected-lite header - run: | - sudo mkdir -p /usr/local/include/nonstd - sudo wget "${EXPECTED_LITE_URL}" -O /usr/local/include/nonstd/expected.hpp - - - name: Install simdutf - run: | - wget https://github.com/simdutf/simdutf/archive/refs/tags/v7.7.0.tar.gz -O simdutf.tar.gz - tar -xzf simdutf.tar.gz - mv simdutf-7.7.0 simdutf - mkdir simdutf/build && cd simdutf/build - cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSIMDUTF_CXX_STANDARD=17 -DSIMDUTF_TOOLS=Off -DSIMDUTF_TESTS=Off .. && make -j2 && sudo make install - cd ../../ && rm -rf simdutf - - - name: Build restinio dependency - run: | - mkdir restinio && cd restinio - wget "https://github.com/Stiffstream/restinio/releases/download/v${RESTINIO_VERSION}/restinio-${RESTINIO_VERSION}.tar.bz2" - tar -xjf restinio-${RESTINIO_VERSION}.tar.bz2 - cd restinio-${RESTINIO_VERSION}/dev - cmake -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off \ - -DRESTINIO_WITH_SOBJECTIZER=Off \ - -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ - -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . - sudo make install - cd ../../ && rm -rf restinio* - - - name: Configure project - run: | - ./autogen.sh - ./configure --enable-proxy-client - - - name: Build - run: make - - build-ubuntu-meson: + build-ubuntu-meson: name: Ubuntu/GCC Meson build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/clang-analyzer.yml b/.github/workflows/clang-analyzer.yml index b0a6a550..49c5b422 100644 --- a/.github/workflows/clang-analyzer.yml +++ b/.github/workflows/clang-analyzer.yml @@ -12,7 +12,7 @@ jobs: sudo apt update && \ sudo apt install libncurses5-dev libreadline-dev nettle-dev \ libgnutls28-dev libuv1-dev python3-dev python3-setuptools libcppunit-dev libjsoncpp-dev \ - autotools-dev autoconf libfmt-dev libmsgpack-dev libargon2-dev libasio-dev \ + libfmt-dev libmsgpack-dev libargon2-dev libasio-dev \ llvm llvm-dev clang clang-tools && \ sudo apt remove gcc g++ diff --git a/.gitignore b/.gitignore index 53f7e537..337768ff 100644 --- a/.gitignore +++ b/.gitignore @@ -23,33 +23,12 @@ **/dhtchat **/dhtscanner -# Autotools -/ac -Makefile -Makefile.in -/aclocal.m4 -/autom4te.cache/ -/config.* -/configure -/depcomp -/install-sh -/libtool -/ltmain.sh -/m4/ -/missing -/stamp-h? -.deps/ -.dirstamp -.libs/ -*.l[ao] -*~ -*.pc - # CMake CMakeCache.txt CMakeFiles/ cmake_install.cmake *ConfigVersion.cmake +*.pc # VSCode .vscode/* @@ -61,7 +40,6 @@ CMakeSettings.json # Eclipse CDT .cproject .project -.autotools language.settings.xml # Python diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 498329ba..00000000 --- a/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -AM_CXXFLAGS = -pthread - -SUBDIRS = - -SUBDIRS += src - -if ENABLE_C -SUBDIRS += c -endif - -if ENABLE_TOOLS -SUBDIRS += tools -endif - -if USE_CYTHON -SUBDIRS += python -endif - -if ENABLE_TESTS -SUBDIRS += tests -endif - -SUBDIRS += doc - -ACLOCAL_AMFLAGS = -I m4 - -DOC_FILES = \ - README.md \ - COPYING - -EXTRA_DIST = \ - $(DOC_FILES) - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = opendht.pc diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 52bbe560..00000000 --- a/autogen.sh +++ /dev/null @@ -1 +0,0 @@ -autoreconf --install --verbose -Wall diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 6188a311..00000000 --- a/configure.ac +++ /dev/null @@ -1,231 +0,0 @@ -dnl define macros -m4_define([opendht_major_version], 3) -m4_define([opendht_minor_version], 6) -m4_define([opendht_patch_version], 2) -m4_define([opendht_version], - [opendht_major_version.opendht_minor_version.opendht_patch_version]) - -AC_INIT(opendht, [opendht_version]) -AC_MSG_WARN([The Autotools build system for OpenDHT is deprecated and will be removed in a future release. Please use CMake or Meson instead.]) -AC_CONFIG_AUX_DIR(ac) -AM_INIT_AUTOMAKE([foreign subdir-objects]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_HOST - -AC_SUBST(OPENDHT_MAJOR_VERSION, opendht_major_version) -AC_SUBST(OPENDHT_MINOR_VERSION, opendht_minor_version) -AC_SUBST(OPENDHT_PATCH_VERSION, opendht_patch_version) - -AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Build in debug mode, adds stricter warnings, disables optimization])) -AS_IF([test "x$enable_debug" = "xyes"], - [CXXFLAGS="${CXXFLAGS} -g -Og -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Wno-deprecated -pedantic-errors"], - [CXXFLAGS="${CXXFLAGS} -O3 -Wno-deprecated -pedantic-errors -fvisibility=hidden"]) - -CPPFLAGS="${CPPFLAGS} -DOPENDHT_BUILD" -AM_CONDITIONAL([OPENDHT_SHARED], [test "x$enable_shared" != xno]) -AM_COND_IF(OPENDHT_SHARED, [ - CPPFLAGS="${CPPFLAGS} -Dopendht_EXPORTS" -]) - -AM_PROG_AR -LT_INIT() -LT_LANG(C++) -AC_LANG(C++) -AC_PROG_CXX -AX_CXX_COMPILE_STDCXX(17,[noext],[mandatory]) - -dnl Check for C binding -AC_ARG_ENABLE([c], [AS_HELP_STRING([--disable-c], [Disable DHT C binding])]) -AM_CONDITIONAL(ENABLE_C, test x$enable_c != "xno") -AM_COND_IF(ENABLE_C, [ - AC_DEFINE([OPENDHT_C], [], [Define if DHT C biding is enabled]) -]) - -dnl Check for indexation -AC_ARG_ENABLE([indexation], [AS_HELP_STRING([--disable-indexation], [Disable DHT indexation])]) -AM_CONDITIONAL(ENABLE_INDEXATION, test x$enable_indexation != "xno") -AM_COND_IF(ENABLE_INDEXATION, [ - AC_DEFINE([OPENDHT_INDEXATION], [], [Define if DHT indexation is enabled]) -]) - -AC_ARG_ENABLE([peer-discovery], [AS_HELP_STRING([--disable-peer-discovery], [Disable peer-discovery])]) -AM_CONDITIONAL(ENABLE_PEER_DISCOVERY, test x$enable_peer_discovery != "xno") -AM_COND_IF(ENABLE_PEER_DISCOVERY, [AC_DEFINE([OPENDHT_PEER_DISCOVERY], [], [Define if peer discovery is enabled])]) - -dnl Check for Doxygen -AC_ARG_ENABLE([doc], AS_HELP_STRING([--enable-doc], [Enable documentation generation (doxygen)])) -AS_IF([test "x$enable_doc" = "xyes"], [ - AC_CHECK_PROGS([DOXYGEN], [doxygen]) - AS_IF([test -z "$DOXYGEN"], - [AC_MSG_ERROR([Doxygen is required to generate the documentation.])]) -]) -AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) - -dnl Check for Python -AC_ARG_ENABLE([python], [AS_HELP_STRING([--disable-python], [Disable python binding])]) -AS_IF([test "x$enable_python" = "xyes"], [ - AM_COND_IF([ENABLE_INDEXATION], [ - AM_PATH_PYTHON([3.3],, [:]) - AS_IF([test -n "$PYTHON"],[ - echo 'import Cython' | $PYTHON - AS_IF([test $? == 0], - [CYTHON=yes], - [AC_MSG_ERROR([Cython not found, but required for Python support.])]) - AC_CHECK_PROGS([PIP], [pip3]) - AS_IF([test -z "$PIP"], - [AC_MSG_WARN([pip not found - continuing without python uninstall support])])]) - ], [AC_MSG_ERROR([Python support requires DHT indexation to be turned on.])])]) -AM_CONDITIONAL([USE_CYTHON], [test -n "$CYTHON"]) -AM_CONDITIONAL([HAVE_PIP], [test -n "$PIP"]) - -case "${host_os}" in - "") - SYS=unknown - ;; - *android*) - SYS=android - ;; - linux*) - SYS=linux - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L" - ;; - darwin*) - SYS=darwin - ;; - mingw32*) - SYS=mingw32 - WIN32=1 - AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.]) - AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.]) - AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition]) - AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.]) - AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.]) - LDFLAGS="${LDFLAGS} -lws2_32" - AC_SUBST(WINDOWS_ARCH) - AC_SUBST(PROGRAMFILES) - ;; - *) - SYS="${host_os}" - ;; -esac - -AM_CONDITIONAL(WIN32, [test "x$SYS" = "xmingw32"]) -AS_IF([test "x$SYS" = "xandroid"], - [], [LDFLAGS="${LDFLAGS} -lpthread"]) - -PKG_PROG_PKG_CONFIG() - -AC_ARG_ENABLE([proxy_server], AS_HELP_STRING([--enable-proxy-server], [Enable proxy server ability]), proxy_server=yes, proxy_server=no) -AM_CONDITIONAL(ENABLE_PROXY_SERVER, test x$proxy_server == xyes) - -AC_ARG_ENABLE([push_notifications], AS_HELP_STRING([--enable-push-notifications], [Enable push notifications support]), push_notifications=yes, push_notifications=no) -AM_CONDITIONAL(ENABLE_PUSH_NOTIFICATIONS, test x$push_notifications == xyes) - -AC_ARG_ENABLE([proxy_server_identity], AS_HELP_STRING([--enable-proxy-server-identity], - [Enable proxy server ability]), proxy_server_identity=yes, proxy_server_identity=no) -AM_CONDITIONAL(ENABLE_PROXY_SERVER_IDENTITY, test x$proxy_server_identity == xyes -a x$proxy_server == xyes) -AC_ARG_ENABLE([proxy_server_identity], AS_HELP_STRING([--enable-proxy-server-identity], - [Enable proxy server ability]), proxy_server_identity=yes, proxy_server_identity=no) - -AC_ARG_ENABLE([proxy_client], AS_HELP_STRING([--enable-proxy-client], [Enable proxy client ability]), proxy_client=yes, proxy_client=no) -AM_CONDITIONAL(ENABLE_PROXY_CLIENT, test x$proxy_client == xyes) - -AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [Enable tests]), build_tests=yes, build_tests=no) -AM_CONDITIONAL(ENABLE_TESTS, test "x$build_tests" == xyes) -AS_IF([test "x$build_tests" == xyes], [ - PKG_CHECK_MODULES([CppUnit], [cppunit >= 1.12]) -]) - -AM_CONDITIONAL(PROXY_CLIENT_OR_SERVER, test x$proxy_client == xyes || test x$proxy_server == xyes) - -PKG_CHECK_MODULES([Nettle], [nettle >= 2.4]) -PKG_CHECK_MODULES([GnuTLS], [gnutls >= 3.3]) -AC_CHECK_HEADERS([msgpack.hpp], [], [ - PKG_CHECK_MODULES([MsgPack], [msgpack-cxx >= 1.2]) -]) -PKG_CHECK_MODULES([Argon2], [libargon2]) -AC_SUBST(argon2_lib, [", libargon2"]) - -AC_ARG_WITH([jsoncpp], AS_HELP_STRING([--without-jsoncpp], [Build without JsonCpp support])) -AS_IF([test "x$with_jsoncpp" != "xno"], - [PKG_CHECK_MODULES([JsonCpp], [jsoncpp >= 1.7.2], [have_jsoncpp=yes], [have_jsoncpp=no]) - PKG_CHECK_MODULES([simdutf], [simdutf >= 6], [have_simdutf=yes], [have_simdutf=no])], - [have_jsoncpp=no]) -AS_IF([test "x$have_jsoncpp" = "xyes"], [ - AC_MSG_NOTICE([Using JsonCpp]) - CPPFLAGS="${CPPFLAGS} -DOPENDHT_JSONCPP" - AC_SUBST(jsoncpp_lib, [", jsoncpp"]) - AC_SUBST(simdutf_lib, [", simdutf"]) -], [ - AC_MSG_NOTICE([Not using JsonCpp]) - AM_COND_IF(PROXY_CLIENT_OR_SERVER, AC_MSG_ERROR(["JsonCpp is required for proxy/push notification support"])) -]) - -AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl], [Build without OpenSSL support])) -AS_IF([test "x$with_openssl" != "xno"], - [PKG_CHECK_MODULES([OpenSSL], [openssl >= 1.1], [have_openssl=yes], [have_openssl=no])], - [have_openssl=no]) -AS_IF([test "x$have_openssl" = "xyes"], [ - AC_MSG_NOTICE([Using OpenSSL]) - AC_SUBST(openssl_lib, [", openssl"]) -], [ - AC_MSG_NOTICE([Not using OpenSSL]) -]) - -PKG_CHECK_MODULES([Fmt], [fmt >= 5.3.0], [have_fmt=yes], [have_fmt=no]) -AS_IF([test "x$have_fmt" = "xyes"], [ - AC_MSG_NOTICE([Using libfmt]) -], [ - AC_MSG_NOTICE([Missing libfmt files]) -]) - -AM_COND_IF([PROXY_CLIENT_OR_SERVER], [ - AC_CHECK_HEADERS([asio.hpp],, AC_MSG_ERROR([Missing Asio headers files])) - CXXFLAGS="${CXXFLAGS} -DASIO_STANDALONE" - PKG_CHECK_MODULES([Llhttp], [libllhttp]) - llhttp_lib=", libllhttp" -]) -AC_SUBST(llhttp_lib) - -AC_ARG_WITH([liburing], AS_HELP_STRING([--with-liburing], [Build with io_uring support(Linux only)]),[], [with_liburing=no]) -AS_IF([test "x$with_liburing" != "xno"], [ - CXX_FLAGS="${CXXFLAGS} -DASIO_HAS_IO_URING -DASIO_DISABLE_EPOLL" - PKG_CHECK_MODULES([Liburing], [liburing]) - iouring_lib=", liburing" -]) -AC_SUBST(iouring_lib) - -CXXFLAGS="${CXXFLAGS} -DMSGPACK_NO_BOOST -DMSGPACK_DISABLE_LEGACY_NIL -DMSGPACK_DISABLE_LEGACY_CONVERT" - -AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools],[Disable tools (CLI DHT node)]),,build_tools=yes) -AM_CONDITIONAL(ENABLE_TOOLS, test x$build_tools == xyes) -AM_COND_IF([ENABLE_TOOLS], [ - AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], - [AC_MSG_ERROR([Unable to find readline.h. Readline is required for the tools.]) - ]) -]) - -AM_COND_IF(ENABLE_PROXY_SERVER, AC_DEFINE([OPENDHT_PROXY_SERVER], [], [Building with proxy server])) -AM_COND_IF(ENABLE_PROXY_CLIENT, AC_DEFINE([OPENDHT_PROXY_CLIENT], [], [Building with proxy client])) -AM_COND_IF(ENABLE_PUSH_NOTIFICATIONS, [CPPFLAGS="${CPPFLAGS} -DOPENDHT_PUSH_NOTIFICATIONS"], []) -AM_COND_IF(ENABLE_PROXY_SERVER_IDENTITY, [CPPFLAGS="${CPPFLAGS} -DOPENDHT_PROXY_SERVER_IDENTITY"], []) - -dnl Configure setup.py if we build the python module -AC_SUBST(CURRENT_SOURCE_DIR, ".") -AC_SUBST(CURRENT_BINARY_DIR, ".") -AC_SUBST(PROJECT_SOURCE_DIR, "..") -AC_SUBST(PROJECT_BINARY_DIR, "../src/.libs") - -AC_CONFIG_FILES([Makefile - src/Makefile - c/Makefile - tools/Makefile - python/Makefile - python/setup.py - tests/Makefile - doc/Makefile - doc/Doxyfile - opendht.pc]) -AC_MSG_WARN([The Autotools build system for OpenDHT is deprecated and will be removed in a future release. Please use CMake or Meson instead.]) -AC_OUTPUT diff --git a/docker/DockerfileDeps b/docker/DockerfileDeps index 6d5519e7..0c167d95 100644 --- a/docker/DockerfileDeps +++ b/docker/DockerfileDeps @@ -3,22 +3,22 @@ LABEL maintainer="Adrien Béraud " LABEL org.opencontainers.image.source=https://github.com/savoirfairelinux/opendht RUN apt-get update && apt-get install -y \ - dialog apt-utils \ + dialog apt-utils \ && apt-get clean \ && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update && apt-get install -y \ - build-essential pkg-config cmake git wget meson \ - libtool autotools-dev autoconf \ - python3-dev python3-setuptools python3-build python3-virtualenv cython3 \ - libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \ - libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev \ - libssl-dev libfmt-dev libasio-dev libmsgpack-dev \ + build-essential pkg-config cmake git wget meson \ + libtool \ + python3-dev python3-setuptools python3-build python3-virtualenv cython3 \ + libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \ + libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev \ + libssl-dev libfmt-dev libasio-dev libmsgpack-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/* RUN mkdir /usr/include/nonstd \ && wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp \ - -O /usr/include/nonstd/expected.hpp + -O /usr/include/nonstd/expected.hpp RUN echo "*** Downloading RESTinio ***" \ && mkdir restinio && cd restinio \ @@ -26,7 +26,7 @@ RUN echo "*** Downloading RESTinio ***" \ && ls -l && tar -xjf restinio-0.7.8.1.tar.bz2 \ && cd restinio-0.7.8.1/dev \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off \ - -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ - -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ + -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ + -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ && make -j2 && make install \ && cd ../../ && rm -rf restinio* diff --git a/docker/DockerfileDepsFocal b/docker/DockerfileDepsFocal index 165d14e9..3d9f4dc3 100644 --- a/docker/DockerfileDepsFocal +++ b/docker/DockerfileDepsFocal @@ -3,24 +3,24 @@ LABEL maintainer="Adrien Béraud " LABEL org.opencontainers.image.source=https://github.com/savoirfairelinux/opendht RUN apt-get update && apt-get install -y \ - dialog apt-utils \ + dialog apt-utils \ && apt-get clean \ && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update && apt-get install -y \ - build-essential pkg-config cmake git wget \ - libtool autotools-dev autoconf \ - python3-dev python3-setuptools python3-pip \ - libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \ - libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev \ - libssl-dev libfmt-dev libasio-dev libmsgpack-dev \ + build-essential pkg-config cmake git wget \ + libtool \ + python3-dev python3-setuptools python3-pip \ + libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \ + libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev \ + libssl-dev libfmt-dev libasio-dev libmsgpack-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/* RUN pip3 install meson Cython RUN mkdir /usr/include/nonstd \ && wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp \ - -O /usr/include/nonstd/expected.hpp + -O /usr/include/nonstd/expected.hpp RUN echo "*** Downloading RESTinio ***" \ && mkdir restinio && cd restinio \ @@ -28,7 +28,7 @@ RUN echo "*** Downloading RESTinio ***" \ && ls -l && tar -xjf restinio-0.7.3.tar.bz2 \ && cd restinio-0.7.3/dev \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off \ - -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ - -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ + -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ + -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ && make -j2 && make install \ && cd ../../ && rm -rf restinio* diff --git a/docker/DockerfileDepsLlvm b/docker/DockerfileDepsLlvm index 983f1050..79e00613 100644 --- a/docker/DockerfileDepsLlvm +++ b/docker/DockerfileDepsLlvm @@ -3,17 +3,17 @@ LABEL maintainer="Adrien Béraud " LABEL org.opencontainers.image.source=https://github.com/savoirfairelinux/opendht RUN apt-get update && apt-get install -y \ - dialog apt-utils \ + dialog apt-utils \ && apt-get clean \ && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update \ && apt-get install -y llvm llvm-dev lldb clang gdb make cmake meson pkg-config \ - libtool git wget libncurses5-dev libreadline-dev \ - nettle-dev libgnutls28-dev libuv1-dev libmsgpack-dev libjsoncpp-dev python3-dev \ - python3-setuptools libcppunit-dev python3-pip python3-build python3-virtualenv \ - autotools-dev autoconf libssl-dev libargon2-dev \ - libfmt-dev libasio-dev \ + libtool git wget libncurses5-dev libreadline-dev \ + nettle-dev libgnutls28-dev libuv1-dev libmsgpack-dev libjsoncpp-dev python3-dev \ + python3-setuptools libcppunit-dev python3-pip python3-build python3-virtualenv \ + libssl-dev libargon2-dev \ + libfmt-dev libasio-dev \ && apt-get remove -y gcc g++ && apt-get autoremove -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/* @@ -24,7 +24,7 @@ ENV CXX=c++ RUN mkdir /usr/include/nonstd \ && wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp \ - -O /usr/include/nonstd/expected.hpp + -O /usr/include/nonstd/expected.hpp RUN echo "*** Downloading RESTinio ***" \ && mkdir restinio && cd restinio \ @@ -32,7 +32,7 @@ RUN echo "*** Downloading RESTinio ***" \ && ls -l && tar -xjf restinio-0.7.8.1.tar.bz2 \ && cd restinio-0.7.8.1/dev \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off \ - -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ - -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ + -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system \ + -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system . \ && make -j2 && make install \ && cd ../../ && rm -rf restinio* diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 51a35054..00000000 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,1005 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for -# the respective C++ standard version. -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for no added switch, and then for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016, 2018 Krzesimir Nowak -# Copyright (c) 2019 Enji Cooper -# Copyright (c) 2020 Jason Merrill -# Copyright (c) 2021 Jörn Heusipp -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 14 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [$1], [20], [ax_cxx_compile_alternatives="20"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$2], [], [dnl - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi]) - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - 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 Cray's crayCC needs "-h std=c++11" - 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]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -dnl Test body for checking C++17 support - -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 Test body for checking C++20 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual ~Base() {} - virtual void f() {} - }; - - struct Derived : public Base - { - virtual ~Derived() override {} - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, 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++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#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 < 201703L - -#error "This is not a C++17 compiler" - -#else - -#include -#include -#include - -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { - - constexpr int foo = [](){return 42;}(); - - } - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - 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, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template 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 - 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; - } - } - - } - - namespace test_template_argument_deduction_for_class_templates - { - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - - namespace test_structured_bindings - { - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - 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(); - - } - - namespace test_exception_spec_type_system - { - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus < 201703L - -]]) - - -dnl Tests for new features in C++20 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 202002L - -#error "This is not a C++20 compiler" - -#else - -#include - -namespace cxx20 -{ - -// As C++20 supports feature test macros in the standard, there is no -// immediate need to actually test for feature availability on the -// Autoconf side. - -} // namespace cxx20 - -#endif // __cplusplus < 202002L - -]])