Jeroen Demeyer on Wed, 16 Sep 2009 09:57:11 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Problems with has_log2.c and has_exp2.c


Bill Allombert wrote:
As far as I see, the issue is two-fold:
1) The file has_exp2.c is not valid in C++, hence this cause Configure
to omit HAS_EXP2. The file has_exp2.c would be better written as:
#include <math.h>
double (*f)(double) = exp2;
int main(){ return f != exp2; }
(since the prototype is part of the standard)

Your fixes work, thanks!

You could also simplify things by casting to void*:
void *f = (void*)exp2;

I attach a patch which also fixes has_alarm.c and has_setsid.c in the same way.

Cheers,
Jeroen.
Index: config/has_setsid.c
===================================================================
--- config/has_setsid.c	(revision 11920)
+++ config/has_setsid.c	(working copy)
@@ -1 +1,3 @@
-main(){ setsid(); }
+#include <unistd.h>
+pid_t (*f)() = setsid;
+int main(){ return f != setsid; }
Index: config/has_alarm.c
===================================================================
--- config/has_alarm.c	(revision 11920)
+++ config/has_alarm.c	(working copy)
@@ -1,4 +1,3 @@
 #include <unistd.h>
-
-char (*f)() = alarm;
+unsigned int (*f)(unsigned int) = alarm;
 int main(){ return f != alarm; }