Browse code

src/Makefile.defs: link -lrt if glibc <= 2.17

- GH #2921

Daniel-Constantin Mierla authored on 08/12/2021 08:21:53
Showing 1 changed files
... ...
@@ -1888,6 +1888,13 @@ ifeq ($(OS), linux)
1888 1888
 	ifeq ($(NO_SELECT),)
1889 1889
 		C_DEFS+=-DHAVE_SELECT
1890 1890
 	endif
1891
+	ifeq ($(CC_NAME), gcc)
1892
+		# link librt for glibc <= 2.17
1893
+		GLIBCVER:=$(shell ldd --version | head -1 | awk '{ sub(/\./, "", $NF); print $NF }' )
1894
+		ifeq ($(shell [ $(GLIBCVER) -le 217 ] && echo librt), librt)
1895
+			LIBS+=-lrt
1896
+		endif
1897
+	endif
1891 1898
 endif
1892 1899
 
1893 1900
 ifeq ($(OS), gnu_kfreebsd)