~ubuntu-branches/ubuntu/utopic/libav/utopic

« back to all changes in this revision

Viewing changes to configure

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-12-21 15:32:13 UTC
  • mto: (1.2.18)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20121221153213-fudzrugjzivtv0wp
Tags: upstream-9~beta3
ImportĀ upstreamĀ versionĀ 9~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
  --enable-gray            enable full grayscale support (slower color)
102
102
  --disable-swscale-alpha  disable alpha channel support in swscale
103
103
 
104
 
Component options:
105
 
  --disable-doc            do not build documentation
 
104
Program options:
 
105
  --disable-programs       do not build command line programs
106
106
  --disable-avconv         disable avconv build
107
107
  --disable-avplay         disable avplay build
108
108
  --disable-avprobe        disable avprobe build
109
109
  --disable-avserver       disable avserver build
 
110
 
 
111
Component options:
 
112
  --disable-doc            do not build documentation
110
113
  --disable-avdevice       disable libavdevice build
111
114
  --disable-avcodec        disable libavcodec build
112
115
  --disable-avformat       disable libavformat build
 
116
  --disable-avutil         disable libavutil build
113
117
  --disable-swscale        disable libswscale build
114
118
  --disable-avfilter       disable video filter support [no]
115
119
  --disable-avresample     disable libavresample build [no]
120
124
  --disable-dct            disable DCT code
121
125
  --disable-dwt            disable DWT code
122
126
  --disable-lsp            disable LSP code
 
127
  --disable-lzo            disable LZO decoder code
123
128
  --disable-mdct           disable MDCT code
124
129
  --disable-rdft           disable RDFT code
125
130
  --disable-fft            disable FFT code
260
265
  --disable-armv5te        disable armv5te optimizations
261
266
  --disable-armv6          disable armv6 optimizations
262
267
  --disable-armv6t2        disable armv6t2 optimizations
263
 
  --disable-armvfp         disable ARM VFP optimizations
 
268
  --disable-vfp            disable VFP optimizations
264
269
  --disable-neon           disable NEON optimizations
265
270
  --disable-vis            disable VIS optimizations
266
271
  --disable-inline-asm     disable use of inline assembler
530
535
    return 1
531
536
}
532
537
 
533
 
