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.

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