bug-autoconf
[Top][All Lists]
Advanced

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

AC_CHECK_FUNC vs AC_LANG(C++)


From: Andreas Schwab
Subject: AC_CHECK_FUNC vs AC_LANG(C++)
Date: 19 Jun 2001 15:26:16 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.103

The following configure script fails to recognize setenv on Linux:

AC_INIT
AC_LANG(C++)
AC_CHECK_FUNCS(setenv)

The check is failing because of conflicting declarations of setenv:

configure:1332: checking for setenv
configure:1369: g++ -o conftest -O2 -g   conftest.cc  >&5
configure:1348: declaration of C function `char setenv (...)' conflicts 
with
/usr/include/stdlib.h:604: previous declaration `int setenv (const char 
*, const char *, int)' here
configure: In function `int main ()':
configure:1360: cannot convert `char () (...)' to `char (*) ()' in 
assignment
configure:1372: $? = 1
configure: failed program was:
#line 1338 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char setenv (); 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 setenv ();
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_setenv) || defined (__stub___setenv)
choke me
#else
f = setenv;
#endif

  ;
  return 0;
}
configure:1388: result: no

The same test work fine with AC_LANG(C), since <stdlib.h> won't be
included.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
address@hidden
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5



reply via email to

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