configure: Add a __WINE_PE_BUILD define for files that are built as PE.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-10-14 11:07:10 +02:00
parent c53736d12f
commit cbf94a7b2c
9 changed files with 27 additions and 31 deletions

11
configure vendored
View File

@ -630,7 +630,6 @@ LDAP_CFLAGS
RT_LIBS RT_LIBS
TOOLSEXT TOOLSEXT
MSVCRTFLAGS MSVCRTFLAGS
EXTRACFLAGS
VKD3D_SHADER_LIBS VKD3D_SHADER_LIBS
VKD3D_SHADER_CFLAGS VKD3D_SHADER_CFLAGS
VKD3D_LIBS VKD3D_LIBS
@ -751,6 +750,7 @@ TOP_INSTALL_DEV
TOP_INSTALL_LIB TOP_INSTALL_LIB
UNIXLDFLAGS UNIXLDFLAGS
UNIXDLLFLAGS UNIXDLLFLAGS
EXTRACFLAGS
LDEXECFLAGS LDEXECFLAGS
LDDLLFLAGS LDDLLFLAGS
DLLFLAGS DLLFLAGS
@ -7935,6 +7935,8 @@ LDDLLFLAGS=""
LDEXECFLAGS="" LDEXECFLAGS=""
EXTRACFLAGS=""
UNIXDLLFLAGS="-fPIC" UNIXDLLFLAGS="-fPIC"
UNIXLDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname,\$(UNIXLIB)" UNIXLDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname,\$(UNIXLIB)"
@ -8311,6 +8313,7 @@ else
fi fi
LIBEXT="dll" LIBEXT="dll"
EXTRACFLAGS="-D__WINE_PE_BUILD"
case $host_cpu in case $host_cpu in
*i[3456]86*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--disable-stdcall-fixup" >&5 *i[3456]86*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--disable-stdcall-fixup" >&5
$as_echo_n "checking whether the compiler supports -Wl,--disable-stdcall-fixup... " >&6; } $as_echo_n "checking whether the compiler supports -Wl,--disable-stdcall-fixup... " >&6; }
@ -9628,7 +9631,7 @@ test -n "$CROSSCC" || CROSSCC="false"
saved_LDFLAGS=$LDFLAGS saved_LDFLAGS=$LDFLAGS
CROSSCFLAGS=${CROSSCFLAGS:-"-g -O2"} CROSSCFLAGS=${CROSSCFLAGS:-"-g -O2"}
EXTRACROSSCFLAGS="-DWINE_CROSS_PE -Wall" EXTRACROSSCFLAGS="-D__WINE_PE_BUILD -Wall"
@ -16871,11 +16874,9 @@ fi
test "x$ac_cv_lib_soname_vkd3d" != "x" || enable_d3d12=${enable_d3d12:-no} test "x$ac_cv_lib_soname_vkd3d" != "x" || enable_d3d12=${enable_d3d12:-no}
EXTRACFLAGS=""
if test "x${GCC}" = "xyes" if test "x${GCC}" = "xyes"
then then
EXTRACFLAGS="-Wall -pipe" EXTRACFLAGS="$EXTRACFLAGS -Wall -pipe"
saved_CFLAGS=$CFLAGS saved_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=unknown-warning-option" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=unknown-warning-option" >&5

View File

