Subject: Re: bug#27041: [PATCH] Check if instancetype supported in ObjC

From: [email-masked]
Date: Thu, 25 May 2017 19:42:05 -0400

Alan Third <[email-masked]> writes:

> --- a/configure.ac
> +++ b/configure.ac
> @@ -1980,6 +1980,23 @@ AC_DEFUN
>  AC_SUBST(NS_OBJ)
>  AC_SUBST(NS_OBJC_OBJ)
>  
> +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
> +
>  HAVE_W32=no
>  W32_OBJ=
>  W32_LIBS=

I guess this should be inside 'if test "${HAVE_NS}" = yes; ...'
(although it seems harmless anyway).