mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-08 00:29:37 +00:00
Better target arch checks, beginnings of x64
This commit is contained in:
parent
24ed2ea6ef
commit
ac0b132dee
21
Makefile.am
21
Makefile.am
|
@ -28,7 +28,7 @@ noinst_PROGRAMS = genfont
|
|||
|
||||
bin_PROGRAMS = apple2ix
|
||||
|
||||
ASM_SRC = \
|
||||
ASM_SRC_x86 = \
|
||||
src/x86/glue.S src/x86/cpu.S
|
||||
|
||||
INTERFACE_CLASSIC_SRC = \
|
||||
|
@ -47,7 +47,7 @@ META_SRC = \
|
|||
|
||||
# NOTE : selectively enabled through configuration process ...
|
||||
EXTRA_apple2ix_SOURCES = \
|
||||
$(ASM_SRC) \
|
||||
$(ASM_SRC_x86) \
|
||||
\
|
||||
$(INTERFACE_CLASSIC_SRC) \
|
||||
\
|
||||
|
@ -62,7 +62,7 @@ apple2ix_SOURCES = src/font.c src/misc.c src/display.c src/vm.c \
|
|||
src/disk.c src/cpu-supp.c
|
||||
|
||||
apple2ix_CFLAGS = @AM_CFLAGS@ @X_CFLAGS@
|
||||
apple2ix_LDFLAGS = @ARCHOS_HACK_LDFLAGS@
|
||||
apple2ix_LDFLAGS =
|
||||
apple2ix_LDADD = @ASM_O@ @INTERFACE_O@ @VIDEO_O@ @AUDIO_O@ @META_O@ @X_LIBS@
|
||||
apple2ix_DEPENDENCIES = @ASM_O@ @INTERFACE_O@ @VIDEO_O@ @AUDIO_O@ @META_O@
|
||||
|
||||
|
@ -85,23 +85,32 @@ A2_TEST_CFLAGS = -DTESTING=1 -Isrc/test
|
|||
TESTS = testcpu testdisplay testvm
|
||||
check_PROGRAMS = testcpu testdisplay testvm
|
||||
|
||||
testcpu_SOURCES = src/test/testcpu.c $(A2_TEST_SOURCES) $(ASM_SRC) $(META_SRC) $(VIDEO_SRC)
|
||||
testcpu_SOURCES = src/test/testcpu.c $(A2_TEST_SOURCES) $(META_SRC) $(VIDEO_SRC)
|
||||
testcpu_CFLAGS = $(apple2ix_CFLAGS) $(A2_TEST_CFLAGS) -UAUDIO_ENABLED -UINTERFACE_CLASSIC -DHEADLESS=1
|
||||
testcpu_LDFLAGS = $(apple2ix_LDFLAGS)
|
||||
testcpu_LDADD = @ASM_O@
|
||||
testcpu_DEPENDENCIES = @ASM_O@ @META_O@
|
||||
|
||||
testdisplay_SOURCES = src/test/testdisplay.c $(A2_TEST_SOURCES) $(ASM_SRC) $(META_SRC) $(VIDEO_SRC)
|
||||
EXTRA_testcpu_SOURCES = $(ASM_SRC_x86)
|
||||
|
||||
testdisplay_SOURCES = src/test/testdisplay.c $(A2_TEST_SOURCES) $(META_SRC) $(VIDEO_SRC)
|
||||
# HACK FIXME TODO NOTE: why don't these CFLAGS here pass down to the .S and .c files in the subdirectories?
|
||||
testdisplay_CFLAGS = $(apple2ix_CFLAGS) $(A2_TEST_CFLAGS) -UAUDIO_ENABLED -UINTERFACE_CLASSIC -DHEADLESS=0
|
||||
testdisplay_LDFLAGS = $(apple2ix_LDFLAGS)
|
||||
testdisplay_LDADD = @ASM_O@
|
||||
testdisplay_DEPENDENCIES = @ASM_O@ @META_O@ @VIDEO_O@
|
||||
|
||||
testvm_SOURCES = src/test/testvm.c $(A2_TEST_SOURCES) $(ASM_SRC) $(META_SRC) $(VIDEO_SRC)
|
||||
EXTRA_testdisplay_SOURCES = $(ASM_SRC_x86)
|
||||
|
||||
testvm_SOURCES = src/test/testvm.c $(A2_TEST_SOURCES) $(META_SRC) $(VIDEO_SRC)
|
||||
# HACK FIXME TODO NOTE: why don't these CFLAGS here pass down to the .S and .c files in the subdirectories?
|
||||
testvm_CFLAGS = $(apple2ix_CFLAGS) $(A2_TEST_CFLAGS) -UAUDIO_ENABLED -UINTERFACE_CLASSIC -DHEADLESS=0
|
||||
testvm_LDFLAGS = $(apple2ix_LDFLAGS)
|
||||
testvm_LDADD = @ASM_O@
|
||||
testvm_DEPENDENCIES = @ASM_O@ @META_O@ @VIDEO_O@
|
||||
|
||||
EXTRA_testvm_SOURCES = $(ASM_SRC_x86)
|
||||
|
||||
###############################################################################
|
||||
# Misc
|
||||
|
||||
|
|
89
configure.ac
89
configure.ac
|
@ -3,6 +3,8 @@ dnl ---------------------------------------------------------------------------
|
|||
AC_PREREQ([2.69])
|
||||
AC_INIT([apple2ix], [0.8])
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
dnl AM_CONFIG_HEADER(src/config.h) -- disable config.h because it makes it difficult/impossible to do modular builds for the test suite
|
||||
|
@ -12,30 +14,67 @@ AM_PROG_CC_C_O dnl apparently required for custom font.c target?
|
|||
AM_PROG_AS
|
||||
AC_PROG_INSTALL
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Arch i386 checks, sigh... The plan is to eventually support x64 and certain
|
||||
dnl ARM targets, but we only handle i386 at the moment thus this hackishness
|
||||
dnl Arch checks
|
||||
|
||||
dnl arch check (currently must be i386)
|
||||
my_save_cflags="$CFLAGS"
|
||||
CFLAGS="-m32 -Xassembler --32"
|
||||
AC_MSG_CHECKING([whether CC supports compiling for i386 ])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
|
||||
AC_MSG_RESULT([w00t!])
|
||||
AC_MSG_WARN([compiling for i386 architecture appears to work, but emulator may fail to link if i386 versions of required libraries are not present...])
|
||||
AM_CFLAGS="-std=gnu11 -Wall $CFLAGS"
|
||||
], [
|
||||
AC_MSG_RESULT([oops])
|
||||
AC_MSG_ERROR([emulator currently supports (cross-)compilation for i386 architecture only])
|
||||
])
|
||||
arch=''
|
||||
case $target in
|
||||
x86_64-*-*)
|
||||
ASM_O="src/x64/glue.o src/x64/cpu.o"
|
||||
arch='x64'
|
||||
;;
|
||||
i?86-*-*)
|
||||
arch='x86'
|
||||
;;
|
||||
x86*)
|
||||
dnl support shorthand ./configure --target=x86
|
||||
arch='x86'
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([emulator does not presently support architecture $target])
|
||||
;;
|
||||
esac
|
||||
|
||||
CFLAGS="$my_save_cflags"
|
||||
CCASFLAGS="$CCASFLAGS -m32 -Xassembler --32"
|
||||
AM_CFLAGS="-std=gnu11 -Wall"
|
||||
|
||||
dnl double-check compilation for x86 target
|
||||
if test "$arch" = "x86" ; then
|
||||
ASM_O="src/x86/glue.o src/x86/cpu.o"
|
||||
my_save_cflags="$CFLAGS"
|
||||
AC_MSG_CHECKING([whether compiler supports x86 target])
|
||||
case $host in
|
||||
i?86-*-*)
|
||||
dnl building on an actual x86 machine presumably works
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
|
||||
AC_MSG_RESULT([32bit w00t!])
|
||||
], [
|
||||
AC_MSG_RESULT([oops])
|
||||
AC_MSG_ERROR([world is b0rken])
|
||||
])
|
||||
;;
|
||||
*)
|
||||
dnl check x86 compilation on x86_64 (or other) host
|
||||
CFLAGS="-m32 -Xassembler --32"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
|
||||
AC_MSG_RESULT([w00t!])
|
||||
AC_MSG_WARN([compiling for x86 architecture appears to work, but emulator may fail to link if x86 versions of required libraries are not present...])
|
||||
dnl HACK FIXME TODO --------------------------------------------------------- ^^^^^^^^^^^^ should check for this (and check linking against all x86 versions of needed libraries
|
||||
AM_CFLAGS="$AM_CFLAGS $CFLAGS"
|
||||
dnl -------- ARCHOS_HACK_LDFLAGS="-L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu"
|
||||
], [
|
||||
AC_MSG_RESULT([oops])
|
||||
AC_MSG_ERROR([build system does not support building for $arch architecture])
|
||||
])
|
||||
;;
|
||||
esac
|
||||
CFLAGS="$my_save_cflags"
|
||||
fi
|
||||
|
||||
AC_SUBST(ASM_O)
|
||||
AC_SUBST([AM_CFLAGS])
|
||||
|
||||
dnl OS Check (currently must be Linux until we sort the arch crap out) ...
|
||||
|
||||
dnl OS Check
|
||||
AC_EGREP_CPP(unsupported_, [
|
||||
#if defined(__ANDROID__)
|
||||
unsupported_for_now
|
||||
|
@ -50,9 +89,11 @@ unsupported_for_now
|
|||
#elif __linux
|
||||
linux
|
||||
#elif __unix
|
||||
unsupported_for_now
|
||||
unix
|
||||
#elif __posix
|
||||
unsupported_for_now
|
||||
posix
|
||||
#else
|
||||
unknown
|
||||
#endif
|
||||
], [
|
||||
AC_MSG_CHECKING([Operating System ])
|
||||
|
@ -71,14 +112,6 @@ AC_TRY_LINK([asm("_glibc_foobar:");], [glibc_foobar()], [
|
|||
AC_DEFINE(NO_UNDERSCORES, 1, [Underscores allowed in assembly linkage])
|
||||
])
|
||||
|
||||
dnl at this point we believe arch/os is good ...
|
||||
|
||||
ARCHOS_HACK_LDFLAGS="-L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu"
|
||||
AC_SUBST(ARCHOS_HACK_LDFLAGS)
|
||||
|
||||
ASM_O="src/x86/glue.o src/x86/cpu.o"
|
||||
AC_SUBST(ASM_O)
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user