makefiles: Add support for multiple PE architectures.

This commit is contained in:
Alexandre Julliard 2022-11-01 10:28:05 +01:00
parent e43cb42250
commit b1f59bc679
5 changed files with 1316 additions and 1087 deletions

88
aclocal.m4 vendored
View file

@ -199,26 +199,23 @@ AS_VAR_POPDEF([ac_var])])
dnl **** Check if we can link an empty program with special CFLAGS ****
dnl
dnl Usage: WINE_TRY_CROSSCFLAGS(flags,[action-if-yes,[action-if-no]])
dnl Usage: WINE_TRY_PE_CFLAGS(flags,[action-if-yes,[action-if-no]])
dnl
dnl The default action-if-yes is to append the flags to EXTRACROSSCFLAGS.
dnl The default action-if-yes is to append the flags to the arch-specific EXTRACFLAGS.
dnl
AC_DEFUN([WINE_TRY_CROSSCFLAGS],
[AS_VAR_PUSHDEF([ac_var], ac_cv_crosscflags_[[$1]])dnl
AC_CACHE_CHECK([whether the cross-compiler supports $1], ac_var,
AC_DEFUN([WINE_TRY_PE_CFLAGS],
[{ AS_VAR_PUSHDEF([ac_var], ac_cv_${wine_arch}_cflags_[[$1]])dnl
AC_CACHE_CHECK([whether $CC supports $1], ac_var,
[ac_wine_try_cflags_saved=$CFLAGS
ac_wine_try_cflags_saved_cc=$CC
ac_wine_try_cflags_saved_exeext=$ac_exeext
CFLAGS="$CFLAGS $EXTRACROSSCFLAGS -nostartfiles -nodefaultlibs $1"
CC="$CROSSCC"
CFLAGS="$CFLAGS -nostartfiles -nodefaultlibs $1"
ac_exeext=".exe"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int __cdecl mainCRTStartup(void) { return 0; }]])],
[AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
CFLAGS=$ac_wine_try_cflags_saved
CC=$ac_wine_try_cflags_saved_cc
ac_exeext=$ac_wine_try_cflags_saved_exeext])
AS_VAR_IF([ac_var],[yes],[m4_default([$2], [EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS $1"])], [$3])dnl
AS_VAR_POPDEF([ac_var])])
AS_VAR_IF([ac_var],[yes],[m4_default([$2], [AS_VAR_APPEND([${wine_arch}_EXTRACFLAGS],[" $1"])], [$3])])dnl
AS_VAR_POPDEF([ac_var]) }])
dnl **** Check whether the given MinGW header is available ****
dnl
@ -229,7 +226,7 @@ AC_DEFUN([WINE_CHECK_MINGW_HEADER],
AC_CACHE_CHECK([for MinGW $1], ac_var,
[ac_wine_check_headers_saved_cc=$CC
ac_wine_check_headers_saved_exeext=$ac_exeext
CC="$CROSSCC"
AS_VAR_COPY([CC],[${wine_arch}_CC])
ac_exeext=".exe"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$4
#include <$1>]])],[AS_VAR_SET([ac_var],[yes])],[AS_VAR_SET([ac_var],[no])])
@ -248,7 +245,7 @@ AC_CACHE_CHECK([for $2 in MinGW -l$1], ac_var,
[ac_wine_check_headers_saved_cc=$CC
ac_wine_check_headers_saved_exeext=$ac_exeext
ac_wine_check_headers_saved_libs=$LIBS
CC="$CROSSCC"
AS_VAR_COPY([CC],[${wine_arch}_CC])
ac_exeext=".exe"
LIBS="-l$1 $5 $LIBS"
AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],[AS_VAR_SET([ac_var],[yes])],[AS_VAR_SET([ac_var],[no])])
@ -298,31 +295,6 @@ LIBS="$LIBS $2"
AC_CHECK_FUNCS([$1],[$3],[$4])
LIBS="$ac_wine_check_funcs_save_LIBS"])
dnl **** Check for a mingw program, trying the various mingw prefixes ****
dnl
dnl Usage: WINE_CHECK_MINGW_PROG(variable,[value-if-not-found],[path])
dnl
AC_DEFUN([WINE_CHECK_MINGW_PROG],
[case "$host_cpu" in
aarch64*)
ac_prefix_list="aarch64-w64-mingw32-clang aarch64-w64-mingw32-gcc clang" ;;
arm*)
ac_prefix_list="armv7-w64-mingw32-clang armv7-w64-mingw32-gcc clang" ;;
i[[3456789]]86*)
ac_prefix_list="m4_foreach([ac_wine_prefix],[w64-mingw32, pc-mingw32, mingw32msvc, mingw32],
m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-ac_wine_prefix-gcc ]))
m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-w64-mingw32-clang ])
mingw32-gcc clang" ;;
x86_64)
ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32, w64-mingw32, mingw32msvc],
m4_foreach([ac_wine_cpu],[x86_64,amd64],[ac_wine_cpu-ac_wine_prefix-gcc ]))
m4_foreach([ac_wine_cpu],[x86_64,amd64],[ac_wine_cpu-w64-mingw32-clang ]) clang" ;;
*)
ac_prefix_list="" ;;
esac
AC_CHECK_PROGS([$1],[$ac_prefix_list],[$2],[$3])])
dnl **** Define helper functions for creating config.status files ****
dnl
dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS])
@ -333,36 +305,40 @@ AC_SUBST(SUBDIRS,"")
AC_SUBST(DISABLED_SUBDIRS,"")
AC_SUBST(CONFIGURE_TARGETS,"")
wine_fn_append_file ()
{
AS_VAR_APPEND($[1]," \\$as_nl $[2]")
}
wine_fn_append_rule ()
{
AS_VAR_APPEND(wine_rules,"$as_nl$[1]")
}
wine_fn_config_makefile ()
{
wine_fn_append_file SUBDIRS $[1]
AS_VAR_IF([$[2]],[no],[wine_fn_append_file DISABLED_SUBDIRS $[1]])
AS_VAR_APPEND([SUBDIRS],[" \\$as_nl $[1]"])
AS_VAR_COPY([enable],[$[2]])
case "$enable" in
no) AS_VAR_APPEND([DISABLED_SUBDIRS],[" $[1]"]) ;;
*aarch64*|*arm*|*i386*|*x86_64*)
if test -n "$PE_ARCHS"
then
for i in $PE_ARCHS
do
test $(expr ",$enable," : ".*,$i,") -gt 0 || AS_VAR_APPEND([${i}_DISABLED_SUBDIRS],[" $[1]"])
done
else
test $(expr ",$enable," : ".*,$HOST_ARCH,") -gt 0 || AS_VAR_APPEND([DISABLED_SUBDIRS],[" $[1]"])
fi;;
esac
}
wine_fn_config_symlink ()
{
ac_links=$[@]
wine_fn_append_rule \
"$ac_links:
@./config.status \$[@]"
for f in $ac_links; do wine_fn_append_file CONFIGURE_TARGETS $f; done
AS_VAR_APPEND([wine_rules],["
$ac_links:
@./config.status \$[@]"])
for f in $ac_links; do AS_VAR_APPEND([CONFIGURE_TARGETS],[" $f"]); done
}])
dnl **** Define helper function to append a rule to a makefile command list ****
dnl
dnl Usage: WINE_APPEND_RULE(rule)
dnl
AC_DEFUN([WINE_APPEND_RULE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_rule "$1"])
AC_DEFUN([WINE_APPEND_RULE],[AC_REQUIRE([WINE_CONFIG_HELPERS])AS_VAR_APPEND([wine_rules],["
$1"])])
dnl **** Create symlinks from config.status ****
dnl
@ -391,7 +367,7 @@ dnl
dnl Usage: WINE_IGNORE_FILE(file,enable)
dnl
AC_DEFUN([WINE_IGNORE_FILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
m4_ifval([$2],[test "x$[$2]" = xno || ])wine_fn_append_file CONFIGURE_TARGETS $1])
m4_ifval([$2],[test "x$[$2]" = xno || ])AS_VAR_APPEND([CONFIGURE_TARGETS],[" $1"])])
dnl **** Add a message to the list displayed at the end ****
dnl

1685
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@ libwine_version="1.0"
dnl **** Command-line arguments ****
AC_ARG_ENABLE(archs, AS_HELP_STRING([--enable-archs={i386,x86_64,arm,aarch64}],[enable multiple architectures for PE compilation]))
AC_ARG_ENABLE(win16, AS_HELP_STRING([--disable-win16],[do not include Win16 support]))
AC_ARG_ENABLE(win64, AS_HELP_STRING([--enable-win64],[build a Win64 emulator on AMD64 (won't run Win32 binaries)]))
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[do not build the regression tests]))
@ -122,7 +123,7 @@ esac
AC_SUBST(TARGETFLAGS)
case $host in
x86_64*|amd64*)
if test "x$enable_win64" != "xyes" -a "$cross_compiling" != "yes"
if test "x$enable_win64" != "xyes" -a "$cross_compiling" != "yes" -a x"$enable_archs" = x
then
CC="$CC -m32"
CXX="$CXX -m32"
@ -134,7 +135,6 @@ case $host in
TARGETFLAGS="$TARGETFLAGS -m32"
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib32/pkgconfig:/usr/lib/pkgconfig}
export PKG_CONFIG_PATH
enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
else
if test "x${GCC}" = "xyes"
@ -149,9 +149,6 @@ case $host in
host_cpu="x86_64"
notice_platform="64-bit "
TARGETFLAGS="$TARGETFLAGS -m64"
enable_wow64=${enable_wow64:-yes}
enable_wow64win=${enable_wow64win:-yes}
enable_wow64cpu=${enable_wow64cpu:-yes}
fi
;;
arm*)
@ -191,22 +188,16 @@ case $host in
CFLAGS="$CFLAGS -mfloat-abi=$float_abi"
TARGETFLAGS="$TARGETFLAGS -mfloat-abi=$float_abi"
;;
aarch64*)
enable_wow64=${enable_wow64:-yes}
enable_wow64win=${enable_wow64win:-yes}
;;
i[[3456789]]86*)
enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
;;
esac
dnl enable_win16 defaults to yes on x86, to no on other CPUs
enable_win16=${enable_win16:-no}
enable_win16=${enable_win16:-i386}
enable_win64=${enable_win64:-no}
enable_wow64=${enable_wow64:-no}
enable_wow64win=${enable_wow64win:-no}
enable_wow64cpu=${enable_wow64cpu:-no}
enable_wow64=${enable_wow64:-aarch64,x86_64}
enable_wow64win=${enable_wow64win:-aarch64,x86_64}
enable_wow64cpu=${enable_wow64cpu:-x86_64}
dnl Disable winetest too if tests are disabled
enable_winetest=${enable_winetest:-$enable_tests}
@ -223,6 +214,16 @@ case $build_os in
*) AC_SUBST(toolsext,"") ;;
esac
HOST_ARCH=unknown
case "$host_cpu" in
aarch64*) HOST_ARCH=aarch64 ;;
arm*) HOST_ARCH=arm ;;
i[[3456789]]86*) HOST_ARCH=i386 ;;
x86_64) HOST_ARCH=x86_64 ;;
esac
m4_set_add_all([_AC_SUBST_VARS],[HOST_ARCH]m4_foreach([cpu],[aarch64,arm,i386,x86_64],
[m4_foreach([var],[CC,CFLAGS,EXTRACFLAGS,LDFLAGS,DEBUG,TARGET,DELAYLOADFLAG,DISABLED_SUBDIRS],[,cpu[_]var])]))
AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir,
[wine_cv_toolsdir="$with_wine_tools"
if test -z "$with_wine_tools"; then
@ -661,7 +662,7 @@ WINE_PATH_SONAME_TOOLS
WINE_CONFIG_HELPERS
wine_binary="wine"
test "x$enable_win64" != "xyes" || wine_binary="wine64"
test "$HOST_ARCH" != x86_64 || wine_binary="wine64"
AC_SUBST(WINELOADER_PROGRAMS,"$wine_binary")
libwine_soversion=`expr $libwine_version : '\([[0-9]]*\)\..*'`
@ -713,7 +714,7 @@ case $host_os in
then
WINE_TRY_CFLAGS([-Wl,-no_pie],
[WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"])
test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader)
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
else
WINE_WARNING([can't build Wine preloader; many programs won't work])
@ -868,159 +869,204 @@ enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no}
enable_wineandroid_drv=${enable_wineandroid_drv:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
dnl Check for cross compiler to build test programs
AC_SUBST(CROSSTARGET)
if test "x$with_mingw" != xno
then
case "x$with_mingw" in
x|xyes) WINE_CHECK_MINGW_PROG(CROSSCC,false) ;;
*) CROSSCC=$with_mingw ;;
esac
if test "$CROSSCC" != "false"
then
ac_save_CC="$CC"
saved_CFLAGS=$CFLAGS
saved_LDFLAGS=$LDFLAGS
AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-"-g -O2"})
AC_SUBST(EXTRACROSSCFLAGS,"-D__WINE_PE_BUILD -Wall")
AC_SUBST(CROSSLDFLAGS)
dnl Check for cross compiler(s)
AC_SUBST(PE_ARCHS,"")
cross_archs=
AS_VAR_SET_IF([enable_archs],
[test "x$with_system_dllpath" = "x" || AC_MSG_ERROR("The --with-system-dllpath option is not compatible with --enable-archs")
ac_save_IFS=$IFS
IFS=' ,'
set x $enable_archs
IFS=$ac_save_IFS
shift
for arch
do
case $arch in
i386|x86_64|arm|aarch64) cross_archs="$cross_archs $arch" ;;
*) AC_MSG_ERROR([Unknown cross-compilation architecture '$arch']) ;;
esac
done],
[if test "x$with_mingw" != xno
then
test $HOST_ARCH = unknown || cross_archs=$HOST_ARCH
case "x$with_mingw" in
x|xyes) ;;
*) AS_VAR_SET(${cross_archs}_CC,$with_mingw) ;;
esac
fi])
CC="$CROSSCC"
CFLAGS=$CROSSCFLAGS
LDFLAGS=$CROSSLDFLAGS
AC_CACHE_CHECK([whether $CROSSCC works], wine_cv_crosscc,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],[wine_cv_crosscc=yes],[wine_cv_crosscc=no])])
if test $wine_cv_crosscc = yes
then
set x $CROSSCC
for wine_arch in $cross_archs
do
AS_VAR_IF([${wine_arch}_CC],[],
[case $wine_arch in
aarch64)
AC_CHECK_PROGS(aarch64_CC,[aarch64-w64-mingw32-clang aarch64-w64-mingw32-gcc clang],[false])
;;
arm)
AC_CHECK_PROGS(arm_CC,[armv7-w64-mingw32-clang armv7-w64-mingw32-gcc clang],[false])
;;
i386)
ac_prefix_list="m4_foreach([cc],[gcc,clang],m4_foreach([cpu],[i686,i586,i486,i386],[cpu-w64-mingw32-cc ]))"
AC_CHECK_PROGS(i386_CC,[$ac_prefix_list clang],[false])
;;
x86_64)
ac_prefix_list="m4_foreach([cc],[gcc,clang],m4_foreach([cpu],[x86_64,amd64],[cpu-w64-mingw32-cc ]))"
AC_CHECK_PROGS(x86_64_CC,[$ac_prefix_list clang],[false])
;;
esac])
AS_VAR_IF([${wine_arch}_CC],[false],[continue])
saved_CC=$CC
saved_CFLAGS=$CFLAGS
CFLAGS=${CROSSCFLAGS:-"-g -O2"}
AS_VAR_COPY([CC],[${wine_arch}_CC])
AS_VAR_COPY([${wine_arch}_CFLAGS],[CFLAGS])
AS_VAR_COPY([${wine_arch}_LDFLAGS],[LDFLAGS])
AS_VAR_SET([${wine_arch}_EXTRACFLAGS],["-D__WINE_PE_BUILD -Wall"])
target=""
AS_VAR_PUSHDEF([wine_cv_crosscc],[ac_cv_${wine_arch}_crosscc])
AC_CACHE_CHECK([whether $CC works],[wine_cv_crosscc],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AS_VAR_SET([wine_cv_crosscc],[yes])],[AS_VAR_SET([wine_cv_crosscc],[no])])])
AS_VAR_IF([wine_cv_crosscc],[yes],
[set x $CC
shift
while test $# -ge 1
do
case "$1" in
*-gcc) target=`expr "$1" : '\(.*\)-gcc'` ;;
*-clang) target=`expr "$1" : '\(.*\)-clang'` ;;
esac
shift
while test $# -ge 1
do
case "$1" in
*-gcc) CROSSTARGET=`expr "$1" : '\(.*\)-gcc'` ;;
*-clang) CROSSTARGET=`expr "$1" : '\(.*\)-clang'` ;;
esac
shift
done
dnl Check if cross compiler supports -target argument
llvm_target=$CROSSTARGET
llvm_cflags="-fuse-ld=lld"
if test -z "$llvm_target"
then
case $host_cpu in
*i[[3456789]]86*) llvm_target=i686-windows ;;
*) llvm_target=$host_cpu-windows ;;
esac
fi
case $llvm_target in
*windows) llvm_cflags="$llvm_cflags -Wl,-subsystem:console" ;;
esac
WINE_TRY_CROSSCFLAGS([-target $llvm_target $llvm_cflags],
[CROSSTARGET=$llvm_target
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -target $CROSSTARGET"
AC_SUBST(DELAYLOADFLAG,["-Wl,-delayload,"])
CFLAGS="$CFLAGS $llvm_cflags"])
fi
AC_MSG_CHECKING([for $CROSSCC option to enable C99 features])
AC_CACHE_VAL([wine_cv_crosscc_c99],
[wine_cv_crosscc_c99=no
for arg in '' '-std=gnu99'
do
CC="$CROSSCC $arg"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$ac_c_conftest_c99_program])],
[wine_cv_crosscc_c99=$arg],[wine_cv_crosscc_c99=no])
test "x$wine_cv_crosscc_c99" != xno && break
done])
case "x$wine_cv_crosscc_c99" in
x) AC_MSG_RESULT([none needed]) ;;
xno) AC_MSG_RESULT([unsupported]) ;;
x*) AC_MSG_RESULT([$wine_cv_crosscc_c99])
CROSSCC="$CROSSCC $wine_cv_crosscc_c99" ;;
esac
WINE_TRY_CROSSCFLAGS([-fno-strict-aliasing])
dnl clang needs to be told to fail on unknown options
WINE_TRY_CROSSCFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"])
WINE_TRY_CROSSCFLAGS([-Werror=ignored-optimization-argument],[CFLAGS="$CFLAGS -Werror=ignored-optimization-argument"])
WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CROSSCFLAGS([-Wempty-body])
WINE_TRY_CROSSCFLAGS([-Wignored-qualifiers])
WINE_TRY_CROSSCFLAGS([-Winit-self])
WINE_TRY_CROSSCFLAGS([-Wpacked-not-aligned],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-packed-not-aligned"])
WINE_TRY_CROSSCFLAGS([-Wpragma-pack],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-pragma-pack"])
WINE_TRY_CROSSCFLAGS([-Wshift-overflow=2])
WINE_TRY_CROSSCFLAGS([-Wstrict-prototypes])
WINE_TRY_CROSSCFLAGS([-Wtype-limits])
WINE_TRY_CROSSCFLAGS([-Wunused-but-set-parameter])
WINE_TRY_CROSSCFLAGS([-Wvla])
WINE_TRY_CROSSCFLAGS([-Wwrite-strings])
WINE_TRY_CROSSCFLAGS([-Wpointer-arith])
WINE_TRY_CROSSCFLAGS([-Wlogical-op])
WINE_TRY_CROSSCFLAGS([-Wabsolute-value])
case $host_cpu in
*i[[3456789]]86*) WINE_TRY_CROSSCFLAGS([-fno-omit-frame-pointer])
WINE_TRY_CROSSCFLAGS([-Wl,--disable-stdcall-fixup],[CROSSLDFLAGS="$CROSSLDFLAGS -Wl,--disable-stdcall-fixup"]) ;;
x86_64) WINE_TRY_CROSSCFLAGS([-Wno-format])
WINE_TRY_CROSSCFLAGS([-Wformat-overflow])
WINE_TRY_CROSSCFLAGS([-Wnonnull])
WINE_TRY_CROSSCFLAGS([-mcx16]) ;;
aarch64) WINE_TRY_CROSSCFLAGS([-Wno-format]) ;;
esac
dnl Determine debug info format
AC_SUBST(CROSSDEBUG)
if test -z "$CROSSDEBUG"
then
for ac_flag in $CROSSCFLAGS; do
case $ac_flag in
-gdwarf*) CROSSDEBUG=dwarf ;;
-gcodeview) CROSSDEBUG=pdb ;;
-g) CROSSDEBUG=${CROSSDEBUG:-dwarf} ;;
esac
done
fi
ac_debug_format_seen=""
for ac_flag in $CROSSCFLAGS; do
case $ac_flag in
-gdwarf*|-gcodeview) ac_debug_format_seen=$ac_flag ;;
esac
done
if test "x$ac_debug_format_seen" = x
then
case $CROSSDEBUG in
*dwarf) WINE_TRY_CROSSCFLAGS([-gdwarf-4]) ;;
pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;;
esac
fi
if test "x$enable_werror" = "xyes"
dnl Check if cross compiler supports -target argument
llvm_target=$target
llvm_cflags="-fuse-ld=lld"
if test -z "$llvm_target"
then
WINE_TRY_CROSSCFLAGS([-Werror])
fi
if test "x$enable_build_id" = "xyes"
then
WINE_TRY_CROSSCFLAGS([-Wl,--build-id], [CROSSCFLAGS="$CROSSCFLAGS -Wl,--build-id"
CROSSLDFLAGS="$CROSSLDFLAGS -Wl,--build-id"])
case $wine_arch in
i386) llvm_target=i686-windows ;;
arm) llvm_target=armv7-windows ;;
*) llvm_target=$wine_arch-windows ;;
esac
fi
case $llvm_target in
*windows) llvm_cflags="$llvm_cflags -Wl,-subsystem:console" ;;
esac
WINE_TRY_PE_CFLAGS([-target $llvm_target $llvm_cflags],
[target=$llvm_target
AS_VAR_SET([${wine_arch}_DELAYLOADFLAG],["-Wl,-delayload,"])
AS_VAR_APPEND([${wine_arch}_EXTRACFLAGS],[" -target $target"])
CFLAGS="$CFLAGS -target $target $llvm_cflags"])
AS_VAR_SET([${wine_arch}_TARGET],[$target])
PE_ARCHS="$PE_ARCHS $wine_arch"])
AS_VAR_POPDEF([wine_cv_crosscc])
CFLAGS=$saved_CFLAGS
LDFLAGS=$saved_LDFLAGS
CC="$ac_save_CC"
AS_VAR_PUSHDEF([wine_cv_crosscc_c99],[ac_cv_${wine_arch}_crosscc_c99])
AC_MSG_CHECKING([for $CC option to enable C99 features])
AC_CACHE_VAL([wine_cv_crosscc_c99],
[AS_VAR_SET([wine_cv_crosscc_c99],[no])
for arg in '' '-std=gnu99'
do
test -z "$arg" || CC="$CC $arg"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$ac_c_conftest_c99_program])],
[AS_VAR_SET([wine_cv_crosscc_c99],[$arg])],
[AS_VAR_SET([wine_cv_crosscc_c99],[no])])
AS_VAR_COPY([CC],[${wine_arch}_CC])
AS_VAR_IF([wine_cv_crosscc_c99],[no],[],[break])
done])
AS_VAR_COPY([res],[wine_cv_crosscc_c99])
case "x$res" in
x) AC_MSG_RESULT([none needed]) ;;
xno) AC_MSG_RESULT([unsupported]) ;;
x*) AC_MSG_RESULT([$res])
AS_VAR_APPEND([${wine_arch}_CC],[" $res"]) ;;
esac
AS_VAR_POPDEF([wine_cv_crosscc_c99])
WINE_TRY_PE_CFLAGS([-fno-strict-aliasing])
dnl clang needs to be told to fail on unknown options
WINE_TRY_PE_CFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"])
WINE_TRY_PE_CFLAGS([-Werror=ignored-optimization-argument],[CFLAGS="$CFLAGS -Werror=ignored-optimization-argument"])
WINE_TRY_PE_CFLAGS([-Wdeclaration-after-statement])
WINE_TRY_PE_CFLAGS([-Wempty-body])
WINE_TRY_PE_CFLAGS([-Wignored-qualifiers])
WINE_TRY_PE_CFLAGS([-Winit-self])
WINE_TRY_PE_CFLAGS([-Wpacked-not-aligned],[AS_VAR_APPEND(${wine_arch}_EXTRACFLAGS,[" -Wno-packed-not-aligned"])])
WINE_TRY_PE_CFLAGS([-Wpragma-pack],[AS_VAR_APPEND(${wine_arch}_EXTRACFLAGS,[" -Wno-pragma-pack"])])
WINE_TRY_PE_CFLAGS([-Wshift-overflow=2])
WINE_TRY_PE_CFLAGS([-Wstrict-prototypes])
WINE_TRY_PE_CFLAGS([-Wtype-limits])
WINE_TRY_PE_CFLAGS([-Wunused-but-set-parameter])
WINE_TRY_PE_CFLAGS([-Wvla])
WINE_TRY_PE_CFLAGS([-Wwrite-strings])
WINE_TRY_PE_CFLAGS([-Wpointer-arith])
WINE_TRY_PE_CFLAGS([-Wlogical-op])
WINE_TRY_PE_CFLAGS([-Wabsolute-value])
case $wine_arch in
i386) WINE_TRY_PE_CFLAGS([-fno-omit-frame-pointer])
WINE_TRY_PE_CFLAGS([-Wl,--disable-stdcall-fixup],
[AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,--disable-stdcall-fixup"])]) ;;
x86_64) WINE_TRY_PE_CFLAGS([-Wno-format])
WINE_TRY_PE_CFLAGS([-Wformat-overflow])
WINE_TRY_PE_CFLAGS([-Wnonnull])
WINE_TRY_PE_CFLAGS([-mcx16]) ;;
aarch64) WINE_TRY_PE_CFLAGS([-Wno-format]) ;;
esac
dnl Determine debug info format
wine_crossdebug=$CROSSDEBUG
if test -z "$wine_crossdebug"
then
for ac_flag in $CFLAGS; do
case $ac_flag in
-gdwarf*) wine_crossdebug=dwarf ;;
-gcodeview) wine_crossdebug=pdb ;;
-g) wine_crossdebug=${wine_crossdebug:-dwarf} ;;
esac
done
fi
fi
WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"],
[MinGW compiler not found, cross-compiling PE files won't be supported.])
case $host_cpu in
aarch64*) test "x$CROSSTARGET" != x || AC_MSG_ERROR([PE cross-compilation is required for ARM64, please install clang/llvm-dlltool/lld, or llvm-mingw.]) ;;
esac
ac_debug_format_seen=""
for ac_flag in $CFLAGS; do
case $ac_flag in
-gdwarf*|-gcodeview) ac_debug_format_seen=$ac_flag ;;
esac
done
if test "x$ac_debug_format_seen" = x
then
case $wine_crossdebug in
*dwarf) WINE_TRY_PE_CFLAGS([-gdwarf-4]) ;;
pdb) WINE_TRY_PE_CFLAGS([-gcodeview]) ;;
esac
fi
AS_VAR_SET([${wine_arch}_DEBUG],[$wine_crossdebug])
test "x$enable_werror" != xyes || WINE_TRY_PE_CFLAGS([-Werror])
test "x$enable_build_id" != xyes || WINE_TRY_PE_CFLAGS([-Wl,--build-id],
[AS_VAR_APPEND([${wine_arch}_CFLAGS],[" -Wl,--build-id"])
AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,--build-id"])])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
done
if test $HOST_ARCH = aarch64 -a "x$PE_ARCHS" = x
then
AC_MSG_ERROR([PE cross-compilation is required for ARM64, please install clang/llvm-dlltool/lld, or llvm-mingw.])
fi
WINE_NOTICE_WITH(mingw,[test "x$PE_ARCHS" = "x"],
[MinGW compiler not found, cross-compiling PE files won't be supported.])
dnl **** External libraries ****
if test "x$with_system_dllpath" != "x" -a "$CROSSCC" != "false"
if test "x$with_system_dllpath" != "x" -a -n "$PE_ARCHS"
then
WINE_MINGW_PACKAGE_FLAGS(FAUDIO,[FAudio],[-lFAudio],
[WINE_CHECK_MINGW_HEADER(FAudio.h,
@ -1921,7 +1967,7 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=
dnl Mingw uses Windows 64-bit types, not Unix ones
cygwin*|mingw32*) WINE_TRY_CFLAGS([-Wno-format]) ;;
dnl Default to ms_abi on 64-bit
*) if test -z "$CROSSTARGET"
*) if test -z "$PE_ARCHS"
then
AC_CACHE_CHECK([for working -mabi=ms], ac_cv_mabi_ms,
[CFLAGS="$CFLAGS -mabi=ms"
@ -1974,11 +2020,9 @@ then
DLLFLAGS="$DLLFLAGS -fasynchronous-unwind-tables"
LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
UNIXDLLFLAGS="$UNIXDLLFLAGS -fasynchronous-unwind-tables"
else
if test "x$enable_win64" = "xyes"
then
WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.])
fi
elif test $HOST_ARCH = x86_64
then
WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.])
fi
dnl **** Platform-specific checks ****
@ -1987,7 +2031,7 @@ case $host_os in
linux*)
case $host_cpu in
*i[[3456789]]86*|x86_64*|*aarch64*|arm*)
test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader)
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
;;
esac
@ -2371,7 +2415,7 @@ wine_srcdir=
test "$srcdir" = . || wine_srcdir="$srcdir/"
WINE_CONFIG_SYMLINK(wine,tools/winewrapper)
WINE_CONFIG_SYMLINK(wine64,tools/winewrapper,["x$enable_win64" != xno -o -n "$with_wine64"])
WINE_CONFIG_SYMLINK(wine64,tools/winewrapper,["$HOST_ARCH" = x86_64 -o -n "$with_wine64"])
WINE_CONFIG_MAKEFILE(dlls/acledit)
WINE_CONFIG_MAKEFILE(dlls/aclui)
@ -3449,18 +3493,18 @@ dnl End of auto-generated output commands
dnl Main ignore file
WINE_IGNORE_FILE("TAGS")
WINE_IGNORE_FILE("tags")
WINE_IGNORE_FILE("autom4te.cache")
WINE_IGNORE_FILE("config.log")
WINE_IGNORE_FILE("config.status")
WINE_IGNORE_FILE("include/config.h")
WINE_IGNORE_FILE("include/stamp-h")
test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine")
WINE_IGNORE_FILE(TAGS)
WINE_IGNORE_FILE(tags)
WINE_IGNORE_FILE(autom4te.cache)
WINE_IGNORE_FILE(config.log)
WINE_IGNORE_FILE(config.status)
WINE_IGNORE_FILE(include/config.h)
WINE_IGNORE_FILE(include/stamp-h)
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine)
if test "x$enable_tools" != xno
then
WINE_IGNORE_FILE("tools/makedep$ac_exeext")
WINE_IGNORE_FILE(tools/makedep$ac_exeext)
AC_CONFIG_COMMANDS([tools/makedep],[wine_fn_output_makedep || AS_EXIT],
[wine_fn_output_makedep ()
{

View file

@ -6,8 +6,9 @@ IMPORTS = winecrt0
UNIX_CFLAGS = $(UNWIND_CFLAGS)
UNIX_LIBS = $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) $(PROCSTAT_LIBS)
EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
x86_64_EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x170000000
EXTRADLLFLAGS = -nodefaultlibs
i386_EXTRADLLFLAGS = -Wl,--image-base,0x7bc00000
x86_64_EXTRADLLFLAGS = -Wl,--image-base,0x170000000
C_SRCS = \
actctx.c \

View file

@ -126,7 +126,7 @@ enum install_rules { INSTALL_LIB, INSTALL_DEV, INSTALL_TEST, NB_INSTALL_RULES };
static const char *install_targets[NB_INSTALL_RULES] = { "install-lib", "install-dev", "install-test" };
static const char *install_variables[NB_INSTALL_RULES] = { "INSTALL_LIB", "INSTALL_DEV", "INSTALL_TEST" };
#define MAX_ARCHS 2
#define MAX_ARCHS 5
/* variables common to all makefiles */
static struct strarray archs;
@ -140,7 +140,6 @@ static struct strarray libs;
static struct strarray enable_tests;
static struct strarray cmdline_vars;
static struct strarray subdirs;
static struct strarray disabled_dirs;
static struct strarray delay_import_libs;
static struct strarray top_install[NB_INSTALL_RULES];
static const char *root_src_dir;
@ -148,7 +147,6 @@ static const char *tools_dir;
static const char *tools_ext;
static const char *exe_ext;
static const char *dll_ext;
static const char *host_cpu;
static const char *fontforge;
static const char *convert;
static const char *flex;
@ -170,6 +168,7 @@ static const char *delay_load_flags[MAX_ARCHS];
static struct strarray target_flags[MAX_ARCHS];
static struct strarray extra_cflags[MAX_ARCHS];
static struct strarray extra_cflags_extlib[MAX_ARCHS];
static struct strarray disabled_dirs[MAX_ARCHS];
struct makefile
{
@ -202,7 +201,6 @@ struct makefile
int native_unix_lib;
int use_msvcrt;
int data_only;
int is_cross;
int is_win16;
int is_exe;
int disabled[MAX_ARCHS];
@ -383,30 +381,6 @@ static void strarray_set_value( struct strarray *array, const char *name, const
}
/*******************************************************************
* normalize_arch
*/
static const char *normalize_arch( const char *arch )
{
unsigned int i, j;
static const char *map[][8] =
{
/* normalized aliases */
{ "i386", "i486", "i586", "i686", "ia32" },
{ "x86_64", "amd64", "x86-64", "x86_amd64", "x64" },
{ "aarch64", "arm64" },
{ "arm" },
};
for (i = 0; i < ARRAY_SIZE(map); i++)
for (j = 0; map[i][j]; j++)
if (!strncmp( arch, map[i][j], strlen(map[i][j]) ))
return map[i][0];
return NULL;
}
/*******************************************************************
* output_filename
*/
@ -639,7 +613,7 @@ static char *arch_module_name( const char *module, unsigned int arch )
*/
static char *arch_make_variable( const char *name, unsigned int arch )
{
return arch ? strmake( "$(CROSS%s)", name ) : strmake( "$(%s)", name );
return arch ? strmake( "$(%s_%s)", archs.str[arch], name ) : strmake( "$(%s)", name );
}
@ -1752,6 +1726,24 @@ static struct strarray get_expanded_file_local_var( const struct makefile *make,
}
/*******************************************************************
* get_expanded_arch_var
*/
static char *get_expanded_arch_var( const struct makefile *make, const char *name, int arch )
{
return get_expanded_make_variable( make, arch ? strmake( "%s_%s", archs.str[arch], name ) : name );
}
/*******************************************************************
* get_expanded_arch_var_array
*/
static struct strarray get_expanded_arch_var_array( const struct makefile *make, const char *name, int arch )
{
return get_expanded_make_var_array( make, arch ? strmake( "%s_%s", archs.str[arch], name ) : name );
}
/*******************************************************************
* set_make_variable
*/
@ -3066,51 +3058,56 @@ static void output_source_spec( struct makefile *make, struct incl_file *source,
{
struct strarray imports = get_expanded_file_local_var( make, obj, "IMPORTS" );
struct strarray dll_flags = empty_strarray;
struct strarray all_libs = empty_strarray, dep_libs = empty_strarray;
struct strarray default_imports = empty_strarray;
struct strarray all_libs, dep_libs;
const char *dll_name, *obj_name, *res_name, *output_file, *debug_file;
unsigned int arch = make->is_cross ? 1 : 0;
unsigned int arch;
if (!imports.count) imports = make->imports;
strarray_addall( &dll_flags, make->extradllflags );
strarray_addall( &dll_flags, get_expanded_file_local_var( make, obj, "EXTRADLLFLAGS" ));
if (!strarray_exists( &dll_flags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports );
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, arch ) );
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, arch ) );
for (arch = 0; arch < archs.count; arch++)
{
if (!is_multiarch( arch )) continue;
all_libs = dep_libs = empty_strarray;
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, arch ) );
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, arch ) );
dll_name = arch_module_name( strmake( "%s.dll", obj ), arch );
obj_name = obj_dir_path( make, strmake( "%s%s.o", arch_dirs[arch], obj ));
res_name = strmake( "%s%s.res", arch_dirs[arch], obj );
output_file = obj_dir_path( make, dll_name );
dll_name = arch_module_name( strmake( "%s.dll", obj ), arch );
obj_name = obj_dir_path( make, strmake( "%s%s.o", arch_dirs[arch], obj ));
res_name = strmake( "%s%s.res", arch_dirs[arch], obj );
output_file = obj_dir_path( make, dll_name );
strarray_add( &make->clean_files, dll_name );
strarray_add( &make->res_files[arch], res_name );
output( "%s:", obj_dir_path( make, res_name ));
output_filename( output_file );
output_filename( tools_path( make, "wrc" ));
output( "\n" );
output( "\t%secho \"%s.dll TESTDLL \\\"%s\\\"\" | %s -u -o $@\n", cmd_prefix( "WRC" ), obj, output_file,
tools_path( make, "wrc" ));
strarray_add( &make->clean_files, dll_name );
strarray_add( &make->res_files[arch], res_name );
output( "%s:", obj_dir_path( make, res_name ));
output_filename( output_file );
output_filename( tools_path( make, "wrc" ));
output( "\n" );
output( "\t%secho \"%s.dll TESTDLL \\\"%s\\\"\" | %s -u -o $@\n", cmd_prefix( "WRC" ), obj, output_file,
tools_path( make, "wrc" ));
output( "%s:", output_file );
output_filename( source->filename );
output_filename( obj_name );
output_filenames( dep_libs );
output_filename( tools_path( make, "winebuild" ));
output_filename( tools_path( make, "winegcc" ));
output( "\n" );
output_winegcc_command( make, arch );
output_filename( "-s" );
output_filenames( dll_flags );
output_filename( "-shared" );
output_filename( source->filename );
output_filename( obj_name );
if ((debug_file = get_debug_file( make, dll_name, arch )))
output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file )));
output_filenames( all_libs );
output_filename( arch_make_variable( "LDFLAGS", arch ));
output( "\n" );
output( "%s:", output_file );
output_filename( source->filename );
output_filename( obj_name );
output_filenames( dep_libs );
output_filename( tools_path( make, "winebuild" ));
output_filename( tools_path( make, "winegcc" ));
output( "\n" );
output_winegcc_command( make, arch );
output_filename( "-s" );
output_filenames( dll_flags );
if (arch) output_filenames( get_expanded_arch_var_array( make, "EXTRADLLFLAGS", arch ));
output_filename( "-shared" );
output_filename( source->filename );
output_filename( obj_name );
if ((debug_file = get_debug_file( make, dll_name, arch )))
output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file )));
output_filenames( all_libs );
output_filename( arch_make_variable( "LDFLAGS", arch ));
output( "\n" );
}
}
@ -3321,7 +3318,7 @@ static void output_module( struct makefile *make, unsigned int arch )
strarray_add( &make->all_targets[arch], module_name );
if (make->data_only)
add_install_rule( make, make->module, arch, module_name,
strmake( "d%s%s", arch_install_dirs[arch], make->module ));
strmake( "d$(dlldir)/%s%s", arch_pe_dirs[arch], make->module ));
else
add_install_rule( make, make->module, arch, module_name,
strmake( "%c%s%s%s", '0' + arch, arch_install_dirs[arch], make->module,
@ -3343,6 +3340,7 @@ static void output_module( struct makefile *make, unsigned int arch )
output_filename( spec_file );
}
output_filenames( make->extradllflags );
if (arch) output_filenames( get_expanded_arch_var_array( make, "EXTRADLLFLAGS", arch ));
output_filenames_obj_dir( make, make->object_files[arch] );
output_filenames_obj_dir( make, make->res_files[arch] );
debug_file = get_debug_file( make, module_name, arch );
@ -3350,12 +3348,6 @@ static void output_module( struct makefile *make, unsigned int arch )
output_filenames( all_libs );
output_filename( arch_make_variable( "LDFLAGS", arch ));
output( "\n" );
if (*dll_ext && make->is_exe && !make->is_win16 && strendswith( make->module, ".exe" ))
{
char *binary = replace_extension( make->module, ".exe", "" );
add_install_rule( make, binary, arch, "wineapploader", strmake( "t$(bindir)/%s", binary ));
}
}
@ -3797,8 +3789,7 @@ static void output_sources( struct makefile *make )
{
struct strarray all_targets = empty_strarray;
struct incl_file *source;
unsigned int i, j;
unsigned int arch = make->is_cross ? 1 : 0;
unsigned int i, j, arch;
strarray_add_uniq( &make->phony_targets, "all" );
@ -3820,14 +3811,18 @@ static void output_sources( struct makefile *make )
/* special case for winetest: add resource files from other test dirs */
if (make->obj_dir && !strcmp( make->obj_dir, "programs/winetest" ))
{
for (i = 0; i < subdirs.count; i++)
for (arch = 0; arch < archs.count; arch++)
{
if (!submakes[i]->testdll) continue;
if (submakes[i]->disabled[arch]) continue;
if (enable_tests.count && !strarray_exists( &enable_tests, submakes[i]->testdll )) continue;
strarray_add( &make->res_files[arch],
strmake( "%s%s", arch_dirs[arch],
replace_extension( submakes[i]->testdll, ".dll", "_test.res" )));
if (!is_multiarch( arch )) continue;
for (i = 0; i < subdirs.count; i++)
{
if (!submakes[i]->testdll) continue;
if (submakes[i]->disabled[arch]) continue;
if (enable_tests.count && !strarray_exists( &enable_tests, submakes[i]->testdll )) continue;
strarray_add( &make->res_files[arch],
strmake( "%s%s", arch_dirs[arch],
replace_extension( submakes[i]->testdll, ".dll", "_test.res" )));
}
}
}
@ -3842,21 +3837,29 @@ static void output_sources( struct makefile *make )
if (make->staticlib)
{
if (!arch || !make->extlib) output_static_lib( make, 0 );
if (arch) output_static_lib( make, arch );
for (arch = 0; arch < archs.count; arch++)
if (is_multiarch( arch ) || !make->extlib) output_static_lib( make, arch );
}
else if (make->module)
{
output_module( make, arch );
if (*dll_ext && !arch && !make->data_only) output_fake_module( make, archs.count - 1 );
if (make->unixlib) output_unix_lib( make );
if (make->importlib)
for (arch = 0; arch < archs.count; arch++)
{
output_import_lib( make, 0 );
if (archs.count > 1) output_import_lib( make, 1 );
if (!is_multiarch( arch ) == !make->use_msvcrt) output_module( make, arch );
else if (is_multiarch( arch ) && *dll_ext) output_fake_module( make, arch );
}
if (make->unixlib) output_unix_lib( make );
if (make->importlib) for (arch = 0; arch < archs.count; arch++) output_import_lib( make, arch );
if (make->is_exe && !make->is_win16 && *dll_ext && strendswith( make->module, ".exe" ))
{
char *binary = replace_extension( make->module, ".exe", "" );
add_install_rule( make, binary, 0, "wineapploader", strmake( "t$(bindir)/%s", binary ));
}
}
else if (make->testdll) output_test_module( make, arch );
else if (make->testdll)
{
for (arch = 0; arch < archs.count; arch++)
if (is_multiarch( arch )) output_test_module( make, arch );
}
else if (make->sharedlib) output_shared_lib( make );
else if (make->programs.count) output_programs( make );
@ -4277,17 +4280,11 @@ static void load_sources( struct makefile *make )
if (make->extlib) make->staticlib = make->extlib;
if (make->staticlib) make->module = make->staticlib;
if (host_cpu)
{
value = get_expanded_file_local_var( make, host_cpu, "EXTRADLLFLAGS" );
if (value.count) make->extradllflags = value;
}
if (make->obj_dir)
{
make->disabled[0] = strarray_exists( &disabled_dirs, make->obj_dir );
make->disabled[0] = strarray_exists( &disabled_dirs[0], make->obj_dir );
for (arch = 1; arch < archs.count; arch++)
make->disabled[arch] = make->disabled[0];
make->disabled[arch] = make->disabled[0] || strarray_exists( &disabled_dirs[arch], make->obj_dir );
}
make->is_win16 = strarray_exists( &make->extradllflags, "-m16" );
make->data_only = strarray_exists( &make->extradllflags, "-Wb,--data-only" );
@ -4361,11 +4358,8 @@ static void load_sources( struct makefile *make )
LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 );
LIST_FOR_EACH_ENTRY( file, &make->sources, struct incl_file, entry ) get_dependencies( file, file );
make->is_cross = archs.count > 1 && make->use_msvcrt;
if (!*dll_ext || make->is_cross)
for (i = 0; i < make->delayimports.count; i++)
strarray_add_uniq( &delay_import_libs, get_base_name( make->delayimports.str[i] ));
for (i = 0; i < make->delayimports.count; i++)
strarray_add_uniq( &delay_import_libs, get_base_name( make->delayimports.str[i] ));
}
@ -4427,7 +4421,7 @@ static int parse_option( const char *opt )
int main( int argc, char *argv[] )
{
const char *makeflags = getenv( "MAKEFLAGS" );
const char *crosstarget, *debug_flag, *delay_load_flag;
const char *target;
unsigned int i, j, arch;
if (makeflags) parse_makeflags( makeflags );
@ -4474,8 +4468,6 @@ int main( int argc, char *argv[] )
target_flags[0] = get_expanded_make_var_array( top_makefile, "TARGETFLAGS" );
msvcrt_flags = get_expanded_make_var_array( top_makefile, "MSVCRTFLAGS" );
dll_flags = get_expanded_make_var_array( top_makefile, "DLLFLAGS" );
extra_cflags[0] = get_expanded_make_var_array( top_makefile, "EXTRACFLAGS" );
extra_cflags[1] = get_expanded_make_var_array( top_makefile, "EXTRACROSSCFLAGS" );
unix_dllflags = get_expanded_make_var_array( top_makefile, "UNIXDLLFLAGS" );
cpp_flags = get_expanded_make_var_array( top_makefile, "CPPFLAGS" );
lddll_flags = get_expanded_make_var_array( top_makefile, "LDDLLFLAGS" );
@ -4484,15 +4476,11 @@ int main( int argc, char *argv[] )
for (i = 0; i < NB_INSTALL_RULES; i++)
top_install[i] = get_expanded_make_var_array( top_makefile, strmake( "TOP_%s", install_variables[i] ));
delay_load_flag = get_expanded_make_variable( top_makefile, "DELAYLOADFLAG" );
root_src_dir = get_expanded_make_variable( top_makefile, "srcdir" );
tools_dir = get_expanded_make_variable( top_makefile, "toolsdir" );
tools_ext = get_expanded_make_variable( top_makefile, "toolsext" );
exe_ext = get_expanded_make_variable( top_makefile, "EXEEXT" );
dll_ext = (exe_ext && !strcmp( exe_ext, ".exe" )) ? "" : ".so";
host_cpu = get_expanded_make_variable( top_makefile, "host_cpu" );
crosstarget = get_expanded_make_variable( top_makefile, "CROSSTARGET" );
debug_flag = get_expanded_make_variable( top_makefile, "CROSSDEBUG" );
fontforge = get_expanded_make_variable( top_makefile, "FONTFORGE" );
convert = get_expanded_make_variable( top_makefile, "CONVERT" );
flex = get_expanded_make_variable( top_makefile, "FLEX" );
@ -4509,36 +4497,34 @@ int main( int argc, char *argv[] )
if (tools_dir && !strcmp( tools_dir, "." )) tools_dir = NULL;
if (!exe_ext) exe_ext = "";
if (!tools_ext) tools_ext = "";
if (!host_cpu || !(host_cpu = normalize_arch( host_cpu ))) host_cpu = "unknown";
strarray_add( &archs, host_cpu );
strarray_add( &archs, get_expanded_make_variable( top_makefile, "HOST_ARCH" ));
strarray_addall( &archs, get_expanded_make_var_array( top_makefile, "PE_ARCHS" ));
arch_dirs[0] = "";
arch_pe_dirs[0] = strmake( "%s-windows/", archs.str[0] );
arch_install_dirs[0] = *dll_ext ? strmake( "$(dlldir)/%s-unix/", archs.str[0] ) : "$(dlldir)/";
strip_progs[0] = "\"$(STRIP)\"";
if (crosstarget)
{
strarray_add( &archs, host_cpu );
strarray_add( &target_flags[1], "-b" );
strarray_add( &target_flags[1], crosstarget );
strip_progs[1] = strmake( "%s-strip", crosstarget );
debug_flags[1] = debug_flag;
}
for (arch = 1; arch < archs.count; arch++)
{
target = get_expanded_arch_var( top_makefile, "TARGET", arch );
strarray_add( &target_flags[arch], "-b" );
strarray_add( &target_flags[arch], target );
arch_dirs[arch] = strmake( "%s-windows/", archs.str[arch] );
arch_pe_dirs[arch] = arch_dirs[arch];
arch_install_dirs[arch] = strmake( "$(dlldir)/%s", arch_dirs[arch] );
strip_progs[arch] = strmake( "%s-strip", target );
}
for (arch = 0; arch < archs.count; arch++)
{
extra_cflags[arch] = get_expanded_arch_var_array( top_makefile, "EXTRACFLAGS", arch );
extra_cflags_extlib[arch] = remove_warning_flags( extra_cflags[arch] );
disabled_dirs[arch] = get_expanded_arch_var_array( top_makefile, "DISABLED_SUBDIRS", arch );
if (!is_multiarch( arch )) continue;
delay_load_flags[arch] = delay_load_flag;
debug_flags[arch] = debug_flag;
delay_load_flags[arch] = get_expanded_arch_var( top_makefile, "DELAYLOADFLAG", arch );
debug_flags[arch] = get_expanded_arch_var( top_makefile, "DEBUG", arch );
}
if (*dll_ext)
@ -4549,7 +4535,6 @@ int main( int argc, char *argv[] )
top_makefile->src_dir = root_src_dir;
subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" );
disabled_dirs = get_expanded_make_var_array( top_makefile, "DISABLED_SUBDIRS" );
submakes = xmalloc( subdirs.count * sizeof(*submakes) );
for (i = 0; i < subdirs.count; i++) submakes[i] = parse_makefile( subdirs.str[i] );