diff options
author | Philip Allison <philip.allison@smoothwall.net> | 2010-06-15 15:27:35 +0200 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2010-06-15 15:27:35 +0200 |
commit | 0728dab771b2a4da8032d5f0ade8870add680b39 (patch) | |
tree | 934cf382db94722fff411e9f98f558d59de899b3 /m4 | |
parent | 8c4f1cb2f61e88456c3f71a5049074ed28ab22cc (diff) | |
download | autoconf-archive-0728dab771b2a4da8032d5f0ade8870add680b39.tar.gz |
AX_PTHREAD: fix compiler warning in AC_TRY_LINK test program
The test program generated by AX_PTHREAD's AC_TRY_LINK invocation generates a
compiler warning (on Linux, using GCC 4). When building with "-Wall -Werror" in
CFLAGS, as done during development to catch unexpected warnings, this turns
into a compiler error; hence, all of the AC_TRY_LINK invocations fail, and the
macro fails to detect any suitable compiler/linker flags for pthreads usage.
A sample from config.log showing the error follows.
configure:16038: result: no
configure:15936: checking whether pthreads work without any flags
configure:16029: gcc -o conftest -O3 -g -Wall -Werror -pipe -fvisibility=hidden -Wl,-O1 -Wl,--as-needed conftest.c >&5
cc1: warnings being treated as errors
conftest.c: In function 'main':
conftest.c:31: error: 'th' is used uninitialized in this function
This patch fixes the issue by placing pthread_create before pthread_join in the
test program.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_pthread.m4 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 index e1dc302..164391e 100644 --- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -75,7 +75,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 8 +#serial 9 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -202,10 +202,10 @@ for flag in $ax_pthread_flags; do static void routine(void* a) {a=0;} static void* start_routine(void* a) {return a;}], [pthread_t th; pthread_attr_t attr; + pthread_create(&th,0,start_routine,0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); - pthread_create(&th,0,start_routine,0); pthread_cleanup_pop(0); ], [ax_pthread_ok=yes]) |