Subject: 28.0.50; Cannot build on MacOS due to -std=c99 change in configure.ac

From: Keith Irwin <[email-masked]>
Date: Tue, 1 Sep 2020 22:44:07 -0700

I’ve been unable to build Emacs from the master branch for the past several days on MacOS (Big Sur). Previously, compiling on Big Sur worked.

I get the following error:

      CC       fringe.o
      CC       image.o
      CC       json.o
      CC       nsterm.o
    In file included from nsterm.m:46:
    ./lisp.h:1237:24: error: implicit declaration of function 'typeof' is invalid in
          C99 [-Werror,-Wimplicit-function-declaration]
      return USE_LSB_TAG ? make_fixnum (n) : XIL (n + (int0 << VALBITS));
                           ^
    ./lisp.h:444:26: note: expanded from macro 'make_fixnum'
    #  define make_fixnum(n) lisp_h_make_fixnum (n)
                             ^
    ./lisp.h:395:9: note: expanded from macro 'lisp_h_make_fixnum'
         ({ typeof (+(n)) lisp_h_make_fixnum_n = n; \
            ^
    ./lisp.h:1237:24: note: did you mean 'Ftype_of'?
    ./lisp.h:444:26: note: expanded from macro 'make_fixnum'
    #  define make_fixnum(n) lisp_h_make_fixnum (n)
                             ^
    ./lisp.h:395:9: note: expanded from macro 'lisp_h_make_fixnum'
         ({ typeof (+(n)) lisp_h_make_fixnum_n = n; \
            ^
    ./globals.h:4765:8: note: 'Ftype_of' declared here
    EXFUN (Ftype_of, 1);
           ^
    In file included from nsterm.m:46:
    ./lisp.h:1237:24: error: expected ';' after expression
      return USE_LSB_TAG ? make_fixnum (n) : XIL (n + (int0 << VALBITS));

I tracked the issue to this commit:

    https://emba.gnu.org/emacs/emacs/-/commit/72f66f70eef18e3b25cc989d67711887304f184b

When I make this change to line ~1904:

    #GNU_OBJC_CFLAGS="-std=c99”
    GNU_OBJC_CFLAGS=""

I can compile emacs as per usual.

I’m running macOS 11, Beta 5, with Xcode Beta 6, though I’m not sure if that’s an issue.

$ clang --version

Apple clang version 12.0.0 (clang-1200.0.31.1)
Target: x86_64-apple-darwin20.0.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ gcc --version

Configured with: --prefix=/Applications/Xcode-beta.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.31.1)
Target: x86_64-apple-darwin20.0.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin