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.

4105 lines
120KB

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