On 09.07.2012, at 19:44, Junio C Hamano wrote:

> Max Horn <m...@quendi.de> writes:
>>>> diff --git a/configure.ac b/configure.ac
>>>> index 4e9012f..d767ef3 100644
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -1002,7 +1002,7 @@ if test -n "$USER_NOPTHREAD"; then
>>>> # -D_REENTRANT' or some such.
>>>> elif test -z "$PTHREAD_CFLAGS"; then
>>>>  threads_found=no
>>>> -  for opt in -mt -pthread -lpthread; do
>>>> +  for opt in "" -mt -pthread -lpthread; do
>>> Hmph.  Would it work to append the new empty string at the end of
>>> the existing list, as opposed to prepending it?
>> No, because that loop aborts on the first match that "works". Since no flags 
>> are necessary on OS X, but adding "-mt" to the flags "works" in the sense 
>> that it does nothing (except triggering a warning about an unknown 
>> argument), we need to check the empty string before "-mt" that. 
> If the test in that "for opt ...; do" considers the linking "work",
> why do you even want to tweak it, and instead let "-mt" be passed?
> If the warning troubles you,

It does trouble me, as it means that every single compiled file now triggers a 
warning, making it impossible to use -Werror, or alternatively much harder to 
spot legit warning. In fact, I am surprised that it doesn't seem to trouble 
*you* :-).

Moreover, while compiling and link "works" with "-mt" present on my system, it 
is very easy to imagine a setup where this test does break: namely on a system 
where pthreads are in the C lib, but the C compiler treats unknown compiler 
options as an error, not a warning. Then none of the three options the test 
checks right now would work

As I see it, an autoconf feature test like this should be checking "which 
linker flags are *required* in order to use pthreads?". But what it currently 
does is to check "which linker flags do not prevent us from (and possibly help 
us to) use pthreads?"  and so they come up with flags that are not necessary, 
and in fact trigger warnings.

> would it be feasible for the purpose of
> the check to tweak the definition of "works" used in the loop so that
> it considers the warning as "not working"?

That would be possible, and probably a good idea. But it is also completely 
orthogonal to my patch. Indeed, if done without my patch, then as a result, 
pthreads would not be detected anymore on Mac OS X, since none of the linker 
flags it tries would work -- as it doesn't try what happens when no linker 
flags are passed.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to