-# if defined(KEEP_INLINES)
-# define EXTERN_INLINE inline
-# else
-# define EXTERN_INLINE extern inline
-# endif
+// The special "extern inline" behaviour is now only supported by gcc
+// when _GNUC_GNU_INLINE__ is defined, and you have to use
+// __attribute__((gnu_inline)). So when we don't have this, we use
+// ordinary static inline.
+//
+// Apple's gcc defines __GNUC_GNU_INLINE__ without providing
+// gnu_inline, so we exclude MacOS X and fall through to the safe
+// version.
+//
+#if defined(__GNUC_GNU_INLINE__) && !defined(__APPLE__)
+# if defined(KEEP_INLINES)
+# define EXTERN_INLINE inline
+# else
+# define EXTERN_INLINE extern inline __attribute__((gnu_inline))
+# endif
+#else
+# if defined(KEEP_INLINES)
+# define EXTERN_INLINE
+# else
+# define EXTERN_INLINE INLINE_HEADER
+# endif
+#endif