[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why does autoconf use a return type of char?
From: |
Stephane Bortzmeyer |
Subject: |
Why does autoconf use a return type of char? |
Date: |
Thu, 25 Jan 2001 10:42:13 +0100 |
When I use:
AC_CHECK_FUNC(gettimeofday, , AC_MSG_ERROR(Missing mandatory function))
autoconf tests it exists with:
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gettimeofday();
On all platforms, everything is fine (despite the fact that gettimeofday
returns int) but, on HP/UX, it says (wrongly) getimeofday does not exist:
configure:1872: checking for gettimeofday
configure:1900: gcc -o conftest -g -O2 -Wall conftest.c 1>&5
configure:1885: conflicting types for `gettimeofday'
/usr/include/sys/time.h:506: previous declaration of `gettimeofday'
configure: failed program was:
#line 1877 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gettimeofday(); below. */
#include <assert.h>
#include <sys/time.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gettimeofday();
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_gettimeofday) || defined (__stub___gettimeofday)
choke me
#else
gettimeofday();
#endif
; return 0; }
1) Is it a bug in HP/UX? In autoconf? In my configure.in?
2) If it's not my fault, any idea of a good workaround?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Why does autoconf use a return type of char?,
Stephane Bortzmeyer <=