From 5da03c7a60b9bd46aa1e28092957b5aaa0655d15 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Thu, 4 Apr 2024 11:59:51 -0700 Subject: [PATCH] configure: Define HAVE_WINE_PRELOADER when the preloader is being built. --- configure | 3 +++ configure.ac | 1 + dlls/ntdll/unix/loader.c | 4 ++-- include/config.h.in | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 355d33982ba..d4101bf79d0 100755 --- a/configure +++ b/configure @@ -20457,6 +20457,9 @@ if test "$wine_use_preloader" = "yes" then test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader" WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader" + +printf "%s\n" "#define HAVE_WINE_PRELOADER 1" >>confdefs.h + fi diff --git a/configure.ac b/configure.ac index bcfa803035d..c73562ba58c 100644 --- a/configure.ac +++ b/configure.ac @@ -2042,6 +2042,7 @@ if test "$wine_use_preloader" = "yes" then test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader) WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader" + AC_DEFINE(HAVE_WINE_PRELOADER, 1, [Define to 1 if the Wine preloader is being used.]) fi dnl **** Check for functions **** diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 8cf6abed3da..41730064a51 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -147,7 +147,7 @@ SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4] = static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2))); #endif -#if defined(linux) || defined(__APPLE__) +#ifdef HAVE_WINE_PRELOADER static const BOOL use_preloader = TRUE; #else static const BOOL use_preloader = FALSE; @@ -2074,7 +2074,7 @@ static int pre_exec(void) return 1; /* we have a preloader on x86-64/arm64 */ } -#elif defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)) +#elif defined(__APPLE__) && defined(HAVE_WINE_PRELOADER) static int pre_exec(void) { diff --git a/include/config.h.in b/include/config.h.in index ef783c75a42..aa066a87ad7 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -642,6 +642,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_VALGRIND_H +/* Define to 1 if the Wine preloader is being used. */ +#undef HAVE_WINE_PRELOADER + /* Define to 1 if you have the header file. */ #undef HAVE_X11_EXTENSIONS_SHAPE_H