[I sent a similar message a couple weeks ago, but since I got no answer, I'll try to paraphrase it]
Hello, I am compiling a C++ program (LyX) with compaq cxx 6.2 in strict ansi mode. It happens that no C functions are found by autoconf 2.52 AC_CHECK_FUNC macro, because the program bug1.C (attached, taken from what autoconf uses) produces: fantomas: cxx -std strict_ansi bug1.C cxx: Error: bug1.C, line 22: a value of type "char (*)() C" cannot be assigned to an entity of type "char (*)()" f = memmove; --^ cxx: Info: 1 error detected in the compilation of "bug1.C". I get only a warning in normal 'ansi' mode (but I cannot compile LyX in ansi mode, so...) The solution is to declare also f as 'extern "C"'.In this case, I only get the warning (which is probably not a problem) fantomas: cxx -std strict_ansi bug1.C cxx: Warning: bug2.C, line 6: Expected type "void *(void *, const void *, unsigned long) C" is incompatible with declared type "char () C", function will not be made intrinsic char memmove (); -----^ Here is a proposed patch I use to be able to compile LyX with cxx 6.2. It just changes AC_LANG_FUNC_LINK_TRY(C) to add an extra extern "C" when needed. I tested it with g++ 2.95.2 nd got no problem. Please let me know if you need more information on this. I'd be grateful to see this fixed in next release. JMarc
/* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char memmove (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_memmove) || defined (__stub___memmove) choke me #else f = memmove; #endif ; return 0; }
--- aclang.m4~ Wed Oct 17 11:51:59 2001 +++ aclang.m4 Thu Nov 8 14:54:06 2001 @@ -402,6 +402,9 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $1 (); +#ifdef __cplusplus +extern "C" +#endif char (*f) (); ], [/* The GNU C library defines this for functions which it implements