fnmatch.h and glob.h are included only if --with-glob is enabled. Whilst it appears that they come from glibc directly, the checks for POSIX_C_SOURCE and whatnot aren't strictly necessary and actually defeat the purpose of bundling them. rpm uses the GNU #defines, but they only kick in if the compiler sets POSIX_C_SOURCE and/or GNU_SOURCE to something valid. These checks are redundant given the limited scope of the header files, and if the compiler or pre-processor don't define POSIX_C_SOURCE or GNU_SOURCE, then they aren't included at all thereby breaking the build process.
Created attachment 10660 [details] Patch for glob.h
Created attachment 10661 [details] Patch for fnmatch.h
FWIW, these are exact copies of what was in glibc, stolen for portability retrofitting on non-GNU systems, presumably as portable as glibc is (i.e. failrly portable). What's worng with simply adding -D_GNU_SOURCE when compiling rpm always, as that is essentially what is intended (i.e. GNU extensions to globbing) even though the includes are in the rpm tree rather than the glibc tree on non-GNU systems?
That sounds like a better fix, I'll give it a go, thanks!
OK, reopen if adding -D_GNU_SOURCE doesn't work for you. BTW, some instructions on what you're doing wrto LDFLAGS, CFLAGS, etc to build rpm on non-linuc platforms would be gratefully received. I'll even write it up if you just send me the output of a build for each platform.