initial attempt at adding os2 support to autotools
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
diff --git a/configure.ac b/configure.ac
index 146beb2..b7f0f66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3183,6 +3183,21 @@ CheckWINDOWS()
CheckStackBoundary
}
+dnl Determine whether the compiler can produce OS/2 executables
+CheckOS2()
+{
+ AC_MSG_CHECKING(OS/2 compiler)
+ have_os2_gcc=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <os2.h>]],
+ [])],[have_os2_gcc=yes],[])
+ AC_MSG_RESULT($have_os2_gcc)
+ if test x$have_os2_gcc != xyes; then
+ AC_MSG_ERROR([
+*** Your compiler ($CC) does not produce OS/2 executables!
+ ])
+ fi
+}
+
dnl Find the DirectX includes and libraries
CheckDIRECTX()
{
@@ -4381,6 +4396,78 @@ case "$host" in
have_timers=yes
fi
;;
+ *-*-os2*)
+ ARCH=os2
+ if test "$build" != "$host"; then # cross-compiling
+ # Default cross-compile location
+ ac_default_prefix=/@unixroot/usr/local/cross-tools/$host
+ else
+ # Look for the location of the tools and install there
+ if test "$BUILD_PREFIX" != ""; then
+ ac_default_prefix=$BUILD_PREFIX
+ fi
+ fi
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -DOS2EMX_PLAIN_CHAR"
+ CheckOS2
+ CheckDeclarationAfterStatement
+ CheckDummyVideo
+ CheckDiskAudio
+ CheckDummyAudio
+
+ # Set up the core platform files
+ SOURCES="$SOURCES $srcdir/src/core/os2/*.c"
+ # FIXME: use system iconv() if available?
+ SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
+ # Use the Unix locale APIs.
+ SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
+ have_locale=yes
+ # Set up files for the video library
+ if test x$enable_video = xyes; then
+ AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/video/os2/*.c"
+ have_video=yes
+ SUMMARY_video="${SUMMARY_video} os/2"
+ fi
+ # Set up files for the audio library
+ if test x$enable_audio = xyes; then
+ AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/audio/os2/*.c"
+ have_audio=yes
+ SUMMARY_audio="${SUMMARY_audio} os/2"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2"
+ fi
+ # Set up files for the thread library
+ if test x$enable_threads = xyes; then
+ AC_DEFINE(SDL_THREAD_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/thread/os2/*.c"
+ SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
+ have_threads=yes
+ fi
+ # Set up files for the timer library
+ if test x$enable_timers = xyes; then
+ AC_DEFINE(SDL_TIMER_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/timer/os2/*.c"
+ have_timers=yes
+ fi
+ # Set up files for the shared object loading library
+ if test x$enable_loadso = xyes; then
+ AC_DEFINE(SDL_LOADSO_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c"
+ have_loadso=yes
+ fi
+ # Set up files for the filesystem library
+ if test x$enable_filesystem = xyes; then
+ AC_DEFINE(SDL_FILESYSTEM_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c"
+ have_filesystem=yes
+ fi
+ # Set up files for the joystick library
+ if test x$enable_joystick = xyes; then
+ AC_DEFINE(SDL_JOYSTICK_OS2, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c"
+ have_joystick=yes
+ fi
+ ;;
*)
AC_MSG_ERROR([
*** Unsupported host: Please add to configure.ac
diff --git a/test/Makefile.in b/test/Makefile.in
index 1e05758..d29dc6e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -235,14 +235,22 @@ testnative$(EXE): $(srcdir)/testnative.c \
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@
endif
+ifeq (@ISOS2@,true)
+testnative$(EXE): $(srcdir)/testnative.c \
+ $(srcdir)/testnativeos2.c
+ $(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+endif
+
#there's probably a better way of doing this
ifeq (@ISMACOSX@,false)
ifeq (@ISWINDOWS@,false)
ifeq (@ISUNIX@,false)
+ifeq (@ISOS2@,false)
testnative$(EXE): ;
endif
endif
endif
+endif
testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
diff --git a/test/configure.ac b/test/configure.ac
index 2f085d6..694551c 100644
--- a/test/configure.ac
+++ b/test/configure.ac
@@ -18,6 +18,7 @@ dnl (Haiku, for example, sets none of these.)
ISUNIX="false"
ISWINDOWS="false"
ISMACOSX="false"
+ISOS2="false"
dnl Figure out which math library to use
case "$host" in
@@ -32,7 +33,7 @@ case "$host" in
MATHLIB=""
SYS_GL_LIBS="-lGL"
;;
- *-*-darwin* )
+ *-*-darwin*)
ISMACOSX="true"
EXE=""
MATHLIB=""
@@ -64,17 +65,23 @@ case "$host" in
MATHLIB=""
SYS_GL_LIBS="-lGLES_CM"
;;
- *-*-emscripten* )
+ *-*-emscripten*)
dnl This should really be .js, but we need to specify extra flags when compiling to js
EXE=".bc"
MATHLIB=""
SYS_GL_LIBS=""
;;
- *-*-riscos* )
+ *-*-riscos*)
EXE=",e1f"
MATHLIB=""
SYS_GL_LIBS=""
;;
+ *-*-os2*)
+ ISOS2="true"
+ EXE=".exe"
+ MATHLIB=""
+ SYS_GL_LIBS=""
+ ;;
*)
dnl Oh well, call it Unix...
ISUNIX="true"
@@ -90,6 +97,7 @@ AC_SUBST(MATHLIB)
AC_SUBST(ISMACOSX)
AC_SUBST(ISWINDOWS)
AC_SUBST(ISUNIX)
+AC_SUBST(ISOS2)
dnl Check for SDL
SDL_VERSION=2.0.18