2013-11-27 14:41:58 +00:00
#!/bin/bash
2014-07-23 06:37:54 +00:00
################################################################
2021-05-21 09:14:04 +00:00
help = no
2014-07-23 06:37:54 +00:00
# feature options
2018-12-22 12:51:57 +00:00
SRS_HDS = NO
2022-06-14 11:13:14 +00:00
SRS_SRT = YES
2021-06-21 23:49:48 +00:00
SRS_RTC = YES
2022-10-06 09:40:58 +00:00
SRS_GB28181 = NO
2021-01-31 06:54:51 +00:00
SRS_CXX11 = YES
2020-06-11 09:12:37 +00:00
SRS_CXX14 = NO
2022-10-21 15:30:43 +00:00
SRS_BACKTRACE = YES
2018-12-22 12:51:57 +00:00
SRS_NGINX = NO
2020-03-21 12:41:37 +00:00
SRS_UTEST = NO
2017-02-11 05:29:53 +00:00
# Always enable the bellow features.
2018-12-22 12:45:25 +00:00
SRS_STREAM_CASTER = YES
2018-12-22 12:30:13 +00:00
SRS_INGEST = YES
2018-12-22 12:03:40 +00:00
SRS_SSL = YES
2020-11-03 08:56:05 +00:00
SRS_SSL_1_0 = NO
2021-01-26 09:54:44 +00:00
SRS_SSL_LOCAL = NO
2020-11-03 08:56:05 +00:00
SRS_HTTPS = YES
2018-12-22 11:58:36 +00:00
SRS_STAT = YES
2018-12-22 11:48:55 +00:00
SRS_TRANSCODE = YES
2017-01-23 09:43:59 +00:00
SRS_HTTP_CALLBACK = YES
SRS_HTTP_SERVER = YES
SRS_HTTP_API = YES
SRS_HTTP_CORE = YES
2017-02-11 05:29:53 +00:00
SRS_HLS = YES
2017-02-11 09:27:40 +00:00
SRS_DVR = YES
2021-04-24 11:45:05 +00:00
SRS_CHERRYPY = NO
2014-04-16 06:14:48 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2020-06-24 04:44:13 +00:00
# FFmpeg stub is the stub code in SRS for ingester or encoder.
2019-02-02 13:42:03 +00:00
SRS_FFMPEG_STUB = NO
2020-06-24 04:44:13 +00:00
# FFmpeg tool is the binary for FFmpeg tool, to exec ingest or transcode.
SRS_FFMPEG_TOOL = NO
# FFmpeg fit is the source code for RTC, to transcode audio or video in SRS.
SRS_FFMPEG_FIT = RESERVED
2014-03-04 04:45:41 +00:00
# arguments
2014-03-22 14:07:14 +00:00
SRS_PREFIX = /usr/local/srs
2022-01-13 10:26:28 +00:00
SRS_DEFAULT_CONFIG = conf/srs.conf
2014-03-04 04:45:41 +00:00
SRS_JOBS = 1
2019-02-02 13:42:03 +00:00
SRS_STATIC = NO
2020-01-26 09:33:10 +00:00
# If enabled, link shared libraries for libst.so which uses MPL license.
2022-07-31 09:12:14 +00:00
# See https://ossrs.net/lts/zh-cn/license#state-threads
2020-01-26 09:33:10 +00:00
SRS_SHARED_ST = NO
2020-01-26 09:41:05 +00:00
# If enabled, link shared libraries for libsrt.so which uses MPL license.
2022-07-31 09:12:14 +00:00
# See https://ossrs.net/lts/zh-cn/license#srt
2020-01-26 09:41:05 +00:00
SRS_SHARED_SRT = NO
2021-06-01 07:39:37 +00:00
# If enabled, link shared libraries for FFmpeg which is LGPL license.
2022-07-31 09:12:14 +00:00
# See https://ossrs.net/lts/zh-cn/license#ffmpeg
2021-06-01 07:39:37 +00:00
SRS_SHARED_FFMPEG = NO
2019-02-02 13:42:03 +00:00
# whether enable the gcov
SRS_GCOV = NO
2014-07-23 06:37:54 +00:00
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
2019-02-02 13:42:03 +00:00
SRS_LOG_VERBOSE = NO
SRS_LOG_INFO = NO
2020-07-05 14:01:03 +00:00
SRS_LOG_TRACE = YES
2022-10-26 13:23:03 +00:00
# Whether use new level definition, see https://stackoverflow.com/a/2031209/17679565
SRS_LOG_LEVEL_V2 = YES
2014-04-06 11:19:13 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2021-05-21 09:14:04 +00:00
# Experts options.
SRS_USE_SYS_SSL = NO # Use system ssl(-lssl) if required.
2017-06-28 01:08:19 +00:00
SRS_VALGRIND = NO
2022-10-22 23:21:15 +00:00
SRS_SANITIZER = YES
SRS_SANITIZER_STATIC = NO
2021-05-21 09:14:04 +00:00
SRS_BUILD_TAG = # Set the object files tag name.
SRS_CLEAN = YES # Whether do "make clean" when configure.
SRS_SIMULATOR = NO # Whether enable RTC simulate API.
2022-08-08 13:39:42 +00:00
SRS_GENERATE_OBJS = NO # Whether generate objs and quit.
2022-11-19 04:11:03 +00:00
SRS_SINGLE_THREAD = NO # Whether force single thread mode.
2014-04-16 06:27:34 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2021-05-21 09:14:04 +00:00
# Performance options.
SRS_GPERF = NO # Performance test: tcmalloc
SRS_GPERF_MC = NO # Performance test: gperf memory check
SRS_GPERF_MD = NO # Performance test: gperf memory defence
SRS_GPERF_MP = NO # Performance test: gperf memory profile
SRS_GPERF_CP = NO # Performance test: gperf cpu profile
SRS_GPROF = NO # Performance test: gprof
#
################################################################
# Preset options
2022-11-18 15:02:35 +00:00
SRS_OSX = #For OSX/macOS/Darwin PC.
SRS_CROSS_BUILD = #For cross build, for example, on Ubuntu.
2021-10-03 06:17:53 +00:00
# For cross build, the cpu, for example(FFmpeg), --cpu=24kc
SRS_CROSS_BUILD_CPU =
# For cross build, the arch, for example(FFmpeg), --arch=aarch64
SRS_CROSS_BUILD_ARCH =
2021-06-21 23:49:48 +00:00
# For cross build, the host, for example(libsrtp), --host=aarch64-linux-gnu
SRS_CROSS_BUILD_HOST =
# For cross build, the cross prefix, for example(FFmpeg), --cross-prefix=aarch64-linux-gnu-
SRS_CROSS_BUILD_PREFIX =
2014-05-04 10:38:08 +00:00
#
2019-12-25 05:17:49 +00:00
#####################################################################################
2021-05-21 09:14:04 +00:00
# Toolchain for cross-build on Ubuntu for ARM or MIPS.
2020-01-21 02:28:25 +00:00
SRS_TOOL_CC = gcc
SRS_TOOL_CXX = g++
SRS_TOOL_AR = ar
2020-01-21 05:59:43 +00:00
SRS_TOOL_LD = ld
SRS_TOOL_RANDLIB = randlib
2020-01-21 02:28:25 +00:00
SRS_EXTRA_FLAGS =
2020-04-03 06:37:48 +00:00
#
#####################################################################################
# Performance optimize.
2021-01-25 14:23:42 +00:00
SRS_NASM = YES
SRS_SRTP_ASM = YES
2020-04-14 12:12:33 +00:00
SRS_DEBUG = NO
2021-02-15 05:09:13 +00:00
SRS_DEBUG_STATS = NO
2013-11-27 14:41:58 +00:00
2014-02-28 06:38:27 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
# menu
2014-02-28 06:38:27 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
function show_help( ) {
cat << END
2013-11-27 14:41:58 +00:00
2020-01-20 02:44:46 +00:00
Presets:
2021-10-03 06:17:53 +00:00
--cross-build Enable cross-build, please set bellow Toolchain also. Default: $( value2switch $SRS_CROSS_BUILD )
2021-01-18 09:28:51 +00:00
--osx Enable build for OSX/Darwin AppleOS. Default: $( value2switch $SRS_OSX )
2020-01-20 02:44:46 +00:00
Features:
-h, --help Print this message and exit 0.
2021-01-18 09:28:51 +00:00
--https= on| off Whether enable HTTPS client and server. Default: $( value2switch $SRS_HTTPS )
--hds= on| off Whether build the hds streaming, mux RTMP to F4M/F4V files. Default: $( value2switch $SRS_HDS )
--cherrypy= on| off Whether install CherryPy for demo api-server. Default: $( value2switch $SRS_CHERRYPY )
--utest= on| off Whether build the utest. Default: $( value2switch $SRS_UTEST )
--srt= on| off Whether build the SRT. Default: $( value2switch $SRS_SRT )
--rtc= on| off Whether build the WebRTC. Default: $( value2switch $SRS_RTC )
2022-10-06 09:40:58 +00:00
--gb28181= on| off Whether build the GB28181. Default: $( value2switch $SRS_GB28181 )
2021-01-18 09:28:51 +00:00
--cxx11= on| off Whether enable the C++11. Default: $( value2switch $SRS_CXX11 )
--cxx14= on| off Whether enable the C++14. Default: $( value2switch $SRS_CXX14 )
2022-10-21 15:30:43 +00:00
--backtrace= on| off Whether show backtrace when crashing. Default: $( value2switch $SRS_BACKTRACE )
2021-01-18 09:28:51 +00:00
--ffmpeg-fit= on| off Whether enable the FFmpeg fit( source code) . Default: $( value2switch $SRS_FFMPEG_FIT )
--prefix= <path> The absolute installation path. Default: $SRS_PREFIX
2022-01-13 10:26:28 +00:00
--config= <path> The default config file for SRS. Default: $SRS_DEFAULT_CONFIG
2021-01-18 09:28:51 +00:00
--gcov= on| off Whether enable the GCOV compiler options. Default: $( value2switch $SRS_GCOV )
--debug= on| off Whether enable the debug code, may hurt performance. Default: $( value2switch $SRS_DEBUG )
2021-02-15 05:09:13 +00:00
--debug-stats= on| off Whether enable the debug stats, may hurt performance. Default: $( value2switch $SRS_DEBUG_STATS )
2021-01-18 09:28:51 +00:00
--jobs[ = N] Allow N jobs at once; infinite jobs with no arg. Default: $SRS_JOBS
2021-02-15 11:24:23 +00:00
--log-verbose= on| off Whether enable the log verbose level. Default: $( value2switch $SRS_LOG_VERBOSE )
--log-info= on| off Whether enable the log info level. Default: $( value2switch $SRS_LOG_INFO )
--log-trace= on| off Whether enable the log trace level. Default: $( value2switch $SRS_LOG_TRACE )
2022-10-26 13:23:03 +00:00
--log-level_v2= on| off Whether use v2.0 log level definition, see log4j specs. Default: $( value2switch $SRS_LOG_LEVEL_V2 )
2020-01-20 02:44:46 +00:00
2020-01-21 02:28:25 +00:00
Performance: @see https://blog.csdn.net/win_lin/article/details/53503869
2021-01-18 09:28:51 +00:00
--valgrind= on| off Whether build valgrind for memory check. Default: $( value2switch $SRS_VALGRIND )
--gperf= on| off Whether build SRS with gperf tools( no gmd/gmc/gmp/gcp, with tcmalloc only) . Default: $( value2switch $SRS_GPERF )
--gmc= on| off Whether build memory check with gperf tools. Default: $( value2switch $SRS_GPERF_MC )
--gmd= on| off Whether build memory defense( corrupt memory) with gperf tools. Default: $( value2switch $SRS_GPERF_MD )
--gmp= on| off Whether build memory profile with gperf tools. Default: $( value2switch $SRS_GPERF_MP )
--gcp= on| off Whether build cpu profile with gperf tools. Default: $( value2switch $SRS_GPERF_CP )
--gprof= on| off Whether build SRS with gprof( GNU profile tool) . Default: $( value2switch $SRS_GPROF )
2022-10-22 23:21:15 +00:00
--sanitizer= on| off Whether build SRS with address sanitizer. Default: $( value2switch $SRS_SANITIZER )
--sanitizer-static= on| off Whether build SRS with static libasan. Default: $( value2switch $SRS_SANITIZER_STATIC )
2021-01-18 09:28:51 +00:00
--nasm= on| off Whether build FFMPEG for RTC with nasm. Default: $( value2switch $SRS_NASM )
--srtp-nasm= on| off Whether build SRTP with ASM( openssl-asm) , requires RTC and openssl-1.0.*. Default: $( value2switch $SRS_SRTP_ASM )
2020-04-03 06:37:48 +00:00
2022-08-05 10:24:46 +00:00
Toolchain options:
2021-02-15 11:24:23 +00:00
--static= on| off Whether add '-static' to link options. Default: $( value2switch $SRS_STATIC )
2021-05-20 12:07:13 +00:00
--cc= <CC> Toolchain: Use c compiler CC. Default: $SRS_TOOL_CC
--cxx= <CXX> Toolchain: Use c++ compiler CXX. Default: $SRS_TOOL_CXX
--ar= <AR> Toolchain: Use archive tool AR. Default: $SRS_TOOL_CXX
--ld= <LD> Toolchain: Use linker tool LD. Default: $SRS_TOOL_CXX
--randlib= <RANDLIB> Toolchain: Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX
2020-01-20 02:44:46 +00:00
--extra-flags= <EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
2022-08-05 10:24:46 +00:00
Cross Build options: @see https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs
2022-08-11 08:55:24 +00:00
--cpu= <CPU> Toolchain: Select the minimum required CPU for cross-build. For example: --cpu= 24kc
--arch= <ARCH> Toolchain: Select architecture for cross-build. For example: --arch= aarch64
--host= <BUILD> Toolchain: Cross-compile to build programs to run on HOST. For example: --host= aarch64-linux-gnu
--cross-prefix= <PREFIX> Toolchain: Use PREFIX for compilation tools. For example: --cross-prefix= aarch64-linux-gnu-
2022-08-05 10:24:46 +00:00
2014-04-16 06:27:34 +00:00
Experts:
2021-01-18 09:28:51 +00:00
--sys-ssl= on| off Do not compile ssl, use system ssl( -lssl) if required. Default: $( value2switch $SRS_USE_SYS_SSL )
2021-01-26 09:54:44 +00:00
--ssl-1-0= on| off Whether use openssl-1.0.*. Default: $( value2switch $SRS_SSL_1_0 )
--ssl-local= on| off Whether use local openssl, not system even exists. Default: $( value2switch $SRS_SSL_LOCAL )
2021-06-01 07:39:37 +00:00
--shared-st= on| off Use shared libraries for ST which is MPL license. Default: $( value2switch $SRS_SHARED_ST )
--shared-srt= on| off Use shared libraries for SRT which is MPL license. Default: $( value2switch $SRS_SHARED_SRT )
--shared-ffmpeg= on| off Use shared libraries for FFmpeg which is LGPL license. Default: $( value2switch $SRS_SHARED_FFMPEG )
2021-01-18 09:28:51 +00:00
--clean= on| off Whether do 'make clean' when configure. Default: $( value2switch $SRS_CLEAN )
2021-05-21 09:14:04 +00:00
--simulator= on| off RTC: Whether enable network simulator. Default: $( value2switch $SRS_SIMULATOR )
2022-08-08 13:39:42 +00:00
--generate-objs= on| off RTC: Whether generate objs and quit. Default: $( value2switch $SRS_GENERATE_OBJS )
2022-11-19 04:11:03 +00:00
--single-thread= on| off Whether force single thread mode. Default: $( value2switch $SRS_SINGLE_THREAD )
2021-01-18 09:28:51 +00:00
--build-tag= <TAG> Set the build object directory suffix.
2014-04-16 06:27:34 +00:00
2014-04-16 05:24:00 +00:00
Workflow:
2020-01-20 02:44:46 +00:00
1. Apply "Presets" . if not specified, use default preset.
2. Apply "Features" , "Performance" and others. user specified option will override the preset.
2021-01-18 09:28:51 +00:00
3. Check configs and generate Makefile.
2014-04-16 05:24:00 +00:00
2015-09-22 04:43:22 +00:00
Remark:
2021-01-18 09:28:51 +00:00
1. For performance, read https://blog.csdn.net/win_lin/article/details/53503869
2015-09-22 04:43:22 +00:00
2014-04-16 05:24:00 +00:00
END
}
2013-11-27 14:41:58 +00:00
2014-04-16 05:24:00 +00:00
function parse_user_option( ) {
2021-05-21 09:14:04 +00:00
# Ignore the options.
if [ [ $option = = '--demo' || $option = = '--dev' || $option = = '--fast-dev' || $option = = '--pi'
|| $option = = '--cubie' || $option = = '--fast' || $option = = '--pure-rtmp' || $option = = '--disable-all'
|| $option = = '--full' || $option = = '--with-http-callback' || $option = = '--without-http-callback'
|| $option = = '--http-callback' || $option = = '--with-http-api' || $option = = '--without-http-api'
|| $option = = '--http-api' || $option = = '--with-http-server' || $option = = '--without-http-server'
|| $option = = '--http-server' || $option = = '--with-hls' || $option = = '--without-hls'
|| $option = = '--hls' || $option = = '--with-dvr' || $option = = '--without-dvr'
|| $option = = '--dvr' || $option = = '--without-transcode' || $option = = '--without-ingest'
|| $option = = '--without-stat' || $option = = '--without-stream-caster' || $option = = '--without-ssl'
|| $option = = '--without-librtmp' || ( $option = = '--librtmp' && $( switch2value $value ) = = NO)
|| $option = = '--without-research' || ( $option = = '--research' && $( switch2value $value ) = = NO)
] ] ; then
echo " Ignore option $option $value " ; return 0;
fi
# if specified export single file, export project first.
if [ [ $option = = '--export-librtmp-single' || $option = = '--export-librtmp-project' || $option = = '--with-librtmp' || $option = = '--librtmp' ] ] ; then
echo " Error: The $option is not supported yet, please read https://github.com/ossrs/srs-librtmp/issues/32 " ; exit 1
fi
if [ [ $option = = '--with-research' || $option = = '--research' ] ] ; then
echo " Error: The $option is not supported yet " ; exit 1
fi
2021-06-21 23:49:48 +00:00
if [ [ $option = = '--arm' || $option = = '--mips' || $option = = '--with-arm-ubuntu12' || $option = = '--with-mips-ubuntu12' ] ] ; then
2022-07-31 09:14:37 +00:00
echo " Error: Removed misleading option $option , please read https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs "
2021-06-21 23:49:48 +00:00
exit -1
fi
2021-05-21 09:14:04 +00:00
# Parse options to variables.
2013-11-27 14:41:58 +00:00
case " $option " in
2014-04-16 05:24:00 +00:00
-h) help = yes ; ;
2014-04-01 08:06:32 +00:00
--help) help = yes ; ;
2013-11-27 14:41:58 +00:00
2014-04-01 08:06:32 +00:00
--jobs) SRS_JOBS = ${ value } ; ;
--prefix) SRS_PREFIX = ${ value } ; ;
2022-01-13 10:26:28 +00:00
--config) SRS_DEFAULT_CONFIG = ${ value } ; ;
2020-01-21 02:28:25 +00:00
2021-05-21 09:14:04 +00:00
--static) SRS_STATIC = $( switch2value $value ) ; ;
2021-10-03 06:17:53 +00:00
--cpu) SRS_CROSS_BUILD_CPU = ${ value } ; ;
--arch) SRS_CROSS_BUILD_ARCH = ${ value } ; ;
--host) SRS_CROSS_BUILD_HOST = ${ value } ; ;
--cross-prefix) SRS_CROSS_BUILD_PREFIX = ${ value } ; ;
2020-01-21 02:28:25 +00:00
--cc) SRS_TOOL_CC = ${ value } ; ;
--cxx) SRS_TOOL_CXX = ${ value } ; ;
--ar) SRS_TOOL_AR = ${ value } ; ;
2020-01-21 05:59:43 +00:00
--ld) SRS_TOOL_LD = ${ value } ; ;
--randlib) SRS_TOOL_RANDLIB = ${ value } ; ;
2020-01-21 02:28:25 +00:00
--extra-flags) SRS_EXTRA_FLAGS = ${ value } ; ;
2020-03-29 07:23:40 +00:00
--build-tag) SRS_BUILD_TAG = ${ value } ; ;
2020-01-21 02:28:25 +00:00
2015-03-10 04:50:27 +00:00
--osx) SRS_OSX = YES ; ;
2020-04-26 14:41:03 +00:00
--without-srtp-nasm) SRS_SRTP_ASM = NO ; ;
--with-srtp-nasm) SRS_SRTP_ASM = YES ; ;
2021-05-21 09:14:04 +00:00
--srtp-nasm) SRS_SRTP_ASM = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--without-nasm) SRS_NASM = NO ; ;
--with-nasm) SRS_NASM = YES ; ;
2021-05-21 09:14:04 +00:00
--nasm) SRS_NASM = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-ssl) SRS_SSL = YES ; ;
2021-05-21 09:14:04 +00:00
--ssl) SRS_SSL = $( switch2value $value ) ; ;
--https) SRS_HTTPS = $( switch2value $value ) ; ;
--ssl-1-0) SRS_SSL_1_0 = $( switch2value $value ) ; ;
--ssl-local) SRS_SSL_LOCAL = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-hds) SRS_HDS = YES ; ;
--without-hds) SRS_HDS = NO ; ;
2021-05-21 09:14:04 +00:00
--hds) SRS_HDS = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-transcode) SRS_TRANSCODE = YES ; ;
2021-05-21 09:14:04 +00:00
--transcode) SRS_TRANSCODE = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-ingest) SRS_INGEST = YES ; ;
2021-05-21 09:14:04 +00:00
--ingest) SRS_INGEST = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-stat) SRS_STAT = YES ; ;
2021-05-21 09:14:04 +00:00
--stat) SRS_STAT = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-stream-caster) SRS_STREAM_CASTER = YES ; ;
2021-05-21 09:14:04 +00:00
--stream-caster) SRS_STREAM_CASTER = $( switch2value $value ) ; ;
2022-10-06 12:59:30 +00:00
--stream-converter) SRS_STREAM_CASTER = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-utest) SRS_UTEST = YES ; ;
--without-utest) SRS_UTEST = NO ; ;
2021-05-21 09:14:04 +00:00
--utest) SRS_UTEST = $( switch2value $value ) ; ;
--cherrypy) SRS_CHERRYPY = $( switch2value $value ) ; ;
--gcov) SRS_GCOV = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-srt) SRS_SRT = YES ; ;
--without-srt) SRS_SRT = NO ; ;
2021-05-21 09:14:04 +00:00
--srt) SRS_SRT = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-rtc) SRS_RTC = YES ; ;
--without-rtc) SRS_RTC = NO ; ;
2021-05-21 09:14:04 +00:00
--rtc) SRS_RTC = $( switch2value $value ) ; ;
--simulator) SRS_SIMULATOR = $( switch2value $value ) ; ;
2022-08-08 13:39:42 +00:00
--generate-objs) SRS_GENERATE_OBJS = $( switch2value $value ) ; ;
2022-11-19 04:11:03 +00:00
--single-thread) SRS_SINGLE_THREAD = $( switch2value $value ) ; ;
2021-05-21 09:14:04 +00:00
--ffmpeg-fit) SRS_FFMPEG_FIT = $( switch2value $value ) ; ;
2022-10-06 09:40:58 +00:00
--gb28181) SRS_GB28181 = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
2021-05-21 09:14:04 +00:00
--cxx11) SRS_CXX11 = $( switch2value $value ) ; ;
--cxx14) SRS_CXX14 = $( switch2value $value ) ; ;
2022-10-21 15:30:43 +00:00
--backtrace) SRS_BACKTRACE = $( switch2value $value ) ; ;
2020-06-03 11:18:41 +00:00
2020-04-26 14:41:03 +00:00
--with-clean) SRS_CLEAN = YES ; ;
--without-clean) SRS_CLEAN = NO ; ;
2021-05-21 09:14:04 +00:00
--clean) SRS_CLEAN = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gperf) SRS_GPERF = YES ; ;
--without-gperf) SRS_GPERF = NO ; ;
2021-05-21 09:14:04 +00:00
--gperf) SRS_GPERF = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gmc) SRS_GPERF_MC = YES ; ;
--without-gmc) SRS_GPERF_MC = NO ; ;
2021-05-21 09:14:04 +00:00
--gmc) SRS_GPERF_MC = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gmd) SRS_GPERF_MD = YES ; ;
--without-gmd) SRS_GPERF_MD = NO ; ;
2021-05-21 09:14:04 +00:00
--gmd) SRS_GPERF_MD = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gmp) SRS_GPERF_MP = YES ; ;
--without-gmp) SRS_GPERF_MP = NO ; ;
2021-05-21 09:14:04 +00:00
--gmp) SRS_GPERF_MP = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gcp) SRS_GPERF_CP = YES ; ;
--without-gcp) SRS_GPERF_CP = NO ; ;
2021-05-21 09:14:04 +00:00
--gcp) SRS_GPERF_CP = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--with-gprof) SRS_GPROF = YES ; ;
--without-gprof) SRS_GPROF = NO ; ;
2021-05-21 09:14:04 +00:00
--gprof) SRS_GPROF = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
2022-10-22 23:21:15 +00:00
--sanitizer) SRS_SANITIZER = $( switch2value $value ) ; ;
--sanitizer-static) SRS_SANITIZER_STATIC = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--use-sys-ssl) SRS_USE_SYS_SSL = YES ; ;
2021-05-21 09:14:04 +00:00
--sys-ssl) SRS_USE_SYS_SSL = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
--use-shared-st) SRS_SHARED_ST = YES ; ;
--use-shared-srt) SRS_SHARED_SRT = YES ; ;
2021-06-01 07:39:37 +00:00
--shared-st) SRS_SHARED_ST = $( switch2value $value ) ; ;
2021-05-21 09:14:04 +00:00
--shared-srt) SRS_SHARED_SRT = $( switch2value $value ) ; ;
2021-06-01 07:39:37 +00:00
--shared-ffmpeg) SRS_SHARED_FFMPEG = $( switch2value $value ) ; ;
2020-04-26 14:41:03 +00:00
2020-01-15 13:26:02 +00:00
--with-valgrind) SRS_VALGRIND = YES ; ;
2017-03-25 07:40:28 +00:00
--without-valgrind) SRS_VALGRIND = NO ; ;
2021-05-21 09:14:04 +00:00
--valgrind) SRS_VALGRIND = $( switch2value $value ) ; ;
2013-11-27 14:41:58 +00:00
2021-05-21 09:14:04 +00:00
--log-verbose) SRS_LOG_VERBOSE = $( switch2value $value ) ; ;
--log-info) SRS_LOG_INFO = $( switch2value $value ) ; ;
--log-trace) SRS_LOG_TRACE = $( switch2value $value ) ; ;
2022-10-26 13:23:03 +00:00
--log-level_v2) SRS_LOG_LEVEL_V2 = $( switch2value $value ) ; ;
2021-05-21 09:14:04 +00:00
--debug) SRS_DEBUG = $( switch2value $value ) ; ;
--debug-stats) SRS_DEBUG_STATS = $( switch2value $value ) ; ;
2021-02-15 11:24:23 +00:00
2021-05-20 12:07:13 +00:00
# Alias for --arm, cross build.
2021-05-21 09:14:04 +00:00
--cross-build) SRS_CROSS_BUILD = YES ; ;
2021-10-03 06:17:53 +00:00
--enable-cross-compile) SRS_CROSS_BUILD = YES ; ;
2021-05-20 12:07:13 +00:00
# Deprecated, might be removed in future.
2022-11-18 15:02:35 +00:00
--x86-x64) SRS_X86_X64 = YES ; ;
--x86-64) SRS_X86_X64 = YES ; ;
2021-02-15 11:24:23 +00:00
--with-nginx) SRS_NGINX = YES ; ;
--without-nginx) SRS_NGINX = NO ; ;
2021-05-21 09:14:04 +00:00
--nginx) SRS_NGINX = $( switch2value $value ) ; ;
2021-02-15 11:24:23 +00:00
--with-ffmpeg) SRS_FFMPEG_TOOL = YES ; ;
--without-ffmpeg) SRS_FFMPEG_TOOL = NO ; ;
2021-05-21 09:14:04 +00:00
--ffmpeg) SRS_FFMPEG_TOOL = $( switch2value $value ) ; ;
--ffmpeg-tool) SRS_FFMPEG_TOOL = $( switch2value $value ) ; ;
2017-01-23 09:43:59 +00:00
2013-11-27 14:41:58 +00:00
*)
echo " $0 : error: invalid option \" $option \" "
exit 1
; ;
esac
2014-04-16 05:24:00 +00:00
}
2013-11-27 14:41:58 +00:00
2014-04-16 06:14:48 +00:00
function parse_user_option_to_value_and_option( ) {
case " $option " in
-*= *)
2019-12-25 09:52:51 +00:00
value = ` echo " $option " | sed -e 's|[-_a-zA-Z0-9/]*=||' `
2020-01-21 02:28:25 +00:00
option = ` echo " $option " | sed -e 's|=[-_a-zA-Z0-9/. +]*||' `
2014-04-16 06:14:48 +00:00
; ;
*) value = "" ; ;
esac
}
2021-06-16 05:40:54 +00:00
# For variable values, might be three values: YES, RESERVED, NO(by default).
2021-01-18 09:28:51 +00:00
function value2switch( ) {
if [ [ $1 = = YES ] ] ; then
echo on;
2021-06-16 05:40:54 +00:00
elif [ [ $1 = = RESERVED ] ] ; then
echo reserved;
2021-01-18 09:28:51 +00:00
else
2021-05-21 09:14:04 +00:00
echo off;
2021-01-18 09:28:51 +00:00
fi
}
2021-06-16 05:40:54 +00:00
# For user options, only off or on(by default).
2021-02-15 11:24:23 +00:00
function switch2value( ) {
2021-05-21 09:14:04 +00:00
if [ [ $1 = = off ] ] ; then
2021-02-15 11:24:23 +00:00
echo NO;
else
2021-05-21 09:14:04 +00:00
echo YES;
2021-02-15 11:24:23 +00:00
fi
}
2022-11-18 15:02:35 +00:00
#####################################################################################
function apply_system_options( ) {
OS_IS_OSX = $( uname -s | grep -q Darwin && echo YES)
OS_IS_LINUX = $( uname -s | grep -q Linux && echo YES)
OS_IS_CYGWIN = $( uname -s | grep -q CYGWIN && echo YES)
OS_IS_CENTOS = $( yum --version >/dev/null 2>& 1 && echo YES)
# For Debian, we think it's ubuntu also.
# For example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v.
OS_IS_UBUNTU = $( apt-get --version >/dev/null 2>& 1 && echo YES)
OS_IS_LOONGSON = $( uname -r | grep -q loongson && echo YES)
# Use gcc to detect the CPU arch.
gcc --help >/dev/null 2>& 1; ret = $? ; if [ [ 0 -ne $ret ] ] ; then echo "Please install gcc" ; exit 1; fi
OS_IS_LOONGARCH64 = $( gcc -dM -E - </dev/null | grep '#define __loongarch64 1' -q && echo YES)
OS_IS_MIPS64 = $( gcc -dM -E - </dev/null | grep '#define __mips64 1' -q && echo YES)
OS_IS_X86_64 = $( gcc -dM -E - </dev/null | grep -q '#define __x86_64 1' && echo YES)
OS_IS_RISCV = $( gcc -dM -E - </dev/null | grep -q '#define __riscv 1' && echo YES)
if [ [ $OS_IS_OSX = = YES ] ] ; then SRS_JOBS = $( sysctl -n hw.ncpu 2>/dev/null || echo 1) ; fi
if [ [ $OS_IS_LINUX = = YES || $OS_IS_CYGWIN = = YES ] ] ; then
SRS_JOBS = $( grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1)
fi
}
apply_system_options
2014-03-16 12:16:42 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
# parse preset options
2014-03-16 12:16:42 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
opt =
for option
do
opt = " $opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"` "
2014-04-16 06:14:48 +00:00
parse_user_option_to_value_and_option
2014-04-16 05:24:00 +00:00
parse_user_option
done
2021-06-16 05:40:54 +00:00
function apply_auto_options( ) {
2021-06-21 23:49:48 +00:00
if [ [ $SRS_CROSS_BUILD = = YES ] ] ; then
2021-10-03 06:17:53 +00:00
if [ [ $SRS_CROSS_BUILD_PREFIX != "" && $SRS_CROSS_BUILD_HOST = = "" ] ] ; then
SRS_CROSS_BUILD_HOST = $( echo $SRS_CROSS_BUILD_PREFIX | sed 's/-$//g' )
fi
if [ [ $SRS_TOOL_CC != "" && $SRS_CROSS_BUILD_HOST = = "" ] ] ; then
SRS_CROSS_BUILD_HOST = $( echo $SRS_TOOL_CC | sed 's/-gcc$//g' )
fi
if [ [ $SRS_CROSS_BUILD_PREFIX = = "" ] ] ; then
SRS_CROSS_BUILD_PREFIX = " ${ SRS_CROSS_BUILD_HOST } - "
fi
SRS_TOOL_CC = ${ SRS_CROSS_BUILD_PREFIX } gcc
SRS_TOOL_CXX = ${ SRS_CROSS_BUILD_PREFIX } g++
SRS_TOOL_AR = ${ SRS_CROSS_BUILD_PREFIX } ar
SRS_TOOL_LD = ${ SRS_CROSS_BUILD_PREFIX } ld
SRS_TOOL_RANDLIB = ${ SRS_CROSS_BUILD_PREFIX } randlib
if [ [ $SRS_CROSS_BUILD_ARCH = = "" ] ] ; then
echo $SRS_TOOL_CC | grep arm >/dev/null 2>& 1 && SRS_CROSS_BUILD_ARCH = "arm"
echo $SRS_TOOL_CC | grep aarch64 >/dev/null 2>& 1 && SRS_CROSS_BUILD_ARCH = "aarch64"
echo $SRS_TOOL_CC | grep mipsel >/dev/null 2>& 1 && SRS_CROSS_BUILD_ARCH = "mipsel"
fi
echo " For cross build, host: $SRS_CROSS_BUILD_HOST , prefix: $SRS_CROSS_BUILD_PREFIX , arch: $SRS_CROSS_BUILD_ARCH , cpu: $SRS_CROSS_BUILD_CPU gcc: $SRS_TOOL_CC "
2021-06-21 23:49:48 +00:00
fi
if [ [ $SRS_OSX = = YES ] ] ; then
SRS_TOOL_LD = $SRS_TOOL_CC
2021-05-20 12:07:13 +00:00
fi
2021-05-16 08:14:00 +00:00
# Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
2020-06-24 04:44:13 +00:00
if [ [ $SRS_RTC = = YES && $SRS_FFMPEG_FIT = = RESERVED ] ] ; then
SRS_FFMPEG_FIT = YES
fi
2014-04-16 05:24:00 +00:00
2022-11-18 15:02:35 +00:00
# If enable gperf, disable sanitizer.
if [ [ $SRS_GPERF = = YES && $SRS_SANITIZER = = YES ] ] ; then
echo "Disable sanitizer for gperf"
SRS_SANITIZER = NO
fi
2014-04-16 06:14:48 +00:00
# if transcode/ingest specified, requires the ffmpeg stub classes.
SRS_FFMPEG_STUB = NO
2022-11-18 15:02:35 +00:00
if [ [ $SRS_TRANSCODE = = YES ] ] ; then SRS_FFMPEG_STUB = YES; fi
if [ [ $SRS_INGEST = = YES ] ] ; then SRS_FFMPEG_STUB = YES; fi
2014-04-16 05:24:00 +00:00
2021-06-16 05:40:54 +00:00
if [ [ $SRS_SRTP_ASM = = YES && $SRS_RTC = = NO ] ] ; then
echo "Disable SRTP-ASM, because RTC is disabled."
SRS_SRTP_ASM = NO
fi
if [ [ $SRS_SRTP_ASM = = YES && $SRS_NASM = = NO ] ] ; then
echo "Disable SRTP-ASM, because NASM is disabled."
SRS_SRTP_ASM = NO
fi
2022-11-18 15:02:35 +00:00
# parse the jobs for make
if [ [ ! -z SRS_JOBS ] ] ; then
export SRS_JOBS = " --jobs= ${ SRS_JOBS } "
fi
2021-06-16 05:40:54 +00:00
}
2022-11-18 15:02:35 +00:00
if [ [ $help = = YES ] ] ; then
2021-06-16 05:40:54 +00:00
apply_auto_options
show_help
exit 0
fi
#####################################################################################
# apply options
#####################################################################################
function apply_detail_options( ) {
2017-01-23 09:43:59 +00:00
# Always enable HTTP utilies.
2022-11-18 15:02:35 +00:00
if [ [ $SRS_HTTP_CORE = = NO ] ] ; then SRS_HTTP_CORE = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP utilies. ${ BLACK } " ; fi
if [ [ $SRS_STREAM_CASTER = = NO ] ] ; then SRS_STREAM_CASTER = YES; echo -e " ${ YELLOW } [WARN] Always enable StreamConverter. ${ BLACK } " ; fi
if [ [ $SRS_INGEST = = NO ] ] ; then SRS_INGEST = YES; echo -e " ${ YELLOW } [WARN] Always enable Ingest. ${ BLACK } " ; fi
if [ [ $SRS_SSL = = NO ] ] ; then SRS_SSL = YES; echo -e " ${ YELLOW } [WARN] Always enable SSL. ${ BLACK } " ; fi
if [ [ $SRS_STAT = = NO ] ] ; then SRS_STAT = YES; echo -e " ${ YELLOW } [WARN] Always enable Statistic. ${ BLACK } " ; fi
if [ [ $SRS_TRANSCODE = = NO ] ] ; then SRS_TRANSCODE = YES; echo -e " ${ YELLOW } [WARN] Always enable Transcode. ${ BLACK } " ; fi
if [ [ $SRS_HTTP_CALLBACK = = NO ] ] ; then SRS_HTTP_CALLBACK = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP callback. ${ BLACK } " ; fi
if [ [ $SRS_HTTP_SERVER = = NO ] ] ; then SRS_HTTP_SERVER = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP server. ${ BLACK } " ; fi
if [ [ $SRS_HTTP_API = = NO ] ] ; then SRS_HTTP_API = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP API. ${ BLACK } " ; fi
if [ [ $SRS_HLS = = NO ] ] ; then SRS_HLS = YES; echo -e " ${ YELLOW } [WARN] Always enable HLS. ${ BLACK } " ; fi
if [ [ $SRS_DVR = = NO ] ] ; then SRS_DVR = YES; echo -e " ${ YELLOW } [WARN] Always enable DVR. ${ BLACK } " ; fi
2014-04-16 06:14:48 +00:00
}
2021-06-16 05:40:54 +00:00
apply_auto_options
2020-06-24 09:03:56 +00:00
apply_detail_options
2014-04-16 06:14:48 +00:00
function regenerate_options( ) {
# save all config options to macro to write to auto headers file
2020-01-24 10:41:09 +00:00
SRS_AUTO_USER_CONFIGURE = ` echo $opt `
2014-04-16 06:14:48 +00:00
# regenerate the options for default values.
2020-01-24 10:41:09 +00:00
SRS_AUTO_CONFIGURE = " --prefix= ${ SRS_PREFIX } "
2022-01-13 10:26:28 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --config= $SRS_DEFAULT_CONFIG "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --hls= $( value2switch $SRS_HLS ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --hds= $( value2switch $SRS_HDS ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --dvr= $( value2switch $SRS_DVR ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ssl= $( value2switch $SRS_SSL ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --https= $( value2switch $SRS_HTTPS ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ssl-1-0= $( value2switch $SRS_SSL_1_0 ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ssl-local= $( value2switch $SRS_SSL_LOCAL ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --sys-ssl= $( value2switch $SRS_USE_SYS_SSL ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --transcode= $( value2switch $SRS_TRANSCODE ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ingest= $( value2switch $SRS_INGEST ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --stat= $( value2switch $SRS_STAT ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --http-callback= $( value2switch $SRS_HTTP_CALLBACK ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --http-server= $( value2switch $SRS_HTTP_SERVER ) "
2022-10-06 12:59:30 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --stream-converter= $( value2switch $SRS_STREAM_CASTER ) "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --http-api= $( value2switch $SRS_HTTP_API ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --utest= $( value2switch $SRS_UTEST ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cherrypy= $( value2switch $SRS_CHERRYPY ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --srt= $( value2switch $SRS_SRT ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --rtc= $( value2switch $SRS_RTC ) "
2022-10-06 09:40:58 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gb28181= $( value2switch $SRS_GB28181 ) "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --simulator= $( value2switch $SRS_SIMULATOR ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cxx11= $( value2switch $SRS_CXX11 ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cxx14= $( value2switch $SRS_CXX14 ) "
2022-10-21 15:30:43 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --backtrace= $( value2switch $SRS_BACKTRACE ) "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ffmpeg-fit= $( value2switch $SRS_FFMPEG_FIT ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --nasm= $( value2switch $SRS_NASM ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --srtp-nasm= $( value2switch $SRS_SRTP_ASM ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --clean= $( value2switch $SRS_CLEAN ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gperf= $( value2switch $SRS_GPERF ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gmc= $( value2switch $SRS_GPERF_MC ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gmd= $( value2switch $SRS_GPERF_MD ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gmp= $( value2switch $SRS_GPERF_MP ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gcp= $( value2switch $SRS_GPERF_CP ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gprof= $( value2switch $SRS_GPROF ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --static= $( value2switch $SRS_STATIC ) "
2021-06-01 04:29:22 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --shared-st= $( value2switch $SRS_SHARED_ST ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --shared-srt= $( value2switch $SRS_SHARED_SRT ) "
2021-06-01 07:39:37 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --shared-ffmpeg= $( value2switch $SRS_SHARED_FFMPEG ) "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-verbose= $( value2switch $SRS_LOG_VERBOSE ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-info= $( value2switch $SRS_LOG_INFO ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-trace= $( value2switch $SRS_LOG_TRACE ) "
2022-10-26 13:23:03 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-level_v2= $( value2switch $SRS_LOG_LEVEL_V2 ) "
2021-02-15 11:24:23 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gcov= $( value2switch $SRS_GCOV ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --debug= $( value2switch $SRS_DEBUG ) "
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --debug-stats= $( value2switch $SRS_DEBUG_STATS ) "
2021-05-21 09:14:04 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cross-build= $( value2switch $SRS_CROSS_BUILD ) "
2022-10-22 23:21:15 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --sanitizer= $( value2switch $SRS_SANITIZER ) "
2022-11-19 04:11:03 +00:00
SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --single-thread= $( value2switch $SRS_SINGLE_THREAD ) "
2021-10-03 06:17:53 +00:00
if [ [ $SRS_CROSS_BUILD_ARCH != "" ] ] ; then SRS_AUTO_CONFIGURE = " $SRS_AUTO_CONFIGURE --arch= $SRS_CROSS_BUILD_ARCH " ; fi
if [ [ $SRS_CROSS_BUILD_CPU != "" ] ] ; then SRS_AUTO_CONFIGURE = " $SRS_AUTO_CONFIGURE --cpu= $SRS_CROSS_BUILD_CPU " ; fi
if [ [ $SRS_CROSS_BUILD_HOST != "" ] ] ; then SRS_AUTO_CONFIGURE = " $SRS_AUTO_CONFIGURE --host= $SRS_CROSS_BUILD_HOST " ; fi
if [ [ $SRS_CROSS_BUILD_PREFIX != "" ] ] ; then SRS_AUTO_CONFIGURE = " $SRS_AUTO_CONFIGURE --cross-prefix= $SRS_CROSS_BUILD_PREFIX " ; fi
2020-04-26 14:41:03 +00:00
if [ [ $SRS_EXTRA_FLAGS != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --extra-flags=\\\" $SRS_EXTRA_FLAGS \\\" " ; fi
if [ [ $SRS_BUILD_TAG != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --build-tag=\\\" $SRS_BUILD_TAG \\\" " ; fi
if [ [ $SRS_TOOL_CC != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cc= $SRS_TOOL_CC " ; fi
if [ [ $SRS_TOOL_CXX != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cxx= $SRS_TOOL_CXX " ; fi
if [ [ $SRS_TOOL_AR != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ar= $SRS_TOOL_AR " ; fi
if [ [ $SRS_TOOL_LD != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ld= $SRS_TOOL_LD " ; fi
if [ [ $SRS_TOOL_RANDLIB != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --randlib= $SRS_TOOL_RANDLIB " ; fi
2016-12-07 04:09:39 +00:00
echo " User config: $SRS_AUTO_USER_CONFIGURE "
echo " Detail config: ${ SRS_AUTO_CONFIGURE } "
2014-04-16 06:14:48 +00:00
}
regenerate_options
2013-11-27 14:41:58 +00:00
2014-02-28 06:38:27 +00:00
#####################################################################################
# check user options
#####################################################################################
2014-04-16 06:14:48 +00:00
function check_option_conflicts( ) {
2020-01-21 07:47:19 +00:00
if [ [ $SRS_TOOL_CC = = '' || $SRS_TOOL_CXX = = '' || $SRS_TOOL_AR = = '' || $SRS_TOOL_LD = = '' || $SRS_TOOL_RANDLIB = = '' ] ] ; then
2021-05-20 12:07:13 +00:00
echo " Error: No build toolchain, cc: $SRS_TOOL_CC , cxx: $SRS_TOOL_CXX , ar: $SRS_TOOL_AR , ld: $SRS_TOOL_LD , randlib: $SRS_TOOL_RANDLIB " ; exit -1
2020-01-21 02:28:25 +00:00
fi
2020-01-21 07:47:19 +00:00
if [ [ $SRS_CROSS_BUILD = = YES && ( $SRS_TOOL_CC = = 'gcc' || $SRS_TOOL_CXX = = 'g++' || $SRS_TOOL_AR = = 'ar' ) ] ] ; then
2021-05-20 12:07:13 +00:00
echo " Error: For cross build, should setup the toolchain(./configure -h|grep -i toolchain), cc: $SRS_TOOL_CC , cxx: $SRS_TOOL_CXX , ar: $SRS_TOOL_AR " ; exit 1
2020-01-21 05:59:43 +00:00
fi
2019-12-25 05:17:49 +00:00
2019-12-25 10:29:07 +00:00
if [ [ $SRS_NGINX = = YES ] ] ; then
2020-08-03 11:31:14 +00:00
echo "Warning: Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"
SRS_NGINX = NO
2019-12-25 10:29:07 +00:00
fi
2019-12-25 05:17:49 +00:00
# TODO: FIXME: check more os.
2014-04-16 06:14:48 +00:00
__check_ok = YES
# check conflict
2022-11-18 15:02:35 +00:00
if [ [ $SRS_GPERF = = NO ] ] ; then
if [ [ $SRS_GPERF_MC = = YES ] ] ; then echo "gperf-mc depends on gperf, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_MD = = YES ] ] ; then echo "gperf-md depends on gperf, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_MP = = YES ] ] ; then echo "gperf-mp depends on gperf, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_CP = = YES ] ] ; then echo "gperf-cp depends on gperf, see: ./configure --help" ; __check_ok = NO; fi
2014-03-07 07:40:55 +00:00
fi
2022-11-18 15:02:35 +00:00
if [ [ $SRS_GPERF_MC = = YES && $SRS_GPERF_MP = = YES ] ] ; then
2015-05-27 02:23:40 +00:00
echo "gperf-mc not compatible with gperf-mp, see: ./configure --help" ;
2021-12-26 09:30:51 +00:00
echo "@see: https://gperftools.github.io/gperftools/heap_checker.html" ;
2015-05-27 02:23:40 +00:00
echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time" ;
__check_ok = NO
fi
2014-04-16 06:14:48 +00:00
# generate the group option: SRS_GPERF
__gperf_slow = NO
2022-11-18 15:02:35 +00:00
if [ [ $SRS_GPERF_MC = = YES ] ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ [ $SRS_GPERF_MD = = YES ] ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ [ $SRS_GPERF_MP = = YES ] ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ [ $SRS_GPERF_CP = = YES ] ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ [ $__gperf_slow = = YES ] ] ; then if [ [ $SRS_GPROF = = YES ] ] ; then
2014-04-16 06:14:48 +00:00
echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help" ; __check_ok = NO;
fi fi
2014-04-15 08:07:25 +00:00
2014-04-16 06:14:48 +00:00
# check variable neccessary
2022-11-18 15:02:35 +00:00
if [ [ $SRS_HDS = = RESERVED ] ] ; then echo "you must specifies the hds, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_SSL = = RESERVED ] ] ; then echo "you must specifies the ssl, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_STREAM_CASTER = = RESERVED ] ] ; then echo "you must specifies the stream-converter, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_UTEST = = RESERVED ] ] ; then echo "you must specifies the utest, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF = = RESERVED ] ] ; then echo "you must specifies the gperf, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_MC = = RESERVED ] ] ; then echo "you must specifies the gperf-mc, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_MD = = RESERVED ] ] ; then echo "you must specifies the gperf-md, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_MP = = RESERVED ] ] ; then echo "you must specifies the gperf-mp, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPERF_CP = = RESERVED ] ] ; then echo "you must specifies the gperf-cp, see: ./configure --help" ; __check_ok = NO; fi
if [ [ $SRS_GPROF = = RESERVED ] ] ; then echo "you must specifies the gprof, see: ./configure --help" ; __check_ok = NO; fi
2014-04-16 06:14:48 +00:00
if [ [ -z $SRS_PREFIX ] ] ; then echo "you must specifies the prefix, see: ./configure --prefix" ; __check_ok = NO; fi
2022-11-18 15:02:35 +00:00
if [ [ $__check_ok = = NO ] ] ; then
2014-04-16 06:14:48 +00:00
exit 1;
fi
}
check_option_conflicts