mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Configure: Reorder the functions, nothing changed.
This commit is contained in:
parent
5559ac25fe
commit
4b09a7d686
1 changed files with 43 additions and 39 deletions
|
@ -117,7 +117,37 @@ SRS_DEBUG=NO
|
|||
SRS_DEBUG_STATS=NO
|
||||
|
||||
#####################################################################################
|
||||
# menu
|
||||
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)
|
||||
|
||||
# Set the os option automatically.
|
||||
if [[ $OS_IS_OSX == YES ]]; then SRS_OSX=YES; fi
|
||||
if [[ $OS_IS_CYGWIN == YES ]]; then SRS_CYGWIN64=YES; fi
|
||||
|
||||
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
|
||||
|
||||
#####################################################################################
|
||||
# Show help menu.
|
||||
#####################################################################################
|
||||
function show_help() {
|
||||
cat << END
|
||||
|
@ -206,6 +236,9 @@ For example:
|
|||
END
|
||||
}
|
||||
|
||||
#####################################################################################
|
||||
# Parse user options
|
||||
#####################################################################################
|
||||
function parse_user_option() {
|
||||
# Ignore the options.
|
||||
if [[ $option == '--demo' || $option == '--dev' || $option == '--fast-dev' || $option == '--pi'
|
||||
|
@ -421,39 +454,6 @@ function switch2value() {
|
|||
fi
|
||||
}
|
||||
|
||||
#####################################################################################
|
||||
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)
|
||||
|
||||
# Set the os option automatically.
|
||||
if [[ $OS_IS_OSX == YES ]]; then SRS_OSX=YES; fi
|
||||
if [[ $OS_IS_CYGWIN == YES ]]; then SRS_CYGWIN64=YES; fi
|
||||
|
||||
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
|
||||
|
||||
#####################################################################################
|
||||
# parse preset options
|
||||
#####################################################################################
|
||||
opt=
|
||||
|
||||
for option
|
||||
|
@ -463,6 +463,9 @@ do
|
|||
parse_user_option
|
||||
done
|
||||
|
||||
#####################################################################################
|
||||
# Apply auto options
|
||||
#####################################################################################
|
||||
function apply_auto_options() {
|
||||
if [[ $OS_IS_CYGWIN == YES ]]; then
|
||||
SRS_CYGWIN64=YES
|
||||
|
@ -545,17 +548,16 @@ function apply_auto_options() {
|
|||
export SRS_JOBS="--jobs=${SRS_JOBS}"
|
||||
fi
|
||||
}
|
||||
apply_auto_options
|
||||
|
||||
if [[ $help == YES ]]; then
|
||||
apply_auto_options
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# apply options
|
||||
# Apply detail options
|
||||
#####################################################################################
|
||||
|
||||
function apply_detail_options() {
|
||||
# Always enable HTTP utilies.
|
||||
if [[ $SRS_HTTP_CORE == NO ]]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi
|
||||
|
@ -570,9 +572,11 @@ function apply_detail_options() {
|
|||
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
|
||||
}
|
||||
apply_auto_options
|
||||
apply_detail_options
|
||||
|
||||
#####################################################################################
|
||||
# Regenerate options for tracing.
|
||||
#####################################################################################
|
||||
function regenerate_options() {
|
||||
# save all config options to macro to write to auto headers file
|
||||
SRS_AUTO_USER_CONFIGURE=`echo $opt`
|
||||
|
@ -649,7 +653,7 @@ function regenerate_options() {
|
|||
regenerate_options
|
||||
|
||||
#####################################################################################
|
||||
# check user options
|
||||
# Check conflicted options
|
||||
#####################################################################################
|
||||
function check_option_conflicts() {
|
||||
if [[ $SRS_TOOL_CC == '' || $SRS_TOOL_CXX == '' || $SRS_TOOL_AR == '' || $SRS_TOOL_LD == '' || $SRS_TOOL_RANDLIB == '' ]]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue