代码拉取完成,页面将自动刷新
同步操作将从 ithewei/libhv 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
confile=hconfig.h
# start confile
cat << END > $confile
#ifndef HV_CONFIG_H_
#define HV_CONFIG_H_
END
# Checks for compiler
echo "checking for compiler..."
if [ $CROSS_COMPILE ]; then
CC=${CROSS_COMPILE}gcc
CXX=${CROSS_COMPILE}g++
fi
if [ ! $CC ]; then
CC=gcc
CXX=g++
fi
CC_VERSION=`$CC --version 2>&1 | head -n 1`
echo "CC = $CC"
echo "CXX = $CXX"
echo "$CC_VERSION"
# shell functions
write_define() {
cat << END >> hconfig.h
#ifndef $macro
#define $macro $value
#endif
END
}
mkdir tmp 2>/dev/null
check_header() {
echo -n "checking for $header... "
rm tmp/check 2>/dev/null
cat << END > tmp/check.c
#include <$header>
int main() {
return 0;
}
END
$CC -o tmp/check tmp/check.c 2>/dev/null
if [ -x tmp/check ]; then
value=1
echo "yes"
else
value=0
echo "no"
fi
macro=HAVE_$(echo $header | tr a-z./ A-Z__)
write_define
}
check_function() {
echo -n "checking for $function... "
rm tmp/check 2>/dev/null
cat << END > tmp/check.c
#include <$header>
int $function(void** pp) {return 0;}
int main() {
void* p;
return $function(&p);
}
END
$CC -o tmp/check tmp/check.c 2>/dev/null
if [ -x tmp/check ]; then
value=0
echo "no"
else
value=1
echo "yes"
fi
macro=HAVE_$(echo $function | tr a-z A-Z)
write_define
}
# Checks for os
echo "checking for os..."
HOST_OS=`uname -s`
HOST_ARCH=`uname -m`
TARGET_PLATFORM=`$CC -v 2>&1 | grep Target | sed 's/Target: //'`
TARGET_ARCH=`echo $TARGET_PLATFORM | awk -F'-' '{print $1}'`
case $TARGET_PLATFORM in
*mingw*) TARGET_OS=Windows ;;
*android*) TARGET_OS=Android ;;
*darwin*) TARGET_OS=Darwin ;;
*) TARGET_OS=Linux ;;
esac
echo "HOST_OS = $HOST_OS"
echo "HOST_ARCH = $HOST_ARCH"
echo "TARGET_PLATFORM = $TARGET_PLATFORM"
echo "TARGET_OS = $TARGET_OS"
echo "TARGET_ARCH = $TARGET_ARCH"
# Checks for programs
# Checks for libraries
# Checks for header files
header=stdbool.h && check_header
header=stdint.h && check_header
header=stdatomic.h && check_header
header=sys/types.h && check_header
header=sys/stat.h && check_header
header=sys/time.h && check_header
header=fcntl.h && check_header
header=pthread.h && check_header
# Checks for functions
function=gettid && header=unistd.h && check_function
function=strlcpy && header=string.h && check_function
function=strlcat && header=string.h && check_function
function=clock_gettime && header=time.h && check_function
function=gettimeofday && header=sys/time.h && check_function
function=pthread_spin_lock && header=pthread.h && check_function
function=pthread_mutex_timedlock && header=pthread.h && check_function
function=sem_timedwait && header=semaphore.h && check_function
# end confile
cat << END >> $confile
#endif // HV_CONFIG_H_
END
echo "configure done."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。