diff --git a/BasiliskII/src/MacOSX/Makefile.in b/BasiliskII/src/MacOSX/Makefile.in index 1f7a9f25..439e656d 100644 --- a/BasiliskII/src/MacOSX/Makefile.in +++ b/BasiliskII/src/MacOSX/Makefile.in @@ -3,12 +3,14 @@ ## System specific configuration SHELL = /bin/sh -CC = @CC@ -CXX = @CXX@ +HOST_CC = gcc +HOST_CXX = g++ +CC = @CC@ -arch $(ARCH) +CXX = @CXX@ -arch $(ARCH) CFLAGS = @CFLAGS@ -g CXXFLAGS = @CXXFLAGS@ -g -CPPFLAGS = @CPPFLAGS@ -I../include -I. @CPUINCLUDES@ -DEFS = @DEFS@ @DEFINES@ -D_REENTRANT -DAQUA +CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../uae_cpu +DEFS = @DEFS@ @DEFINES@ -D_REENTRANT -DAQUA -DFPU_IEEE LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ MONSRCS = @MONSRCS@ @@ -27,23 +29,47 @@ endif ## CPU emulation code WANT_JIT = @WANT_JIT@ WANT_JIT_DEBUG = @WANT_JIT_DEBUG@ +USE_JIT = no +CPUSRCS = \ + ../uae_cpu/basilisk_glue.cpp ../uae_cpu/readcpu.cpp \ + ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/fpu/fpu_ieee.cpp +GEN_CPUSRCS = \ + cpustbl.cpp cpudefs.cpp \ + cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp \ + cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp +ifeq ($(ARCH), i386) USE_JIT = $(WANT_JIT) -CPUSRCS = @CPUSRCS@ +DEFS += -DUNALIGNED_PROFITABLE -DREGPARAM="__attribute__((regparm(3)))" +DEFS += -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE +endif +ifeq ($(ARCH), x86_64) +USE_JIT = $(WANT_JIT) +DEFS += -DUNALIGNED_PROFITABLE +DEFS += -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS +endif ifeq ($(USE_JIT), yes) DEFS += -DUSE_JIT -DUSE_JIT_FPU ifeq ($(WANT_JIT_DEBUG), yes) DEFS += -DJIT_DEBUG endif CPUSRCS += \ + ../uae_cpu/compiler/compemu_support.cpp \ + ../uae_cpu/compiler/compemu_fpp.cpp +GEN_CPUSRCS += \ cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp \ cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp \ compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp \ compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp \ - ../uae_cpu/compiler/compemu_support.cpp \ - ../uae_cpu/compiler/compemu_fpp.cpp \ - compstbl.o cpustbl_nf.o + cpustbl_nf.cpp compstbl.cpp endif +GEN_DIR = gen +ifneq ($(ARCH),) +GEN_DIR = gen.$(ARCH) +endif +CPUSRCS += $(foreach file, $(GEN_CPUSRCS), $(GEN_DIR)/$(file)) +CPPFLAGS += -I$(GEN_DIR) + ## Files UNIXSRCS = vm_alloc.cpp vm_alloc.h sigsegv.cpp sigsegv.h video_vosf.h video_blit.cpp \ xpram_unix.cpp user_strings_unix.cpp user_strings_unix.h \ @@ -61,18 +87,22 @@ SRCS = ../main.cpp main_macosx.mm ../prefs.cpp ../prefs_items.cpp prefs_macosx.m NNThread.m Emulator.mm EmulatorView.mm Controller.mm PrefsEditor.mm \ sshpty.c strlcpy.c \ $(MONSRCS) $(CPUSRCS) $(SLIRP_SRCS) + +## Documentation files +DOCS = README.txt Credits.html ToDo.html HowTo.html Versions.html + +## Binaries to build APP = BasiliskII APP_APP = $(APP).app - -PROGS = $(APP)_app -DOCS = README.txt Credits.html ToDo.html HowTo.html Versions.html +TARGET_ARCHES = @TARGET_ARCHES@ +PROGS = $(foreach arch, $(TARGET_ARCHES), $(APP).$(arch)) ## Rules .PHONY: modules install installdirs uninstall mostlyclean clean distclean depend dep .SUFFIXES: .SUFFIXES: .c .cpp .s .o .h -all: $(PROGS) +all: $(APP)_app README.txt: ../../README $(LN_S) $< $@ @@ -80,6 +110,9 @@ $(UNIXSRCS): %: ../Unix/% $(LN_S) $< $@ OBJ_DIR = obj +ifneq ($(ARCH),) +OBJ_DIR = obj.$(ARCH) +endif $(OBJ_DIR):: @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 @@ -93,11 +126,25 @@ SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) -$(APP): $(UNIXSRCS) $(OBJ_DIR) $(OBJS) - $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) - $(BLESS) $(APP) +define PROGS_template +$(APP).$(1): links + +$(MAKE) $(OBJ_DIR).$(1)/$(APP) ARCH=$(1) + $(LN_S) -f $(OBJ_DIR).$(1)/$(APP) $(APP).$(1) +endef -$(APP)_app: $(APP) $(DOCS) ../MacOSX/Info.plist ../MacOSX/$(APP).icns +$(APP): $(PROGS) + lipo $(foreach arch, $(TARGET_ARCHES), -arch $(arch) $(APP).$(arch)) \ + -create -output $@ + +$(foreach arch,$(TARGET_ARCHES),$(eval $(call PROGS_template,$(arch)))) + +links: $(UNIXSRCS) + +$(OBJ_DIR)/$(APP): $(OBJ_DIR) $(GEN_DIR) $(OBJS) + $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) + $(BLESS) $@ + +$(APP)_app: $(APP) $(DOCS) Info.plist $(APP).icns mkdir -p $(APP_APP)/Contents cp -f ../MacOSX/Info.plist $(APP_APP)/Contents/ echo -n 'APPL????' > $(APP_APP)/Contents/PkgInfo @@ -106,17 +153,17 @@ $(APP)_app: $(APP) $(DOCS) ../MacOSX/Info.plist ../MacOSX/$(APP).icns strip $(APP_APP)/Contents/MacOS/$(APP) mkdir -p $(APP_APP)/Contents/Resources cp -Rp English.lproj $(APP_APP)/Contents/Resources/ - cp -f ../MacOSX/$(APP).icns $(APP_APP)/Contents/Resources/ + cp -f $(APP).icns $(APP_APP)/Contents/Resources/ cp -f $(DOCS) $(APP_APP)/Contents/Resources/ find $(APP_APP) -type d -name CVS | xargs rm -rf mostlyclean: rm -rf $(APP_APP) - rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak + rm -f $(PROGS) $(OBJ_DIR)/* $(OBJ_DIR).*/* core* *.core *~ *.bak clean: mostlyclean rm -f $(UNIXSRCS) - rm -f cpuemu.cpp cpudefs.cpp cputmp*.s cpufast*.s cpustbl.cpp cputbl.h compemu.cpp compstbl.cpp comptbl.h + rm -f $(GEN_DIR).*/* distclean: clean rm -rf $(OBJ_DIR) @@ -140,83 +187,90 @@ $(OBJ_DIR)/%.o : %.mm $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ $(OBJ_DIR)/%.o : %.s $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ +$(OBJ_DIR)/%.ho : %.c + $(HOST_CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ +$(OBJ_DIR)/%.ho : %.cpp + $(HOST_CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/build68k: $(OBJ_DIR)/build68k.o - $(CC) $(LDFLAGS) -o $(OBJ_DIR)/build68k $(OBJ_DIR)/build68k.o -$(OBJ_DIR)/gencpu: $(OBJ_DIR)/gencpu.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o - $(CXX) $(LDFLAGS) -o $(OBJ_DIR)/gencpu $(OBJ_DIR)/gencpu.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o -$(OBJ_DIR)/gencomp: $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o - $(CXX) $(LDFLAGS) -o $(OBJ_DIR)/gencomp $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o +$(OBJ_DIR)/build68k: $(OBJ_DIR)/build68k.ho + $(HOST_CC) $(LDFLAGS) -o $@ $(OBJ_DIR)/build68k.ho +$(OBJ_DIR)/gencpu: $(OBJ_DIR)/gencpu.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho + $(HOST_CXX) $(LDFLAGS) -o $@ $(OBJ_DIR)/gencpu.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho +$(OBJ_DIR)/gencomp: $(OBJ_DIR)/gencomp.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho + $(HOST_CXX) $(LDFLAGS) -o $@ $(OBJ_DIR)/gencomp.ho $(OBJ_DIR)/readcpu.ho $(OBJ_DIR)/cpudefs.ho -cpudefs.cpp: $(OBJ_DIR)/build68k ../uae_cpu/table68k - $(OBJ_DIR)/build68k <../uae_cpu/table68k >cpudefs.cpp -cpustbl.cpp: cpuemu.cpp -cpustbl_nf.cpp: cpustbl.cpp -compstbl.cpp: compemu.cpp -cputbl.h: cpuemu.cpp -comptbl.h: compemu.cpp +$(GEN_DIR):: + @[ -d $(GEN_DIR) ] || mkdir $(GEN_DIR) > /dev/null 2>&1 -cpuemu.cpp: $(OBJ_DIR)/gencpu - $(OBJ_DIR)/gencpu +$(GEN_DIR)/cpudefs.cpp: $(OBJ_DIR)/build68k ../uae_cpu/table68k + $(OBJ_DIR)/build68k <../uae_cpu/table68k > $@ +$(GEN_DIR)/cpustbl.cpp: $(GEN_DIR)/cpuemu.cpp +$(GEN_DIR)/cpustbl_nf.cpp: $(GEN_DIR)/cpustbl.cpp +$(GEN_DIR)/compstbl.cpp: $(GEN_DIR)/compemu.cpp +$(GEN_DIR)/cputbl.h: $(GEN_DIR)/cpuemu.cpp +$(GEN_DIR)/comptbl.h: $(GEN_DIR)/compemu.cpp -compemu.cpp: $(OBJ_DIR)/gencomp - $(OBJ_DIR)/gencomp +$(GEN_DIR)/cpuemu.cpp: $(OBJ_DIR)/gencpu + cd $(GEN_DIR) && ../$(OBJ_DIR)/gencpu -$(OBJ_DIR)/cpustbl_nf.o: cpustbl.cpp +$(GEN_DIR)/compemu.cpp: $(OBJ_DIR)/gencomp + cd $(GEN_DIR) && ../$(OBJ_DIR)/gencomp + +$(OBJ_DIR)/cpustbl_nf.o: $(GEN_DIR)/cpustbl.cpp $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DNOFLAGS -c $< -o $@ -$(OBJ_DIR)/compemu_support.o: compemu_support.cpp comptbl.h +$(OBJ_DIR)/compemu_support.o: compemu_support.cpp $(GEN_DIR)/comptbl.h $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu1.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu1.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu2.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu2.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu3.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu3.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu4.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu4.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu5.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu5.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu6.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu6.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu7.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu7.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu8.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu8.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu1_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu1_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu2_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu2_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu3_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu3_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu4_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu4_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu5_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu5_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu6_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu6_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu7_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu7_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/cpuemu8_nf.o: cpuemu.cpp +$(OBJ_DIR)/cpuemu8_nf.o: $(GEN_DIR)/cpuemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 -DNOFLAGS $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu1.o: compemu.cpp +$(OBJ_DIR)/compemu1.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_1 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu2.o: compemu.cpp +$(OBJ_DIR)/compemu2.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_2 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu3.o: compemu.cpp +$(OBJ_DIR)/compemu3.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_3 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu4.o: compemu.cpp +$(OBJ_DIR)/compemu4.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_4 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu5.o: compemu.cpp +$(OBJ_DIR)/compemu5.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_5 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu6.o: compemu.cpp +$(OBJ_DIR)/compemu6.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_6 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu7.o: compemu.cpp +$(OBJ_DIR)/compemu7.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_7 $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/compemu8.o: compemu.cpp +$(OBJ_DIR)/compemu8.o: $(GEN_DIR)/compemu.cpp $(CXX) $(CPPFLAGS) $(DEFS) -DPART_8 $(CXXFLAGS) -c $< -o $@ #------------------------------------------------------------------------- diff --git a/BasiliskII/src/MacOSX/config_macosx.h b/BasiliskII/src/MacOSX/config_macosx.h new file mode 100644 index 00000000..22398944 --- /dev/null +++ b/BasiliskII/src/MacOSX/config_macosx.h @@ -0,0 +1,62 @@ +/* + * config_macosx.h - MacOS X macros determined at compile-time + * + * $Id$ + * + * Basilisk II (C) 1997-2005 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Supported platforms are: ppc, ppc64, x86, x86_64 */ +#if ! defined __ppc__ && ! defined __ppc64__ && ! defined __i386__ && ! defined __x86_64__ +# error "Unsupported architecture. Please fix arch-specific macros" +#endif + +/* Size of data types */ +#define SIZEOF_FLOAT 4 +#define SIZEOF_DOUBLE 8 +#if defined __ppc__ || defined __ppc64__ +# if defined __LONG_DOUBLE_128__ +# define SIZEOF_LONG_DOUBLE 16 +# else +# define SIZEOF_LONG_DOUBLE 8 +# endif +#else +# define SIZEOF_LONG_DOUBLE 16 +#endif +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#if defined __ppc64__ || defined __x86_64__ +# define SIZEOF_LONG 8 +#else +# define SIZEOF_LONG 4 +#endif +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_VOID_P SIZEOF_LONG /* ILP32 or LP64 */ + +/* Endian-ness of data types */ +#if ! defined __LITTLE_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#endif + +/* Define to the floating point format of the host machine. */ +#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT + +/* Define to 1 if the host machine stores floating point numbers in memory + with the word containing the sign bit at the lowest address, or to 0 if it + does it the other way around. This macro should not be defined if the + ordering is the same as for multi-word integers. */ +/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */ diff --git a/BasiliskII/src/MacOSX/configure.in b/BasiliskII/src/MacOSX/configure.in index 8f78a962..1d3da5fc 100644 --- a/BasiliskII/src/MacOSX/configure.in +++ b/BasiliskII/src/MacOSX/configure.in @@ -13,6 +13,10 @@ AC_INIT(main_macosx.mm) AC_CONFIG_AUX_DIR(../Unix) AC_PREREQ(2.12) AC_CONFIG_HEADER(config.h) +AH_TOP([ +/* Include MacOS X macros determined at compile-time */ +#include "config_macosx.h" +]) dnl Aliases for PACKAGE and VERSION macros. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.]) @@ -22,29 +26,26 @@ dnl Some systems do not put corefiles in the currect directory, avoid saving dnl cores for the configure tests since some are intended to dump core. ulimit -c 0 +dnl Universal binaries. +AC_ARG_ENABLE(universal, +[ --enable-universal enable universal binaries for selected arches [default=no]], +[ WANT_UNIVERSAL="" + for arch in $enableval; do + case $arch in + yes) WANT_UNIVERSAL="i386 ppc";; + ppc|ppc64|i386|x86_64) WANT_UNIVERSAL="$WANT_UNIVERSAL $arch";; + esac + done +]) + dnl Video options. AC_ARG_ENABLE(multiwin, -[ --enable-multiwin allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no]) +[ --enable-multiwin allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no]) dnl JIT compiler options. AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no]) AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no]) -dnl FPU emulation core. -AC_ARG_ENABLE(fpe, -[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], -[ case "$enableval" in - dnl default is always ieee, if architecture has this fp format - auto) FPE_CORE_TEST_ORDER="ieee uae";; - ieee) FPE_CORE_TEST_ORDER="ieee";; - uae) FPE_CORE_TEST_ORDER="uae";; - x86) FPE_CORE_TEST_ORDER="x86";; - *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; - esac -], -[ FPE_CORE_TEST_ORDER="ieee uae" -]) - dnl Addressing modes. AC_ARG_ENABLE(addressing, [ --enable-addressing=AM specify the addressing mode to use [default=fastest]], @@ -182,17 +183,8 @@ AC_CHECK_HEADERS(AvailabilityMacros.h) AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_BIGENDIAN AC_C_CONST AC_C_INLINE -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(long long, 8) -AC_CHECK_SIZEOF(float, 4) -AC_CHECK_SIZEOF(double, 8) -AC_CHECK_SIZEOF(long double, 12) -AC_CHECK_SIZEOF(void *, 4) AC_TYPE_OFF_T dnl These two symbols are not defined in 10.1's autoconf: dnl AC_CHECK_TYPE(loff_t, off_t) @@ -968,245 +960,27 @@ if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then fi fi -dnl Select appropriate CPU source and REGPARAM define. -ASM_OPTIMIZATIONS=none -CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" - -dnl Other platforms should define their own set of noflags file variants -CAN_JIT=no -if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then - dnl i386 CPU - DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\"" - if [[ "x$HAVE_GAS" = "xyes" ]]; then - ASM_OPTIMIZATIONS=i386 - DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE" - CAN_JIT=yes - fi -elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then - dnl x86-64 CPU - DEFINES="$DEFINES -DUNALIGNED_PROFITABLE" - if [[ "x$HAVE_GAS" = "xyes" ]]; then - ASM_OPTIMIZATIONS="x86-64" - DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" - CAN_JIT=yes +dnl Make sure we can enable JIT debug mode. +if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then + if [[ ":$WANT_JIT:$WANT_MON:" != ":yes:yes:" ]]; then + AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug]) + WANT_JIT_DEBUG=no fi fi -dnl Enable JIT compiler, if possible. -if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then - if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then - if [[ "x$WANT_MON" = "xno" ]]; then - AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug]) - WANT_JIT_DEBUG=no - fi - fi - - dnl IEEE core is the only FPU emulator to use with the JIT compiler - case $FPE_CORE_TEST_ORDER in - ieee*) ;; - *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;; - esac - FPE_CORE_TEST_ORDER="ieee" -else - WANT_JIT=no - WANT_JIT_DEBUG=no - JITSRCS="" -fi - -dnl Utility macro used by next two tests. -dnl AC_EXAMINE_OBJECT(C source code, -dnl commands examining object file, -dnl [commands to run if compile failed]): -dnl -dnl Compile the source code to an object file; then convert it into a -dnl printable representation. All unprintable characters and -dnl asterisks (*) are replaced by dots (.). All white space is -dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the -dnl output, but runs of newlines are compressed to a single newline. -dnl Finally, line breaks are forcibly inserted so that no line is -dnl longer than 80 columns and the file ends with a newline. The -dnl result of all this processing is in the file conftest.dmp, which -dnl may be examined by the commands in the second argument. -dnl -AC_DEFUN([gcc_AC_EXAMINE_OBJECT], -[AC_LANG_SAVE -AC_LANG_C -dnl Next bit cribbed from AC_TRY_COMPILE. -cat > conftest.$ac_ext < conftest.dmp - $2 -ifelse($3, , , else - $3 -)dnl -fi -rm -rf conftest* -AC_LANG_RESTORE]) - -dnl Floating point format probe. -dnl The basic concept is the same as the above: grep the object -dnl file for an interesting string. We have to watch out for -dnl rounding changing the values in the object, however; this is -dnl handled by ignoring the least significant byte of the float. -dnl -dnl Does not know about VAX G-float or C4x idiosyncratic format. -dnl It does know about PDP-10 idiosyncratic format, but this is -dnl not presently supported by GCC. S/390 "binary floating point" -dnl is in fact IEEE (but maybe we should have that in EBCDIC as well -dnl as ASCII?) -dnl -AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], -[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, -[gcc_AC_EXAMINE_OBJECT( -[/* This will not work unless sizeof(double) == 8. */ -extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; - -/* This structure must have no internal padding. */ -struct possibility { - char prefix[8]; - double candidate; - char postfix[8]; -}; - -#define C(cand) { "\nformat:", cand, ":tamrof\n" } -struct possibility table [] = -{ - C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ - C( 3.53802595280598432000e+18), /* D__float - VAX */ - C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ - C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ - C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ -};], - [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='VAX D-float' - elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='PDP-10' - elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IBM 370 hex' - else - AC_MSG_ERROR(Unknown floating point format) - fi], - [AC_MSG_ERROR(compile failed)]) -]) -# IEEE is the default format. If the float endianness isn't the same -# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN -# (which is a tristate: yes, no, default). This is only an issue with -# IEEE; the other formats are only supported by a few machines each, -# all with the same endianness. -format=IEEE_FLOAT_FORMAT -fbigend= -case $ac_cv_c_float_format in - 'IEEE (big-endian)' ) - if test $ac_cv_c_bigendian = no; then - fbigend=1 - fi - ;; - 'IEEE (little-endian)' ) - if test $ac_cv_c_bigendian = yes; then - fbigend=0 - fi - ;; - 'VAX D-float' ) - format=VAX_FLOAT_FORMAT - ;; - 'PDP-10' ) - format=PDP10_FLOAT_FORMAT - ;; - 'IBM 370 hex' ) - format=IBM_FLOAT_FORMAT - ;; -esac -AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, - [Define to the floating point format of the host machine.]) -if test -n "$fbigend"; then - AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, - [Define to 1 if the host machine stores floating point numbers in - memory with the word containing the sign bit at the lowest address, - or to 0 if it does it the other way around. - - This macro should not be defined if the ordering is the same as for - multi-word integers.]) -fi -]) - -dnl Select appropriate FPU source. -gcc_AC_C_FLOAT_FORMAT +dnl Additionnal checks for the IEEE FPU emulation code. AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) - -for fpe in $FPE_CORE_TEST_ORDER; do - case $fpe in - ieee) - case $ac_cv_c_float_format in - IEEE*) - FPE_CORE="IEEE fpu core" - DEFINES="$DEFINES -DFPU_IEEE" - AC_DEFINE(FPU_IEEE, 1, [Floating Point Core emulation method is IEEE.]) - FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" - dnl Math functions not mandated by C99 standard - AC_CHECK_FUNCS(isnanl isinfl) - dnl Math functions required by C99 standard, but probably not - dnl implemented everywhere. In that case, we fall back to the - dnl regular variant for doubles. - AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl) - AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl) - AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl) - AC_CHECK_FUNCS(floorl ceill) - break - ;; - esac - ;; - x86) - if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then - FPE_CORE="i387 fpu core" - DEFINES="$DEFINES -DFPU_X86" - FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" - break - fi - ;; - uae) - FPE_CORE="uae fpu core" - DEFINES="$DEFINES -DFPU_UAE" - AC_DEFINE(FPU_UAE, 1, [Floating Point Core emulation is standard UAE.]) - FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" - break - ;; - *) - AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) - ;; - esac -done -if [[ "x$FPE_CORE" = "x" ]]; then - AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) -fi - -dnl Check for certain math functions AC_CHECK_FUNCS(atanh) AC_CHECK_FUNCS(isnan isinf finite isnormal signbit) - -dnl UAE CPU sources for all non-m68k-native architectures. - CPUINCLUDES="-I../uae_cpu" - CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS" +dnl Math functions not mandated by C99 standard +AC_CHECK_FUNCS(isnanl isinfl) +dnl Math functions required by C99 standard, but probably not +dnl implemented everywhere. In that case, we fall back to the +dnl regular variant for doubles. +AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl) +AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl) +AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl) +AC_CHECK_FUNCS(floorl ceill) dnl Remove the "-g" option if set for GCC. if [[ "x$HAVE_GCC27" = "xyes" ]]; then @@ -1214,14 +988,6 @@ if [[ "x$HAVE_GCC27" = "xyes" ]]; then CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'` fi -dnl Or if we have -IPA (MIPSPro compilers) -if [[ "x$HAVE_IPA" = "xyes" ]]; then - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" - CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" - CXXFLAGS="-LANG:std $CXXFLAGS" - LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" -fi - dnl dnl Some Mac OS X specific stuff: dnl @@ -1242,14 +1008,18 @@ else IDEARGS="" fi -AC_DEFINE(HAVE_SLIRP, 1, [Try to compile network emulation library!]) +dnl Universal binaries +if [[ -z "$WANT_UNIVERSAL" ]]; then + WANT_UNIVERSAL=`echo $target_cpu | sed -e 's/i.86/i386/'` +fi +AC_SUBST(TARGET_ARCHES, [$WANT_UNIVERSAL]) + AC_DEFINE(DATADIR, "~", [unix_ether needs this!]) dnl Generate Makefile. AC_SUBST(DEFINES) AC_SUBST(MONSRCS) AC_SUBST(CPUINCLUDES) -AC_SUBST(CPUSRCS) AC_SUBST(BLESS) AC_SUBST(IDE) AC_SUBST(PROJECT) @@ -1267,13 +1037,12 @@ dnl Print summary. echo echo Basilisk II configuration summary: echo +echo Build binaries for ..................... : $WANT_UNIVERSAL echo Multiple emulator windows .............. : $ENABLE_MULTIPLE echo Enable video on SEGV signals ........... : $WANT_VOSF echo mon debugger support ................... : $WANT_MON echo Build JIT compiler ..................... : $WANT_JIT echo Build JIT with debug code .............. : $WANT_JIT_DEBUG -echo Floating-Point emulation core .......... : $FPE_CORE -echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS echo Addressing mode ........................ : $ADDRESSING_MODE echo Bad memory access recovery type ........ : $sigsegv_recovery echo Mac OS X development environment ....... : $IDE