configure.in
changeset 3391 188fc5ecc58c
parent 3390 802e5d85b90c
child 3392 efc22582afc5
     1.1 --- a/configure.in	Tue Oct 13 06:33:46 2009 +0000
     1.2 +++ b/configure.in	Tue Oct 13 06:40:08 2009 +0000
     1.3 @@ -112,6 +112,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 @@ -541,9 +564,6 @@
    1.34      fi
    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 @@ -604,21 +624,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 @@ -712,12 +719,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 @@ -755,7 +758,7 @@
    1.83                  PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
    1.84                  PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
    1.85                  audio_pulseaudio=yes
    1.86 -        fi
    1.87 +            fi
    1.88          fi
    1.89          AC_MSG_RESULT($audio_pulseaudio)
    1.90  
    1.91 @@ -763,21 +766,8 @@
    1.92              AC_ARG_ENABLE(pulseaudio-shared,
    1.93  AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
    1.94                            , enable_pulseaudio_shared=yes)
    1.95 -            if test "x`echo $PULSEAUDIO_LIBS | grep -- -L`" = "x"; then
    1.96 -                if test "x`ls /$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
    1.97 -                    PULSEAUDIO_LIBS="-L/$base_libdir $PULSEAUDIO_LIBS"
    1.98 -                elif test "x`ls /usr/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
    1.99 -                    PULSEAUDIO_LIBS="-L/usr/$base_libdir $PULSEAUDIO_LIBS"
   1.100 -                elif test "x`ls /usr/local/$base_libdir/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   1.101 -                    PULSEAUDIO_LIBS="-L/usr/local/$base_libdir $PULSEAUDIO_LIBS"
   1.102 -                fi
   1.103 -            fi
   1.104 -            pulseaudio_lib_spec=`echo $PULSEAUDIO_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
   1.105 -            if test x$pulse_lib_spec = x; then
   1.106 -                pulse_lib_spec="/usr/$base_libdir/libpulse-simple.so.*"
   1.107 -            fi
   1.108 -            pulseaudio_lib=`ls -- $pulseaudio_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.109 -            echo "-- $pulseaudio_lib_spec -> $pulseaudio_lib"
   1.110 +            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.111 +            echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   1.112  
   1.113              AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   1.114              SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   1.115 @@ -809,7 +799,6 @@
   1.116          else
   1.117              ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   1.118              ARTS_LIBS=`$ARTSCONFIG --libs`
   1.119 -            ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
   1.120              AC_MSG_CHECKING(for aRts development environment)
   1.121              audio_arts=no
   1.122              save_CFLAGS="$CFLAGS"
   1.123 @@ -827,9 +816,8 @@
   1.124                  AC_ARG_ENABLE(arts-shared,
   1.125  AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   1.126                                , enable_arts_shared=yes)
   1.127 -                arts_lib_spec="$ARTS_PREFIX/$base_libdir/libartsc.so.*"
   1.128 -                arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.129 -                echo "-- $arts_lib_spec -> $arts_lib"
   1.130 +                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.131 +                echo "-- dynamic libartsc -> $arts_lib"
   1.132  
   1.133                  AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   1.134                  SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   1.135 @@ -886,21 +874,8 @@
   1.136              AC_ARG_ENABLE(nas-shared,
   1.137  AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   1.138                            , enable_nas_shared=yes)
   1.139 -            if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
   1.140 -                if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.141 -                    NAS_LIBS="-L/lib $NAS_LIBS"
   1.142 -                elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.143 -                    NAS_LIBS="-L/usr/lib $NAS_LIBS"
   1.144 -                elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   1.145 -                    NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
   1.146 -                fi
   1.147 -            fi
   1.148 -            nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
   1.149 -            if test x$nas_lib_spec = x; then
   1.150 -                nas_lib_spec="/usr/$base_libdir/libaudio.so.*"
   1.151 -            fi
   1.152 -            nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   1.153 -            echo "-- $nas_lib_spec -> $nas_lib"
   1.154 +            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.155 +            echo "-- dynamic libaudio -> $nas_lib"
   1.156  
   1.157              if test x$have_loadso != xyes && \
   1.158                 test x$enable_nas_shared = xyes; then
   1.159 @@ -1019,45 +994,12 @@
   1.160                      x11ext_lib='libXext.so'
   1.161                      ;;
   1.162                  *)
   1.163 -                    x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
   1.164 -                    for path in $x11_lib_path /usr/$base_libdir /usr/X11/$base_libdir /usr/X11R6/$base_libdir; do
   1.165 -                        if test "x$x11_lib" = "x"; then
   1.166 -                            x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.167 -                            if test "x$x11_lib" = "x"; then
   1.168 -                                x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.169 -                            fi
   1.170 -                        fi
   1.171 -                        if test "x$x11ext_lib" = "x"; then
   1.172 -                            x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.173 -                            if test "x$x11ext_lib" = "x"; then
   1.174 -                                x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.175 -                            fi
   1.176 -                        fi
   1.177 -                        if test "x$xrender_lib" = "x"; then
   1.178 -                            xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.179 -                            if test "x$xrender_lib" = "x"; then
   1.180 -                                xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.181 -                            fi
   1.182 -                        fi
   1.183 -                        if test "x$xrandr_lib" = "x"; then
   1.184 -                            xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.185 -                            if test "x$xrandr_lib" = "x"; then
   1.186 -                                xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.187 -                            fi
   1.188 -                        fi
   1.189 -                        if test "x$xinput_lib" = "x"; then
   1.190 -                            xinput_lib=[`ls -- $path/libXi.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.191 -                            if test "x$xinput_lib" = "x"; then
   1.192 -                                xinput_lib=[`ls -- $path/libXi.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.193 -                            fi
   1.194 -                        fi
   1.195 -                        if test "x$xss_lib" = "x"; then
   1.196 -                            xss_lib=[`ls -- $path/libXss.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.197 -                            if test "x$xss_lib" = "x"; then
   1.198 -                                xss_lib=[`ls -- $path/libXss.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.199 -                            fi
   1.200 -                        fi
   1.201 -                    done
   1.202 +                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.203 +                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.204 +                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.205 +                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.206 +                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.207 +                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.208                      ;;
   1.209              esac
   1.210