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.

4236 lines
125KB

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