mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Add C++ Standard detection to configure and fix a new C++20 compile issue
* The autoconf-archive package contains macros useful for detecting C++ standard and testing other C++ capabilities but that package was never included in the install_prereq script so many existing build environments won't have it. Even if it is installed, older versions won't newer C++ standards and will actually cause an error if you try to test for that version. To make it available for those environments, the ax_cxx_compile_stdcxx.m4 macro has copied from the latest release of autoconf-archive into the autoconf directory. * A convenience wrapper(ast_cxx_check_std) around ax_cxx_compile_stdcxx was also added so checking the standard version and setting the asterisk-specific PBX_ variables becomes a one-liner: `AST_CXX_CHECK_STD([std], [force_latest_std])`. Calling that with a version of `17` for instance, will set PBX_CXX17 to 0 or 1 depending on whether the current c++ compiler supports stdc++17. HAVE_CXX17 will also be 'defined" or not depending on the result. * C++ compilers hardly ever default to the latest standard they support. g++ version 14 for instance supports up to C++23 but only uses C++17 by default. If you want to use C++23, you have to add `-std=gnu++=23` to the g++ command line. If you set the second argument of AST_CXX_CHECK_STD to "yes", the macro will automatically keep the highest `-std=gnu++` value that worked and pass that to the Makefiles. * The autoconf-archive package was added to install_prereq for future use. * Updated configure.ac to use AST_CXX_CHECK_STD() to check for C++ versions 11, 14, 17, 20 and 23. * Updated configure.ac to accept the `--enable-latest-cxx-std` option which will set the second option to AST_CXX_CHECK_STD() to "yes". The default is "no". * ast_copy_string() in strings.h declares the 'sz' variable as volatile and does an `sz--` on it later. C++20 no longer allows the `++` and `--` increment and decrement operators to be used on variables declared as volatile however so that was changed to `sz -= 1`.
This commit is contained in:
@@ -19,7 +19,7 @@ usage() {
|
||||
}
|
||||
|
||||
# Basic build system:
|
||||
PACKAGES_DEBIAN="build-essential pkg-config"
|
||||
PACKAGES_DEBIAN="build-essential pkg-config autoconf-archive"
|
||||
# Asterisk: basic requirements:
|
||||
PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev"
|
||||
# Asterisk: for addons:
|
||||
@@ -35,7 +35,7 @@ PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion"
|
||||
PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch"
|
||||
|
||||
# Basic build system:
|
||||
PACKAGES_RH="make gcc gcc-c++ pkgconfig"
|
||||
PACKAGES_RH="make gcc gcc-c++ pkgconfig autoconf-archive"
|
||||
# Asterisk: basic requirements:
|
||||
PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel"
|
||||
# Asterisk: for addons:
|
||||
@@ -51,7 +51,7 @@ PACKAGES_RH="$PACKAGES_RH wget subversion"
|
||||
PACKAGES_RH="$PACKAGES_RH bzip2 patch"
|
||||
|
||||
# Basic build system:
|
||||
PACKAGES_SUSE="make gcc gcc-c++ pkg-config"
|
||||
PACKAGES_SUSE="make gcc gcc-c++ pkg-config autoconf-archive"
|
||||
# Asterisk: basic requirements:
|
||||
PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel"
|
||||
# Asterisk: for addons:
|
||||
@@ -67,7 +67,7 @@ PACKAGES_SUSE="$PACKAGES_SUSE wget subversion"
|
||||
PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch"
|
||||
|
||||
# Basic build system:
|
||||
PACKAGES_ARCH="make gcc pkg-config"
|
||||
PACKAGES_ARCH="make gcc pkg-config autoconf-archive"
|
||||
# Asterisk: basic requirements:
|
||||
PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite"
|
||||
# Asterisk: for addons:
|
||||
@@ -131,7 +131,7 @@ PACKAGES_OBSD="$PACKAGES_OBSD wget subversion"
|
||||
PACKAGES_OBSD="$PACKAGES_OBSD bzip2"
|
||||
|
||||
# Basic build system:
|
||||
PACKAGES_FBSD="gmake pkgconf"
|
||||
PACKAGES_FBSD="gmake pkgconf autoconf-archive"
|
||||
# Asterisk: basic requirements:
|
||||
PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"
|
||||
# Asterisk: for addons:
|
||||
|
Reference in New Issue
Block a user