@ -696,6 +696,7 @@ dnl **** Check for working dll ****
AC_SUBST(DLLFLAGS,"") AC_SUBST(DLLFLAGS,"")
AC_SUBST(LDDLLFLAGS,"") AC_SUBST(LDDLLFLAGS,"")
AC_SUBST(LDEXECFLAGS,"") AC_SUBST(LDEXECFLAGS,"")
AC_SUBST(EXTRACFLAGS,"")
AC_SUBST(UNIXDLLFLAGS,"-fPIC") AC_SUBST(UNIXDLLFLAGS,"-fPIC")
AC_SUBST(UNIXLDFLAGS,["-shared -Wl,-Bsymbolic -Wl,-soname,\$(UNIXLIB)"]) AC_SUBST(UNIXLDFLAGS,["-shared -Wl,-Bsymbolic -Wl,-soname,\$(UNIXLIB)"])
AC_SUBST(TOP_INSTALL_LIB,"") AC_SUBST(TOP_INSTALL_LIB,"")
@ -715,6 +716,7 @@ case $host_os in
cygwin*|mingw32*) cygwin*|mingw32*)
AC_CHECK_TOOL(DLLTOOL,dlltool,false) AC_CHECK_TOOL(DLLTOOL,dlltool,false)
LIBEXT="dll" LIBEXT="dll"
EXTRACFLAGS="-D__WINE_PE_BUILD"
dnl Disable stdcall fixups to catch prototype mismatches dnl Disable stdcall fixups to catch prototype mismatches
case $host_cpu in case $host_cpu in
*i[[3456]]86*) WINE_TRY_CFLAGS([-Wl,--disable-stdcall-fixup], *i[[3456]]86*) WINE_TRY_CFLAGS([-Wl,--disable-stdcall-fixup],
@ -953,7 +955,7 @@ then
saved_CFLAGS=$CFLAGS saved_CFLAGS=$CFLAGS
saved_LDFLAGS=$LDFLAGS saved_LDFLAGS=$LDFLAGS
AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-"-g -O2"}) AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-"-g -O2"})
AC_SUBST(EXTRACROSSCFLAGS,"-DWINE_CROSS_PE -Wall") AC_SUBST(EXTRACROSSCFLAGS,"-D__WINE_PE_BUILD -Wall")
AC_SUBST(CROSSLDFLAGS) AC_SUBST(CROSSLDFLAGS)
CC="$CROSSCC" CC="$CROSSCC"
@ -1955,10 +1957,9 @@ test "x$ac_cv_lib_soname_vkd3d" != "x" || enable_d3d12=${enable_d3d12:-no}
dnl **** Check for gcc specific options **** dnl **** Check for gcc specific options ****
AC_SUBST(EXTRACFLAGS,"")
if test "x${GCC}" = "xyes" if test "x${GCC}" = "xyes"
then then
EXTRACFLAGS="-Wall -pipe" EXTRACFLAGS="$EXTRACFLAGS -Wall -pipe"
dnl Check for some compiler flags dnl Check for some compiler flags
dnl clang needs to be told to fail on unknown options dnl clang needs to be told to fail on unknown options
@ -2584,10 +2585,7 @@ esac
dnl **** Generate output files **** dnl **** Generate output files ****
AH_TOP([#ifndef __WINE_CONFIG_H AH_TOP([#ifndef __WINE_CONFIG_H
#define __WINE_CONFIG_H #define __WINE_CONFIG_H])
#ifdef WINE_CROSS_PE
#error config.h should not be used when cross-compiling
#endif])
AH_BOTTOM([#endif /* __WINE_CONFIG_H */]) AH_BOTTOM([#endif /* __WINE_CONFIG_H */])
AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h]) AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h])

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
/* referenced by MSVC to pull crt support for floating points. we don't use it. */ /* referenced by MSVC to pull crt support for floating points. we don't use it. */
int _fltused = 0; int _fltused = 0;

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
@ -249,4 +249,4 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
return p__wine_dbg_header( cls, channel, function ); return p__wine_dbg_header( cls, channel, function );
} }
#endif /* _WIN32 */ #endif /* __WINE_PE_BUILD */

View File

@ -25,7 +25,7 @@
WINBASEAPI void *WINAPI DelayLoadFailureHook( LPCSTR name, LPCSTR function ); WINBASEAPI void *WINAPI DelayLoadFailureHook( LPCSTR name, LPCSTR function );
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
extern IMAGE_DOS_HEADER __ImageBase; extern IMAGE_DOS_HEADER __ImageBase;
@ -39,7 +39,7 @@ FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAG
return ResolveDelayLoadedAPI( &__ImageBase, descr, NULL, DelayLoadFailureHook, addr, 0 ); return ResolveDelayLoadedAPI( &__ImageBase, descr, NULL, DelayLoadFailureHook, addr, 0 );
} }
#else /* _WIN32 */ #else /* __WINE_PE_BUILD */
struct ImgDelayDescr struct ImgDelayDescr
{ {
@ -79,4 +79,4 @@ static void free_delay_imports(void)
} }
#endif #endif
#endif /* _WIN32 */ #endif /* __WINE_PE_BUILD */

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
#include <stdarg.h> #include <stdarg.h>
@ -65,4 +65,4 @@ NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, vo
return p__wine_unix_call( handle, code, args ); return p__wine_unix_call( handle, code, args );
} }
#endif /* _WIN32 */ #endif /* __WINE_PE_BUILD */

