Skip to content

Commit a4f1905

Browse files
committed
[libc] Fix pthreads compiling issue with new newlib version
1 parent 64ac492 commit a4f1905

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
from building import *
2+
from utils import VersionCmp
23

3-
cwd = GetCurrentDir()
4-
src = Glob('*.c')
5-
CPPPATH = [cwd]
4+
cwd = GetCurrentDir()
5+
src = Glob('*.c')
6+
CPPPATH = [cwd]
7+
CPPDEFINES = []
8+
9+
# only enable POSIX.1b-1993 Real-time extensions
10+
libc_ver = GetDepend('LIBC_VERSION')
11+
try:
12+
ver = libc_ver.split(' ')
13+
ver = ver[1]
14+
if VersionCmp(ver, "2.5.0") == 1:
15+
CPPDEFINES = ['_POSIX_C_SOURCE=199309L']
16+
except :
17+
pass
618

719
group = DefineGroup('pthreads', src,
8-
depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH)
20+
depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
921

1022
Return('group')

0 commit comments

Comments
 (0)