2014-01-23 04:42:34 +00:00
dnl ---------------------------------------------------------------------------
2014-10-25 15:12:51 +00:00
AC_DEFINE(PACKAGE_URL, "https://github.com/mauiaaron/apple2", [apple2ix project URL])
2014-01-23 04:42:34 +00:00
AC_PREREQ([2.69])
AC_INIT([apple2ix], [0.8])
2014-06-07 18:24:53 +00:00
AC_CANONICAL_TARGET
2014-01-23 04:42:34 +00:00
AM_INIT_AUTOMAKE([foreign subdir-objects])
2014-03-23 21:21:31 +00:00
dnl AM_CONFIG_HEADER(src/config.h) -- disable config.h because it makes it difficult/impossible to do modular builds for the test suite
2014-01-23 04:42:34 +00:00
AC_PROG_CC([clang gcc])
AM_PROG_CC_C_O dnl apparently required for custom font.c target?
AM_PROG_AS
AC_PROG_INSTALL
dnl ---------------------------------------------------------------------------
2014-06-07 18:24:53 +00:00
dnl Arch checks
2014-06-08 18:01:38 +00:00
ASM_O="src/x86/glue.o src/x86/cpu.o"
2014-10-11 23:53:32 +00:00
TESTVM_ASM_O="src/x86/testvm-glue.o src/x86/testvm-cpu.o"
2014-12-28 22:50:43 +00:00
TESTDISK_ASM_O="src/x86/testdisk-glue.o src/x86/testdisk-cpu.o"
2014-06-07 18:24:53 +00:00
arch=''
case $target in
x86_64-*-*)
arch='x64'
;;
i?86-*-*)
arch='x86'
;;
x86*)
dnl support shorthand ./configure --target=x86
arch='x86'
;;
*)
2014-06-08 18:01:38 +00:00
ASM_O=""
2014-06-07 18:24:53 +00:00
AC_MSG_ERROR([emulator does not presently support architecture $target])
;;
esac
AM_CFLAGS="-std=gnu11 -Wall"
dnl double-check compilation for x86 target
if test "$arch" = "x86" ; then
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
2014-01-23 04:42:34 +00:00
2014-06-07 18:24:53 +00:00
AC_SUBST(ASM_O)
2014-10-11 23:53:32 +00:00
AC_SUBST(TESTVM_ASM_O)
2014-12-28 22:50:43 +00:00
AC_SUBST(TESTDISK_ASM_O)
2014-01-23 04:42:34 +00:00
AC_SUBST([AM_CFLAGS])
2014-06-07 18:24:53 +00:00
dnl OS Check
2014-01-23 04:42:34 +00:00
AC_EGREP_CPP(unsupported_, [
#if defined(__ANDROID__)
unsupported_for_now
#elif __APPLE__
unsupported_for_now
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
#elif TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#else
#endif
#elif __linux
linux
#elif __unix
2014-06-07 18:24:53 +00:00
unix
2014-01-23 04:42:34 +00:00
#elif __posix
2014-06-07 18:24:53 +00:00
posix
#else
unknown
2014-01-23 04:42:34 +00:00
#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...])
], [
AC_MSG_NOTICE([Underscores in assembly linkage not allowed...])
AC_DEFINE(NO_UNDERSCORES, 1, [Underscores allowed in assembly linkage])
])
dnl ---------------------------------------------------------------------------
AM_PROG_LEX
dnl AS_IF([test "x$LEX" = "xno"], [
dnl AC_MSG_ERROR([Emulator needs lex/flex to build source...])
dnl ], [
2014-09-17 03:49:57 +00:00
dnl AC_MSG_RESULT([Found lex $LEX])
2014-01-23 04:42:34 +00:00
dnl ])
dnl POSIX high-precision clock
AC_SEARCH_LIBS(clock_gettime, rt, [], [
AC_MSG_ERROR([Emulator needs realtime clocks (-lrt) to build...])
], [])
AC_CHECK_HEADER(zlib.h, [], [
AC_MSG_ERROR([Emulator requires zlib headers to build...])
])
AC_SEARCH_LIBS(gzopen, z, [], [
AC_MSG_ERROR([Emulator requires zlib library to build...])
], [])
AC_CHECK_HEADER(pthread.h, [], [
AC_MSG_ERROR([Emulator requires pthread headers to build...])
])
AC_SEARCH_LIBS(pthread_create, pthread, [], [
AC_MSG_ERROR([Emulator requires pthread library to build...])
], [])
2014-09-17 03:49:57 +00:00
AC_SEARCH_LIBS(sqrtf, m, [], [
AC_MSG_ERROR([Emulator requires math library to build...])
], [])
2014-01-23 04:42:34 +00:00
dnl ---------------------------------------------------------------------------
dnl Video ...
AC_PATH_XTRA
2014-09-17 03:49:57 +00:00
opengl_selected='yes'
AC_ARG_ENABLE([opengl], AS_HELP_STRING([--disable-opengl], [Disable OpenGL video driver (uses regular X11)]), [
opengl_selected='no'
], [
AC_CHECK_HEADER(GL/glew.h, [
AC_CHECK_HEADER(GL/freeglut.h, [
AC_SEARCH_LIBS(glCreateProgram, [GL], [
AC_SEARCH_LIBS(glutMainLoop, [glut freeglut], [
AC_SEARCH_LIBS(glewInit, [GLEW glew], [
opengl_supported='yes'
AC_DEFINE(VIDEO_OPENGL, 1, [Use OpenGL])
2014-10-08 05:05:14 +00:00
AC_DEFINE(USE_GLUT, 1, [Use GLUT library])
2015-04-12 21:20:17 +00:00
VIDEO_O="src/video/glvideo.o src/video/glanimation.o src/video/glcpuanim.o src/video/glhudmodel.o src/video/glutinput.o src/video_util/matrixUtil.o src/video_util/modelUtil.o src/video_util/sourceUtil.o src/video_util/vectorUtil.o"
2014-09-17 03:49:57 +00:00
AC_MSG_RESULT([Building emulator with OpenGL support, w00t!])
], [
AC_MSG_WARN([Did not find OpenGL GLEW library...])
], [-lGL -lGLEW -lglut])
], [
AC_MSG_WARN([Did not find glut library...])
], [-lGL -lGLEW -lglut])
], [
AC_MSG_WARN([Did not find OpenGL library...])
], [-lGL])
], [
AC_MSG_WARN([Did not find GL/freeglut.h header ...])
])
], [
AC_MSG_WARN([Did not find GL/glew.h header ...])
])
2014-01-23 04:42:34 +00:00
])
2014-09-17 03:49:57 +00:00
AS_IF([test "x$opengl_supported" = "xyes"], [
2014-01-23 04:42:34 +00:00
], [
2014-09-17 03:49:57 +00:00
dnl OpenGL not supported
AS_IF([test "x$opengl_selected" = "xyes"], [
AC_MSG_WARN([Did not find OpenGL libraries, will attempt to build legacy X11 variant ...])
], [])
AC_CHECK_HEADER(X11/XKBlib.h, [
AC_SEARCH_LIBS(XPutImage, [X11], [
AC_SEARCH_LIBS(XShmAttach, Xext, [
AC_DEFINE(HAVE_X11_SHM, 1, [Enable X11 MIT SHM extension])
], [
AC_MSG_WARN([Building emulator without support of X11 MITSHM extension...])
], [-lX11])
VIDEO_O="src/video/xvideo.o"
], [
AC_MSG_ERROR([Did not find OpenGL nor X11 libraries...])
], [-LX11])
], [
AC_MSG_ERROR([Did not find OpenGL nor X11 headers...])
])
])
2014-01-23 04:42:34 +00:00
AC_SUBST(VIDEO_O)
2014-04-26 20:22:19 +00:00
AC_DEFINE(HEADLESS, 0, [Set to 1 to disable video output driver])
2014-01-23 04:42:34 +00:00
dnl ---------------------------------------------------------------------------
dnl Sound ...
AC_ARG_ENABLE([audio], AS_HELP_STRING([--disable-audio], [Disable emulator audio output]), [], [
AC_CHECK_HEADER(AL/al.h, [
AC_CHECK_HEADER(AL/alc.h, [
AC_CHECK_HEADER(AL/alext.h, [
AC_SEARCH_LIBS(alcOpenDevice, openal, [
dnl found OpenAL ...
AC_DEFINE(AUDIO_OPENAL, 1, [Enable OpenAL audio output])
AC_DEFINE(AUDIO_ENABLED, 1, [Enable sound module])
2015-01-31 21:57:10 +00:00
AUDIO_GLUE_C="src/audio/speaker.c src/audio/mockingboard.c"
2014-01-23 04:42:34 +00:00
AUDIO_O="src/audio/soundcore.o src/audio/soundcore-openal.o src/audio/speaker.o src/audio/win-shim.o src/audio/alhelpers.o src/audio/mockingboard.o src/audio/AY8910.o"
], [
AC_MSG_WARN([Could not find OpenAL libraries, sound will be disabled])
], [])
], [
AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled])
], [
#include <AL/al.h>
#include <AL/alc.h>
2014-03-30 17:37:34 +00:00
])
2014-01-23 04:42:34 +00:00
], [
AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled])
])
], [
AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled])
])
])
AC_SUBST(AUDIO_GLUE_C)
AC_SUBST(AUDIO_O)
dnl AS_IF([test "x$audio_disabled" = "xno"], [
dnl ...
dnl ])
dnl ---------------------------------------------------------------------------
2014-03-23 21:21:31 +00:00
dnl Debugger & classic interface ...
2014-01-23 04:42:34 +00:00
AC_ARG_ENABLE([debugger], AS_HELP_STRING([--disable-debugger], [Disable 6502 debugging console]), [], [
AC_DEFINE(DEBUGGER, 1, [Enable 6502 debugger module])
2015-02-18 21:42:28 +00:00
META_O="src/meta/debug.o src/meta/debugger.o src/meta/opcodes.o src/test/sha1.o"
2014-01-23 04:42:34 +00:00
])
AC_SUBST(META_O)
2014-03-23 21:21:31 +00:00
INTERFACE_O="src/interface.o"
AC_SUBST(INTERFACE_O)
AC_DEFINE(INTERFACE_CLASSIC, 1, [Use the classic menu interface])
2014-01-23 04:42:34 +00:00
dnl ---------------------------------------------------------------------------
dnl Misc ...
AC_DEFINE(APPLE2IX, 1, [Denotes a section of code as Apple//ix sourced, used with external sources])
AC_DEFINE(KEYPAD_JOYSTICK, 1, [Joystick emulated on keyboard ... should not be true on mobile devices])
2015-03-10 02:54:05 +00:00
AC_DEFINE(CONFORMANT_TRACKS, 1, [Conformant to Applewin, and apparently also to the original //e disk timing, but hella-slow on low-end mobile devices])
2014-01-23 04:42:34 +00:00
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES([Makefile])
AC_OUTPUT