a workaround AppKit usability no when Emacs 25.1 build
TL;DR
use clang for building Emacs 25.1.1 on Mac when configure script warning said that Appkit/Appkit.h is exist but unable.
reproduce step
cd somewhere curl -OL http://ftp.jaist.ac.jp/pub/GNU/emacs/emacs-25.1.tar.xz tar Jxvf emacs-25.1.tar.xz cd emacs-25.1 ./configure --without-x
the configure script may produce bellow error message
checking AppKit/AppKit.h usability... no
checking AppKit/AppKit.h presence... yes
configure: WARNING: AppKit/AppKit.h: present but cannot be compiled
configure: WARNING: AppKit/AppKit.h: check for missing prerequisite headers?
configure: WARNING: AppKit/AppKit.h: see the Autoconf documentation
configure: WARNING: AppKit/AppKit.h: section "Present But Cannot Be Compiled"
configure: WARNING: AppKit/AppKit.h: proceeding with the compiler's result
configure: WARNING: ## ------------------------------------ ##
configure: WARNING: ## Report this to bug-gnu-emacs@gnu.org ##
configure: WARNING: ## ------------------------------------ ##
checking for AppKit/AppKit.h... no
configure: error: The include files (AppKit/AppKit.h etc) that
are required for a Nextstep build are missing or cannot be compiled.
Either fix this, or re-configure with the option '--without-ns'.
an AppKit/Appkit.h is located at
locate AppKit.h | grep -v html
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/AppKit.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/AppKit.h
/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/AppKit.h
CPPFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/ does now work well.
In fact, this is gcc bug.
My workaround is to use clang instead of gcc by CC environment variable.
cd somewhere curl -OL http://ftp.jaist.ac.jp/pub/GNU/emacs/emacs-25.1.tar.xz tar Jxvf emacs-25.1.tar.xz cd emacs-25.1 CC=/usr/bin/clang ./configure --without-x