Skip to content
Prev 8877 / 12125 Next

[R-pkg-devel] How to update "SystemRequirements: C++11"?

This might be helpful. Using autoconf and ax_cxx_compile_stdcxx (
https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html)
in package_root/tools/m4:

configure.ac
------------
AC_PREREQ(2.64)
AC_INIT(yourpackagename, 1.0, your at email.com)
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_AUX_DIR([tools/build-aux])
AC_CONFIG_FILES([src/Makevars])

m4_include([tools/m4/ax_cxx_compile_stdcxx.m4])

AX_CXX_COMPILE_STDCXX([11], [], [mandatory])
AX_CXX_COMPILE_STDCXX([14], [], [optional])
AX_CXX_COMPILE_STDCXX([17], [], [optional])

MAX_SUPPORTED_CXX_VERSION=CXX11
if test -z "$HAVECXX14"; then
  MAX_SUPPORTED_CXX_VERSION=CXX14
  if test -z "$HAVECXX17"; then
    MAX_SUPPORTED_CXX_VERSION=CXX17
  fi
fi

AC_SUBST(MAX_SUPPORTED_CXX_VERSION)

AC_OUTPUT

Makevars.in
-----------
CXX_STD = @MAX_SUPPORTED_CXX_VERSION@
# usual make stuff

DESCRIPTION
-----------
# usual description stuff
SystemRequirements: C++11
# add authors of compiler macro to authors field


On Mon, Feb 6, 2023 at 6:10 PM Avraham Adler <avraham.adler at gmail.com>
wrote: