I don't see anything wrong with that macro. If I understand it
correctly, it should work on FreeBSD and pick up "-pthread".
It looks rather promising. And while I might copy it over and fix it
locally, I would like to escalate this upstream, if the algorithm there is
Either way, I'd need to know what the correct way is.
What I understood now is:
On current versions -lpthread should work. On some older versions I should
be using -lthr (so not -lc_r, then?).
No, do not use -lpthread. Refer to John Baldwin's response, -pthread is
what you should be using. Also, our ports system allows one to override
-pthread (the default) with PTHREAD_LIBS and PTHREAD_CFLAGS. I suspect
that part of the macro came from us (FreeBSD). Please do not escalate
anything upstream without checking with our ports team, as it looks like
the m4 macro has already been adjusted for FreeBSD.
Is there a safe way to check whether we're running a version that needs
-lthr? In the varnish example you provided, I cannot find a check for