Subject: 28.0.91: Build fails on MSYS2/MinGW-w64 with Clang

From: Óscar Fuentes <[email-masked]>
Date: Thu, 20 Jan 2022 00:41:03 +0100

Building under the Clang environment (which uses clang instead of gcc)
fails with

$ make V=1
make -C lib all
make[1]: Entering directory '/d/dev/other/MINGW-packages/mingw-w64-emacs/src/build-CLANG64/lib'
clang -c -D__USE_MINGW_ANSI_STDIO=1   -MMD -MF deps/getopt.d -MP -Wno-switch -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes -Wno-initializer-overrides -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare   -march=x86-64 -mtune=generic -O2 -pipe -I. -I../src -I../../emacs-28.0.91/lib -I../../emacs-28.0.91/lib/../src  -o getopt.o ../../emacs-28.0.91/lib/getopt.c
In file included from ../../emacs-28.0.91/lib/getopt.c:24:
In file included from ./getopt.h:52:
In file included from ./unistd.h:40:
In file included from C:/apps/msys64/clang64/x86_64-w64-mingw32/include/unistd.h:11:
In file included from ../../emacs-28.0.91/lib/../src/process.h:29:
In file included from ../../emacs-28.0.91/lib/../src/gnutls.h:31:
../../emacs-28.0.91/lib/../src/lisp.h:944:10: fatal error: 'globals.h' file not found
#include "globals.h"
         ^~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:84: getopt.o] Error 1
make[1]: Leaving directory '/d/dev/other/MINGW-packages/mingw-w64-emacs/src/build-CLANG64/lib'
make: *** [Makefile:436: lib] Error 2

globals.h does not exist. AFAIK it is a generated file, but on this
build it is not generated.

The configure invocation is

  configure \
    --prefix=/clang64 \
    --build=x86_64-w64-mingw32 \
    --with-modules \
    --without-dbus \
    --without-compress-install

Speaking of configure, it does not even try to locate several libraries.
The string "jpeg", for instance, only appears in config.log as

LIBJPEG=''