]> Git Repo - buildroot-mgba.git/blame - package/coreutils/coreutils-02-fix-timer-time-m4.patch
util-linux: bump to version 2.25.2
[buildroot-mgba.git] / package / coreutils / coreutils-02-fix-timer-time-m4.patch
CommitLineData
0cb2b158
TP
1Fix thread detection with uClibc in timer_time.m4
2
3The timer_time.m4 gl_TIMER_TIME function determines which libraries
4need to be linked to get access to the timer function, generally -lrt
5for Linux systems. On platforms where threads are used, librt
6typically uses thread functions from libpthread.
7
8However, the test to determine whether the platform has thread or not
9is incorrect: it assumes that if the C library is uClibc, then threads
10are not available. This is actually not true: uClibc has configurable
11thread support, and when thread support is available, librt calls
12libpthread functions.
13
14This is important when static linking is used, because otherwise only
15-lrt is used at link time, which fails because librt calls undefined
16thread functions. Both -lrt and -lpthread must be passed.
17
18This problem is fixed by making the uClibc thread detection a bit
19smarter, thanks to the usage of the __HAS_NO_THREADS__ macro defined
20in <bits/uClibc_config.h>, which itself is included by <features.h>.
21
22Signed-off-by: Thomas Petazzoni <[email protected]>
23
24Index: b/m4/timer_time.m4
25===================================================================
26--- a/m4/timer_time.m4
27+++ b/m4/timer_time.m4
28@@ -28,7 +28,7 @@
29 #include <features.h>
30 #ifdef __GNU_LIBRARY__
31 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
32- && !defined __UCLIBC__
33+ && !(__UCLIBC__ && __HAS_NO_THREADS__)
34 Thread emulation available
35 #endif
36 #endif
This page took 0.232292 seconds and 4 git commands to generate.