Re: [patch #8186] ax_pthread adds -pthread when it should not on OSX when compiling with clang

"Daniel Richard G." <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
On Thu, 2013 Sep 26 8:47+1000, Peter Johansson wrote:
>
> > The problem appears to be that Clang blithely accepts options it
> > doesn't recognize, printing a warning at most. Without some
> > additional flag to disable this behavior, there's no good way to
> > implement a feature test.
>
> My understanding is that's exactly what gnulib folks are doing when
> they add
>
> '-Werror -Wunknown-warning-option' to CFLAGS.

Note that the gnulib macro addresses *warning options*, not
arbitrary compiler options.

Anyway, I figured it would be easier to actually try installing and
running the damn thing rather than talk about it endlessly, so here's
what I found:

$ cat hello.c
#include <stdio.h>
int main()
{
        return 0;
}
$ clang -c hello.c ; echo exit status $?
exit status 0
$ clang -pthread -c hello.c ; echo exit status $?
exit status 0
$ clang -foobaz -c hello.c ; echo exit status $?
clang: warning: argument unused during compilation: '-foobaz'
exit status 0
$ clang -Werror -pthread -c hello.c ; echo exit status $?
exit status 0
$ clang -Werror -foobaz -c hello.c ; echo exit status $?
clang: error: argument unused during compilation: '-foobaz'
exit status 1

That's basically what I needed, and I'll have a draft update of the
macro ready for testing soon.


--Daniel


-- 
Daniel Richard G. || [email protected]
My ASCII-art .sig got a bad case of Times New Roman.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.