configure.in
changeset 368 e61c4fb262bd
parent 357 d6d0cfdbea65
child 369 5f98121182be
     1.1 --- a/configure.in	Wed Jul 18 16:45:41 2007 +0000
     1.2 +++ b/configure.in	Wed Jul 18 16:58:37 2007 +0000
     1.3 @@ -56,14 +56,15 @@
     1.4  EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
     1.5  BUILD_LDFLAGS="$LDFLAGS"
     1.6  EXTRA_LDFLAGS="$BASE_LDFLAGS"
     1.7 -for path in /usr/local; do
     1.8 -    if test -d $path/include; then
     1.9 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    1.10 -    fi
    1.11 -    if test -d $path/lib; then
    1.12 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    1.13 -    fi
    1.14 -done
    1.15 +## These are common directories to find software packages
    1.16 +#for path in /usr/freeware /usr/pkg /usr/local; do
    1.17 +#    if test -d $path/include; then
    1.18 +#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    1.19 +#    fi
    1.20 +#    if test -d $path/lib; then
    1.21 +#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    1.22 +#    fi
    1.23 +#done
    1.24  CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    1.25  CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    1.26  LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    1.27 @@ -72,18 +73,34 @@
    1.28  AC_LIBTOOL_WIN32_DLL
    1.29  AC_PROG_LIBTOOL
    1.30  AC_PROG_CC
    1.31 -AC_PROG_CXX
    1.32  AC_PROG_INSTALL
    1.33  AC_PROG_MAKE_SET
    1.34 +if test -z "$host_alias"; then
    1.35 +    hostaliaswindres=
    1.36 +else
    1.37 +    hostaliaswindres="$host_alias-windres"
    1.38 +fi
    1.39 +AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
    1.40  
    1.41  dnl Check for compiler characteristics
    1.42  AC_C_CONST
    1.43  
    1.44  case "$host" in
    1.45      *-*-cygwin* | *-*-mingw32*)
    1.46 +        SOURCES="$srcdir/version.rc"
    1.47          EXE=".exe"
    1.48 +        if test "$build" != "$host"; then # cross-compiling
    1.49 +            # Default cross-compile location
    1.50 +            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
    1.51 +        else
    1.52 +            # Look for the location of the tools and install there
    1.53 +            if test "$BUILD_PREFIX" != ""; then
    1.54 +                ac_default_prefix=$BUILD_PREFIX
    1.55 +            fi
    1.56 +        fi
    1.57          ;;
    1.58      *)
    1.59 +        SOURCES=""
    1.60          EXE=""
    1.61          ;;
    1.62  esac
    1.63 @@ -98,11 +115,24 @@
    1.64  $srcdir/mixer.c \
    1.65  $srcdir/music.c"
    1.66  
    1.67 +find_lib()
    1.68 +{
    1.69 +    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
    1.70 +    env_lib_path=[`echo $LIBS $LDFLAGS | sed 's/-L[ ]*//g'`]
    1.71 +    for path in $gcc_lib_path $env_lib_path /usr/lib /usr/local/lib; do
    1.72 +        lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.73 +        if test x$lib != x; then
    1.74 +            echo $lib
    1.75 +            return
    1.76 +        fi
    1.77 +    done
    1.78 +}
    1.79 +
    1.80  dnl Check for SDL
    1.81  SDL_VERSION=1.2.10
    1.82  AM_PATH_SDL($SDL_VERSION,
    1.83              :,
    1.84 -	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    1.85 +            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    1.86  )
    1.87  EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
    1.88  EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
    1.89 @@ -132,32 +162,32 @@
    1.90  AC_HELP_STRING([--enable-music-libmikmod], [enable MOD music via external libmikmod [[default=no]]]),
    1.91                [], [enable_music_libmikmod=no])
    1.92  if test x$enable_music_libmikmod = xyes; then
    1.93 -	AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
    1.94 -	if test "$LIBMIKMOD_CONFIG" != "no" ; then
    1.95 -		no_libmikmod=no
    1.96 -		CFLAGS_SAVED="$CFLAGS"
    1.97 -		LIBS_SAVED="$LIBS"
    1.98 -		CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
    1.99 -		LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
   1.100 -		AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
   1.101 -		AC_TRY_RUN([
   1.102 +    AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
   1.103 +    if test "$LIBMIKMOD_CONFIG" != "no" ; then
   1.104 +        no_libmikmod=no
   1.105 +        CFLAGS_SAVED="$CFLAGS"
   1.106 +        LIBS_SAVED="$LIBS"
   1.107 +        CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
   1.108 +        LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
   1.109 +        AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
   1.110 +        AC_TRY_RUN([
   1.111  #include "mikmod.h"
   1.112  #include "stdio.h"
   1.113  
   1.114  int main(int argc, char **argv)
   1.115  {
   1.116 -	long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
   1.117 -	/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
   1.118 -	if(ver>=((maj<<16)|(min<<8)|(rev))) {
   1.119 -		printf("yes\n");
   1.120 -		return 0;
   1.121 -	}
   1.122 -	printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
   1.123 -	return 1;
   1.124 +    long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
   1.125 +    /*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
   1.126 +    if(ver>=((maj<<16)|(min<<8)|(rev))) {
   1.127 +        printf("yes\n");
   1.128 +        return 0;
   1.129 +    }
   1.130 +    printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
   1.131 +    return 1;
   1.132  }
   1.133  ], EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`";EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`", CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
   1.134  [echo $ac_n "cross compiling; assumed OK... $ac_c"])
   1.135 -	fi
   1.136 +    fi
   1.137  fi
   1.138  
   1.139  AC_ARG_ENABLE([music-mod],
   1.140 @@ -218,67 +248,73 @@
   1.141  AC_ARG_ENABLE([music-ogg],
   1.142  AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
   1.143                [], [enable_music_ogg=yes])
   1.144 -if test x$enable_music_ogg = xyes; then
   1.145 -    AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
   1.146 -    have_vorbis=no
   1.147 -    AC_TRY_COMPILE([
   1.148 -     #include <vorbis/vorbisfile.h>
   1.149 -    ],[
   1.150 -    ],[
   1.151 -    have_vorbis=yes
   1.152 -    ])
   1.153 -    AC_MSG_RESULT($have_vorbis)
   1.154 -    if test x$have_vorbis = xyes; then
   1.155 -        AC_ARG_ENABLE([music-ogg-shared],
   1.156 -AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
   1.157 -                      [], [enable_music_ogg_shared=yes])
   1.158 -        case "$host" in
   1.159 -            *-*-darwin*)
   1.160 -                for path in /usr/lib /usr/local/lib; do
   1.161 -                    if test x$ogg_lib = x; then
   1.162 -                        ogg_lib=[`ls -- $path/libvorbisfile.[0-9].dylib 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.163 -                    fi
   1.164 -                done
   1.165 -                ;;
   1.166 -            *-*-cygwin* | *-*-mingw32*)
   1.167 -                ogg_lib='vorbisfile.dll'
   1.168 -                ;;
   1.169 -            *)
   1.170 -                for path in /usr/lib /usr/local/lib; do
   1.171 -                    if test x$ogg_lib = x; then
   1.172 -                        ogg_lib=[`ls -- $path/libvorbisfile.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.173 -                    fi
   1.174 -                done
   1.175 -                ;;
   1.176 -        esac
   1.177 -        SOURCES="$SOURCES $srcdir/*_ogg.c"
   1.178 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
   1.179 -        if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
   1.180 -            echo "-- dynamic libvorbisfile -> $ogg_lib"
   1.181 -            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
   1.182 -        else
   1.183 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
   1.184 -        fi
   1.185 -    fi
   1.186 -fi
   1.187  AC_ARG_ENABLE(music-ogg-tremor,
   1.188  [  --enable-music-ogg-tremor   enable OGG music via libtremor [[default=no]]],
   1.189 -	      , enable_music_ogg_tremor=no)
   1.190 -if test x$enable_music_ogg_tremor = xyes; then
   1.191 -    AC_MSG_CHECKING(for libtremor headers)
   1.192 -    have_tremor=no
   1.193 -    AC_TRY_COMPILE([
   1.194 -     #include <tremor/ivorbiscodec.h>
   1.195 -     #include <tremor/ivorbisfile.h>
   1.196 -    ],[
   1.197 -    ],[
   1.198 -    have_tremor=yes
   1.199 -    ])
   1.200 -    AC_MSG_RESULT($have_tremor)
   1.201 -    if test x$have_tremor = xyes; then
   1.202 -        SOURCES="$SOURCES $srcdir/*_ogg.c"
   1.203 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
   1.204 -	EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
   1.205 +              [], enable_music_ogg_tremor=no)
   1.206 +AC_ARG_ENABLE([music-ogg-shared],
   1.207 +AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
   1.208 +              [], [enable_music_ogg_shared=yes])
   1.209 +if test x$enable_music_ogg = xyes; then
   1.210 +    if test x$enable_music_ogg_tremor = xyes; then
   1.211 +        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
   1.212 +        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
   1.213 +        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
   1.214 +            case "$host" in
   1.215 +                *-*-darwin*)
   1.216 +                    ogg_lib=[`find_lib libvorbisidec*.dylib`]
   1.217 +                    if test x$ogg_lib = x; then
   1.218 +                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
   1.219 +                    fi
   1.220 +                    if test x$ogg_lib = x; then
   1.221 +                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
   1.222 +                    fi
   1.223 +                    ;;
   1.224 +                *-*-cygwin* | *-*-mingw32*)
   1.225 +                    ogg_lib=[`find_lib "vorbisidec*dll"`]
   1.226 +                    ;;
   1.227 +                *)
   1.228 +                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
   1.229 +                    if test x$ogg_lib = x; then
   1.230 +                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
   1.231 +                    fi
   1.232 +                    ;;
   1.233 +            esac
   1.234 +            SOURCES="$SOURCES $srcdir/*_ogg.c"
   1.235 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
   1.236 +            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
   1.237 +                echo "-- dynamic libvorbisidec -> $ogg_lib"
   1.238 +                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
   1.239 +            else
   1.240 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
   1.241 +            fi
   1.242 +        fi
   1.243 +    else
   1.244 +        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
   1.245 +        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
   1.246 +        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
   1.247 +            case "$host" in
   1.248 +                *-*-darwin*)
   1.249 +                    ogg_lib=[`find_lib libvorbisfile*.dylib`]
   1.250 +                    ;;
   1.251 +                *-*-cygwin* | *-*-mingw32*)
   1.252 +                    ogg_lib=[`find_lib "vorbisfile*dll"`]
   1.253 +                    ;;
   1.254 +                *)
   1.255 +                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
   1.256 +                    if test x$ogg_lib = x; then
   1.257 +                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
   1.258 +                    fi
   1.259 +                    ;;
   1.260 +            esac
   1.261 +            SOURCES="$SOURCES $srcdir/*_ogg.c"
   1.262 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
   1.263 +            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
   1.264 +                echo "-- dynamic libvorbisfile -> $ogg_lib"
   1.265 +                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
   1.266 +            else
   1.267 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
   1.268 +            fi
   1.269 +        fi
   1.270      fi
   1.271  fi
   1.272  AC_ARG_ENABLE(music-mp3,
   1.273 @@ -293,21 +329,16 @@
   1.274                        [], [enable_music_mp3_shared=yes])
   1.275          case "$host" in
   1.276              *-*-darwin*)
   1.277 -                for path in /usr/lib /usr/local/lib; do
   1.278 -                    if test x$smpeg_lib = x; then
   1.279 -                        smpeg_lib=[`ls -- $path/libsmpeg*.[0-9].dylib 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.280 -                    fi
   1.281 -                done
   1.282 +                smpeg_lib=[`find_lib libsmpeg*.dylib`]
   1.283                  ;;
   1.284              *-*-cygwin* | *-*-mingw32*)
   1.285 -                smpeg_lib='smpeg.dll'
   1.286 +                smpeg_lib=[`find_lib "smpeg*dll"`]
   1.287                  ;;
   1.288              *)
   1.289 -                for path in /usr/lib /usr/local/lib; do
   1.290 -                    if test x$smpeg_lib = x; then
   1.291 -                        smpeg_lib=[`ls -- $path/libsmpeg*.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   1.292 -                    fi
   1.293 -                done
   1.294 +                smpeg_lib=[`find_lib "libsmpeg.so.[0-9]"`]
   1.295 +                if test x$smpeg_lib = x; then
   1.296 +                    smpeg_lib=[`find_lib "libsmpeg.so.[0-9]*"`]
   1.297 +                fi
   1.298                  ;;
   1.299          esac
   1.300          SOURCES="$SOURCES $srcdir/*_mp3.c"
   1.301 @@ -341,6 +372,7 @@
   1.302  fi
   1.303  
   1.304  OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   1.305 +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
   1.306  
   1.307  dnl Expand the sources and objects needed to build the library
   1.308  AC_SUBST(ac_aux_dir)
   1.309 @@ -351,6 +383,7 @@
   1.310  AC_SUBST(BUILD_LDFLAGS)
   1.311  AC_SUBST(EXTRA_LDFLAGS)
   1.312  AC_SUBST(EXE)
   1.313 +AC_SUBST(WINDRES)
   1.314  AC_SUBST(SDL_CFLAGS)
   1.315  AC_SUBST(SDL_LIBS)
   1.316