changeset 9887:f2408973947f

Fix __GNUC_STDC_INLINE__ predefine with Apple GCC on MacOS X 10.5.
author Bruno Haible <bruno@clisp.org>
date Fri, 11 Apr 2008 15:13:24 +0200
parents c9ee791c5d9c
children 4552418ad371
files ChangeLog gnulib-tool m4/gnulib-common.m4
diffstat 3 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 11 13:29:33 2008 +0200
+++ b/ChangeLog	Fri Apr 11 15:13:24 2008 +0200
@@ -1,3 +1,10 @@
+2008-04-11  Bruno Haible  <bruno@clisp.org>
+
+	Fix __GNUC_STDC_INLINE__ predefine with Apple GCC on MacOS X 10.5.
+	* gnulib-tool (func_emit_initmacro_start): Emit an invocation of
+	gl_COMMON.
+	* m4/gnulib-common.m4 (gl_COMMON, gl_COMMON_BODY): New macros.
+
 2008-04-11  Bruno Haible  <bruno@clisp.org>
 
 	* modules/git-merge-changelog (git_merge_changelog_LDADD): Add LIBINTL.
--- a/gnulib-tool	Fri Apr 11 13:29:33 2008 +0200
+++ b/gnulib-tool	Fri Apr 11 15:13:24 2008 +0200
@@ -2046,6 +2046,7 @@
   # We let automake know about the files to be distributed through the
   # EXTRA_lib_SOURCES variable.
   echo "  m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
+  echo "  gl_COMMON"
 }
 
 # func_emit_initmacro_end macro_prefix
--- a/m4/gnulib-common.m4	Fri Apr 11 13:29:33 2008 +0200
+++ b/m4/gnulib-common.m4	Fri Apr 11 15:13:24 2008 +0200
@@ -1,9 +1,28 @@
-# gnulib-common.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 4
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
+# gl_COMMON
+# is expanded unconditionally through gnulib-tool magic.
+AC_DEFUN([gl_COMMON], [
+  dnl Use AC_REQUIRE here, so that the code is expanded once only.
+  AC_REQUIRE([gl_COMMON_BODY])
+])
+AC_DEFUN([gl_COMMON_BODY], [
+  AH_VERBATIM([isoc99_inline],
+[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
+   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
+   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
+   __APPLE__ && __MACH__ test for MacOS X.
+   __APPLE_CC__ tests for the Apple compiler and its version.
+   __STDC_VERSION__ tests for the C99 mode.  */
+#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
+# define __GNUC_STDC_INLINE__ 1
+#endif])
+])
+
 # gl_MODULE_INDICATOR([modulename])
 # defines a C macro indicating the presence of the given module.
 AC_DEFUN([gl_MODULE_INDICATOR],