From 6e04c6640263b30d88cf85004647a22737fa2188 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 3 Jun 2020 19:18:41 +0800 Subject: [PATCH] Support enable C++11. 4.0.29 --- README.md | 1 + trunk/auto/auto_headers.sh | 6 ++++++ trunk/auto/options.sh | 10 ++++++++++ trunk/configure | 2 +- trunk/src/core/srs_core_version4.hpp | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f6526de6..e2e0b14f9 100755 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-06-03, Support enable C++11. 4.0.29 * v4.0, 2020-05-31, Remove [srs-librtmp](https://github.com/ossrs/srs/issues/1535#issuecomment-633907655). 4.0.28 * v4.0, 2020-05-21, For [#307][bug #307], disable GSO and sendmmsg. 4.0.27 * v4.0, 2020-05-14, For [#307][bug #307], refine core structure, RTMP base on frame, RTC base on RTP. 4.0.26 diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 403328e78..6867c3945 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -69,6 +69,12 @@ else srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H fi +if [ $SRS_CXX11 = YES ]; then + srs_define_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H +fi + if [ $SRS_RTC = YES ]; then srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H else diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 49cf21be6..ad592662e 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -19,6 +19,7 @@ SRS_HDS=NO SRS_SRT=NO SRS_RTC=YES SRS_GB28181=NO +SRS_CXX11=NO SRS_NGINX=NO SRS_FFMPEG_TOOL=NO SRS_LIBRTMP=NO @@ -149,6 +150,7 @@ Features: --srt=on|off Whether build the SRT support for SRS. --rtc=on|off Whether build the WebRTC support for SRS. --gb28181=on|off Whether build the GB28181 support for SRS. + --cxx11=on|off Whether enable the C++11 support for SRS. --prefix= The absolute installation path for srs. Default: $SRS_PREFIX --gcov=on|off Whether enable the GCOV compiler options. @@ -321,6 +323,8 @@ function parse_user_option() { --without-gb28181) SRS_GB28181=NO ;; --gb28181) if [[ $value == off ]]; then SRS_GB28181=NO; else SRS_GB28181=YES; fi ;; + --cxx11) if [[ $value == off ]]; then SRS_CXX11=NO; else SRS_CXX11=YES; fi ;; + --with-clean) SRS_CLEAN=YES ;; --without-clean) SRS_CLEAN=NO ;; --clean) if [[ $value == off ]]; then SRS_CLEAN=NO; else SRS_CLEAN=YES; fi ;; @@ -514,6 +518,11 @@ function apply_user_presets() { SRS_UTEST=NO SRS_STATIC=NO fi + + # Enable c++11 for SRT. + if [[ $SRS_SRT == YES ]]; then + SRS_CXX11=YES + fi } apply_user_presets @@ -613,6 +622,7 @@ function regenerate_options() { if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=off"; fi if [ $SRS_SIMULATOR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=off"; fi if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=off"; fi + if [ $SRS_CXX11 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=off"; fi if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=off"; fi if [ $SRS_SRTP_ASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=off"; fi if [ $SRS_SENDMMSG = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=off"; fi diff --git a/trunk/configure b/trunk/configure index b2d283c0f..5bf253747 100755 --- a/trunk/configure +++ b/trunk/configure @@ -87,7 +87,7 @@ GDBDebug=" -g -O0" WarnLevel=" -Wall" # the compile standard. CppStd="-ansi" -if [[ $SRS_SRT == YES ]]; then +if [[ $SRS_CXX11 == YES ]]; then CppStd="-std=c++11" fi # performance of gprof diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index ff30ceb31..96b9826ef 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 28 +#define SRS_VERSION4_REVISION 29 #endif