check_deps(){
 
538
do_check_deps(){
534
539
    for cfg; do
535
540
        cfg="${cfg#!}"
536
541
        enabled ${cfg}_checking && die "Circular dependency for $cfg."
537
542
        disabled ${cfg}_checking && continue
538
543
        enable ${cfg}_checking
 
544
        append allopts $cfg
539
545
 
540
546
        eval dep_all="\$${cfg}_deps"
541
547
        eval dep_any="\$${cfg}_deps_any"
545
551
        eval dep_ifn="\$${cfg}_if_any"
546
552
 
547
553
        pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
548
 
        check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
 
554
        do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
549
555
        popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
550
556
 
551
557
        [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
555
561
        disabled_any $dep_sel && disable $cfg
556
562
 
557
563
        if enabled $cfg; then
558
 
            eval dep_extralibs="\$${cfg}_extralibs"
559
 
            test -n "$dep_extralibs" && add_extralibs $dep_extralibs
560
564
            enable_deep $dep_sel
561
565
            enable_deep_weak $dep_sgs
562
566
        fi
565
569
    done
566
570
}
567
571
 
568
 
print_config_h(){
569
 
    enabled $1 && v=1 || v=0
570
 
    echo "#define $2 $v"
571
 
}
572
 
 
573
 
print_config_mak(){
574
 
    enabled $1 && v= || v=!
575
 
    echo "$v$2=yes"
576
 
}
577
 
 
578
 
print_config_asm(){
579
 
    enabled $1 && v=1 || v=0
580
 
    echo "%define $2 $v"
 
572
check_deps(){
 
573
    unset allopts
 
574
 
 
575
    do_check_deps "$@"
 
576
 
 
577
    for cfg in $allopts; do
 
578
        enabled $cfg || continue
 
579
        eval dep_extralibs="\$${cfg}_extralibs"
 
580
        test -n "$dep_extralibs" && add_extralibs $dep_extralibs
 
581
    done
581
582
}
582
583
 
583
584
print_config(){
584
585
    pfx=$1
585
586
    files=$2
586
587
    shift 2
587
 
    for cfg; do
588
 
        ucname="$(toupper $cfg)"
589
 
        for f in $files; do
590
 
            "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
591
 
        done
592
 
    done
 
588
    map 'eval echo "$v \${$v:-no}"' "$@" |
 
589
    awk "BEGIN { split(\"$files\", files) }
 
590
        {
 
591
            c = \"$pfx\" toupper(\$1);
 
592
            v = \$2;
 
593
            sub(/yes/, 1, v);
 
594
            sub(/no/,  0, v);
 
595
            for (f in files) {
 
596
                file = files[f];
 
597
                if (file ~ /\\.h\$/) {
 
598
                    printf(\"#define %s %d\\n\", c, v) >>file;
 
599
                } else if (file ~ /\\.asm\$/) {
 
600
                    printf(\"%%define %s %d\\n\", c, v) >>file;
 
601
                } else if (file ~ /\\.mak\$/) {
 
602
                    n = -v ? \"\" : \"!\";
 
603
                    printf(\"%s%s=yes\\n\", n, c) >>file;
 
604
                }
 
605
            }
 
606
        }"
593
607
}
594
608
 
595
609
print_enabled(){
596
 
    test x"$1" = x-n && end=" " && shift || end="\n"
597
610
    suf=$1
598
611
    shift
599
612
    for v; do
600
 
        enabled $v && printf "%s$end" ${v%$suf};
 
613
        enabled $v && printf "%s\n" ${v%$suf};
601
614
    done
602
615
}
603
616
 
680
693
 
681
694
check_as(){
682
695
    log check_as "$@"
683
 
    cat > $TMPC
684
 
    log_file $TMPC
685
 
    check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPC
 
696
    cat > $TMPS
 
697
    log_file $TMPS
 
698
    check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
686
699
}
687
700
 
688
701
check_inline_asm(){
691
704
    code="$2"
692
705
    shift 2
693
706
    disable $name
694
 
    check_as "$@" <<EOF && enable $name
 
707
    check_cc "$@" <<EOF && enable $name
695
708
void foo(void){ __asm__ volatile($code); }
696
709
EOF
697
710
}
698
711
 
 
712
check_insn(){
 
713
    log check_insn "$@"
 
714
    check_inline_asm ${1}_inline "\"$2\""
 
715
    echo "$2" | check_as && enable ${1}_external || disable ${1}_external
 
716
}
 
717
 
699
718
check_yasm(){
700
719
    log check_yasm "$@"
701
720
    echo "$1" > $TMPS
784
803
check_mathfunc(){
785
804
    log check_mathfunc "$@"
786
805
    func=$1
787
 
    shift
 
806
    narg=$2
 
807
    shift 2
 
808
    test $narg = 2 && args="f, g" || args="f"
788
809
    disable $func
789
810
    check_ld "$@" <<EOF && enable $func
790
811
#include <math.h>
791
 
float foo(float f) { return $func(f); }
 
812
float foo(float f, float g) { return $func($args); }
792
813
int main(void){ return 0; }
793
814
EOF
794
815
}
976
997
    protocols
977
998
"
978
999
 
 
1000
LIBRARY_LIST="
 
1001
    avcodec
 
1002
    avdevice
 
1003
    avfilter
 
1004
    avformat
 
1005
    avresample
 
1006
    avutil
 
1007
    swscale
 
1008
"
 
1009
 
979
1010
PROGRAM_LIST="
980
1011
    avconv
981
1012
    avplay
985
1016
 
986
1017
CONFIG_LIST="
987
1018
    $COMPONENT_LIST
 
1019
    $LIBRARY_LIST
988
1020
    $PROGRAM_LIST
989
 
    avcodec
990
 
    avdevice
991
 
    avfilter
992
 
    avformat
993
 
    avresample
994
1021
    avisynth
995
1022
    bzlib
996
1023
    dct
1029
1056
    libxavs
1030
1057
    libxvid
1031
1058
    lsp
 
1059
    lzo
1032
1060
    mdct
1033
1061
    memalign_hack
1034
1062
    network
1042
1070
    small
1043
1071
    sram
1044
1072
    static
1045
 
    swscale
1046
1073
    swscale_alpha
1047
1074
    thumb
1048
1075
    vaapi
1060
1087
'
1061
1088
 
1062
1089
ARCH_LIST='
 
1090
    aarch64
1063
1091
    alpha
1064
1092
    arm
1065
1093
    avr32
1085
1113
    x86_64
1086
1114
'
1087
1115
 
 
1116
ARCH_EXT_LIST_ARM='
 
1117
    armv5te
 
1118
    armv6
 
1119
    armv6t2
 
1120
    neon
 
1121
    vfp
 
1122
    vfpv3
 
1123
'
 
1124
 
1088
1125
ARCH_EXT_LIST_X86='
1089
1126
    amd3dnow
1090
1127
    amd3dnowext
1101
1138
'
1102
1139
 
1103
1140
ARCH_EXT_LIST="
 
1141
    $ARCH_EXT_LIST_ARM
1104
1142
    $ARCH_EXT_LIST_X86
1105
1143
    altivec
1106
 
    armv5te
1107
 
    armv6
1108
 
    armv6t2
1109
 
    armvfp
1110
 
    neon
1111
1144
    ppc4xx
1112
 
    vfpv3
1113
1145
    vis
1114
1146
"
1115
1147
 
1170
1202
    attribute_packed
1171
1203
    closesocket
1172
1204
    cmov
 
1205
    CommandLineToArgvW
1173
1206
    cpunop
1174
1207
    CryptGenRandom
1175
1208
    dcbzl
1230
1263
    sched_getaffinity
1231
1264
    sdl
1232
1265
    sdl_video_size
 
1266
    SetConsoleTextAttribute
1233
1267
    setmode
1234
1268
    setrlimit
1235
1269
    Sleep
1271
1305
    xmm_clobbers
1272
1306
"
1273
1307
 
1274
 
# options emitted with CONFIG_ prefix but not available on command line
 
1308
# options emitted with CONFIG_ prefix but not available on the command line
1275
1309
CONFIG_EXTRA="
1276
1310
    aandcttables
1277
1311
    ac3dsp
1278
 
    avutil
1279
1312
    error_resilience
1280
1313
    gcrypt
1281
1314
    golomb
1295
1328
    rangecoder
1296
1329
    rtpdec
1297
1330
    sinewin
 
1331
    videodsp
1298
1332
    vp3dsp
1299
1333
"
1300
1334
 
1366
1400
armv5te_deps="arm"
1367
1401
armv6_deps="arm"
1368
1402
armv6t2_deps="arm"
1369
 
armvfp_deps="arm"
1370
1403
neon_deps="arm"
1371
 
vfpv3_deps="armvfp"
 
1404
vfp_deps="arm"
 
1405
vfpv3_deps="vfp"
 
1406
 
 
1407
map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
1372
1408
 
1373
1409
altivec_deps="ppc"
1374
1410
ppc4xx_deps="ppc"
1403
1439
 
1404
1440
aligned_stack_if_any="ppc x86"
1405
1441
fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1406
 
fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
1407
 
fast_unaligned_if_any="armv6 ppc x86"
 
1442
fast_clz_if_any="alpha avr32 mips ppc x86"
 
1443
fast_unaligned_if_any="ppc x86"
1408
1444
 
1409
1445
inline_asm_deps="!tms470"
1410
1446
need_memalign="altivec neon sse"
1436
1472
binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1437
1473
binkaudio_rdft_decoder_select="mdct rdft sinewin"
1438
1474
cavs_decoder_select="golomb mpegvideo"
 
1475
comfortnoise_encoder_select="lpc"
1439
1476
cook_decoder_select="mdct sinewin"
 
1477
cscd_decoder_select="lzo"
1440
1478
cscd_decoder_suggest="zlib"
1441
1479
dca_decoder_select="mdct"
1442
1480
dnxhd_encoder_select="aandcttables mpegvideoenc"
1507
1545
mpeg4_encoder_select="h263_encoder"
1508
1546
mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1509
1547
mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
 
1548
mpegvideo_select="videodsp"
1510
1549
msmpeg4v1_decoder_select="h263_decoder"
1511
1550
msmpeg4v1_encoder_select="h263_encoder"
1512
1551
msmpeg4v2_decoder_select="h263_decoder"
1516
1555
mss2_decoder_select="vc1_decoder"
1517
1556
nellymoser_decoder_select="mdct sinewin"
1518
1557
nellymoser_encoder_select="mdct sinewin"
 
1558
nuv_decoder_select="lzo"
1519
1559
png_decoder_select="zlib"
1520
1560
png_encoder_select="zlib"
1521
1561
qcelp_decoder_select="lsp"
1551
1591
vc1image_decoder_select="vc1_decoder"
1552
1592
vorbis_decoder_select="mdct"
1553
1593
vorbis_encoder_select="mdct"
1554
 
vp3_decoder_select="vp3dsp"
1555
 
vp5_decoder_select="vp3dsp"
1556
 
vp6_decoder_select="huffman vp3dsp"
 
1594
vp3_decoder_select="vp3dsp videodsp"
 
1595
vp5_decoder_select="vp3dsp videodsp"
 
1596
vp6_decoder_select="huffman vp3dsp videodsp"
1557
1597
vp6a_decoder_select="vp6_decoder"
1558
1598
vp6f_decoder_select="vp6_decoder"
1559
 
vp8_decoder_select="h264pred h264qpel"
 
1599
vp8_decoder_select="h264pred videodsp"
1560
1600
wmapro_decoder_select="mdct sinewin"
1561
1601
wmav1_decoder_select="mdct sinewin"
1562
1602
wmav1_encoder_select="mdct sinewin"
1627
1667
eac3_demuxer_select="ac3_parser"
1628
1668
flac_demuxer_select="flac_parser"
1629
1669
ipod_muxer_select="mov_muxer"
 
1670
ismv_muxer_select="mov_muxer"
1630
1671
matroska_audio_muxer_select="matroska_muxer"
1631
 
matroska_demuxer_suggest="zlib bzlib"
 
1672
matroska_demuxer_suggest="bzlib lzo zlib"
1632
1673
mov_demuxer_suggest="zlib"
1633
1674
mp3_demuxer_select="mpegaudio_parser"
1634
1675
mp4_muxer_select="mov_muxer"
1647
1688
sdp_demuxer_select="rtpdec"
1648
1689
smoothstreaming_muxer_select="ismv_muxer"
1649
1690
spdif_muxer_select="aac_parser"
 
1691
tak_demuxer_select="tak_parser"
1650
1692
tg2_muxer_select="mov_muxer"
1651
1693
tgp_muxer_select="mov_muxer"
1652
1694
w64_demuxer_deps="wav_demuxer"
1676
1718
ffrtmpcrypt_protocol_select="tcp_protocol"
1677
1719
ffrtmphttp_protocol_deps="!librtmp_protocol"
1678
1720
ffrtmphttp_protocol_select="http_protocol"
1679
 
gopher_protocol_deps="network"
1680
 
httpproxy_protocol_deps="network"
 
1721
gopher_protocol_select="network"
1681
1722
httpproxy_protocol_select="tcp_protocol"
1682
 
http_protocol_deps="network"
1683
1723
http_protocol_select="tcp_protocol"
1684
1724
https_protocol_select="tls_protocol"
1685
1725
librtmp_protocol_deps="librtmp"
1688
1728
librtmpt_protocol_deps="librtmp"
1689
1729
librtmpte_protocol_deps="librtmp"
1690
1730
mmsh_protocol_select="http_protocol"
1691
 
mmst_protocol_deps="network"
 
1731
mmst_protocol_select="network"
1692
1732
rtmp_protocol_deps="!librtmp_protocol"
1693
1733
rtmp_protocol_select="tcp_protocol"
1694
1734
rtmpe_protocol_select="ffrtmpcrypt_protocol"
1698
1738
rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
1699
1739
rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
1700
1740
rtp_protocol_select="udp_protocol"
1701
 
sctp_protocol_deps="network struct_sctp_event_subscribe"
1702
 
tcp_protocol_deps="network"
 
1741
sctp_protocol_deps="struct_sctp_event_subscribe"
 
1742
sctp_protocol_select="network"
 
1743
tcp_protocol_select="network"
1703
1744
tls_protocol_deps_any="openssl gnutls"
1704
1745
tls_protocol_select="tcp_protocol"
1705
 
udp_protocol_deps="network"
 
1746
udp_protocol_select="network"
1706
1747
 
1707
1748
# filters
1708
1749
blackframe_filter_deps="gpl"
1721
1762
yadif_filter_deps="gpl"
1722
1763
 
1723
1764
# libraries
1724
 
avdevice_deps="avcodec avformat"
1725
 
avformat_deps="avcodec"
 
1765
avcodec_deps="avutil"
 
1766
avdevice_deps="avutil avcodec avformat"
 
1767
avfilter_deps="avutil"
 
1768
avformat_deps="avutil avcodec"
 
1769
avresample_deps="avutil"
 
1770
swscale_deps="avutil"
1726
1771
 
1727
1772
# programs
1728
 
avconv_deps="avcodec avfilter avformat avresample swscale
1729
 
             aformat_filter asyncts_filter
1730
 
             format_filter fps_filter scale_filter setpts_filter"
1731
 
avplay_deps="avcodec avformat swscale sdl"
 
1773
avconv_deps="avcodec avfilter avformat avresample swscale"
 
1774
avconv_select="aformat_filter anull_filter asyncts_filter format_filter
 
1775
               fps_filter null_filter resample_filter scale_filter
 
1776
               setpts_filter"
 
1777
avplay_deps="avcodec avformat avresample swscale sdl"
1732
1778
avplay_select="rdft"
1733
1779
avprobe_deps="avcodec avformat"
1734
1780
avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
1772
1818
host_os=$target_os_default
1773
1819
 
1774
1820
# configurable options
1775
 
enable $PROGRAM_LIST
1776
 
 
1777
 
enable avcodec
1778
 
enable avdevice
1779
 
enable avfilter
1780
 
enable avformat
1781
 
enable avresample
1782
 
enable avutil
1783
 
enable swscale
 
1821
enable $LIBRARY_LIST $PROGRAM_LIST
1784
1822
 
1785
1823
enable asm
1786
1824
enable debug
1787
1825
enable doc
1788
 
enable network
1789
1826
enable optimizations
1790
1827
enable safe_bitstream_reader
1791
1828
enable static
1933
1970
for opt do
1934
1971
    optval="${opt#*=}"
1935
1972
    case "$opt" in
1936
 
    --extra-ldflags=*) add_ldflags $optval
1937
 
    ;;
1938
 
    --extra-libs=*) add_extralibs $optval
1939
 
    ;;
1940
 
    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1941
 
    ;;
1942
 
    --enable-debug=*) debuglevel="$optval"
1943
 
    ;;
1944
 
    --disable-everything)
1945
 
    map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
1946
 
    ;;
1947
 
    --enable-random|--disable-random)
1948
 
    action=${opt%%-random}
1949
 
    do_random ${action#--} $COMPONENT_LIST
1950
 
    ;;
1951
 
    --enable-random=*|--disable-random=*)
1952
 
    action=${opt%%-random=*}
1953
 
    do_random ${action#--} $optval
1954
 
    ;;
1955
 
    --enable-*=*|--disable-*=*)
1956
 
    eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
1957
 
    is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
1958
 
    eval list=\$$(toupper $thing)_LIST
1959
 
    name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
1960
 
    $action $(filter "$name" $list)
1961
 
    ;;
1962
 
    --enable-?*|--disable-?*)
1963
 
    eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
1964
 
    if is_in $option $COMPONENT_LIST; then
1965
 
        test $action = disable && action=unset
1966
 
        eval $action \$$(toupper ${option%s})_LIST
1967
 
    elif is_in $option $CMDLINE_SELECT; then
1968
 
        $action $option
1969
 
    else
1970
 
        die_unknown $opt
1971
 
    fi
1972
 
    ;;
1973
 
    --list-*)
