comparison configure.in @ 939:c7c04f811994

Date: Tue, 01 Jun 2004 15:27:44 +0300 From: Martin_Storsj Subject: Update for dynamic loading of ALSA I sent you a patch a few months ago which enables SDL to load ALSA dynamically. Now I've finally got time to tweak this yet some more. I've added code from alsa.m4 (from alsa's dev package) to acinclude.m4, and made the detection of the alsa library name a bit better. I've also fixed up the loading versioned symbols with dlvsym, so that it falls back to dlsym. I wouldn't say the configure script is complete yet, but this is how far I've come this time, and I'm no expert at those things.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 21 Aug 2004 04:20:00 +0000
parents 84f930aebaeb
children ac488ad4ef1d
comparison
equal deleted inserted replaced
938:fa2ce068b0b6 939:c7c04f811994
280 { 280 {
281 AC_ARG_ENABLE(alsa, 281 AC_ARG_ENABLE(alsa,
282 [ --enable-alsa support the ALSA audio API [default=yes]], 282 [ --enable-alsa support the ALSA audio API [default=yes]],
283 , enable_alsa=yes) 283 , enable_alsa=yes)
284 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then 284 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
285 AC_MSG_CHECKING(for ALSA audio support)
286 have_alsa=no 285 have_alsa=no
287 AC_TRY_COMPILE([ 286 AM_PATH_ALSA(0.9.0, have_alsa=yes)
288 #include <alsa/asoundlib.h>
289 ],[
290 #if SND_LIB_VERSION < ((0<<16)|(9<<8)|0)
291 #error Your version of ALSA is too old
292 #endif
293 snd_pcm_t *pcm_handle;
294 ],[
295 AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes)
296 ])
297 if test x$have_alsa = xyes; then 287 if test x$have_alsa = xyes; then
298 AC_ARG_ENABLE(alsa-shared, 288 AC_ARG_ENABLE(alsa-shared,
299 [ --enable-alsa-shared dynamically load ALSA audio support [default=yes]], 289 [ --enable-alsa-shared dynamically load ALSA audio support [default=yes]],
300 , enable_alsa_shared=yes) 290 , enable_alsa_shared=yes)
301 alsa_lib=`ls /usr/lib/libasound.so.* | sed 's/.*\/\(.*\)/\1/; q'` 291 if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
292 if test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
293 ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
294 else if test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
295 ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
296 fi; fi
297 fi
298 alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
299 alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
300 echo "-- $alsa_lib_spec -> $alsa_lib"
301
302 if test x$use_dlopen != xyes && \ 302 if test x$use_dlopen != xyes && \
303 test x$enable_alsa_shared = xyes; then 303 test x$enable_alsa_shared = xyes; then
304 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option]) 304 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
305 fi 305 fi
306 if test x$use_dlopen = xyes && \ 306 if test x$use_dlopen = xyes && \
307 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then 307 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
308 CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib)" 308 CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib) $ALSA_CFLAGS"
309 AC_SUBST(alsa_lib) 309 AC_SUBST(alsa_lib)
310
311 AC_MSG_CHECKING(for dlvsym)
312 use_dlvsym=no
313 AC_TRY_COMPILE([
314 #include <stdio.h>
315 #define __USE_GNU
316 #include <dlfcn.h>
317 ],[
318 dlvsym(NULL,"","");
319 ],[
320 use_dlvsym=yes
321 ])
322 AC_MSG_RESULT($use_dlvsym);
323 if test x$use_dlvsym = xyes; then
324 CFLAGS="$CFLAGS -DUSE_DLVSYM"
325 fi
310 else 326 else
311 CFLAGS="$CFLAGS -DALSA_SUPPORT" 327 CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
312 SYSTEM_LIBS="$SYSTEM_LIBS -lasound" 328 SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
313 fi 329 fi
314 AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa" 330 AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
315 AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la" 331 AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
316 else
317 AC_MSG_RESULT($have_alsa)
318 fi 332 fi
319 fi 333 fi
320 } 334 }
321 335
322 dnl Check whether we want to use IRIX 6.5+ native audio or not 336 dnl Check whether we want to use IRIX 6.5+ native audio or not