[svn] / trunk / xvidcore / build / generic / configure.in Repository:
ViewVC logotype

Diff of /trunk/xvidcore/build/generic/configure.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1382, Mon Mar 22 22:36:25 2004 UTC revision 1794, Fri Nov 14 15:43:28 2008 UTC
# Line 2  Line 2 
2  dnl  dnl
3  dnl Autoconf script for XviD  dnl Autoconf script for XviD
4  dnl  dnl
5  dnl Copyright(C) 2003 Edouard Gomez <ed.gomez@free.fr>  dnl Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr>
6  dnl  dnl
7  dnl ==========================================================================  dnl ==========================================================================
8    
9  AC_INIT([XviD], [1.0.0 rc3], [xvid-devel@xvid.org])  AC_PREREQ([2.50])
10    
11    AC_INIT([XviD], [1.1.0-beta2], [xvid-devel@xvid.org])
12  AC_CONFIG_SRCDIR(configure.in)  AC_CONFIG_SRCDIR(configure.in)
13    
14  dnl Do not forget to increase that when needed.  dnl Do not forget to increase that when needed.
15  API_MAJOR="4"  API_MAJOR="4"
16  API_MINOR="0"  API_MINOR="1"
17    
18  dnl NASM version requirement  dnl NASM version requirement
19  minimum_nasm_patch_version=34  minimum_nasm_patch_version=34
20    minimum_nasm_minor_version=99
21    minimum_nasm_major_version=2
22  nasm_prog="nasm"  nasm_prog="nasm"
23    yasm_prog="yasm"
24    
25  dnl Default CFLAGS -- Big impact on overall speed  dnl Default CFLAGS -- Big impact on overall speed
26  our_cflags_defaults="-Wall"  our_cflags_defaults="-Wall"
# Line 160  Line 165 
165            AC_MSG_RESULT(ia32)            AC_MSG_RESULT(ia32)
166                  ARCHITECTURE="IA32"                  ARCHITECTURE="IA32"
167                  ;;                  ;;
168              x86_64)
169                    AC_MSG_RESULT(x86_64)
170                    ARCHITECTURE="X86_64"
171                    ;;
172                  powerpc)                  powerpc)
173                  AC_MSG_RESULT(PowerPC)                  AC_MSG_RESULT(PowerPC)
174                  dnl ATM the ppc port is out of date                  ARCHITECTURE="PPC"
                 dnl ARCHITECTURE="PPC"  
                 ARCHITECTURE="GENERIC"  
175                  ;;                  ;;
176                  ia64)                  ia64)
177                  AC_MSG_RESULT(ia64)                  AC_MSG_RESULT(ia64)
# Line 260  Line 267 
267  SPECIFIC_CFLAGS=""  SPECIFIC_CFLAGS=""
268  PRE_SHARED_LIB=""  PRE_SHARED_LIB=""
269  case "$target_os" in  case "$target_os" in
270       *bsd*|linux*|irix*|solaris*)       linux*|solaris*)
271            AC_MSG_RESULT([ok])
272            STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
273            SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
274            SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm"
275            SPECIFIC_CFLAGS="-fPIC"
276            ;;
277         *bsd*|irix*)
278          AC_MSG_RESULT([ok])          AC_MSG_RESULT([ok])
279          STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"          STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
280          SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"          SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
# Line 325  Line 339 
339  dnl IA32  dnl IA32
340  dnl  dnl
341    
342  if test "$ARCHITECTURE" = "IA32" ; then  if test "$ARCHITECTURE" = "IA32" -o "$ARCHITECTURE" = "X86_64" ; then
343    
344     dnl     dnl
345     dnl Checking nasm existence     dnl Checking for nasm compatible programs
346       dnl yasm is preferred over nasm, because... i can use it
347       dnl to profile assembly code ;-)
348     dnl     dnl
349    
350       found_nasm_comp_prog="no"
351       chosen_asm_prog=""
352    
353       dnl Check for yasm first
354       AC_CHECK_PROG([ac_yasm], [$yasm_prog], [yes], [no], , [yes])
355       if test "$ac_yasm" = "yes" ; then
356         found_nasm_comp_prog="yes"
357         chosen_asm_prog="$yasm_prog"
358       fi
359    
360       dnl if yasm hasn't been found, then check for nasm (not buggy version)
361       if test "$found_nasm_comp_prog" = "no" ; then
362     AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes])     AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes])
363     if test "$ac_nasm" = "yes" ; then     if test "$ac_nasm" = "yes" ; then
   
