On 2023-09-18 02:55, Sébastien Hinderer wrote:
the project currently has the convention of including system headers before its ocnfiguraiotn headers
Ouch. The Autoconf manual explicitly says "The package should ‘#include’ the configuration header file before any other header files" <https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Configuration-Headers.html> so your project's convention is not supported.
One option I am ocnsidering is to use themacro to determine wether the macro needs to be defined and then use its result to determine whether -D_FILE_OFFSET_BITS=64 should be addeed to the command-line or not.
Something like that should be a workaround, yes. However, you'll likely need to add -D options for more than just _FILE_OFFSET_BITS. I suggest looking also into the macros _LARGEFILE_SOURCE, _TIME_BITS, _LARGE_FILES, and __MINGW_USE_VC2005_COMPAT, depending on which platforms you're trying to port to.
Also, if you're using any other Autoconf macros you may need to do something similar. Pretty much any 'undef _*' in your config.hin is suspect. There are 37 such macros in GNU coreutils, e.g., _GNU_SOURCE, _DARWIN_C_SOURCE, _REGEX_LARGE_OFFSETS. If GNU coreutils used your project's conventions it'd likely need to prepare -D options for all of these, and maybe even more.