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.

4306 lines
127KB

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