* Check ANSI compatibility of Mac OS X system header
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index 6c2483f..59e9992 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -70,8 +70,10 @@
/* This is for Mac OS X. Without redefinition, OS_INLINE */
/* expands to `static inline' which doesn't survive the */
/* -ansi compilation flag of GCC. */
+#if !HAVE_ANSI_OS_INLINE
#undef OS_INLINE
#define OS_INLINE static __inline__
+#endif
#include <Carbon/Carbon.h>
#else
#include <Resources.h>
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index d0e3c4a..254ae89 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -199,7 +199,34 @@ if test x$with_old_mac_fonts = xyes; then
UseResFile( res );
],
- [AC_MSG_RESULT([ok])],
+ [AC_MSG_RESULT([ok])
+ AC_MSG_CHECKING([OS_INLINE macro is ANSI compatible])
+ orig_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
+ AC_TRY_COMPILE([
+#if defined(__GNUC__) && defined(__APPLE_CC__)
+# include <Carbon/Carbon.h>
+# include <ApplicationServices/ApplicationServices.h>
+#else
+# include <ConditionalMacros.h>
+# include <Files.h>
+#endif
+ ],
+ [
+ /* OSHostByteOrder() is typed as 'OS_INLINE' */
+ int32_t os_byte_order = OSHostByteOrder();
+ if ( OSBigEndian != os_byte_order )
+ return 1;
+ ],
+ [
+ AC_MSG_RESULT([ok])
+ CFLAGS="$orig_CFLAGS"
+ CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
+ ],[
+ AC_MSG_RESULT([no, ANSI incompatible])
+ CFLAGS="$orig_CFLAGS"
+ ])
+ ],
[AC_MSG_RESULT([not found])
LDFLAGS="${orig_LDFLAGS}"
CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index ea47caa..07a2dc7 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -72,8 +72,10 @@
/* This is for Mac OS X. Without redefinition, OS_INLINE */
/* expands to `static inline' which doesn't survive the */
/* -ansi compilation flag of GCC. */
+#if !HAVE_ANSI_OS_INLINE
#undef OS_INLINE
#define OS_INLINE static __inline__
+#endif
#include <Carbon/Carbon.h>
#ifndef HFS_MAXPATHLEN