[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using AC_C_INLINE blows up C++ tests
From: |
Paul Eggert |
Subject: |
Re: Using AC_C_INLINE blows up C++ tests |
Date: |
07 Jul 2003 00:46:39 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Albert Chin <address@hidden> writes:
> The correct solution is checking for 'inline' for whatever the current
> language is. Of course, this means programmers cannot use 'inline' for
> C and C++ which is counterintuitive so the patch might be good enough.
OK, you guys talked me into it. I installed the following patch.
Using AH_VERBATIM is a bit of a hack, but I couldn't think of a
cleaner hack.
2003-07-07 Paul Eggert <address@hidden>
* lib/autoconf/c.m4 (AC_C_INLINE): Wrap the '#define inline ...'
inside '#ifndef __cplusplus'. Problem reported by
Bob Friesenhahn.
Index: c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.180
retrieving revision 1.181
diff -p -u -r1.180 -r1.181
--- c.m4 21 Jun 2003 00:01:04 -0000 1.180
+++ c.m4 7 Jul 2003 07:41:07 -0000 1.181
@@ -1020,12 +1020,25 @@ $ac_kw foo_t foo () {return 0; }
[ac_cv_c_inline=$ac_kw; break])
done
])
+AH_VERBATIM([inline],
+[/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif])
case $ac_cv_c_inline in
inline | yes) ;;
- no) AC_DEFINE(inline,,
- [Define as `__inline' if that's what the C compiler calls it,
- or to nothing if it is not supported.]) ;;
- *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
esac
])# AC_C_INLINE