The following patch adds Trylink.U and replaces all uses of Inlibc.U with Trylink.U. The advantage is that the results of Trylink.U are determined using the compiler, thus they match reality and unlikely cause false-positives due to stricter checks (like prototypes). This also doesn't require knowledge of system internals and is deemed more portable and cleaner.
I skipped two modules: d_euc2jis.U and d_sjis2jis.U because I have no idea where these come from or what prototypes these functions are supposed to have. I couldn't find any code using them.
Something which is missing is passing library hints. The math functions are likely not detected because no attempt is make to link against "libm" (i.e., -lm). I think the best option is to pass a (space-separated) list of candidates in a variable or some such and then try to link against each in order until linking succeeds.
I've tested all modules on NetBSD so far.
Logged In: YES
user_id=643728
Originator: YES
I have attached a modified Trylink.U. This variant uses the 2nd and following parameters as additional linker flags. First linking is tried without any additional flags. If that fails each parameter is tried until linking succeeds. This allows detecting of math functions like this:
set d_fmod -lm
eval $trylink
The working linker flag is not stored though. I'm not sure whether $ldflags should be modified or how to record the result otherwise.
File Added: Trylink.U
Logged In: YES
user_id=643728
Originator: YES
I've attached a revision of the first patch. It fixes some typos and adds #include <sys/types.h> to a couple of checks because this is required for {mode,gid,pid,uid}_t by glibc/Linux. It also passes -dl to trylink for dlopen and dlerror because it's required by glibc/Linux.
This means most of the checks work fine on Linux and IRIX.
File Added: dist.trylink.rev1.udif
Logged In: YES
user_id=643728
Originator: YES
I've attached a revision of the first patch. It fixes some typos and adds #include <sys/types.h> to a couple of checks because this is required for {mode,gid,pid,uid}_t by glibc/Linux. It also passes -dl to trylink for dlopen and dlerror because it's required by glibc/Linux.
This means most of the checks work fine on Linux and IRIX.
File Added: dist.trylink.rev1.udif
Logged In: YES
user_id=13887
Originator: NO
Thanks for that patch. I will integrate it promptly.
One possible drawback is that Configure will no longer work on legacy systems where "pid_t" is not defined but "int" must be used instead (see the Pid_t symbol for instance).