winebuild: Add -m32/-m64 options to allow 32/64-bit cross-compiles.

This commit is contained in:
Alexandre Julliard 2009-01-15 21:17:51 +01:00
parent 1608cb99b5
commit 07f77c4148
5 changed files with 35 additions and 1 deletions

7
configure vendored
View File

@ -745,10 +745,10 @@ X_PRE_LIBS
X_CFLAGS X_CFLAGS
CPP CPP
XMKMF XMKMF
TARGETFLAGS
TOOLSDIR TOOLSDIR
WIN16_INSTALL WIN16_INSTALL
WIN16_FILES WIN16_FILES
TARGETFLAGS
CPPBIN CPPBIN
ac_ct_CXX ac_ct_CXX
CXXFLAGS CXXFLAGS
@ -3867,6 +3867,11 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
AS="${AS:-as} --32" AS="${AS:-as} --32"
host_cpu="i386" host_cpu="i386"
notice_platform="32-bit " notice_platform="32-bit "
TARGETFLAGS="-m32"
else
TARGETFLAGS="-m64"
fi fi
;; ;;
esac esac

View File

@ -113,6 +113,9 @@ case $host in
AS="${AS:-as} --32" AS="${AS:-as} --32"
host_cpu="i386" host_cpu="i386"
notice_platform="32-bit " notice_platform="32-bit "
AC_SUBST(TARGETFLAGS,"-m32")
else
AC_SUBST(TARGETFLAGS,"-m64")
fi fi
;; ;;
esac esac

View File

@ -231,6 +231,7 @@ extern int kill_at;
extern int verbose; extern int verbose;
extern int save_temps; extern int save_temps;
extern int link_ext_symbols; extern int link_ext_symbols;
extern int force_pointer_size;
extern char *input_file_name; extern char *input_file_name;
extern char *spec_file_name; extern char *spec_file_name;

View File

@ -48,6 +48,7 @@ int kill_at = 0;
int verbose = 0; int verbose = 0;
int save_temps = 0; int save_temps = 0;
int link_ext_symbols = 0; int link_ext_symbols = 0;
int force_pointer_size = 0;
#ifdef __i386__ #ifdef __i386__
enum target_cpu target_cpu = CPU_x86; enum target_cpu target_cpu = CPU_x86;
@ -240,6 +241,7 @@ static const char usage_str[] =
" --ld-cmd=LD Command to use for linking (default: ld)\n" " --ld-cmd=LD Command to use for linking (default: ld)\n"
" -l, --library=LIB Import the specified library\n" " -l, --library=LIB Import the specified library\n"
" -L, --library-path=DIR Look for imports libraries in DIR\n" " -L, --library-path=DIR Look for imports libraries in DIR\n"
" -m32, -m64 Force building 32-bit resp. 64-bit code\n"
" -M, --main-module=MODULE Set the name of the main module for a Win16 dll\n" " -M, --main-module=MODULE Set the name of the main module for a Win16 dll\n"
" --nm-cmd=NM Command to use to get undefined symbols (default: nm)\n" " --nm-cmd=NM Command to use to get undefined symbols (default: nm)\n"
" --nxcompat=y|n Set the NX compatibility flag (default: yes)\n" " --nxcompat=y|n Set the NX compatibility flag (default: yes)\n"
@ -365,6 +367,12 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
lib_path = xrealloc( lib_path, (nb_lib_paths+1) * sizeof(*lib_path) ); lib_path = xrealloc( lib_path, (nb_lib_paths+1) * sizeof(*lib_path) );
lib_path[nb_lib_paths++] = xstrdup( optarg ); lib_path[nb_lib_paths++] = xstrdup( optarg );
break; break;
case 'm':
if (strcmp( optarg, "32" ) && strcmp( optarg, "64" ))
fatal_error( "Invalid -m option '%s', expected -m32 or -m64\n", optarg );
if (!strcmp( optarg, "32" )) force_pointer_size = 4;
else force_pointer_size = 8;
break;
case 'M': case 'M':
spec->type = SPEC_WIN16; spec->type = SPEC_WIN16;
break; break;
@ -490,6 +498,20 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
if (spec->file_name && !strchr( spec->file_name, '.' )) if (spec->file_name && !strchr( spec->file_name, '.' ))
strcat( spec->file_name, exec_mode == MODE_EXE ? ".exe" : ".dll" ); strcat( spec->file_name, exec_mode == MODE_EXE ? ".exe" : ".dll" );
switch (target_cpu)
{
case CPU_x86:
if (force_pointer_size == 8) target_cpu = CPU_x86_64;
break;
case CPU_x86_64:
if (force_pointer_size == 4) target_cpu = CPU_x86;
break;
default:
if (force_pointer_size == 8)
fatal_error( "Cannot build 64-bit code for this CPU\n" );
break;
}
return &argv[optind]; return &argv[optind];
} }

View File

@ -143,6 +143,9 @@ Import the specified library, looking for a corresponding
\fIlibname.def\fR file in the directories specified with the \fB-L\fR \fIlibname.def\fR file in the directories specified with the \fB-L\fR
option. option.
.TP .TP
.B \-m32, -m64
Generate 32-bit, respectively 64-bit code.
.TP
.BI \-M,\ --main-module= module .BI \-M,\ --main-module= module
Specify that we are building a 16-bit dll, that will ultimately be Specify that we are building a 16-bit dll, that will ultimately be
linked together with the 32-bit dll specified in \fImodule\fR. Only linked together with the 32-bit dll specified in \fImodule\fR. Only