initial attempt at adding os2 support to autotools

This commit is contained in:
Ozkan Sezer 2021-12-01 01:55:56 +03:00
parent 3355464079
commit efa1aa9a8f
3 changed files with 106 additions and 3 deletions

View File

@ -3183,6 +3183,21 @@ CheckWINDOWS()
CheckStackBoundary 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 dnl Find the DirectX includes and libraries
CheckDIRECTX() CheckDIRECTX()
{ {
@ -4381,6 +4396,78 @@ case "$host" in
have_timers=yes have_timers=yes
fi 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([ AC_MSG_ERROR([
*** Unsupported host: Please add to configure.ac *** Unsupported host: Please add to configure.ac

View File

@ -235,14 +235,22 @@ testnative$(EXE): $(srcdir)/testnative.c \
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@
endif 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 #there's probably a better way of doing this
ifeq (@ISMACOSX@,false) ifeq (@ISMACOSX@,false)
ifeq (@ISWINDOWS@,false) ifeq (@ISWINDOWS@,false)
ifeq (@ISUNIX@,false) ifeq (@ISUNIX@,false)
ifeq (@ISOS2@,false)
testnative$(EXE): ; testnative$(EXE): ;
endif endif
endif endif
endif endif
endif
testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) $(CC) -o $@ $^ $(CFLAGS) $(LIBS)

View File

@ -18,6 +18,7 @@ dnl (Haiku, for example, sets none of these.)
ISUNIX="false" ISUNIX="false"
ISWINDOWS="false" ISWINDOWS="false"
ISMACOSX="false" ISMACOSX="false"
ISOS2="false"
dnl Figure out which math library to use dnl Figure out which math library to use
case "$host" in case "$host" in
@ -32,7 +33,7 @@ case "$host" in
MATHLIB="" MATHLIB=""
SYS_GL_LIBS="-lGL" SYS_GL_LIBS="-lGL"
;; ;;
*-*-darwin* ) *-*-darwin*)
ISMACOSX="true" ISMACOSX="true"
EXE="" EXE=""
MATHLIB="" MATHLIB=""
@ -64,17 +65,23 @@ case "$host" in
MATHLIB="" MATHLIB=""
SYS_GL_LIBS="-lGLES_CM" SYS_GL_LIBS="-lGLES_CM"
;; ;;
*-*-emscripten* ) *-*-emscripten*)
dnl This should really be .js, but we need to specify extra flags when compiling to js dnl This should really be .js, but we need to specify extra flags when compiling to js
EXE=".bc" EXE=".bc"
MATHLIB="" MATHLIB=""
SYS_GL_LIBS="" SYS_GL_LIBS=""
;; ;;
*-*-riscos* ) *-*-riscos*)
EXE=",e1f" EXE=",e1f"
MATHLIB="" MATHLIB=""
SYS_GL_LIBS="" SYS_GL_LIBS=""
;; ;;
*-*-os2*)
ISOS2="true"
EXE=".exe"
MATHLIB=""
SYS_GL_LIBS=""
;;
*) *)
dnl Oh well, call it Unix... dnl Oh well, call it Unix...
ISUNIX="true" ISUNIX="true"
@ -90,6 +97,7 @@ AC_SUBST(MATHLIB)
AC_SUBST(ISMACOSX) AC_SUBST(ISMACOSX)
AC_SUBST(ISWINDOWS) AC_SUBST(ISWINDOWS)
AC_SUBST(ISUNIX) AC_SUBST(ISUNIX)
AC_SUBST(ISOS2)
dnl Check for SDL dnl Check for SDL
SDL_VERSION=2.0.18 SDL_VERSION=2.0.18