vcpkg(mfx-dispatch): pre-run libtoolize before autoreconf for autotools 1.17+
build-linux / build-linux-x64 (push) Failing after 27s
build-windows / build-windows-x64 (push) Successful in 1h11m39s

This commit is contained in:
2026-05-05 14:16:36 +02:00
parent e087770238
commit 33524ad2b1
+20 -11
View File
@@ -18,17 +18,26 @@ vcpkg_from_github(
${MISSING_CSTDINT_IMPORT_PATCH}
)
# autotools 1.17+ (Debian 13, Ubuntu 24.04+) doesn't trace the deprecated
# `AC_PROG_LIBTOOL` for libtoolize, so the libtool m4 macros never get pulled
# in and automake fails with "Libtool library used but 'LIBTOOL' is undefined".
# Swap to the modern `LT_INIT` macro at extract time so this works on any
# distro. No-op on hosts that already have AC_PROG_LIBTOOL working.
if(EXISTS "${SOURCE_PATH}/configure.ac")
file(READ "${SOURCE_PATH}/configure.ac" _mfx_configure_ac)
string(REPLACE "AC_PROG_LIBTOOL" "LT_INIT" _mfx_configure_ac_patched "${_mfx_configure_ac}")
if(NOT _mfx_configure_ac STREQUAL _mfx_configure_ac_patched)
file(WRITE "${SOURCE_PATH}/configure.ac" "${_mfx_configure_ac_patched}")
message(STATUS "mfx-dispatch: replaced AC_PROG_LIBTOOL with LT_INIT for autotools >= 1.17")
# mfx_dispatch's configure.ac uses LT_INIT, but autoreconf 1.17+ (Debian 13,
# Ubuntu 24.04+) sometimes fails to trace it -- reporting "not using Libtool"
# and skipping libtoolize. When libtoolize doesn't run, libtool's m4 macros
# never get installed into the source tree, and automake then fails with
# "Libtool library used but 'LIBTOOL' is undefined" on Makefile.am:7.
#
# Force libtoolize to run before autoreconf so the m4 macros are guaranteed
# to be present regardless of autoreconf's introspection result.
if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
find_program(LIBTOOLIZE NAMES libtoolize glibtoolize)
if(LIBTOOLIZE)
message(STATUS "mfx-dispatch: pre-running libtoolize to install libtool m4 macros")
file(MAKE_DIRECTORY "${SOURCE_PATH}/m4")
vcpkg_execute_required_process(
COMMAND "${LIBTOOLIZE}" --force --copy --install
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "libtoolize-${TARGET_TRIPLET}"
)
else()
message(WARNING "libtoolize not found; mfx-dispatch build is likely to fail")
endif()
endif()