# HG changeset patch # User Thomas Petazzoni # Date 1393026098 -3600 # Node ID 4d899884c95c51f0ecf91c4f0bae80ca88675cee # Parent 621c25ada8d55c386b9ea2104f0868fb7b60ca74 m4: fix gl_TIMER_TIME() detection of threads on uClibc The timer_time.m4 gl_TIMER_TIME function determines which libraries need to be linked to get access to the timer function, generally -lrt for Linux systems. On platforms where threads are used, librt typically uses thread functions from libpthread. However, the test to determine whether the platform has thread or not is incorrect: it assumes that if the C library is uClibc, then threads are not available. This is actually not true: uClibc has configurable thread support, and when thread support is available, librt calls libpthread functions. This is important when static linking is used, because otherwise only -lrt is used at link time, which fails because librt calls undefined thread functions. Both -lrt and -lpthread must be passed. This problem is fixed by making the uClibc thread detection a bit smarter, thanks to the usage of the __HAS_NO_THREADS__ macro defined in , which itself is included by . Signed-off-by: Thomas Petazzoni Signed-off-by: Eric Blake diff -r 621c25ada8d5 -r 4d899884c95c ChangeLog --- a/ChangeLog Fri Feb 21 13:02:10 2014 -0700 +++ b/ChangeLog Sat Feb 22 00:41:38 2014 +0100 @@ -1,3 +1,8 @@ +2014-02-21 Thomas Petazzoni (tiny change) + timer: fix uClibc detection of threading + * m4/time_time.m4 (gl_TIMER_TIME): Detect whether threads are + enabled in uClibc. + 2014-02-21 Eric Blake maintainer-makefiles: provide AC_PROG_SED for older autoconf diff -r 621c25ada8d5 -r 4d899884c95c m4/timer_time.m4 --- a/m4/timer_time.m4 Fri Feb 21 13:02:10 2014 -0700 +++ b/m4/timer_time.m4 Sat Feb 22 00:41:38 2014 +0100 @@ -28,7 +28,7 @@ #include #ifdef __GNU_LIBRARY__ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ + && !(__UCLIBC__ && __HAS_NO_THREADS__) Thread emulation available #endif #endif