make.sh: link with -lrt when glibc versions less than 2.17 in Linux

remotes/origin/fstore_storage_engine
YuQing 2023-03-14 15:22:06 +08:00
parent 8b298570b3
commit 595a8c5664
1 changed files with 10 additions and 1 deletions

11
make.sh
View File

@ -13,6 +13,9 @@ int main()
{ {
printf("%d\n", (int)sizeof(void*)); printf("%d\n", (int)sizeof(void*));
printf("%d\n", (int)sizeof(off_t)); printf("%d\n", (int)sizeof(off_t));
#ifdef __GLIBC_MINOR__
printf("%d\n", __GLIBC_MINOR__);
#endif
return 0; return 0;
} }
EOF EOF
@ -39,13 +42,16 @@ fi
count=0 count=0
int_bytes=4 int_bytes=4
off_bytes=8 off_bytes=8
glibc_minor=0
LIB_VERSION=lib64 LIB_VERSION=lib64
for col in $output; do for col in $output; do
if [ $count -eq 0 ]; then if [ $count -eq 0 ]; then
int_bytes=$col int_bytes=$col
else elif [ $count -eq 1 ]; then
off_bytes=$col off_bytes=$col
else
glibc_minor=$col
fi fi
count=$($EXPR $count + 1) count=$($EXPR $count + 1)
@ -106,6 +112,9 @@ HAVE_USER_H=0
if [ "$uname" = "Linux" ]; then if [ "$uname" = "Linux" ]; then
OS_NAME=OS_LINUX OS_NAME=OS_LINUX
IOEVENT_USE=IOEVENT_USE_EPOLL IOEVENT_USE=IOEVENT_USE_EPOLL
if [ $glibc_minor -lt 17 ]; then
LIBS="$LIBS -lrt"
fi
elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
OS_NAME=OS_FREEBSD OS_NAME=OS_FREEBSD
IOEVENT_USE=IOEVENT_USE_KQUEUE IOEVENT_USE=IOEVENT_USE_KQUEUE