--- trunk/xvidcore/build/generic/configure.in 2005/01/16 10:34:52 1596 +++ trunk/xvidcore/build/generic/configure.in 2008/11/28 18:16:42 1821 @@ -1,6 +1,6 @@ dnl ========================================================================== dnl -dnl Autoconf script for XviD +dnl Autoconf script for Xvid dnl dnl Copyright(C) 2003-2004 Edouard Gomez dnl @@ -8,7 +8,7 @@ AC_PREREQ([2.50]) -AC_INIT([XviD], [1.1.0-beta1], [xvid-devel@xvid.org]) +AC_INIT([Xvid], [1.3.0], [xvid-devel@xvid.org]) AC_CONFIG_SRCDIR(configure.in) dnl Do not forget to increase that when needed. @@ -16,16 +16,15 @@ API_MINOR="1" dnl NASM version requirement -minimum_nasm_patch_version=34 +minimum_nasm_minor_version=0 +minimum_nasm_major_version=2 nasm_prog="nasm" -yasm_prog="yasm" dnl Default CFLAGS -- Big impact on overall speed our_cflags_defaults="-Wall" our_cflags_defaults="$our_cflags_defaults -O2" our_cflags_defaults="$our_cflags_defaults -fstrength-reduce" our_cflags_defaults="$our_cflags_defaults -finline-functions" -our_cflags_defaults="$our_cflags_defaults -freduce-all-givs" our_cflags_defaults="$our_cflags_defaults -ffast-math" our_cflags_defaults="$our_cflags_defaults -fomit-frame-pointer" @@ -199,7 +198,7 @@ BUS="64BIT" ;; *) - AC_MSG_ERROR([XviD supports only 32/64 bit architectures]) + AC_MSG_ERROR([Xvid supports only 32/64 bit architectures]) ;; esac @@ -265,7 +264,14 @@ SPECIFIC_CFLAGS="" PRE_SHARED_LIB="" case "$target_os" in - *bsd*|linux*|irix*|solaris*) + linux*|solaris*) + AC_MSG_RESULT([ok]) + STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" + SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" + SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm" + SPECIFIC_CFLAGS="-fPIC" + ;; + *bsd*|irix*) AC_MSG_RESULT([ok]) STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" @@ -334,40 +340,35 @@ dnl dnl Checking for nasm compatible programs - dnl yasm is preferred over nasm, because... i can use it - dnl to profile assembly code ;-) dnl found_nasm_comp_prog="no" chosen_asm_prog="" - dnl Check for yasm first - AC_CHECK_PROG([ac_yasm], [$yasm_prog], [yes], [no], , [yes]) - if test "$ac_yasm" = "yes" ; then - found_nasm_comp_prog="yes" - chosen_asm_prog="$yasm_prog" - fi - - dnl if yasm hasn't been found, then check for nasm (not buggy version) - if test "$found_nasm_comp_prog" = "no" -a "$ARCHITECTURE" != "X86_64" ; then + dnl Check for nasm (not buggy version) + if test "$found_nasm_comp_prog" = "no" ; then AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) if test "$ac_nasm" = "yes" ; then dnl - dnl Checking nasm patch version + dnl Checking nasm version dnl - AC_MSG_CHECKING([for nasm patch version]) - nasm_patch=`$nasm_prog -r | cut -d '.' -f 3 | cut -d ' ' -f 1` - if test -z $nasm_patch ; then - nasm_patch=-1 + AC_MSG_CHECKING([for nasm version]) + nasm_minor=`$nasm_prog -v | cut -d '.' -f 2 | cut -d ' ' -f 1` + nasm_major=`$nasm_prog -v | cut -d '.' -f 1 | cut -d ' ' -f 3` + if test -z $nasm_minor ; then + nasm_minor=-1 fi - AC_MSG_RESULT([$nasm_patch]) - + if test -z $nasm_major ; then + nasm_major=-1 + fi + AC_MSG_RESULT([$nasm_major]) - if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then - AC_MSG_WARN([nasm patch version is too old]) + dnl need nasm 2.x for SSE3/4 and X86_64 + if test "$nasm_major" -lt "$minimum_nasm_major_version" ; then + AC_MSG_WARN([nasm version is too old]) else - found_nasm_comp_prog="yes" - chosen_asm_prog="$nasm_prog" + found_nasm_comp_prog="yes" + chosen_asm_prog="$nasm_prog" fi fi fi @@ -379,25 +380,41 @@ AC_MSG_CHECKING([for asm object format]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) - AC_MSG_RESULT([elf]) - NASM_FORMAT="elf" + if test "$ARCHITECTURE" = "X86_64" ; then + AC_MSG_RESULT([elf64]) + NASM_FORMAT="elf64" + else + AC_MSG_RESULT([elf]) + NASM_FORMAT="elf" + fi MARK_FUNCS="-DMARK_FUNCS" PREFIX="" ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) - AC_MSG_RESULT([win32]) - NASM_FORMAT="win32" - PREFIX="-DPREFIX" + if test "$ARCHITECTURE" = "X86_64" ; then + AC_MSG_RESULT([win64]) + NASM_FORMAT="win64" + else + AC_MSG_RESULT([win32]) + NASM_FORMAT="win32" + fi + PREFIX="-DWINDOWS" MARK_FUNCS="" ;; + *darwin*) + AC_MSG_RESULT([macho]) + NASM_FORMAT="macho" + PREFIX="-DPREFIX" + MARK_FUNCS="" + ;; esac AS="$chosen_asm_prog" ASSEMBLY_EXTENSION="asm" - AFLAGS="-I\$(= 3.4.0 +dnl ========================================================================== + +if test "$GCC" = "yes" ; then +cat << EOF > test.c +#include +int main(int argc, char **argv) +{ + if (*argv[[1]] == 'M') { + printf("%d", __GNUC__); + } + if (*argv[[1]] == 'm') { + printf("%d", __GNUC_MINOR__); + } + return 0; +} +EOF + $CC -o gcc-ver test.c + + GCC_MAJOR=`./gcc-ver M` + GCC_MINOR=`./gcc-ver m` + + rm -f test.c + rm -f gcc-ver + + # GCC 4.x + if test "${GCC_MAJOR}" -gt 3 ; then + CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` + CFLAGS=`echo $CFLAGS | sed s,'-freduce-all-givs','',g` + CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g` + CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g` + CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g` + fi + + # GCC 3.4.x + if test "${GCC_MAJOR}" -eq 3 && test "${GCC_MINOR}" -gt 3 ; then + CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` + fi +fi + + +dnl ========================================================================== dnl dnl Substitions dnl