From 33524ad2b19c83b047015b61535f00d476bb4ea0 Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Tue, 5 May 2026 14:16:36 +0200 Subject: [PATCH] vcpkg(mfx-dispatch): pre-run libtoolize before autoreconf for autotools 1.17+ --- res/vcpkg/mfx-dispatch/portfile.cmake | 31 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/res/vcpkg/mfx-dispatch/portfile.cmake b/res/vcpkg/mfx-dispatch/portfile.cmake index 2b2fc6435..7bf0a58bf 100644 --- a/res/vcpkg/mfx-dispatch/portfile.cmake +++ b/res/vcpkg/mfx-dispatch/portfile.cmake @@ -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()