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.

3488 lines
102KB

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