diff configure.in @ 294:d2d48e10f370

Added a new header file: SDL_loadso.h It contains the following functions: SDL_LoadObject(), SDL_LoadFunction(), SDL_UnloadObject() The UNIX esd and arts audio code use these to dynamically load their respective audio libraries.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 06 Mar 2002 05:20:11 +0000
parents eadc0746dfaf
children 54ad1d2f1325
line wrap: on
line diff
--- a/configure.in	Tue Mar 05 23:19:37 2002 +0000
+++ b/configure.in	Wed Mar 06 05:20:11 2002 +0000
@@ -324,12 +324,26 @@
 [  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
                   , enable_esd=yes)
     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
-        AM_PATH_ESD(0.2.8, [
-            CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
-            SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
+	use_esd=no
+        AM_PATH_ESD(0.2.8, use_esd=yes)
+	if test x$use_esd = xyes; then
+            AC_ARG_ENABLE(esd-shared,
+[  --enable-esd-shared     dynamically load ESD support [default=yes]],
+                          , enable_esd_shared=yes)
+            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
+	    esd_lib=`ls $esd_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
+	    echo "-- $esd_lib_spec -> $esd_lib"
+            if test x$enable_dlopen = xyes && \
+               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
+                CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
+		AC_SUBST(esd_lib)
+            else
+                CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
+                SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
+            fi
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
             AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
-        ])
+        fi
     fi
 }
 
@@ -359,8 +373,20 @@
             CFLAGS="$save_CFLAGS"
             AC_MSG_RESULT($audio_arts)
             if test x$audio_arts = xyes; then
-                CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
-                SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
+                AC_ARG_ENABLE(arts-shared,
+[  --enable-arts-shared     dynamically load ESD support [default=yes]],
+                              , enable_arts_shared=yes)
+                arts_lib_spec=`echo $ARTSC_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libarts.so.*/'`
+	        arts_lib=`ls $arts_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
+	        echo "-- $arts_lib_spec -> $arts_lib"
+                if test x$enable_dlopen = xyes && \
+                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
+                    CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
+		    AC_SUBST(arts_lib)
+                else
+                    CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
+                    SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
+                fi
                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
                 AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
             fi
@@ -1353,11 +1379,36 @@
     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
 }
 
+dnl Check for the dlfcn.h interface for dynamically loading objects
+CheckDLOPEN()
+{
+    AC_ARG_ENABLE(dlopen,
+[  --enable-dlopen         use dlopen for shared object loading [default=yes]],
+                  , enable_dlopen=yes)
+    if test x$enable_dlopen = xyes; then
+        AC_MSG_CHECKING(for dlopen)
+        use_dlopen=no
+        AC_TRY_COMPILE([
+         #include <dlfcn.h>
+        ],[
+        ],[
+        use_dlopen=yes
+        ])
+        AC_MSG_RESULT($use_dlopen)
+
+        if test x$use_dlopen = xyes; then
+            CFLAGS="$CFLAGS -DUSE_DLOPEN"
+            SYSTEM_LIBS="$SYSTEM_LIBS -ldl"
+        fi
+    fi
+}
+
 case "$target" in
     *-*-linux*)
         ARCH=linux
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNASM
         CheckOSS
         CheckALSA
@@ -1429,6 +1480,7 @@
         ARCH=bsdi
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1480,6 +1532,7 @@
         ARCH=freebsd
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckVGL
         CheckNASM
         CheckOSS
@@ -1535,6 +1588,7 @@
         ARCH=netbsd
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1588,6 +1642,7 @@
         ARCH=openbsd
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckOPENBSDAUDIO
         CheckNASM
         CheckOSS
@@ -1647,6 +1702,7 @@
         ARCH=sysv5
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1696,6 +1752,7 @@
         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1744,6 +1801,7 @@
         ARCH=irix
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckDMEDIA
         CheckESD
         CheckNAS
@@ -1806,6 +1864,7 @@
         ARCH=hpux
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckOSS
         CheckNAS
         CheckX11
@@ -1853,6 +1912,7 @@
         ARCH=aix
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckOSS
         CheckNAS
         CheckX11
@@ -1898,6 +1958,7 @@
         ARCH=osf
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNAS
         CheckX11
         CheckGGI
@@ -1944,6 +2005,7 @@
         ARCH=qnx
         CheckDummyVideo
         CheckDiskAudio
+	CheckDLOPEN
         CheckNAS
         CheckPHOTON
         CheckX11