mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-09 14:29:23 +00:00
Autotools builds on Mac somewhat
This commit is contained in:
parent
85dc4e5132
commit
2d5c47d534
@ -79,7 +79,6 @@ apple2ix_SOURCES = \
|
||||
|
||||
apple2ix_CFLAGS = @AM_CFLAGS@ @X_CFLAGS@
|
||||
apple2ix_CCASFLAGS = $(apple2ix_CFLAGS)
|
||||
apple2ix_LDFLAGS = -Wl,-z,noexecstack
|
||||
apple2ix_LDADD = @ASM_O@ @VIDEO_O@ @AUDIO_O@ @X_LIBS@
|
||||
apple2ix_DEPENDENCIES = @ASM_O@ @VIDEO_O@ @AUDIO_O@
|
||||
|
||||
|
36
configure.ac
36
configure.ac
@ -92,36 +92,6 @@ AC_SUBST(testvm_ASM_O)
|
||||
AC_SUBST([AM_CFLAGS])
|
||||
|
||||
|
||||
dnl OS Check
|
||||
AC_EGREP_CPP(unsupported_, [
|
||||
#if defined(__ANDROID__)
|
||||
unsupported_for_now
|
||||
#elif __APPLE__
|
||||
unsupported_for_now
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_SIMULATOR
|
||||
#elif TARGET_OS_IPHONE
|
||||
#elif TARGET_OS_MAC
|
||||
#else
|
||||
#endif
|
||||
#elif __linux
|
||||
linux
|
||||
#elif __unix
|
||||
unix
|
||||
#elif __posix
|
||||
posix
|
||||
#else
|
||||
unknown
|
||||
#endif
|
||||
], [
|
||||
AC_MSG_CHECKING([Operating System ])
|
||||
AC_MSG_RESULT([unsupported])
|
||||
AC_MSG_ERROR([Apparently you have an unsupported OS, build aborted])
|
||||
], [
|
||||
AC_MSG_CHECKING([Operating System ])
|
||||
AC_MSG_RESULT([supported])
|
||||
])
|
||||
|
||||
dnl ASM underscore linking test
|
||||
AC_TRY_LINK([asm("_glibc_foobar:");], [glibc_foobar()], [
|
||||
AC_MSG_NOTICE([Underscores in assembly linkage allowed...])
|
||||
@ -133,6 +103,12 @@ AC_TRY_LINK([asm("_glibc_foobar:");], [glibc_foobar()], [
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl CLI builds extra search areas ...
|
||||
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
|
||||
CFLAGS="$CFLAGS -I/opt/local/include"
|
||||
CXXFLAGS="$CXXFLAGS -I/opt/local/include"
|
||||
LDFLAGS="$LDFLAGS -L/opt/local/lib"
|
||||
|
||||
# Sometimes Flex is installed as Lex, e.g., NetBSD.
|
||||
AC_CHECK_PROG([FLEX], [flex lex], [flex])
|
||||
# Force the use of `missing' to wrap Flex invocations.
|
||||
|
@ -110,7 +110,7 @@ void audio_shutdown(void) {
|
||||
void audio_pause(void) {
|
||||
// CPU thread owns audio lifecycle (see note above)
|
||||
// Deadlock on Kindle Fire 1st Gen if audio_pause() and audio_resume() happen off CPU thread ...
|
||||
#ifdef __APPLE__
|
||||
#if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
# warning FIXME TODO : this assert is firing on iOS port ... but the assert is valid ... fix soon
|
||||
#else
|
||||
assert(pthread_self() == cpu_thread_id);
|
||||
|
38
src/common.h
38
src/common.h
@ -16,21 +16,6 @@
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# warning DEFINING CUSTOM TEMP_FAILURE_RETRY(x) macro
|
||||
# define TEMP_FAILURE_RETRY(exp) ({ \
|
||||
typeof (exp) _rc; \
|
||||
do { \
|
||||
_rc = (exp); \
|
||||
if (_rc == -1 && (errno == EINTR || errno == EAGAIN) ) { \
|
||||
usleep(10); \
|
||||
} else { \
|
||||
break; \
|
||||
} \
|
||||
} while (1); \
|
||||
_rc; })
|
||||
#endif
|
||||
|
||||
// custom annotations
|
||||
#define INOUT
|
||||
#define INPARM
|
||||
@ -84,9 +69,11 @@
|
||||
|
||||
#include "meta/trace.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "darwin-shim.h"
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#if __APPLE__
|
||||
# include "meta/darwin-shim.h"
|
||||
# if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
# import <CoreFoundation/CoreFoundation.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if VIDEO_OPENGL
|
||||
@ -154,4 +141,19 @@
|
||||
#define LIKELY(x) __builtin_expect((x), true)
|
||||
#define UNLIKELY(x) __builtin_expect((x), false)
|
||||
|
||||
#if !defined(TEMP_FAILURE_RETRY)
|
||||
# define TEMP_FAILURE_RETRY(exp) ({ \
|
||||
typeof (exp) _rc; \
|
||||
do { \
|
||||
_rc = (exp); \
|
||||
if (_rc == -1 && (errno == EINTR || errno == EAGAIN) ) { \
|
||||
usleep(10); \
|
||||
} else { \
|
||||
break; \
|
||||
} \
|
||||
} while (1); \
|
||||
_rc; })
|
||||
#endif
|
||||
|
||||
|
||||
#endif // whole file
|
||||
|
@ -780,7 +780,7 @@ void disk6_init(void) {
|
||||
const char *disk6_eject(int drive) {
|
||||
|
||||
#if !TESTING
|
||||
# if __APPLE__
|
||||
# if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
# warning FIXME TODO ...
|
||||
# else
|
||||
assert(cpu_isPaused() && "CPU must be paused for disk ejection");
|
||||
@ -877,7 +877,7 @@ const char *disk6_eject(int drive) {
|
||||
const char *disk6_insert(int fd, int drive, const char * const file_name, int readonly) {
|
||||
|
||||
#if !TESTING
|
||||
# if __APPLE__
|
||||
# if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
# warning FIXME TODO ...
|
||||
# else
|
||||
assert(cpu_isPaused() && "CPU must be paused for disk insertion");
|
||||
|
@ -1489,7 +1489,11 @@ void c_interface_keyboard_layout()
|
||||
static pthread_mutex_t classic_interface_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_t interface_thread_id = 0;
|
||||
|
||||
static void *interface_thread(void *current_key)
|
||||
typedef struct interface_key_s {
|
||||
int current_key;
|
||||
} interface_key_s;
|
||||
|
||||
static void *interface_thread(void *data)
|
||||
{
|
||||
interface_thread_id = pthread_self();
|
||||
|
||||
@ -1504,7 +1508,9 @@ static void *interface_thread(void *current_key)
|
||||
disk_path[PATH_MAX-1] = '\0';
|
||||
FREE(path);
|
||||
|
||||
switch ((__SWORD_TYPE)current_key) {
|
||||
interface_key_s *interface_key = (interface_key_s *)data;
|
||||
|
||||
switch (interface_key->current_key) {
|
||||
case kF1:
|
||||
c_interface_select_diskette( 0 );
|
||||
break;
|
||||
@ -1550,12 +1556,15 @@ static void *interface_thread(void *current_key)
|
||||
|
||||
void c_interface_begin(int current_key)
|
||||
{
|
||||
static interface_key_s interface_key = { 0 };
|
||||
|
||||
if (interface_thread_id) {
|
||||
return;
|
||||
}
|
||||
pthread_mutex_lock(&classic_interface_lock);
|
||||
interface_thread_id=1; // interface thread starting ...
|
||||
pthread_create(&interface_thread_id, NULL, (void *)&interface_thread, (void *)((__SWORD_TYPE)current_key));
|
||||
interface_key.current_key = current_key;
|
||||
pthread_create(&interface_thread_id, NULL, (void *)&interface_thread, &interface_key);
|
||||
pthread_detach(interface_thread_id);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if __APPLE__
|
||||
|
||||
#include "common.h"
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
@ -40,3 +42,6 @@ int my_clock_gettime(int clk_id, struct timespec *tp) {
|
||||
tp->tv_nsec = diff - (tp->tv_sec * ORWL_GIGA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +66,7 @@ int _a2_asprintf(char **strp, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
#define CFRELEASE(x) \
|
||||
do { \
|
||||
CFRelease((x)); \
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define TRACE_TOUCH 0
|
||||
|
||||
#if !defined(__linux__)
|
||||
# warning Linux-specific function call tracing and general profiling not enabled
|
||||
// TODO FIXME ... implement systrace ...
|
||||
#else
|
||||
|
||||
extern void _trace_cleanup(void *token);
|
||||
|
@ -44,7 +44,7 @@ static void _init_common(void) {
|
||||
static __attribute__((constructor)) void __init_common(void) {
|
||||
emulator_registerStartupCallback(CTOR_PRIORITY_FIRST, &_init_common);
|
||||
}
|
||||
#elif defined(ANDROID) || defined(__APPLE__)
|
||||
#elif defined(ANDROID) || (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
// data_dir is set up elsewhere
|
||||
#else
|
||||
# error "Specify a CONFIG_DATADIR and PACKAGE_NAME"
|
||||
@ -237,7 +237,7 @@ bool emulator_loadState(int fd, int fdA, int fdB) {
|
||||
}
|
||||
|
||||
if (UNLIKELY(filePos != fileSiz)) {
|
||||
LOG("OOPS, state file read: %lu total: %lu", filePos, fileSiz);
|
||||
LOG("OOPS, state file read: %lu total: %lu", (unsigned long)filePos, (unsigned long)fileSiz);
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
@ -375,7 +375,7 @@ void emulator_start(void) {
|
||||
c_keys_set_key(kF8); // show credits before emulation start
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(ANDROID)
|
||||
#if !(TARGET_OS_MAC || TARGET_OS_PHONE) && !defined(ANDROID)
|
||||
video_init();
|
||||
#endif
|
||||
|
||||
@ -394,7 +394,7 @@ bool emulator_isShuttingDown(void) {
|
||||
return emulatorShuttingDown;
|
||||
}
|
||||
|
||||
#if !defined(__APPLE__) && !defined(ANDROID)
|
||||
#if !(TARGET_OS_MAC || TARGET_OS_PHONE) && !defined(ANDROID)
|
||||
int main(int _argc, char **_argv) {
|
||||
argc = _argc;
|
||||
argv = _argv;
|
||||
|
@ -71,7 +71,7 @@ void test_common_init(void) {
|
||||
c_debugger_set_timeout(0);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
# define PATHS_COUNT 8
|
||||
char **_copy_paths_mac(const char *fileName) {
|
||||
const char *fmts[PATHS_COUNT + 1] = {
|
||||
@ -208,7 +208,7 @@ char **_copy_paths_main(const char *fileName) {
|
||||
#endif
|
||||
|
||||
char **test_copy_disk_paths(const char *fileName) {
|
||||
#if defined(__APPLE__)
|
||||
#if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
return _copy_paths_mac(fileName);
|
||||
#else
|
||||
return _copy_paths_main(fileName);
|
||||
@ -217,7 +217,7 @@ char **test_copy_disk_paths(const char *fileName) {
|
||||
|
||||
int test_setup_boot_disk(const char *fileName, int readonly) {
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
char **paths = _copy_paths_mac(fileName);
|
||||
#else
|
||||
char **paths = _copy_paths_main(fileName);
|
||||
|
@ -46,7 +46,7 @@ void sha1_to_str(const uint8_t * const md, char *buf);
|
||||
static inline int ASSERT_SHA(const char *SHA_STR) {
|
||||
uint8_t md[SHA_DIGEST_LENGTH];
|
||||
|
||||
uint8_t fb = MALLOC(SCANWIDTH*SCANHEIGHT);
|
||||
uint8_t *fb = MALLOC(SCANWIDTH*SCANHEIGHT);
|
||||
display_renderStagingFramebuffer(fb);
|
||||
SHA1(fb, SCANWIDTH*SCANHEIGHT, md);
|
||||
FREE(fb);
|
||||
|
@ -172,7 +172,7 @@ void reinitialize(void) {
|
||||
|
||||
void timing_initialize(void) {
|
||||
#if !TESTING
|
||||
# ifdef __APPLE__
|
||||
# if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
# warning FIXME TODO : this assert is firing on iOS port ... but the assert is valid ... fix soon
|
||||
# else
|
||||
assert(cpu_isPaused() || (pthread_self() == cpu_thread_id));
|
||||
@ -284,7 +284,7 @@ static void *cpu_thread(void *dummyptr) {
|
||||
cpu_runloop:
|
||||
do
|
||||
{
|
||||
LOG("CPUTHREAD %lu LOCKING FOR MAYBE INITIALIZING AUDIO ...", cpu_thread_id);
|
||||
LOG("CPUTHREAD %lu LOCKING FOR MAYBE INITIALIZING AUDIO ...", (unsigned long)cpu_thread_id);
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
if (emul_reinitialize_audio) {
|
||||
emul_reinitialize_audio = false;
|
||||
|
@ -29,7 +29,7 @@ void video_init(void) {
|
||||
video_initialized = true;
|
||||
|
||||
assert(pthread_self() != cpu_thread_id);
|
||||
LOG("(re)setting render_thread_id : %ld -> %ld", render_thread_id, pthread_self());
|
||||
LOG("(re)setting render_thread_id : %lu -> %lu", (unsigned long)render_thread_id, (unsigned long)pthread_self());
|
||||
render_thread_id = pthread_self();
|
||||
|
||||
video_clear();
|
||||
@ -38,7 +38,7 @@ void video_init(void) {
|
||||
}
|
||||
|
||||
void _video_setRenderThread(pthread_t id) {
|
||||
LOG("setting render_thread_id : %ld -> %ld", render_thread_id, id);
|
||||
LOG("setting render_thread_id : %lu -> %lu", (unsigned long)render_thread_id, (unsigned long)id);
|
||||
render_thread_id = id;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#define UNINITIALIZED_GL (-31337) // HACK FIXME TODO : is there an official OpenGL value we can use to signify an uninitialized state? (cannot depend on zero)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
# define USE_VAO 1
|
||||
# import <CoreFoundation/CoreFoundation.h>
|
||||
# import <TargetConditionals.h>
|
||||
|
@ -58,7 +58,7 @@ static demoSource *srcLoadSource(const char *filepathname) {
|
||||
|
||||
demoSource *glshader_createSource(const char *fileName) {
|
||||
demoSource *src = NULL;
|
||||
#if defined(__APPLE__)
|
||||
#if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFStringRef fileString = CFStringCreateWithCString(/*allocator*/NULL, fileName, CFStringGetSystemEncoding());
|
||||
CFURLRef fileURL = CFBundleCopyResourceURL(mainBundle, fileString, NULL, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user