[Top][All Lists]

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


From: Akim Demaille
Subject: Re: AC_CHECK_FUNC and C++
Date: 21 Sep 2001 17:10:57 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

| It should be noted in the documentation that it *is* possible to make
| AC_CHECK_FUNC use a C++ compiler:
|   AC_LIBSOURCE(mkstemp.cc)
|   AC_CHECK_FUNC(mkstemp,
|                 [AC_DEFINE(HAVE_MKSTEMP, 1,
|                            [Define if you have mkstemp().])],
|                 [_AC_LIBOBJ(mkstemp)])
|   AC_LANG_POP(C++)

Well, why not, but actually, I think it is the converse that should be
documented: _when_ it doesn't work properly.  That this is not
supported would be (was) a bug.

| Nevertheless, this approach causes problems.  A user got the following
| error message (omitting the `configure:xxxx' prefix):
|   checking for mkstemp
|   g++ -o conftest -O2  -s conftest.cc  >&5
|   declaration of C function `char mkstemp()' conflicts with
|   /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0.1/include/stdlib.h:246:
|     previous declaration `int mkstemp(char*)' here
|   $? = 1
| For C++, I need a proper way to specify the prototype.  What is the
| best way in autoconf to do that?

Hm...  Maybe it is really time to completely revamp AC_CHECK_FUNC.
First of all, it should run AC_CHECK_DECL on the appropriate headers
before trying to emulate the proto.

Man, you are stuck.  First try to write it by hand?

No!  Try this instead:

# ------------------------------------
# Don't include <ctype.h> because on OSF/1 3.0 it includes
# <sys/types.h> which includes <sys/select.h> which contains a
# prototype for select.  Similarly for bzero.
[/* 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_$1) || defined (__stub___$1)
choke me
f = $1;

Just past it somewhere, and pray for it to work.

reply via email to

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