The key is to not use C++ to execute these tests. Use C while checking for library functions. Only set the language to C++ while testing C++ related features. Bob On Mon, 19 Jan 2004, Hanspeter Roth wrote: > Hello, > > I have AC_CHECK_FUNCS which looks for getloadavg(). This works with > gcc 2.95 but fails on FreeBSD 5.2 where gcc has version 3.3.3. > On FreeBSD 5.2 configure claims that getloadavg() is not available. > > configure.in: > > AC_INIT(configure.in) > AC_PREREQ([2.50]) > dnl AC_LANG(C++) > AC_LANG_CPLUSPLUS > AC_CHECK_FUNCS(failed getloadavg sysctlbyname) > AC_OUTPUT(Makefile) > > config.log: > > configure:1661: checking for getloadavg > configure:1704: g++ -o conftest -g -O2 conftest.cc >&5 > configure:1676: error: declaration of C function `char getloadavg()' conflicts > with > /usr/include/stdlib.h:258: error: previous declaration `int getloadavg(double*, > int)' here > configure:1707: $? = 1 > configure: failed program was: > #line 1666 "configure" > #include "confdefs.h" > /* System header to define __stub macros and hopefully few prototypes, > which can conflict with char getloadavg (); 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 getloadavg (); > char (*f) (); > > #ifdef F77_DUMMY_MAIN > # ifdef __cplusplus > extern "C" > # endif > int F77_DUMMY_MAIN() { return 1; } > #endif > 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_getloadavg) || defined (__stub___getloadavg) > choke me > #else > f = getloadavg; > #endif > > ; > return 0; > } > configure:1723: result: no > > > How should this be solved? > How can one make gcc 3.3.3 work with getloadavg()? > > -Hanspeter > > ====================================== Bob Friesenhahn bfriesen@xxxxxxxxxxxxxxxxxxx http://www.simplesystems.org/users/bfriesen