364        dnl        dnl
365        dnl Checking nasm patch version        dnl Checking nasm patch version
366        dnl        dnl
367        AC_MSG_CHECKING([for nasm patch version])        AC_MSG_CHECKING([for nasm patch version])
368        nasm_patch=`nasm -r | cut -d '.' -f 3 | cut -d ' ' -f 1`             nasm_patch=`$nasm_prog -r | cut -d '.' -f 3 | cut -d ' ' -f 1`
369               nasm_minor=`$nasm_prog -v | cut -d '.' -f 2 | cut -d ' ' -f 1`
370               nasm_major=`$nasm_prog -v | cut -d '.' -f 1 | cut -d ' ' -f 3`
371        if test -z $nasm_patch ; then        if test -z $nasm_patch ; then
372          nasm_patch=-1          nasm_patch=-1
373        fi        fi
374               if test -z $nasm_minor ; then
375                  nasm_minor=-1
376               fi
377               if test -z $nasm_major ; then
378                  nasm_major=-1
379               fi
380        AC_MSG_RESULT([$nasm_patch])        AC_MSG_RESULT([$nasm_patch])
381    
382               dnl need nasm 2.x for SSE3/4 and X86_64
383        if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then             if test "$nasm_major" -lt "$minimum_nasm_major_version" ; then
384          AC_MSG_WARN([nasm patch version too old - Compiling generic sources only])               AC_MSG_WARN([nasm version is too old])
         ARCHITECTURE="GENERIC"  
385        else        else
386                 found_nasm_comp_prog="yes"
387                   chosen_asm_prog="$nasm_prog"
388               fi
389           fi
390       fi
391    
392           dnl           dnl
393           dnl Checking nasm format - win32 or elf     dnl Ok now sort what object format we must use
394           dnl           dnl
395           AC_MSG_CHECKING([for nasm object format])     if test "$found_nasm_comp_prog" = "yes" ; then
396           AC_MSG_CHECKING([for asm object format])
397           case "$target_os" in           case "$target_os" in
398                *bsd*|linux*|beos|irix*|solaris*)                *bsd*|linux*|beos|irix*|solaris*)
399                    AC_MSG_RESULT([elf])                    AC_MSG_RESULT([elf])
400                    NASM_FORMAT="elf"                    NASM_FORMAT="elf"
401                   MARK_FUNCS="-DMARK_FUNCS"
402                    PREFIX=""                    PREFIX=""
403                    ;;                    ;;
404                [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)                [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
405                    AC_MSG_RESULT([win32])                    AC_MSG_RESULT([win32])
406                    NASM_FORMAT="win32"                    NASM_FORMAT="win32"
407                    PREFIX="-DPREFIX"                    PREFIX="-DPREFIX"
408                   MARK_FUNCS=""
409                   ;;
410               *darwin*)
411                   AC_MSG_RESULT([macho])
412                   NASM_FORMAT="macho"
413                   PREFIX="-DPREFIX"
414                   MARK_FUNCS=""
415                    ;;                    ;;
416            esac            esac
417    
418            AS=nasm         AS="$chosen_asm_prog"
           AFLAGS="-I\$(<D)/ -f $NASM_FORMAT $PREFIX"  
419            ASSEMBLY_EXTENSION="asm"            ASSEMBLY_EXTENSION="asm"
420            ASSEMBLY_SOURCES="SRC_IA32"         AFLAGS="-I\$(<D)/ -f $NASM_FORMAT $PREFIX $MARK_FUNCS"
421           ASSEMBLY_SOURCES="SRC_${ARCHITECTURE}"
422           if test "$ARCHITECTURE" = "X86_64" ; then
423                   AFLAGS=${AFLAGS}" -m amd64"
424         fi         fi
   
