After latest Additions to the FreeBSD 5.0-current headers, the special case isn't needed any longer. The two last problematic functions are ctermid_r and setgroups which aren't defined in the POSIX/XOPEN case. This patch works around the problem by setting CFLAGS with -Wall -Werror for gcc before checking for this two functions.
Logged In: YES user_id=21627 Can you please explain the purpose of setting CFLAGS first to MY_CPPFLAGS etc? Also, why are you seeting OLDFLAGS between the if and the then? Also, setting -Werror might have unintended site effects, IMO, testing for a declaration is better done by checking whether the address of a function can be taken. Apart from that, the patch looks good.
Logged In: YES user_id=205 The setting of CFLAGS is for the test below. For FreeBSD XOPEN* and POSIX* would be sufficient, but IMO it's better to set all (till this point) found CFLAGS. The setting of OLDCFLAGS should have been one line above the if. It's used to safe the CFLAGS before the tests and restore it later. That allows to set the (problematic?) -Werror for the two checks. But, silly me., you're right.. By checking the address of the function it works without -Wall -Werror. Though the CFLAGS are still needed.
Logged In: YES user_id=205 Sometime I should just think twice.. So, this version of the patch is cleaner. The checks if the address of the function in question could be taken and instead of setting (gcc specific) compiler flags confdefs.h is included.. So, it should work if all c compilers..