1974
 
        NAME="${opt#--list-}"
1975
 
        is_in $NAME $COMPONENT_LIST || die_unknown $opt
1976
 
        NAME=${NAME%s}
1977
 
        eval show_list $NAME \$$(toupper $NAME)_LIST
1978
 
    ;;
1979
 
    --help|-h) show_help
1980
 
    ;;
1981
 
    *)
1982
 
    optname="${opt%%=*}"
1983
 
    optname="${optname#--}"
1984
 
    optname=$(echo "$optname" | sed 's/-/_/g')
1985
 
    if is_in $optname $CMDLINE_SET; then
1986
 
        eval $optname='$optval'
1987
 
    elif is_in $optname $CMDLINE_APPEND; then
1988
 
        append $optname "$optval"
1989
 
    else
1990
 
         die_unknown $opt
1991
 
    fi
1992
 
    ;;
 
1973
        --extra-ldflags=*)
 
1974
            add_ldflags $optval
 
1975
        ;;
 
1976
        --extra-libs=*)
 
1977
            add_extralibs $optval
 
1978
        ;;
 
1979
        --disable-devices)
 
1980
            disable $INDEV_LIST $OUTDEV_LIST
 
1981
        ;;
 
1982
        --enable-debug=*)
 
1983
            debuglevel="$optval"
 