425     else     else
426          AC_MSG_WARN([nasm not found - Compiling generic sources only])         AC_MSG_WARN([no correct assembler was found - Compiling generic sources only])
427          ARCHITECTURE="GENERIC"          ARCHITECTURE="GENERIC"
428     fi     fi
   
429  fi  fi
430    
431  dnl  dnl
432  dnl PPC  dnl PPC
433  dnl  dnl
434    dnl With the PPC platform we do not use assembly language, we better keep with
435    dnl intrinsic altivec functions and types as they are supported by both Apple
436    dnl and GNU gcc with very slight changes to code which can be sumed up by:
437    dnl
438    dnl Apple:
439    dnl  - compile with the option -faltivec
440    dnl  - define vectors with parentheses vec = (0,0,0,0)
441    dnl GNU
442    dnl  - compile with -maltivec -mabi=altivec
443    dnl  - include <altivec.h> before using intrincic
444    dnl  - define vectors with vec = {0,0,0,0}
445    dnl
446    dnl * The compile time option will be "injected" into SPECIFIC_CFLAGS variable
447    dnl * The need for altivec.h will also be injected into SPECIFIC_CFLAGS through
448    dnl   a -DHAVE_ALTIVEC_H
449    dnl * The vector definition is handled in portab.h thx to
450    dnl   HAVE_PARENTHESES/BRACES_ALTIVEC_DECL
451    dnl
452    PPC_ALTIVEC_SOURCES=""
453  if test "$ARCHITECTURE" = "PPC" ; then  if test "$ARCHITECTURE" = "PPC" ; then
454     AS="\$(CC)"     AS="\$(CC)"
455     AFLAGS="-c"     AFLAGS=""
456     ASSEMBLY_EXTENSION="s"     ASSEMBLY_EXTENSION=".s"
457     ASSEMBLY_SOURCES="SRC_PPC"     ASSEMBLY_SOURCES=""
458     AC_MSG_CHECKING([for Altivec support])  
459     cat > conftest.S << EOF     AC_MSG_CHECKING([for altivec.h])
460           .text  cat > conftest.c << EOF
461           vxor 0,0,0  #include <altivec.h>
462    int main() { return(0); }
463  EOF  EOF
464     if $CC -c conftest.S 2>/dev/null 1>/dev/null ; then     if $CC -faltivec -c conftest.c 2>/dev/null 1>/dev/null || \
465          $CC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then
466          AC_MSG_RESULT(yes)          AC_MSG_RESULT(yes)
467          SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DARCH_IS_PPC_ALTIVEC"          SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_H"
468          ASSEMBLY_SOURCES="SRC_ALTIVEC"          TEMP_ALTIVEC="-DHAVE_ALTIVEC_H"
469     else     else
470          AC_MSG_RESULT(no)          AC_MSG_RESULT(no)
471            TEMP_ALTIVEC=""
472       fi
473    
474       AC_MSG_CHECKING([for Altivec compiler support])
475    cat > conftest.c << EOF
476    #ifdef HAVE_ALTIVEC_H
477    #include <altivec.h>
478    #endif
479    
480    int main()
481    {
482      vector unsigned int vartest2 = (vector unsigned int)(0);
483      vector unsigned int vartest3 = (vector unsigned int)(1);
484      vartest2 = vec_add(vartest2, vartest3);
485      return(0);
486    }
487    EOF
488       if $CC $TEMP_ALTIVEC -faltivec -c conftest.c 2>/dev/null 1>/dev/null ; then
489            AC_MSG_RESULT([yes (Apple)])
490            SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -faltivec -DHAVE_ALTIVEC_PARENTHESES_DECL $TEMP_ALTIVEC"
491            PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC"
492       else
493    cat > conftest.c << EOF
494    #ifdef HAVE_ALTIVEC_H
495    #include <altivec.h>
496    #endif
497    
498    int main()
499    {
500      vector unsigned int vartest2 = (vector unsigned int){0};
501      vector unsigned int vartest3 = (vector unsigned int){1};
502      vartest2 = vec_add(vartest2, vartest3);
503      return(0);
504    }
505    EOF
506       if $CC $TEMP_ALTIVEC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then
507            AC_MSG_RESULT([yes (GNU)])
508            SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -maltivec -mabi=altivec -DHAVE_ALTIVEC_BRACES_DECL $TEMP_ALTIVEC"
509            PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC"
510       else
511            AC_MSG_RESULT([no (ppc support won't be compiled in)])
512            dnl Only C code can be compiled :-(
513            ARCHITECTURE="GENERIC"
514     fi     fi
515       fi
516    
517     rm -f conftest.*     rm -f conftest.*
518  fi  fi
519    
# Line 439  Line 553 
553  AC_CHECK_HEADERS(  AC_CHECK_HEADERS(
554          stdio.h \          stdio.h \
555          signal.h \          signal.h \
556            stdlib.h \
557            string.h \
558            assert.h \
559            math.h \
560          , , AC_MSG_ERROR(Missing header file))          , , AC_MSG_ERROR(Missing header file))
561    
562  dnl ==========================================================================  dnl ==========================================================================
563  dnl  dnl
564    dnl Check for pthread
565    dnl
566    dnl ==========================================================================
567    
568    AC_CHECK_HEADER(
569            pthread.h,
570            AC_CHECK_LIB(
571                    pthread,
572                    pthread_create,
573                    AC_CHECK_LIB(
574                            pthread,
575                            pthread_join,
576                            SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD"
577                            SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread",
578                            AC_MSG_WARN(Pthread not supported. No SMP support)),
579                    AC_MSG_WARN(Pthread not supported. No SMP support)),
580            AC_MSG_WARN(Pthread not supported. No SMP support))
581    
582    dnl ==========================================================================
583    dnl
584  dnl Now we can set CFLAGS if needed  dnl Now we can set CFLAGS if needed
585  dnl  dnl
586  dnl ==========================================================================  dnl ==========================================================================
# Line 467  Line 605 
605  fi  fi
606    
607  dnl ==========================================================================  dnl ==========================================================================
608    dnl Some gcc flags can't be used for gcc >= 3.4.0
609    dnl ==========================================================================
610    
611    if test "$GCC" = "yes" ; then
612    cat << EOF > test.c
613    #include <stdio.h>
614    int main(int argc, char **argv)
615    {
616            if (*argv[[1]] == 'M') {
617                    printf("%d", __GNUC__);
618            }
619            if (*argv[[1]] == 'm') {
620                    printf("%d", __GNUC_MINOR__);
621            }
622            return 0;
623    }
624    EOF
625            $CC -o gcc-ver test.c
626    
627            GCC_MAJOR=`./gcc-ver M`
628            GCC_MINOR=`./gcc-ver m`
629    
630            rm -f test.c
631            rm -f gcc-ver
632    
633            # GCC 4.x
634            if test "${GCC_MAJOR}" -gt 3 ; then
635                    CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g`
636                    CFLAGS=`echo $CFLAGS | sed s,'-freduce-all-givs','',g`
637                    CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g`
638                    CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g`
639                    CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g`
640            fi
641    
642            # GCC 3.4.x
643            if test "${GCC_MAJOR}" -eq 3 && test "${GCC_MINOR}" -gt 3 ; then
644                    CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g`
645            fi
646    fi
647    
648    
649    dnl ==========================================================================
650  dnl  dnl
651  dnl Substitions  dnl Substitions
652  dnl  dnl
# Line 490  Line 670 
670  AC_SUBST(SPECIFIC_LDFLAGS)  AC_SUBST(SPECIFIC_LDFLAGS)
671  AC_SUBST(SPECIFIC_CFLAGS)  AC_SUBST(SPECIFIC_CFLAGS)
672  AC_SUBST(DCT_IA64_SOURCES)  AC_SUBST(DCT_IA64_SOURCES)
673    AC_SUBST(PPC_ALTIVEC_SOURCES)
674  AC_SUBST(RANLIB)  AC_SUBST(RANLIB)
675  AC_SUBST(API_MAJOR)  AC_SUBST(API_MAJOR)
676  AC_SUBST(API_MINOR)  AC_SUBST(API_MINOR)

Legend:
Removed from v.1382  
changed lines
  Added in v.1794

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4