clang and configure checking for equivalent simple type

Klaus T. Aehlig aehlig at linta.de
Thu Sep 29 04:58:34 UTC 2011


Hallo,

while trying to find out why I couldn't build net/socat with clang
I found something that might be a general issue, and I wonder what
appropriate actions would be.

Trying 'cd /usr/ports/net/socat && make CC=clang' failed for me and
it turned out that the reason was that the configure script could
not find out the 'equivalent simple type of off_t'. Looking at the
configure script, one notes that it tries code snippets like

#include <sys/types.h>
#include <unistd.h>
int
main ()
{
off_t u; long v; &u==&v;
  ;
  return 0;
}

and check for compile errors. However, the above program is rejected
by clang, as the value &u==&v is unused, which, of course, has nothing
to do with the intended check whether off_t * and long * are compatible
pointer.

Adding

CFLAGS+= -Wno-unused 

solves this problem.

However, I assume that these kind of tests are quite widespread in configure
scripts, so I wonder what to do about this. Possible options include

- adding 'CFLAGS+= -Wno-unused' just for this port

- do nothing, but recommend users to have -Wno-unused in CFLAGS when using clang
  (maybe somewhere in the handbook)

- check with portmgr@ if adding -Wno-unused to the default CFLAGS (for clang?)
  is an option

- something completely different?? 
  (like: add an appropriate entry to my /etc/make.conf and don't care)

Any suggestions? 

Best,
Klaus



More information about the freebsd-ports mailing list