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.

4298 lines
126KB

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