autoconf
[Top][All Lists]
Advanced

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

Problem with AC_CHECK_FUNCS() and new versions of g++


From: Mo DeJong
Subject: Problem with AC_CHECK_FUNCS() and new versions of g++
Date: Fri, 8 Dec 2000 01:11:14 -0800 (PST)

Hi all.

I seem to have run into a big problem with newer versions
of g++, it seems to be a bit more strict about the code
it allows and this is causing AC_CHECK_FUNCS() to fail.

I have some code like this:

AC_CHECK_FUNCS(mkdir, , AC_MSG_ERROR([No mkdir() function found]))

This gets translated to a conftest.c of:

#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 mkdir ();
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_mkdir) || defined (__stub___mkdir)
choke me
#else
f = mkdir;
#endif

  ;
  return 0;
}

It works fine with gcc, but not g++.

% gcc -c conftest.c

% g++ -c conftest.c
conftest.c: In function `int main ()':
conftest.c:20: cannot convert `char () (...)' to `char (*) ()' in
assignment

Older versions of g++ work just fine.
This one came with my Red Hat 6.2 install.

% /usr/bin/g++ -c conftest.c 

Now for the strange part. This seemingly
silly change fixes things.

@@ -5,7 +5,7 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char mkdir ();
+char mkdir (void);
 char (*f) ();

% g++ -c conftest.c


So what do folks think? Should the AC_CHECK_FUNCS
macro be changed to use "... func (void)" like this?
Of course, it might be better to change g++ to
not generate this error, I am not sure at this
point.

cheers
Mo DeJong
Red Hat Inc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]