1984
        ;;
 
1985
        --disable-programs)
 
1986
            disable $PROGRAM_LIST
 
1987
        ;;
 
1988
        --disable-everything)
 
1989
            map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
 
1990
        ;;
 
1991
        --enable-random|--disable-random)
 
1992
            action=${opt%%-random}
 
1993
            do_random ${action#--} $COMPONENT_LIST
 
1994
        ;;
 
1995
        --enable-random=*|--disable-random=*)
 
1996
            action=${opt%%-random=*}
 
1997
            do_random ${action#--} $optval
 
1998
        ;;
 
1999
        --enable-*=*|--disable-*=*)
 
2000
            eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
 
2001
            is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
 
2002
            eval list=\$$(toupper $thing)_LIST
 
2003
            name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
 
2004
            $action $(filter "$name" $list)
 
2005
        ;;
 
2006
        --enable-?*|--disable-?*)
 
2007
            eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
 
2008
            if is_in $option $COMPONENT_LIST; then
 
2009
                test $action = disable && action=unset
 
2010
                eval $action \$$(toupper ${option%s})_LIST
 
2011
            elif is_in $option $CMDLINE_SELECT; then
 
2012
                $action $option
 
2013
            else
 
2014
                die_unknown $opt
 
2015
            fi
 
2016
        ;;
 
2017
        --list-*)
 
2018
            NAME="${opt#--list-}"
 
2019
            is_in $NAME $COMPONENT_LIST || die_unknown $opt
 
2020
            NAME=${NAME%s}
 
2021
            eval show_list $NAME \$$(toupper $NAME)_LIST
 
2022
        ;;
 
2023
        --help|-h) show_help
 
2024
        ;;
 
2025
        *)
 
2026
            optname="${opt%%=*}"
 
2027
            optname="${optname#--}"
 
2028
            optname=$(echo "$optname" | sed 's/-/_/g')
 
2029
            if is_in $optname $CMDLINE_SET; then
 
2030
                eval $optname='$optval'
 
2031
            elif is_in $optname $CMDLINE_APPEND; then
 
2032
                append $optname "$optval"
 
2033
            else
 
2034
                die_unknown $opt
 
2035
            fi
 
2036
        ;;
1993
2037
    esac
1994
2038
done
1995
2039
 
2103
2147
    die "Sanity test failed."
2104
2148
fi
2105
2149
 
 
2150
ccc_flags(){
 
2151
    for flag; do
 
2152
        case $flag in
 
2153
            -std=c99)           echo -c99                       ;;
 
2154
            -mcpu=*)            echo -arch ${flag#*=}           ;;
 
2155
            -mieee)             echo -ieee                      ;;
 
2156
            -O*|-fast)          echo $flag                      ;;
 
2157
            -fno-math-errno)    echo -assume nomath_errno       ;;
 
2158
            -g)                 echo -g3                        ;;
 
2159
            -Wall)              echo -msg_enable level2         ;;
 
2160
            -Wno-pointer-sign)  echo -msg_disable ptrmismatch1  ;;
 
2161
            -Wl,*)              echo $flag                      ;;
 
2162
            -f*|-W*)                                            ;;
 
2163
            *)                  echo $flag                      ;;
 
2164
        esac
 
2165
   done
 
2166
}
 
2167
 
2106
2168
msvc_flags(){
2107
2169
    for flag; do
2108
2170
        case $flag in
2153
2215
                    prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
2154
2216
                    *-sse3)             echo -xarch=sse3                 ;;
2155
2217
                    core2)              echo -xarch=ssse3 -xchip=core2   ;;
 
