You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3853 lines
112KB

  1. #!/bin/sh
  2. #
  3. # Libav configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken Libav."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. show_help(){
  51. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Help options:
  55. --help print this message
  56. --list-decoders show all available decoders
  57. --list-encoders show all available encoders
  58. --list-hwaccels show all available hardware accelerators
  59. --list-demuxers show all available demuxers
  60. --list-muxers show all available muxers
  61. --list-parsers show all available parsers
  62. --list-protocols show all available protocols
  63. --list-bsfs show all available bitstream filters
  64. --list-indevs show all available input devices
  65. --list-outdevs show all available output devices
  66. --list-filters show all available filters
  67. Standard options:
  68. --logfile=FILE log tests and output to FILE [config.log]
  69. --disable-logging do not log configure debug information
  70. --prefix=PREFIX install in PREFIX [$prefix]
  71. --bindir=DIR install binaries in DIR [PREFIX/bin]
  72. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  73. --libdir=DIR install libs in DIR [PREFIX/lib]
  74. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  75. --incdir=DIR install includes in DIR [PREFIX/include]
  76. --mandir=DIR install man page in DIR [PREFIX/share/man]
  77. Licensing options:
  78. --enable-gpl allow use of GPL code, the resulting libs
  79. and binaries will be under GPL [no]
  80. --enable-version3 upgrade (L)GPL to version 3 [no]
  81. --enable-nonfree allow use of nonfree code, the resulting libs
  82. and binaries will be unredistributable [no]
  83. Configuration options:
  84. --disable-static do not build static libraries [no]
  85. --enable-shared build shared libraries [no]
  86. --enable-small optimize for size instead of speed
  87. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  88. --enable-gray enable full grayscale support (slower color)
  89. --disable-swscale-alpha disable alpha channel support in swscale
  90. Component options:
  91. --disable-doc do not build documentation
  92. --disable-avconv disable avconv build
  93. --disable-avplay disable avplay build
  94. --disable-avprobe disable avprobe build
  95. --disable-avserver disable avserver build
  96. --disable-avdevice disable libavdevice build
  97. --disable-avcodec disable libavcodec build
  98. --disable-avformat disable libavformat build
  99. --disable-swscale disable libswscale build
  100. --disable-avfilter disable video filter support [no]
  101. --disable-avresample disable libavresample build [no]
  102. --disable-pthreads disable pthreads [auto]
  103. --disable-w32threads disable Win32 threads [auto]
  104. --enable-x11grab enable X11 grabbing [no]
  105. --disable-network disable network support [no]
  106. --disable-dct disable DCT code
  107. --disable-dwt disable DWT code
  108. --disable-lsp disable LSP code
  109. --disable-mdct disable MDCT code
  110. --disable-rdft disable RDFT code
  111. --disable-fft disable FFT code
  112. --enable-dxva2 enable DXVA2 code
  113. --enable-vaapi enable VAAPI code
  114. --enable-vda enable VDA code
  115. --enable-vdpau enable VDPAU code
  116. Individual component options:
  117. --disable-everything disable all components listed below
  118. --disable-encoder=NAME disable encoder NAME
  119. --enable-encoder=NAME enable encoder NAME
  120. --disable-encoders disable all encoders
  121. --disable-decoder=NAME disable decoder NAME
  122. --enable-decoder=NAME enable decoder NAME
  123. --disable-decoders disable all decoders
  124. --disable-hwaccel=NAME disable hwaccel NAME
  125. --enable-hwaccel=NAME enable hwaccel NAME
  126. --disable-hwaccels disable all hwaccels
  127. --disable-muxer=NAME disable muxer NAME
  128. --enable-muxer=NAME enable muxer NAME
  129. --disable-muxers disable all muxers
  130. --disable-demuxer=NAME disable demuxer NAME
  131. --enable-demuxer=NAME enable demuxer NAME
  132. --disable-demuxers disable all demuxers
  133. --enable-parser=NAME enable parser NAME
  134. --disable-parser=NAME disable parser NAME
  135. --disable-parsers disable all parsers
  136. --enable-bsf=NAME enable bitstream filter NAME
  137. --disable-bsf=NAME disable bitstream filter NAME
  138. --disable-bsfs disable all bitstream filters
  139. --enable-protocol=NAME enable protocol NAME
  140. --disable-protocol=NAME disable protocol NAME
  141. --disable-protocols disable all protocols
  142. --enable-indev=NAME enable input device NAME
  143. --disable-indev=NAME disable input device NAME
  144. --disable-indevs disable input devices
  145. --enable-outdev=NAME enable output device NAME
  146. --disable-outdev=NAME disable output device NAME
  147. --disable-outdevs disable output devices
  148. --disable-devices disable all devices
  149. --enable-filter=NAME enable filter NAME
  150. --disable-filter=NAME disable filter NAME
  151. --disable-filters disable all filters
  152. External library support:
  153. --enable-avisynth enable reading of AVISynth script files [no]
  154. --enable-bzlib enable bzlib [autodetect]
  155. --enable-frei0r enable frei0r video filtering
  156. --enable-gnutls enable gnutls [no]
  157. --enable-libcdio enable audio CD grabbing with libcdio
  158. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  159. and libraw1394 [no]
  160. --enable-libfaac enable AAC encoding via libfaac [no]
  161. --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
  162. --enable-libfreetype enable libfreetype [no]
  163. --enable-libgsm enable GSM de/encoding via libgsm [no]
  164. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  165. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  166. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  167. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  168. --enable-libopencv enable video filtering via libopencv [no]
  169. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  170. --enable-libpulse enable Pulseaudio input via libpulse [no]
  171. --enable-librtmp enable RTMP[E] support via librtmp [no]
  172. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  173. --enable-libspeex enable Speex de/encoding via libspeex [no]
  174. --enable-libtheora enable Theora encoding via libtheora [no]
  175. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  176. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  177. --enable-libvorbis enable Vorbis encoding via libvorbis [no]
  178. --enable-libvpx enable VP8 de/encoding via libvpx [no]
  179. --enable-libx264 enable H.264 encoding via x264 [no]
  180. --enable-libxavs enable AVS encoding via xavs [no]
  181. --enable-libxvid enable Xvid encoding via xvidcore,
  182. native MPEG-4/Xvid encoder exists [no]
  183. --enable-openssl enable openssl [no]
  184. --enable-zlib enable zlib [autodetect]
  185. Advanced options (experts only):
  186. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  187. --enable-cross-compile assume a cross-compiler is used
  188. --sysroot=PATH root of cross-build tree
  189. --sysinclude=PATH location of cross-build system headers
  190. --target-os=OS compiler targets OS [$target_os]
  191. --target-exec=CMD command to run executables on target
  192. --target-path=DIR path to view of build directory on target
  193. --toolchain=NAME set tool defaults according to NAME
  194. --nm=NM use nm tool
  195. --ar=AR use archive tool AR [$ar_default]
  196. --as=AS use assembler AS [$as_default]
  197. --cc=CC use C compiler CC [$cc_default]
  198. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  199. --ld=LD use linker LD
  200. --host-cc=HOSTCC use host C compiler HOSTCC
  201. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  202. --host-ld=HOSTLD use host linker HOSTLD
  203. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  204. --host-libs=HLIBS use libs HLIBS when linking for host
  205. --host-os=OS compiler host OS [$target_os]
  206. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  207. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  208. --extra-libs=ELIBS add ELIBS [$ELIBS]
  209. --extra-version=STRING version string suffix []
  210. --optflags=OPTFLAGS override optimization-related compiler flags
  211. --build-suffix=SUFFIX library name suffix []
  212. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  213. --arch=ARCH select architecture [$arch]
  214. --cpu=CPU select the minimum required CPU (affects
  215. instruction selection, may crash on older CPUs)
  216. --enable-pic build position-independent code
  217. --enable-sram allow use of on-chip SRAM
  218. --enable-thumb compile for Thumb instruction set
  219. --disable-symver disable symbol versioning
  220. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  221. --disable-safe-bitstream-reader
  222. disable buffer boundary checking in bitreaders
  223. (faster, but may crash)
  224. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  225. Optimization options (experts only):
  226. --disable-asm disable all assembler optimizations
  227. --disable-altivec disable AltiVec optimizations
  228. --disable-amd3dnow disable 3DNow! optimizations
  229. --disable-amd3dnowext disable 3DNow! extended optimizations
  230. --disable-mmx disable MMX optimizations
  231. --disable-mmxext disable MMXEXT optimizations
  232. --disable-sse disable SSE optimizations
  233. --disable-sse2 disable SSE2 optimizations
  234. --disable-sse3 disable SSE3 optimizations
  235. --disable-ssse3 disable SSSE3 optimizations
  236. --disable-sse4 disable SSE4 optimizations
  237. --disable-sse42 disable SSE4.2 optimizations
  238. --disable-avx disable AVX optimizations
  239. --disable-fma4 disable FMA4 optimizations
  240. --disable-armv5te disable armv5te optimizations
  241. --disable-armv6 disable armv6 optimizations
  242. --disable-armv6t2 disable armv6t2 optimizations
  243. --disable-armvfp disable ARM VFP optimizations
  244. --disable-mmi disable MMI optimizations
  245. --disable-neon disable NEON optimizations
  246. --disable-vis disable VIS optimizations
  247. --disable-inline-asm disable use of inline assembler
  248. --disable-yasm disable use of yasm assembler
  249. Developer options (useful when working on Libav itself):
  250. --disable-debug disable debugging symbols
  251. --enable-debug=LEVEL set the debug level [$debuglevel]
  252. --disable-optimizations disable compiler optimizations
  253. --enable-extra-warnings enable more compiler warnings
  254. --samples=PATH location of test samples for FATE, if not set use
  255. \$LIBAV_SAMPLES at make invocation time.
  256. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  257. should be used only for debugging purposes)
  258. --enable-random randomly enable/disable components
  259. --disable-random
  260. --enable-random=LIST randomly enable/disable specific components or
  261. --disable-random=LIST component groups. LIST is a comma-separated list
  262. of NAME[:PROB] entries where NAME is a component
  263. (group) and PROB the probability associated with
  264. NAME (default 0.5).
  265. --random-seed=VALUE seed value for --enable/disable-random
  266. NOTE: Object files are built at the place where configure is launched.
  267. EOF
  268. exit 0
  269. }
  270. quotes='""'
  271. log(){
  272. echo "$@" >> $logfile
  273. }
  274. log_file(){
  275. log BEGIN $1
  276. pr -n -t $1 >> $logfile
  277. log END $1
  278. }
  279. echolog(){
  280. log "$@"
  281. echo "$@"
  282. }
  283. warn(){
  284. log "WARNING: $*"
  285. WARNINGS="${WARNINGS}WARNING: $*\n"
  286. }
  287. die(){
  288. echolog "$@"
  289. cat <<EOF
  290. If you think configure made a mistake, make sure you are using the latest
  291. version from Git. If the latest version fails, report the problem to the
  292. libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
  293. EOF
  294. if disabled logging; then
  295. cat <<EOF
  296. Rerun configure with logging enabled (do not use --disable-logging), and
  297. include the log this produces with your report.
  298. EOF
  299. else
  300. cat <<EOF
  301. Include the log file "$logfile" produced by configure as this will help
  302. solving the problem.
  303. EOF
  304. fi
  305. exit 1
  306. }
  307. # Avoid locale weirdness, besides we really just want to translate ASCII.
  308. toupper(){
  309. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  310. }
  311. tolower(){
  312. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  313. }
  314. c_escape(){
  315. echo "$*" | sed 's/["\\]/\\\0/g'
  316. }
  317. sh_quote(){
  318. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  319. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  320. echo "$v"
  321. }
  322. cleanws(){
  323. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  324. }
  325. filter(){
  326. pat=$1
  327. shift
  328. for v; do
  329. eval "case $v in $pat) echo $v ;; esac"
  330. done
  331. }
  332. filter_out(){
  333. pat=$1
  334. shift
  335. for v; do
  336. eval "case $v in $pat) ;; *) echo $v ;; esac"
  337. done
  338. }
  339. map(){
  340. m=$1
  341. shift
  342. for v; do eval $m; done
  343. }
  344. add_suffix(){
  345. suffix=$1
  346. shift
  347. for v; do echo ${v}${suffix}; done
  348. }
  349. set_all(){
  350. value=$1
  351. shift
  352. for var in $*; do
  353. eval $var=$value
  354. done
  355. }
  356. set_weak(){
  357. value=$1
  358. shift
  359. for var; do
  360. eval : \${$var:=$value}
  361. done
  362. }
  363. set_safe(){
  364. var=$1
  365. shift
  366. eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
  367. }
  368. get_safe(){
  369. eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
  370. }
  371. pushvar(){
  372. for var in $*; do
  373. eval level=\${${var}_level:=0}
  374. eval ${var}_${level}="\$$var"
  375. eval ${var}_level=$(($level+1))
  376. done
  377. }
  378. popvar(){
  379. for var in $*; do
  380. eval level=\${${var}_level:-0}
  381. test $level = 0 && continue
  382. eval level=$(($level-1))
  383. eval $var="\${${var}_${level}}"
  384. eval ${var}_level=$level
  385. eval unset ${var}_${level}
  386. done
  387. }
  388. enable(){
  389. set_all yes $*
  390. }
  391. disable(){
  392. set_all no $*
  393. }
  394. enable_weak(){
  395. set_weak yes $*
  396. }
  397. disable_weak(){
  398. set_weak no $*
  399. }
  400. enable_safe(){
  401. for var; do
  402. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  403. done
  404. }
  405. disable_safe(){
  406. for var; do
  407. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  408. done
  409. }
  410. do_enable_deep(){
  411. for var; do
  412. enabled $var && continue
  413. eval sel="\$${var}_select"
  414. eval sgs="\$${var}_suggest"
  415. pushvar var sgs
  416. enable_deep $sel
  417. popvar sgs
  418. enable_deep_weak $sgs
  419. popvar var
  420. done
  421. }
  422. enable_deep(){
  423. do_enable_deep $*
  424. enable $*
  425. }
  426. enable_deep_weak(){
  427. do_enable_deep $*
  428. enable_weak $*
  429. }
  430. enabled(){
  431. test "${1#!}" = "$1" && op== || op=!=
  432. eval test "x\$${1#!}" $op "xyes"
  433. }
  434. disabled(){
  435. test "${1#!}" = "$1" && op== || op=!=
  436. eval test "x\$${1#!}" $op "xno"
  437. }
  438. enabled_all(){
  439. for opt; do
  440. enabled $opt || return 1
  441. done
  442. }
  443. disabled_all(){
  444. for opt; do
  445. disabled $opt || return 1
  446. done
  447. }
  448. enabled_any(){
  449. for opt; do
  450. enabled $opt && return 0
  451. done
  452. }
  453. disabled_any(){
  454. for opt; do
  455. disabled $opt && return 0
  456. done
  457. return 1
  458. }
  459. set_default(){
  460. for opt; do
  461. eval : \${$opt:=\$${opt}_default}
  462. done
  463. }
  464. is_in(){
  465. value=$1
  466. shift
  467. for var in $*; do
  468. [ $var = $value ] && return 0
  469. done
  470. return 1
  471. }
  472. check_deps(){
  473. for cfg; do
  474. cfg="${cfg#!}"
  475. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  476. disabled ${cfg}_checking && continue
  477. enable ${cfg}_checking
  478. eval dep_all="\$${cfg}_deps"
  479. eval dep_any="\$${cfg}_deps_any"
  480. eval dep_sel="\$${cfg}_select"
  481. eval dep_sgs="\$${cfg}_suggest"
  482. eval dep_ifa="\$${cfg}_if"
  483. eval dep_ifn="\$${cfg}_if_any"
  484. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  485. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  486. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  487. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  488. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  489. enabled_all $dep_all || disable $cfg
  490. enabled_any $dep_any || disable $cfg
  491. disabled_any $dep_sel && disable $cfg
  492. if enabled $cfg; then
  493. eval dep_extralibs="\$${cfg}_extralibs"
  494. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  495. enable_deep $dep_sel
  496. enable_deep_weak $dep_sgs
  497. fi
  498. disable ${cfg}_checking
  499. done
  500. }
  501. print_config_h(){
  502. enabled $1 && v=1 || v=0
  503. echo "#define $2 $v"
  504. }
  505. print_config_mak(){
  506. enabled $1 && v= || v=!
  507. echo "$v$2=yes"
  508. }
  509. print_config_asm(){
  510. enabled $1 && v=1 || v=0
  511. echo "%define $2 $v"
  512. }
  513. print_config(){
  514. pfx=$1
  515. files=$2
  516. shift 2
  517. for cfg; do
  518. ucname="$(toupper $cfg)"
  519. for f in $files; do
  520. "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
  521. done
  522. done
  523. }
  524. print_enabled(){
  525. test "$1" = -n && end=" " && shift || end="\n"
  526. suf=$1
  527. shift
  528. for v; do
  529. enabled $v && printf "%s$end" ${v%$suf};
  530. done
  531. }
  532. append(){
  533. var=$1
  534. shift
  535. eval "$var=\"\$$var $*\""
  536. }
  537. prepend(){
  538. var=$1
  539. shift
  540. eval "$var=\"$* \$$var\""
  541. }
  542. add_cppflags(){
  543. append CPPFLAGS "$@"
  544. }
  545. add_cflags(){
  546. append CFLAGS $($cflags_filter "$@")
  547. }
  548. add_asflags(){
  549. append ASFLAGS $($asflags_filter "$@")
  550. }
  551. add_ldflags(){
  552. append LDFLAGS $($ldflags_filter "$@")
  553. }
  554. add_extralibs(){
  555. prepend extralibs $($ldflags_filter "$@")
  556. }
  557. add_host_cflags(){
  558. append host_cflags $($host_cflags_filter "$@")
  559. }
  560. add_host_ldflags(){
  561. append host_ldflags $($host_ldflags_filter "$@")
  562. }
  563. check_cmd(){
  564. log "$@"
  565. "$@" >> $logfile 2>&1
  566. }
  567. cc_o(){
  568. eval printf '%s\\n' $CC_O
  569. }
  570. cc_e(){
  571. eval printf '%s\\n' $CC_E
  572. }
  573. check_cc(){
  574. log check_cc "$@"
  575. cat > $TMPC
  576. log_file $TMPC
  577. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  578. }
  579. check_cpp(){
  580. log check_cpp "$@"
  581. cat > $TMPC
  582. log_file $TMPC
  583. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  584. }
  585. as_o(){
  586. eval printf '%s\\n' $AS_O
  587. }
  588. check_as(){
  589. log check_as "$@"
  590. cat > $TMPC
  591. log_file $TMPC
  592. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPC
  593. }
  594. check_inline_asm(){
  595. log check_inline_asm "$@"
  596. name="$1"
  597. code="$2"
  598. shift 2
  599. disable $name
  600. check_as "$@" <<EOF && enable $name
  601. void foo(void){ __asm__ volatile($code); }
  602. EOF
  603. }
  604. check_yasm(){
  605. log check_yasm "$@"
  606. echo "$1" > $TMPS
  607. log_file $TMPS
  608. shift 1
  609. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  610. }
  611. ld_o(){
  612. eval printf '%s\\n' $LD_O
  613. }
  614. check_ld(){
  615. log check_ld "$@"
  616. flags=''
  617. libs=''
  618. for f; do
  619. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  620. done
  621. check_cc $($cflags_filter $flags) || return
  622. flags=$($ldflags_filter $flags)
  623. libs=$($ldflags_filter $libs)
  624. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  625. }
  626. check_code(){
  627. log check_code "$@"
  628. check=$1
  629. headers=$2
  630. code=$3
  631. shift 3
  632. {
  633. for hdr in $headers; do
  634. echo "#include <$hdr>"
  635. done
  636. echo "int main(void) { $code; return 0; }"
  637. } | check_$check "$@"
  638. }
  639. check_cppflags(){
  640. log check_cppflags "$@"
  641. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  642. int x;
  643. EOF
  644. }
  645. check_cflags(){
  646. log check_cflags "$@"
  647. set -- $($cflags_filter "$@")
  648. check_cc "$@" <<EOF && append CFLAGS "$@"
  649. int x;
  650. EOF
  651. }
  652. test_ldflags(){
  653. log test_ldflags "$@"
  654. check_ld "$@" <<EOF
  655. int main(void){ return 0; }
  656. EOF
  657. }
  658. check_ldflags(){
  659. log check_ldflags "$@"
  660. test_ldflags "$@" && add_ldflags "$@"
  661. }
  662. check_header(){
  663. log check_header "$@"
  664. header=$1
  665. shift
  666. disable_safe $header
  667. check_cpp "$@" <<EOF && enable_safe $header
  668. #include <$header>
  669. int x;
  670. EOF
  671. }
  672. check_func(){
  673. log check_func "$@"
  674. func=$1
  675. shift
  676. disable $func
  677. check_ld "$@" <<EOF && enable $func
  678. extern int $func();
  679. int main(void){ $func(); }
  680. EOF
  681. }
  682. check_mathfunc(){
  683. log check_mathfunc "$@"
  684. func=$1
  685. shift
  686. disable $func
  687. check_ld "$@" <<EOF && enable $func
  688. #include <math.h>
  689. float foo(float f) { return $func(f); }
  690. int main(void){ return 0; }
  691. EOF
  692. }
  693. check_func_headers(){
  694. log check_func_headers "$@"
  695. headers=$1
  696. funcs=$2
  697. shift 2
  698. {
  699. for hdr in $headers; do
  700. echo "#include <$hdr>"
  701. done
  702. for func in $funcs; do
  703. echo "long check_$func(void) { return (long) $func; }"
  704. done
  705. echo "int main(void) { return 0; }"
  706. } | check_ld "$@" && enable $funcs && enable_safe $headers
  707. }
  708. check_cpp_condition(){
  709. log check_cpp_condition "$@"
  710. header=$1
  711. condition=$2
  712. shift 2
  713. check_cpp "$@" <<EOF
  714. #include <$header>
  715. #if !($condition)
  716. #error "unsatisfied condition: $condition"
  717. #endif
  718. EOF
  719. }
  720. check_lib(){
  721. log check_lib "$@"
  722. header="$1"
  723. func="$2"
  724. shift 2
  725. check_header $header && check_func $func "$@" && add_extralibs "$@"
  726. }
  727. check_lib2(){
  728. log check_lib2 "$@"
  729. headers="$1"
  730. funcs="$2"
  731. shift 2
  732. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  733. }
  734. check_pkg_config(){
  735. log check_pkg_config "$@"
  736. pkg="$1"
  737. headers="$2"
  738. funcs="$3"
  739. shift 3
  740. $pkg_config --exists $pkg || return
  741. pkg_cflags=$($pkg_config --cflags $pkg)
  742. pkg_libs=$($pkg_config --libs $pkg)
  743. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  744. set_safe ${pkg}_cflags $pkg_cflags &&
  745. set_safe ${pkg}_libs $pkg_libs
  746. }
  747. check_exec(){
  748. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  749. }
  750. check_exec_crash(){
  751. code=$(cat)
  752. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  753. # are safe but may not be available everywhere. Thus we use
  754. # raise(SIGTERM) instead. The check is run in a subshell so we
  755. # can redirect the "Terminated" message from the shell. SIGBUS
  756. # is not defined by standard C so it is used conditionally.
  757. (check_exec "$@") >> $logfile 2>&1 <<EOF
  758. #include <signal.h>
  759. static void sighandler(int sig){
  760. raise(SIGTERM);
  761. }
  762. int foo(void){
  763. $code
  764. }
  765. int main(void){
  766. signal(SIGILL, sighandler);
  767. signal(SIGFPE, sighandler);
  768. signal(SIGSEGV, sighandler);
  769. #ifdef SIGBUS
  770. signal(SIGBUS, sighandler);
  771. #endif
  772. foo();
  773. }
  774. EOF
  775. }
  776. check_type(){
  777. log check_type "$@"
  778. headers=$1
  779. type=$2
  780. shift 2
  781. disable_safe "$type"
  782. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  783. }
  784. check_struct(){
  785. log check_type "$@"
  786. headers=$1
  787. struct=$2
  788. member=$3
  789. shift 3
  790. disable_safe "${struct}_${member}"
  791. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  792. enable_safe "${struct}_${member}"
  793. }
  794. require(){
  795. name="$1"
  796. header="$2"
  797. func="$3"
  798. shift 3
  799. check_lib $header $func "$@" || die "ERROR: $name not found"
  800. }
  801. require2(){
  802. name="$1"
  803. headers="$2"
  804. func="$3"
  805. shift 3
  806. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  807. }
  808. require_pkg_config(){
  809. pkg="$1"
  810. check_pkg_config "$@" || die "ERROR: $pkg not found"
  811. add_cflags $(get_safe ${pkg}_cflags)
  812. add_extralibs $(get_safe ${pkg}_libs)
  813. }
  814. hostcc_o(){
  815. eval printf '%s\\n' $HOSTCC_O
  816. }
  817. check_host_cc(){
  818. log check_host_cc "$@"
  819. cat > $TMPC
  820. log_file $TMPC
  821. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  822. }
  823. check_host_cflags(){
  824. log check_host_cflags "$@"
  825. set -- $($host_cflags_filter "$@")
  826. check_host_cc "$@" <<EOF && append host_cflags "$@"
  827. int x;
  828. EOF
  829. }
  830. apply(){
  831. file=$1
  832. shift
  833. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  834. }
  835. cp_if_changed(){
  836. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  837. mkdir -p "$(dirname $2)"
  838. cp -f "$1" "$2"
  839. }
  840. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  841. # system-dependent things.
  842. COMPONENT_LIST="
  843. bsfs
  844. decoders
  845. demuxers
  846. encoders
  847. filters
  848. hwaccels
  849. indevs
  850. muxers
  851. outdevs
  852. parsers
  853. protocols
  854. "
  855. PROGRAM_LIST="
  856. avconv
  857. avplay
  858. avprobe
  859. avserver
  860. "
  861. CONFIG_LIST="
  862. $COMPONENT_LIST
  863. $PROGRAM_LIST
  864. avcodec
  865. avdevice
  866. avfilter
  867. avformat
  868. avresample
  869. avisynth
  870. bzlib
  871. dct
  872. doc
  873. dwt
  874. dxva2
  875. fft
  876. frei0r
  877. gnutls
  878. gpl
  879. gray
  880. hardcoded_tables
  881. libcdio
  882. libdc1394
  883. libfaac
  884. libfdk_aac
  885. libfreetype
  886. libgsm
  887. libilbc
  888. libmp3lame
  889. libopencore_amrnb
  890. libopencore_amrwb
  891. libopencv
  892. libopenjpeg
  893. libpulse
  894. librtmp
  895. libschroedinger
  896. libspeex
  897. libtheora
  898. libvo_aacenc
  899. libvo_amrwbenc
  900. libvorbis
  901. libvpx
  902. libx264
  903. libxavs
  904. libxvid
  905. lsp
  906. mdct
  907. memalign_hack
  908. network
  909. nonfree
  910. openssl
  911. pic
  912. rdft
  913. runtime_cpudetect
  914. safe_bitstream_reader
  915. shared
  916. small
  917. sram
  918. static
  919. swscale
  920. swscale_alpha
  921. thumb
  922. vaapi
  923. vda
  924. vdpau
  925. version3
  926. xmm_clobber_test
  927. x11grab
  928. zlib
  929. "
  930. THREADS_LIST='
  931. pthreads
  932. w32threads
  933. '
  934. ARCH_LIST='
  935. alpha
  936. arm
  937. avr32
  938. avr32_ap
  939. avr32_uc
  940. bfin
  941. ia64
  942. m68k
  943. mips
  944. mips64
  945. parisc
  946. ppc
  947. ppc64
  948. s390
  949. sh4
  950. sparc
  951. sparc64
  952. tomi
  953. x86
  954. x86_32
  955. x86_64
  956. '
  957. ARCH_EXT_LIST_X86='
  958. amd3dnow
  959. amd3dnowext
  960. avx
  961. fma4
  962. mmx
  963. mmxext
  964. sse
  965. sse2
  966. sse3
  967. sse4
  968. sse42
  969. ssse3
  970. '
  971. ARCH_EXT_LIST="
  972. $ARCH_EXT_LIST_X86
  973. altivec
  974. armv5te
  975. armv6
  976. armv6t2
  977. armvfp
  978. mmi
  979. neon
  980. ppc4xx
  981. vfpv3
  982. vis
  983. "
  984. HAVE_LIST_PUB='
  985. bigendian
  986. fast_unaligned
  987. '
  988. HAVE_LIST="
  989. $ARCH_EXT_LIST
  990. $(add_suffix _external $ARCH_EXT_LIST)
  991. $(add_suffix _inline $ARCH_EXT_LIST)
  992. $HAVE_LIST_PUB
  993. $THREADS_LIST
  994. aligned_malloc
  995. aligned_stack
  996. alsa_asoundlib_h
  997. altivec_h
  998. arpa_inet_h
  999. asm_mod_q
  1000. asm_mod_y
  1001. attribute_may_alias
  1002. attribute_packed
  1003. cbrtf
  1004. closesocket
  1005. cmov
  1006. cpuid
  1007. cpunop
  1008. dcbzl
  1009. dev_bktr_ioctl_bt848_h
  1010. dev_bktr_ioctl_meteor_h
  1011. dev_ic_bt8xx_h
  1012. dev_video_bktr_ioctl_bt848_h
  1013. dev_video_meteor_ioctl_meteor_h
  1014. direct_h
  1015. dlfcn_h
  1016. dlopen
  1017. dos_paths
  1018. dxva_h
  1019. ebp_available
  1020. ebx_available
  1021. exp2
  1022. exp2f
  1023. fast_64bit
  1024. fast_clz
  1025. fast_cmov
  1026. fcntl
  1027. fork
  1028. getaddrinfo
  1029. gethrtime
  1030. getopt
  1031. GetProcessAffinityMask
  1032. GetProcessMemoryInfo
  1033. GetProcessTimes
  1034. GetSystemTimeAsFileTime
  1035. getrusage
  1036. gettimeofday
  1037. gnu_as
  1038. ibm_asm
  1039. inet_aton
  1040. inline_asm
  1041. io_h
  1042. isatty
  1043. isinf
  1044. isnan
  1045. jack_port_get_latency_range
  1046. ldbrx
  1047. libdc1394_1
  1048. libdc1394_2
  1049. llrint
  1050. llrintf
  1051. local_aligned_16
  1052. local_aligned_8
  1053. localtime_r
  1054. log2
  1055. log2f
  1056. loongson
  1057. lrint
  1058. lrintf
  1059. machine_ioctl_bt848_h
  1060. machine_ioctl_meteor_h
  1061. malloc_h
  1062. MapViewOfFile
  1063. memalign
  1064. mkstemp
  1065. mm_empty
  1066. mmap
  1067. msvcrt
  1068. nanosleep
  1069. poll_h
  1070. posix_memalign
  1071. rdtsc
  1072. rint
  1073. round
  1074. roundf
  1075. rweflags
  1076. sched_getaffinity
  1077. sdl
  1078. sdl_video_size
  1079. setmode
  1080. setrlimit
  1081. Sleep
  1082. sndio_h
  1083. socklen_t
  1084. soundcard_h
  1085. strerror_r
  1086. strptime
  1087. strtok_r
  1088. struct_addrinfo
  1089. struct_group_source_req
  1090. struct_ip_mreq_source
  1091. struct_ipv6_mreq
  1092. struct_pollfd
  1093. struct_rusage_ru_maxrss
  1094. struct_sockaddr_in6
  1095. struct_sockaddr_sa_len
  1096. struct_sockaddr_storage
  1097. struct_v4l2_frmivalenum_discrete
  1098. symver
  1099. symver_asm_label
  1100. symver_gnu_asm
  1101. sysconf
  1102. sysctl
  1103. sys_mman_h
  1104. sys_param_h
  1105. sys_resource_h
  1106. sys_select_h
  1107. sys_soundcard_h
  1108. sys_time_h
  1109. sys_videoio_h
  1110. threads
  1111. trunc
  1112. truncf
  1113. unistd_h
  1114. usleep
  1115. vfp_args
  1116. VirtualAlloc
  1117. windows_h
  1118. winsock2_h
  1119. xform_asm
  1120. xgetbv
  1121. xmm_clobbers
  1122. yasm
  1123. "
  1124. # options emitted with CONFIG_ prefix but not available on command line
  1125. CONFIG_EXTRA="
  1126. aandcttables
  1127. ac3dsp
  1128. avutil
  1129. error_resilience
  1130. gcrypt
  1131. golomb
  1132. gplv3
  1133. h264chroma
  1134. h264dsp
  1135. h264pred
  1136. h264qpel
  1137. huffman
  1138. lgplv3
  1139. lpc
  1140. mpegaudiodsp
  1141. mpegvideo
  1142. mpegvideoenc
  1143. nettle
  1144. rangecoder
  1145. rtpdec
  1146. sinewin
  1147. vp3dsp
  1148. "
  1149. CMDLINE_SELECT="
  1150. $ARCH_EXT_LIST
  1151. $CONFIG_LIST
  1152. $THREADS_LIST
  1153. asm
  1154. cross_compile
  1155. debug
  1156. extra_warnings
  1157. inline_asm
  1158. logging
  1159. optimizations
  1160. symver
  1161. yasm
  1162. "
  1163. PATHS_LIST='
  1164. bindir
  1165. datadir
  1166. incdir
  1167. libdir
  1168. mandir
  1169. prefix
  1170. shlibdir
  1171. '
  1172. CMDLINE_SET="
  1173. $PATHS_LIST
  1174. ar
  1175. arch
  1176. as
  1177. build_suffix
  1178. cc
  1179. cpu
  1180. cross_prefix
  1181. dep_cc
  1182. extra_version
  1183. host_cc
  1184. host_cflags
  1185. host_ld
  1186. host_ldflags
  1187. host_libs
  1188. host_os
  1189. ld
  1190. logfile
  1191. malloc_prefix
  1192. nm
  1193. optflags
  1194. pkg_config
  1195. random_seed
  1196. samples
  1197. sysinclude
  1198. sysroot
  1199. target_exec
  1200. target_os
  1201. target_path
  1202. toolchain
  1203. "
  1204. CMDLINE_APPEND="
  1205. extra_cflags
  1206. "
  1207. # code dependency declarations
  1208. # architecture extensions
  1209. armv5te_deps="arm"
  1210. armv6_deps="arm"
  1211. armv6t2_deps="arm"
  1212. armvfp_deps="arm"
  1213. neon_deps="arm"
  1214. vfpv3_deps="armvfp"
  1215. mmi_deps="mips"
  1216. altivec_deps="ppc"
  1217. ppc4xx_deps="ppc"
  1218. vis_deps="sparc"
  1219. x86_64_suggest="cmov fast_cmov"
  1220. amd3dnow_deps="mmx"
  1221. amd3dnowext_deps="amd3dnow"
  1222. mmx_deps="x86"
  1223. mmxext_deps="mmx"
  1224. sse_deps="mmxext"
  1225. sse2_deps="sse"
  1226. sse3_deps="sse2"
  1227. ssse3_deps="sse3"
  1228. sse4_deps="ssse3"
  1229. sse42_deps="sse4"
  1230. avx_deps="sse42"
  1231. fma4_deps="avx"
  1232. mmx_external_deps="yasm"
  1233. mmx_inline_deps="inline_asm"
  1234. mmx_suggest="mmx_external mmx_inline"
  1235. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
  1236. eval dep=\$${ext}_deps
  1237. eval ${ext}_external_deps='"${dep}_external"'
  1238. eval ${ext}_inline_deps='"${dep}_inline"'
  1239. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1240. done
  1241. aligned_stack_if_any="ppc x86"
  1242. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1243. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1244. fast_unaligned_if_any="armv6 ppc x86"
  1245. inline_asm_deps="!tms470"
  1246. need_memalign="altivec neon sse"
  1247. symver_if_any="symver_asm_label symver_gnu_asm"
  1248. log2_deps="!msvcrt"
  1249. # subsystems
  1250. dct_select="rdft"
  1251. mdct_select="fft"
  1252. rdft_select="fft"
  1253. mpegaudiodsp_select="dct"
  1254. mpegvideoenc_select="mpegvideo"
  1255. # decoders / encoders / hardware accelerators
  1256. aac_decoder_select="mdct sinewin"
  1257. aac_encoder_select="mdct sinewin"
  1258. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1259. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1260. ac3_encoder_select="mdct ac3dsp"
  1261. ac3_fixed_encoder_select="mdct ac3dsp"
  1262. alac_encoder_select="lpc"
  1263. amrnb_decoder_select="lsp"
  1264. amrwb_decoder_select="lsp"
  1265. atrac1_decoder_select="mdct sinewin"
  1266. atrac3_decoder_select="mdct"
  1267. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1268. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1269. cavs_decoder_select="golomb mpegvideo"
  1270. cook_decoder_select="mdct sinewin"
  1271. cscd_decoder_suggest="zlib"
  1272. dca_decoder_select="mdct"
  1273. dnxhd_encoder_select="aandcttables mpegvideoenc"
  1274. dxa_decoder_select="zlib"
  1275. eac3_decoder_select="ac3_decoder"
  1276. eac3_encoder_select="ac3_encoder"
  1277. eamad_decoder_select="aandcttables error_resilience mpegvideo"
  1278. eatgq_decoder_select="aandcttables"
  1279. eatqi_decoder_select="aandcttables error_resilience mpegvideo"
  1280. ffv1_decoder_select="golomb rangecoder"
  1281. ffv1_encoder_select="rangecoder"
  1282. ffvhuff_encoder_select="huffman"
  1283. flac_decoder_select="golomb"
  1284. flac_encoder_select="golomb lpc"
  1285. flashsv_decoder_select="zlib"
  1286. flashsv_encoder_select="zlib"
  1287. flashsv2_decoder_select="zlib"
  1288. flv_decoder_select="h263_decoder"
  1289. flv_encoder_select="h263_encoder"
  1290. fraps_decoder_select="huffman"
  1291. h261_decoder_select="error_resilience mpegvideo"
  1292. h261_encoder_select="aandcttables mpegvideoenc"
  1293. h263_decoder_select="error_resilience h263_parser mpegvideo"
  1294. h263_encoder_select="aandcttables error_resilience mpegvideoenc"
  1295. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1296. h263i_decoder_select="h263_decoder"
  1297. h263p_encoder_select="h263_encoder"
  1298. h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1299. h264_dxva2_hwaccel_deps="dxva2api_h"
  1300. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1301. h264_vaapi_hwaccel_select="vaapi h264_decoder"
  1302. h264_vda_hwaccel_select="vda h264_decoder"
  1303. h264_vdpau_decoder_select="vdpau h264_decoder"
  1304. huffyuv_encoder_select="huffman"
  1305. iac_decoder_select="fft mdct sinewin"
  1306. imc_decoder_select="fft mdct sinewin"
  1307. jpegls_decoder_select="golomb"
  1308. jpegls_encoder_select="golomb"
  1309. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1310. loco_decoder_select="golomb"
  1311. mdec_decoder_select="error_resilience mpegvideo"
  1312. mjpeg_encoder_select="aandcttables mpegvideoenc"
  1313. mlp_decoder_select="mlp_parser"
  1314. mp1_decoder_select="mpegaudiodsp"
  1315. mp1float_decoder_select="mpegaudiodsp"
  1316. mp2_decoder_select="mpegaudiodsp"
  1317. mp2float_decoder_select="mpegaudiodsp"
  1318. mp3_decoder_select="mpegaudiodsp"
  1319. mp3adu_decoder_select="mpegaudiodsp"
  1320. mp3adufloat_decoder_select="mpegaudiodsp"
  1321. mp3float_decoder_select="mpegaudiodsp"
  1322. mp3on4_decoder_select="mpegaudiodsp"
  1323. mp3on4float_decoder_select="mpegaudiodsp"
  1324. mpc7_decoder_select="mpegaudiodsp"
  1325. mpc8_decoder_select="mpegaudiodsp"
  1326. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1327. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1328. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1329. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1330. mpeg1video_decoder_select="error_resilience mpegvideo"
  1331. mpeg1video_encoder_select="aandcttables error_resilience mpegvideoenc"
  1332. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1333. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1334. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1335. mpeg2video_decoder_select="error_resilience mpegvideo"
  1336. mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
  1337. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1338. mpeg4_encoder_select="h263_encoder"
  1339. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1340. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1341. msmpeg4v1_decoder_select="h263_decoder"
  1342. msmpeg4v1_encoder_select="h263_encoder"
  1343. msmpeg4v2_decoder_select="h263_decoder"
  1344. msmpeg4v2_encoder_select="h263_encoder"
  1345. msmpeg4v3_decoder_select="h263_decoder"
  1346. msmpeg4v3_encoder_select="h263_encoder"
  1347. mss2_decoder_select="vc1_decoder"
  1348. nellymoser_decoder_select="mdct sinewin"
  1349. nellymoser_encoder_select="mdct sinewin"
  1350. png_decoder_select="zlib"
  1351. png_encoder_select="zlib"
  1352. qcelp_decoder_select="lsp"
  1353. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1354. ra_144_encoder_select="lpc"
  1355. ralf_decoder_select="golomb"
  1356. rv10_decoder_select="h263_decoder"
  1357. rv10_encoder_select="h263_encoder"
  1358. rv20_decoder_select="h263_decoder"
  1359. rv20_encoder_select="h263_encoder"
  1360. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1361. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1362. shorten_decoder_select="golomb"
  1363. sipr_decoder_select="lsp"
  1364. snow_decoder_select="dwt rangecoder"
  1365. snow_encoder_select="aandcttables dwt error_resilience mpegvideoenc rangecoder"
  1366. svq1_decoder_select="error_resilience mpegvideo"
  1367. svq1_encoder_select="aandcttables error_resilience mpegvideoenc"
  1368. svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1369. svq3_decoder_suggest="zlib"
  1370. theora_decoder_select="vp3_decoder"
  1371. tiff_decoder_suggest="zlib"
  1372. tiff_encoder_suggest="zlib"
  1373. truehd_decoder_select="mlp_decoder"
  1374. tscc_decoder_select="zlib"
  1375. twinvq_decoder_select="mdct lsp sinewin"
  1376. utvideo_encoder_select="huffman"
  1377. vc1_decoder_select="h263_decoder h264chroma h264qpel"
  1378. vc1_dxva2_hwaccel_deps="dxva2api_h"
  1379. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1380. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1381. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1382. vc1image_decoder_select="vc1_decoder"
  1383. vorbis_decoder_select="mdct"
  1384. vorbis_encoder_select="mdct"
  1385. vp3_decoder_select="vp3dsp"
  1386. vp5_decoder_select="vp3dsp"
  1387. vp6_decoder_select="huffman vp3dsp"
  1388. vp6a_decoder_select="vp6_decoder"
  1389. vp6f_decoder_select="vp6_decoder"
  1390. vp8_decoder_select="h264pred h264qpel"
  1391. wmapro_decoder_select="mdct sinewin"
  1392. wmav1_decoder_select="mdct sinewin"
  1393. wmav1_encoder_select="mdct sinewin"
  1394. wmav2_decoder_select="mdct sinewin"
  1395. wmav2_encoder_select="mdct sinewin"
  1396. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1397. wmv1_decoder_select="h263_decoder"
  1398. wmv1_encoder_select="h263_encoder"
  1399. wmv2_decoder_select="h263_decoder"
  1400. wmv2_encoder_select="h263_encoder"
  1401. wmv3_decoder_select="vc1_decoder"
  1402. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1403. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1404. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1405. wmv3image_decoder_select="wmv3_decoder"
  1406. zerocodec_decoder_select="zlib"
  1407. zlib_decoder_select="zlib"
  1408. zlib_encoder_select="zlib"
  1409. zmbv_decoder_select="zlib"
  1410. zmbv_encoder_select="zlib"
  1411. vaapi_deps="va_va_h"
  1412. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1413. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1414. # parsers
  1415. h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
  1416. mpeg4video_parser_select="error_resilience mpegvideo"
  1417. mpegvideo_parser_select="error_resilience mpegvideo"
  1418. vc1_parser_select="error_resilience mpegvideo"
  1419. # external libraries
  1420. libfaac_encoder_deps="libfaac"
  1421. libfdk_aac_encoder_deps="libfdk_aac"
  1422. libgsm_decoder_deps="libgsm"
  1423. libgsm_encoder_deps="libgsm"
  1424. libgsm_ms_decoder_deps="libgsm"
  1425. libgsm_ms_encoder_deps="libgsm"
  1426. libilbc_decoder_deps="libilbc"
  1427. libilbc_encoder_deps="libilbc"
  1428. libmp3lame_encoder_deps="libmp3lame"
  1429. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1430. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1431. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1432. libopenjpeg_decoder_deps="libopenjpeg"
  1433. libopenjpeg_encoder_deps="libopenjpeg"
  1434. libschroedinger_decoder_deps="libschroedinger"
  1435. libschroedinger_encoder_deps="libschroedinger"
  1436. libspeex_decoder_deps="libspeex"
  1437. libspeex_encoder_deps="libspeex"
  1438. libtheora_encoder_deps="libtheora"
  1439. libvo_aacenc_encoder_deps="libvo_aacenc"
  1440. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1441. libvorbis_encoder_deps="libvorbis"
  1442. libvpx_decoder_deps="libvpx"
  1443. libvpx_encoder_deps="libvpx"
  1444. libx264_encoder_deps="libx264"
  1445. libxavs_encoder_deps="libxavs"
  1446. libxvid_encoder_deps="libxvid"
  1447. # demuxers / muxers
  1448. ac3_demuxer_select="ac3_parser"
  1449. asf_stream_muxer_select="asf_muxer"
  1450. avisynth_demuxer_deps="avisynth"
  1451. dirac_demuxer_select="dirac_parser"
  1452. eac3_demuxer_select="ac3_parser"
  1453. flac_demuxer_select="flac_parser"
  1454. ipod_muxer_select="mov_muxer"
  1455. matroska_audio_muxer_select="matroska_muxer"
  1456. matroska_demuxer_suggest="zlib bzlib"
  1457. mov_demuxer_suggest="zlib"
  1458. mp3_demuxer_select="mpegaudio_parser"
  1459. mp4_muxer_select="mov_muxer"
  1460. mpegts_muxer_select="adts_muxer latm_muxer mpegvideo"
  1461. mpegtsraw_demuxer_select="mpegts_demuxer"
  1462. mxf_d10_muxer_select="mxf_muxer"
  1463. ogg_demuxer_select="golomb"
  1464. psp_muxer_select="mov_muxer"
  1465. rtp_demuxer_select="sdp_demuxer"
  1466. rtp_muxer_select="mpegvideo"
  1467. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1468. rtsp_demuxer_select="http_protocol rtpdec"
  1469. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1470. sap_demuxer_select="sdp_demuxer"
  1471. sap_muxer_select="rtp_muxer rtp_protocol"
  1472. sdp_demuxer_select="rtpdec"
  1473. smoothstreaming_muxer_select="ismv_muxer"
  1474. spdif_muxer_select="aac_parser"
  1475. tg2_muxer_select="mov_muxer"
  1476. tgp_muxer_select="mov_muxer"
  1477. w64_demuxer_deps="wav_demuxer"
  1478. # indevs / outdevs
  1479. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1480. alsa_outdev_deps="alsa_asoundlib_h"
  1481. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1482. dv1394_indev_deps="dv1394 dv_demuxer"
  1483. fbdev_indev_deps="linux_fb_h"
  1484. jack_indev_deps="jack_jack_h"
  1485. libcdio_indev_deps="libcdio"
  1486. libdc1394_indev_deps="libdc1394"
  1487. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1488. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1489. pulse_indev_deps="libpulse"
  1490. sndio_indev_deps="sndio_h"
  1491. sndio_outdev_deps="sndio_h"
  1492. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1493. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1494. vfwcap_indev_extralibs="-lavicap32"
  1495. x11grab_indev_deps="x11grab XShmCreateImage"
  1496. # protocols
  1497. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1498. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1499. ffrtmpcrypt_protocol_select="tcp_protocol"
  1500. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1501. ffrtmphttp_protocol_select="http_protocol"
  1502. gopher_protocol_deps="network"
  1503. httpproxy_protocol_deps="network"
  1504. httpproxy_protocol_select="tcp_protocol"
  1505. http_protocol_deps="network"
  1506. http_protocol_select="tcp_protocol"
  1507. https_protocol_select="tls_protocol"
  1508. librtmp_protocol_deps="librtmp"
  1509. librtmpe_protocol_deps="librtmp"
  1510. librtmps_protocol_deps="librtmp"
  1511. librtmpt_protocol_deps="librtmp"
  1512. librtmpte_protocol_deps="librtmp"
  1513. mmsh_protocol_select="http_protocol"
  1514. mmst_protocol_deps="network"
  1515. rtmp_protocol_deps="!librtmp_protocol"
  1516. rtmp_protocol_select="tcp_protocol"
  1517. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1518. rtmps_protocol_deps="!librtmp_protocol"
  1519. rtmps_protocol_select="tls_protocol"
  1520. rtmpt_protocol_select="ffrtmphttp_protocol"
  1521. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1522. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1523. rtp_protocol_select="udp_protocol"
  1524. sctp_protocol_deps="network struct_sctp_event_subscribe"
  1525. tcp_protocol_deps="network"
  1526. tls_protocol_deps_any="openssl gnutls"
  1527. tls_protocol_select="tcp_protocol"
  1528. udp_protocol_deps="network"
  1529. # filters
  1530. blackframe_filter_deps="gpl"
  1531. boxblur_filter_deps="gpl"
  1532. cropdetect_filter_deps="gpl"
  1533. delogo_filter_deps="gpl"
  1534. drawtext_filter_deps="libfreetype"
  1535. frei0r_filter_deps="frei0r dlopen strtok_r"
  1536. frei0r_filter_extralibs='$ldl'
  1537. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1538. frei0r_src_filter_extralibs='$ldl'
  1539. hqdn3d_filter_deps="gpl"
  1540. resample_filter_deps="avresample"
  1541. ocv_filter_deps="libopencv"
  1542. scale_filter_deps="swscale"
  1543. yadif_filter_deps="gpl"
  1544. # libraries
  1545. avdevice_deps="avcodec avformat"
  1546. avformat_deps="avcodec"
  1547. # programs
  1548. avconv_deps="avcodec avfilter avformat avresample swscale
  1549. aformat_filter asyncts_filter
  1550. format_filter fps_filter scale_filter setpts_filter"
  1551. avplay_deps="avcodec avformat swscale sdl"
  1552. avplay_select="rdft"
  1553. avprobe_deps="avcodec avformat"
  1554. avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
  1555. avserver_extralibs='$ldl'
  1556. doc_deps="texi2html"
  1557. # tests
  1558. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1559. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1560. test_deps(){
  1561. suf1=$1
  1562. suf2=$2
  1563. shift 2
  1564. for v; do
  1565. dep=${v%=*}
  1566. tests=${v#*=}
  1567. for name in ${tests}; do
  1568. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1569. done
  1570. done
  1571. }
  1572. test_deps _muxer _demuxer \
  1573. aiff \
  1574. pcm_alaw=alaw \
  1575. asf \
  1576. au \
  1577. avi \
  1578. dv=dv_fmt \
  1579. ffm \
  1580. flv=flv_fmt \
  1581. gxf \
  1582. matroska=mkv \
  1583. mmf \
  1584. mov \
  1585. pcm_mulaw=mulaw \
  1586. mxf="mxf mxf_d10" \
  1587. nut \
  1588. ogg \
  1589. rawvideo=pixfmt \
  1590. rm \
  1591. swf \
  1592. mpegts=ts \
  1593. voc \
  1594. wav \
  1595. yuv4mpegpipe=yuv4mpeg \
  1596. # default parameters
  1597. logfile="config.log"
  1598. # installation paths
  1599. prefix_default="/usr/local"
  1600. bindir_default='${prefix}/bin'
  1601. datadir_default='${prefix}/share/avconv'
  1602. incdir_default='${prefix}/include'
  1603. libdir_default='${prefix}/lib'
  1604. mandir_default='${prefix}/share/man'
  1605. shlibdir_default="$libdir_default"
  1606. # toolchain
  1607. ar_default="ar"
  1608. cc_default="gcc"
  1609. host_cc_default="gcc"
  1610. ln_s="ln -sf"
  1611. nm_default="nm -g"
  1612. objformat="elf"
  1613. pkg_config_default=pkg-config
  1614. ranlib="ranlib"
  1615. yasmexe="yasm"
  1616. nogas=":"
  1617. # machine
  1618. arch_default=$(uname -m)
  1619. cpu="generic"
  1620. # OS
  1621. target_os_default=$(tolower $(uname -s))
  1622. host_os=$target_os_default
  1623. # configurable options
  1624. enable $PROGRAM_LIST
  1625. enable avcodec
  1626. enable avdevice
  1627. enable avfilter
  1628. enable avformat
  1629. enable avresample
  1630. enable avutil
  1631. enable swscale
  1632. enable asm
  1633. enable debug
  1634. enable doc
  1635. enable network
  1636. enable optimizations
  1637. enable safe_bitstream_reader
  1638. enable static
  1639. enable swscale_alpha
  1640. # build settings
  1641. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1642. AVSERVERLDFLAGS=-Wl,-E
  1643. LIBPREF="lib"
  1644. LIBSUF=".a"
  1645. FULLNAME='$(NAME)$(BUILDSUF)'
  1646. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1647. SLIBPREF="lib"
  1648. SLIBSUF=".so"
  1649. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1650. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1651. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1652. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1653. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1654. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1655. asflags_filter=echo
  1656. cflags_filter=echo
  1657. ldflags_filter=echo
  1658. AS_C='-c'
  1659. AS_O='-o $@'
  1660. CC_C='-c'
  1661. CC_E='-E -o $@'
  1662. CC_O='-o $@'
  1663. LD_O='-o $@'
  1664. LD_LIB='-l%'
  1665. LD_PATH='-L'
  1666. HOSTCC_C='-c'
  1667. HOSTCC_O='-o $@'
  1668. HOSTLD_O='-o $@'
  1669. host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
  1670. host_libs='-lm'
  1671. host_cflags_filter=echo
  1672. host_ldflags_filter=echo
  1673. target_path='$(CURDIR)'
  1674. # since the object filename is not given with the -MM flag, the compiler
  1675. # is only able to print the basename, and we must add the path ourselves
  1676. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1677. DEPFLAGS='-MM'
  1678. # find source path
  1679. if test -f configure; then
  1680. source_path=.
  1681. else
  1682. source_path=$(cd $(dirname "$0"); pwd)
  1683. echo "$source_path" | grep -q '[[:blank:]]' &&
  1684. die "Out of tree builds are impossible with whitespace in source path."
  1685. test -e "$source_path/config.h" &&
  1686. die "Out of tree builds are impossible with config.h in source dir."
  1687. fi
  1688. for v in "$@"; do
  1689. r=${v#*=}
  1690. l=${v%"$r"}
  1691. r=$(sh_quote "$r")
  1692. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1693. done
  1694. find_things(){
  1695. thing=$1
  1696. pattern=$2
  1697. file=$source_path/$3
  1698. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1699. }
  1700. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1701. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1702. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1703. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1704. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1705. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1706. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1707. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1708. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1709. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1710. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1711. ALL_COMPONENTS="
  1712. $BSF_LIST
  1713. $DECODER_LIST
  1714. $DEMUXER_LIST
  1715. $ENCODER_LIST
  1716. $FILTER_LIST
  1717. $HWACCEL_LIST
  1718. $INDEV_LIST
  1719. $MUXER_LIST
  1720. $OUTDEV_LIST
  1721. $PARSER_LIST
  1722. $PROTOCOL_LIST
  1723. "
  1724. find_tests(){
  1725. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1726. }
  1727. LAVF_TESTS=$(find_tests lavf)
  1728. LAVFI_TESTS=$(find_tests lavfi)
  1729. SEEK_TESTS=$(find_tests seek seek_)
  1730. ALL_TESTS="$LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
  1731. for n in $COMPONENT_LIST; do
  1732. v=$(toupper ${n%s})_LIST
  1733. eval enable \$$v
  1734. eval ${n}_if_any="\$$v"
  1735. done
  1736. enable $ARCH_EXT_LIST $ALL_TESTS
  1737. die_unknown(){
  1738. echo "Unknown option \"$1\"."
  1739. echo "See $0 --help for available options."
  1740. exit 1
  1741. }
  1742. show_list() {
  1743. suffix=_$1
  1744. shift
  1745. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1746. exit 0
  1747. }
  1748. rand_list(){
  1749. IFS=', '
  1750. set -- $*
  1751. unset IFS
  1752. for thing; do
  1753. comp=${thing%:*}
  1754. prob=${thing#$comp}
  1755. prob=${prob#:}
  1756. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  1757. echo "prob ${prob:-0.5}"
  1758. printf '%s\n' $comp
  1759. done
  1760. }
  1761. do_random(){
  1762. action=$1
  1763. shift
  1764. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  1765. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  1766. }
  1767. for opt do
  1768. optval="${opt#*=}"
  1769. case "$opt" in
  1770. --extra-ldflags=*) add_ldflags $optval
  1771. ;;
  1772. --extra-libs=*) add_extralibs $optval
  1773. ;;
  1774. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1775. ;;
  1776. --enable-debug=*) debuglevel="$optval"
  1777. ;;
  1778. --disable-everything)
  1779. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1780. ;;
  1781. --enable-random|--disable-random)
  1782. action=${opt%%-random}
  1783. do_random ${action#--} $COMPONENT_LIST
  1784. ;;
  1785. --enable-random=*|--disable-random=*)
  1786. action=${opt%%-random=*}
  1787. do_random ${action#--} $optval
  1788. ;;
  1789. --enable-*=*|--disable-*=*)
  1790. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1791. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1792. eval list=\$$(toupper $thing)_LIST
  1793. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1794. $action $(filter "$name" $list)
  1795. ;;
  1796. --enable-?*|--disable-?*)
  1797. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1798. if is_in $option $COMPONENT_LIST; then
  1799. test $action = disable && action=unset
  1800. eval $action \$$(toupper ${option%s})_LIST
  1801. elif is_in $option $CMDLINE_SELECT; then
  1802. $action $option
  1803. else
  1804. die_unknown $opt
  1805. fi
  1806. ;;
  1807. --list-*)
  1808. NAME="${opt#--list-}"
  1809. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1810. NAME=${NAME%s}
  1811. eval show_list $NAME \$$(toupper $NAME)_LIST
  1812. ;;
  1813. --help|-h) show_help
  1814. ;;
  1815. *)
  1816. optname="${opt%%=*}"
  1817. optname="${optname#--}"
  1818. optname=$(echo "$optname" | sed 's/-/_/g')
  1819. if is_in $optname $CMDLINE_SET; then
  1820. eval $optname='$optval'
  1821. elif is_in $optname $CMDLINE_APPEND; then
  1822. append $optname "$optval"
  1823. else
  1824. die_unknown $opt
  1825. fi
  1826. ;;
  1827. esac
  1828. done
  1829. disabled logging && logfile=/dev/null
  1830. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1831. set >> $logfile
  1832. test -n "$cross_prefix" && enable cross_compile
  1833. if enabled cross_compile; then
  1834. test -n "$arch" && test -n "$target_os" ||
  1835. die "Must specify target arch and OS when cross-compiling"
  1836. fi
  1837. set_default arch target_os
  1838. ar_default="${cross_prefix}${ar_default}"
  1839. cc_default="${cross_prefix}${cc_default}"
  1840. nm_default="${cross_prefix}${nm_default}"
  1841. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1842. ranlib="${cross_prefix}${ranlib}"
  1843. sysinclude_default="${sysroot}/usr/include"
  1844. case "$toolchain" in
  1845. msvc)
  1846. cc_default="c99wrap cl"
  1847. ld_default="c99wrap link"
  1848. nm_default="dumpbin -symbols"
  1849. ar_default="lib"
  1850. ;;
  1851. ?*)
  1852. die "Unknown toolchain $toolchain"
  1853. ;;
  1854. esac
  1855. set_default cc pkg_config sysinclude
  1856. enabled cross_compile || host_cc_default=$cc
  1857. set_default host_cc
  1858. if ! $pkg_config --version >/dev/null 2>&1; then
  1859. warn "$pkg_config not found, library detection may fail."
  1860. pkg_config=false
  1861. fi
  1862. exesuf() {
  1863. case $1 in
  1864. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1865. esac
  1866. }
  1867. EXESUF=$(exesuf $target_os)
  1868. HOSTEXESUF=$(exesuf $host_os)
  1869. # set temporary file name
  1870. : ${TMPDIR:=$TEMPDIR}
  1871. : ${TMPDIR:=$TMP}
  1872. : ${TMPDIR:=/tmp}
  1873. if ! check_cmd mktemp -u XXXXXX; then
  1874. # simple replacement for missing mktemp
  1875. # NOT SAFE FOR GENERAL USE
  1876. mktemp(){
  1877. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1878. }
  1879. fi
  1880. tmpfile(){
  1881. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1882. (set -C; exec > $tmp) 2>/dev/null ||
  1883. die "Unable to create temporary file in $TMPDIR."
  1884. append TMPFILES $tmp
  1885. eval $1=$tmp
  1886. }
  1887. trap 'rm -f -- $TMPFILES' EXIT
  1888. tmpfile TMPASM .asm
  1889. tmpfile TMPC .c
  1890. tmpfile TMPE $EXESUF
  1891. tmpfile TMPH .h
  1892. tmpfile TMPO .o
  1893. tmpfile TMPS .S
  1894. tmpfile TMPSH .sh
  1895. tmpfile TMPV .ver
  1896. unset -f mktemp
  1897. chmod +x $TMPE
  1898. # make sure we can execute files in $TMPDIR
  1899. cat > $TMPSH 2>> $logfile <<EOF
  1900. #! /bin/sh
  1901. EOF
  1902. chmod +x $TMPSH >> $logfile 2>&1
  1903. if ! $TMPSH >> $logfile 2>&1; then
  1904. cat <<EOF
  1905. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1906. variable to another directory and make sure that it is not mounted noexec.
  1907. EOF
  1908. die "Sanity test failed."
  1909. fi
  1910. msvc_flags(){
  1911. for flag; do
  1912. case $flag in
  1913. -fomit-frame-pointer) echo -Oy ;;
  1914. -g) echo -Z7 ;;
  1915. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  1916. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  1917. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  1918. -wd4996 ;;
  1919. -std=c99) ;;
  1920. -fno-math-errno) ;;
  1921. -fno-common) ;;
  1922. -fno-signed-zeros) ;;
  1923. -lz) echo zlib.lib ;;
  1924. -l*) echo ${flag#-l}.lib ;;
  1925. *) echo $flag ;;
  1926. esac
  1927. done
  1928. }
  1929. pgi_flags(){
  1930. for flag; do
  1931. case $flag in
  1932. -fomit-frame-pointer) echo -Mnoframe ;;
  1933. -g) echo -gopt ;;
  1934. *) echo $flag ;;
  1935. esac
  1936. done
  1937. }
  1938. suncc_flags(){
  1939. for flag; do
  1940. case $flag in
  1941. -march=*|-mcpu=*)
  1942. case "${flag#*=}" in
  1943. native) echo -xtarget=native ;;
  1944. v9|niagara) echo -xarch=sparc ;;
  1945. ultrasparc) echo -xarch=sparcvis ;;
  1946. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1947. i586|pentium) echo -xchip=pentium ;;
  1948. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1949. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1950. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1951. pentium4*) echo -xtarget=pentium4 ;;
  1952. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1953. *-sse3) echo -xarch=sse3 ;;
  1954. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1955. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  1956. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1957. k8|opteron|athlon64|athlon-fx)
  1958. echo -xarch=sse2a ;;
  1959. athlon*) echo -xarch=pentium_proa ;;
  1960. esac
  1961. ;;
  1962. -std=c99) echo -xc99 ;;
  1963. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1964. -fPIC) echo -KPIC -xcode=pic32 ;;
  1965. -W*,*) echo $flag ;;
  1966. -f*-*|-W*) ;;
  1967. *) echo $flag ;;
  1968. esac
  1969. done
  1970. }
  1971. tms470_flags(){
  1972. for flag; do
  1973. case $flag in
  1974. -march=*|-mcpu=*)
  1975. case "${flag#*=}" in
  1976. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1977. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1978. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1979. armv6*|arm11*) echo -mv=6 ;;
  1980. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1981. echo -mv=5e ;;
  1982. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1983. esac
  1984. ;;
  1985. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1986. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1987. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1988. -msoft-float) echo --float_support=vfplib ;;
  1989. -O[0-3]|-mf=*) echo $flag ;;
  1990. -g) echo -g -mn ;;
  1991. -pds=*) echo $flag ;;
  1992. -D*|-I*) echo $flag ;;
  1993. --gcc|--abi=*) echo $flag ;;
  1994. -me) echo $flag ;;
  1995. esac
  1996. done
  1997. }
  1998. probe_cc(){
  1999. pfx=$1
  2000. _cc=$2
  2001. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2002. unset _ld_o _ldflags _ld_lib _ld_path
  2003. unset _depflags _DEPCMD _DEPFLAGS
  2004. _flags_filter=echo
  2005. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2006. _type=llvm_gcc
  2007. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2008. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2009. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2010. _cflags_speed='-O3'
  2011. _cflags_size='-Os'
  2012. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2013. _type=gcc
  2014. gcc_version=$($_cc --version | head -n1)
  2015. gcc_basever=$($_cc -dumpversion)
  2016. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2017. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2018. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2019. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2020. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2021. fi
  2022. _cflags_speed='-O3'
  2023. _cflags_size='-Os'
  2024. elif $_cc --version 2>/dev/null | grep -q Intel; then
  2025. _type=icc
  2026. _ident=$($_cc --version | head -n1)
  2027. _depflags='-MMD'
  2028. _cflags_speed='-O3'
  2029. _cflags_size='-Os'
  2030. _cflags_noopt='-O1'
  2031. elif $_cc -v 2>&1 | grep -q xlc; then
  2032. _type=xlc
  2033. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2034. _cflags_speed='-O5'
  2035. _cflags_size='-O5 -qcompact'
  2036. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2037. _type=ccc
  2038. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2039. _DEPFLAGS='-M'
  2040. debuglevel=3
  2041. _ldflags='-Wl,-z,now' # calls to libots crash without this
  2042. _cflags_speed='-fast'
  2043. _cflags_size='-O1'
  2044. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2045. test -d "$sysroot" || die "No valid sysroot specified."
  2046. _type=armcc
  2047. _ident=$($_cc --vsn | head -n1)
  2048. armcc_conf="$PWD/armcc.conf"
  2049. $_cc --arm_linux_configure \
  2050. --arm_linux_config_file="$armcc_conf" \
  2051. --configure_sysroot="$sysroot" \
  2052. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2053. die "Error creating armcc configuration file."
  2054. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2055. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2056. as_default="${cross_prefix}gcc"
  2057. _depflags='-MMD'
  2058. _cflags_speed='-O3'
  2059. _cflags_size='-Os'
  2060. elif $_cc -version 2>/dev/null | grep -q TMS470; then
  2061. _type=tms470
  2062. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2063. _flags='--gcc --abi=eabi -me'
  2064. _cflags='-D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__='
  2065. _cc_e='-ppl -fe=$@'
  2066. _cc_o='-fe=$@'
  2067. as_default="${cross_prefix}gcc"
  2068. ld_default="${cross_prefix}gcc"
  2069. _depflags='-ppa -ppd=$(@:.o=.d)'
  2070. _cflags_speed='-O3 -mf=5'
  2071. _cflags_size='-O3 -mf=2'
  2072. _flags_filter=tms470_flags
  2073. elif $_cc -v 2>&1 | grep -q clang; then
  2074. _type=clang
  2075. _ident=$($_cc --version | head -n1)
  2076. _depflags='-MMD'
  2077. _cflags_speed='-O3'
  2078. _cflags_size='-Os'
  2079. elif $_cc -V 2>&1 | grep -q Sun; then
  2080. _type=suncc
  2081. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2082. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2083. _DEPFLAGS='-xM1 -xc99'
  2084. _ldflags='-std=c99'
  2085. _cflags_speed='-O5'
  2086. _cflags_size='-O5 -xspace'
  2087. _flags_filter=suncc_flags
  2088. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2089. _type=pathscale
  2090. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2091. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2092. _cflags_speed='-O2'
  2093. _cflags_size='-Os'
  2094. _flags_filter='filter_out -Wdisabled-optimization'
  2095. elif $_cc -v 2>&1 | grep -q Open64; then
  2096. _type=open64
  2097. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2098. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2099. _cflags_speed='-O2'
  2100. _cflags_size='-Os'
  2101. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2102. elif $_cc -V 2>&1 | grep -q Portland; then
  2103. _type=pgi
  2104. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2105. opt_common='-alias=ansi -Mlre -Mpre'
  2106. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2107. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2108. _cflags_noopt="-O1"
  2109. _flags_filter=pgi_flags
  2110. elif $_cc 2>&1 | grep -q Microsoft; then
  2111. _type=msvc
  2112. _ident=$($cc 2>&1 | head -n1)
  2113. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2114. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2115. _cflags_speed="-O2"
  2116. _cflags_size="-O1"
  2117. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2118. if $_cc 2>&1 | grep -q Linker; then
  2119. _ld_o='-out $@'
  2120. else
  2121. _ld_o='-Fe$@'
  2122. fi
  2123. _cc_o='-Fo $@'
  2124. _cc_e='-P -Fi $@'
  2125. _flags_filter=msvc_flags
  2126. _ld_lib='lib%.a'
  2127. _ld_path='-libpath:'
  2128. _flags='-nologo'
  2129. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2130. if [ $pfx = hostcc ]; then
  2131. append _cflags -Dsnprintf=_snprintf
  2132. fi
  2133. fi
  2134. eval ${pfx}_type=\$_type
  2135. eval ${pfx}_ident=\$_ident
  2136. }
  2137. set_ccvars(){
  2138. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2139. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2140. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2141. if [ -n "$_depflags" ]; then
  2142. eval ${1}_DEPFLAGS=\$_depflags
  2143. else
  2144. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2145. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2146. eval DEP${1}FLAGS=\$_flags
  2147. fi
  2148. }
  2149. probe_cc cc "$cc"
  2150. cflags_filter=$_flags_filter
  2151. cflags_speed=$_cflags_speed
  2152. cflags_size=$_cflags_size
  2153. cflags_noopt=$_cflags_noopt
  2154. add_cflags $_flags $_cflags
  2155. cc_ldflags=$_ldflags
  2156. set_ccvars CC
  2157. probe_cc hostcc "$host_cc"
  2158. host_cflags_filter=$_flags_filter
  2159. add_host_cflags $_flags $_cflags
  2160. set_ccvars HOSTCC
  2161. test -n "$cc_type" && enable $cc_type ||
  2162. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2163. : ${as_default:=$cc}
  2164. : ${dep_cc_default:=$cc}
  2165. : ${ld_default:=$cc}
  2166. : ${host_ld_default:=$host_cc}
  2167. set_default ar as dep_cc ld host_ld
  2168. probe_cc as "$as"
  2169. asflags_filter=$_flags_filter
  2170. add_asflags $_flags $_cflags
  2171. set_ccvars AS
  2172. probe_cc ld "$ld"
  2173. ldflags_filter=$_flags_filter
  2174. add_ldflags $_flags $_ldflags
  2175. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2176. LD_O=${_ld_o-$LD_O}
  2177. LD_LIB=${_ld_lib-$LD_LIB}
  2178. LD_PATH=${_ld_path-$LD_PATH}
  2179. probe_cc hostld "$host_ld"
  2180. host_ldflags_filter=$_flags_filter
  2181. add_host_ldflags $_flags $_ldflags
  2182. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2183. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2184. probe_cc depcc "$dep_cc"
  2185. CCDEP=${_DEPCMD:-$DEPCMD}
  2186. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2187. DEPCCFLAGS=$_flags
  2188. fi
  2189. if $ar 2>&1 | grep -q Microsoft; then
  2190. arflags="-nologo"
  2191. ar_o='-out:$@'
  2192. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2193. arflags="rq"
  2194. ar_o='$@'
  2195. else
  2196. arflags="rc"
  2197. ar_o='$@'
  2198. fi
  2199. add_cflags $extra_cflags
  2200. add_asflags $extra_cflags
  2201. if test -n "$sysroot"; then
  2202. case "$cc_type" in
  2203. gcc|llvm_gcc|clang)
  2204. add_cppflags --sysroot="$sysroot"
  2205. add_ldflags --sysroot="$sysroot"
  2206. ;;
  2207. tms470)
  2208. add_cppflags -I"$sysinclude"
  2209. add_ldflags --sysroot="$sysroot"
  2210. ;;
  2211. esac
  2212. fi
  2213. if test "$cpu" = host; then
  2214. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2215. case "$cc_type" in
  2216. gcc|llvm_gcc)
  2217. check_native(){
  2218. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2219. sed -n "/cc1.*$1=/{
  2220. s/.*$1=\\([^ ]*\\).*/\\1/
  2221. p
  2222. q
  2223. }" $TMPE
  2224. }
  2225. cpu=$(check_native -march || check_native -mcpu)
  2226. ;;
  2227. esac
  2228. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2229. fi
  2230. # Deal with common $arch aliases
  2231. case "$arch" in
  2232. arm*)
  2233. arch="arm"
  2234. ;;
  2235. mips|mipsel|IP*)
  2236. arch="mips"
  2237. ;;
  2238. mips64*)
  2239. arch="mips"
  2240. subarch="mips64"
  2241. ;;
  2242. parisc|hppa)
  2243. arch="parisc"
  2244. ;;
  2245. parisc64|hppa64)
  2246. arch="parisc"
  2247. subarch="parisc64"
  2248. ;;
  2249. "Power Macintosh"|ppc|powerpc)
  2250. arch="ppc"
  2251. ;;
  2252. ppc64|powerpc64)
  2253. arch="ppc"
  2254. subarch="ppc64"
  2255. ;;
  2256. s390|s390x)
  2257. arch="s390"
  2258. ;;
  2259. sh4|sh)
  2260. arch="sh4"
  2261. ;;
  2262. sun4u|sparc64)
  2263. arch="sparc"
  2264. subarch="sparc64"
  2265. ;;
  2266. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2267. arch="x86"
  2268. ;;
  2269. esac
  2270. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2271. enable $arch
  2272. # Add processor-specific flags
  2273. if test "$cpu" = generic; then
  2274. : do nothing
  2275. elif enabled ppc; then
  2276. case $(tolower $cpu) in
  2277. 601|ppc601|powerpc601)
  2278. cpuflags="-mcpu=601"
  2279. disable altivec
  2280. ;;
  2281. 603*|ppc603*|powerpc603*)
  2282. cpuflags="-mcpu=603"
  2283. disable altivec
  2284. ;;
  2285. 604*|ppc604*|powerpc604*)
  2286. cpuflags="-mcpu=604"
  2287. disable altivec
  2288. ;;
  2289. g3|75*|ppc75*|powerpc75*)
  2290. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2291. disable altivec
  2292. ;;
  2293. g4|745*|ppc745*|powerpc745*)
  2294. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2295. ;;
  2296. 74*|ppc74*|powerpc74*)
  2297. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2298. ;;
  2299. g5|970|ppc970|powerpc970)
  2300. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2301. ;;
  2302. power[3-7]*)
  2303. cpuflags="-mcpu=$cpu -mpowerpc-gfxopt -mpowerpc64"
  2304. ;;
  2305. cell)
  2306. cpuflags="-mcpu=cell"
  2307. enable ldbrx
  2308. ;;
  2309. e500mc)
  2310. cpuflags="-mcpu=e500mc"
  2311. disable altivec
  2312. ;;
  2313. e500v2)
  2314. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2315. disable altivec
  2316. ;;
  2317. e500)
  2318. cpuflags="-mcpu=8540 -mhard-float"
  2319. disable altivec
  2320. ;;
  2321. esac
  2322. elif enabled x86; then
  2323. case $cpu in
  2324. i[345]86|pentium)
  2325. cpuflags="-march=$cpu"
  2326. disable mmx
  2327. ;;
  2328. # targets that do NOT support conditional mov (cmov)
  2329. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2330. cpuflags="-march=$cpu"
  2331. disable cmov
  2332. ;;
  2333. # targets that do support conditional mov (cmov)
  2334. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom|bdver*)
  2335. cpuflags="-march=$cpu"
  2336. enable cmov
  2337. enable fast_cmov
  2338. ;;
  2339. # targets that do support conditional mov but on which it's slow
  2340. pentium4|pentium4m|prescott|nocona)
  2341. cpuflags="-march=$cpu"
  2342. enable cmov
  2343. disable fast_cmov
  2344. ;;
  2345. esac
  2346. elif enabled sparc; then
  2347. case $cpu in
  2348. niagara)
  2349. cpuflags="-mcpu=$cpu"
  2350. disable vis
  2351. ;;
  2352. sparc64)
  2353. cpuflags="-mcpu=v9"
  2354. ;;
  2355. esac
  2356. elif enabled arm; then
  2357. case $cpu in
  2358. armv*)
  2359. cpuflags="-march=$cpu"
  2360. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2361. ;;
  2362. *)
  2363. cpuflags="-mcpu=$cpu"
  2364. case $cpu in
  2365. cortex-a*) subarch=armv7a ;;
  2366. cortex-r*) subarch=armv7r ;;
  2367. cortex-m*) enable thumb; subarch=armv7m ;;
  2368. arm11*) subarch=armv6 ;;
  2369. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2370. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2371. esac
  2372. ;;
  2373. esac
  2374. elif enabled alpha; then
  2375. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2376. elif enabled bfin; then
  2377. cpuflags="-mcpu=$cpu"
  2378. elif enabled mips; then
  2379. cpuflags="-march=$cpu"
  2380. elif enabled avr32; then
  2381. case $cpu in
  2382. ap7[02]0[0-2])
  2383. subarch="avr32_ap"
  2384. cpuflags="-mpart=$cpu"
  2385. ;;
  2386. ap)
  2387. subarch="avr32_ap"
  2388. cpuflags="-march=$cpu"
  2389. ;;
  2390. uc3[ab]*)
  2391. subarch="avr32_uc"
  2392. cpuflags="-mcpu=$cpu"
  2393. ;;
  2394. uc)
  2395. subarch="avr32_uc"
  2396. cpuflags="-march=$cpu"
  2397. ;;
  2398. esac
  2399. fi
  2400. add_cflags $cpuflags
  2401. add_asflags $cpuflags
  2402. # compiler sanity check
  2403. check_exec <<EOF
  2404. int main(void){ return 0; }
  2405. EOF
  2406. if test "$?" != 0; then
  2407. echo "$cc is unable to create an executable file."
  2408. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2409. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2410. echo "Only do this if you know what cross compiling means."
  2411. fi
  2412. die "C compiler test failed."
  2413. fi
  2414. add_cppflags -D_ISOC99_SOURCE
  2415. check_cflags -std=c99
  2416. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2417. #include <stdlib.h>
  2418. EOF
  2419. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2420. #include <stdlib.h>
  2421. EOF
  2422. check_host_cflags -std=c99
  2423. check_host_cflags -Wall
  2424. case "$arch" in
  2425. alpha|ia64|mips|parisc|sparc)
  2426. spic=$shared
  2427. ;;
  2428. x86)
  2429. subarch="x86_32"
  2430. check_code cc "" "int test[(int)sizeof(char*) - 7]" && subarch="x86_64"
  2431. if test "$subarch" = "x86_64"; then
  2432. spic=$shared
  2433. fi
  2434. ;;
  2435. esac
  2436. enable $subarch
  2437. enabled spic && enable pic
  2438. # OS specific
  2439. case $target_os in
  2440. haiku)
  2441. prefix_default="/boot/common"
  2442. network_extralibs="-lnetwork"
  2443. host_libs=
  2444. ;;
  2445. sunos)
  2446. AVSERVERLDFLAGS=""
  2447. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2448. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2449. network_extralibs="-lsocket -lnsl"
  2450. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2451. # When using suncc to build, the Solaris linker will mark
  2452. # an executable with each instruction set encountered by
  2453. # the Solaris assembler. As our libraries contain their own
  2454. # guards for processor-specific code, instead suppress
  2455. # generation of the HWCAPS ELF section on Solaris x86 only.
  2456. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2457. nm_default='nm -P -g'
  2458. ;;
  2459. netbsd)
  2460. disable symver
  2461. oss_indev_extralibs="-lossaudio"
  2462. oss_outdev_extralibs="-lossaudio"
  2463. ;;
  2464. openbsd|bitrig)
  2465. # On OpenBSD 4.5. the compiler does not use PIC unless
  2466. # explicitly using -fPIC. Libav builds fine without PIC,
  2467. # however the generated executable will not do anything
  2468. # (simply quits with exit-code 1, no crash, no output).
  2469. # Thus explicitly enable PIC here.
  2470. enable pic
  2471. disable symver
  2472. SHFLAGS='-shared'
  2473. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBVERSION)'
  2474. SLIB_INSTALL_LINKS=
  2475. oss_indev_extralibs="-lossaudio"
  2476. oss_outdev_extralibs="-lossaudio"
  2477. ;;
  2478. dragonfly)
  2479. disable symver
  2480. ;;
  2481. freebsd)
  2482. ;;
  2483. bsd/os)
  2484. add_extralibs -lpoll -lgnugetopt
  2485. ;;
  2486. darwin)
  2487. gas="gas-preprocessor.pl $cc"
  2488. enabled ppc && add_asflags -force_cpusubtype_ALL
  2489. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2490. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2491. add_ldflags -Wl,-dynamic,-search_paths_first
  2492. SLIBSUF=".dylib"
  2493. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2494. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2495. AVSERVERLDFLAGS=-Wl,-bind_at_load
  2496. objformat="macho"
  2497. enabled x86_64 && objformat="macho64"
  2498. enabled_any pic shared ||
  2499. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2500. ;;
  2501. mingw32*)
  2502. if test $target_os = "mingw32ce"; then
  2503. disable network
  2504. else
  2505. target_os=mingw32
  2506. fi
  2507. LIBTARGET=i386
  2508. if enabled x86_64; then
  2509. LIBTARGET="i386:x86-64"
  2510. elif enabled arm; then
  2511. LIBTARGET=arm-wince
  2512. fi
  2513. shlibdir_default="$bindir_default"
  2514. SLIBPREF=""
  2515. SLIBSUF=".dll"
  2516. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2517. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2518. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2519. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2520. SLIB_INSTALL_LINKS=
  2521. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2522. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2523. 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'
  2524. objformat="win32"
  2525. dlltool="${cross_prefix}dlltool"
  2526. ranlib=:
  2527. enable dos_paths
  2528. check_cflags -fno-common
  2529. add_cppflags -U__STRICT_ANSI__
  2530. ;;
  2531. cygwin*)
  2532. target_os=cygwin
  2533. shlibdir_default="$bindir_default"
  2534. SLIBPREF="cyg"
  2535. SLIBSUF=".dll"
  2536. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2537. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2538. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2539. SLIB_INSTALL_LINKS=
  2540. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  2541. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  2542. objformat="win32"
  2543. enable dos_paths
  2544. check_cflags -fno-common
  2545. add_cppflags -U__STRICT_ANSI__
  2546. ;;
  2547. *-dos|freedos|opendos)
  2548. network_extralibs="-lsocket"
  2549. objformat="coff"
  2550. enable dos_paths
  2551. add_cppflags -U__STRICT_ANSI__
  2552. ;;
  2553. linux)
  2554. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2555. enable dv1394
  2556. ;;
  2557. irix*)
  2558. target_os=irix
  2559. ranlib="echo ignoring ranlib"
  2560. ;;
  2561. os/2*)
  2562. ln_s="cp -f"
  2563. objformat="aout"
  2564. add_cppflags -D_GNU_SOURCE
  2565. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2566. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2567. AVSERVERLDFLAGS=""
  2568. LIBSUF="_s.a"
  2569. SLIBPREF=""
  2570. SLIBSUF=".dll"
  2571. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2572. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2573. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2574. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2575. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2576. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2577. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2578. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2579. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2580. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2581. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2582. enable dos_paths
  2583. ;;
  2584. gnu/kfreebsd)
  2585. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2586. ;;
  2587. gnu)
  2588. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2589. ;;
  2590. qnx)
  2591. add_cppflags -D_QNX_SOURCE
  2592. network_extralibs="-lsocket"
  2593. ;;
  2594. symbian)
  2595. SLIBSUF=".dll"
  2596. enable dos_paths
  2597. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2598. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2599. add_ldflags -Wl,--target1-abs,--no-undefined \
  2600. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2601. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2602. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2603. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2604. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2605. ;;
  2606. none)
  2607. ;;
  2608. *)
  2609. die "Unknown OS '$target_os'."
  2610. ;;
  2611. esac
  2612. # determine libc flavour
  2613. if check_cpp_condition features.h "defined __UCLIBC__"; then
  2614. libc_type=uclibc
  2615. elif check_cpp_condition features.h "defined __GLIBC__"; then
  2616. libc_type=glibc
  2617. elif check_header _mingw.h; then
  2618. libc_type=mingw
  2619. check_cpp_condition _mingw.h \
  2620. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  2621. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2622. die "ERROR: MinGW runtime version must be >= 3.15."
  2623. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  2624. libc_type=newlib
  2625. elif check_func_headers stdlib.h _get_doserrno; then
  2626. libc_type=msvcrt
  2627. add_cflags -Dstrtod=avpriv_strtod
  2628. add_cflags -Dsnprintf=avpriv_snprintf \
  2629. -D_snprintf=avpriv_snprintf \
  2630. -Dvsnprintf=avpriv_vsnprintf
  2631. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  2632. libc_type=klibc
  2633. fi
  2634. test -n "$libc_type" && enable $libc_type
  2635. esc(){
  2636. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  2637. }
  2638. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  2639. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2640. set_default $PATHS_LIST
  2641. set_default nm
  2642. # we need to build at least one lib type
  2643. if ! enabled_any static shared; then
  2644. cat <<EOF
  2645. At least one library type must be built.
  2646. Specify --enable-static to build the static libraries or --enable-shared to
  2647. build the shared libraries as well. To only build the shared libraries specify
  2648. --disable-static in addition to --enable-shared.
  2649. EOF
  2650. exit 1;
  2651. fi
  2652. die_license_disabled() {
  2653. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2654. }
  2655. die_license_disabled gpl libcdio
  2656. die_license_disabled gpl libx264
  2657. die_license_disabled gpl libxavs
  2658. die_license_disabled gpl libxvid
  2659. die_license_disabled gpl x11grab
  2660. die_license_disabled nonfree libfaac
  2661. die_license_disabled nonfree libfdk_aac
  2662. die_license_disabled nonfree openssl
  2663. die_license_disabled version3 libopencore_amrnb
  2664. die_license_disabled version3 libopencore_amrwb
  2665. die_license_disabled version3 libvo_aacenc
  2666. die_license_disabled version3 libvo_amrwbenc
  2667. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2668. disabled optimizations || check_cflags -fomit-frame-pointer
  2669. enable_pic() {
  2670. enable pic
  2671. add_cppflags -DPIC
  2672. add_cflags -fPIC
  2673. add_asflags -fPIC
  2674. }
  2675. enabled pic && enable_pic
  2676. check_cc <<EOF || die "Symbol mangling check failed."
  2677. int ff_extern;
  2678. EOF
  2679. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2680. extern_prefix=${sym%%ff_extern*}
  2681. check_cc <<EOF && enable_weak inline_asm
  2682. void foo(void) { __asm__ volatile ("" ::); }
  2683. EOF
  2684. _restrict=
  2685. for restrict_keyword in restrict __restrict__ __restrict; do
  2686. check_cc <<EOF && _restrict=$restrict_keyword && break
  2687. void foo(char * $restrict_keyword p);
  2688. EOF
  2689. done
  2690. check_cc <<EOF && enable attribute_packed
  2691. struct { int x; } __attribute__((packed)) x;
  2692. EOF
  2693. check_cc <<EOF && enable attribute_may_alias
  2694. union { int x; } __attribute__((may_alias)) x;
  2695. EOF
  2696. check_cc <<EOF || die "endian test failed"
  2697. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2698. EOF
  2699. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2700. if enabled alpha; then
  2701. check_cflags -mieee
  2702. elif enabled arm; then
  2703. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2704. nogas=die
  2705. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2706. enable vfp_args
  2707. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2708. case "${cross_prefix:-$cc}" in
  2709. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2710. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2711. __asm__ (".eabi_attribute 28, 1");
  2712. int main(void) { return 0; }
  2713. EOF
  2714. esac
  2715. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2716. fi
  2717. enabled armv5te && check_inline_asm armv5te '"qadd r0, r0, r0"'
  2718. enabled armv6 && check_inline_asm armv6 '"sadd16 r0, r0, r0"'
  2719. enabled armv6t2 && check_inline_asm armv6t2 '"movt r0, #0"'
  2720. enabled armvfp && check_inline_asm armvfp '"fadds s0, s0, s0"'
  2721. enabled neon && check_inline_asm neon '"vadd.i16 q0, q0, q0"'
  2722. enabled vfpv3 && check_inline_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2723. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  2724. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2725. enabled_all armv6t2 shared !pic && enable_pic
  2726. elif enabled mips; then
  2727. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  2728. enabled mmi && check_inline_asm mmi '"lq $2, 0($2)"'
  2729. elif enabled ppc; then
  2730. enable local_aligned_8 local_aligned_16
  2731. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2732. check_inline_asm ibm_asm '"add 0, 0, 0"'
  2733. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  2734. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2735. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2736. if enabled altivec; then
  2737. nogas=warn
  2738. check_cflags -maltivec -mabi=altivec &&
  2739. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2740. check_cflags -faltivec
  2741. # check if our compiler supports Motorola AltiVec C API
  2742. check_cc <<EOF || disable altivec
  2743. $inc_altivec_h
  2744. int main(void) {
  2745. vector signed int v1 = (vector signed int) { 0 };
  2746. vector signed int v2 = (vector signed int) { 1 };
  2747. v1 = vec_add(v1, v2);
  2748. return 0;
  2749. }
  2750. EOF
  2751. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  2752. fi
  2753. elif enabled sparc; then
  2754. enabled vis &&
  2755. check_inline_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2756. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2757. elif enabled x86; then
  2758. check_code ld immintrin.h "return __xgetbv(0)" && enable xgetbv
  2759. check_code ld intrin.h "int info[4]; __cpuid(info, 0)" && enable cpuid
  2760. check_code ld intrin.h "__rdtsc()" && enable rdtsc
  2761. check_code ld intrin.h "unsigned int x = __readeflags()" && enable rweflags
  2762. check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
  2763. enable local_aligned_8 local_aligned_16
  2764. # check whether EBP is available on x86
  2765. # As 'i' is stored on the stack, this program will crash
  2766. # if the base pointer is used to access it because the
  2767. # base pointer is cleared in the inline assembly code.
  2768. check_exec_crash <<EOF && enable ebp_available
  2769. volatile int i=0;
  2770. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  2771. return i;
  2772. EOF
  2773. # check whether EBX is available on x86
  2774. check_inline_asm ebx_available '""::"b"(0)' &&
  2775. check_inline_asm ebx_available '"":::"%ebx"'
  2776. # check whether xmm clobbers are supported
  2777. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  2778. # check whether binutils is new enough to compile SSSE3/MMXEXT
  2779. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  2780. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  2781. if ! disabled_any asm mmx yasm; then
  2782. if check_cmd $yasmexe --version; then
  2783. enabled x86_64 && yasm_extra="-m amd64"
  2784. yasm_debug="-g dwarf2"
  2785. elif check_cmd nasm -v; then
  2786. yasmexe=nasm
  2787. yasm_debug="-g -F dwarf"
  2788. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2789. fi
  2790. YASMFLAGS="-f $objformat $yasm_extra"
  2791. enabled pic && append YASMFLAGS "-DPIC"
  2792. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2793. case "$objformat" in
  2794. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2795. esac
  2796. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2797. die "yasm not found, use --disable-yasm for a crippled build"
  2798. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external
  2799. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  2800. check_yasm "CPU amdnop" && enable cpunop
  2801. fi
  2802. case "$cpu" in
  2803. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2804. disable fast_clz
  2805. ;;
  2806. esac
  2807. fi
  2808. if enabled asm; then
  2809. as=${gas:=$as}
  2810. check_inline_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2811. $nogas "GNU assembler not found, install gas-preprocessor"
  2812. fi
  2813. check_ldflags -Wl,--as-needed
  2814. if check_func dlopen; then
  2815. ldl=
  2816. elif check_func dlopen -ldl; then
  2817. ldl=-ldl
  2818. fi
  2819. if enabled network; then
  2820. check_type "sys/types.h sys/socket.h" socklen_t
  2821. check_type netdb.h "struct addrinfo"
  2822. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  2823. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  2824. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2825. check_type netinet/in.h "struct sockaddr_in6"
  2826. check_type poll.h "struct pollfd"
  2827. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2828. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2829. check_type netinet/sctp.h "struct sctp_event_subscribe"
  2830. check_func getaddrinfo $network_extralibs
  2831. # Prefer arpa/inet.h over winsock2
  2832. if check_header arpa/inet.h ; then
  2833. check_func closesocket
  2834. elif check_header winsock2.h ; then
  2835. check_func_headers winsock2.h closesocket -lws2 &&
  2836. network_extralibs="-lws2" ||
  2837. { check_func_headers winsock2.h closesocket -lws2_32 &&
  2838. network_extralibs="-lws2_32"; }
  2839. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  2840. check_type ws2tcpip.h socklen_t
  2841. check_type ws2tcpip.h "struct addrinfo"
  2842. check_type ws2tcpip.h "struct group_source_req"
  2843. check_type ws2tcpip.h "struct ip_mreq_source"
  2844. check_type ws2tcpip.h "struct ipv6_mreq"
  2845. check_type winsock2.h "struct pollfd"
  2846. check_type ws2tcpip.h "struct sockaddr_in6"
  2847. check_type ws2tcpip.h "struct sockaddr_storage"
  2848. check_struct winsock2.h "struct sockaddr" sa_len
  2849. else
  2850. disable network
  2851. fi
  2852. fi
  2853. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2854. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2855. check_func fcntl
  2856. check_func fork
  2857. check_func gethrtime
  2858. check_func getopt
  2859. check_func getrusage
  2860. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2861. check_func gettimeofday
  2862. check_func inet_aton $network_extralibs
  2863. check_func isatty
  2864. check_func localtime_r
  2865. check_func ${malloc_prefix}memalign && enable memalign
  2866. check_func mkstemp
  2867. check_func mmap
  2868. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2869. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  2870. check_func setrlimit
  2871. check_func strerror_r
  2872. check_func strptime
  2873. check_func strtok_r
  2874. check_func sched_getaffinity
  2875. check_func sysconf
  2876. check_func sysctl
  2877. check_func usleep
  2878. check_func_headers io.h setmode
  2879. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  2880. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2881. check_func_headers windows.h GetProcessAffinityMask
  2882. check_func_headers windows.h GetProcessTimes
  2883. check_func_headers windows.h GetSystemTimeAsFileTime
  2884. check_func_headers windows.h MapViewOfFile
  2885. check_func_headers windows.h Sleep
  2886. check_func_headers windows.h VirtualAlloc
  2887. check_header direct.h
  2888. check_header dlfcn.h
  2889. check_header dxva.h
  2890. check_header dxva2api.h
  2891. check_header io.h
  2892. check_header malloc.h
  2893. check_header poll.h
  2894. check_header sys/mman.h
  2895. check_header sys/param.h
  2896. check_header sys/resource.h
  2897. check_header sys/select.h
  2898. check_header sys/time.h
  2899. check_header unistd.h
  2900. check_header vdpau/vdpau.h
  2901. check_header vdpau/vdpau_x11.h
  2902. check_header windows.h
  2903. check_header X11/extensions/XvMClib.h
  2904. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2905. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2906. if ! disabled w32threads && ! enabled pthreads; then
  2907. check_func _beginthreadex && enable w32threads
  2908. fi
  2909. # check for some common methods of building with pthread support
  2910. # do this before the optional library checks as some of them require pthreads
  2911. if ! disabled pthreads && ! enabled w32threads; then
  2912. enable pthreads
  2913. if check_func pthread_create; then
  2914. :
  2915. elif check_func pthread_create -pthread; then
  2916. add_cflags -pthread
  2917. add_extralibs -pthread
  2918. elif check_func pthread_create -pthreads; then
  2919. add_cflags -pthreads
  2920. add_extralibs -pthreads
  2921. elif check_func pthread_create -lpthreadGC2; then
  2922. add_extralibs -lpthreadGC2
  2923. elif ! check_lib pthread.h pthread_create -lpthread; then
  2924. disable pthreads
  2925. fi
  2926. fi
  2927. for thread in $THREADS_LIST; do
  2928. if enabled $thread; then
  2929. test -n "$thread_type" &&
  2930. die "ERROR: Only one thread type must be selected." ||
  2931. thread_type="$thread"
  2932. fi
  2933. done
  2934. check_lib math.h sin -lm && LIBM="-lm"
  2935. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2936. check_mathfunc cbrtf
  2937. check_mathfunc exp2
  2938. check_mathfunc exp2f
  2939. check_mathfunc isinf
  2940. check_mathfunc isnan
  2941. check_mathfunc llrint
  2942. check_mathfunc llrintf
  2943. check_mathfunc log2
  2944. check_mathfunc log2f
  2945. check_mathfunc lrint
  2946. check_mathfunc lrintf
  2947. check_mathfunc rint
  2948. check_mathfunc round
  2949. check_mathfunc roundf
  2950. check_mathfunc trunc
  2951. check_mathfunc truncf
  2952. # these are off by default, so fail if requested and not available
  2953. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2954. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2955. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  2956. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2957. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  2958. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2959. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2960. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  2961. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2962. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2963. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2964. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  2965. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2966. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  2967. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2968. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2969. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2970. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2971. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2972. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2973. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2974. enabled libvpx && {
  2975. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2976. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2977. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2978. die "ERROR: libvpx encoder version must be >=0.9.1"; } }
  2979. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2980. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  2981. die "ERROR: libx264 version must be >= 0.118."; }
  2982. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2983. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2984. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  2985. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  2986. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  2987. die "ERROR: openssl not found"; }
  2988. if enabled gnutls; then
  2989. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  2990. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  2991. fi
  2992. # libdc1394 check
  2993. if enabled libdc1394; then
  2994. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2995. enable libdc1394_2; } ||
  2996. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2997. enable libdc1394_1; } ||
  2998. die "ERROR: No version of libdc1394 found "
  2999. fi
  3000. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3001. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3002. enable sdl &&
  3003. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  3004. fi
  3005. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3006. check_header linux/fb.h
  3007. check_header linux/videodev2.h
  3008. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3009. check_header sys/videoio.h
  3010. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3011. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3012. # w32api 3.12 had it defined wrong
  3013. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3014. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3015. { check_header dev/bktr/ioctl_meteor.h &&
  3016. check_header dev/bktr/ioctl_bt848.h; } ||
  3017. { check_header machine/ioctl_meteor.h &&
  3018. check_header machine/ioctl_bt848.h; } ||
  3019. { check_header dev/video/meteor/ioctl_meteor.h &&
  3020. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3021. check_header dev/ic/bt8xx.h
  3022. check_header sndio.h
  3023. check_header sys/soundcard.h
  3024. check_header soundcard.h
  3025. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3026. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3027. check_func jack_port_get_latency_range -ljack
  3028. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3029. enabled libcdio &&
  3030. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  3031. enabled x11grab &&
  3032. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3033. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3034. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3035. # check for VDA header
  3036. if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
  3037. enable vda && add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
  3038. fi
  3039. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  3040. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3041. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && disable vdpau; }
  3042. fi
  3043. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3044. # add some useful compiler flags if supported
  3045. check_cflags -Wdeclaration-after-statement
  3046. check_cflags -Wall
  3047. check_cflags -Wno-parentheses
  3048. check_cflags -Wno-switch
  3049. check_cflags -Wno-format-zero-length
  3050. check_cflags -Wdisabled-optimization
  3051. check_cflags -Wpointer-arith
  3052. check_cflags -Wredundant-decls
  3053. check_cflags -Wno-pointer-sign
  3054. check_cflags -Wcast-qual
  3055. check_cflags -Wwrite-strings
  3056. check_cflags -Wtype-limits
  3057. check_cflags -Wundef
  3058. check_cflags -Wmissing-prototypes
  3059. check_cflags -Wstrict-prototypes
  3060. enabled extra_warnings && check_cflags -Winline
  3061. # add some linker flags
  3062. check_ldflags -Wl,--warn-common
  3063. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3064. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3065. enabled xmm_clobber_test &&
  3066. check_ldflags -Wl,--wrap,avcodec_open2 \
  3067. -Wl,--wrap,avcodec_decode_audio4 \
  3068. -Wl,--wrap,avcodec_decode_video2 \
  3069. -Wl,--wrap,avcodec_decode_subtitle2 \
  3070. -Wl,--wrap,avcodec_encode_audio2 \
  3071. -Wl,--wrap,avcodec_encode_video \
  3072. -Wl,--wrap,avcodec_encode_subtitle \
  3073. -Wl,--wrap,sws_scale ||
  3074. disable xmm_clobber_test
  3075. echo "X{};" > $TMPV
  3076. if test_ldflags -Wl,--version-script,$TMPV; then
  3077. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3078. check_cc <<EOF && enable symver_asm_label
  3079. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3080. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3081. EOF
  3082. check_cc <<EOF && enable symver_gnu_asm
  3083. __asm__(".symver ff_foo,av_foo@VERSION");
  3084. void ff_foo(void) {}
  3085. EOF
  3086. fi
  3087. if [ -n "$optflags" ]; then
  3088. add_cflags $optflags
  3089. elif enabled small; then
  3090. add_cflags $cflags_size
  3091. elif enabled optimizations; then
  3092. add_cflags $cflags_speed
  3093. else
  3094. add_cflags $cflags_noopt
  3095. fi
  3096. check_cflags -fno-math-errno
  3097. check_cflags -fno-signed-zeros
  3098. if enabled icc; then
  3099. # Just warnings, no remarks
  3100. check_cflags -w1
  3101. # -wd: Disable following warnings
  3102. # 144, 167, 556: -Wno-pointer-sign
  3103. # 1292: attribute "foo" ignored
  3104. # 1419: external declaration in primary source file
  3105. # 10006: ignoring unknown option -fno-signed-zeros
  3106. # 10148: ignoring unknown option -Wno-parentheses
  3107. # 10156: ignoring option '-W'; no argument required
  3108. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3109. # 11030: Warning unknown option --as-needed
  3110. # 10156: ignoring option '-export'; no argument required
  3111. check_ldflags -wd10156,11030
  3112. # Allow to compile with optimizations
  3113. check_ldflags -march=$cpu
  3114. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3115. enable ebp_available
  3116. if enabled x86_32; then
  3117. icc_version=$($cc -dumpversion)
  3118. test ${icc_version%%.*} -ge 11 &&
  3119. check_cflags -falign-stack=maintain-16-byte ||
  3120. disable aligned_stack
  3121. fi
  3122. elif enabled ccc; then
  3123. # disable some annoying warnings
  3124. add_cflags -msg_disable cvtu32to64
  3125. add_cflags -msg_disable embedcomment
  3126. add_cflags -msg_disable needconstext
  3127. add_cflags -msg_disable nomainieee
  3128. add_cflags -msg_disable ptrmismatch1
  3129. add_cflags -msg_disable unreachcode
  3130. elif enabled gcc; then
  3131. check_cflags -fno-tree-vectorize
  3132. check_cflags -Werror=implicit-function-declaration
  3133. check_cflags -Werror=missing-prototypes
  3134. check_cflags -Werror=declaration-after-statement
  3135. elif enabled llvm_gcc; then
  3136. check_cflags -mllvm -stack-alignment=16
  3137. elif enabled clang; then
  3138. check_cflags -mllvm -stack-alignment=16
  3139. check_cflags -Qunused-arguments
  3140. elif enabled armcc; then
  3141. # 2523: use of inline assembler is deprecated
  3142. add_cflags -W${armcc_opt},--diag_suppress=2523
  3143. add_cflags -W${armcc_opt},--diag_suppress=1207
  3144. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3145. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3146. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3147. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3148. elif enabled tms470; then
  3149. add_cflags -pds=824 -pds=837
  3150. elif enabled pathscale; then
  3151. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3152. elif enabled msvc; then
  3153. enabled x86_32 && disable aligned_stack
  3154. fi
  3155. enabled_any $THREADS_LIST && enable threads
  3156. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3157. check_deps $CONFIG_LIST \
  3158. $CONFIG_EXTRA \
  3159. $HAVE_LIST \
  3160. $ALL_COMPONENTS \
  3161. $ALL_TESTS \
  3162. ! enabled_any memalign posix_memalign aligned_malloc &&
  3163. enabled_any $need_memalign && enable memalign_hack
  3164. echo "install prefix $prefix"
  3165. echo "source path $source_path"
  3166. echo "C compiler $cc"
  3167. echo "ARCH $arch ($cpu)"
  3168. if test "$build_suffix" != ""; then
  3169. echo "build suffix $build_suffix"
  3170. fi
  3171. if test "$extra_version" != ""; then
  3172. echo "version string suffix $extra_version"
  3173. fi
  3174. echo "big-endian ${bigendian-no}"
  3175. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3176. if enabled x86; then
  3177. echo "${yasmexe} ${yasm-no}"
  3178. echo "MMX enabled ${mmx-no}"
  3179. echo "MMXEXT enabled ${mmxext-no}"
  3180. echo "3DNow! enabled ${amd3dnow-no}"
  3181. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3182. echo "SSE enabled ${sse-no}"
  3183. echo "SSSE3 enabled ${ssse3-no}"
  3184. echo "AVX enabled ${avx-no}"
  3185. echo "FMA4 enabled ${fma4-no}"
  3186. echo "CMOV enabled ${cmov-no}"
  3187. echo "CMOV is fast ${fast_cmov-no}"
  3188. echo "EBX available ${ebx_available-no}"
  3189. echo "EBP available ${ebp_available-no}"
  3190. fi
  3191. if enabled arm; then
  3192. echo "ARMv5TE enabled ${armv5te-no}"
  3193. echo "ARMv6 enabled ${armv6-no}"
  3194. echo "ARMv6T2 enabled ${armv6t2-no}"
  3195. echo "ARM VFP enabled ${armvfp-no}"
  3196. echo "NEON enabled ${neon-no}"
  3197. fi
  3198. if enabled mips; then
  3199. echo "MMI enabled ${mmi-no}"
  3200. fi
  3201. if enabled ppc; then
  3202. echo "AltiVec enabled ${altivec-no}"
  3203. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3204. echo "dcbzl available ${dcbzl-no}"
  3205. fi
  3206. if enabled sparc; then
  3207. echo "VIS enabled ${vis-no}"
  3208. fi
  3209. echo "debug symbols ${debug-no}"
  3210. echo "optimize for size ${small-no}"
  3211. echo "optimizations ${optimizations-no}"
  3212. echo "static ${static-no}"
  3213. echo "shared ${shared-no}"
  3214. echo "new filter support ${avfilter-no}"
  3215. echo "network support ${network-no}"
  3216. echo "threading support ${thread_type-no}"
  3217. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3218. echo "SDL support ${sdl-no}"
  3219. echo "libdxva2 enabled ${dxva2-no}"
  3220. echo "libva enabled ${vaapi-no}"
  3221. echo "libvdpau enabled ${vdpau-no}"
  3222. echo "AVISynth enabled ${avisynth-no}"
  3223. echo "frei0r enabled ${frei0r-no}"
  3224. echo "gnutls enabled ${gnutls-no}"
  3225. echo "libcdio support ${libcdio-no}"
  3226. echo "libdc1394 support ${libdc1394-no}"
  3227. echo "libfaac enabled ${libfaac-no}"
  3228. echo "libfdk-aac enabled ${libfdk_aac-no}"
  3229. echo "libgsm enabled ${libgsm-no}"
  3230. echo "libilbc enabled ${libilbc-no}"
  3231. echo "libmp3lame enabled ${libmp3lame-no}"
  3232. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3233. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3234. echo "libopencv support ${libopencv-no}"
  3235. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3236. echo "libpulse enabled ${libpulse-no}"
  3237. echo "librtmp enabled ${librtmp-no}"
  3238. echo "libschroedinger enabled ${libschroedinger-no}"
  3239. echo "libspeex enabled ${libspeex-no}"
  3240. echo "libtheora enabled ${libtheora-no}"
  3241. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3242. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3243. echo "libvorbis enabled ${libvorbis-no}"
  3244. echo "libvpx enabled ${libvpx-no}"
  3245. echo "libx264 enabled ${libx264-no}"
  3246. echo "libxavs enabled ${libxavs-no}"
  3247. echo "libxvid enabled ${libxvid-no}"
  3248. echo "openssl enabled ${openssl-no}"
  3249. echo "zlib enabled ${zlib-no}"
  3250. echo "bzlib enabled ${bzlib-no}"
  3251. test -n "$random_seed" &&
  3252. echo "random seed ${random_seed}"
  3253. echo
  3254. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3255. echo "Enabled ${type}s:"
  3256. eval list=\$$(toupper $type)_LIST
  3257. print_enabled '_*' $list | sort | pr -r -3 -t
  3258. echo
  3259. done
  3260. license="LGPL version 2.1 or later"
  3261. if enabled nonfree; then
  3262. license="nonfree and unredistributable"
  3263. elif enabled gplv3; then
  3264. license="GPL version 3 or later"
  3265. elif enabled lgplv3; then
  3266. license="LGPL version 3 or later"
  3267. elif enabled gpl; then
  3268. license="GPL version 2 or later"
  3269. fi
  3270. echo "License: $license"
  3271. echo "Creating config.mak and config.h..."
  3272. test -e Makefile || $ln_s "$source_path/Makefile" .
  3273. config_files="$TMPH config.mak"
  3274. cat > config.mak <<EOF
  3275. # Automatically generated by configure - do not modify!
  3276. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  3277. prefix=$prefix
  3278. LIBDIR=\$(DESTDIR)$libdir
  3279. SHLIBDIR=\$(DESTDIR)$shlibdir
  3280. INCDIR=\$(DESTDIR)$incdir
  3281. BINDIR=\$(DESTDIR)$bindir
  3282. DATADIR=\$(DESTDIR)$datadir
  3283. MANDIR=\$(DESTDIR)$mandir
  3284. SRC_PATH=$source_path
  3285. CC_IDENT=$cc_ident
  3286. ARCH=$arch
  3287. CC=$cc
  3288. AS=$as
  3289. LD=$ld
  3290. DEPCC=$dep_cc
  3291. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  3292. DEPAS=$as
  3293. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  3294. YASM=$yasmexe
  3295. DEPYASM=$yasmexe
  3296. AR=$ar
  3297. ARFLAGS=$arflags
  3298. AR_O=$ar_o
  3299. RANLIB=$ranlib
  3300. LN_S=$ln_s
  3301. CPPFLAGS=$CPPFLAGS
  3302. CFLAGS=$CFLAGS
  3303. ASFLAGS=$ASFLAGS
  3304. AS_C=$AS_C
  3305. AS_O=$AS_O
  3306. CC_C=$CC_C
  3307. CC_O=$CC_O
  3308. LD_O=$LD_O
  3309. LD_LIB=$LD_LIB
  3310. LD_PATH=$LD_PATH
  3311. DLLTOOL=$dlltool
  3312. LDFLAGS=$LDFLAGS
  3313. LDFLAGS-avserver=$AVSERVERLDFLAGS
  3314. SHFLAGS=$SHFLAGS
  3315. YASMFLAGS=$YASMFLAGS
  3316. BUILDSUF=$build_suffix
  3317. FULLNAME=$FULLNAME
  3318. LIBPREF=$LIBPREF
  3319. LIBSUF=$LIBSUF
  3320. LIBNAME=$LIBNAME
  3321. SLIBPREF=$SLIBPREF
  3322. SLIBSUF=$SLIBSUF
  3323. EXESUF=$EXESUF
  3324. EXTRA_VERSION=$extra_version
  3325. CCDEP=$CCDEP
  3326. CCDEP_FLAGS=$CCDEP_FLAGS
  3327. ASDEP=$ASDEP
  3328. ASDEP_FLAGS=$ASDEP_FLAGS
  3329. CC_DEPFLAGS=$CC_DEPFLAGS
  3330. AS_DEPFLAGS=$AS_DEPFLAGS
  3331. HOSTCC=$host_cc
  3332. HOSTLD=$host_ld
  3333. HOSTCFLAGS=$host_cflags
  3334. HOSTEXESUF=$HOSTEXESUF
  3335. HOSTLDFLAGS=$host_ldflags
  3336. HOSTLIBS=$host_libs
  3337. DEPHOSTCC=$host_cc
  3338. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  3339. HOSTCCDEP=$HOSTCCDEP
  3340. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  3341. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  3342. HOSTCC_C=$HOSTCC_C
  3343. HOSTCC_O=$HOSTCC_O
  3344. HOSTLD_O=$HOSTLD_O
  3345. TARGET_EXEC=$target_exec
  3346. TARGET_PATH=$target_path
  3347. LIBS-avplay=$sdl_libs
  3348. CFLAGS-avplay=$sdl_cflags
  3349. ZLIB=$($ldflags_filter -lz)
  3350. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3351. EXTRALIBS=$extralibs
  3352. INSTALL=install
  3353. LIBTARGET=${LIBTARGET}
  3354. SLIBNAME=${SLIBNAME}
  3355. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3356. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3357. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3358. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3359. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3360. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3361. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3362. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3363. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  3364. EOF
  3365. get_version(){
  3366. lcname=$1
  3367. name=$(toupper $lcname)
  3368. file=$source_path/$lcname/version.h
  3369. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3370. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3371. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3372. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3373. }
  3374. get_version libavcodec
  3375. get_version libavdevice
  3376. get_version libavfilter
  3377. get_version libavformat
  3378. get_version libavresample
  3379. get_version libavutil
  3380. get_version libswscale
  3381. cat > $TMPH <<EOF
  3382. /* Automatically generated by configure - do not modify! */
  3383. #ifndef LIBAV_CONFIG_H
  3384. #define LIBAV_CONFIG_H
  3385. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  3386. #define LIBAV_LICENSE "$(c_escape $license)"
  3387. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3388. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  3389. #define restrict $_restrict
  3390. #define EXTERN_PREFIX "${extern_prefix}"
  3391. #define EXTERN_ASM ${extern_prefix}
  3392. #define SLIBSUF "$SLIBSUF"
  3393. EOF
  3394. test -n "$malloc_prefix" &&
  3395. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3396. if enabled yasm; then
  3397. append config_files $TMPASM
  3398. printf '' >$TMPASM
  3399. fi
  3400. print_config ARCH_ "$config_files" $ARCH_LIST
  3401. print_config HAVE_ "$config_files" $HAVE_LIST
  3402. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3403. $CONFIG_EXTRA \
  3404. $ALL_COMPONENTS \
  3405. cat >>config.mak <<EOF
  3406. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3407. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3408. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3409. EOF
  3410. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3411. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3412. cp_if_changed $TMPH config.h
  3413. touch .config
  3414. enabled yasm && cp_if_changed $TMPASM config.asm
  3415. cat > $TMPH <<EOF
  3416. /* Generated by ffconf */
  3417. #ifndef AVUTIL_AVCONFIG_H
  3418. #define AVUTIL_AVCONFIG_H
  3419. EOF
  3420. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3421. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3422. cp_if_changed $TMPH libavutil/avconfig.h
  3423. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3424. # build pkg-config files
  3425. pkgconfig_generate(){
  3426. name=$1
  3427. shortname=${name#lib}${build_suffix}
  3428. comment=$2
  3429. version=$3
  3430. libs=$4
  3431. requires=$5
  3432. enabled ${name#lib} || return 0
  3433. mkdir -p $name
  3434. cat <<EOF > $name/$name.pc
  3435. prefix=$prefix
  3436. exec_prefix=\${prefix}
  3437. libdir=$libdir
  3438. includedir=$incdir
  3439. Name: $name
  3440. Description: $comment
  3441. Version: $version
  3442. Requires: $(enabled shared || echo $requires)
  3443. Requires.private: $(enabled shared && echo $requires)
  3444. Conflicts:
  3445. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3446. Libs.private: $(enabled shared && echo $libs)
  3447. Cflags: -I\${includedir}
  3448. EOF
  3449. cat <<EOF > $name/$name-uninstalled.pc
  3450. prefix=
  3451. exec_prefix=
  3452. libdir=\${pcfiledir}
  3453. includedir=${source_path}
  3454. Name: $name
  3455. Description: $comment
  3456. Version: $version
  3457. Requires: $requires
  3458. Conflicts:
  3459. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3460. Cflags: -I\${includedir}
  3461. EOF
  3462. }
  3463. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3464. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3465. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3466. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3467. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3468. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
  3469. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"