# Copyright © 2023-2024 Nick Bowler # # Monkey patches for gnulib macros. # # License WTFPL2: Do What The Fuck You Want To Public License, version 2. # This is free software: you are free to do what the fuck you want to. # There is NO WARRANTY, to the extent permitted by law. # DX_PATCH_GNULIB # # Apply all the patches described below. Should be expanded before AC_INIT. AC_DEFUN([DX_PATCH_GNULIB], [m4_foreach_w([patch], m4_defn([_DX_GL_PATCHES]), [m4_indir([_DX_GL_PATCH(]m4_defn([patch])[)])])]) m4_define([_DX_GL_PATCHES]) m4_define([_DX_GL_PATCH], [m4_define([_DX_GL_PATCH($1)], [$2])m4_define([_DX_GL_PATCHES], m4_defn([_DX_GL_PATCHES])[ $1])]) # Patch if ! ... constructs produced by gnulib conditional dependencies # as these fail in Solaris 10 /bin/sh. _DX_GL_PATCH([gl-cond-deps], [DX_PATCH_MACRO([gl_INIT], [if ! *\(.*gnulib_enabled[^;]*\); then], [if \1; then :; else])]) # Patch old versions of threadlib.m4, which have a quoting bug preventing # correct determination of PTHREAD_IN_USE_DETECTION_HARD on Solaris 9 and # earlier. If this is set incorrectly, libcdecl will crash on error. _DX_GL_PATCH([gl-threadlib-solaris-fix], [DX_PATCH_MACRO([gl_PTHREADLIB_BODY], [solaris2\.\[1-9\]], [solaris2.@<:@1-9@:>@])]) # Patch old versions of threadlib to default to native Windows threads. # This is the default behaviour in current upstream gnulib, and avoids # pulling in extra libraries by default on MinGW. _DX_GL_PATCH([gl-threadlib-mingw-default], [DX_PATCH_MACRO([gl_THREADLIB_EARLY_BODY], [\[gl_use_winpthreads_default=\]], [[gl_use_winpthreads_default=no]])]) # Remove silly warning flag probes that are included unconditionally in newer # gnulib and bloat downstream configure scripts for no real reason. _DX_GL_PATCH([gl-no-warnings], [m4_ifdef([gl_CC_GNULIB_WARNINGS], [AC_DEFUN([gl_CC_GNULIB_WARNINGS])])]) # Avoid gnulib stdint.m4 from forcing HAVE_(UNSIGNED_)LONG_LONG_INT as this # breaks anything which actually tries to use AC_TYPE_LONG_LONG_INT to work # with missing long long, and is otherwise pointless. # # Gnulib itself doesn't care about these definitions and unconditionally uses # long long. So by itself, this won't fix any failures in Gnulib due to an # actually missing 'long long' but also should not create new problems. _DX_GL_PATCH([stdint-no-fake-longlong], [DX_PATCH_MACRO([gl_STDINT_H], [AC_DEFINE(\[HAVE[_UNSIGNED]*_LONG_LONG_INT\][^)]*.], [dnl])])