2218
                    corei7)           echo -xarch=sse4_2 -xchip=nehalem  ;;
 
2219
                    corei7-avx)       echo -xarch=avx -xchip=sandybridge ;;
2156
2220
                    amdfam10|barcelona|bdver*) echo -xarch=sse4_1        ;;
2157
2221
                    athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
2158
2222
                    k8|opteron|athlon64|athlon-fx)
2243
2307
        _type=ccc
2244
2308
        _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
2245
2309
        _DEPFLAGS='-M'
2246
 
        debuglevel=3
2247
 
        _ldflags='-Wl,-z,now' # calls to libots crash without this
2248
2310
        _cflags_speed='-fast'
2249
2311
        _cflags_size='-O1'
 
2312
        _flags_filter=ccc_flags
2250
2313
    elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
2251
2314
        test -d "$sysroot" || die "No valid sysroot specified."
2252
2315
        _type=armcc
2450
2513
 
2451
2514
# Deal with common $arch aliases
2452
2515
case "$arch" in
 
2516
    aarch64|arm64)
 
2517
        arch="aarch64"
 
2518
    ;;
2453
2519
    arm*)
2454
2520
        arch="arm"
2455
2521
    ;;
2456
 
    mips|mipsel|IP*)
2457
 
        arch="mips"
2458
 
    ;;
2459
 
    mips64*)
2460
 
        arch="mips"
2461
 
        subarch="mips64"
2462
 
    ;;
2463
 
    parisc|hppa)
2464
 
        arch="parisc"
2465
 
    ;;
2466
 
    parisc64|hppa64)
2467
 
        arch="parisc"
2468
 
        subarch="parisc64"
2469
 
    ;;
2470
 
    "Power Macintosh"|ppc|powerpc)
2471
 
        arch="ppc"
2472
 
    ;;
2473
 
    ppc64|powerpc64)
2474
 
        arch="ppc"
2475
 
        subarch="ppc64"
 
2522
    mips*|IP*)
 
2523
        arch="mips"
 
2524
    ;;
 
2525
    parisc*|hppa*)
 
2526
        arch="parisc"
 
2527
    ;;
 
2528
    "Power Macintosh"|ppc*|powerpc*)
 
2529
        arch="ppc"
2476
2530
    ;;
2477
2531
    s390|s390x)
2478
2532
        arch="s390"
2480
2534
    sh4|sh)
2481
2535
        arch="sh4"
2482
2536
    ;;
2483
 
    sun4u|sparc64)
 
2537
    sun4u|sparc*)
2484
2538
        arch="sparc"
2485
 
        subarch="sparc64"
2486
2539
    ;;
2487
2540
    tilegx|tile-gx)
2488
2541
        arch="tilegx"
2496
2549
enable $arch
2497
2550
 
2498
2551
# Add processor-specific flags
2499
 
if test "$cpu" = generic; then
2500
 
    : do nothing
 
2552
if enabled aarch64; then
 
2553
 
 
2554
    case $cpu in
 
2555
        armv*)
 
2556
            cpuflags="-march=$cpu"
 
2557
        ;;
 
2558
        *)
 
2559
            cpuflags="-mcpu=$cpu"
 
2560
        ;;
 
2561
    esac
 
2562
 
 
2563
elif enabled alpha; then
 
2564
 
 
2565
    cpuflags="-mcpu=$cpu"
 
2566
 
 
2567
elif enabled arm; then
 
2568
 
 
2569
    check_arm_arch() {
 
2570
        check_cpp_condition stddef.h \
 
2571
            "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
 
2572
            $cpuflags
 
2573
    }
 
2574
 
 
2575
    probe_arm_arch() {
 
2576
        if   check_arm_arch 4;        then echo armv4;
 
2577
        elif check_arm_arch 4T;       then echo armv4t;
 
2578
        elif check_arm_arch 5;        then echo armv5;
 
2579
        elif check_arm_arch 5E;       then echo armv5e;
 
2580
        elif check_arm_arch 5T;       then echo armv5t;
 
2581
        elif check_arm_arch 5TE;      then echo armv5te;
 
2582
        elif check_arm_arch 5TEJ;     then echo armv5te;
 
2583
        elif check_arm_arch 6;        then echo armv6;
 
2584
        elif check_arm_arch 6J;       then echo armv6j;
 
2585
        elif check_arm_arch 6K;       then echo armv6k;
 
2586
        elif check_arm_arch 6Z;       then echo armv6z;
 
2587
        elif check_arm_arch 6ZK;      then echo armv6zk;
 
2588
        elif check_arm_arch 6T2;      then echo armv6t2;
 
2589
        elif check_arm_arch 7;        then echo armv7;
 
2590
        elif check_arm_arch 7A  7_A;  then echo armv7-a;
 
2591
        elif check_arm_arch 7R  7_R;  then echo armv7-r;
 
2592
        elif check_arm_arch 7M  7_M;  then echo armv7-m;
 
2593
        elif check_arm_arch 7EM 7E_M; then echo armv7-m;
 
2594
        elif check_arm_arch 8A  8_A;  then echo armv8-a;
 
2595
        fi
 
2596
    }
 
2597
 
 
2598
    [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
 
2599
 
 
2600
    case $cpu in
 
2601
        armv*)
 
2602
            cpuflags="-march=$cpu"
 
2603
            subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
 
2604
        ;;
 
2605
        *)
 
2606
            cpuflags="-mcpu=$cpu"
 
2607
            case $cpu in
 
2608
                cortex-a*)                               subarch=armv7a  ;;
 
2609
                cortex-r*)                               subarch=armv7r  ;;
 
2610
                cortex-m*)                 enable thumb; subarch=armv7m  ;;
 
2611
                arm11*)                                  subarch=armv6   ;;
 
2612
                arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
 
2613
                armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
 
2614
                *)                             subarch=$(probe_arm_arch) ;;
 
2615
            esac
 
2616
        ;;
 
2617
    esac
 
2618
 
 
2619
    case "$subarch" in
 
2620
        armv5t*)    enable fast_clz                ;;
 
2621
        armv[6-8]*) enable fast_clz fast_unaligned ;;
 
2622
    esac
 
2623
 
 
2624
elif enabled avr32; then
 
2625
 
 
2626
    case $cpu in
 
2627
        ap7[02]0[0-2])
 
2628
            subarch="avr32_ap"
 
