Hi all,
here's a patch for the Autoconf & Automake build files:
* Unify the build process for Windows (MinGW/MSYS), Linux (x86 &
x86-64) and Mac OS X (untested).
* Introduce the configure options `--enable-dynarec' and
`--disable-dynarec' for specifying whether to include the dynamic
recompiler or the standard CPU emulation -- the latter is default.
The DynaRec feature is marked as experimental in the `configure
--help' text. `make clean' is recommended after switching the
option.
* Introduce the configure options `--enable-debug' and
`--disable-debug' for specifying whether to build a debug
executable. Default is non-debug. CFLAGS are set as follows:
--enable-debug => "-Wall -O0 -g -D_DEBUG"
--disable-debug => "-Wall -O2"
* Introduce endianness checking to allow for PPC (Mac) builds. On PPC
(and other big-endian architectures, of course), WORDS_BIGENDIAN is
#defined.
* Change vidc20.c to use the WORDS_BIGENDIAN #define instead of
_RPCEMU_BIG_ENDIAN.
(Authors: Christof Efkemann, Kai Thomsen)
After applying the patch, you'll have to run `autoreconf --force
--install' (or likewise) in order to rebuild `configure',
`config.h.in', `aclocal.m4' and `Makefile.in'.
Unfortunately, I can't seem to find a MinGW binary distribution of
Allegro that contains the allegro.m4 file, which the Autoconf-processed
configure.ac needs, so to be able to run `autoreconf' on MinGW, you
should:
- extract allegro.m4 from the DOS/Windows Allegro sources (it's
located under `misc') and
- copy it to the /share/aclocal directory (on my machine, this
corresponds to D:\msys\1.0\share\aclocal) or to RPCemu's `src'
directory
In case Allegro's header and library files aren't located on the common
default paths, e. g., if you've installed Allegro in your home
directory, it's possible to specify custom paths by running `configure'
like this:
./configure CPPFLAGS="-I/path/to/include" LDFLAGS="-L/path/to/lib"
The following auto{conf,make} versions have worked for me on
- Linux x86: autoconf 2.61, automake 1.10
- Linux x86-64: ditto
- Windows: autoconf 2.56, automake 1.7.1
By the way, I encountered two things on Windows (MSYS/MinGW):
* The cmos.ram currently in SVN has a MouseType setting that doesn't
work. `*Configure MouseType 0' unfreezes the pointer.
* rpclog() in rpc-win.c uses a hardcoded absolute file path
(apparently left over from debugging) that leads to a segmentation
fault. Alex Waugh already mentioned this.
Cheers,
--KaiIndex: configure.ac
===================================================================
--- configure.ac (Revision 89)
+++ configure.ac (Arbeitskopie)
@@ -1,17 +1,87 @@
-# configure.in for the RPCemu
+# configure.ac for the RPCemu
#
AC_PREREQ(2.50)
-AC_INIT(rpcemu, 0.7)
+AC_INIT(RPCemu, 0.7, , rpcemu)
+
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+AM_INIT_AUTOMAKE(foreign)
+
+AC_MSG_CHECKING([whether to enable debugging])
+AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug], [build debug executable]))
+if test "$enable_debug" = "yes"; then
+ CFLAGS="$CFLAGS -Wall -O0 -g -D_DEBUG"
+ AC_MSG_RESULT([yes])
+else
+ CFLAGS="$CFLAGS -Wall -O2"
+ AC_MSG_RESULT([no])
+fi
+
+AC_MSG_CHECKING([whether to use the dynamic recompiler])
+AC_ARG_ENABLE(dynarec,
+ AC_HELP_STRING([--enable-dynarec],
+ [use dynamic recompiler (experimental)]),,
+ enable_dynarec=no)
+AC_MSG_RESULT($enable_dynarec)
+AM_CONDITIONAL(DYNAREC, test "$enable_dynarec" = "yes")
+if test "$enable_dynarec" = "yes"; then
+ AC_MSG_CHECKING([for CPU])
+ case "${host_cpu}" in
+ i?86)
+ CPU=i386
+ AC_MSG_RESULT(${host_cpu})
+ ;;
+ x86_64)
+ CPU=x86_64
+ AC_MSG_RESULT(${host_cpu})
+ ;;
+ *)
+ AC_MSG_ERROR([Unsupported CPU.])
+ ;;
+ esac
+fi
+
+AC_MSG_CHECKING([for Operating System])
+case "${host}" in
+ *linux*)
+ OS="linux"
+ AC_MSG_RESULT(Linux)
+ ;;
+ *mingw*)
+ OS="win"
+ AC_MSG_RESULT(Windows)
+ ;;
+ *macosx*)
+ OS="macosx"
+ AC_MSG_RESULT([Mac OS X])
+ ;;
+ *)
+ AC_MSG_ERROR([Unsupported host system.])
+ ;;
+esac
+
+AM_CONDITIONAL(OS_WIN, test "$OS" = "win")
+AM_CONDITIONAL(OS_LINUX, test "$OS" = "linux")
+AM_CONDITIONAL(OS_MACOSX, test "$OS" = "macosx")
+AM_CONDITIONAL(CPU_X86_64, test "$CPU" = "x86_64")
+AM_CONDITIONAL(CPU_I386, test "$CPU" = "i386")
+
AC_CONFIG_SRCDIR(arm.c)
-AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
-AC_CANONICAL_HOST
-AC_PROG_CC
+AM_PROG_CC_C_O
+AC_C_BIGENDIAN(, , AC_MSG_ERROR(unknown endianness))
AC_ISC_POSIX
-AC_PATH_XTRA
+# Do not run test for Allegro with Win32/MinGW version, as binary builds have
+# `allegro-config' missing.
+# NOTE: For the following Autoconf macro to be supported, you need to extract
+# allegro.m4 from the DOS/Windows Allegro sources (the file is contained
+# in `misc') and copy it to this directory or MSYS's `/share/aclocal'.
+if test "$OS" != "win"; then
+ AM_PATH_ALLEGRO(, , AC_MSG_ERROR(building RPCemu requires Allegro to be installed))
+fi
-AM_PATH_ALLEGRO(, , AC_MSG_ERROR(project requires Allegro to be installed))
-AC_SUBST(topdir)
AC_OUTPUT([Makefile])
Index: Makefile.am
===================================================================
--- Makefile.am (Revision 89)
+++ Makefile.am (Arbeitskopie)
@@ -1,10 +1,51 @@
# Makefile.am for the RPCemu
bin_PROGRAMS = rpcemu
-rpcemu_SOURCES = 82c711.c arm.c cmos.c \
-cp15.c gui.c ide.c iomd.c keyboard.c mem.c \
-romload.c rpc-linux.c vidc20.c hostfs.c \
-rpcemu.c sound.c fpa.c codegen_null.c
-rpcemu_CFLAGS=$(allegro_CFLAGS)
-rpcemu_LDADD=$(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(allegro_LIBS)
+rpcemu_CFLAGS = $(allegro_CFLAGS)
+
+# workaround for Win32 Allegro, which has `allegro-config' missing
+if OS_WIN
+rpcemu_LDADD = -lalleg
+else
+rpcemu_LDADD = $(allegro_LIBS)
+endif
+
+rpcemu_SOURCES = 82c711.c 82c711.h cdrom-iso.c cmos.c cmos.h cp15.c cp15.h \
+fpa.c hostfs.c hostfs.h ide.c ide.h iomd.c iomd.h keyboard.c keyboard.h mem.c \
+mem.h romload.c rpcemu.c sound.c sound.h vidc20.c vidc20.h
+
+if DYNAREC
+rpcemu_SOURCES += ArmDynarec.c ArmDynarecOps.h
+rpcemu_CFLAGS += -DDYNAREC
+
+if CPU_X86_64
+rpcemu_SOURCES += codegen_amd64.c codegen_amd64.h
+endif
+if CPU_I386
+rpcemu_SOURCES += codegen_x86.c codegen_x86.h
+endif
+
+else
+# non-DYNAREC
+rpcemu_SOURCES += arm.c arm.h codegen_null.c
+endif
+
+if OS_WIN
+rpcemu_SOURCES += cdrom-ioctl.c rpc-win.c resources.h
+rpcemu_CPPFLAGS = -Dsleep=Sleep
+rpcemu_LDADD += acorn.o -lcomdlg32 -lwinmm
+
+%.o: %.rc
+ windres $^ $@
+endif
+
+if OS_LINUX
+rpcemu_SOURCES += rpc-linux.c gui.c cdrom-linuxioctl.c
+endif
+
+if OS_MACOSX
+rpcemu_SOURCES += rpc-macosx.c gui.c
+endif
+
+EXTRA_DIST = acorn.rc rpcemu.ico makefile.dj rpc-dos.c
Index: vidc20.c
===================================================================
--- vidc20.c (Revision 89)
+++ vidc20.c (Arbeitskopie)
@@ -564,7 +564,7 @@
int xx;
for (xx=0;xx<64;xx+=4)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
vidp[x+xx+3]=thr.vpal[ramp[addr]&1] |(thr.vpal[(ramp[addr]>>1)&1]<<16);
vidp[x+xx+2]=thr.vpal[(ramp[addr]>>2)&1]|(thr.vpal[(ramp[addr]>>3)&1]<<16);
vidp[x+xx+1]=thr.vpal[(ramp[addr]>>4)&1]|(thr.vpal[(ramp[addr]>>5)&1]<<16);
@@ -663,7 +663,7 @@
int xx;
for (xx=0;xx<16;xx+=4)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
// if (!x && !y) printf("%02X %04X\n",ramp[addr],vpal[ramp[addr&0xF]]);
vidp[x+xx+3]=thr.vpal[ramp[addr]>>4]|(thr.vpal[ramp[addr]&0xF]<<16);
vidp[x+xx+2]=thr.vpal[ramp[addr+1]>>4]|(thr.vpal[ramp[addr+1]&0xF]<<16);
@@ -722,7 +722,7 @@
int xx;
for (xx=0;xx<8;xx+=2)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
vidp[x+xx+1]=thr.vpal[ramp[addr+1]&0xFF]|(thr.vpal[ramp[addr]&0xFF]<<16);
vidp[x+xx]=thr.vpal[ramp[addr+3]&0xFF]|(thr.vpal[ramp[addr+2]&0xFF]<<16);
#else
@@ -974,7 +974,7 @@
int xx;
for (xx=0;xx<32;xx+=8)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
vidp[x+xx]=thr.vpal[ramp[addr+3]&0xF];
vidp[x+xx+1]=thr.vpal[(ramp[addr+3]>>4)&0xF];
vidp[x+xx+2]=thr.vpal[ramp[addr+2]&0xF];
@@ -1165,7 +1165,7 @@
vidp16=(unsigned short *)bmp_write_line(b,y+thr.cursory);
for (x=0;x<32;x+=4)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
addr^=3;
#endif
if ((x+thr.cursorx)>=0 && (x+thr.cursorx)<thr.xsize && ramp[addr]&3)
@@ -1176,7 +1176,7 @@
vidp16[x+thr.cursorx+2]=thr.vpal[((ramp[addr]>>4)&3)|0x100];
if ((x+thr.cursorx+3)>=0 && (x+thr.cursorx+3)<thr.xsize && (ramp[addr]>>6)&3)
vidp16[x+thr.cursorx+3]=thr.vpal[((ramp[addr]>>6)&3)|0x100];
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
addr^=3;
#endif
addr++;
@@ -1193,7 +1193,7 @@
vidp=(uint32_t *)bmp_write_line(b,y+thr.cursory);
for (x=0;x<32;x+=4)
{
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
addr^=3;
#endif
if ((x+thr.cursorx)>=0 && (x+thr.cursorx)<thr.xsize && ramp[addr]&3)
@@ -1204,7 +1204,7 @@
vidp[x+thr.cursorx+2]=thr.vpal[((ramp[addr]>>4)&3)|0x100];
if ((x+thr.cursorx+3)>=0 && (x+thr.cursorx+3)<thr.xsize && (ramp[addr]>>6)&3)
vidp[x+thr.cursorx+3]=thr.vpal[((ramp[addr]>>6)&3)|0x100];
-#ifdef _RPCEMU_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
addr^=3;
#endif
addr++;
_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu