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.

4275 lines
126KB

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