2629
            cpuflags="-mpart=$cpu"
 
2630
        ;;
 
2631
        ap)
 
2632
            subarch="avr32_ap"
 
2633
            cpuflags="-march=$cpu"
 
2634
        ;;
 
2635
        uc3[ab]*)
 
2636
            subarch="avr32_uc"
 
2637
            cpuflags="-mcpu=$cpu"
 
2638
        ;;
 
2639
        uc)
 
2640
            subarch="avr32_uc"
 
2641
            cpuflags="-march=$cpu"
 
2642
        ;;
 
2643
    esac
 
2644
 
 
2645
elif enabled bfin; then
 
2646
 
 
2647
    cpuflags="-mcpu=$cpu"
 
2648
 
 
2649
elif enabled mips; then
 
2650
 
 
2651
    cpuflags="-march=$cpu"
 
2652
 
2501
2653
elif enabled ppc; then
2502
2654
 
2503
2655
    case $(tolower $cpu) in
2514
2666
            disable altivec
2515
2667
        ;;
2516
2668
        g3|75*|ppc75*|powerpc75*)
2517
 
            cpuflags="-mcpu=750 -mpowerpc-gfxopt"
 
2669
            cpuflags="-mcpu=750"
2518
2670
            disable altivec
2519
2671
        ;;
2520
2672
        g4|745*|ppc745*|powerpc745*)
2521
 
            cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
 
2673
            cpuflags="-mcpu=7450"
2522
2674
        ;;
2523
2675
        74*|ppc74*|powerpc74*)
2524
 
            cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
 
2676
            cpuflags="-mcpu=7400"
2525
2677
        ;;
2526
2678
        g5|970|ppc970|powerpc970)
2527
 
            cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
 
2679
            cpuflags="-mcpu=970"
2528
2680
        ;;
2529
2681
        power[3-7]*)
2530
 
            cpuflags="-mcpu=$cpu -mpowerpc-gfxopt -mpowerpc64"
 
2682
            cpuflags="-mcpu=$cpu"
2531
2683
        ;;
2532
2684
        cell)
2533
2685
            cpuflags="-mcpu=cell"
2547
2699
        ;;
2548
2700
    esac
2549
2701
 
 
2702
elif enabled sparc; then
 
2703
 
 
2704
    case $cpu in
 
2705
        cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
 
2706
            cpuflags="-mcpu=$cpu"
 
2707
            disable vis
 
2708
        ;;
 
2709
        ultrasparc*|niagara[234])
 
2710
            cpuflags="-mcpu=$cpu"
 
2711
        ;;
 
2712
    esac
 
2713
 
2550
2714
elif enabled x86; then
2551
2715
 
2552
2716
    case $cpu in
2560
2724
            disable cmov
2561
2725
        ;;
2562
2726
        # targets that do support conditional mov (cmov)
2563
 
        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom|bdver*)
 
2727
        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
2564
2728
            cpuflags="-march=$cpu"
2565
2729
            enable cmov
2566
2730
            enable fast_cmov
2573
2737
        ;;
2574
2738
    esac
2575
2739
 
2576
 
elif enabled sparc; then
2577
 
 
2578
 
    case $cpu in
2579
 
        niagara)
2580
 
            cpuflags="-mcpu=$cpu"
2581
 
            disable vis
2582
 
        ;;
2583
 
        sparc64)
2584
 
            cpuflags="-mcpu=v9"
2585
 
        ;;
2586
 
    esac
2587
 
 
2588
 
elif enabled arm; then
2589
 
 
2590
 
    case $cpu in
2591
 
        armv*)
2592
 
            cpuflags="-march=$cpu"
2593
 
            subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
2594
 
        ;;
2595
 
        *)
2596
 
            cpuflags="-mcpu=$cpu"
2597
 
            case $cpu in
2598
 
                cortex-a*)                               subarch=armv7a  ;;
2599
 
                cortex-r*)                               subarch=armv7r  ;;
2600
 
                cortex-m*)                 enable thumb; subarch=armv7m  ;;
2601
 
                arm11*)                                  subarch=armv6   ;;
2602
 
                arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
2603
 
                armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
2604
 
            esac
2605
 
        ;;
2606
 
    esac
2607
 
 
2608
 
elif enabled alpha; then
2609
 
 
2610
 
    enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
2611
 
 
2612
 
elif enabled bfin; then
2613
 
 
2614
 
    cpuflags="-mcpu=$cpu"
2615
 
 
2616
 
elif enabled mips; then
2617
 
 
2618
 
    cpuflags="-march=$cpu"
2619
 
 
2620
 
elif enabled avr32; then
2621
 
 
2622
 
    case $cpu in
2623
 
        ap7[02]0[0-2])
2624
 
            subarch="avr32_ap"
2625
 
            cpuflags="-mpart=$cpu"
2626
 
        ;;
2627
 
        ap)
2628
 
            subarch="avr32_ap"
2629
 
            cpuflags="-march=$cpu"
2630
 
        ;;
2631
 
        uc3[ab]*)
2632
 
            subarch="avr32_uc"
2633
 
            cpuflags="-mcpu=$cpu"
2634
 
        ;;
2635
 
        uc)
2636
 
            subarch="avr32_uc"
2637
 
            cpuflags="-march=$cpu"
2638
 
        ;;
2639
 
    esac
2640
 
 
2641
 
fi
2642
 
 
2643
 
add_cflags $cpuflags
2644
 
add_asflags $cpuflags
 
2740
fi
 
2741
 
 
2742
if [ "$cpu" != generic ]; then
 
2743
    add_cflags  $cpuflags
 
2744
    add_asflags $cpuflags
 
2745
fi
2645
2746
 
2646
2747
# compiler sanity check
2647
2748
check_exec <<EOF
2668
2769
check_host_cflags -std=c99
2669
2770
check_host_cflags -Wall
2670
2771
 
 
2772
check_64bit(){
 
2773
    arch32=$1
 
2774
    arch64=$2
 
2775
    expr=$3
 
2776
    check_code cc "" "int test[2*($expr) - 1]" &&
 
2777
        subarch=$arch64 || subarch=$arch32
 
2778
}
 
2779
 
2671
2780
case "$arch" in
2672
 
    alpha|ia64|mips|parisc|sparc)
 
2781
    alpha|ia64)
 
2782
        spic=$shared
 
2783
    ;;
 
