]> Savannah Git Hosting - gnulib.git/commitdiff
extern-inline: improve macOS port
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 17 Jan 2022 22:03:01 +0000 (14:03 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 17 Jan 2022 22:07:24 +0000 (14:07 -0800)
* m4/extern-inline.m4 (gl_EXTERN_INLINE):
Define HAVE___HEADER_INLINE at configure-time, so that config.h
knows the workaround is not needed even though ctype.h has not yet
been included.  This lets the compiler use extern inline functions
on newer macOS platforms, instead of static inline.
Problem reported by Reuben Thomas in:
https://lists.gnu.org/r/bug-gnulib/2022-01/msg00130.html

ChangeLog
m4/extern-inline.m4

index 33944f44b806d225e3cf644fd18c25755075ddee..c5eebe4872edcbc31ee6af029e098b58e7e5e09c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-01-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       extern-inline: improve macOS port
+       * m4/extern-inline.m4 (gl_EXTERN_INLINE):
+       Define HAVE___HEADER_INLINE at configure-time, so that config.h
+       knows the workaround is not needed even though ctype.h has not yet
+       been included.  This lets the compiler use extern inline functions
+       on newer macOS platforms, instead of static inline.
+       Problem reported by Reuben Thomas in:
+       https://lists.gnu.org/r/bug-gnulib/2022-01/msg00130.html
+
 2022-01-17  Bruno Haible  <bruno@clisp.org>
 
        xstrtol: Trim dependencies.
index 2e914dbc0707088ea86102f63f0fd72802081bba..8a12bddd5719d9704e6123a16db82ccf10ccfbd5 100644 (file)
@@ -7,7 +7,22 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_EXTERN_INLINE],
 [
-  AH_VERBATIM([extern_inline],
+  AC_CACHE_CHECK([whether ctype.h defines __header_inline],
+    [gl_cv_have___header_inline],
+    [AC_PREPROC_IFELSE(
+       [AC_LANG_SOURCE([[#include <ctype.h>
+                         #ifndef __header_inline
+                          #error "<ctype.h> does not define __header_inline"
+                         #endif
+                        ]])],
+       [gl_cv_have___header_inline=yes],
+       [gl_cv_have___header_inline=no])])
+  if test "$gl_cv_have___header_inline" = yes; then
+    AC_DEFINE([HAVE___HEADER_INLINE], [1],
+      [Define to 1 if ctype.h defines __header_inline.])
+  fi
+
+  AH_VERBATIM([HAVE___HEADER_INLINE_1],
 [/* Please see the Gnulib manual for how to use these macros.
 
    Suppress extern inline with HP-UX cc, as it appears to be broken; see
@@ -54,7 +69,7 @@ AC_DEFUN([gl_EXTERN_INLINE],
  */
 #if (((defined __APPLE__ && defined __MACH__) \
       || defined __DragonFly__ || defined __FreeBSD__) \
-     && (defined __header_inline \
+     && (defined HAVE___HEADER_INLINE \
          ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
             && ! defined __clang__) \
          : ((! defined _DONT_USE_CTYPE_INLINE_ \