AC_SUBST(NS_OBJ)
AC_SUBST(NS_OBJC_OBJ)
+if test "${HAVE_NS}" = yes; then
+ AC_CACHE_CHECK(
+ [if the Objective C compiler supports instancetype],
+ [emacs_cv_objc_instancetype],
+ [AC_LANG_PUSH([Objective C])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[@interface Test
+ + (instancetype)test;
+ @end]])],
+ emacs_cv_objc_instancetype=yes,
+ emacs_cv_objc_instancetype=no)
+ AC_LANG_POP([Objective C])])
+
+ if test x$emacs_cv_objc_instancetype = xyes ; then
+ AC_DEFINE(NATIVE_OBJC_INSTANCETYPE, 1,
+ [Define if ObjC compiler supports instancetype natively.])
+ fi
+fi
+
HAVE_W32=no
W32_OBJ=
W32_LIBS=
typedef float EmacsCGFloat;
#endif
-/* FIXME: instancetype is a language built-in, but older versions of
- Clang don't support it, and I don't know if GCC supports it at all.
- Should this be tested for in ./configure? */
-#if defined (NS_IMPL_GNUSTEP)
- || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
-typedef id instancetype;
-typedef NSUInteger NSWindowStyleMask;
-#endif
-
/* ==========================================================================
Trace support
#endif
+/* If the compiler doesn't support instancetype, map it to id. */
+#ifndef NATIVE_OBJC_INSTANCETYPE
+typedef id instancetype;
+#endif
+
+
/* ==========================================================================
NSColor, EmacsColor category.
#define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
#define NSAlertStyleCritical NSCriticalAlertStyle
#define NSControlSizeRegular NSRegularControlSize
+
+/* And adds NSWindowStyleMask. */
+#ifdef __OBJC__
+typedef NSUInteger NSWindowStyleMask;
+#endif
#endif
#endif /* HAVE_NS */