2784
    mips)
 
2785
        check_64bit mips mips64 '_MIPS_SIM > 1'
 
2786
        spic=$shared
 
2787
    ;;
 
2788
    parisc)
 
2789
        check_64bit parisc parisc64 'sizeof(void *) > 4'
 
2790
        spic=$shared
 
2791
    ;;
 
2792
    ppc)
 
2793
        check_64bit ppc ppc64 'sizeof(void *) > 4'
 
2794
        spic=$shared
 
2795
    ;;
 
2796
    sparc)
 
2797
        check_64bit sparc sparc64 'sizeof(void *) > 4'
2673
2798
        spic=$shared
2674
2799
    ;;
2675
2800
    x86)
2676
 
        subarch="x86_32"
2677
 
        check_code cc "" "int test[(int)sizeof(char*) - 7]" && subarch="x86_64"
 
2801
        check_64bit x86_32 x86_64 'sizeof(void *) > 4'
2678
2802
        if test "$subarch" = "x86_64"; then
2679
2803
            spic=$shared
2680
2804
        fi
2764
2888
        SLIBSUF=".dll"
2765
2889
        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
2766
2890
        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
2767
 
        SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
 
2891
        SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
2768
2892
        SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
2769
2893
        SLIB_INSTALL_LINKS=
2770
2894
        SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
2771
2895
        SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
2772
 
        SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
 
2896
        SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
2773
2897
        objformat="win32"
2774
2898
        dlltool="${cross_prefix}dlltool"
2775
2899
        ranlib=:
2813
2937
        SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
2814
2938
        objformat="win32"
2815
2939
        enable dos_paths
2816
 
        add_cppflags -U__STRICT_ANSI__
2817
2940
        ;;
2818
2941
    *-dos|freedos|opendos)
2819
2942
        network_extralibs="-lsocket"
2822
2945
        add_cppflags -U__STRICT_ANSI__
2823
2946
        ;;
2824
2947
    linux)
2825
 
        add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2826
2948
        enable dv1394
2827
2949
        ;;
2828
2950
    irix*)
2853
2975
        enable dos_paths
2854
2976
        ;;
2855
2977
    gnu/kfreebsd)
2856
 
        add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
 
2978
        add_cppflags -D_BSD_SOURCE
2857
2979
        ;;
2858
2980
    gnu)
2859
 
        add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2860
2981
        ;;
2861
2982
    qnx)
2862
2983
        add_cppflags -D_QNX_SOURCE
2904
3025
 
2905
3026
if check_cpp_condition features.h "defined __UCLIBC__"; then
2906
3027
    libc_type=uclibc
 
3028
    add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2907
3029
elif check_cpp_condition features.h "defined __GLIBC__"; then
2908
3030
    libc_type=glibc
 
3031
    add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
2909
3032
elif check_header _mingw.h; then
2910
3033
    libc_type=mingw
2911
3034
    check_cpp_condition _mingw.h \
2914
3037
        die "ERROR: MinGW runtime version must be >= 3.15."
2915
3038
elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
2916
3039
    libc_type=newlib
 
3040
    add_cppflags -U__STRICT_ANSI__
2917
3041
elif check_func_headers stdlib.h _get_doserrno; then
2918
3042
    libc_type=msvcrt
2919
3043
    add_compat strtod.o strtod=avpriv_strtod
2936
3060
    add_cflags   -pds=48    # incompatible redefinition of macro
2937
3061
fi
2938
3062
 
 
3063
if enabled_all ccc glibc; then
 
3064
    add_ldflags -Wl,-z,now  # calls to libots crash without this
 
3065
fi
 
3066
 
2939
3067
esc(){
2940
3068
    echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
2941
3069
}
3026
3154
 
3027
3155
elif enabled arm; then
3028
3156
 
 
3157
    check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
3029
3158
    enabled thumb && check_cflags -mthumb || check_cflags -marm
3030
3159
    nogas=die
3031
3160
 
3042
3171
        warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
3043
3172
    fi
3044
3173
 
3045
 
    enabled armv5te && check_inline_asm armv5te '"qadd r0, r0, r0"'
3046
 
    enabled armv6   && check_inline_asm armv6   '"sadd16 r0, r0, r0"'
3047
 
    enabled armv6t2 && check_inline_asm armv6t2 '"movt r0, #0"'
3048
 
    enabled armvfp  && check_inline_asm armvfp  '"fadds s0, s0, s0"'
3049
 
    enabled neon    && check_inline_asm neon    '"vadd.i16 q0, q0, q0"'
3050
 
    enabled vfpv3   && check_inline_asm vfpv3   '"vmov.f32 s0, #1.0"'
 
3174
    enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
 
3175
    enabled armv6   && check_insn armv6   'sadd16 r0, r0, r0'
 
3176
    enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
 
3177
    enabled neon    && check_insn neon    'vadd.i16 q0, q0, q0'
 
3178
    enabled vfp     && check_insn vfp     'fadds s0, s0, s0'
 
3179
    enabled vfpv3   && check_insn vfpv3   'vmov.f32 s0, #1.0'
 
3180
 
 
3181
    [ $target_os = linux ] ||
 
3182
        map 'enabled_any ${v}_external ${v}_inline || disable $v' \
 
3183
            $ARCH_EXT_LIST_ARM
3051
3184
 
3052
3185
    check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
3053
3186
    check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
3058
3191
 
3059
3192
    check_inline_asm loongson '"dmult.g $1, $2, $3"'
3060
3193
 
 
3194
elif enabled parisc; then
 
3195
 
 
3196
    if enabled gcc; then
 
3197
        case $($cc -dumpversion) in
 
3198
            4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
 
3199
        esac
 
3200
    fi
 
3201
 
3061
3202
elif enabled ppc; then
3062
3203
 
3063
3204
    enable local_aligned_8 local_aligned_16
3090
3231
 
3091
3232
elif enabled sparc; then
3092
3233
 
3093
 
    enabled vis &&
3094
 
        check_inline_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
3095
 
            add_cflags -mcpu=ultrasparc -mtune=ultrasparc
 
3234
    enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
3096
3235
 
3097
3236
elif enabled x86; then
3098
3237
 
3140
3279
            elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
3141
3280
        esac
3142
3281
 
3143
 
        check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
 
3282
        check_yasm "vextractf128 xmm0, ymm0, 0" && enable yasm ||