View File

@ -2,9 +2,6 @@
#ifndef __WINE_CONFIG_H #ifndef __WINE_CONFIG_H
#define __WINE_CONFIG_H #define __WINE_CONFIG_H
#ifdef WINE_CROSS_PE
#error config.h should not be used when cross-compiling
#endif
/* Define to the file extension for executables. */ /* Define to the file extension for executables. */
#undef EXEEXT #undef EXEEXT

View File

@ -21,13 +21,13 @@
#ifndef __WINE_WINE_ASM_H #ifndef __WINE_WINE_ASM_H
#define __WINE_WINE_ASM_H #define __WINE_WINE_ASM_H
#if defined(__APPLE__) || (defined(_WIN32) && defined(__i386__)) #if defined(__APPLE__) || (defined(__WINE_PE_BUILD) && defined(__i386__))
# define __ASM_NAME(name) "_" name # define __ASM_NAME(name) "_" name
#else #else
# define __ASM_NAME(name) name # define __ASM_NAME(name) name
#endif #endif
#if defined(_WIN32) && defined(__i386__) #if defined(__WINE_PE_BUILD) && defined(__i386__)
# define __ASM_STDCALL(name,args) "_" name "@" #args # define __ASM_STDCALL(name,args) "_" name "@" #args
# define __ASM_FASTCALL(name,args) "@" name "@" #args # define __ASM_FASTCALL(name,args) "@" name "@" #args
#else #else
@ -55,7 +55,7 @@
# define __ASM_SEH(str) # define __ASM_SEH(str)
#endif #endif
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
# define __ASM_FUNC_TYPE(name) ".def " name "\n\t.scl 2\n\t.type 32\n\t.endef" # define __ASM_FUNC_TYPE(name) ".def " name "\n\t.scl 2\n\t.type 32\n\t.endef"
#elif defined(__APPLE__) #elif defined(__APPLE__)
# define __ASM_FUNC_TYPE(name) "" # define __ASM_FUNC_TYPE(name) ""
@ -67,7 +67,7 @@
# define __ASM_FUNC_TYPE(name) ".type " name ",@function" # define __ASM_FUNC_TYPE(name) ".type " name ",@function"
#endif #endif
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
# define __ASM_FUNC_SIZE(name) "" # define __ASM_FUNC_SIZE(name) ""
#elif defined(__APPLE__) #elif defined(__APPLE__)
# define __ASM_FUNC_SIZE(name) "" # define __ASM_FUNC_SIZE(name) ""
@ -107,7 +107,7 @@
__ASM_BLOCK_END __ASM_BLOCK_END
#endif #endif
#ifdef _WIN32 #ifdef __WINE_PE_BUILD
#define __ASM_GLOBAL_IMPORT(name) __ASM_DEFINE_IMPORT(__ASM_NAME(#name)) #define __ASM_GLOBAL_IMPORT(name) __ASM_DEFINE_IMPORT(__ASM_NAME(#name))
#define __ASM_STDCALL_IMPORT(name,args) __ASM_DEFINE_IMPORT(__ASM_STDCALL(#name,args)) #define __ASM_STDCALL_IMPORT(name,args) __ASM_DEFINE_IMPORT(__ASM_STDCALL(#name,args))
#else #else
@ -117,7 +117,7 @@
/* fastcall support */ /* fastcall support */
#if defined(__i386__) && !defined(_WIN32) #if defined(__i386__) && !defined(__WINE_PE_BUILD)
# define __ASM_USE_FASTCALL_WRAPPER # define __ASM_USE_FASTCALL_WRAPPER
# define DEFINE_FASTCALL1_WRAPPER(func) \ # define DEFINE_FASTCALL1_WRAPPER(func) \
@ -176,7 +176,7 @@
#endif /* __i386__ */ #endif /* __i386__ */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(__WINE_PE_BUILD) && !defined(__APPLE__) && !defined(__ANDROID__)
#define __ASM_OBSOLETE(func) __asm__( ".symver " #func "_obsolete," #func "@WINE_1.0" ) #define __ASM_OBSOLETE(func) __asm__( ".symver " #func "_obsolete," #func "@WINE_1.0" )
#else #else
#undef __ASM_OBSOLETE #undef __ASM_OBSOLETE