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.

2409 lines
70KB

  1. #!/bin/sh
  2. #
  3. # FFmpeg 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 FFMPEG, 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 FFmpeg."
  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. echo "Usage: configure [options]"
  52. echo "Options: [defaults in brackets after descriptions]"
  53. echo
  54. echo "Standard options:"
  55. echo " --help print this message"
  56. echo " --logfile=FILE log tests and output to FILE [config.err]"
  57. echo " --disable-logging do not log configure debug information"
  58. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  59. echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
  60. echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
  61. echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
  62. echo " --incdir=DIR install includes in DIR [PREFIX/include]"
  63. echo " --mandir=DIR install man page in DIR [PREFIX/share/man]"
  64. echo " --enable-static build static libraries [yes]"
  65. echo " --disable-static do not build static libraries [no]"
  66. echo " --enable-shared build shared libraries [no]"
  67. echo " --disable-shared do not build shared libraries [yes]"
  68. echo " --enable-gpl allow use of GPL code, the resulting libs"
  69. echo " and binaries will be under GPL [no]"
  70. echo " --enable-nonfree allow use of nonfree code, the resulting libs"
  71. echo " and binaries will be unredistributable [no]"
  72. echo " --enable-postproc enable GPLed postprocessing support [no]"
  73. echo " --enable-swscale enable GPLed software scaler support [no]"
  74. echo " --enable-avfilter video filter support (replaces vhook) [no]"
  75. echo " --enable-avfilter-lavf video filters dependent on avformat [no]"
  76. echo " --disable-vhook disable video hooking support"
  77. echo " --enable-beosthreads use BeOS threads [no]"
  78. echo " --enable-os2threads use OS/2 threads [no]"
  79. echo " --enable-pthreads use pthreads [no]"
  80. echo " --enable-w32threads use Win32 threads [no]"
  81. echo " --enable-x11grab enable X11 grabbing [no]"
  82. echo
  83. echo "External library support:"
  84. echo " --enable-mlib enable Sun medialib [no]"
  85. echo " --enable-avisynth enable reading of AVISynth script files [no]"
  86. echo " --enable-bzlib enable bzlib [no]"
  87. echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
  88. echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
  89. echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394"
  90. echo " and libraw1394 [no]"
  91. echo " --enable-libdirac enable Dirac support via libdirac [no]"
  92. echo " --enable-libfaac enable FAAC support via libfaac [no]"
  93. echo " --enable-libfaad enable FAAD support via libfaad [no]"
  94. echo " --enable-libfaadbin open libfaad.so.0 at runtime [no]"
  95. echo " --enable-libgsm enable GSM support via libgsm [no]"
  96. echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [no]"
  97. echo " --enable-libnut enable NUT (de)muxing via libnut,"
  98. echo " native (de)muxer exists [no]"
  99. echo " --enable-libschroedinger enable Dirac support via libschroedinger [no]"
  100. echo " --enable-libspeex enable Speex decoding via libspeex [no]"
  101. echo " --enable-libtheora enable Theora encoding via libtheora [no]"
  102. echo " --enable-libvorbis enable Vorbis encoding via libvorbis,"
  103. echo " native implementation exists [no]"
  104. echo " --enable-libx264 enable H.264 encoding via x264 [no]"
  105. echo " --enable-libxvid enable Xvid encoding via xvidcore,"
  106. echo " native MPEG-4/Xvid encoder exists [no]"
  107. echo " --enable-zlib enable zlib [no]"
  108. echo ""
  109. echo "Advanced options (experts only):"
  110. echo " --source-path=PATH path to source code [$source_path]"
  111. echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
  112. echo " --enable-cross-compile assume a cross-compiler is used"
  113. echo " --target-os=OS compiler targets OS [$target_os]"
  114. echo " --cc=CC use C compiler CC [$cc]"
  115. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  116. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  117. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  118. echo " --extra-version=STRING version string suffix []"
  119. echo " --build-suffix=SUFFIX library name suffix []"
  120. echo " --arch=ARCH select architecture [$arch]"
  121. echo " --cpu=CPU select the minimum required CPU (affects"
  122. echo " instruction selection, may crash on older CPUs)"
  123. echo " --enable-powerpc-perf enable performance report on PPC"
  124. echo " (requires enabling PMC)"
  125. echo " --disable-altivec disable AltiVec optimizations"
  126. echo " --disable-mmx disable MMX optimizations"
  127. echo " --disable-mmx2 disable MMX2 optimizations"
  128. echo " --disable-ssse3 disable SSSE3 optimizations"
  129. echo " --disable-armv5te disable armv5te optimizations"
  130. echo " --disable-armv6 disable armv6 optimizations"
  131. echo " --disable-armvfp disable ARM VFP optimizations"
  132. echo " --disable-iwmmxt disable iwmmxt optimizations"
  133. echo " --disable-mmi disable MMI optimizations"
  134. echo " --disable-neon disable neon optimizations"
  135. echo " --disable-vis disable VIS optimizations"
  136. echo " --disable-network disable network support [no]"
  137. echo " --disable-ipv6 disable IPv6 support [no]"
  138. echo " --disable-mpegaudio-hp faster (but less accurate)"
  139. echo " MPEG audio decoding [no]"
  140. echo " --disable-fft disable FFT code"
  141. echo " --disable-golomb disable Golomb code"
  142. echo " --disable-mdct disable MDCT code"
  143. echo " --enable-gray enable full grayscale support (slower color)"
  144. echo " --disable-ffmpeg disable ffmpeg build"
  145. echo " --disable-ffplay disable ffplay build"
  146. echo " --disable-ffserver disable ffserver build"
  147. echo " --enable-small optimize for size instead of speed"
  148. echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
  149. echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
  150. echo " --enable-beos-netserver enable BeOS netserver"
  151. echo " --disable-encoder=NAME disable encoder NAME"
  152. echo " --enable-encoder=NAME enable encoder NAME"
  153. echo " --disable-encoders disable all encoders"
  154. echo " --disable-decoder=NAME disable decoder NAME"
  155. echo " --enable-decoder=NAME enable decoder NAME"
  156. echo " --disable-decoders disable all decoders"
  157. echo " --disable-muxer=NAME disable muxer NAME"
  158. echo " --enable-muxer=NAME enable muxer NAME"
  159. echo " --disable-muxers disable all muxers"
  160. echo " --disable-demuxer=NAME disable demuxer NAME"
  161. echo " --enable-demuxer=NAME enable demuxer NAME"
  162. echo " --disable-demuxers disable all demuxers"
  163. echo " --enable-parser=NAME enable parser NAME"
  164. echo " --disable-parser=NAME disable parser NAME"
  165. echo " --disable-parsers disable all parsers"
  166. echo " --enable-bsf=NAME enable bitstream filter NAME"
  167. echo " --disable-bsf=NAME disable bitstream filter NAME"
  168. echo " --disable-bsfs disable all bitstream filters"
  169. echo " --enable-protocol=NAME enable protocol NAME"
  170. echo " --disable-protocol=NAME disable protocol NAME"
  171. echo " --disable-protocols disable all protocols"
  172. echo " --disable-indevs disable input devices"
  173. echo " --disable-outdevs disable output devices"
  174. echo " --disable-devices disable all devices"
  175. echo " --enable-filter=NAME enable filter NAME"
  176. echo " --disable-filter=NAME disable filter NAME"
  177. echo " --disable-filters disable all filters"
  178. echo " --list-decoders show all available decoders"
  179. echo " --list-encoders show all available encoders"
  180. echo " --list-muxers show all available muxers"
  181. echo " --list-demuxers show all available demuxers"
  182. echo " --list-parsers show all available parsers"
  183. echo " --list-protocols show all available protocols"
  184. echo " --list-bsfs show all available bitstream filters"
  185. echo " --list-indevs show all available input devices"
  186. echo " --list-outdevs show all available output devices"
  187. echo " --list-filters show all available filters"
  188. echo
  189. echo "Developer options (useful when working on FFmpeg itself):"
  190. echo " --disable-debug disable debugging symbols"
  191. echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
  192. echo " --enable-gprof enable profiling with gprof [$gprof]"
  193. echo " --disable-optimizations disable compiler optimizations"
  194. echo " --enable-extra-warnings enable more compiler warnings"
  195. echo " --disable-stripping disable stripping of executables and shared libraries"
  196. echo ""
  197. echo "NOTE: Object files are built at the place where configure is launched."
  198. exit 0
  199. }
  200. log(){
  201. echo "$@" >> $logfile
  202. }
  203. log_file(){
  204. log BEGIN $1
  205. pr -n -t $1 >> $logfile
  206. log END $1
  207. }
  208. echolog(){
  209. log "$@"
  210. echo "$@"
  211. }
  212. die(){
  213. echolog "$@"
  214. cat <<EOF
  215. If you think configure made a mistake, make sure you are using the latest
  216. version from SVN. If the latest version fails, report the problem to the
  217. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  218. EOF
  219. if disabled logging; then
  220. cat <<EOF
  221. Rerun configure with logging enabled (do not use --disable-logging), and
  222. include the log this produces with your report.
  223. EOF
  224. else
  225. cat <<EOF
  226. Include the log file "$logfile" produced by configure as this will help
  227. solving the problem.
  228. EOF
  229. fi
  230. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  231. exit 1
  232. }
  233. # Avoid locale weirdness, besides we really just want to translate ASCII.
  234. toupper(){
  235. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  236. }
  237. tolower(){
  238. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  239. }
  240. set_all(){
  241. value=$1
  242. shift
  243. for var in $*; do
  244. eval $var=$value
  245. done
  246. }
  247. set_weak(){
  248. value=$1
  249. shift
  250. for var; do
  251. eval : \${$var:=$value}
  252. done
  253. }
  254. pushvar(){
  255. for var in $*; do
  256. eval level=\${${var}_level:=0}
  257. eval ${var}_${level}="\$$var"
  258. eval ${var}_level=$(($level+1))
  259. done
  260. }
  261. popvar(){
  262. for var in $*; do
  263. eval level=\${${var}_level:-0}
  264. test $level = 0 && continue
  265. eval level=$(($level-1))
  266. eval $var="\${${var}_${level}}"
  267. eval ${var}_level=$level
  268. eval unset ${var}_${level}
  269. done
  270. }
  271. enable(){
  272. set_all yes $*
  273. }
  274. disable(){
  275. set_all no $*
  276. }
  277. enable_weak(){
  278. set_weak yes $*
  279. }
  280. disable_weak(){
  281. set_weak no $*
  282. }
  283. do_enable_deep(){
  284. for var; do
  285. enabled $var && continue
  286. eval sel="\$${var}_select"
  287. eval sgs="\$${var}_suggest"
  288. pushvar var sgs
  289. enable_deep $sel
  290. popvar sgs
  291. enable_deep_weak $sgs
  292. popvar var
  293. done
  294. }
  295. enable_deep(){
  296. do_enable_deep $*
  297. enable $*
  298. }
  299. enable_deep_weak(){
  300. do_enable_deep $*
  301. enable_weak $*
  302. }
  303. enabled(){
  304. test "${1#!}" = "$1" && op== || op=!=
  305. eval test "x\$${1#!}" $op "xyes"
  306. }
  307. disabled(){
  308. test "${1#!}" = "$1" && op== || op=!=
  309. eval test "x\$${1#!}" $op "xno"
  310. }
  311. enabled_all(){
  312. for opt; do
  313. enabled $opt || return 1
  314. done
  315. }
  316. disabled_all(){
  317. for opt; do
  318. disabled $opt || return 1
  319. done
  320. }
  321. enabled_any(){
  322. for opt; do
  323. enabled $opt && return 0
  324. done
  325. }
  326. disabled_any(){
  327. for opt; do
  328. disabled $opt && return 0
  329. done
  330. return 1
  331. }
  332. set_default(){
  333. for opt; do
  334. eval test -z "\$$opt" && eval $opt=\$${opt}_default
  335. done
  336. }
  337. is_in(){
  338. value=$1
  339. shift
  340. for var in $*; do
  341. [ $var = $value ] && return 0
  342. done
  343. return 1
  344. }
  345. check_deps(){
  346. for cfg; do
  347. cfg="${cfg#!}"
  348. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  349. disabled ${cfg}_checking && continue
  350. enable ${cfg}_checking
  351. eval dep_all="\$${cfg}_deps"
  352. eval dep_any="\$${cfg}_deps_any"
  353. eval dep_sel="\$${cfg}_select"
  354. eval dep_sgs="\$${cfg}_suggest"
  355. pushvar cfg dep_all dep_any dep_sel dep_sgs
  356. check_deps $dep_all $dep_any $dep_sel $dep_sgs
  357. popvar cfg dep_all dep_any dep_sel dep_sgs
  358. enabled_all $dep_all || disable $cfg
  359. enabled_any $dep_any || disable $cfg
  360. disabled_any $dep_sel && disable $cfg
  361. if enabled $cfg; then
  362. eval dep_extralibs="\$${cfg}_extralibs"
  363. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  364. enable_deep $dep_sel
  365. enable_deep_weak $dep_sgs
  366. fi
  367. disable ${cfg}_checking
  368. done
  369. }
  370. print_config(){
  371. pfx=$1
  372. header=$2
  373. makefile=$3
  374. shift 3
  375. for cfg; do
  376. ucname="`toupper $cfg`"
  377. if enabled $cfg; then
  378. echo "#define ${pfx}${ucname} 1" >> $header
  379. echo "#define ENABLE_${ucname} 1" >> $header
  380. echo "${pfx}${ucname}=yes" >> $makefile
  381. else
  382. echo "#define ENABLE_${ucname} 0" >> $header
  383. fi
  384. done
  385. }
  386. flags_saved(){
  387. (: ${SAVE_CFLAGS?}) 2> /dev/null
  388. }
  389. save_flags(){
  390. flags_saved && return
  391. SAVE_CFLAGS="$CFLAGS"
  392. SAVE_LDFLAGS="$LDFLAGS"
  393. SAVE_extralibs="$extralibs"
  394. }
  395. restore_flags(){
  396. flags_saved || return
  397. CFLAGS="$SAVE_CFLAGS"
  398. LDFLAGS="$SAVE_LDFLAGS"
  399. extralibs="$SAVE_extralibs"
  400. unset SAVE_CFLAGS
  401. unset SAVE_LDFLAGS
  402. unset SAVE_extralibs
  403. }
  404. temp_cflags(){
  405. save_flags
  406. CFLAGS="$CFLAGS $*"
  407. }
  408. temp_ldflags(){
  409. save_flags
  410. LDFLAGS="$LDFLAGS $*"
  411. }
  412. temp_extralibs(){
  413. save_flags
  414. extralibs="$extralibs $*"
  415. }
  416. append(){
  417. var=$1
  418. shift
  419. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  420. eval "$var=\"\$$var $*\""
  421. }
  422. add_cflags(){
  423. append CFLAGS "$@"
  424. }
  425. add_ldflags(){
  426. append LDFLAGS "$@"
  427. }
  428. add_extralibs(){
  429. append extralibs "$@"
  430. }
  431. check_cmd(){
  432. log "$@"
  433. "$@" >> $logfile 2>&1
  434. }
  435. check_cc(){
  436. log check_cc "$@"
  437. cat > $TMPC
  438. log_file $TMPC
  439. check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
  440. }
  441. check_cpp(){
  442. log check_cpp "$@"
  443. cat > $TMPC
  444. log_file $TMPC
  445. check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
  446. }
  447. check_asm(){
  448. log check_asm "$@"
  449. name="$1"
  450. asm="$2"
  451. shift 2
  452. check_cc "$@" <<EOF && enable $name || disable $name
  453. int foo(void){ __asm__ volatile($asm); }
  454. EOF
  455. }
  456. check_yasm(){
  457. log check_yasm "$@"
  458. echo "$1" > $TMPS
  459. log_file $TMPS
  460. shift 1
  461. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  462. }
  463. check_ld(){
  464. log check_ld "$@"
  465. check_cc || return
  466. flags=''
  467. libs=''
  468. for f; do
  469. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  470. done
  471. check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  472. }
  473. check_cflags(){
  474. log check_cflags "$@"
  475. check_cc "$@" <<EOF && add_cflags "$@"
  476. int x;
  477. EOF
  478. }
  479. check_ldflags(){
  480. log check_ldflags "$@"
  481. check_ld "$@" <<EOF && add_ldflags "$@"
  482. int main(void){ return 0; }
  483. EOF
  484. }
  485. check_header(){
  486. log check_header "$@"
  487. header=$1
  488. shift
  489. var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
  490. disable $var
  491. check_cpp "$@" <<EOF && enable $var
  492. #include <$header>
  493. int x;
  494. EOF
  495. }
  496. check_func(){
  497. log check_func "$@"
  498. func=$1
  499. shift
  500. disable $func
  501. check_ld "$@" <<EOF && enable $func
  502. extern int $func();
  503. int main(void){ $func(); }
  504. EOF
  505. }
  506. check_func_headers(){
  507. log check_func_headers "$@"
  508. headers=$1
  509. func=$2
  510. shift 2
  511. disable $func
  512. incs=""
  513. for hdr in $headers; do
  514. incs="$incs
  515. #include <$hdr>"
  516. done
  517. check_ld "$@" <<EOF && enable $func
  518. $incs
  519. int main(int argc, char **argv){
  520. (void) $func;
  521. return 0;
  522. }
  523. EOF
  524. }
  525. check_cpp_condition(){
  526. log check_cpp_condition "$@"
  527. header=$1
  528. condition=$2
  529. check_cpp <<EOF
  530. #include <$header>
  531. #if !($condition)
  532. #error "unsatisfied condition: $condition"
  533. #endif
  534. EOF
  535. }
  536. check_lib(){
  537. log check_lib "$@"
  538. header="$1"
  539. func="$2"
  540. shift 2
  541. temp_extralibs "$@"
  542. check_header $header && check_func $func && add_extralibs "$@"
  543. err=$?
  544. restore_flags
  545. return $err
  546. }
  547. check_lib2(){
  548. log check_lib2 "$@"
  549. headers="$1"
  550. func="$2"
  551. shift 2
  552. temp_extralibs "$@"
  553. check_func_headers "$headers" $func && add_extralibs "$@"
  554. err=$?
  555. restore_flags
  556. return $err
  557. }
  558. check_exec(){
  559. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  560. }
  561. check_exec_crash(){
  562. code=`cat`
  563. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  564. # are safe but may not be available everywhere. Thus we use
  565. # raise(SIGTERM) instead. The check is run in a subshell so we
  566. # can redirect the "Terminated" message from the shell. SIGBUS
  567. # is not defined by standard C so it is used conditionally.
  568. (check_exec "$@") >> $logfile 2>&1 <<EOF
  569. #include <signal.h>
  570. static void sighandler(int sig){
  571. raise(SIGTERM);
  572. }
  573. int main(void){
  574. signal(SIGILL, sighandler);
  575. signal(SIGFPE, sighandler);
  576. signal(SIGSEGV, sighandler);
  577. #ifdef SIGBUS
  578. signal(SIGBUS, sighandler);
  579. #endif
  580. { $code }
  581. }
  582. EOF
  583. }
  584. check_type(){
  585. log check_type "$@"
  586. headers=$1
  587. type=$2
  588. shift 2
  589. disable $type
  590. incs=""
  591. for hdr in $headers; do
  592. incs="$incs
  593. #include <$hdr>"
  594. done
  595. check_cc "$@" <<EOF && enable $type
  596. $incs
  597. $type v;
  598. EOF
  599. }
  600. require(){
  601. name="$1"
  602. header="$2"
  603. func="$3"
  604. shift 3
  605. check_lib $header $func "$@" || die "ERROR: $name not found"
  606. }
  607. require2(){
  608. name="$1"
  609. headers="$2"
  610. func="$3"
  611. shift 3
  612. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  613. }
  614. check_foo_config(){
  615. cfg=$1
  616. pkg=$2
  617. header=$3
  618. func=$4
  619. shift 4
  620. disable $cfg
  621. check_cmd ${pkg}-config --version
  622. err=$?
  623. if test "$err" = 0; then
  624. temp_cflags `${pkg}-config --cflags`
  625. temp_extralibs `${pkg}-config --libs`
  626. check_lib "$@" $header $func && enable $cfg
  627. fi
  628. return $err
  629. }
  630. apply(){
  631. file=$1
  632. shift
  633. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  634. }
  635. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  636. # system-dependent things.
  637. COMPONENT_LIST="
  638. bsfs
  639. decoders
  640. demuxers
  641. encoders
  642. filters
  643. indevs
  644. muxers
  645. outdevs
  646. parsers
  647. protocols
  648. "
  649. CONFIG_LIST="
  650. $COMPONENT_LIST
  651. avfilter
  652. avfilter_lavf
  653. avisynth
  654. beos_netserver
  655. bzlib
  656. ffmpeg
  657. ffplay
  658. ffserver
  659. fft
  660. golomb
  661. gpl
  662. gprof
  663. gray
  664. hardcoded_tables
  665. ipv6
  666. libamr_nb
  667. libamr_wb
  668. libdc1394
  669. libdirac
  670. libfaac
  671. libfaad
  672. libfaadbin
  673. libgsm
  674. libmp3lame
  675. libnut
  676. libschroedinger
  677. libspeex
  678. libtheora
  679. libvorbis
  680. libx264
  681. libxvid
  682. mdct
  683. memalign_hack
  684. mlib
  685. mpegaudio_hp
  686. network
  687. nonfree
  688. postproc
  689. powerpc_perf
  690. small
  691. swscale
  692. vhook
  693. x11grab
  694. zlib
  695. "
  696. THREADS_LIST='
  697. beosthreads
  698. os2threads
  699. pthreads
  700. w32threads
  701. '
  702. ARCH_LIST='
  703. alpha
  704. armv4l
  705. bfin
  706. ia64
  707. m68k
  708. mips
  709. parisc
  710. powerpc
  711. s390
  712. sh4
  713. sparc
  714. sparc64
  715. x86
  716. x86_32
  717. x86_64
  718. '
  719. ARCH_EXT_LIST='
  720. altivec
  721. armv5te
  722. armv6
  723. armvfp
  724. iwmmxt
  725. mmi
  726. mmx
  727. mmx2
  728. neon
  729. ssse3
  730. vis
  731. '
  732. HAVE_LIST="
  733. $ARCH_EXT_LIST
  734. $THREADS_LIST
  735. altivec_h
  736. arpa_inet_h
  737. bswap
  738. closesocket
  739. cmov
  740. conio_h
  741. dcbzl
  742. dev_bktr_ioctl_bt848_h
  743. dev_bktr_ioctl_meteor_h
  744. dev_ic_bt8xx_h
  745. dev_video_meteor_ioctl_meteor_h
  746. dev_video_bktr_ioctl_bt848_h
  747. dlfcn_h
  748. dlopen
  749. dos_paths
  750. ebp_available
  751. ebx_available
  752. fast_64bit
  753. fast_cmov
  754. fast_unaligned
  755. fork
  756. freetype2
  757. gethrtime
  758. GetProcessTimes
  759. getrusage
  760. imlib2
  761. inet_aton
  762. inline_asm
  763. libdc1394_1
  764. libdc1394_2
  765. llrint
  766. lrint
  767. lrintf
  768. machine_ioctl_bt848_h
  769. machine_ioctl_meteor_h
  770. malloc_h
  771. memalign
  772. mkstemp
  773. pld
  774. ppc64
  775. round
  776. roundf
  777. sdl
  778. sdl_video_size
  779. socklen_t
  780. soundcard_h
  781. poll_h
  782. sys_mman_h
  783. sys_resource_h
  784. sys_select_h
  785. sys_soundcard_h
  786. sys_videoio_h
  787. termios_h
  788. threads
  789. winsock2_h
  790. yasm
  791. "
  792. # options emitted with CONFIG_ prefix but not available on command line
  793. CONFIG_EXTRA="
  794. fft_mmx
  795. "
  796. CMDLINE_SELECT="
  797. $ARCH_EXT_LIST
  798. $CONFIG_LIST
  799. $THREADS_LIST
  800. cross_compile
  801. debug
  802. extra_warnings
  803. logging
  804. optimizations
  805. shared
  806. static
  807. stripping
  808. "
  809. PATHS_LIST='
  810. bindir
  811. incdir
  812. libdir
  813. mandir
  814. prefix
  815. shlibdir
  816. '
  817. CMDLINE_SET="
  818. $PATHS_LIST
  819. arch
  820. build_suffix
  821. cc
  822. cpu
  823. cross_prefix
  824. extra_version
  825. logfile
  826. source_path
  827. target_os
  828. "
  829. # code dependency declarations
  830. # architecture extensions
  831. altivec_deps="powerpc"
  832. armv5te_deps="armv4l"
  833. armv6_deps="armv4l"
  834. armvfp_deps="armv4l"
  835. iwmmxt_deps="armv4l"
  836. mmi_deps="mips"
  837. mmx_deps="x86"
  838. mmx2_deps="x86 mmx"
  839. neon_deps="armv4l"
  840. ssse3_deps="x86"
  841. vis_deps="sparc"
  842. # common features
  843. fft_suggest="fft_mmx"
  844. fft_mmx_deps="mmx yasm"
  845. # decoders / encoders
  846. aac_decoder_select="fft mdct"
  847. ac3_decoder_deps="gpl"
  848. ac3_decoder_select="fft mdct"
  849. atrac3_decoder_select="fft mdct"
  850. cavs_decoder_select="golomb"
  851. cook_decoder_select="fft mdct"
  852. cscd_decoder_suggest="zlib"
  853. dca_decoder_select="fft mdct"
  854. dxa_decoder_select="zlib"
  855. eac3_decoder_deps="gpl"
  856. eac3_decoder_select="fft mdct"
  857. ffv1_decoder_select="golomb"
  858. flac_decoder_select="golomb"
  859. flac_encoder_select="golomb"
  860. flashsv_decoder_select="zlib"
  861. flashsv_encoder_select="zlib"
  862. h264_decoder_select="golomb"
  863. imc_decoder_select="fft mdct"
  864. jpegls_decoder_select="golomb"
  865. jpegls_encoder_select="golomb"
  866. loco_decoder_select="golomb"
  867. mpeg_xvmc_decoder_deps="xvmc"
  868. nellymoser_decoder_select="fft mdct"
  869. nellymoser_encoder_select="fft mdct"
  870. png_decoder_select="zlib"
  871. png_encoder_select="zlib"
  872. qdm2_decoder_select="fft mdct"
  873. shorten_decoder_select="golomb"
  874. sonic_decoder_select="golomb"
  875. sonic_encoder_select="golomb"
  876. sonic_ls_encoder_select="golomb"
  877. svq3_decoder_select="golomb"
  878. svq3_decoder_suggest="zlib"
  879. tiff_decoder_suggest="zlib"
  880. tiff_encoder_suggest="zlib"
  881. tscc_decoder_select="zlib"
  882. vorbis_decoder_select="fft mdct"
  883. vorbis_encoder_select="fft mdct"
  884. wmav1_decoder_select="fft mdct"
  885. wmav1_encoder_select="fft mdct"
  886. wmav2_decoder_select="fft mdct"
  887. wmav2_encoder_select="fft mdct"
  888. zlib_decoder_select="zlib"
  889. zlib_encoder_select="zlib"
  890. zmbv_decoder_select="zlib"
  891. zmbv_encoder_select="zlib"
  892. # external libraries
  893. libamr_nb_decoder_deps="libamr_nb"
  894. libamr_nb_encoder_deps="libamr_nb"
  895. libamr_wb_decoder_deps="libamr_wb"
  896. libamr_wb_encoder_deps="libamr_wb"
  897. libdirac_decoder_deps="libdirac !libschroedinger"
  898. libdirac_encoder_deps="libdirac"
  899. libfaac_encoder_deps="libfaac"
  900. libfaad_decoder_deps="libfaad"
  901. libfaadbin_decoder_extralibs='$ldl'
  902. libgsm_decoder_deps="libgsm"
  903. libgsm_encoder_deps="libgsm"
  904. libgsm_ms_decoder_deps="libgsm"
  905. libgsm_ms_encoder_deps="libgsm"
  906. libmp3lame_encoder_deps="libmp3lame"
  907. libschroedinger_decoder_deps="libschroedinger"
  908. libschroedinger_encoder_deps="libschroedinger"
  909. libspeex_decoder_deps="libspeex"
  910. libtheora_encoder_deps="libtheora"
  911. libvorbis_encoder_deps="libvorbis"
  912. libx264_encoder_deps="libx264"
  913. libxvid_encoder_deps="libxvid"
  914. mpeg4aac_decoder_deps="libfaad"
  915. # demuxers / muxers
  916. ac3_demuxer_deps="ac3_parser"
  917. audio_beos_demuxer_deps="audio_beos"
  918. audio_beos_demuxer_extralibs="-lmedia -lbe"
  919. audio_beos_muxer_deps="audio_beos"
  920. audio_beos_muxer_extralibs="-lmedia -lbe"
  921. avisynth_demuxer_deps="avisynth"
  922. bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  923. dirac_demuxer_deps="dirac_parser"
  924. dv1394_demuxer_deps="dv1394 dv_demuxer"
  925. libdc1394_demuxer_deps="libdc1394"
  926. libnut_demuxer_deps="libnut"
  927. libnut_muxer_deps="libnut"
  928. matroska_demuxer_suggest="zlib bzlib"
  929. mov_demuxer_suggest="zlib"
  930. mp3_demuxer_deps="mpegaudio_parser"
  931. oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  932. oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  933. redir_demuxer_deps="network"
  934. rtp_muxer_deps="network rtp_protocol"
  935. rtsp_demuxer_deps="sdp_demuxer"
  936. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  937. v4l_demuxer_deps="linux_videodev_h"
  938. v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
  939. vfwcap_demuxer_deps="capCreateCaptureWindow"
  940. vfwcap_demuxer_extralibs="-lvfw32"
  941. x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  942. x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  943. # protocols
  944. http_protocol_deps="network"
  945. rtp_protocol_deps="udp_protocol"
  946. tcp_protocol_deps="network"
  947. udp_protocol_deps="network"
  948. # filters
  949. movie_filter_deps="avfilter_lavf"
  950. # programs
  951. ffplay_deps="sdl"
  952. ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  953. ffserver_extralibs='$ldl'
  954. vhook_extralibs='$ldl'
  955. # default parameters
  956. logfile="config.err"
  957. # installation paths
  958. prefix_default="/usr/local"
  959. bindir_default='${prefix}/bin'
  960. incdir_default='${prefix}/include'
  961. libdir_default='${prefix}/lib'
  962. mandir_default='${prefix}/share/man'
  963. shlibdir_default="$libdir_default"
  964. # toolchain
  965. cc_default="gcc"
  966. yasmexe="yasm"
  967. ar="ar"
  968. nm="nm"
  969. ranlib="ranlib"
  970. strip="strip"
  971. asmalign_pot="unknown"
  972. ln_s="ln -sf"
  973. objformat="elf"
  974. # machine
  975. arch=`uname -m`
  976. cpu="generic"
  977. # OS
  978. target_os=$(tolower $(uname -s))
  979. # configurable options
  980. enable debug
  981. enable ffmpeg
  982. enable ffplay
  983. enable ffserver
  984. enable ipv6
  985. enable mpegaudio_hp
  986. enable network
  987. enable optimizations
  988. enable protocols
  989. enable static
  990. enable stripping
  991. vhook="default"
  992. # build settings
  993. add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  994. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  995. VHOOKSHFLAGS='$(SHFLAGS)'
  996. FFSERVERLDFLAGS=-Wl,-E
  997. LIBPREF="lib"
  998. LIBSUF=".a"
  999. FULLNAME='$(NAME)$(BUILDSUF)'
  1000. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1001. SLIBPREF="lib"
  1002. SLIBSUF=".so"
  1003. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1004. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1005. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1006. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1007. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1008. # full relative path for objects in subdirectories for non-recursive Make.
  1009. DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
  1010. # find source path
  1011. source_path="`dirname \"$0\"`"
  1012. enable source_path_used
  1013. if test -z "$source_path" -o "$source_path" = "." ; then
  1014. source_path="`pwd`"
  1015. disable source_path_used
  1016. else
  1017. source_path="`cd \"$source_path\"; pwd`"
  1018. echo "$source_path" | grep -q '[[:blank:]]' &&
  1019. die "Out of tree builds are impossible with whitespace in source path."
  1020. fi
  1021. FFMPEG_CONFIGURATION="$@"
  1022. find_things(){
  1023. thing=$1
  1024. pattern=$2
  1025. file=$source_path/$3
  1026. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1027. }
  1028. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1029. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1030. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1031. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1032. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1033. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1034. OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
  1035. INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
  1036. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1037. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1038. enable $ARCH_EXT_LIST \
  1039. $DECODER_LIST \
  1040. $ENCODER_LIST \
  1041. $PARSER_LIST \
  1042. $BSF_LIST \
  1043. $DEMUXER_LIST \
  1044. $MUXER_LIST \
  1045. $FILTER_LIST \
  1046. $PROTOCOL_LIST \
  1047. $INDEV_LIST \
  1048. $OUTDEV_LIST \
  1049. die_unknown(){
  1050. echo "Unknown option \"$1\"."
  1051. echo "See $0 --help for available options."
  1052. exit 1
  1053. }
  1054. show_list() {
  1055. suffix=_$1
  1056. shift
  1057. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  1058. exit 0
  1059. }
  1060. for opt do
  1061. optval="${opt#*=}"
  1062. case "$opt" in
  1063. --extra-cflags=*) add_cflags "$optval"
  1064. ;;
  1065. --extra-ldflags=*) add_ldflags "$optval"
  1066. ;;
  1067. --extra-libs=*) add_extralibs "$optval"
  1068. ;;
  1069. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1070. ;;
  1071. --enable-debug=*) debuglevel="$optval"
  1072. ;;
  1073. --enable-*=*|--disable-*=*)
  1074. eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
  1075. case "$thing" in
  1076. encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
  1077. *) die_unknown "$opt" ;;
  1078. esac
  1079. ;;
  1080. --enable-?*|--disable-?*)
  1081. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  1082. if is_in $option $COMPONENT_LIST; then
  1083. eval $action \$$(toupper ${option%s})_LIST
  1084. elif is_in $option $CMDLINE_SELECT; then
  1085. $action $option
  1086. else
  1087. die_unknown $opt
  1088. fi
  1089. ;;
  1090. --list-*)
  1091. NAME="${opt#--list-}"
  1092. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1093. NAME=${NAME%s}
  1094. eval show_list $NAME \$$(toupper $NAME)_LIST
  1095. ;;
  1096. --help|-h) show_help
  1097. ;;
  1098. *)
  1099. optname="${opt%%=*}"
  1100. optname="${optname#--}"
  1101. optname=$(echo "$optname" | sed 's/-/_/g')
  1102. is_in $optname $CMDLINE_SET || die_unknown $opt
  1103. eval $optname='$optval'
  1104. ;;
  1105. esac
  1106. done
  1107. disabled logging && logfile=/dev/null
  1108. echo "# $0 $@" > $logfile
  1109. set >> $logfile
  1110. cc_default="${cross_prefix}${cc_default}"
  1111. yasmexe="${cross_prefix}${yasmexe}"
  1112. ar="${cross_prefix}${ar}"
  1113. nm="${cross_prefix}${nm}"
  1114. ranlib="${cross_prefix}${ranlib}"
  1115. strip="${cross_prefix}${strip}"
  1116. set_default cc
  1117. # set temporary file name
  1118. if test ! -z "$TMPDIR" ; then
  1119. TMPDIR1="${TMPDIR}"
  1120. elif test ! -z "$TEMPDIR" ; then
  1121. TMPDIR1="${TEMPDIR}"
  1122. else
  1123. TMPDIR1="/tmp"
  1124. fi
  1125. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  1126. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
  1127. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  1128. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  1129. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  1130. TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
  1131. check_cflags -std=c99
  1132. case "$arch" in
  1133. i386|i486|i586|i686|i86pc|BePC)
  1134. arch="x86_32"
  1135. enable fast_unaligned
  1136. ;;
  1137. x86_64|amd64)
  1138. arch="x86_32"
  1139. enable cmov
  1140. enable fast_cmov
  1141. enable fast_unaligned
  1142. check_cc <<EOF && enable fast_64bit && arch="x86_64"
  1143. int test[sizeof(char*) - 7];
  1144. EOF
  1145. ;;
  1146. # armv4l is a subset of armv[567]*l
  1147. arm|armv[4567]*l)
  1148. arch="armv4l"
  1149. ;;
  1150. alpha)
  1151. arch="alpha"
  1152. enable fast_64bit
  1153. ;;
  1154. "Power Macintosh"|ppc|powerpc)
  1155. arch="powerpc"
  1156. enable fast_unaligned
  1157. ;;
  1158. ppc64)
  1159. arch="powerpc"
  1160. enable fast_64bit
  1161. enable fast_unaligned
  1162. ;;
  1163. mips|mipsel|IP*)
  1164. arch="mips"
  1165. ;;
  1166. sun4u|sparc64)
  1167. arch="sparc64"
  1168. enable fast_64bit
  1169. ;;
  1170. sparc)
  1171. arch="sparc"
  1172. ;;
  1173. sh4)
  1174. arch="sh4"
  1175. ;;
  1176. parisc)
  1177. arch="parisc"
  1178. ;;
  1179. parisc64)
  1180. arch="parisc"
  1181. enable fast_64bit
  1182. ;;
  1183. s390|s390x)
  1184. arch="s390"
  1185. ;;
  1186. m68k)
  1187. arch="m68k"
  1188. ;;
  1189. ia64)
  1190. arch="ia64"
  1191. enable fast_64bit
  1192. ;;
  1193. bfin)
  1194. arch="bfin"
  1195. ;;
  1196. *)
  1197. arch="unknown"
  1198. ;;
  1199. esac
  1200. enable $arch
  1201. enabled_any x86_32 x86_64 && enable x86
  1202. enabled sparc64 && enable sparc
  1203. # OS specific
  1204. case $target_os in
  1205. beos|haiku|zeta)
  1206. prefix_default="$HOME/config"
  1207. # helps building libavcodec
  1208. add_cflags "-DPIC -fomit-frame-pointer"
  1209. # 3 gcc releases known for BeOS, each with ugly bugs
  1210. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1211. case "$gcc_version" in
  1212. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1213. disable mmx
  1214. ;;
  1215. *20010315*) echo "BeBits gcc"
  1216. add_cflags "-fno-expensive-optimizations"
  1217. ;;
  1218. esac
  1219. SHFLAGS=-nostart
  1220. # enable BeOS things
  1221. enable audio_beos
  1222. # no need for libm, but the inet stuff
  1223. # Check for BONE
  1224. # XXX: actually should check for NOT net_server
  1225. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1226. network_extralibs="-lbind -lsocket"
  1227. else
  1228. enable beos_netserver
  1229. network_extralibs="-lnet"
  1230. fi ;;
  1231. sunos)
  1232. FFSERVERLDFLAGS=""
  1233. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1234. network_extralibs="-lsocket -lnsl"
  1235. ;;
  1236. netbsd)
  1237. oss_demuxer_extralibs="-lossaudio"
  1238. oss_muxer_extralibs="-lossaudio"
  1239. ;;
  1240. openbsd)
  1241. disable need_memalign
  1242. LIBOBJFLAGS='$(PIC)'
  1243. SHFLAGS='-shared'
  1244. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
  1245. SLIBNAME_WITH_VERSION='$(SLIBNAME)'
  1246. SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
  1247. oss_demuxer_extralibs="-lossaudio"
  1248. oss_muxer_extralibs="-lossaudio"
  1249. ;;
  1250. freebsd)
  1251. disable need_memalign
  1252. ;;
  1253. bsd/os)
  1254. osextralibs="-lpoll -lgnugetopt"
  1255. strip="strip -d"
  1256. ;;
  1257. darwin)
  1258. disable need_memalign
  1259. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1260. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
  1261. strip="strip -x"
  1262. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1263. SLIBSUF=".dylib"
  1264. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1265. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1266. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1267. objformat="macho"
  1268. enabled x86_64 && objformat="macho64"
  1269. ;;
  1270. mingw32*)
  1271. target_os=mingw32
  1272. LIBTARGET=i386
  1273. if test $arch = x86_64; then
  1274. disable need_memalign
  1275. LIBTARGET=x64
  1276. fi
  1277. shlibdir_default="$bindir_default"
  1278. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1279. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1280. if enabled swscale; then
  1281. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1282. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1283. fi
  1284. disable ffserver
  1285. SLIBPREF=""
  1286. SLIBSUF=".dll"
  1287. EXESUF=".exe"
  1288. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1289. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1290. SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1291. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1292. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1293. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1294. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1295. objformat="win32"
  1296. enable dos_paths
  1297. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1298. die "ERROR: MinGW runtime version must be >= 3.15."
  1299. enabled_any avisynth vfwcap_demuxer &&
  1300. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 12)" ||
  1301. die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.12 or later."; }
  1302. ;;
  1303. cygwin*)
  1304. target_os=cygwin
  1305. shlibdir_default="$bindir_default"
  1306. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1307. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1308. if enabled swscale; then
  1309. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1310. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1311. fi
  1312. EXESUF=".exe"
  1313. SLIBPREF="cyg"
  1314. SLIBSUF=".dll"
  1315. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1316. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1317. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1318. objformat="win32"
  1319. enable dos_paths
  1320. ;;
  1321. *-dos|freedos|opendos)
  1322. disable ffplay ffserver vhook
  1323. disable $INDEV_LIST $OUTDEV_LIST
  1324. network_extralibs="-lsocket"
  1325. EXESUF=".exe"
  1326. objformat="win32"
  1327. enable dos_paths
  1328. ;;
  1329. linux)
  1330. enable dv1394
  1331. ;;
  1332. irix*)
  1333. target_os=irix
  1334. ranlib="echo ignoring ranlib"
  1335. ;;
  1336. os/2*)
  1337. strip="lxlite"
  1338. ln_s="cp -f"
  1339. EXESUF=".exe"
  1340. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1341. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1342. FFSERVERLDFLAGS=""
  1343. LIBSUF="_s.a"
  1344. SLIBPREF=""
  1345. SLIBSUF=".dll"
  1346. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1347. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1348. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1349. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1350. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1351. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1352. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1353. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1354. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1355. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1356. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1357. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1358. disable vhook
  1359. enable dos_paths
  1360. ;;
  1361. interix)
  1362. disable vhook
  1363. ;;
  1364. *)
  1365. target_os="${target_os}-UNKNOWN"
  1366. ;;
  1367. esac
  1368. set_default $PATHS_LIST
  1369. add_extralibs $osextralibs
  1370. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1371. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1372. test -n "$cross_prefix" && enable cross_compile
  1373. # we need to build at least one lib type
  1374. if ! enabled_any static shared; then
  1375. cat <<EOF
  1376. At least one library type must be built.
  1377. Specify --enable-static to build the static libraries or --enable-shared to
  1378. build the shared libraries as well. To only build the shared libraries specify
  1379. --disable-static in addition to --enable-shared.
  1380. EOF
  1381. exit 1;
  1382. fi
  1383. disabled static && LIBNAME=""
  1384. if enabled_any libfaad libfaadbin ; then
  1385. if check_header faad.h; then
  1386. check_cc <<EOF
  1387. #include <faad.h>
  1388. #ifndef FAAD2_VERSION
  1389. ok faad1
  1390. #endif
  1391. int main(void) { return 0; }
  1392. EOF
  1393. test $? = 0 && enable libfaad2
  1394. else
  1395. die "FAAD test failed."
  1396. fi
  1397. fi
  1398. if ! enabled gpl; then
  1399. die_gpl_disabled(){
  1400. name=$1
  1401. shift
  1402. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1403. }
  1404. die_gpl_disabled "The Postprocessing code" postproc
  1405. die_gpl_disabled "libx264" libx264
  1406. die_gpl_disabled "libxvidcore" libxvid
  1407. die_gpl_disabled "FAAD2" libfaad2
  1408. die_gpl_disabled "The X11 grabber" x11grab
  1409. die_gpl_disabled "The software scaler" swscale
  1410. fi
  1411. if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1412. die "libamr is nonfree and --enable-nonfree is not specified."
  1413. fi
  1414. check_deps $ARCH_EXT_LIST
  1415. test -z "$need_memalign" && need_memalign="$mmx"
  1416. #Darwin CC versions
  1417. if test $target_os = darwin; then
  1418. if $cc -v 2>&1 | grep -q xlc; then
  1419. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1420. else
  1421. add_cflags "-pipe"
  1422. check_cflags "-force_cpusubtype_ALL"
  1423. check_cflags "-Wno-sign-compare"
  1424. enabled shared || check_cflags -mdynamic-no-pic
  1425. fi
  1426. fi
  1427. disabled optimizations || check_cflags -fomit-frame-pointer
  1428. # Add processor-specific flags
  1429. if test $cpu != "generic"; then
  1430. warn_altivec(){
  1431. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1432. }
  1433. case $cpu in
  1434. 601|ppc601|PowerPC601)
  1435. add_cflags "-mcpu=601"
  1436. warn_altivec enabled PPC601
  1437. ;;
  1438. 603*|ppc603*|PowerPC603*)
  1439. add_cflags "-mcpu=603"
  1440. warn_altivec enabled PPC603
  1441. ;;
  1442. 604*|ppc604*|PowerPC604*)
  1443. add_cflags "-mcpu=604"
  1444. warn_altivec enabled PPC604
  1445. ;;
  1446. G3|g3|75*|ppc75*|PowerPC75*)
  1447. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1448. warn_altivec enabled PPC75x
  1449. ;;
  1450. G4|g4|745*|ppc745*|PowerPC745*)
  1451. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1452. warn_altivec disabled PPC745x
  1453. ;;
  1454. 74*|ppc74*|PowerPC74*)
  1455. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1456. warn_altivec disabled PPC74xx
  1457. ;;
  1458. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1459. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1460. warn_altivec disabled PPC970
  1461. enable ppc64
  1462. ;;
  1463. Cell|CELL|cell)
  1464. add_cflags "-mcpu=cell"
  1465. warn_altivec disabled Cell
  1466. enable ppc64
  1467. ;;
  1468. # targets that do NOT support conditional mov (cmov)
  1469. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1470. add_cflags "-march=$cpu"
  1471. disable cmov
  1472. ;;
  1473. # targets that do support conditional mov (cmov)
  1474. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1475. add_cflags "-march=$cpu"
  1476. enable cmov
  1477. enable fast_cmov
  1478. ;;
  1479. # targets that do support conditional mov but on which it's slow
  1480. pentium4|pentium4m|prescott|nocona)
  1481. add_cflags "-march=$cpu"
  1482. enable cmov
  1483. disable fast_cmov
  1484. ;;
  1485. sparc64)
  1486. add_cflags "-mcpu=v9"
  1487. ;;
  1488. arm11*|cortex*)
  1489. add_cflags "-mcpu=$cpu"
  1490. enable fast_unaligned
  1491. ;;
  1492. armv*)
  1493. add_cflags "-march=$cpu"
  1494. ;;
  1495. arm*)
  1496. add_cflags "-mcpu=$cpu"
  1497. ;;
  1498. *)
  1499. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1500. ;;
  1501. esac
  1502. fi
  1503. # make sure we can execute files in $TMPDIR
  1504. cat > $TMPSH 2>> $logfile <<EOF
  1505. #! /bin/sh
  1506. EOF
  1507. chmod +x $TMPSH >> $logfile 2>&1
  1508. if ! $TMPSH >> $logfile 2>&1; then
  1509. cat <<EOF
  1510. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1511. variable to another directory and make sure that $TMPDIR1 is not mounted
  1512. noexec.
  1513. EOF
  1514. die "Sanity test failed."
  1515. fi
  1516. rm $TMPSH
  1517. # compiler sanity check
  1518. check_exec <<EOF
  1519. int main(void){ return 0; }
  1520. EOF
  1521. if test "$?" != 0; then
  1522. echo "$cc is unable to create an executable file."
  1523. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1524. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1525. echo "Only do this if you know what cross compiling means."
  1526. fi
  1527. die "C compiler test failed."
  1528. fi
  1529. check_cc <<EOF || die "Symbol mangling check failed."
  1530. int ff_extern;
  1531. EOF
  1532. sym=$($nm -P -g $TMPO | grep ff_extern)
  1533. extern_prefix=${sym%%ff_extern*}
  1534. check_asm inline_asm '""'
  1535. if enabled x86; then
  1536. # check whether EBP is available on x86
  1537. # As 'i' is stored on the stack, this program will crash
  1538. # if the base pointer is used to access it because the
  1539. # base pointer is cleared in the inline assembly code.
  1540. check_exec_crash <<EOF && enable ebp_available
  1541. volatile int i=0;
  1542. __asm__ volatile (
  1543. "xorl %%ebp, %%ebp"
  1544. ::: "%ebp");
  1545. return i;
  1546. EOF
  1547. # check wether EBX is available on x86
  1548. check_asm ebx_available '"":::"%ebx"'
  1549. # check whether binutils is new enough to compile SSSE3/MMX2
  1550. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1551. enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
  1552. check_asm bswap '"bswap %%eax" ::: "%eax"'
  1553. YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
  1554. enabled x86_64 && append YASMFLAGS "-m amd64"
  1555. enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1556. case "$objformat" in
  1557. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1558. macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
  1559. *) append YASMFLAGS "-DPREFIX" ;;
  1560. esac
  1561. check_yasm "pabsw xmm0, xmm0" && enable yasm
  1562. fi
  1563. # check for assembler specific support
  1564. if test $arch = "powerpc"; then
  1565. check_asm dcbzl '"dcbzl 0, 1"'
  1566. fi
  1567. # check for SIMD availability
  1568. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1569. if enabled altivec; then
  1570. check_cflags -maltivec -mabi=altivec &&
  1571. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1572. check_cflags -faltivec
  1573. # check if our compiler supports Motorola AltiVec C API
  1574. check_cc <<EOF || disable altivec
  1575. $inc_altivec_h
  1576. int main(void) {
  1577. vector signed int v1, v2, v3;
  1578. v1 = vec_add(v2,v3);
  1579. return 0;
  1580. }
  1581. EOF
  1582. # check if our compiler supports braces for vector declarations
  1583. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1584. $inc_altivec_h
  1585. int main (void) { (vector int) {1}; return 0; }
  1586. EOF
  1587. fi
  1588. # We have to check if pld is a nop and disable it.
  1589. enabled armv4l && check_asm pld '"pld [r0]"'
  1590. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1591. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1592. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  1593. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1594. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1595. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  1596. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1597. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1598. # ---
  1599. # big/little-endian test
  1600. check_cc <<EOF || die "endian test failed"
  1601. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1602. EOF
  1603. od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1604. # ---
  1605. # check availability of some header files
  1606. if check_func dlopen; then
  1607. ldl=
  1608. elif check_func dlopen -ldl; then
  1609. ldl=-ldl
  1610. fi
  1611. check_func fork
  1612. check_func gethrtime
  1613. check_func getrusage
  1614. check_func inet_aton $network_extralibs
  1615. check_func memalign
  1616. check_func mkstemp
  1617. check_func_headers windows.h GetProcessTimes
  1618. check_header conio.h
  1619. check_header dlfcn.h
  1620. check_header malloc.h
  1621. check_header poll.h
  1622. check_header sys/mman.h
  1623. check_header sys/resource.h
  1624. check_header sys/select.h
  1625. check_header termios.h
  1626. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1627. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1628. fi
  1629. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  1630. disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1631. # check for some common methods of building with pthread support
  1632. # do this before the optional library checks as some of them require pthreads
  1633. if enabled pthreads; then
  1634. if check_func pthread_create; then
  1635. :
  1636. elif check_func pthread_create -pthread; then
  1637. add_cflags -pthread
  1638. add_extralibs -pthread
  1639. elif check_func pthread_create -pthreads; then
  1640. add_cflags -pthreads
  1641. add_extralibs -pthreads
  1642. elif check_func pthread_create -lpthreadGC2; then
  1643. add_extralibs -lpthreadGC2
  1644. elif ! check_lib pthread.h pthread_create -lpthread; then
  1645. die "ERROR: can't find pthreads library"
  1646. fi
  1647. fi
  1648. for thread in $THREADS_LIST; do
  1649. if enabled $thread; then
  1650. test -n "$thread_type" &&
  1651. die "ERROR: Only one thread type must be selected." ||
  1652. thread_type="$thread"
  1653. fi
  1654. done
  1655. check_lib math.h sin -lm
  1656. # test for C99 functions in math.h
  1657. for func in llrint lrint lrintf round roundf; do
  1658. check_exec <<EOF && enable $func || disable $func
  1659. #include <math.h>
  1660. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1661. EOF
  1662. done
  1663. # these are off by default, so fail if requested and not available
  1664. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1665. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1666. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1667. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  1668. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
  1669. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1670. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1671. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1672. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1673. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  1674. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1675. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  1676. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1677. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  1678. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1679. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1680. enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
  1681. { check_cpp_condition x264.h "X264_BUILD >= 65" ||
  1682. die "ERROR: libx264 version must be >= 0.65."; }
  1683. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  1684. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1685. # libdc1394 check
  1686. if enabled libdc1394; then
  1687. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1688. enable libdc1394_2; } ||
  1689. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1690. enable libdc1394_1; } ||
  1691. die "ERROR: No version of libdc1394 found "
  1692. fi
  1693. _restrict=
  1694. for restrict_keyword in restrict __restrict__ __restrict; do
  1695. check_cc <<EOF && _restrict=$restrict_keyword && break
  1696. void foo(char * $restrict_keyword p);
  1697. EOF
  1698. done
  1699. test "$vhook" = "default" && vhook="$dlopen"
  1700. if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
  1701. disable vhook
  1702. echo
  1703. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1704. echo "Patches welcome."
  1705. echo
  1706. fi
  1707. if enabled vhook; then
  1708. check_ldflags -rdynamic
  1709. check_ldflags -export-dynamic
  1710. fi
  1711. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1712. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1713. ##########################################
  1714. # SDL check
  1715. disable sdl_too_old
  1716. disable sdl
  1717. SDL_CONFIG="${cross_prefix}sdl-config"
  1718. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1719. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1720. temp_cflags $sdl_cflags
  1721. temp_extralibs `"${SDL_CONFIG}" --libs`
  1722. if check_lib2 SDL.h SDL_Init; then
  1723. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1724. if test "$_sdlversion" -lt 121 ; then
  1725. enable sdl_too_old
  1726. else
  1727. enable sdl
  1728. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1729. #include <SDL.h>
  1730. int main(int argc, char **argv){
  1731. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1732. int w = vi->current_w;
  1733. return 0;
  1734. }
  1735. EOF
  1736. fi
  1737. fi
  1738. restore_flags
  1739. fi
  1740. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1741. ##########################################
  1742. # Network check
  1743. if enabled network; then
  1744. check_type sys/socket.h socklen_t
  1745. # Prefer arpa/inet.h over winsock2
  1746. if check_header arpa/inet.h ; then
  1747. check_func closesocket
  1748. elif check_header winsock2.h ; then
  1749. network_extralibs="-lws2_32"
  1750. check_type ws2tcpip.h socklen_t
  1751. check_func_headers winsock2.h closesocket
  1752. fi
  1753. fi
  1754. ##########################################
  1755. # IPv6 check
  1756. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1757. #include <sys/types.h>
  1758. #include <sys/socket.h>
  1759. #include <netinet/in.h>
  1760. #include <netdb.h>
  1761. int main(void) {
  1762. struct sockaddr_storage saddr;
  1763. struct ipv6_mreq mreq6;
  1764. getaddrinfo(0,0,0,0);
  1765. getnameinfo(0,0,0,0,0,0,0);
  1766. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1767. }
  1768. EOF
  1769. check_header linux/videodev.h
  1770. check_header linux/videodev2.h
  1771. check_header sys/videoio.h
  1772. check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1773. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1774. { check_header dev/bktr/ioctl_meteor.h &&
  1775. check_header dev/bktr/ioctl_bt848.h; } ||
  1776. { check_header machine/ioctl_meteor.h &&
  1777. check_header machine/ioctl_bt848.h; } ||
  1778. { check_header dev/video/meteor/ioctl_meteor.h &&
  1779. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1780. check_header dev/ic/bt8xx.h
  1781. check_header sys/soundcard.h
  1782. check_header soundcard.h
  1783. # deal with the X11 frame grabber
  1784. enabled x11grab &&
  1785. check_header X11/Xlib.h &&
  1786. check_header X11/extensions/XShm.h &&
  1787. check_func XOpenDisplay -lX11 &&
  1788. check_func XShmCreateImage -lX11 -lXext
  1789. enabled debug && add_cflags -g"$debuglevel"
  1790. # add some useful compiler flags if supported
  1791. check_cflags -Wdeclaration-after-statement
  1792. check_cflags -Wall
  1793. check_cflags -Wno-switch
  1794. check_cflags -Wdisabled-optimization
  1795. check_cflags -Wpointer-arith
  1796. check_cflags -Wredundant-decls
  1797. check_cflags -Wno-pointer-sign
  1798. check_cflags -Wcast-qual
  1799. check_cflags -Wwrite-strings
  1800. check_cflags -Wtype-limits
  1801. enabled extra_warnings && check_cflags -Winline
  1802. # add some linker flags
  1803. check_ldflags -Wl,--warn-common
  1804. check_ldflags -Wl,--as-needed
  1805. check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  1806. check_ldflags -Wl,-Bsymbolic
  1807. if enabled small; then
  1808. check_cflags -Os # not all compilers support -Os
  1809. optimizations="small"
  1810. elif enabled optimizations; then
  1811. if $cc -v 2>&1 | grep -q xlc; then
  1812. add_cflags "-O5"
  1813. add_ldflags "-O5"
  1814. else
  1815. add_cflags "-O3"
  1816. fi
  1817. fi
  1818. check_cflags -fno-math-errno
  1819. check_cflags -fno-signed-zeros
  1820. # add some flags for Intel C Compiler
  1821. if $cc --version 2> /dev/null | grep -q Intel; then
  1822. # Just warnings, no remarks
  1823. check_cflags -w1
  1824. # -wd: Disable following warnings
  1825. # 144, 167, 556: -Wno-pointer-sign
  1826. # 10006: ignoring unknown option -fno-signed-zeros
  1827. # 10156: ignoring option '-W'; no argument required
  1828. check_cflags -wd144,167,556,10006,10156
  1829. # 11030: Warning unknown option --as-needed
  1830. # 10156: ignoring option '-export'; no argument required
  1831. check_ldflags -wd10156,11030
  1832. # Allow to compile with optimizations
  1833. check_ldflags -march=$cpu
  1834. fi
  1835. # PIC flags for shared library objects where they are needed
  1836. if enabled shared; then
  1837. # LIBOBJFLAGS may have already been set in the OS configuration
  1838. if test -z "$LIBOBJFLAGS" ; then
  1839. case "$arch" in
  1840. x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  1841. esac
  1842. fi
  1843. fi
  1844. if enabled gprof; then
  1845. add_cflags "-p"
  1846. add_ldflags "-p"
  1847. fi
  1848. VHOOKCFLAGS="-fPIC"
  1849. # Find out if the .align argument is a power of two or not.
  1850. if test $asmalign_pot = "unknown"; then
  1851. disable asmalign_pot
  1852. echo '__asm__ (".align 3");' | check_cc && enable asmalign_pot
  1853. fi
  1854. enabled_any $DECODER_LIST && enable decoders
  1855. enabled_any $ENCODER_LIST && enable encoders
  1856. enabled_any $BSF_LIST && enable bsfs
  1857. enabled_any $DEMUXER_LIST && enable demuxers
  1858. enabled_any $MUXER_LIST && enable muxers
  1859. enabled_any $FILTER_LIST && enable filters
  1860. enabled_any $INDEV_LIST && enable demuxers
  1861. enabled_any $OUTDEV_LIST && enable muxers
  1862. enabled_any $PROTOCOL_LIST && enable protocols
  1863. enabled_any $THREADS_LIST && enable threads
  1864. check_deps $CONFIG_LIST \
  1865. $CONFIG_EXTRA \
  1866. $HAVE_LIST \
  1867. $DECODER_LIST \
  1868. $ENCODER_LIST \
  1869. $PARSER_LIST \
  1870. $BSF_LIST \
  1871. $DEMUXER_LIST \
  1872. $MUXER_LIST \
  1873. $FILTER_LIST \
  1874. $INDEV_LIST \
  1875. $OUTDEV_LIST \
  1876. $PROTOCOL_LIST \
  1877. enabled libdc1394 && append pkg_requires "libraw1394"
  1878. enabled libdirac && append pkg_requires "dirac"
  1879. enabled libtheora && append pkg_requires "theora"
  1880. enabled libvorbis && append pkg_requires "vorbisenc"
  1881. echo "install prefix $prefix"
  1882. echo "source path $source_path"
  1883. echo "C compiler $cc"
  1884. echo ".align is power-of-two $asmalign_pot"
  1885. echo "ARCH $arch ($cpu)"
  1886. if test "$build_suffix" != ""; then
  1887. echo "build suffix $build_suffix"
  1888. fi
  1889. if test "$extra_version" != ""; then
  1890. echo "version string suffix $extra_version"
  1891. fi
  1892. echo "big-endian ${bigendian-no}"
  1893. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1894. echo "yasm ${yasm-no}"
  1895. echo "MMX enabled ${mmx-no}"
  1896. echo "CMOV enabled ${cmov-no}"
  1897. echo "CMOV is fast ${fast_cmov-no}"
  1898. echo "EBX available ${ebx_available-no}"
  1899. echo "EBP available ${ebp_available-no}"
  1900. fi
  1901. if test $arch = "armv4l"; then
  1902. echo "ARMv5TE enabled ${armv5te-no}"
  1903. echo "ARMv6 enabled ${armv6-no}"
  1904. echo "ARM VFP enabled ${armvfp-no}"
  1905. echo "IWMMXT enabled ${iwmmxt-no}"
  1906. echo "NEON enabled ${neon-no}"
  1907. fi
  1908. if test $arch = "mips"; then
  1909. echo "MMI enabled ${mmi-no}"
  1910. fi
  1911. if test $arch = "powerpc"; then
  1912. echo "AltiVec enabled ${altivec-no}"
  1913. echo "dcbzl available ${dcbzl-no}"
  1914. fi
  1915. echo "gprof enabled ${gprof-no}"
  1916. echo "debug symbols ${debug-no}"
  1917. echo "strip symbols ${stripping-no}"
  1918. echo "optimizations ${optimizations-no}"
  1919. echo "static ${static-no}"
  1920. echo "shared ${shared-no}"
  1921. echo "postprocessing support ${postproc-no}"
  1922. echo "software scaler enabled ${swscale-no}"
  1923. echo "new filter support ${avfilter-no}"
  1924. echo "filters using lavformat ${avfilter_lavf-no}"
  1925. echo "video hooking ${vhook-no}"
  1926. if enabled vhook; then
  1927. echo "Imlib2 support ${imlib2-no}"
  1928. echo "FreeType support ${freetype2-no}"
  1929. fi
  1930. echo "network support ${network-no}"
  1931. if enabled network; then
  1932. echo "IPv6 support ${ipv6-no}"
  1933. fi
  1934. echo "threading support ${thread_type-no}"
  1935. echo "SDL support ${sdl-no}"
  1936. if enabled sdl_too_old; then
  1937. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1938. fi
  1939. echo "Sun medialib support ${mlib-no}"
  1940. echo "AVISynth enabled ${avisynth-no}"
  1941. echo "libamr-nb support ${libamr_nb-no}"
  1942. echo "libamr-wb support ${libamr_wb-no}"
  1943. echo "libdc1394 support ${libdc1394-no}"
  1944. echo "libdirac enabled ${libdirac-no}"
  1945. echo "libfaac enabled ${libfaac-no}"
  1946. echo "libfaad enabled ${libfaad-no}"
  1947. echo "libfaad dlopened ${libfaadbin-no}"
  1948. echo "libgsm enabled ${libgsm-no}"
  1949. echo "libmp3lame enabled ${libmp3lame-no}"
  1950. echo "libnut enabled ${libnut-no}"
  1951. echo "libschroedinger enabled ${libschroedinger-no}"
  1952. echo "libspeex enabled ${libspeex-no}"
  1953. echo "libtheora enabled ${libtheora-no}"
  1954. echo "libvorbis enabled ${libvorbis-no}"
  1955. echo "libx264 enabled ${libx264-no}"
  1956. echo "libxvid enabled ${libxvid-no}"
  1957. echo "zlib enabled ${zlib-no}"
  1958. echo "bzlib enabled ${bzlib-no}"
  1959. echo
  1960. for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
  1961. echo "Enabled ${type}s:"
  1962. eval list=\$$(toupper $type)_LIST
  1963. for part in $list; do
  1964. enabled $part && echo ${part%_*}
  1965. done | sort | pr -3 -t
  1966. echo
  1967. done
  1968. license="LGPL"
  1969. if enabled nonfree; then
  1970. license="unredistributable"
  1971. elif enabled gpl; then
  1972. license="GPL"
  1973. fi
  1974. echo "License: $license"
  1975. echo "Creating config.mak and config.h..."
  1976. echo "# Automatically generated by configure - do not modify!" > config.mak
  1977. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1978. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1979. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1980. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1981. echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  1982. echo "prefix=$prefix" >> config.mak
  1983. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1984. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1985. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1986. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1987. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1988. echo "CC=$cc" >> config.mak
  1989. echo "YASM=$yasmexe" >> config.mak
  1990. echo "AR=$ar" >> config.mak
  1991. echo "RANLIB=$ranlib" >> config.mak
  1992. echo "LN_S=$ln_s" >> config.mak
  1993. enabled stripping &&
  1994. echo "STRIP=$strip" >> config.mak ||
  1995. echo "STRIP=echo ignoring strip" >> config.mak
  1996. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1997. echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
  1998. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1999. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  2000. echo "SHFLAGS=$SHFLAGS" >> config.mak
  2001. echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  2002. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  2003. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  2004. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  2005. echo "BUILD_STATIC=$static" >> config.mak
  2006. echo "BUILDSUF=$build_suffix" >> config.mak
  2007. echo "FULLNAME=$FULLNAME" >> config.mak
  2008. echo "LIBPREF=$LIBPREF" >> config.mak
  2009. echo "LIBSUF=$LIBSUF" >> config.mak
  2010. echo "LIBNAME=$LIBNAME" >> config.mak
  2011. echo "SLIBPREF=$SLIBPREF" >> config.mak
  2012. echo "SLIBSUF=$SLIBSUF" >> config.mak
  2013. echo "EXESUF=$EXESUF" >> config.mak
  2014. echo "EXTRA_VERSION=$extra_version" >> config.mak
  2015. echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  2016. if enabled bigendian; then
  2017. echo "WORDS_BIGENDIAN=yes" >> config.mak
  2018. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  2019. fi
  2020. if enabled sdl; then
  2021. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  2022. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  2023. fi
  2024. if enabled texi2html; then
  2025. echo "BUILD_DOC=yes" >> config.mak
  2026. fi
  2027. get_version(){
  2028. name=$1
  2029. file=$source_path/$2
  2030. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2031. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2032. lcname=$(tolower $name)
  2033. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2034. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2035. }
  2036. get_version LIBSWSCALE libswscale/swscale.h
  2037. get_version LIBPOSTPROC libpostproc/postprocess.h
  2038. get_version LIBAVCODEC libavcodec/avcodec.h
  2039. get_version LIBAVDEVICE libavdevice/avdevice.h
  2040. get_version LIBAVFORMAT libavformat/avformat.h
  2041. get_version LIBAVUTIL libavutil/avutil.h
  2042. get_version LIBAVFILTER libavfilter/avfilter.h
  2043. if enabled shared; then
  2044. echo "BUILD_SHARED=yes" >> config.mak
  2045. echo "PIC=-fPIC -DPIC" >> config.mak
  2046. echo "LIBTARGET=${LIBTARGET}" >> config.mak
  2047. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  2048. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  2049. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  2050. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  2051. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  2052. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  2053. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  2054. fi
  2055. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  2056. echo "EXTRALIBS=$extralibs" >> config.mak
  2057. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2058. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2059. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2060. $CONFIG_EXTRA \
  2061. $DECODER_LIST \
  2062. $ENCODER_LIST \
  2063. $PARSER_LIST \
  2064. $BSF_LIST \
  2065. $DEMUXER_LIST \
  2066. $MUXER_LIST \
  2067. $FILTER_LIST \
  2068. $PROTOCOL_LIST \
  2069. $INDEV_LIST \
  2070. $OUTDEV_LIST \
  2071. echo "#define restrict $_restrict" >> $TMPH
  2072. if enabled small; then
  2073. echo "#define av_always_inline" >> $TMPH
  2074. fi
  2075. echo "SRC_PATH=\"$source_path\"" >> config.mak
  2076. echo "SRC_PATH_BARE=$source_path" >> config.mak
  2077. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  2078. # Apparently it's not possible to portably echo a backslash.
  2079. enabled asmalign_pot &&
  2080. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  2081. printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
  2082. echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  2083. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2084. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2085. cmp -s $TMPH config.h &&
  2086. echo "config.h is unchanged" ||
  2087. mv -f $TMPH config.h
  2088. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  2089. # build tree in object directory if source path is different from current one
  2090. if enabled source_path_used; then
  2091. DIRS="\
  2092. doc \
  2093. libavcodec \
  2094. libavcodec/alpha \
  2095. libavcodec/armv4l \
  2096. libavcodec/bfin \
  2097. libavcodec/i386 \
  2098. libavcodec/mlib \
  2099. libavcodec/ppc \
  2100. libavcodec/sh4 \
  2101. libavcodec/sparc \
  2102. libavdevice \
  2103. libavfilter \
  2104. libavformat \
  2105. libavutil \
  2106. libpostproc \
  2107. libswscale \
  2108. tests \
  2109. tools \
  2110. vhook \
  2111. "
  2112. FILES="\
  2113. Makefile \
  2114. common.mak \
  2115. subdir.mak \
  2116. doc/texi2pod.pl \
  2117. libavcodec/Makefile \
  2118. libavdevice/Makefile \
  2119. libavfilter/Makefile \
  2120. libavformat/Makefile \
  2121. libavutil/Makefile \
  2122. libpostproc/Makefile \
  2123. libswscale/Makefile \
  2124. "
  2125. for dir in $DIRS ; do
  2126. mkdir -p $dir
  2127. done
  2128. for f in $FILES ; do
  2129. $ln_s "$source_path/$f" $f
  2130. done
  2131. fi
  2132. # build pkg-config files
  2133. pkgconfig_generate(){
  2134. name=$1
  2135. shortname=${name#lib}${build_suffix}
  2136. comment=$2
  2137. version=$3
  2138. libs=$4
  2139. requires=$5
  2140. cat <<EOF > $name/$name.pc
  2141. prefix=$prefix
  2142. exec_prefix=\${prefix}
  2143. libdir=$libdir
  2144. includedir=$incdir
  2145. Name: $name
  2146. Description: $comment
  2147. Version: $version
  2148. Requires: $(disabled shared && echo $requires)
  2149. Requires.private: $(enabled shared && echo $requires)
  2150. Conflicts:
  2151. Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  2152. Libs.private: $(enabled shared && echo $libs)
  2153. Cflags: -I\${includedir}
  2154. EOF
  2155. cat <<EOF > $name/$name-uninstalled.pc
  2156. prefix=
  2157. exec_prefix=
  2158. libdir=\${pcfiledir}
  2159. includedir=${source_path}
  2160. Name: $name
  2161. Description: $comment
  2162. Version: $version
  2163. Requires: $requires
  2164. Conflicts:
  2165. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2166. Cflags: -I\${includedir}
  2167. EOF
  2168. }
  2169. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2170. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2171. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2172. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
  2173. enabled avfilter &&
  2174. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2175. enabled postproc &&
  2176. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2177. if enabled swscale; then
  2178. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  2179. else
  2180. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2181. apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
  2182. fi