3144
3283
            die "yasm not found, use --disable-yasm for a crippled build"
3145
 
        check_yasm "vextractf128 xmm0, ymm0, 0"      || disable avx_external
3146
3284
        check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
3147
3285
        check_yasm "CPU amdnop" && enable cpunop
3148
3286
    fi
3157
3295
 
3158
3296
if enabled asm; then
3159
3297
    as=${gas:=$as}
3160
 
    check_inline_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
 
3298
    check_as <<EOF && enable gnu_as || \
3161
3299
        $nogas "GNU assembler not found, install gas-preprocessor"
 
3300
.macro m n
 
3301
\n: .int 0
 
3302
.endm
 
3303
m x
 
3304
EOF
3162
3305
fi
3163
3306
 
3164
3307
check_ldflags -Wl,--as-needed
3169
3312
    ldl=-ldl
3170
3313
fi
3171
3314
 
3172
 
if enabled network; then
 
3315
if ! disabled network; then
3173
3316
    check_type "sys/types.h sys/socket.h" socklen_t
3174
3317
    check_type netdb.h "struct addrinfo"
3175
3318
    check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
3240
3383
check_func_headers windows.h GetProcessTimes
3241
3384
check_func_headers windows.h GetSystemTimeAsFileTime
3242
3385
check_func_headers windows.h MapViewOfFile
 
3386
check_func_headers windows.h SetConsoleTextAttribute
3243
3387
check_func_headers windows.h Sleep
3244
3388
check_func_headers windows.h VirtualAlloc
3245
3389
 
3265
3409
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
3266
3410
 
3267
3411
if ! disabled w32threads && ! enabled pthreads; then
3268
 
    check_func _beginthreadex && enable w32threads
 
3412
    check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
3269
3413
fi
3270
3414
 
3271
3415
# check for some common methods of building with pthread support
3298
3442
check_lib math.h sin -lm && LIBM="-lm"
3299
3443
enabled vaapi && require vaapi va/va.h vaInitialize -lva
3300
3444
 
 
3445
atan2f_args=2
 
3446
ldexpf_args=2
 
3447
powf_args=2
 
3448
 
3301
3449
for func in $MATH_FUNCS; do
3302
 
    check_mathfunc $func
 
3450
    eval check_mathfunc $func \${${func}_args:-1}
3303
3451
done
3304
3452
 
3305
3453
# these are off by default, so fail if requested and not available
3328
3476
enabled libvpx     && {
3329
3477
    enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
3330
3478
                                die "ERROR: libvpx decoder version must be >=0.9.1"; }
3331
 
    enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
3332
 
                                die "ERROR: libvpx encoder version must be >=0.9.1"; } }
 
3479
    enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
 
3480
                                die "ERROR: libvpx encoder version must be >=0.9.6"; } }
3333
3481
enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
3334
3482
                      { check_cpp_condition x264.h "X264_BUILD >= 118" ||
3335
3483
                        die "ERROR: libx264 version must be >= 0.118."; }
3512
3660
    fi
3513
3661
elif enabled ccc; then
3514
3662
    # disable some annoying warnings
3515
 
    add_cflags -msg_disable cvtu32to64
3516
 
    add_cflags -msg_disable embedcomment
3517
 
    add_cflags -msg_disable needconstext
3518
 
    add_cflags -msg_disable nomainieee
3519
 
    add_cflags -msg_disable ptrmismatch1
3520
 
    add_cflags -msg_disable unreachcode
 
3663
    add_cflags -msg_disable bitnotint
 
3664
    add_cflags -msg_disable mixfuncvoid
 
3665
    add_cflags -msg_disable nonstandcast
 
3666
    add_cflags -msg_disable unsupieee
3521
3667
elif enabled gcc; then
3522
3668
    check_optflags -fno-tree-vectorize
3523
3669
    check_cflags -Werror=implicit-function-declaration
3529
3675
elif enabled clang; then
3530
3676
    check_cflags -mllvm -stack-alignment=16
3531
3677
    check_cflags -Qunused-arguments
 
3678
    check_cflags -Werror=implicit-function-declaration
 
3679
    check_cflags -Werror=missing-prototypes
3532
3680
elif enabled armcc; then
3533
3681
    # 2523: use of inline assembler is deprecated
3534
3682
    add_cflags -W${armcc_opt},--diag_suppress=2523
3546
3694
fi
3547
3695
 
3548
3696
case $target_os in
 
3697
    osf1)
 
3698
        enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
 
3699
    ;;
3549
3700
    plan9)
3550
3701
        add_cppflags -Dmain=plan9_main
3551
3702
    ;;
3594
3745
    echo "ARMv5TE enabled           ${armv5te-no}"
3595
3746
    echo "ARMv6 enabled             ${armv6-no}"
3596
3747
    echo "ARMv6T2 enabled           ${armv6t2-no}"
3597
 
    echo "ARM VFP enabled           ${armvfp-no}"
 
3748
    echo "VFP enabled               ${vfp-no}"
3598
3749
    echo "NEON enabled              ${neon-no}"
3599
3750
fi
3600
3751
if enabled ppc; then
3711
3862
AS_C=$AS_C
3712
3863
AS_O=$AS_O
3713
3864
CC_C=$CC_C
 
3865
CC_E=$CC_E
3714
3866
CC_O=$CC_O
3715
3867
LD_O=$LD_O
3716
3868
LD_LIB=$LD_LIB
3773
3925
EOF
3774
3926
 
3775
3927
get_version(){
3776
 
    lcname=$1
 
3928
    lcname=lib${1}
3777
3929
    name=$(toupper $lcname)
3778
3930
    file=$source_path/$lcname/version.h
3779
3931
    eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
3782
3934
    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
3783
3935
}
3784
3936
 
3785
 
get_version libavcodec
3786
 
get_version libavdevice
3787
 
get_version libavfilter
3788
 
get_version libavformat
3789
 
get_version libavresample
3790
 
get_version libavutil
3791
 
get_version libswscale
 
3937
map 'get_version $v' $LIBRARY_LIST
3792
3938
 
3793
3939
cat > $TMPH <<EOF
3794
3940
/* Automatically generated by configure - do not modify! */
3887
4033
pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
3888
4034
pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
3889
4035
pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
3890
 
pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
3891
 
pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
 
4036
pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
 
4037
pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
3892
4038
pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"