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.

3458 lines
103KB

  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. show_help(){
  51. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Standard options:
  55. --help print this message
  56. --logfile=FILE log tests and output to FILE [config.log]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-avconv disable avconv build
  76. --disable-avplay disable avplay build
  77. --disable-avprobe disable avprobe build
  78. --disable-avserver disable avserver build
  79. --disable-avdevice disable libavdevice build
  80. --disable-avcodec disable libavcodec build
  81. --disable-avformat disable libavformat build
  82. --disable-swscale disable libswscale build
  83. --disable-postproc disable libpostproc build
  84. --disable-avfilter disable video filter support [no]
  85. --disable-pthreads disable pthreads [auto]
  86. --disable-w32threads disable Win32 threads [auto]
  87. --enable-x11grab enable X11 grabbing [no]
  88. --disable-network disable network support [no]
  89. --enable-gray enable full grayscale support (slower color)
  90. --disable-swscale-alpha disable alpha channel support in swscale
  91. --disable-fastdiv disable table-based division
  92. --enable-small optimize for size instead of speed
  93. --disable-aandct disable AAN DCT code
  94. --disable-dct disable DCT code
  95. --disable-fft disable FFT code
  96. --disable-golomb disable Golomb code
  97. --disable-huffman disable Huffman code
  98. --disable-lpc disable LPC code
  99. --disable-mdct disable MDCT code
  100. --disable-rdft disable RDFT code
  101. --enable-vaapi enable VAAPI code
  102. --enable-vdpau enable VDPAU code
  103. --disable-dxva2 disable DXVA2 code
  104. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  105. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  106. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  107. --disable-everything disable all components listed below
  108. --disable-encoder=NAME disable encoder NAME
  109. --enable-encoder=NAME enable encoder NAME
  110. --disable-encoders disable all encoders
  111. --disable-decoder=NAME disable decoder NAME
  112. --enable-decoder=NAME enable decoder NAME
  113. --disable-decoders disable all decoders
  114. --disable-hwaccel=NAME disable hwaccel NAME
  115. --enable-hwaccel=NAME enable hwaccel NAME
  116. --disable-hwaccels disable all hwaccels
  117. --disable-muxer=NAME disable muxer NAME
  118. --enable-muxer=NAME enable muxer NAME
  119. --disable-muxers disable all muxers
  120. --disable-demuxer=NAME disable demuxer NAME
  121. --enable-demuxer=NAME enable demuxer NAME
  122. --disable-demuxers disable all demuxers
  123. --enable-parser=NAME enable parser NAME
  124. --disable-parser=NAME disable parser NAME
  125. --disable-parsers disable all parsers
  126. --enable-bsf=NAME enable bitstream filter NAME
  127. --disable-bsf=NAME disable bitstream filter NAME
  128. --disable-bsfs disable all bitstream filters
  129. --enable-protocol=NAME enable protocol NAME
  130. --disable-protocol=NAME disable protocol NAME
  131. --disable-protocols disable all protocols
  132. --disable-indev=NAME disable input device NAME
  133. --disable-outdev=NAME disable output device NAME
  134. --disable-indevs disable input devices
  135. --disable-outdevs disable output devices
  136. --disable-devices disable all devices
  137. --enable-filter=NAME enable filter NAME
  138. --disable-filter=NAME disable filter NAME
  139. --disable-filters disable all filters
  140. --list-decoders show all available decoders
  141. --list-encoders show all available encoders
  142. --list-hwaccels show all available hardware accelerators
  143. --list-muxers show all available muxers
  144. --list-demuxers show all available demuxers
  145. --list-parsers show all available parsers
  146. --list-protocols show all available protocols
  147. --list-bsfs show all available bitstream filters
  148. --list-indevs show all available input devices
  149. --list-outdevs show all available output devices
  150. --list-filters show all available filters
  151. External library support:
  152. --enable-avisynth enable reading of AVISynth script files [no]
  153. --enable-bzlib enable bzlib [autodetect]
  154. --enable-frei0r enable frei0r video filtering
  155. --enable-gnutls enable gnutls [no]
  156. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  157. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  158. --enable-libopencv enable video filtering via libopencv [no]
  159. --enable-libcdio enable audio CD grabbing with libcdio
  160. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  161. and libraw1394 [no]
  162. --enable-libdirac enable Dirac support via libdirac [no]
  163. --enable-libfaac enable FAAC support via libfaac [no]
  164. --enable-libfreetype enable libfreetype [no]
  165. --enable-libgsm enable GSM support via libgsm [no]
  166. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  167. --enable-libnut enable NUT (de)muxing via libnut,
  168. native (de)muxer exists [no]
  169. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  170. --enable-librtmp enable RTMP[E] support via librtmp [no]
  171. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  172. --enable-libspeex enable Speex support via libspeex [no]
  173. --enable-libtheora enable Theora encoding via libtheora [no]
  174. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  175. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  176. --enable-libvorbis enable Vorbis encoding via libvorbis,
  177. native implementation exists [no]
  178. --enable-libvpx enable VP8 support via libvpx [no]
  179. --enable-libx264 enable H.264 encoding via x264 [no]
  180. --enable-libxavs enable AVS encoding via xavs [no]
  181. --enable-libxvid enable Xvid encoding via xvidcore,
  182. native MPEG-4/Xvid encoder exists [no]
  183. --enable-mlib enable Sun medialib [no]
  184. --enable-openssl enable openssl [no]
  185. --enable-zlib enable zlib [autodetect]
  186. Advanced options (experts only):
  187. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  188. --enable-cross-compile assume a cross-compiler is used
  189. --sysroot=PATH root of cross-build tree
  190. --sysinclude=PATH location of cross-build system headers
  191. --target-os=OS compiler targets OS [$target_os]
  192. --target-exec=CMD command to run executables on target
  193. --target-path=DIR path to view of build directory on target
  194. --nm=NM use nm tool
  195. --ar=AR use archive tool AR [$ar_default]
  196. --as=AS use assembler AS [$as_default]
  197. --cc=CC use C compiler CC [$cc_default]
  198. --ld=LD use linker LD
  199. --host-cc=HOSTCC use host C compiler HOSTCC
  200. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  201. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  202. --host-libs=HLIBS use libs HLIBS when linking for host
  203. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  204. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  205. --extra-libs=ELIBS add ELIBS [$ELIBS]
  206. --extra-version=STRING version string suffix []
  207. --build-suffix=SUFFIX library name suffix []
  208. --arch=ARCH select architecture [$arch]
  209. --cpu=CPU select the minimum required CPU (affects
  210. instruction selection, may crash on older CPUs)
  211. --disable-asm disable all assembler optimizations
  212. --disable-altivec disable AltiVec optimizations
  213. --disable-amd3dnow disable 3DNow! optimizations
  214. --disable-amd3dnowext disable 3DNow! extended optimizations
  215. --disable-mmx disable MMX optimizations
  216. --disable-mmx2 disable MMX2 optimizations
  217. --disable-sse disable SSE optimizations
  218. --disable-ssse3 disable SSSE3 optimizations
  219. --disable-avx disable AVX optimizations
  220. --disable-armv5te disable armv5te optimizations
  221. --disable-armv6 disable armv6 optimizations
  222. --disable-armv6t2 disable armv6t2 optimizations
  223. --disable-armvfp disable ARM VFP optimizations
  224. --disable-iwmmxt disable iwmmxt optimizations
  225. --disable-mmi disable MMI optimizations
  226. --disable-neon disable neon optimizations
  227. --disable-vis disable VIS optimizations
  228. --disable-yasm disable use of yasm assembler
  229. --enable-pic build position-independent code
  230. --malloc-prefix=PFX prefix malloc and related names with PFX
  231. --enable-sram allow use of on-chip SRAM
  232. --disable-symver disable symbol versioning
  233. --optflags override optimization-related compiler flags
  234. Developer options (useful when working on Libav itself):
  235. --disable-debug disable debugging symbols
  236. --enable-debug=LEVEL set the debug level [$debuglevel]
  237. --disable-optimizations disable compiler optimizations
  238. --enable-extra-warnings enable more compiler warnings
  239. --samples=PATH location of test samples for FATE, if not set use
  240. \$FATE_SAMPLES at make invocation time.
  241. NOTE: Object files are built at the place where configure is launched.
  242. EOF
  243. exit 0
  244. }
  245. quotes='""'
  246. log(){
  247. echo "$@" >> $logfile
  248. }
  249. log_file(){
  250. log BEGIN $1
  251. pr -n -t $1 >> $logfile
  252. log END $1
  253. }
  254. echolog(){
  255. log "$@"
  256. echo "$@"
  257. }
  258. warn(){
  259. log "WARNING: $*"
  260. WARNINGS="${WARNINGS}WARNING: $*\n"
  261. }
  262. die(){
  263. echolog "$@"
  264. cat <<EOF
  265. If you think configure made a mistake, make sure you are using the latest
  266. version from Git. If the latest version fails, report the problem to the
  267. libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
  268. EOF
  269. if disabled logging; then
  270. cat <<EOF
  271. Rerun configure with logging enabled (do not use --disable-logging), and
  272. include the log this produces with your report.
  273. EOF
  274. else
  275. cat <<EOF
  276. Include the log file "$logfile" produced by configure as this will help
  277. solving the problem.
  278. EOF
  279. fi
  280. exit 1
  281. }
  282. # Avoid locale weirdness, besides we really just want to translate ASCII.
  283. toupper(){
  284. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  285. }
  286. tolower(){
  287. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  288. }
  289. c_escape(){
  290. echo "$*" | sed 's/["\\]/\\\0/g'
  291. }
  292. sh_quote(){
  293. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  294. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  295. echo "$v"
  296. }
  297. cleanws(){
  298. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  299. }
  300. filter(){
  301. pat=$1
  302. shift
  303. for v; do
  304. eval "case $v in $pat) echo $v ;; esac"
  305. done
  306. }
  307. filter_out(){
  308. pat=$1
  309. shift
  310. for v; do
  311. eval "case $v in $pat) ;; *) echo $v ;; esac"
  312. done
  313. }
  314. map(){
  315. m=$1
  316. shift
  317. for v; do eval $m; done
  318. }
  319. set_all(){
  320. value=$1
  321. shift
  322. for var in $*; do
  323. eval $var=$value
  324. done
  325. }
  326. set_weak(){
  327. value=$1
  328. shift
  329. for var; do
  330. eval : \${$var:=$value}
  331. done
  332. }
  333. set_safe(){
  334. var=$1
  335. shift
  336. eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
  337. }
  338. get_safe(){
  339. eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
  340. }
  341. pushvar(){
  342. for var in $*; do
  343. eval level=\${${var}_level:=0}
  344. eval ${var}_${level}="\$$var"
  345. eval ${var}_level=$(($level+1))
  346. done
  347. }
  348. popvar(){
  349. for var in $*; do
  350. eval level=\${${var}_level:-0}
  351. test $level = 0 && continue
  352. eval level=$(($level-1))
  353. eval $var="\${${var}_${level}}"
  354. eval ${var}_level=$level
  355. eval unset ${var}_${level}
  356. done
  357. }
  358. enable(){
  359. set_all yes $*
  360. }
  361. disable(){
  362. set_all no $*
  363. }
  364. enable_weak(){
  365. set_weak yes $*
  366. }
  367. disable_weak(){
  368. set_weak no $*
  369. }
  370. enable_safe(){
  371. for var; do
  372. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  373. done
  374. }
  375. disable_safe(){
  376. for var; do
  377. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  378. done
  379. }
  380. do_enable_deep(){
  381. for var; do
  382. enabled $var && continue
  383. eval sel="\$${var}_select"
  384. eval sgs="\$${var}_suggest"
  385. pushvar var sgs
  386. enable_deep $sel
  387. popvar sgs
  388. enable_deep_weak $sgs
  389. popvar var
  390. done
  391. }
  392. enable_deep(){
  393. do_enable_deep $*
  394. enable $*
  395. }
  396. enable_deep_weak(){
  397. do_enable_deep $*
  398. enable_weak $*
  399. }
  400. enabled(){
  401. test "${1#!}" = "$1" && op== || op=!=
  402. eval test "x\$${1#!}" $op "xyes"
  403. }
  404. disabled(){
  405. test "${1#!}" = "$1" && op== || op=!=
  406. eval test "x\$${1#!}" $op "xno"
  407. }
  408. enabled_all(){
  409. for opt; do
  410. enabled $opt || return 1
  411. done
  412. }
  413. disabled_all(){
  414. for opt; do
  415. disabled $opt || return 1
  416. done
  417. }
  418. enabled_any(){
  419. for opt; do
  420. enabled $opt && return 0
  421. done
  422. }
  423. disabled_any(){
  424. for opt; do
  425. disabled $opt && return 0
  426. done
  427. return 1
  428. }
  429. set_default(){
  430. for opt; do
  431. eval : \${$opt:=\$${opt}_default}
  432. done
  433. }
  434. is_in(){
  435. value=$1
  436. shift
  437. for var in $*; do
  438. [ $var = $value ] && return 0
  439. done
  440. return 1
  441. }
  442. check_deps(){
  443. for cfg; do
  444. cfg="${cfg#!}"
  445. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  446. disabled ${cfg}_checking && continue
  447. enable ${cfg}_checking
  448. eval dep_all="\$${cfg}_deps"
  449. eval dep_any="\$${cfg}_deps_any"
  450. eval dep_sel="\$${cfg}_select"
  451. eval dep_sgs="\$${cfg}_suggest"
  452. eval dep_ifa="\$${cfg}_if"
  453. eval dep_ifn="\$${cfg}_if_any"
  454. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  455. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  456. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  457. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  458. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  459. enabled_all $dep_all || disable $cfg
  460. enabled_any $dep_any || disable $cfg
  461. disabled_any $dep_sel && disable $cfg
  462. if enabled $cfg; then
  463. eval dep_extralibs="\$${cfg}_extralibs"
  464. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  465. enable_deep $dep_sel
  466. enable_deep_weak $dep_sgs
  467. fi
  468. disable ${cfg}_checking
  469. done
  470. }
  471. print_config_h(){
  472. enabled $1 && v=1 || v=0
  473. echo "#define $2 $v"
  474. }
  475. print_config_mak(){
  476. enabled $1 && v= || v=!
  477. echo "$v$2=yes"
  478. }
  479. print_config_asm(){
  480. enabled $1 && echo "%define $2"
  481. }
  482. print_config(){
  483. pfx=$1
  484. files=$2
  485. shift 2
  486. for cfg; do
  487. ucname="$(toupper $cfg)"
  488. for f in $files; do
  489. "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
  490. done
  491. done
  492. }
  493. print_enabled(){
  494. test "$1" = -n && end=" " && shift || end="\n"
  495. suf=$1
  496. shift
  497. for v; do
  498. enabled $v && printf "%s$end" ${v%$suf};
  499. done
  500. }
  501. append(){
  502. var=$1
  503. shift
  504. eval "$var=\"\$$var $*\""
  505. }
  506. prepend(){
  507. var=$1
  508. shift
  509. eval "$var=\"$* \$$var\""
  510. }
  511. add_cppflags(){
  512. append CPPFLAGS $($filter_cppflags "$@")
  513. }
  514. add_cflags(){
  515. append CFLAGS $($filter_cflags "$@")
  516. }
  517. add_asflags(){
  518. append ASFLAGS $($filter_asflags "$@")
  519. }
  520. add_ldflags(){
  521. append LDFLAGS "$@"
  522. }
  523. add_extralibs(){
  524. prepend extralibs "$@"
  525. }
  526. check_cmd(){
  527. log "$@"
  528. "$@" >> $logfile 2>&1
  529. }
  530. check_cc(){
  531. log check_cc "$@"
  532. cat > $TMPC
  533. log_file $TMPC
  534. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  535. }
  536. check_cpp(){
  537. log check_cpp "$@"
  538. cat > $TMPC
  539. log_file $TMPC
  540. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  541. }
  542. check_as(){
  543. log check_as "$@"
  544. cat > $TMPC
  545. log_file $TMPC
  546. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  547. }
  548. check_asm(){
  549. log check_asm "$@"
  550. name="$1"
  551. code="$2"
  552. shift 2
  553. disable $name
  554. check_as "$@" <<EOF && enable $name
  555. void foo(void){ __asm__ volatile($code); }
  556. EOF
  557. }
  558. check_yasm(){
  559. log check_yasm "$@"
  560. echo "$1" > $TMPS
  561. log_file $TMPS
  562. shift 1
  563. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  564. }
  565. check_ld(){
  566. log check_ld "$@"
  567. flags=''
  568. libs=''
  569. for f; do
  570. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  571. done
  572. check_cc $($filter_cflags $flags) || return
  573. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
  574. }
  575. check_cppflags(){
  576. log check_cppflags "$@"
  577. set -- $($filter_cppflags "$@")
  578. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  579. int x;
  580. EOF
  581. }
  582. check_cflags(){
  583. log check_cflags "$@"
  584. set -- $($filter_cflags "$@")
  585. check_cc "$@" <<EOF && append CFLAGS "$@"
  586. int x;
  587. EOF
  588. }
  589. test_ldflags(){
  590. log test_ldflags "$@"
  591. check_ld "$@" <<EOF
  592. int main(void){ return 0; }
  593. EOF
  594. }
  595. check_ldflags(){
  596. log check_ldflags "$@"
  597. test_ldflags "$@" && add_ldflags "$@"
  598. }
  599. check_header(){
  600. log check_header "$@"
  601. header=$1
  602. shift
  603. disable_safe $header
  604. check_cpp "$@" <<EOF && enable_safe $header
  605. #include <$header>
  606. int x;
  607. EOF
  608. }
  609. check_func(){
  610. log check_func "$@"
  611. func=$1
  612. shift
  613. disable $func
  614. check_ld "$@" <<EOF && enable $func
  615. extern int $func();
  616. int main(void){ $func(); }
  617. EOF
  618. }
  619. check_mathfunc(){
  620. log check_mathfunc "$@"
  621. func=$1
  622. shift
  623. disable $func
  624. check_ld "$@" <<EOF && enable $func
  625. #include <math.h>
  626. float foo(float f) { return $func(f); }
  627. int main(void){ return 0; }
  628. EOF
  629. }
  630. check_func_headers(){
  631. log check_func_headers "$@"
  632. headers=$1
  633. funcs=$2
  634. shift 2
  635. {
  636. for hdr in $headers; do
  637. echo "#include <$hdr>"
  638. done
  639. for func in $funcs; do
  640. echo "long check_$func(void) { return (long) $func; }"
  641. done
  642. echo "int main(void) { return 0; }"
  643. } | check_ld "$@" && enable $funcs && enable_safe $headers
  644. }
  645. check_cpp_condition(){
  646. log check_cpp_condition "$@"
  647. header=$1
  648. condition=$2
  649. shift 2
  650. check_cpp $($filter_cppflags "$@") <<EOF
  651. #include <$header>
  652. #if !($condition)
  653. #error "unsatisfied condition: $condition"
  654. #endif
  655. EOF
  656. }
  657. check_lib(){
  658. log check_lib "$@"
  659. header="$1"
  660. func="$2"
  661. shift 2
  662. check_header $header && check_func $func "$@" && add_extralibs "$@"
  663. }
  664. check_lib2(){
  665. log check_lib2 "$@"
  666. headers="$1"
  667. funcs="$2"
  668. shift 2
  669. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  670. }
  671. check_pkg_config(){
  672. log check_pkg_config "$@"
  673. pkg="$1"
  674. headers="$2"
  675. funcs="$3"
  676. shift 3
  677. $pkg_config --exists $pkg || return
  678. pkg_cflags=$($pkg_config --cflags $pkg)
  679. pkg_libs=$($pkg_config --libs $pkg)
  680. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  681. set_safe ${pkg}_cflags $pkg_cflags &&
  682. set_safe ${pkg}_libs $pkg_libs
  683. }
  684. check_exec(){
  685. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  686. }
  687. check_exec_crash(){
  688. code=$(cat)
  689. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  690. # are safe but may not be available everywhere. Thus we use
  691. # raise(SIGTERM) instead. The check is run in a subshell so we
  692. # can redirect the "Terminated" message from the shell. SIGBUS
  693. # is not defined by standard C so it is used conditionally.
  694. (check_exec "$@") >> $logfile 2>&1 <<EOF
  695. #include <signal.h>
  696. static void sighandler(int sig){
  697. raise(SIGTERM);
  698. }
  699. int main(void){
  700. signal(SIGILL, sighandler);
  701. signal(SIGFPE, sighandler);
  702. signal(SIGSEGV, sighandler);
  703. #ifdef SIGBUS
  704. signal(SIGBUS, sighandler);
  705. #endif
  706. { $code }
  707. }
  708. EOF
  709. }
  710. check_type(){
  711. log check_type "$@"
  712. headers=$1
  713. type=$2
  714. shift 2
  715. disable_safe "$type"
  716. incs=""
  717. for hdr in $headers; do
  718. incs="$incs
  719. #include <$hdr>"
  720. done
  721. check_cc "$@" <<EOF && enable_safe "$type"
  722. $incs
  723. $type v;
  724. EOF
  725. }
  726. check_struct(){
  727. log check_type "$@"
  728. headers=$1
  729. struct=$2
  730. member=$3
  731. shift 3
  732. disable_safe "${struct}_${member}"
  733. incs=""
  734. for hdr in $headers; do
  735. incs="$incs
  736. #include <$hdr>"
  737. done
  738. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  739. $incs
  740. const void *p = &(($struct *)0)->$member;
  741. EOF
  742. }
  743. require(){
  744. name="$1"
  745. header="$2"
  746. func="$3"
  747. shift 3
  748. check_lib $header $func "$@" || die "ERROR: $name not found"
  749. }
  750. require2(){
  751. name="$1"
  752. headers="$2"
  753. func="$3"
  754. shift 3
  755. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  756. }
  757. require_pkg_config(){
  758. pkg="$1"
  759. check_pkg_config "$@" || die "ERROR: $pkg not found"
  760. add_cflags $(get_safe ${pkg}_cflags)
  761. add_extralibs $(get_safe ${pkg}_libs)
  762. }
  763. check_host_cc(){
  764. log check_host_cc "$@"
  765. cat > $TMPC
  766. log_file $TMPC
  767. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  768. }
  769. check_host_cflags(){
  770. log check_host_cflags "$@"
  771. check_host_cc "$@" <<EOF && append host_cflags "$@"
  772. int x;
  773. EOF
  774. }
  775. apply(){
  776. file=$1
  777. shift
  778. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  779. }
  780. cp_if_changed(){
  781. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  782. mkdir -p "$(dirname $2)"
  783. cp -f "$1" "$2"
  784. }
  785. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  786. # system-dependent things.
  787. COMPONENT_LIST="
  788. bsfs
  789. decoders
  790. demuxers
  791. encoders
  792. filters
  793. hwaccels
  794. indevs
  795. muxers
  796. outdevs
  797. parsers
  798. protocols
  799. "
  800. CONFIG_LIST="
  801. $COMPONENT_LIST
  802. aandct
  803. ac3dsp
  804. avcodec
  805. avdevice
  806. avfilter
  807. avformat
  808. avisynth
  809. bzlib
  810. dct
  811. doc
  812. dwt
  813. dxva2
  814. fastdiv
  815. ffmpeg
  816. avconv
  817. avplay
  818. avprobe
  819. avserver
  820. fft
  821. frei0r
  822. gnutls
  823. golomb
  824. gpl
  825. gray
  826. h264dsp
  827. h264pred
  828. hardcoded_tables
  829. huffman
  830. libcdio
  831. libdc1394
  832. libdirac
  833. libfaac
  834. libfreetype
  835. libgsm
  836. libmp3lame
  837. libnut
  838. libopencore_amrnb
  839. libopencore_amrwb
  840. libopencv
  841. libopenjpeg
  842. libpulse
  843. librtmp
  844. libschroedinger
  845. libspeex
  846. libtheora
  847. libvo_aacenc
  848. libvo_amrwbenc
  849. libvorbis
  850. libvpx
  851. libx264
  852. libxavs
  853. libxvid
  854. lpc
  855. lsp
  856. mdct
  857. memalign_hack
  858. mlib
  859. mpegaudiodsp
  860. network
  861. nonfree
  862. openssl
  863. pic
  864. postproc
  865. rdft
  866. rtpdec
  867. runtime_cpudetect
  868. shared
  869. sinewin
  870. small
  871. sram
  872. static
  873. swscale
  874. swscale_alpha
  875. thumb
  876. vaapi
  877. vdpau
  878. version3
  879. x11grab
  880. zlib
  881. "
  882. THREADS_LIST='
  883. pthreads
  884. w32threads
  885. '
  886. ARCH_LIST='
  887. alpha
  888. arm
  889. avr32
  890. avr32_ap
  891. avr32_uc
  892. bfin
  893. ia64
  894. m68k
  895. mips
  896. mips64
  897. parisc
  898. ppc
  899. ppc64
  900. s390
  901. sh4
  902. sparc
  903. sparc64
  904. tomi
  905. x86
  906. x86_32
  907. x86_64
  908. '
  909. ARCH_EXT_LIST='
  910. altivec
  911. amd3dnow
  912. amd3dnowext
  913. armv5te
  914. armv6
  915. armv6t2
  916. armvfp
  917. avx
  918. iwmmxt
  919. mmi
  920. mmx
  921. mmx2
  922. neon
  923. ppc4xx
  924. sse
  925. ssse3
  926. vfpv3
  927. vis
  928. '
  929. HAVE_LIST_PUB='
  930. bigendian
  931. fast_unaligned
  932. '
  933. HAVE_LIST="
  934. $ARCH_EXT_LIST
  935. $HAVE_LIST_PUB
  936. $THREADS_LIST
  937. aligned_stack
  938. alsa_asoundlib_h
  939. altivec_h
  940. arpa_inet_h
  941. asm_mod_y
  942. attribute_may_alias
  943. attribute_packed
  944. bswap
  945. closesocket
  946. cmov
  947. dcbzl
  948. dev_bktr_ioctl_bt848_h
  949. dev_bktr_ioctl_meteor_h
  950. dev_ic_bt8xx_h
  951. dev_video_meteor_ioctl_meteor_h
  952. dev_video_bktr_ioctl_bt848_h
  953. dlfcn_h
  954. dlopen
  955. dos_paths
  956. ebp_available
  957. ebx_available
  958. exp2
  959. exp2f
  960. fast_64bit
  961. fast_clz
  962. fast_cmov
  963. fcntl
  964. fork
  965. getaddrinfo
  966. gethrtime
  967. GetProcessMemoryInfo
  968. GetProcessTimes
  969. getrusage
  970. gnu_as
  971. struct_rusage_ru_maxrss
  972. ibm_asm
  973. inet_aton
  974. inline_asm
  975. isatty
  976. ldbrx
  977. libdc1394_1
  978. libdc1394_2
  979. llrint
  980. llrintf
  981. local_aligned_16
  982. local_aligned_8
  983. localtime_r
  984. log2
  985. log2f
  986. loongson
  987. lrint
  988. lrintf
  989. lzo1x_999_compress
  990. machine_ioctl_bt848_h
  991. machine_ioctl_meteor_h
  992. malloc_h
  993. MapViewOfFile
  994. memalign
  995. mkstemp
  996. mmap
  997. posix_memalign
  998. round
  999. roundf
  1000. sdl
  1001. sdl_video_size
  1002. setmode
  1003. sndio_h
  1004. socklen_t
  1005. soundcard_h
  1006. poll_h
  1007. setrlimit
  1008. strerror_r
  1009. strptime
  1010. strtok_r
  1011. struct_addrinfo
  1012. struct_ipv6_mreq
  1013. struct_sockaddr_in6
  1014. struct_sockaddr_sa_len
  1015. struct_sockaddr_storage
  1016. symver
  1017. symver_gnu_asm
  1018. symver_asm_label
  1019. sys_mman_h
  1020. sys_resource_h
  1021. sys_select_h
  1022. sys_soundcard_h
  1023. sys_videoio_h
  1024. threads
  1025. trunc
  1026. truncf
  1027. vfp_args
  1028. VirtualAlloc
  1029. winsock2_h
  1030. xform_asm
  1031. xmm_clobbers
  1032. yasm
  1033. "
  1034. # options emitted with CONFIG_ prefix but not available on command line
  1035. CONFIG_EXTRA="
  1036. avutil
  1037. gplv3
  1038. lgplv3
  1039. "
  1040. CMDLINE_SELECT="
  1041. $ARCH_EXT_LIST
  1042. $CONFIG_LIST
  1043. $THREADS_LIST
  1044. asm
  1045. cross_compile
  1046. debug
  1047. extra_warnings
  1048. logging
  1049. optimizations
  1050. symver
  1051. yasm
  1052. "
  1053. PATHS_LIST='
  1054. bindir
  1055. datadir
  1056. incdir
  1057. libdir
  1058. mandir
  1059. prefix
  1060. shlibdir
  1061. '
  1062. CMDLINE_SET="
  1063. $PATHS_LIST
  1064. ar
  1065. arch
  1066. as
  1067. build_suffix
  1068. cc
  1069. cpu
  1070. cross_prefix
  1071. dep_cc
  1072. extra_version
  1073. host_cc
  1074. host_cflags
  1075. host_ldflags
  1076. host_libs
  1077. host_os
  1078. ld
  1079. logfile
  1080. malloc_prefix
  1081. nm
  1082. optflags
  1083. pkg_config
  1084. samples
  1085. sysinclude
  1086. sysroot
  1087. target_exec
  1088. target_os
  1089. target_path
  1090. "
  1091. CMDLINE_APPEND="
  1092. extra_cflags
  1093. "
  1094. # code dependency declarations
  1095. # architecture extensions
  1096. armv5te_deps="arm"
  1097. armv6_deps="arm"
  1098. armv6t2_deps="arm"
  1099. armvfp_deps="arm"
  1100. iwmmxt_deps="arm"
  1101. neon_deps="arm"
  1102. vfpv3_deps="armvfp"
  1103. mmi_deps="mips"
  1104. altivec_deps="ppc"
  1105. ppc4xx_deps="ppc"
  1106. vis_deps="sparc"
  1107. x86_64_suggest="cmov fast_cmov"
  1108. amd3dnow_deps="mmx"
  1109. amd3dnowext_deps="amd3dnow"
  1110. mmx_deps="x86"
  1111. mmx2_deps="mmx"
  1112. sse_deps="mmx"
  1113. ssse3_deps="sse"
  1114. avx_deps="ssse3"
  1115. aligned_stack_if_any="ppc x86"
  1116. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1117. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1118. fast_unaligned_if_any="armv6 ppc x86"
  1119. need_memalign="altivec neon sse"
  1120. inline_asm_deps="!tms470"
  1121. symver_if_any="symver_asm_label symver_gnu_asm"
  1122. # subsystems
  1123. dct_select="rdft"
  1124. mdct_select="fft"
  1125. rdft_select="fft"
  1126. mpegaudiodsp_select="dct"
  1127. # decoders / encoders / hardware accelerators
  1128. aac_decoder_select="mdct sinewin"
  1129. aac_encoder_select="mdct sinewin"
  1130. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1131. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1132. ac3_encoder_select="mdct ac3dsp"
  1133. ac3_fixed_encoder_select="mdct ac3dsp"
  1134. alac_encoder_select="lpc"
  1135. amrnb_decoder_select="lsp"
  1136. amrwb_decoder_select="lsp"
  1137. atrac1_decoder_select="mdct sinewin"
  1138. atrac3_decoder_select="mdct"
  1139. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1140. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1141. cavs_decoder_select="golomb"
  1142. cook_decoder_select="mdct sinewin"
  1143. cscd_decoder_suggest="zlib"
  1144. dca_decoder_select="mdct"
  1145. dnxhd_encoder_select="aandct"
  1146. dxa_decoder_select="zlib"
  1147. eac3_decoder_select="ac3_decoder"
  1148. eac3_encoder_select="mdct ac3dsp"
  1149. eamad_decoder_select="aandct"
  1150. eatgq_decoder_select="aandct"
  1151. eatqi_decoder_select="aandct"
  1152. ffv1_decoder_select="golomb"
  1153. flac_decoder_select="golomb"
  1154. flac_encoder_select="golomb lpc"
  1155. flashsv_decoder_select="zlib"
  1156. flashsv_encoder_select="zlib"
  1157. flashsv2_decoder_select="zlib"
  1158. flv_decoder_select="h263_decoder"
  1159. flv_encoder_select="h263_encoder"
  1160. fraps_decoder_select="huffman"
  1161. h261_encoder_select="aandct"
  1162. h263_decoder_select="h263_parser"
  1163. h263_encoder_select="aandct"
  1164. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1165. h263i_decoder_select="h263_decoder"
  1166. h263p_encoder_select="h263_encoder"
  1167. h264_decoder_select="golomb h264dsp h264pred"
  1168. h264_dxva2_hwaccel_deps="dxva2api_h"
  1169. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1170. h264_vaapi_hwaccel_select="vaapi h264_decoder"
  1171. h264_vdpau_decoder_select="vdpau h264_decoder"
  1172. imc_decoder_select="fft mdct sinewin"
  1173. jpegls_decoder_select="golomb"
  1174. jpegls_encoder_select="golomb"
  1175. ljpeg_encoder_select="aandct"
  1176. loco_decoder_select="golomb"
  1177. mjpeg_encoder_select="aandct"
  1178. mlp_decoder_select="mlp_parser"
  1179. mp1_decoder_select="mpegaudiodsp"
  1180. mp2_decoder_select="mpegaudiodsp"
  1181. mp3adu_decoder_select="mpegaudiodsp"
  1182. mp3_decoder_select="mpegaudiodsp"
  1183. mp3on4_decoder_select="mpegaudiodsp"
  1184. mp1float_decoder_select="mpegaudiodsp"
  1185. mp2float_decoder_select="mpegaudiodsp"
  1186. mp3adufloat_decoder_select="mpegaudiodsp"
  1187. mp3float_decoder_select="mpegaudiodsp"
  1188. mp3on4float_decoder_select="mpegaudiodsp"
  1189. mpeg1video_encoder_select="aandct"
  1190. mpeg2video_encoder_select="aandct"
  1191. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1192. mpeg4_encoder_select="h263_encoder"
  1193. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1194. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1195. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1196. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1197. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1198. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1199. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1200. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1201. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1202. msmpeg4v1_decoder_select="h263_decoder"
  1203. msmpeg4v1_encoder_select="h263_encoder"
  1204. msmpeg4v2_decoder_select="h263_decoder"
  1205. msmpeg4v2_encoder_select="h263_encoder"
  1206. msmpeg4v3_decoder_select="h263_decoder"
  1207. msmpeg4v3_encoder_select="h263_encoder"
  1208. nellymoser_decoder_select="mdct sinewin"
  1209. nellymoser_encoder_select="mdct sinewin"
  1210. png_decoder_select="zlib"
  1211. png_encoder_select="zlib"
  1212. qcelp_decoder_select="lsp"
  1213. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1214. ra_144_encoder_select="lpc"
  1215. rv10_decoder_select="h263_decoder"
  1216. rv10_encoder_select="h263_encoder"
  1217. rv20_decoder_select="h263_decoder"
  1218. rv20_encoder_select="h263_encoder"
  1219. rv30_decoder_select="golomb h264pred"
  1220. rv40_decoder_select="golomb h264pred"
  1221. shorten_decoder_select="golomb"
  1222. sipr_decoder_select="lsp"
  1223. snow_decoder_select="dwt"
  1224. snow_encoder_select="aandct dwt"
  1225. svq1_encoder_select="aandct"
  1226. svq3_decoder_select="golomb h264dsp h264pred"
  1227. svq3_decoder_suggest="zlib"
  1228. theora_decoder_select="vp3_decoder"
  1229. tiff_decoder_suggest="zlib"
  1230. tiff_encoder_suggest="zlib"
  1231. truehd_decoder_select="mlp_decoder"
  1232. tscc_decoder_select="zlib"
  1233. twinvq_decoder_select="mdct lsp sinewin"
  1234. vc1_decoder_select="h263_decoder"
  1235. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1236. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1237. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1238. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1239. vc1image_decoder_select="vc1_decoder"
  1240. vorbis_decoder_select="mdct"
  1241. vorbis_encoder_select="mdct"
  1242. vp6_decoder_select="huffman"
  1243. vp6a_decoder_select="vp6_decoder"
  1244. vp6f_decoder_select="vp6_decoder"
  1245. vp8_decoder_select="h264pred"
  1246. wmapro_decoder_select="mdct sinewin"
  1247. wmav1_decoder_select="mdct sinewin"
  1248. wmav1_encoder_select="mdct sinewin"
  1249. wmav2_decoder_select="mdct sinewin"
  1250. wmav2_encoder_select="mdct sinewin"
  1251. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1252. wmv1_decoder_select="h263_decoder"
  1253. wmv1_encoder_select="h263_encoder"
  1254. wmv2_decoder_select="h263_decoder"
  1255. wmv2_encoder_select="h263_encoder"
  1256. wmv3_decoder_select="vc1_decoder"
  1257. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1258. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1259. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1260. wmv3image_decoder_select="wmv3_decoder"
  1261. zlib_decoder_select="zlib"
  1262. zlib_encoder_select="zlib"
  1263. zmbv_decoder_select="zlib"
  1264. zmbv_encoder_select="zlib"
  1265. vaapi_deps="va_va_h"
  1266. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1267. # parsers
  1268. h264_parser_select="golomb h264dsp h264pred"
  1269. # external libraries
  1270. libdirac_decoder_deps="libdirac !libschroedinger"
  1271. libdirac_encoder_deps="libdirac"
  1272. libfaac_encoder_deps="libfaac"
  1273. libgsm_decoder_deps="libgsm"
  1274. libgsm_encoder_deps="libgsm"
  1275. libgsm_ms_decoder_deps="libgsm"
  1276. libgsm_ms_encoder_deps="libgsm"
  1277. libmp3lame_encoder_deps="libmp3lame"
  1278. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1279. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1280. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1281. libopenjpeg_decoder_deps="libopenjpeg"
  1282. libschroedinger_decoder_deps="libschroedinger"
  1283. libschroedinger_encoder_deps="libschroedinger"
  1284. libspeex_decoder_deps="libspeex"
  1285. libspeex_encoder_deps="libspeex"
  1286. libtheora_encoder_deps="libtheora"
  1287. libvo_aacenc_encoder_deps="libvo_aacenc"
  1288. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1289. libvorbis_encoder_deps="libvorbis"
  1290. libvpx_decoder_deps="libvpx"
  1291. libvpx_encoder_deps="libvpx"
  1292. libx264_encoder_deps="libx264"
  1293. libxavs_encoder_deps="libxavs"
  1294. libxvid_encoder_deps="libxvid"
  1295. # demuxers / muxers
  1296. ac3_demuxer_select="ac3_parser"
  1297. asf_stream_muxer_select="asf_muxer"
  1298. avisynth_demuxer_deps="avisynth"
  1299. dirac_demuxer_select="dirac_parser"
  1300. eac3_demuxer_select="ac3_parser"
  1301. flac_demuxer_select="flac_parser"
  1302. ipod_muxer_select="mov_muxer"
  1303. libnut_demuxer_deps="libnut"
  1304. libnut_muxer_deps="libnut"
  1305. matroska_audio_muxer_select="matroska_muxer"
  1306. matroska_demuxer_suggest="zlib bzlib"
  1307. mov_demuxer_suggest="zlib"
  1308. mp3_demuxer_select="mpegaudio_parser"
  1309. mp4_muxer_select="mov_muxer"
  1310. mpegtsraw_demuxer_select="mpegts_demuxer"
  1311. mxf_d10_muxer_select="mxf_muxer"
  1312. ogg_demuxer_select="golomb"
  1313. psp_muxer_select="mov_muxer"
  1314. rtp_demuxer_select="sdp_demuxer"
  1315. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1316. rtsp_demuxer_select="http_protocol rtpdec"
  1317. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1318. sap_demuxer_select="sdp_demuxer"
  1319. sap_muxer_select="rtp_muxer rtp_protocol"
  1320. sdp_demuxer_select="rtpdec"
  1321. spdif_muxer_select="aac_parser"
  1322. tg2_muxer_select="mov_muxer"
  1323. tgp_muxer_select="mov_muxer"
  1324. w64_demuxer_deps="wav_demuxer"
  1325. # indevs / outdevs
  1326. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1327. alsa_outdev_deps="alsa_asoundlib_h"
  1328. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1329. dv1394_indev_deps="dv1394 dv_demuxer"
  1330. fbdev_indev_deps="linux_fb_h"
  1331. jack_indev_deps="jack_jack_h"
  1332. libcdio_indev_deps="libcdio"
  1333. libdc1394_indev_deps="libdc1394"
  1334. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1335. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1336. pulse_indev_deps="libpulse"
  1337. sndio_indev_deps="sndio_h"
  1338. sndio_outdev_deps="sndio_h"
  1339. v4l_indev_deps="linux_videodev_h"
  1340. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1341. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1342. vfwcap_indev_extralibs="-lavicap32"
  1343. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1344. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1345. # protocols
  1346. gopher_protocol_deps="network"
  1347. http_protocol_deps="network"
  1348. http_protocol_select="tcp_protocol"
  1349. mmsh_protocol_select="http_protocol"
  1350. mmst_protocol_deps="network"
  1351. rtmp_protocol_select="tcp_protocol"
  1352. rtp_protocol_select="udp_protocol"
  1353. tcp_protocol_deps="network"
  1354. udp_protocol_deps="network"
  1355. # filters
  1356. blackframe_filter_deps="gpl"
  1357. boxblur_filter_deps="gpl"
  1358. cropdetect_filter_deps="gpl"
  1359. delogo_filter_deps="gpl"
  1360. drawtext_filter_deps="libfreetype"
  1361. frei0r_filter_deps="frei0r dlopen strtok_r"
  1362. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1363. hqdn3d_filter_deps="gpl"
  1364. ocv_filter_deps="libopencv"
  1365. scale_filter_deps="swscale"
  1366. yadif_filter_deps="gpl"
  1367. # libraries
  1368. avdevice_deps="avcodec avformat"
  1369. avformat_deps="avcodec"
  1370. postproc_deps="gpl"
  1371. # programs
  1372. ffmpeg_deps="avcodec avformat swscale"
  1373. ffmpeg_select="buffer_filter"
  1374. avconv_deps="avcodec avformat swscale"
  1375. avconv_select="buffer_filter"
  1376. avplay_deps="avcodec avformat swscale sdl"
  1377. avplay_select="rdft"
  1378. avprobe_deps="avcodec avformat"
  1379. avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1380. avserver_extralibs='$ldl'
  1381. doc_deps="texi2html"
  1382. # tests
  1383. test_deps(){
  1384. suf1=$1
  1385. suf2=$2
  1386. shift 2
  1387. for v; do
  1388. dep=${v%=*}
  1389. tests=${v#*=}
  1390. for name in ${tests}; do
  1391. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1392. done
  1393. done
  1394. }
  1395. mxf_d10_test_deps="avfilter"
  1396. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1397. test_deps _encoder _decoder \
  1398. adpcm_g726=g726 \
  1399. adpcm_ima_qt \
  1400. adpcm_ima_wav \
  1401. adpcm_ms \
  1402. adpcm_swf \
  1403. adpcm_yamaha=adpcm_yam \
  1404. alac \
  1405. asv1 \
  1406. asv2 \
  1407. bmp \
  1408. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1409. dvvideo="dv dv50" \
  1410. ffv1 \
  1411. flac \
  1412. flashsv \
  1413. flv \
  1414. gif \
  1415. h261 \
  1416. h263="h263 h263p" \
  1417. huffyuv \
  1418. jpegls \
  1419. mjpeg="jpg mjpeg ljpeg" \
  1420. mp2 \
  1421. mpeg1video="mpeg mpeg1b" \
  1422. mpeg2video="mpeg2 mpeg2thread" \
  1423. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1424. msmpeg4v3=msmpeg4 \
  1425. msmpeg4v2 \
  1426. pbm=pbmpipe \
  1427. pcx \
  1428. pgm="pgm pgmpipe" \
  1429. png \
  1430. ppm="ppm ppmpipe" \
  1431. rawvideo="rgb yuv" \
  1432. roq \
  1433. rv10 \
  1434. rv20 \
  1435. sgi \
  1436. snow="snow snowll" \
  1437. svq1 \
  1438. targa=tga \
  1439. tiff \
  1440. wmav1 \
  1441. wmav2 \
  1442. wmv1 \
  1443. wmv2 \
  1444. test_deps _muxer _demuxer \
  1445. aiff \
  1446. pcm_alaw=alaw \
  1447. asf \
  1448. au \
  1449. avi \
  1450. dv=dv_fmt \
  1451. ffm \
  1452. flv=flv_fmt \
  1453. gxf \
  1454. matroska=mkv \
  1455. mmf \
  1456. mov \
  1457. pcm_mulaw=mulaw \
  1458. mxf="mxf mxf_d10" \
  1459. nut \
  1460. ogg \
  1461. rawvideo=pixfmt \
  1462. rm \
  1463. swf \
  1464. mpegts=ts \
  1465. voc \
  1466. wav \
  1467. yuv4mpegpipe=yuv4mpeg \
  1468. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1469. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1470. # default parameters
  1471. logfile="config.log"
  1472. # installation paths
  1473. prefix_default="/usr/local"
  1474. bindir_default='${prefix}/bin'
  1475. datadir_default='${prefix}/share/avconv'
  1476. incdir_default='${prefix}/include'
  1477. libdir_default='${prefix}/lib'
  1478. mandir_default='${prefix}/share/man'
  1479. shlibdir_default="$libdir_default"
  1480. # toolchain
  1481. ar_default="ar"
  1482. cc_default="gcc"
  1483. cc_version=\"unknown\"
  1484. host_cc_default="gcc"
  1485. ln_s="ln -sf"
  1486. nm_default="nm"
  1487. objformat="elf"
  1488. pkg_config_default=pkg-config
  1489. ranlib="ranlib"
  1490. yasmexe="yasm"
  1491. nogas=":"
  1492. nm_opts='-g'
  1493. # machine
  1494. arch_default=$(uname -m)
  1495. cpu="generic"
  1496. # OS
  1497. target_os_default=$(tolower $(uname -s))
  1498. host_os=$target_os_default
  1499. # configurable options
  1500. enable avcodec
  1501. enable avdevice
  1502. enable avfilter
  1503. enable avformat
  1504. enable avutil
  1505. enable asm
  1506. enable debug
  1507. enable doc
  1508. enable fastdiv
  1509. enable ffmpeg
  1510. enable avconv
  1511. enable avplay
  1512. enable avprobe
  1513. enable avserver
  1514. enable network
  1515. enable optimizations
  1516. enable postproc
  1517. enable protocols
  1518. enable static
  1519. enable swscale
  1520. enable swscale_alpha
  1521. # build settings
  1522. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1523. AVSERVERLDFLAGS=-Wl,-E
  1524. LIBPREF="lib"
  1525. LIBSUF=".a"
  1526. FULLNAME='$(NAME)$(BUILDSUF)'
  1527. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1528. SLIBPREF="lib"
  1529. SLIBSUF=".so"
  1530. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1531. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1532. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1533. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1534. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1535. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1536. AS_O='-o $@'
  1537. CC_O='-o $@'
  1538. host_cflags='-D_ISOC99_SOURCE -O3 -g'
  1539. host_libs='-lm'
  1540. target_path='$(CURDIR)'
  1541. # since the object filename is not given with the -MM flag, the compiler
  1542. # is only able to print the basename, and we must add the path ourselves
  1543. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1544. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1545. # find source path
  1546. if test -f configure; then
  1547. source_path=.
  1548. else
  1549. source_path=$(cd $(dirname "$0"); pwd)
  1550. echo "$source_path" | grep -q '[[:blank:]]' &&
  1551. die "Out of tree builds are impossible with whitespace in source path."
  1552. test -e "$source_path/config.h" &&
  1553. die "Out of tree builds are impossible with config.h in source dir."
  1554. fi
  1555. for v in "$@"; do
  1556. r=${v#*=}
  1557. l=${v%"$r"}
  1558. r=$(sh_quote "$r")
  1559. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1560. done
  1561. find_things(){
  1562. thing=$1
  1563. pattern=$2
  1564. file=$source_path/$3
  1565. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1566. }
  1567. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1568. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1569. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1570. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1571. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1572. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1573. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1574. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1575. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1576. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1577. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1578. find_tests(){
  1579. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1580. }
  1581. ACODEC_TESTS=$(find_tests acodec)
  1582. VCODEC_TESTS=$(find_tests vsynth1)
  1583. LAVF_TESTS=$(find_tests lavf)
  1584. LAVFI_TESTS=$(find_tests lavfi)
  1585. SEEK_TESTS=$(find_tests seek seek_)
  1586. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1587. for n in $COMPONENT_LIST; do
  1588. v=$(toupper ${n%s})_LIST
  1589. eval enable \$$v
  1590. eval ${n}_if_any="\$$v"
  1591. done
  1592. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1593. die_unknown(){
  1594. echo "Unknown option \"$1\"."
  1595. echo "See $0 --help for available options."
  1596. exit 1
  1597. }
  1598. show_list() {
  1599. suffix=_$1
  1600. shift
  1601. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1602. exit 0
  1603. }
  1604. for opt do
  1605. optval="${opt#*=}"
  1606. case "$opt" in
  1607. --extra-ldflags=*) add_ldflags $optval
  1608. ;;
  1609. --extra-libs=*) add_extralibs $optval
  1610. ;;
  1611. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1612. ;;
  1613. --enable-debug=*) debuglevel="$optval"
  1614. ;;
  1615. --disable-everything)
  1616. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1617. ;;
  1618. --enable-*=*|--disable-*=*)
  1619. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1620. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1621. eval list=\$$(toupper $thing)_LIST
  1622. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1623. $action $(filter "$name" $list)
  1624. ;;
  1625. --enable-?*|--disable-?*)
  1626. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1627. if is_in $option $COMPONENT_LIST; then
  1628. test $action = disable && action=unset
  1629. eval $action \$$(toupper ${option%s})_LIST
  1630. elif is_in $option $CMDLINE_SELECT; then
  1631. $action $option
  1632. else
  1633. die_unknown $opt
  1634. fi
  1635. ;;
  1636. --list-*)
  1637. NAME="${opt#--list-}"
  1638. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1639. NAME=${NAME%s}
  1640. eval show_list $NAME \$$(toupper $NAME)_LIST
  1641. ;;
  1642. --help|-h) show_help
  1643. ;;
  1644. *)
  1645. optname="${opt%%=*}"
  1646. optname="${optname#--}"
  1647. optname=$(echo "$optname" | sed 's/-/_/g')
  1648. if is_in $optname $CMDLINE_SET; then
  1649. eval $optname='$optval'
  1650. elif is_in $optname $CMDLINE_APPEND; then
  1651. append $optname "$optval"
  1652. else
  1653. die_unknown $opt
  1654. fi
  1655. ;;
  1656. esac
  1657. done
  1658. disabled logging && logfile=/dev/null
  1659. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1660. set >> $logfile
  1661. test -n "$cross_prefix" && enable cross_compile
  1662. if enabled cross_compile; then
  1663. test -n "$arch" && test -n "$target_os" ||
  1664. die "Must specify target arch and OS when cross-compiling"
  1665. fi
  1666. set_default arch target_os
  1667. ar_default="${cross_prefix}${ar_default}"
  1668. cc_default="${cross_prefix}${cc_default}"
  1669. nm_default="${cross_prefix}${nm_default}"
  1670. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1671. ranlib="${cross_prefix}${ranlib}"
  1672. sysinclude_default="${sysroot}/usr/include"
  1673. set_default cc nm pkg_config sysinclude
  1674. enabled cross_compile || host_cc_default=$cc
  1675. set_default host_cc
  1676. if ! $pkg_config --version >/dev/null 2>&1; then
  1677. warn "$pkg_config not found, library detection may fail."
  1678. pkg_config=false
  1679. fi
  1680. exesuf() {
  1681. case $1 in
  1682. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1683. esac
  1684. }
  1685. EXESUF=$(exesuf $target_os)
  1686. HOSTEXESUF=$(exesuf $host_os)
  1687. # set temporary file name
  1688. : ${TMPDIR:=$TEMPDIR}
  1689. : ${TMPDIR:=$TMP}
  1690. : ${TMPDIR:=/tmp}
  1691. if ! check_cmd mktemp -u XXXXXX; then
  1692. # simple replacement for missing mktemp
  1693. # NOT SAFE FOR GENERAL USE
  1694. mktemp(){
  1695. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1696. }
  1697. fi
  1698. tmpfile(){
  1699. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1700. (set -C; exec > $tmp) 2>/dev/null ||
  1701. die "Unable to create temporary file in $TMPDIR."
  1702. append TMPFILES $tmp
  1703. eval $1=$tmp
  1704. }
  1705. trap 'rm -f -- $TMPFILES' EXIT
  1706. tmpfile TMPC .c
  1707. tmpfile TMPE $EXESUF
  1708. tmpfile TMPH .h
  1709. tmpfile TMPO .o
  1710. tmpfile TMPS .S
  1711. tmpfile TMPV .ver
  1712. tmpfile TMPSH .sh
  1713. tmpfile TMPASM .asm
  1714. unset -f mktemp
  1715. chmod +x $TMPE
  1716. # make sure we can execute files in $TMPDIR
  1717. cat > $TMPSH 2>> $logfile <<EOF
  1718. #! /bin/sh
  1719. EOF
  1720. chmod +x $TMPSH >> $logfile 2>&1
  1721. if ! $TMPSH >> $logfile 2>&1; then
  1722. cat <<EOF
  1723. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1724. variable to another directory and make sure that it is not mounted noexec.
  1725. EOF
  1726. die "Sanity test failed."
  1727. fi
  1728. filter_cflags=echo
  1729. filter_cppflags=echo
  1730. filter_asflags=echo
  1731. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1732. cc_type=llvm_gcc
  1733. cc_version=__VERSION__
  1734. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1735. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1736. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1737. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1738. speed_cflags='-O3'
  1739. size_cflags='-Os'
  1740. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1741. cc_type=gcc
  1742. cc_version=__VERSION__
  1743. gcc_version=$($cc --version | head -n1)
  1744. gcc_basever=$($cc -dumpversion)
  1745. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1746. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1747. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1748. if ! $cc -dumpversion | grep -q '^2\.'; then
  1749. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1750. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1751. fi
  1752. speed_cflags='-O3'
  1753. size_cflags='-Os'
  1754. elif $cc --version 2>/dev/null | grep -q Intel; then
  1755. cc_type=icc
  1756. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1757. cc_ident=$($cc --version | head -n1)
  1758. icc_version=$($cc -dumpversion)
  1759. CC_DEPFLAGS='-MMD'
  1760. AS_DEPFLAGS='-MMD'
  1761. speed_cflags='-O3'
  1762. size_cflags='-Os'
  1763. noopt_cflags='-O1'
  1764. elif $cc -v 2>&1 | grep -q xlc; then
  1765. cc_type=xlc
  1766. cc_version="AV_STRINGIFY(__IBMC__)"
  1767. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1768. speed_cflags='-O5'
  1769. size_cflags='-O5 -qcompact'
  1770. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1771. cc_type=ccc
  1772. cc_version="AV_STRINGIFY(__DECC_VER)"
  1773. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1774. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1775. debuglevel=3
  1776. add_ldflags -Wl,-z,now # calls to libots crash without this
  1777. speed_cflags='-fast'
  1778. size_cflags='-O1'
  1779. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1780. test -d "$sysroot" || die "No valid sysroot specified."
  1781. cc_type=armcc
  1782. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1783. cc_ident=$($cc --vsn | head -n1)
  1784. armcc_conf="$PWD/armcc.conf"
  1785. $cc --arm_linux_configure \
  1786. --arm_linux_config_file="$armcc_conf" \
  1787. --configure_sysroot="$sysroot" \
  1788. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1789. die "Error creating armcc configuration file."
  1790. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1791. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1792. as_default="${cross_prefix}gcc"
  1793. CC_DEPFLAGS='-MMD'
  1794. AS_DEPFLAGS='-MMD'
  1795. speed_cflags='-O3'
  1796. size_cflags='-Os'
  1797. filter_asflags="filter_out -W${armcc_opt}*"
  1798. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1799. cc_type=tms470
  1800. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1801. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1802. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1803. CC_O='-fr=$(@D)'
  1804. as_default="${cross_prefix}gcc"
  1805. ld_default="${cross_prefix}gcc"
  1806. TMPO=$(basename $TMPC .c).o
  1807. append TMPFILES $TMPO
  1808. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1809. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1810. AS_DEPFLAGS='-MMD'
  1811. speed_cflags='-O3 -mf=5'
  1812. size_cflags='-O3 -mf=2'
  1813. filter_cflags=tms470_flags
  1814. tms470_flags(){
  1815. for flag; do
  1816. case $flag in
  1817. -march=*|-mcpu=*)
  1818. case "${flag#*=}" in
  1819. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1820. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1821. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1822. armv6*|arm11*) echo -mv=6 ;;
  1823. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1824. echo -mv=5e ;;
  1825. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1826. esac
  1827. ;;
  1828. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1829. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1830. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1831. -msoft-float) echo --float_support=vfplib ;;
  1832. -O[0-3]|-mf=*) echo $flag ;;
  1833. -g) echo -g -mn ;;
  1834. -pds=*) echo $flag ;;
  1835. esac
  1836. done
  1837. }
  1838. elif $cc -v 2>&1 | grep -q clang; then
  1839. cc_type=clang
  1840. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1841. cc_version=__clang_version__ || cc_version=__VERSION__
  1842. cc_ident=$($cc --version | head -n1)
  1843. CC_DEPFLAGS='-MMD'
  1844. AS_DEPFLAGS='-MMD'
  1845. speed_cflags='-O3'
  1846. size_cflags='-Os'
  1847. elif $cc -V 2>&1 | grep -q Sun; then
  1848. cc_type=suncc
  1849. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1850. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1851. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1852. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1853. add_ldflags -xc99
  1854. speed_cflags='-O5'
  1855. size_cflags='-O5 -xspace'
  1856. filter_cflags=suncc_flags
  1857. suncc_flags(){
  1858. for flag; do
  1859. case $flag in
  1860. -march=*|-mcpu=*)
  1861. case "${flag#*=}" in
  1862. native) echo -xtarget=native ;;
  1863. v9|niagara) echo -xarch=sparc ;;
  1864. ultrasparc) echo -xarch=sparcvis ;;
  1865. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1866. i586|pentium) echo -xchip=pentium ;;
  1867. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1868. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1869. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1870. pentium4*) echo -xtarget=pentium4 ;;
  1871. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1872. *-sse3) echo -xarch=sse3 ;;
  1873. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1874. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1875. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1876. k8|opteron|athlon64|athlon-fx)
  1877. echo -xarch=sse2a ;;
  1878. athlon*) echo -xarch=pentium_proa ;;
  1879. esac
  1880. ;;
  1881. -std=c99) echo -xc99 ;;
  1882. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1883. -fPIC) echo -KPIC -xcode=pic32 ;;
  1884. -W*,*) echo $flag ;;
  1885. -f*-*|-W*) ;;
  1886. *) echo $flag ;;
  1887. esac
  1888. done
  1889. }
  1890. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  1891. cc_type=pathscale
  1892. cc_version=__PATHSCALE__
  1893. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1894. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1895. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1896. speed_cflags='-O2'
  1897. size_cflags='-Os'
  1898. filter_cflags='filter_out -Wdisabled-optimization'
  1899. elif $cc -v 2>&1 | grep -q Open64; then
  1900. cc_type=open64
  1901. cc_version=__OPEN64__
  1902. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1903. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1904. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1905. speed_cflags='-O2'
  1906. size_cflags='-Os'
  1907. filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  1908. fi
  1909. test -n "$cc_type" && enable $cc_type ||
  1910. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  1911. : ${as_default:=$cc}
  1912. : ${dep_cc_default:=$cc}
  1913. : ${ld_default:=$cc}
  1914. set_default ar as dep_cc ld
  1915. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1916. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1917. add_cflags $extra_cflags
  1918. add_asflags $extra_cflags
  1919. if test -n "$sysroot"; then
  1920. case "$cc_type" in
  1921. gcc|llvm_gcc|clang)
  1922. add_cppflags --sysroot="$sysroot"
  1923. add_ldflags --sysroot="$sysroot"
  1924. ;;
  1925. tms470)
  1926. add_cppflags -I"$sysinclude"
  1927. add_ldflags --sysroot="$sysroot"
  1928. ;;
  1929. esac
  1930. fi
  1931. if test "$cpu" = host; then
  1932. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1933. case "$cc_type" in
  1934. gcc|llvm_gcc)
  1935. check_native(){
  1936. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1937. sed -n "/cc1.*$1=/{
  1938. s/.*$1=\\([^ ]*\\).*/\\1/
  1939. p
  1940. q
  1941. }" $TMPE
  1942. }
  1943. cpu=$(check_native -march || check_native -mcpu)
  1944. ;;
  1945. esac
  1946. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1947. fi
  1948. # Deal with common $arch aliases
  1949. case "$arch" in
  1950. arm*)
  1951. arch="arm"
  1952. ;;
  1953. mips|mipsel|IP*)
  1954. arch="mips"
  1955. ;;
  1956. mips64*)
  1957. arch="mips"
  1958. subarch="mips64"
  1959. ;;
  1960. parisc|hppa)
  1961. arch="parisc"
  1962. ;;
  1963. parisc64|hppa64)
  1964. arch="parisc"
  1965. subarch="parisc64"
  1966. ;;
  1967. "Power Macintosh"|ppc|powerpc)
  1968. arch="ppc"
  1969. ;;
  1970. ppc64|powerpc64)
  1971. arch="ppc"
  1972. subarch="ppc64"
  1973. ;;
  1974. s390|s390x)
  1975. arch="s390"
  1976. ;;
  1977. sh4|sh)
  1978. arch="sh4"
  1979. ;;
  1980. sun4u|sparc64)
  1981. arch="sparc"
  1982. subarch="sparc64"
  1983. ;;
  1984. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  1985. arch="x86"
  1986. ;;
  1987. esac
  1988. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  1989. enable $arch
  1990. # Add processor-specific flags
  1991. if test "$cpu" = generic; then
  1992. : do nothing
  1993. elif enabled ppc; then
  1994. case $(tolower $cpu) in
  1995. 601|ppc601|powerpc601)
  1996. cpuflags="-mcpu=601"
  1997. disable altivec
  1998. ;;
  1999. 603*|ppc603*|powerpc603*)
  2000. cpuflags="-mcpu=603"
  2001. disable altivec
  2002. ;;
  2003. 604*|ppc604*|powerpc604*)
  2004. cpuflags="-mcpu=604"
  2005. disable altivec
  2006. ;;
  2007. g3|75*|ppc75*|powerpc75*)
  2008. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2009. disable altivec
  2010. ;;
  2011. g4|745*|ppc745*|powerpc745*)
  2012. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2013. ;;
  2014. 74*|ppc74*|powerpc74*)
  2015. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2016. ;;
  2017. g5|970|ppc970|powerpc970|power4*)
  2018. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2019. ;;
  2020. cell)
  2021. cpuflags="-mcpu=cell"
  2022. enable ldbrx
  2023. ;;
  2024. e500v2)
  2025. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2026. disable altivec
  2027. ;;
  2028. e500)
  2029. cpuflags="-mcpu=8540 -mhard-float"
  2030. disable altivec
  2031. ;;
  2032. esac
  2033. elif enabled x86; then
  2034. case $cpu in
  2035. i[345]86|pentium)
  2036. cpuflags="-march=$cpu"
  2037. disable mmx
  2038. ;;
  2039. # targets that do NOT support conditional mov (cmov)
  2040. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2041. cpuflags="-march=$cpu"
  2042. disable cmov
  2043. ;;
  2044. # targets that do support conditional mov (cmov)
  2045. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2046. cpuflags="-march=$cpu"
  2047. enable cmov
  2048. enable fast_cmov
  2049. ;;
  2050. # targets that do support conditional mov but on which it's slow
  2051. pentium4|pentium4m|prescott|nocona)
  2052. cpuflags="-march=$cpu"
  2053. enable cmov
  2054. disable fast_cmov
  2055. ;;
  2056. esac
  2057. elif enabled sparc; then
  2058. case $cpu in
  2059. niagara)
  2060. cpuflags="-mcpu=$cpu"
  2061. disable vis
  2062. ;;
  2063. sparc64)
  2064. cpuflags="-mcpu=v9"
  2065. ;;
  2066. esac
  2067. elif enabled arm; then
  2068. case $cpu in
  2069. armv*)
  2070. cpuflags="-march=$cpu"
  2071. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2072. ;;
  2073. *)
  2074. cpuflags="-mcpu=$cpu"
  2075. case $cpu in
  2076. cortex-a*) subarch=armv7a ;;
  2077. cortex-r*) subarch=armv7r ;;
  2078. cortex-m*) enable thumb; subarch=armv7m ;;
  2079. arm11*) subarch=armv6 ;;
  2080. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2081. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2082. esac
  2083. ;;
  2084. esac
  2085. elif enabled alpha; then
  2086. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2087. elif enabled bfin; then
  2088. cpuflags="-mcpu=$cpu"
  2089. elif enabled mips; then
  2090. cpuflags="-march=$cpu"
  2091. elif enabled avr32; then
  2092. case $cpu in
  2093. ap7[02]0[0-2])
  2094. subarch="avr32_ap"
  2095. cpuflags="-mpart=$cpu"
  2096. ;;
  2097. ap)
  2098. subarch="avr32_ap"
  2099. cpuflags="-march=$cpu"
  2100. ;;
  2101. uc3[ab]*)
  2102. subarch="avr32_uc"
  2103. cpuflags="-mcpu=$cpu"
  2104. ;;
  2105. uc)
  2106. subarch="avr32_uc"
  2107. cpuflags="-march=$cpu"
  2108. ;;
  2109. esac
  2110. fi
  2111. add_cflags $cpuflags
  2112. add_asflags $cpuflags
  2113. # compiler sanity check
  2114. check_exec <<EOF
  2115. int main(void){ return 0; }
  2116. EOF
  2117. if test "$?" != 0; then
  2118. echo "$cc is unable to create an executable file."
  2119. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2120. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2121. echo "Only do this if you know what cross compiling means."
  2122. fi
  2123. die "C compiler test failed."
  2124. fi
  2125. add_cppflags -D_ISOC99_SOURCE
  2126. check_cflags -std=c99
  2127. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2128. #include <stdlib.h>
  2129. EOF
  2130. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2131. #include <stdlib.h>
  2132. EOF
  2133. check_host_cflags -std=c99
  2134. check_host_cflags -Wall
  2135. case "$arch" in
  2136. alpha|ia64|mips|parisc|sparc)
  2137. spic=$shared
  2138. ;;
  2139. x86)
  2140. subarch="x86_32"
  2141. check_cc <<EOF && subarch="x86_64"
  2142. int test[(int)sizeof(char*) - 7];
  2143. EOF
  2144. if test "$subarch" = "x86_64"; then
  2145. spic=$shared
  2146. fi
  2147. ;;
  2148. esac
  2149. enable $subarch
  2150. enabled spic && enable pic
  2151. # OS specific
  2152. case $target_os in
  2153. haiku)
  2154. prefix_default="/boot/common"
  2155. network_extralibs="-lnetwork"
  2156. host_libs=
  2157. ;;
  2158. sunos)
  2159. AVSERVERLDFLAGS=""
  2160. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2161. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2162. network_extralibs="-lsocket -lnsl"
  2163. add_cppflags -D__EXTENSIONS__
  2164. # When using suncc to build, the Solaris linker will mark
  2165. # an executable with each instruction set encountered by
  2166. # the Solaris assembler. As our libraries contain their own
  2167. # guards for processor-specific code, instead suppress
  2168. # generation of the HWCAPS ELF section on Solaris x86 only.
  2169. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2170. nm_opts='-P -g'
  2171. ;;
  2172. netbsd)
  2173. disable symver
  2174. oss_indev_extralibs="-lossaudio"
  2175. oss_outdev_extralibs="-lossaudio"
  2176. ;;
  2177. openbsd)
  2178. enable malloc_aligned
  2179. # On OpenBSD 4.5. the compiler does not use PIC unless
  2180. # explicitly using -fPIC. Libav builds fine without PIC,
  2181. # however the generated executable will not do anything
  2182. # (simply quits with exit-code 1, no crash, no output).
  2183. # Thus explicitly enable PIC here.
  2184. enable pic
  2185. disable symver
  2186. SHFLAGS='-shared'
  2187. oss_indev_extralibs="-lossaudio"
  2188. oss_outdev_extralibs="-lossaudio"
  2189. ;;
  2190. dragonfly)
  2191. enable malloc_aligned
  2192. disable symver
  2193. ;;
  2194. freebsd)
  2195. enable malloc_aligned
  2196. ;;
  2197. bsd/os)
  2198. add_extralibs -lpoll -lgnugetopt
  2199. ;;
  2200. darwin)
  2201. enable malloc_aligned
  2202. gas="gas-preprocessor.pl $cc"
  2203. enabled ppc && add_asflags -force_cpusubtype_ALL
  2204. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2205. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2206. add_ldflags -Wl,-dynamic,-search_paths_first
  2207. SLIBSUF=".dylib"
  2208. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2209. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2210. AVSERVERLDFLAGS=-Wl,-bind_at_load
  2211. objformat="macho"
  2212. enabled x86_64 && objformat="macho64"
  2213. enabled_any pic shared ||
  2214. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2215. ;;
  2216. mingw32*)
  2217. if test $target_os = "mingw32ce"; then
  2218. disable network
  2219. else
  2220. target_os=mingw32
  2221. enable_weak w32threads
  2222. fi
  2223. LIBTARGET=i386
  2224. if enabled x86_64; then
  2225. enable malloc_aligned
  2226. LIBTARGET="i386:x86-64"
  2227. elif enabled arm; then
  2228. LIBTARGET=arm-wince
  2229. fi
  2230. shlibdir_default="$bindir_default"
  2231. SLIBPREF=""
  2232. SLIBSUF=".dll"
  2233. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2234. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2235. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2236. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2237. SLIB_INSTALL_LINKS=
  2238. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2239. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2240. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2241. objformat="win32"
  2242. dlltool="${cross_prefix}dlltool"
  2243. enable dos_paths
  2244. check_cflags -fno-common
  2245. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2246. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2247. die "ERROR: MinGW runtime version must be >= 3.15."
  2248. add_cppflags -U__STRICT_ANSI__
  2249. ;;
  2250. cygwin*)
  2251. target_os=cygwin
  2252. shlibdir_default="$bindir_default"
  2253. SLIBPREF="cyg"
  2254. SLIBSUF=".dll"
  2255. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2256. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2257. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2258. objformat="win32"
  2259. enable dos_paths
  2260. check_cflags -fno-common
  2261. add_cppflags -U__STRICT_ANSI__
  2262. ;;
  2263. *-dos|freedos|opendos)
  2264. network_extralibs="-lsocket"
  2265. objformat="coff"
  2266. enable dos_paths
  2267. add_cppflags -U__STRICT_ANSI__
  2268. ;;
  2269. linux)
  2270. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2271. enable dv1394
  2272. ;;
  2273. irix*)
  2274. target_os=irix
  2275. ranlib="echo ignoring ranlib"
  2276. ;;
  2277. os/2*)
  2278. ln_s="cp -f"
  2279. objformat="aout"
  2280. add_cppflags -D_GNU_SOURCE
  2281. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2282. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2283. AVSERVERLDFLAGS=""
  2284. LIBSUF="_s.a"
  2285. SLIBPREF=""
  2286. SLIBSUF=".dll"
  2287. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2288. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2289. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2290. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2291. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2292. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2293. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2294. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2295. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2296. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2297. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2298. enable dos_paths
  2299. ;;
  2300. gnu/kfreebsd)
  2301. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2302. ;;
  2303. gnu)
  2304. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2305. ;;
  2306. qnx)
  2307. add_cppflags -D_QNX_SOURCE
  2308. network_extralibs="-lsocket"
  2309. ;;
  2310. symbian)
  2311. SLIBSUF=".dll"
  2312. enable dos_paths
  2313. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2314. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2315. add_ldflags -Wl,--target1-abs,--no-undefined \
  2316. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2317. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2318. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2319. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2320. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2321. ;;
  2322. none)
  2323. ;;
  2324. *)
  2325. die "Unknown OS '$target_os'."
  2326. ;;
  2327. esac
  2328. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
  2329. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2330. set_default $PATHS_LIST
  2331. # we need to build at least one lib type
  2332. if ! enabled_any static shared; then
  2333. cat <<EOF
  2334. At least one library type must be built.
  2335. Specify --enable-static to build the static libraries or --enable-shared to
  2336. build the shared libraries as well. To only build the shared libraries specify
  2337. --disable-static in addition to --enable-shared.
  2338. EOF
  2339. exit 1;
  2340. fi
  2341. die_license_disabled() {
  2342. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2343. }
  2344. die_license_disabled gpl libcdio
  2345. die_license_disabled gpl libx264
  2346. die_license_disabled gpl libxavs
  2347. die_license_disabled gpl libxvid
  2348. die_license_disabled gpl x11grab
  2349. die_license_disabled nonfree libfaac
  2350. die_license_disabled nonfree openssl
  2351. die_license_disabled version3 libopencore_amrnb
  2352. die_license_disabled version3 libopencore_amrwb
  2353. die_license_disabled version3 libvo_aacenc
  2354. die_license_disabled version3 libvo_amrwbenc
  2355. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2356. disabled optimizations || check_cflags -fomit-frame-pointer
  2357. enable_pic() {
  2358. enable pic
  2359. add_cppflags -DPIC
  2360. add_cflags -fPIC
  2361. add_asflags -fPIC
  2362. }
  2363. enabled pic && enable_pic
  2364. check_cc <<EOF || die "Symbol mangling check failed."
  2365. int ff_extern;
  2366. EOF
  2367. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2368. extern_prefix=${sym%%ff_extern*}
  2369. check_cc <<EOF && enable inline_asm
  2370. void foo(void) { __asm__ volatile ("" ::); }
  2371. EOF
  2372. _restrict=
  2373. for restrict_keyword in restrict __restrict__ __restrict; do
  2374. check_cc <<EOF && _restrict=$restrict_keyword && break
  2375. void foo(char * $restrict_keyword p);
  2376. EOF
  2377. done
  2378. check_cc <<EOF && enable attribute_packed
  2379. struct { int x; } __attribute__((packed)) x;
  2380. EOF
  2381. check_cc <<EOF && enable attribute_may_alias
  2382. union { int x; } __attribute__((may_alias)) x;
  2383. EOF
  2384. check_cc <<EOF || die "endian test failed"
  2385. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2386. EOF
  2387. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2388. if enabled alpha; then
  2389. check_cflags -mieee
  2390. elif enabled arm; then
  2391. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2392. nogas=die
  2393. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2394. enable vfp_args
  2395. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2396. case "${cross_prefix:-$cc}" in
  2397. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2398. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2399. __asm__ (".eabi_attribute 28, 1");
  2400. int main(void) { return 0; }
  2401. EOF
  2402. esac
  2403. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2404. fi
  2405. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2406. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2407. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2408. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2409. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2410. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2411. enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2412. check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2413. enabled_all armv6t2 shared !pic && enable_pic
  2414. elif enabled mips; then
  2415. check_asm loongson '"dmult.g $1, $2, $3"'
  2416. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2417. elif enabled ppc; then
  2418. enable local_aligned_8 local_aligned_16
  2419. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2420. check_asm ibm_asm '"add 0, 0, 0"'
  2421. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2422. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2423. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2424. if enabled altivec; then
  2425. nogas=warn
  2426. check_cflags -maltivec -mabi=altivec &&
  2427. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2428. check_cflags -faltivec
  2429. # check if our compiler supports Motorola AltiVec C API
  2430. check_cc <<EOF || disable altivec
  2431. $inc_altivec_h
  2432. int main(void) {
  2433. vector signed int v1, v2, v3;
  2434. v1 = vec_add(v2,v3);
  2435. return 0;
  2436. }
  2437. EOF
  2438. # check if our compiler supports braces for vector declarations
  2439. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2440. $inc_altivec_h
  2441. int main (void) { (vector int) {1}; return 0; }
  2442. EOF
  2443. fi
  2444. elif enabled sparc; then
  2445. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2446. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2447. elif enabled x86; then
  2448. enable local_aligned_8 local_aligned_16
  2449. # check whether EBP is available on x86
  2450. # As 'i' is stored on the stack, this program will crash
  2451. # if the base pointer is used to access it because the
  2452. # base pointer is cleared in the inline assembly code.
  2453. check_exec_crash <<EOF && enable ebp_available
  2454. volatile int i=0;
  2455. __asm__ volatile (
  2456. "xorl %%ebp, %%ebp"
  2457. ::: "%ebp");
  2458. return i;
  2459. EOF
  2460. # check whether EBX is available on x86
  2461. check_asm ebx_available '""::"b"(0)' &&
  2462. check_asm ebx_available '"":::"%ebx"'
  2463. # check whether xmm clobbers are supported
  2464. check_asm xmm_clobbers '"":::"%xmm0"'
  2465. # check whether binutils is new enough to compile SSSE3/MMX2
  2466. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2467. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2468. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2469. if ! disabled_any asm mmx yasm; then
  2470. if check_cmd $yasmexe --version; then
  2471. enabled x86_64 && yasm_extra="-m amd64"
  2472. yasm_debug="-g dwarf2"
  2473. elif check_cmd nasm -v; then
  2474. yasmexe=nasm
  2475. yasm_debug="-g -F dwarf"
  2476. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2477. fi
  2478. YASMFLAGS="-f $objformat $yasm_extra"
  2479. enabled pic && append YASMFLAGS "-DPIC"
  2480. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2481. case "$objformat" in
  2482. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2483. esac
  2484. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2485. die "yasm not found, use --disable-yasm for a crippled build"
  2486. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2487. fi
  2488. case "$cpu" in
  2489. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2490. disable fast_clz
  2491. ;;
  2492. esac
  2493. fi
  2494. if enabled asm; then
  2495. as=${gas:=$as}
  2496. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2497. $nogas "GNU assembler not found, install gas-preprocessor"
  2498. fi
  2499. check_ldflags -Wl,--as-needed
  2500. if check_func dlopen; then
  2501. ldl=
  2502. elif check_func dlopen -ldl; then
  2503. ldl=-ldl
  2504. fi
  2505. if enabled network; then
  2506. check_type "sys/types.h sys/socket.h" socklen_t
  2507. check_type netdb.h "struct addrinfo"
  2508. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2509. check_type netinet/in.h "struct sockaddr_in6"
  2510. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2511. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2512. # Prefer arpa/inet.h over winsock2
  2513. if check_header arpa/inet.h ; then
  2514. check_func closesocket
  2515. elif check_header winsock2.h ; then
  2516. check_func_headers winsock2.h closesocket -lws2 && \
  2517. network_extralibs="-lws2" || \
  2518. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2519. network_extralibs="-lws2_32"; }
  2520. check_type ws2tcpip.h socklen_t
  2521. check_type ws2tcpip.h "struct addrinfo"
  2522. check_type ws2tcpip.h "struct ipv6_mreq"
  2523. check_type ws2tcpip.h "struct sockaddr_in6"
  2524. check_type ws2tcpip.h "struct sockaddr_storage"
  2525. check_struct winsock2.h "struct sockaddr" sa_len
  2526. else
  2527. disable network
  2528. fi
  2529. fi
  2530. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2531. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2532. check_func fcntl
  2533. check_func fork
  2534. check_func getaddrinfo $network_extralibs
  2535. check_func gethrtime
  2536. check_func getrusage
  2537. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2538. check_func inet_aton $network_extralibs
  2539. check_func isatty
  2540. check_func localtime_r
  2541. check_func ${malloc_prefix}memalign && enable memalign
  2542. check_func mkstemp
  2543. check_func mmap
  2544. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2545. check_func setrlimit
  2546. check_func strerror_r
  2547. check_func strptime
  2548. check_func strtok_r
  2549. check_func_headers io.h setmode
  2550. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2551. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2552. check_func_headers windows.h GetProcessTimes
  2553. check_func_headers windows.h MapViewOfFile
  2554. check_func_headers windows.h VirtualAlloc
  2555. check_header dlfcn.h
  2556. check_header dxva2api.h
  2557. check_header malloc.h
  2558. check_header poll.h
  2559. check_header sys/mman.h
  2560. check_header sys/resource.h
  2561. check_header sys/select.h
  2562. check_header vdpau/vdpau.h
  2563. check_header vdpau/vdpau_x11.h
  2564. check_header X11/extensions/XvMClib.h
  2565. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2566. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2567. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2568. # check for some common methods of building with pthread support
  2569. # do this before the optional library checks as some of them require pthreads
  2570. if ! disabled pthreads && ! enabled w32threads; then
  2571. enable pthreads
  2572. if check_func pthread_create; then
  2573. :
  2574. elif check_func pthread_create -pthread; then
  2575. add_cflags -pthread
  2576. add_extralibs -pthread
  2577. elif check_func pthread_create -pthreads; then
  2578. add_cflags -pthreads
  2579. add_extralibs -pthreads
  2580. elif check_func pthread_create -lpthreadGC2; then
  2581. add_extralibs -lpthreadGC2
  2582. elif ! check_lib pthread.h pthread_create -lpthread; then
  2583. disable pthreads
  2584. fi
  2585. fi
  2586. for thread in $THREADS_LIST; do
  2587. if enabled $thread; then
  2588. test -n "$thread_type" &&
  2589. die "ERROR: Only one thread type must be selected." ||
  2590. thread_type="$thread"
  2591. fi
  2592. done
  2593. check_lib math.h sin -lm && LIBM="-lm"
  2594. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2595. check_mathfunc exp2
  2596. check_mathfunc exp2f
  2597. check_mathfunc llrint
  2598. check_mathfunc llrintf
  2599. check_mathfunc log2
  2600. check_mathfunc log2f
  2601. check_mathfunc lrint
  2602. check_mathfunc lrintf
  2603. check_mathfunc round
  2604. check_mathfunc roundf
  2605. check_mathfunc trunc
  2606. check_mathfunc truncf
  2607. # these are off by default, so fail if requested and not available
  2608. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2609. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2610. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  2611. enabled libdirac && require_pkg_config dirac \
  2612. "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
  2613. "dirac_decoder_init dirac_encoder_init"
  2614. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2615. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2616. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2617. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2618. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2619. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2620. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2621. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  2622. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2623. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  2624. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2625. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2626. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2627. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2628. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2629. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2630. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2631. enabled libvpx && {
  2632. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2633. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2634. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2635. die "ERROR: libvpx encoder version must be >=0.9.1"; } }
  2636. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2637. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  2638. die "ERROR: libx264 version must be >= 0.118."; }
  2639. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2640. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2641. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2642. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  2643. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  2644. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  2645. die "ERROR: openssl not found"; }
  2646. # libdc1394 check
  2647. if enabled libdc1394; then
  2648. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2649. enable libdc1394_2; } ||
  2650. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2651. enable libdc1394_1; } ||
  2652. die "ERROR: No version of libdc1394 found "
  2653. fi
  2654. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2655. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2656. enable sdl &&
  2657. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2658. fi
  2659. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2660. check_header linux/fb.h
  2661. check_header linux/videodev.h
  2662. check_header linux/videodev2.h
  2663. check_header sys/videoio.h
  2664. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2665. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2666. # w32api 3.12 had it defined wrong
  2667. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2668. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2669. { check_header dev/bktr/ioctl_meteor.h &&
  2670. check_header dev/bktr/ioctl_bt848.h; } ||
  2671. { check_header machine/ioctl_meteor.h &&
  2672. check_header machine/ioctl_bt848.h; } ||
  2673. { check_header dev/video/meteor/ioctl_meteor.h &&
  2674. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2675. check_header dev/ic/bt8xx.h
  2676. check_header sndio.h
  2677. check_header sys/soundcard.h
  2678. check_header soundcard.h
  2679. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2680. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2681. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  2682. enabled libcdio &&
  2683. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  2684. enabled x11grab &&
  2685. check_header X11/Xlib.h &&
  2686. check_header X11/extensions/XShm.h &&
  2687. check_header X11/extensions/Xfixes.h &&
  2688. check_func XOpenDisplay -lX11 &&
  2689. check_func XShmCreateImage -lX11 -lXext &&
  2690. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2691. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2692. check_cpp_condition \
  2693. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2694. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2695. disable vdpau; }
  2696. fi
  2697. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2698. # add some useful compiler flags if supported
  2699. check_cflags -Wdeclaration-after-statement
  2700. check_cflags -Wall
  2701. check_cflags -Wno-parentheses
  2702. check_cflags -Wno-switch
  2703. check_cflags -Wno-format-zero-length
  2704. check_cflags -Wdisabled-optimization
  2705. check_cflags -Wpointer-arith
  2706. check_cflags -Wredundant-decls
  2707. check_cflags -Wno-pointer-sign
  2708. check_cflags -Wcast-qual
  2709. check_cflags -Wwrite-strings
  2710. check_cflags -Wtype-limits
  2711. check_cflags -Wundef
  2712. check_cflags -Wmissing-prototypes
  2713. check_cflags -Wstrict-prototypes
  2714. enabled extra_warnings && check_cflags -Winline
  2715. # add some linker flags
  2716. check_ldflags -Wl,--warn-common
  2717. check_ldflags -Wl,-rpath-link=libpostproc:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
  2718. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2719. echo "X{};" > $TMPV
  2720. if test_ldflags -Wl,--version-script,$TMPV; then
  2721. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2722. check_cc <<EOF && enable symver_asm_label
  2723. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2724. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2725. EOF
  2726. check_cc <<EOF && enable symver_gnu_asm
  2727. __asm__(".symver ff_foo,av_foo@VERSION");
  2728. void ff_foo(void) {}
  2729. EOF
  2730. fi
  2731. if [ -n "$optflags" ]; then
  2732. add_cflags $optflags
  2733. elif enabled small; then
  2734. add_cflags $size_cflags
  2735. elif enabled optimizations; then
  2736. add_cflags $speed_cflags
  2737. else
  2738. add_cflags $noopt_cflags
  2739. fi
  2740. check_cflags -fno-math-errno
  2741. check_cflags -fno-signed-zeros
  2742. if enabled icc; then
  2743. # Just warnings, no remarks
  2744. check_cflags -w1
  2745. # -wd: Disable following warnings
  2746. # 144, 167, 556: -Wno-pointer-sign
  2747. # 1292: attribute "foo" ignored
  2748. # 10006: ignoring unknown option -fno-signed-zeros
  2749. # 10148: ignoring unknown option -Wno-parentheses
  2750. # 10156: ignoring option '-W'; no argument required
  2751. check_cflags -wd144,167,556,1292,10006,10148,10156
  2752. # 11030: Warning unknown option --as-needed
  2753. # 10156: ignoring option '-export'; no argument required
  2754. check_ldflags -wd10156,11030
  2755. # Allow to compile with optimizations
  2756. check_ldflags -march=$cpu
  2757. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2758. enable ebp_available
  2759. if enabled x86_32; then
  2760. test ${icc_version%%.*} -ge 11 && \
  2761. check_cflags -falign-stack=maintain-16-byte || \
  2762. disable aligned_stack
  2763. fi
  2764. elif enabled ccc; then
  2765. # disable some annoying warnings
  2766. add_cflags -msg_disable cvtu32to64
  2767. add_cflags -msg_disable embedcomment
  2768. add_cflags -msg_disable needconstext
  2769. add_cflags -msg_disable nomainieee
  2770. add_cflags -msg_disable ptrmismatch1
  2771. add_cflags -msg_disable unreachcode
  2772. elif enabled gcc; then
  2773. check_cflags -fno-tree-vectorize
  2774. check_cflags -Werror=implicit-function-declaration
  2775. check_cflags -Werror=missing-prototypes
  2776. elif enabled llvm_gcc; then
  2777. check_cflags -mllvm -stack-alignment=16
  2778. elif enabled clang; then
  2779. check_cflags -mllvm -stack-alignment=16
  2780. check_cflags -Qunused-arguments
  2781. elif enabled armcc; then
  2782. # 2523: use of inline assembler is deprecated
  2783. add_cflags -W${armcc_opt},--diag_suppress=2523
  2784. add_cflags -W${armcc_opt},--diag_suppress=1207
  2785. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2786. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2787. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  2788. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  2789. elif enabled tms470; then
  2790. add_cflags -pds=824 -pds=837
  2791. elif enabled pathscale; then
  2792. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2793. fi
  2794. enabled_any $THREADS_LIST && enable threads
  2795. check_deps $CONFIG_LIST \
  2796. $CONFIG_EXTRA \
  2797. $HAVE_LIST \
  2798. $DECODER_LIST \
  2799. $ENCODER_LIST \
  2800. $HWACCEL_LIST \
  2801. $PARSER_LIST \
  2802. $BSF_LIST \
  2803. $DEMUXER_LIST \
  2804. $MUXER_LIST \
  2805. $FILTER_LIST \
  2806. $INDEV_LIST \
  2807. $OUTDEV_LIST \
  2808. $PROTOCOL_LIST \
  2809. $ACODEC_TESTS \
  2810. $VCODEC_TESTS \
  2811. $LAVF_TESTS \
  2812. $LAVFI_TESTS \
  2813. $SEEK_TESTS \
  2814. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2815. ! enabled_any memalign posix_memalign malloc_aligned &&
  2816. enabled_any $need_memalign && enable memalign_hack
  2817. echo "install prefix $prefix"
  2818. echo "source path $source_path"
  2819. echo "C compiler $cc"
  2820. echo "ARCH $arch ($cpu)"
  2821. if test "$build_suffix" != ""; then
  2822. echo "build suffix $build_suffix"
  2823. fi
  2824. if test "$extra_version" != ""; then
  2825. echo "version string suffix $extra_version"
  2826. fi
  2827. echo "big-endian ${bigendian-no}"
  2828. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2829. if enabled x86; then
  2830. echo "${yasmexe} ${yasm-no}"
  2831. echo "MMX enabled ${mmx-no}"
  2832. echo "MMX2 enabled ${mmx2-no}"
  2833. echo "3DNow! enabled ${amd3dnow-no}"
  2834. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2835. echo "SSE enabled ${sse-no}"
  2836. echo "SSSE3 enabled ${ssse3-no}"
  2837. echo "AVX enabled ${avx-no}"
  2838. echo "CMOV enabled ${cmov-no}"
  2839. echo "CMOV is fast ${fast_cmov-no}"
  2840. echo "EBX available ${ebx_available-no}"
  2841. echo "EBP available ${ebp_available-no}"
  2842. fi
  2843. if enabled arm; then
  2844. echo "ARMv5TE enabled ${armv5te-no}"
  2845. echo "ARMv6 enabled ${armv6-no}"
  2846. echo "ARMv6T2 enabled ${armv6t2-no}"
  2847. echo "ARM VFP enabled ${armvfp-no}"
  2848. echo "IWMMXT enabled ${iwmmxt-no}"
  2849. echo "NEON enabled ${neon-no}"
  2850. fi
  2851. if enabled mips; then
  2852. echo "MMI enabled ${mmi-no}"
  2853. fi
  2854. if enabled ppc; then
  2855. echo "AltiVec enabled ${altivec-no}"
  2856. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2857. echo "dcbzl available ${dcbzl-no}"
  2858. fi
  2859. if enabled sparc; then
  2860. echo "VIS enabled ${vis-no}"
  2861. fi
  2862. echo "debug symbols ${debug-no}"
  2863. echo "optimize for size ${small-no}"
  2864. echo "optimizations ${optimizations-no}"
  2865. echo "static ${static-no}"
  2866. echo "shared ${shared-no}"
  2867. echo "postprocessing support ${postproc-no}"
  2868. echo "new filter support ${avfilter-no}"
  2869. echo "network support ${network-no}"
  2870. echo "threading support ${thread_type-no}"
  2871. echo "SDL support ${sdl-no}"
  2872. echo "Sun medialib support ${mlib-no}"
  2873. echo "libdxva2 enabled ${dxva2-no}"
  2874. echo "libva enabled ${vaapi-no}"
  2875. echo "libvdpau enabled ${vdpau-no}"
  2876. echo "AVISynth enabled ${avisynth-no}"
  2877. echo "frei0r enabled ${frei0r-no}"
  2878. echo "gnutls enabled ${gnutls-no}"
  2879. echo "libcdio support ${libcdio-no}"
  2880. echo "libdc1394 support ${libdc1394-no}"
  2881. echo "libdirac enabled ${libdirac-no}"
  2882. echo "libfaac enabled ${libfaac-no}"
  2883. echo "libgsm enabled ${libgsm-no}"
  2884. echo "libmp3lame enabled ${libmp3lame-no}"
  2885. echo "libnut enabled ${libnut-no}"
  2886. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2887. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2888. echo "libopencv support ${libopencv-no}"
  2889. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2890. echo "libpulse enabled ${libpulse-no}"
  2891. echo "librtmp enabled ${librtmp-no}"
  2892. echo "libschroedinger enabled ${libschroedinger-no}"
  2893. echo "libspeex enabled ${libspeex-no}"
  2894. echo "libtheora enabled ${libtheora-no}"
  2895. echo "libvo-aacenc support ${libvo_aacenc-no}"
  2896. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  2897. echo "libvorbis enabled ${libvorbis-no}"
  2898. echo "libvpx enabled ${libvpx-no}"
  2899. echo "libx264 enabled ${libx264-no}"
  2900. echo "libxavs enabled ${libxavs-no}"
  2901. echo "libxvid enabled ${libxvid-no}"
  2902. echo "openssl enabled ${openssl-no}"
  2903. echo "zlib enabled ${zlib-no}"
  2904. echo "bzlib enabled ${bzlib-no}"
  2905. echo
  2906. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2907. echo "Enabled ${type}s:"
  2908. eval list=\$$(toupper $type)_LIST
  2909. print_enabled '_*' $list | sort | pr -r -3 -t
  2910. echo
  2911. done
  2912. license="LGPL version 2.1 or later"
  2913. if enabled nonfree; then
  2914. license="nonfree and unredistributable"
  2915. elif enabled gplv3; then
  2916. license="GPL version 3 or later"
  2917. elif enabled lgplv3; then
  2918. license="LGPL version 3 or later"
  2919. elif enabled gpl; then
  2920. license="GPL version 2 or later"
  2921. fi
  2922. echo "License: $license"
  2923. echo "Creating config.mak and config.h..."
  2924. test -e Makefile || $ln_s "$source_path/Makefile" .
  2925. config_files="$TMPH config.mak"
  2926. cat > config.mak <<EOF
  2927. # Automatically generated by configure - do not modify!
  2928. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  2929. prefix=$prefix
  2930. LIBDIR=\$(DESTDIR)$libdir
  2931. SHLIBDIR=\$(DESTDIR)$shlibdir
  2932. INCDIR=\$(DESTDIR)$incdir
  2933. BINDIR=\$(DESTDIR)$bindir
  2934. DATADIR=\$(DESTDIR)$datadir
  2935. MANDIR=\$(DESTDIR)$mandir
  2936. SRC_PATH=$source_path
  2937. CC_IDENT=$cc_ident
  2938. ARCH=$arch
  2939. CC=$cc
  2940. AS=$as
  2941. LD=$ld
  2942. DEPCC=$dep_cc
  2943. YASM=$yasmexe
  2944. YASMDEP=$yasmexe
  2945. AR=$ar
  2946. RANLIB=$ranlib
  2947. LN_S=$ln_s
  2948. CPPFLAGS=$CPPFLAGS
  2949. CFLAGS=$CFLAGS
  2950. ASFLAGS=$ASFLAGS
  2951. AS_O=$CC_O
  2952. CC_O=$CC_O
  2953. DLLTOOL=$dlltool
  2954. LDFLAGS=$LDFLAGS
  2955. AVSERVERLDFLAGS=$AVSERVERLDFLAGS
  2956. SHFLAGS=$SHFLAGS
  2957. YASMFLAGS=$YASMFLAGS
  2958. BUILDSUF=$build_suffix
  2959. FULLNAME=$FULLNAME
  2960. LIBPREF=$LIBPREF
  2961. LIBSUF=$LIBSUF
  2962. LIBNAME=$LIBNAME
  2963. SLIBPREF=$SLIBPREF
  2964. SLIBSUF=$SLIBSUF
  2965. EXESUF=$EXESUF
  2966. EXTRA_VERSION=$extra_version
  2967. DEPFLAGS=$DEPFLAGS
  2968. CCDEP=$CCDEP
  2969. ASDEP=$ASDEP
  2970. CC_DEPFLAGS=$CC_DEPFLAGS
  2971. AS_DEPFLAGS=$AS_DEPFLAGS
  2972. HOSTCC=$host_cc
  2973. HOSTCFLAGS=$host_cflags
  2974. HOSTEXESUF=$HOSTEXESUF
  2975. HOSTLDFLAGS=$host_ldflags
  2976. HOSTLIBS=$host_libs
  2977. TARGET_EXEC=$target_exec
  2978. TARGET_PATH=$target_path
  2979. SDL_LIBS=$sdl_libs
  2980. SDL_CFLAGS=$sdl_cflags
  2981. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2982. EXTRALIBS=$extralibs
  2983. INSTALL=install
  2984. LIBTARGET=${LIBTARGET}
  2985. SLIBNAME=${SLIBNAME}
  2986. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2987. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2988. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2989. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2990. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  2991. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  2992. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  2993. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  2994. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  2995. EOF
  2996. get_version(){
  2997. name=$1
  2998. file=$source_path/$2
  2999. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3000. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3001. lcname=$(tolower $name)
  3002. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3003. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3004. }
  3005. get_version LIBSWSCALE libswscale/swscale.h
  3006. get_version LIBPOSTPROC libpostproc/postprocess.h
  3007. get_version LIBAVCODEC libavcodec/version.h
  3008. get_version LIBAVDEVICE libavdevice/avdevice.h
  3009. get_version LIBAVFORMAT libavformat/version.h
  3010. get_version LIBAVUTIL libavutil/avutil.h
  3011. get_version LIBAVFILTER libavfilter/avfilter.h
  3012. cat > $TMPH <<EOF
  3013. /* Automatically generated by configure - do not modify! */
  3014. #ifndef LIBAV_CONFIG_H
  3015. #define LIBAV_CONFIG_H
  3016. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  3017. #define LIBAV_LICENSE "$(c_escape $license)"
  3018. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3019. #define CC_TYPE "$cc_type"
  3020. #define CC_VERSION $cc_version
  3021. #define restrict $_restrict
  3022. #define EXTERN_PREFIX "${extern_prefix}"
  3023. #define EXTERN_ASM ${extern_prefix}
  3024. #define SLIBSUF "$SLIBSUF"
  3025. EOF
  3026. test -n "$malloc_prefix" &&
  3027. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3028. if enabled small || disabled optimizations; then
  3029. echo "#undef av_always_inline" >> $TMPH
  3030. if enabled small; then
  3031. echo "#define av_always_inline inline" >> $TMPH
  3032. else
  3033. echo "#define av_always_inline av_unused" >> $TMPH
  3034. fi
  3035. fi
  3036. if enabled yasm; then
  3037. append config_files $TMPASM
  3038. printf '' >$TMPASM
  3039. fi
  3040. print_config ARCH_ "$config_files" $ARCH_LIST
  3041. print_config HAVE_ "$config_files" $HAVE_LIST
  3042. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3043. $CONFIG_EXTRA \
  3044. $DECODER_LIST \
  3045. $ENCODER_LIST \
  3046. $HWACCEL_LIST \
  3047. $PARSER_LIST \
  3048. $BSF_LIST \
  3049. $DEMUXER_LIST \
  3050. $MUXER_LIST \
  3051. $FILTER_LIST \
  3052. $PROTOCOL_LIST \
  3053. $INDEV_LIST \
  3054. $OUTDEV_LIST \
  3055. cat >>config.mak <<EOF
  3056. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3057. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3058. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3059. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3060. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3061. EOF
  3062. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3063. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3064. cp_if_changed $TMPH config.h
  3065. touch .config
  3066. enabled yasm && cp_if_changed $TMPASM config.asm
  3067. cat > $TMPH <<EOF
  3068. /* Generated by ffconf */
  3069. #ifndef AVUTIL_AVCONFIG_H
  3070. #define AVUTIL_AVCONFIG_H
  3071. EOF
  3072. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3073. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3074. cp_if_changed $TMPH libavutil/avconfig.h
  3075. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3076. # build pkg-config files
  3077. pkgconfig_generate(){
  3078. name=$1
  3079. shortname=${name#lib}${build_suffix}
  3080. comment=$2
  3081. version=$3
  3082. libs=$4
  3083. requires=$5
  3084. enabled ${name#lib} || return 0
  3085. mkdir -p $name
  3086. cat <<EOF > $name/$name.pc
  3087. prefix=$prefix
  3088. exec_prefix=\${prefix}
  3089. libdir=$libdir
  3090. includedir=$incdir
  3091. Name: $name
  3092. Description: $comment
  3093. Version: $version
  3094. Requires: $(enabled shared || echo $requires)
  3095. Requires.private: $(enabled shared && echo $requires)
  3096. Conflicts:
  3097. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3098. Libs.private: $(enabled shared && echo $libs)
  3099. Cflags: -I\${includedir}
  3100. EOF
  3101. cat <<EOF > $name/$name-uninstalled.pc
  3102. prefix=
  3103. exec_prefix=
  3104. libdir=\${pcfiledir}
  3105. includedir=${source_path}
  3106. Name: $name
  3107. Description: $comment
  3108. Version: $version
  3109. Requires: $requires
  3110. Conflicts:
  3111. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3112. Cflags: -I\${includedir}
  3113. EOF
  3114. }
  3115. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3116. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3117. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3118. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3119. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3120. pkgconfig_generate libpostproc "Libav postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3121. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"