[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using AC_C_INLINE blows up C++ tests
From: |
Bob Friesenhahn |
Subject: |
Re: Using AC_C_INLINE blows up C++ tests |
Date: |
Sat, 7 Jun 2003 11:42:35 -0500 (CDT) |
On 7 Jun 2003, Assar Westerlund wrote:
> Bob Friesenhahn <address@hidden> writes:
> > If a configure script uses AC_C_INLINE to test the C compiler, and
> > then later switches the current language to C++ in order to perform
> > C++ tests, the C++ tests will fail if AC_C_INLINE re-defines 'inline'
> > to some other string.
> >
> > It would be useful if Autoconf would hide any re-definition of inline
> > if the current language is not C.
>
> Wouldn't that require autoconf to write multiple config.h for multiple
> languages? That might be a good idea, but it would require the
> configure script to tell what things should be in common, and quite a
> bit of restructuring of autoconf.
Issues with config.h are easily taken care of with an
#undef inline
after including config.h in a C++ module or header. It is true that
autoheader could arrange to add #ifdefs around the inline define so
that it doesn't take effect for C++. In fact, it can be argued that
compiler feature tests for the C compiler should never be supplied for
any other language environment since other languages are using a
different compiler.
The main Autoconf issue is that each feature test program includes all
the #defines generated from any previous test. This means that if
AC_C_INLINE has been executed previously, then a define like
#define inline __inline
may be automatically generated as part of conftest.c, which causes C++
tests which include C++ headers or otherwise use inline to fail.
Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen