Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pmandin: Added Atari LDG shared object loader
  • Loading branch information
pmandin committed Jul 16, 2003
1 parent d385590 commit 861d798
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.MiNT
Expand Up @@ -51,6 +51,7 @@ Timer (VBL vector, GNU pth library)
Joystick and joypad support (Ikbd, Hardware)
Audio support (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled)
Threads support (Multitasking OS only via GNU pth library)
Shared object support (using LDG library from http://ldg.atari.org/)

- What is missing:
CDROM support (Metados, /dev/cdrom)
Expand Down
27 changes: 22 additions & 5 deletions configure.in
Expand Up @@ -380,7 +380,7 @@ CheckARTSC()
AC_MSG_RESULT($audio_arts)
if test x$audio_arts = xyes; then
AC_ARG_ENABLE(arts-shared,
[ --enable-arts-shared dynamically load aRts audio support [default=no]],
[ --enable-arts-shared dynamically load aRts audio support [default=no]],
, enable_arts_shared=no)
arts_lib_spec=`echo $ARTSC_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libartsc.so.*/'`
arts_lib=`ls $arts_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
Expand Down Expand Up @@ -408,7 +408,7 @@ dnl See if the NAS audio interface is supported
CheckNAS()
{
AC_ARG_ENABLE(nas,
[ --enable-nas support the NAS audio API [default=yes]],
[ --enable-nas support the NAS audio API [default=yes]],
, enable_nas=yes)
if test x$enable_audio = xyes -a x$enable_nas = xyes; then
AC_MSG_CHECKING(for NAS audio support)
Expand Down Expand Up @@ -438,7 +438,7 @@ dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
AC_ARG_ENABLE(diskaudio,
[ --enable-diskaudio support the disk writer audio driver [default=yes]],
[ --enable-diskaudio support the disk writer audio driver [default=yes]],
, enable_diskaudio=yes)
if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
Expand Down Expand Up @@ -776,7 +776,7 @@ dnl Find DirectFB
CheckDirectFB()
{
AC_ARG_ENABLE(video-directfb,
[ --enable-video-directfb use DirectFB video driver [default=yes]],
[ --enable-video-directfb use DirectFB video driver [default=yes]],
, enable_video_directfb=yes)
if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
video_directfb=no
Expand Down Expand Up @@ -899,7 +899,7 @@ dnl Find the VGL includes and libraries
CheckVGL()
{
AC_ARG_ENABLE(video-vgl,
[ --enable-video-vgl use VGL video driver [default=no]],
[ --enable-video-vgl use VGL video driver [default=no]],
, enable_video_vgl=no)
if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
AC_MSG_CHECKING(for libVGL support)
Expand Down Expand Up @@ -1577,6 +1577,22 @@ CheckDLOPEN()
fi
}

dnl Set up the Atari LDG (shared object loader)
CheckAtariLdg()
{
AC_ARG_ENABLE(atari-ldg,
[ --enable-atari-ldg use Atari LDG for shared object loading [default=yes]],
, enable_atari_ldg=yes)
if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
CFLAGS="$CFLAGS -DENABLE_LDG"
SYSTEM_LIBS="$SYSTEM_LIBS -lldg"
fi
fi
}

dnl Check for the usbhid(3) library on *BSD
CheckUSBHID()
{
Expand Down Expand Up @@ -2429,6 +2445,7 @@ case "$target" in
CheckAtariXbiosVideo
CheckAtariGemVideo
CheckAtariAudio
CheckAtariLdg
CheckPTH
# Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c)
Expand Down
12 changes: 12 additions & 0 deletions src/SDL_loadso.c
Expand Up @@ -40,6 +40,9 @@ static char rcsid =
# include <Strings.h>
# include <CodeFragments.h>
# include <Errors.h>
#elif defined(__MINT__) && defined(ENABLE_LDG)
# include <gem.h>
# include <ldg.h>
#else
/*#error Unsupported dynamic link environment*/
#endif /* system type */
Expand Down Expand Up @@ -113,6 +116,9 @@ void *SDL_LoadObject(const char *sofile)
if ( loaderror == NULL ) {
handle = (void *)(library_id);
}
#elif defined(__MINT__) && defined(ENABLE_LDG)
/* * */
handle = (void *)ldg_open((char *)sofile, ldg_global);
#endif /* system type */

if ( handle == NULL ) {
Expand Down Expand Up @@ -163,6 +169,9 @@ void *SDL_LoadFunction(void *handle, const char *name)
(char **)&symbol, &class) != noErr ) {
loaderror = "Symbol not found";
}
#elif defined(__MINT__) && defined(ENABLE_LDG)
/* * */
symbol = (void *)ldg_find((char *)name, (LDG *)handle);
#endif /* system type */

if ( symbol == NULL ) {
Expand Down Expand Up @@ -193,5 +202,8 @@ void SDL_UnloadObject(void *handle)
/* * */
CFragConnectionID library_id = (CFragConnectionID)handle;
CloseConnection(library_id);
#elif defined(__MINT__) && defined(ENABLE_LDG)
/* * */
ldg_close((LDG *)handle, ldg_global);
#endif /* system type */
}

0 comments on commit 861d798

Please sign in to comment.