comparison configure.in @ 4327:2b6e3b42f80f SDL-1.2

Simplify and improve dynamic library detection, taken from SDL_image
author Sam Lantinga <slouken@libsdl.org>
date Tue, 13 Oct 2009 05:20:09 +0000
parents a156aea07417
children 4abf24b03b1d
comparison
equal deleted inserted replaced
4326:a156aea07417 4327:2b6e3b42f80f
103 SDL_CFLAGS="$BASE_CFLAGS" 103 SDL_CFLAGS="$BASE_CFLAGS"
104 SDL_LIBS="-lSDL $BASE_LDFLAGS" 104 SDL_LIBS="-lSDL $BASE_LDFLAGS"
105 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" 105 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
106 CFLAGS="$CFLAGS $EXTRA_CFLAGS" 106 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
107 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" 107 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
108
109 dnl set this to use on systems that use lib64 instead of lib
110 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
111
112 dnl Function to find a library in the compiler search path
113 find_lib()
114 {
115 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
116 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
117 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
118 if test "$cross_compiling" = yes; then
119 host_lib_path=""
120 else
121 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
122 fi
123 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
124 lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
125 if test x$lib != x; then
126 echo $lib
127 return
128 fi
129 done
130 }
108 131
109 dnl Check for compiler characteristics 132 dnl Check for compiler characteristics
110 AC_C_CONST 133 AC_C_CONST
111 AC_C_INLINE 134 AC_C_INLINE
112 AC_C_VOLATILE 135 AC_C_VOLATILE
288 , enable_assembly=yes) 311 , enable_assembly=yes)
289 if test x$enable_assembly = xyes; then 312 if test x$enable_assembly = xyes; then
290 AC_DEFINE(SDL_ASSEMBLY_ROUTINES) 313 AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
291 fi 314 fi
292 315
293 dnl set this to use on systems that use lib64 instead of lib
294 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
295
296 dnl See if the OSS audio interface is supported 316 dnl See if the OSS audio interface is supported
297 CheckOSS() 317 CheckOSS()
298 { 318 {
299 AC_ARG_ENABLE(oss, 319 AC_ARG_ENABLE(oss,
300 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]), 320 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
351 LIBS="$alsa_save_LIBS" 371 LIBS="$alsa_save_LIBS"
352 if test x$have_alsa = xyes; then 372 if test x$have_alsa = xyes; then
353 AC_ARG_ENABLE(alsa-shared, 373 AC_ARG_ENABLE(alsa-shared,
354 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), 374 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
355 , enable_alsa_shared=yes) 375 , enable_alsa_shared=yes)
356 if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then 376 alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
357 if test "x`ls /$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then 377 echo "-- dynamic libasound -> $alsa_lib"
358 ALSA_LIBS="-L/$base_libdir $ALSA_LIBS"
359 elif test "x`ls /usr/$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then
360 ALSA_LIBS="-L/usr/$base_libdir $ALSA_LIBS"
361 elif test "x`ls /usr/local/$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then
362 ALSA_LIBS="-L/usr/local/$base_libdir $ALSA_LIBS"
363 fi
364 fi
365 alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
366 if test x$alsa_lib_spec = x; then
367 alsa_lib_spec="/usr/$base_libdir/libasound.so.*"
368 fi
369 alsa_lib=`ls -- $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
370 echo "-- $alsa_lib_spec -> $alsa_lib"
371 378
372 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA) 379 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
373 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" 380 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
374 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" 381 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
375 if test x$have_loadso != xyes && \ 382 if test x$have_loadso != xyes && \
459 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) 466 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
460 if test x$have_esd = xyes; then 467 if test x$have_esd = xyes; then
461 AC_ARG_ENABLE(esd-shared, 468 AC_ARG_ENABLE(esd-shared,
462 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), 469 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
463 , enable_esd_shared=yes) 470 , enable_esd_shared=yes)
464 esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'` 471 esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
465 if test x$esd_lib_spec = x; then 472 echo "-- dynamic libesd -> $esd_lib"
466 esd_lib_spec="/usr/$base_libdir/libesd.so.*"
467 fi
468 esd_lib=`ls -- $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
469 echo "-- $esd_lib_spec -> $esd_lib"
470 473
471 AC_DEFINE(SDL_AUDIO_DRIVER_ESD) 474 AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
472 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" 475 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
473 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" 476 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
474 if test x$have_loadso != xyes && \ 477 if test x$have_loadso != xyes && \
498 PULSE_REQUIRED_VERSION=0.9 501 PULSE_REQUIRED_VERSION=0.9
499 502
500 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 503 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
501 AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support) 504 AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support)
502 if test x$PKG_CONFIG != xno; then 505 if test x$PKG_CONFIG != xno; then
503 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then 506 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then
504 PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` 507 PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
505 PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple` 508 PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple`
506 audio_pulse=yes 509 audio_pulse=yes
507 fi 510 fi
508 fi 511 fi
509 AC_MSG_RESULT($audio_pulse) 512 AC_MSG_RESULT($audio_pulse)
510 513
511 if test x$audio_pulse = xyes; then 514 if test x$audio_pulse = xyes; then
512 AC_ARG_ENABLE(pulseaudio-shared, 515 AC_ARG_ENABLE(pulseaudio-shared,
513 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), 516 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
514 , enable_pulseaudio_shared=yes) 517 , enable_pulseaudio_shared=yes)
515 if test "x`echo $PULSE_LIBS | grep -- -L`" = "x"; then 518 pulse_lib=[`find_lib "libpulse-simple.so.*" "$PULSE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
516 if test "x`ls /$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then 519 echo "-- dynamic libpulse-simple -> $pulse_lib"
517 PULSE_LIBS="-L/$base_libdir $PULSE_LIBS"
518 elif test "x`ls /usr/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
519 PULSE_LIBS="-L/usr/$base_libdir $PULSE_LIBS"
520 elif test "x`ls /usr/local/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
521 PULSE_LIBS="-L/usr/local/$base_libdir $PULSE_LIBS"
522 fi
523 fi
524 pulse_lib_spec=`echo $PULSE_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
525 if test x$pulse_lib_spec = x; then
526 pulse_lib_spec="/usr/$base_libdir/libpulse-simple.so.*"
527 fi
528 pulse_lib=`ls -- $pulse_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
529 echo "-- $pulse_lib_spec -> $pulse_lib"
530 520
531 AC_DEFINE(SDL_AUDIO_DRIVER_PULSE) 521 AC_DEFINE(SDL_AUDIO_DRIVER_PULSE)
532 SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c" 522 SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c"
533 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS" 523 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS"
534 if test x$have_loadso != xyes && \ 524 if test x$have_loadso != xyes && \
556 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then 546 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
557 : # arts isn't installed 547 : # arts isn't installed
558 else 548 else
559 ARTS_CFLAGS=`$ARTSCONFIG --cflags` 549 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
560 ARTS_LIBS=`$ARTSCONFIG --libs` 550 ARTS_LIBS=`$ARTSCONFIG --libs`
561 ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
562 AC_MSG_CHECKING(for aRts development environment) 551 AC_MSG_CHECKING(for aRts development environment)
563 audio_arts=no 552 audio_arts=no
564 save_CFLAGS="$CFLAGS" 553 save_CFLAGS="$CFLAGS"
565 CFLAGS="$CFLAGS $ARTS_CFLAGS" 554 CFLAGS="$CFLAGS $ARTS_CFLAGS"
566 AC_TRY_COMPILE([ 555 AC_TRY_COMPILE([
574 AC_MSG_RESULT($audio_arts) 563 AC_MSG_RESULT($audio_arts)
575 if test x$audio_arts = xyes; then 564 if test x$audio_arts = xyes; then
576 AC_ARG_ENABLE(arts-shared, 565 AC_ARG_ENABLE(arts-shared,
577 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), 566 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
578 , enable_arts_shared=yes) 567 , enable_arts_shared=yes)
579 arts_lib_spec="$ARTS_PREFIX/$base_libdir/libartsc.so.*" 568 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
580 arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` 569 echo "-- dynamic libartsc -> $arts_lib"
581 echo "-- $arts_lib_spec -> $arts_lib"
582 570
583 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS) 571 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
584 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" 572 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
585 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" 573 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
586 if test x$have_loadso != xyes && \ 574 if test x$have_loadso != xyes && \
633 621
634 if test x$have_nas = xyes; then 622 if test x$have_nas = xyes; then
635 AC_ARG_ENABLE(nas-shared, 623 AC_ARG_ENABLE(nas-shared,
636 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]), 624 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
637 , enable_nas_shared=yes) 625 , enable_nas_shared=yes)
638 if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then 626 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
639 if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then 627 echo "-- dynamic libaudio -> $nas_lib"
640 NAS_LIBS="-L/lib $NAS_LIBS"
641 elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
642 NAS_LIBS="-L/usr/lib $NAS_LIBS"
643 elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
644 NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
645 fi
646 fi
647 nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
648 if test x$nas_lib_spec = x ; then
649 nas_lib_spec="/usr/$base_libdir/libaudio.so.*"
650 fi
651 nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
652 echo "-- $nas_lib_spec -> $nas_lib"
653 628
654 if test x$have_loadso != xyes && \ 629 if test x$have_loadso != xyes && \
655 test x$enable_nas_shared = xyes; then 630 test x$enable_nas_shared = xyes; then
656 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading]) 631 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
657 fi 632 fi
1004 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32 979 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
1005 x11_lib='libX11.so' 980 x11_lib='libX11.so'
1006 x11ext_lib='libXext.so' 981 x11ext_lib='libXext.so'
1007 ;; 982 ;;
1008 *) 983 *)
1009 x11_lib_path=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`] 984 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1010 for path in $x11_lib_path /usr/$base_libdir /usr/X11/$base_libdir /usr/X11R6/$base_libdir; do 985 x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1011 if test "x$x11_lib" = "x"; then 986 xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1012 x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] 987 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1013 if test "x$x11_lib" = "x"; then
1014 x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1015 fi
1016 fi
1017 if test "x$x11ext_lib" = "x"; then
1018 x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1019 if test "x$x11ext_lib" = "x"; then
1020 x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1021 fi
1022 fi
1023 if test "x$xrender_lib" = "x"; then
1024 xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1025 if test "x$xrender_lib" = "x"; then
1026 xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1027 fi
1028 fi
1029 if test "x$xrandr_lib" = "x"; then
1030 xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1031 if test "x$xrandr_lib" = "x"; then
1032 xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
1033 fi
1034 fi
1035 done
1036 ;; 988 ;;
1037 esac 989 esac
1038 990
1039 X_CFLAGS="$X_CFLAGS -DXTHREADS" 991 X_CFLAGS="$X_CFLAGS -DXTHREADS"
1040 if test x$ac_cv_func_shmat != xyes; then 992 if test x$ac_cv_func_shmat != xyes; then