The following configure.ac fragment
AC_LANG_PUSH(C++)
AC_CHECK_DECL(std::setlocale, [AC_DEFINE([HAVE_SETLOCALE], [], [Define if
setlocale is available in clocale])], , [#include <clocale>])
results in the warning
conftest.cpp:37:12: warning: extra tokens at end of #ifndef directive
in config.log.
The corresponding code is:
#include <clocale>
int
main ()
{
#ifndef std::setlocale
(void) std::setlocale;
#endif
;
return 0;
}
The problem is "#ifndef std::setlocale" where ":" is no proper macro
character. In this case the ifndef can be ommitted.
Jens
tags +upstream thanks Hello Jens, this is clearly an upstream bug. Adding bug-autoconf. * Jens Seidel wrote on Fri, Apr 23, 2010 at 05:30:55PM CEST: Yep. This is another problem with the AC_CHECK_DECL* macros and C++ sources. There is a pending patch for another issue in this area, http://thread.gmane.org/gmane.comp.gcc.patches/201265/focus=12673 but it does not address the above. It would probably be sufficient to just not use the #ifndef if the name contained characters not suitable for a CPP macro. Cheers, and thanks for the bug report, Ralf
I'm looking over old bug reports before uploading 2.67.
Using the following configure.ac:
AC_INIT
AC_PREREQ(2.59)
AC_LANG_PUSH(C++)
AC_CHECK_DECL(std::setlocale, [AC_DEFINE([HAVE_SETLOCALE], [], [Define if
setlocale is available in clocale])], , [#include <clocale>])
AC_OUTPUT
I confirmed that this bug is still present. Notably, the
following appears in config.log:
conftest.cpp:14:12: warning: extra tokens at end of #ifndef directive
and by editing the configure script directly I found that indeed,
the generated program was still this:
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h. */
#include <clocale>
int
main ()
{
#ifndef std::setlocale
#ifdef __cplusplus
(void) std::setlocale;
#else
(void) std::setlocale;
#endif
#endif
;
return 0;
}