configure.in
branchSDL-1.2
changeset 4327 2b6e3b42f80f
parent 4326 a156aea07417
child 4328 4abf24b03b1d
     1.1 --- a/configure.in	Tue Oct 13 04:23:34 2009 +0000
     1.2 +++ b/configure.in	Tue Oct 13 05:20:09 2009 +0000
     1.3 @@ -106,6 +106,29 @@
     1.4  CFLAGS="$CFLAGS $EXTRA_CFLAGS"
     1.5  LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
     1.6  
     1.7 +dnl set this to use on systems that use lib64 instead of lib
     1.8 +base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
     1.9 +
    1.10 +dnl Function to find a library in the compiler search path
    1.11 +find_lib()
    1.12 +{
    1.13 +    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
    1.14 +    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
    1.15 +    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
    1.16 +    if test "$cross_compiling" = yes; then
    1.17 +        host_lib_path=""
    1.18 +    else
    1.19 +        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
    1.20 +    fi
    1.21 +    for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
    1.22 +        lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
    1.23 +        if test x$lib != x; then
    1.24 +            echo $lib
    1.25 +            return
    1.26 +        fi
    1.27 +    done
    1.28 +}
    1.29 +
    1.30  dnl Check for compiler characteristics
    1.31  AC_C_CONST
    1.32  AC_C_INLINE
    1.33 @@ -290,9 +313,6 @@
    1.34      AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
    1.35  fi
    1.36  
    1.37 -dnl set this to use on systems that use lib64 instead of lib
    1.38 -base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
    1.39 -
    1.40  dnl See if the OSS audio interface is supported
    1.41  CheckOSS()
    1.42  {
    1.43 @@ -353,21 +373,8 @@
    1.44              AC_ARG_ENABLE(alsa-shared,
    1.45  AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
    1.46                            , enable_alsa_shared=yes)
    1.47 -            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
    1.48 -                if test "x`ls /$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then
    1.49 -                    ALSA_LIBS="-L/$base_libdir $ALSA_LIBS"
    1.50 -                elif test "x`ls /usr/$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then
    1.51 -                    ALSA_LIBS="-L/usr/$base_libdir $ALSA_LIBS"
    1.52 -                elif test "x`ls /usr/local/$base_libdir/libasound.so.* 2> /dev/null`" != "x"; then
    1.53 -                    ALSA_LIBS="-L/usr/local/$base_libdir $ALSA_LIBS"
    1.54 -                fi
    1.55 -            fi
    1.56 -            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
    1.57 -            if test x$alsa_lib_spec = x; then
    1.58 -                alsa_lib_spec="/usr/$base_libdir/libasound.so.*"
    1.59 -            fi
    1.60 -            alsa_lib=`ls -- $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
    1.61 -            echo "-- $alsa_lib_spec -> $alsa_lib"
    1.62 +            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.63 +            echo "-- dynamic libasound -> $alsa_lib"
    1.64  
    1.65              AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
    1.66              SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
    1.67 @@ -461,12 +468,8 @@
    1.68              AC_ARG_ENABLE(esd-shared,
    1.69  AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
    1.70                            , enable_esd_shared=yes)
    1.71 -            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
    1.72 -            if test x$esd_lib_spec = x; then
    1.73 -                esd_lib_spec="/usr/$base_libdir/libesd.so.*"
    1.74 -            fi
    1.75 -            esd_lib=`ls -- $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
    1.76 -            echo "-- $esd_lib_spec -> $esd_lib"
    1.77 +            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.78 +            echo "-- dynamic libesd -> $esd_lib"
    1.79  
    1.80              AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
    1.81              SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
    1.82 @@ -500,11 +503,11 @@
    1.83          AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.84          AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support)
    1.85          if test x$PKG_CONFIG != xno; then
    1.86 -        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then
    1.87 +            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then
    1.88                  PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
    1.89                  PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple`
    1.90                  audio_pulse=yes
    1.91 -        fi
    1.92 +            fi
    1.93          fi
    1.94          AC_MSG_RESULT($audio_pulse)
    1.95  
    1.96 @@ -512,21 +515,8 @@
    1.97              AC_ARG_ENABLE(pulseaudio-shared,
    1.98  AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
    1.99                            , enable_pulseaudio_shared=yes)
   1.100 -            if test "x`echo $PULSE_LIBS | grep -- -L`" = "x"; then
   1.101 -                if test "x`ls /$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   1.102 -                    PULSE_LIBS="-L/$base_libdir $PULSE_LIBS"
   1.103 -                elif test "x`ls /usr/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   1.104 -                    PULSE_LIBS="-L/usr/$base_libdir $PULSE_LIBS"
   1.105 -                elif test "x`ls /usr/local/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   1.106 -                    PULSE_LIBS="-L/usr/local/$base_libdir $PULSE_LIBS"
   1.107 -                fi
   1.108 -            fi
   1.109 -            pulse_lib_spec=`echo $PULSE_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
   1.110 -            if test x$pulse_lib_spec = x; then
   1.111 -                pulse_lib_spec="/usr/$base_libdir/libpulse-simple.so.*"
   1.112 -            fi
   1.113 -            pulse_lib=`ls -- $pulse_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.114 -            echo "-- $pulse_lib_spec -> $pulse_lib"
   1.115 +            pulse_lib=[`find_lib "libpulse-simple.so.*" "$PULSE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.116 +            echo "-- dynamic libpulse-simple -> $pulse_lib"
   1.117  
   1.118              AC_DEFINE(SDL_AUDIO_DRIVER_PULSE)
   1.119              SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c"
   1.120 @@ -558,7 +548,6 @@
   1.121          else
   1.122              ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   1.123              ARTS_LIBS=`$ARTSCONFIG --libs`
   1.124 -            ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
   1.125              AC_MSG_CHECKING(for aRts development environment)
   1.126              audio_arts=no
   1.127              save_CFLAGS="$CFLAGS"
   1.128 @@ -576,9 +565,8 @@
   1.129                  AC_ARG_ENABLE(arts-shared,
   1.130  AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   1.131                                , enable_arts_shared=yes)
   1.132 -                arts_lib_spec="$ARTS_PREFIX/$base_libdir/libartsc.so.*"
   1.133 -                arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.134 -                echo "-- $arts_lib_spec -> $arts_lib"
   1.135 +                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.136 +                echo "-- dynamic libartsc -> $arts_lib"
   1.137  
   1.138                  AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   1.139                  SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   1.140 @@ -635,21 +623,8 @@
   1.141              AC_ARG_ENABLE(nas-shared,
   1.142  AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   1.143                            , enable_nas_shared=yes)
   1.144 -            if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
   1.145 -                if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.146 -                    NAS_LIBS="-L/lib $NAS_LIBS"
   1.147 -                elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.148 -                    NAS_LIBS="-L/usr/lib $NAS_LIBS"
   1.149 -                elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.150 -                    NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
   1.151 -                fi
   1.152 -            fi
   1.153 -            nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
   1.154 -            if test x$nas_lib_spec = x ; then
   1.155 -                nas_lib_spec="/usr/$base_libdir/libaudio.so.*"
   1.156 -            fi
   1.157 -            nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.158 -            echo "-- $nas_lib_spec -> $nas_lib"
   1.159 +            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.160 +            echo "-- dynamic libaudio -> $nas_lib"
   1.161  
   1.162              if test x$have_loadso != xyes && \
   1.163                 test x$enable_nas_shared = xyes; then
   1.164 @@ -1006,33 +981,10 @@
   1.165                      x11ext_lib='libXext.so'
   1.166                      ;;
   1.167                  *)
   1.168 -                    x11_lib_path=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
   1.169 -                    for path in $x11_lib_path /usr/$base_libdir /usr/X11/$base_libdir /usr/X11R6/$base_libdir; do
   1.170 -                        if test "x$x11_lib" = "x"; then
   1.171 -                            x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.172 -                            if test "x$x11_lib" = "x"; then
   1.173 -                                x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.174 -                            fi
   1.175 -                        fi
   1.176 -                        if test "x$x11ext_lib" = "x"; then
   1.177 -                            x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.178 -                            if test "x$x11ext_lib" = "x"; then
   1.179 -                                x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.180 -                            fi
   1.181 -                        fi
   1.182 -                        if test "x$xrender_lib" = "x"; then
   1.183 -                            xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.184 -                            if test "x$xrender_lib" = "x"; then
   1.185 -                                xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.186 -                            fi
   1.187 -                        fi
   1.188 -                        if test "x$xrandr_lib" = "x"; then
   1.189 -                            xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.190 -                            if test "x$xrandr_lib" = "x"; then
   1.191 -                                xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.192 -                            fi
   1.193 -                        fi
   1.194 -                    done
   1.195 +                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.196 +                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.197 +                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.198 +                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.199                      ;;
   1.200              esac
   1.201