Alexandre Julliard : makefiles: Normalize the host architecture in makedep instead of configure.
Alexandre Julliard
julliard at winehq.org
Tue Sep 21 15:59:03 CDT 2021
Module: wine
Branch: master
Commit: 0f83b83cd526c1c411ab74e8f1a76423ba0a6291
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0f83b83cd526c1c411ab74e8f1a76423ba0a6291
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Sep 21 14:26:38 2021 +0200
makefiles: Normalize the host architecture in makedep instead of configure.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
Makefile.in | 2 +-
configure | 14 --------------
configure.ac | 9 ---------
tools/makedep.c | 34 +++++++++++++++++++++++++++++-----
4 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index d9e01a277c0..74e9f96657f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -31,8 +31,8 @@ fontdir = ${datadir}/wine/fonts
nlsdir = ${datadir}/wine/nls
dlldir = ${libdir}/wine
srcdir = @srcdir@
+host_cpu = @host_cpu@
SHELL = /bin/sh
-ARCH = @ARCH@
CC = @CC@
CXX = @CXX@
CPPBIN = @CPPBIN@
diff --git a/configure b/configure
index db592f0868d..70c4766de81 100755
--- a/configure
+++ b/configure
@@ -774,7 +774,6 @@ AR
BISON
FLEX
TOOLSDIR
-ARCH
TARGETFLAGS
LD
CPPBIN
@@ -5896,19 +5895,6 @@ then
--enable-win64 should be used in the 64-bit build tree, --with-wine64 in the 32-bit Wow64 build tree." "$LINENO" 5
fi
-case $host_cpu in
- *i[3456789]86*) ARCH="i386"
- ;;
- *x86_64*) ARCH="x86_64"
- ;;
- *aarch64*) ARCH="aarch64"
- ;;
- *arm*) ARCH="arm"
- ;;
- *) ARCH=""
- ;;
-esac
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the directory containing the Wine tools" >&5
$as_echo_n "checking for the directory containing the Wine tools... " >&6; }
if ${wine_cv_toolsdir+:} false; then :
diff --git a/configure.ac b/configure.ac
index 0bc46a1427b..5db5b317da6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,15 +243,6 @@ then
--enable-win64 should be used in the 64-bit build tree, --with-wine64 in the 32-bit Wow64 build tree.])
fi
-dnl Normalize CPU architecture
-case $host_cpu in
- *i[[3456789]]86*) AC_SUBST(ARCH,"i386") ;;
- *x86_64*) AC_SUBST(ARCH,"x86_64") ;;
- *aarch64*) AC_SUBST(ARCH,"aarch64") ;;
- *arm*) AC_SUBST(ARCH,"arm") ;;
- *) AC_SUBST(ARCH,"") ;;
-esac
-
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
diff --git a/tools/makedep.c b/tools/makedep.c
index cc10540fe7f..41051f9d610 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -157,7 +157,7 @@ static const char *tools_ext;
static const char *exe_ext;
static const char *dll_ext;
static const char *man_ext;
-static const char *arch;
+static const char *host_cpu;
static const char *pe_dir;
static const char *so_dir;
static const char *crosstarget;
@@ -526,6 +526,30 @@ static void strarray_qsort( struct strarray *array, int (*func)(const char **, c
}
+/*******************************************************************
+ * 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 < sizeof(map) / sizeof(map[0]); 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
*/
@@ -4410,7 +4434,7 @@ int main( int argc, char *argv[] )
exe_ext = get_expanded_make_variable( top_makefile, "EXEEXT" );
man_ext = get_expanded_make_variable( top_makefile, "api_manext" );
dll_ext = (exe_ext && !strcmp( exe_ext, ".exe" )) ? "" : ".so";
- arch = get_expanded_make_variable( top_makefile, "ARCH" );
+ host_cpu = get_expanded_make_variable( top_makefile, "host_cpu" );
crosstarget = get_expanded_make_variable( top_makefile, "CROSSTARGET" );
crossdebug = get_expanded_make_variable( top_makefile, "CROSSDEBUG" );
fontforge = get_expanded_make_variable( top_makefile, "FONTFORGE" );
@@ -4431,10 +4455,10 @@ int main( int argc, char *argv[] )
if (!exe_ext) exe_ext = "";
if (!tools_ext) tools_ext = "";
if (!man_ext) man_ext = "3w";
- if (arch)
+ if (host_cpu && (host_cpu = normalize_arch( host_cpu )))
{
- so_dir = strmake( "$(dlldir)/%s-unix", arch );
- pe_dir = strmake( "$(dlldir)/%s-windows", arch );
+ so_dir = strmake( "$(dlldir)/%s-unix", host_cpu );
+ pe_dir = strmake( "$(dlldir)/%s-windows", host_cpu );
}
else
so_dir = pe_dir = "$(dlldir)";
More information about the wine-cvs
mailing list