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.

2412 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. oldscaler
  796. "
  797. CMDLINE_SELECT="
  798. $ARCH_EXT_LIST
  799. $CONFIG_LIST
  800. $THREADS_LIST
  801. cross_compile
  802. debug
  803. extra_warnings
  804. logging
  805. optimizations
  806. shared
  807. static
  808. stripping
  809. "
  810. PATHS_LIST='
  811. bindir
  812. incdir
  813. libdir
  814. mandir
  815. prefix
  816. shlibdir
  817. '
  818. CMDLINE_SET="
  819. $PATHS_LIST
  820. arch
  821. build_suffix
  822. cc
  823. cpu
  824. cross_prefix
  825. extra_version
  826. logfile
  827. source_path
  828. target_os
  829. "
  830. # code dependency declarations
  831. # architecture extensions
  832. altivec_deps="powerpc"
  833. armv5te_deps="armv4l"
  834. armv6_deps="armv4l"
  835. armvfp_deps="armv4l"
  836. iwmmxt_deps="armv4l"
  837. mmi_deps="mips"
  838. mmx_deps="x86"
  839. mmx2_deps="x86 mmx"
  840. neon_deps="armv4l"
  841. ssse3_deps="x86"
  842. vis_deps="sparc"
  843. # common features
  844. fft_suggest="fft_mmx"
  845. fft_mmx_deps="mmx yasm"
  846. oldscaler_deps="!swscale"
  847. # decoders / encoders
  848. aac_decoder_select="fft mdct"
  849. ac3_decoder_deps="gpl"
  850. ac3_decoder_select="fft mdct"
  851. atrac3_decoder_select="fft mdct"
  852. cavs_decoder_select="golomb"
  853. cook_decoder_select="fft mdct"
  854. cscd_decoder_suggest="zlib"
  855. dca_decoder_select="fft mdct"
  856. dxa_decoder_select="zlib"
  857. eac3_decoder_deps="gpl"
  858. eac3_decoder_select="fft mdct"
  859. ffv1_decoder_select="golomb"
  860. flac_decoder_select="golomb"
  861. flac_encoder_select="golomb"
  862. flashsv_decoder_select="zlib"
  863. flashsv_encoder_select="zlib"
  864. h264_decoder_select="golomb"
  865. imc_decoder_select="fft mdct"
  866. jpegls_decoder_select="golomb"
  867. jpegls_encoder_select="golomb"
  868. loco_decoder_select="golomb"
  869. mpeg_xvmc_decoder_deps="xvmc"
  870. nellymoser_decoder_select="fft mdct"
  871. nellymoser_encoder_select="fft mdct"
  872. png_decoder_select="zlib"
  873. png_encoder_select="zlib"
  874. qdm2_decoder_select="fft mdct"
  875. shorten_decoder_select="golomb"
  876. sonic_decoder_select="golomb"
  877. sonic_encoder_select="golomb"
  878. sonic_ls_encoder_select="golomb"
  879. svq3_decoder_select="golomb"
  880. svq3_decoder_suggest="zlib"
  881. tiff_decoder_suggest="zlib"
  882. tiff_encoder_suggest="zlib"
  883. tscc_decoder_select="zlib"
  884. vorbis_decoder_select="fft mdct"
  885. vorbis_encoder_select="fft mdct"
  886. wmav1_decoder_select="fft mdct"
  887. wmav1_encoder_select="fft mdct"
  888. wmav2_decoder_select="fft mdct"
  889. wmav2_encoder_select="fft mdct"
  890. zlib_decoder_select="zlib"
  891. zlib_encoder_select="zlib"
  892. zmbv_decoder_select="zlib"
  893. zmbv_encoder_select="zlib"
  894. # external libraries
  895. libamr_nb_decoder_deps="libamr_nb"
  896. libamr_nb_encoder_deps="libamr_nb"
  897. libamr_wb_decoder_deps="libamr_wb"
  898. libamr_wb_encoder_deps="libamr_wb"
  899. libdirac_decoder_deps="libdirac !libschroedinger"
  900. libdirac_encoder_deps="libdirac"
  901. libfaac_encoder_deps="libfaac"
  902. libfaad_decoder_deps="libfaad"
  903. libfaadbin_decoder_extralibs='$ldl'
  904. libgsm_decoder_deps="libgsm"
  905. libgsm_encoder_deps="libgsm"
  906. libgsm_ms_decoder_deps="libgsm"
  907. libgsm_ms_encoder_deps="libgsm"
  908. libmp3lame_encoder_deps="libmp3lame"
  909. libschroedinger_decoder_deps="libschroedinger"
  910. libschroedinger_encoder_deps="libschroedinger"
  911. libspeex_decoder_deps="libspeex"
  912. libtheora_encoder_deps="libtheora"
  913. libvorbis_encoder_deps="libvorbis"
  914. libx264_encoder_deps="libx264"
  915. libxvid_encoder_deps="libxvid"
  916. mpeg4aac_decoder_deps="libfaad"
  917. # demuxers / muxers
  918. ac3_demuxer_deps="ac3_parser"
  919. audio_beos_demuxer_deps="audio_beos"
  920. audio_beos_demuxer_extralibs="-lmedia -lbe"
  921. audio_beos_muxer_deps="audio_beos"
  922. audio_beos_muxer_extralibs="-lmedia -lbe"
  923. avisynth_demuxer_deps="avisynth"
  924. bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  925. dirac_demuxer_deps="dirac_parser"
  926. dv1394_demuxer_deps="dv1394 dv_demuxer"
  927. libdc1394_demuxer_deps="libdc1394"
  928. libnut_demuxer_deps="libnut"
  929. libnut_muxer_deps="libnut"
  930. matroska_demuxer_suggest="zlib bzlib"
  931. mov_demuxer_suggest="zlib"
  932. mp3_demuxer_deps="mpegaudio_parser"
  933. oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  934. oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  935. redir_demuxer_deps="network"
  936. rtp_muxer_deps="network rtp_protocol"
  937. rtsp_demuxer_deps="sdp_demuxer"
  938. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  939. v4l_demuxer_deps="linux_videodev_h"
  940. v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
  941. vfwcap_demuxer_deps="capCreateCaptureWindow"
  942. vfwcap_demuxer_extralibs="-lvfw32"
  943. x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  944. x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  945. # protocols
  946. http_protocol_deps="network"
  947. rtp_protocol_deps="udp_protocol"
  948. tcp_protocol_deps="network"
  949. udp_protocol_deps="network"
  950. # filters
  951. movie_filter_deps="avfilter_lavf"
  952. # programs
  953. ffplay_deps="sdl"
  954. ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  955. ffserver_extralibs='$ldl'
  956. vhook_extralibs='$ldl'
  957. # default parameters
  958. logfile="config.err"
  959. # installation paths
  960. prefix_default="/usr/local"
  961. bindir_default='${prefix}/bin'
  962. incdir_default='${prefix}/include'
  963. libdir_default='${prefix}/lib'
  964. mandir_default='${prefix}/share/man'
  965. shlibdir_default="$libdir_default"
  966. # toolchain
  967. cc_default="gcc"
  968. yasmexe="yasm"
  969. ar="ar"
  970. nm="nm"
  971. ranlib="ranlib"
  972. strip="strip"
  973. asmalign_pot="unknown"
  974. ln_s="ln -sf"
  975. objformat="elf"
  976. # machine
  977. arch=`uname -m`
  978. cpu="generic"
  979. # OS
  980. target_os=$(tolower $(uname -s))
  981. # configurable options
  982. enable debug
  983. enable ffmpeg
  984. enable ffplay
  985. enable ffserver
  986. enable ipv6
  987. enable mpegaudio_hp
  988. enable network
  989. enable oldscaler
  990. enable optimizations
  991. enable protocols
  992. enable static
  993. enable stripping
  994. vhook="default"
  995. # build settings
  996. add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  997. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  998. VHOOKSHFLAGS='$(SHFLAGS)'
  999. FFSERVERLDFLAGS=-Wl,-E
  1000. LIBPREF="lib"
  1001. LIBSUF=".a"
  1002. FULLNAME='$(NAME)$(BUILDSUF)'
  1003. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1004. SLIBPREF="lib"
  1005. SLIBSUF=".so"
  1006. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1007. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1008. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1009. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1010. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1011. # full relative path for objects in subdirectories for non-recursive Make.
  1012. 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,"'
  1013. # find source path
  1014. source_path="`dirname \"$0\"`"
  1015. enable source_path_used
  1016. if test -z "$source_path" -o "$source_path" = "." ; then
  1017. source_path="`pwd`"
  1018. disable source_path_used
  1019. else
  1020. source_path="`cd \"$source_path\"; pwd`"
  1021. echo "$source_path" | grep -q '[[:blank:]]' &&
  1022. die "Out of tree builds are impossible with whitespace in source path."
  1023. fi
  1024. FFMPEG_CONFIGURATION="$@"
  1025. find_things(){
  1026. thing=$1
  1027. pattern=$2
  1028. file=$source_path/$3
  1029. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1030. }
  1031. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1032. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1033. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1034. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1035. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1036. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1037. OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
  1038. INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
  1039. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1040. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1041. enable $ARCH_EXT_LIST \
  1042. $DECODER_LIST \
  1043. $ENCODER_LIST \
  1044. $PARSER_LIST \
  1045. $BSF_LIST \
  1046. $DEMUXER_LIST \
  1047. $MUXER_LIST \
  1048. $FILTER_LIST \
  1049. $PROTOCOL_LIST \
  1050. $INDEV_LIST \
  1051. $OUTDEV_LIST \
  1052. die_unknown(){
  1053. echo "Unknown option \"$1\"."
  1054. echo "See $0 --help for available options."
  1055. exit 1
  1056. }
  1057. show_list() {
  1058. suffix=_$1
  1059. shift
  1060. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  1061. exit 0
  1062. }
  1063. for opt do
  1064. optval="${opt#*=}"
  1065. case "$opt" in
  1066. --extra-cflags=*) add_cflags "$optval"
  1067. ;;
  1068. --extra-ldflags=*) add_ldflags "$optval"
  1069. ;;
  1070. --extra-libs=*) add_extralibs "$optval"
  1071. ;;
  1072. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1073. ;;
  1074. --enable-debug=*) debuglevel="$optval"
  1075. ;;
  1076. --enable-*=*|--disable-*=*)
  1077. eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
  1078. case "$thing" in
  1079. encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
  1080. *) die_unknown "$opt" ;;
  1081. esac
  1082. ;;
  1083. --enable-?*|--disable-?*)
  1084. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  1085. if is_in $option $COMPONENT_LIST; then
  1086. eval $action \$$(toupper ${option%s})_LIST
  1087. elif is_in $option $CMDLINE_SELECT; then
  1088. $action $option
  1089. else
  1090. die_unknown $opt
  1091. fi
  1092. ;;
  1093. --list-*)
  1094. NAME="${opt#--list-}"
  1095. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1096. NAME=${NAME%s}
  1097. eval show_list $NAME \$$(toupper $NAME)_LIST
  1098. ;;
  1099. --help|-h) show_help
  1100. ;;
  1101. *)
  1102. optname="${opt%%=*}"
  1103. optname="${optname#--}"
  1104. optname=$(echo "$optname" | sed 's/-/_/g')
  1105. is_in $optname $CMDLINE_SET || die_unknown $opt
  1106. eval $optname='$optval'
  1107. ;;
  1108. esac
  1109. done
  1110. disabled logging && logfile=/dev/null
  1111. echo "# $0 $@" > $logfile
  1112. set >> $logfile
  1113. cc_default="${cross_prefix}${cc_default}"
  1114. yasmexe="${cross_prefix}${yasmexe}"
  1115. ar="${cross_prefix}${ar}"
  1116. nm="${cross_prefix}${nm}"
  1117. ranlib="${cross_prefix}${ranlib}"
  1118. strip="${cross_prefix}${strip}"
  1119. set_default cc
  1120. # set temporary file name
  1121. if test ! -z "$TMPDIR" ; then
  1122. TMPDIR1="${TMPDIR}"
  1123. elif test ! -z "$TEMPDIR" ; then
  1124. TMPDIR1="${TEMPDIR}"
  1125. else
  1126. TMPDIR1="/tmp"
  1127. fi
  1128. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  1129. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
  1130. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  1131. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  1132. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  1133. TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
  1134. check_cflags -std=c99
  1135. case "$arch" in
  1136. i386|i486|i586|i686|i86pc|BePC)
  1137. arch="x86_32"
  1138. enable fast_unaligned
  1139. ;;
  1140. x86_64|amd64)
  1141. arch="x86_32"
  1142. enable cmov
  1143. enable fast_cmov
  1144. enable fast_unaligned
  1145. check_cc <<EOF && enable fast_64bit && arch="x86_64"
  1146. int test[sizeof(char*) - 7];
  1147. EOF
  1148. ;;
  1149. # armv4l is a subset of armv[567]*l
  1150. arm|armv[4567]*l)
  1151. arch="armv4l"
  1152. ;;
  1153. alpha)
  1154. arch="alpha"
  1155. enable fast_64bit
  1156. ;;
  1157. "Power Macintosh"|ppc|powerpc)
  1158. arch="powerpc"
  1159. enable fast_unaligned
  1160. ;;
  1161. ppc64)
  1162. arch="powerpc"
  1163. enable fast_64bit
  1164. enable fast_unaligned
  1165. ;;
  1166. mips|mipsel|IP*)
  1167. arch="mips"
  1168. ;;
  1169. sun4u|sparc64)
  1170. arch="sparc64"
  1171. enable fast_64bit
  1172. ;;
  1173. sparc)
  1174. arch="sparc"
  1175. ;;
  1176. sh4)
  1177. arch="sh4"
  1178. ;;
  1179. parisc)
  1180. arch="parisc"
  1181. ;;
  1182. parisc64)
  1183. arch="parisc"
  1184. enable fast_64bit
  1185. ;;
  1186. s390|s390x)
  1187. arch="s390"
  1188. ;;
  1189. m68k)
  1190. arch="m68k"
  1191. ;;
  1192. ia64)
  1193. arch="ia64"
  1194. enable fast_64bit
  1195. ;;
  1196. bfin)
  1197. arch="bfin"
  1198. ;;
  1199. *)
  1200. arch="unknown"
  1201. ;;
  1202. esac
  1203. enable $arch
  1204. enabled_any x86_32 x86_64 && enable x86
  1205. enabled sparc64 && enable sparc
  1206. # OS specific
  1207. case $target_os in
  1208. beos|haiku|zeta)
  1209. prefix_default="$HOME/config"
  1210. # helps building libavcodec
  1211. add_cflags "-DPIC -fomit-frame-pointer"
  1212. # 3 gcc releases known for BeOS, each with ugly bugs
  1213. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1214. case "$gcc_version" in
  1215. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1216. disable mmx
  1217. ;;
  1218. *20010315*) echo "BeBits gcc"
  1219. add_cflags "-fno-expensive-optimizations"
  1220. ;;
  1221. esac
  1222. SHFLAGS=-nostart
  1223. # enable BeOS things
  1224. enable audio_beos
  1225. # no need for libm, but the inet stuff
  1226. # Check for BONE
  1227. # XXX: actually should check for NOT net_server
  1228. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1229. network_extralibs="-lbind -lsocket"
  1230. else
  1231. enable beos_netserver
  1232. network_extralibs="-lnet"
  1233. fi ;;
  1234. sunos)
  1235. FFSERVERLDFLAGS=""
  1236. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1237. network_extralibs="-lsocket -lnsl"
  1238. ;;
  1239. netbsd)
  1240. oss_demuxer_extralibs="-lossaudio"
  1241. oss_muxer_extralibs="-lossaudio"
  1242. ;;
  1243. openbsd)
  1244. disable need_memalign
  1245. LIBOBJFLAGS='$(PIC)'
  1246. SHFLAGS='-shared'
  1247. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
  1248. SLIBNAME_WITH_VERSION='$(SLIBNAME)'
  1249. SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
  1250. oss_demuxer_extralibs="-lossaudio"
  1251. oss_muxer_extralibs="-lossaudio"
  1252. ;;
  1253. freebsd)
  1254. disable need_memalign
  1255. ;;
  1256. bsd/os)
  1257. osextralibs="-lpoll -lgnugetopt"
  1258. strip="strip -d"
  1259. ;;
  1260. darwin)
  1261. disable need_memalign
  1262. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1263. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
  1264. strip="strip -x"
  1265. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1266. SLIBSUF=".dylib"
  1267. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1268. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1269. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1270. objformat="macho"
  1271. enabled x86_64 && objformat="macho64"
  1272. ;;
  1273. mingw32*)
  1274. target_os=mingw32
  1275. LIBTARGET=i386
  1276. if test $arch = x86_64; then
  1277. disable need_memalign
  1278. LIBTARGET=x64
  1279. fi
  1280. shlibdir_default="$bindir_default"
  1281. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1282. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1283. if enabled swscale; then
  1284. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1285. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1286. fi
  1287. disable ffserver
  1288. SLIBPREF=""
  1289. SLIBSUF=".dll"
  1290. EXESUF=".exe"
  1291. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1292. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1293. SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1294. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1295. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1296. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1297. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1298. objformat="win32"
  1299. enable dos_paths
  1300. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1301. die "ERROR: MinGW runtime version must be >= 3.15."
  1302. enabled_any avisynth vfwcap_demuxer &&
  1303. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 12)" ||
  1304. die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.12 or later."; }
  1305. ;;
  1306. cygwin*)
  1307. target_os=cygwin
  1308. shlibdir_default="$bindir_default"
  1309. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1310. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1311. if enabled swscale; then
  1312. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1313. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1314. fi
  1315. EXESUF=".exe"
  1316. SLIBPREF="cyg"
  1317. SLIBSUF=".dll"
  1318. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1319. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1320. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1321. objformat="win32"
  1322. enable dos_paths
  1323. ;;
  1324. *-dos|freedos|opendos)
  1325. disable ffplay ffserver vhook
  1326. disable $INDEV_LIST $OUTDEV_LIST
  1327. network_extralibs="-lsocket"
  1328. EXESUF=".exe"
  1329. objformat="win32"
  1330. enable dos_paths
  1331. ;;
  1332. linux)
  1333. enable dv1394
  1334. ;;
  1335. irix*)
  1336. target_os=irix
  1337. ranlib="echo ignoring ranlib"
  1338. ;;
  1339. os/2*)
  1340. strip="lxlite"
  1341. ln_s="cp -f"
  1342. EXESUF=".exe"
  1343. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1344. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1345. FFSERVERLDFLAGS=""
  1346. LIBSUF="_s.a"
  1347. SLIBPREF=""
  1348. SLIBSUF=".dll"
  1349. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1350. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1351. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1352. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1353. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1354. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1355. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1356. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1357. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1358. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1359. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1360. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1361. disable vhook
  1362. enable dos_paths
  1363. ;;
  1364. interix)
  1365. disable vhook
  1366. ;;
  1367. *)
  1368. target_os="${target_os}-UNKNOWN"
  1369. ;;
  1370. esac
  1371. set_default $PATHS_LIST
  1372. add_extralibs $osextralibs
  1373. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1374. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1375. test -n "$cross_prefix" && enable cross_compile
  1376. # we need to build at least one lib type
  1377. if ! enabled_any static shared; then
  1378. cat <<EOF
  1379. At least one library type must be built.
  1380. Specify --enable-static to build the static libraries or --enable-shared to
  1381. build the shared libraries as well. To only build the shared libraries specify
  1382. --disable-static in addition to --enable-shared.
  1383. EOF
  1384. exit 1;
  1385. fi
  1386. disabled static && LIBNAME=""
  1387. if enabled_any libfaad libfaadbin ; then
  1388. if check_header faad.h; then
  1389. check_cc <<EOF
  1390. #include <faad.h>
  1391. #ifndef FAAD2_VERSION
  1392. ok faad1
  1393. #endif
  1394. int main(void) { return 0; }
  1395. EOF
  1396. test $? = 0 && enable libfaad2
  1397. else
  1398. die "FAAD test failed."
  1399. fi
  1400. fi
  1401. if ! enabled gpl; then
  1402. die_gpl_disabled(){
  1403. name=$1
  1404. shift
  1405. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1406. }
  1407. die_gpl_disabled "The Postprocessing code" postproc
  1408. die_gpl_disabled "libx264" libx264
  1409. die_gpl_disabled "libxvidcore" libxvid
  1410. die_gpl_disabled "FAAD2" libfaad2
  1411. die_gpl_disabled "The X11 grabber" x11grab
  1412. die_gpl_disabled "The software scaler" swscale
  1413. fi
  1414. if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1415. die "libamr is nonfree and --enable-nonfree is not specified."
  1416. fi
  1417. check_deps $ARCH_EXT_LIST
  1418. test -z "$need_memalign" && need_memalign="$mmx"
  1419. #Darwin CC versions
  1420. if test $target_os = darwin; then
  1421. if $cc -v 2>&1 | grep -q xlc; then
  1422. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1423. else
  1424. add_cflags "-pipe"
  1425. check_cflags "-force_cpusubtype_ALL"
  1426. check_cflags "-Wno-sign-compare"
  1427. enabled shared || check_cflags -mdynamic-no-pic
  1428. fi
  1429. fi
  1430. disabled optimizations || check_cflags -fomit-frame-pointer
  1431. # Add processor-specific flags
  1432. if test $cpu != "generic"; then
  1433. warn_altivec(){
  1434. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1435. }
  1436. case $cpu in
  1437. 601|ppc601|PowerPC601)
  1438. add_cflags "-mcpu=601"
  1439. warn_altivec enabled PPC601
  1440. ;;
  1441. 603*|ppc603*|PowerPC603*)
  1442. add_cflags "-mcpu=603"
  1443. warn_altivec enabled PPC603
  1444. ;;
  1445. 604*|ppc604*|PowerPC604*)
  1446. add_cflags "-mcpu=604"
  1447. warn_altivec enabled PPC604
  1448. ;;
  1449. G3|g3|75*|ppc75*|PowerPC75*)
  1450. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1451. warn_altivec enabled PPC75x
  1452. ;;
  1453. G4|g4|745*|ppc745*|PowerPC745*)
  1454. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1455. warn_altivec disabled PPC745x
  1456. ;;
  1457. 74*|ppc74*|PowerPC74*)
  1458. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1459. warn_altivec disabled PPC74xx
  1460. ;;
  1461. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1462. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1463. warn_altivec disabled PPC970
  1464. enable ppc64
  1465. ;;
  1466. Cell|CELL|cell)
  1467. add_cflags "-mcpu=cell"
  1468. warn_altivec disabled Cell
  1469. enable ppc64
  1470. ;;
  1471. # targets that do NOT support conditional mov (cmov)
  1472. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1473. add_cflags "-march=$cpu"
  1474. disable cmov
  1475. ;;
  1476. # targets that do support conditional mov (cmov)
  1477. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1478. add_cflags "-march=$cpu"
  1479. enable cmov
  1480. enable fast_cmov
  1481. ;;
  1482. # targets that do support conditional mov but on which it's slow
  1483. pentium4|pentium4m|prescott|nocona)
  1484. add_cflags "-march=$cpu"
  1485. enable cmov
  1486. disable fast_cmov
  1487. ;;
  1488. sparc64)
  1489. add_cflags "-mcpu=v9"
  1490. ;;
  1491. arm11*|cortex*)
  1492. add_cflags "-mcpu=$cpu"
  1493. enable fast_unaligned
  1494. ;;
  1495. armv*)
  1496. add_cflags "-march=$cpu"
  1497. ;;
  1498. arm*)
  1499. add_cflags "-mcpu=$cpu"
  1500. ;;
  1501. *)
  1502. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1503. ;;
  1504. esac
  1505. fi
  1506. # make sure we can execute files in $TMPDIR
  1507. cat > $TMPSH 2>> $logfile <<EOF
  1508. #! /bin/sh
  1509. EOF
  1510. chmod +x $TMPSH >> $logfile 2>&1
  1511. if ! $TMPSH >> $logfile 2>&1; then
  1512. cat <<EOF
  1513. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1514. variable to another directory and make sure that $TMPDIR1 is not mounted
  1515. noexec.
  1516. EOF
  1517. die "Sanity test failed."
  1518. fi
  1519. rm $TMPSH
  1520. # compiler sanity check
  1521. check_exec <<EOF
  1522. int main(void){ return 0; }
  1523. EOF
  1524. if test "$?" != 0; then
  1525. echo "$cc is unable to create an executable file."
  1526. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1527. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1528. echo "Only do this if you know what cross compiling means."
  1529. fi
  1530. die "C compiler test failed."
  1531. fi
  1532. check_cc <<EOF || die "Symbol mangling check failed."
  1533. int ff_extern;
  1534. EOF
  1535. sym=$($nm -P -g $TMPO | grep ff_extern)
  1536. extern_prefix=${sym%%ff_extern*}
  1537. check_asm inline_asm '""'
  1538. if enabled x86; then
  1539. # check whether EBP is available on x86
  1540. # As 'i' is stored on the stack, this program will crash
  1541. # if the base pointer is used to access it because the
  1542. # base pointer is cleared in the inline assembly code.
  1543. check_exec_crash <<EOF && enable ebp_available
  1544. volatile int i=0;
  1545. __asm__ volatile (
  1546. "xorl %%ebp, %%ebp"
  1547. ::: "%ebp");
  1548. return i;
  1549. EOF
  1550. # check wether EBX is available on x86
  1551. check_asm ebx_available '"":::"%ebx"'
  1552. # check whether binutils is new enough to compile SSSE3/MMX2
  1553. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1554. enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
  1555. check_asm bswap '"bswap %%eax" ::: "%eax"'
  1556. YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
  1557. enabled x86_64 && append YASMFLAGS "-m amd64"
  1558. enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1559. case "$objformat" in
  1560. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1561. macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
  1562. *) append YASMFLAGS "-DPREFIX" ;;
  1563. esac
  1564. check_yasm "pabsw xmm0, xmm0" && enable yasm
  1565. fi
  1566. # check for assembler specific support
  1567. if test $arch = "powerpc"; then
  1568. check_asm dcbzl '"dcbzl 0, 1"'
  1569. fi
  1570. # check for SIMD availability
  1571. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1572. if enabled altivec; then
  1573. check_cflags -maltivec -mabi=altivec &&
  1574. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1575. check_cflags -faltivec
  1576. # check if our compiler supports Motorola AltiVec C API
  1577. check_cc <<EOF || disable altivec
  1578. $inc_altivec_h
  1579. int main(void) {
  1580. vector signed int v1, v2, v3;
  1581. v1 = vec_add(v2,v3);
  1582. return 0;
  1583. }
  1584. EOF
  1585. # check if our compiler supports braces for vector declarations
  1586. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1587. $inc_altivec_h
  1588. int main (void) { (vector int) {1}; return 0; }
  1589. EOF
  1590. fi
  1591. # We have to check if pld is a nop and disable it.
  1592. enabled armv4l && check_asm pld '"pld [r0]"'
  1593. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1594. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1595. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  1596. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1597. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1598. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  1599. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1600. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1601. # ---
  1602. # big/little-endian test
  1603. check_cc <<EOF || die "endian test failed"
  1604. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1605. EOF
  1606. od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1607. # ---
  1608. # check availability of some header files
  1609. if check_func dlopen; then
  1610. ldl=
  1611. elif check_func dlopen -ldl; then
  1612. ldl=-ldl
  1613. fi
  1614. check_func fork
  1615. check_func gethrtime
  1616. check_func getrusage
  1617. check_func inet_aton $network_extralibs
  1618. check_func memalign
  1619. check_func mkstemp
  1620. check_func_headers windows.h GetProcessTimes
  1621. check_header conio.h
  1622. check_header dlfcn.h
  1623. check_header malloc.h
  1624. check_header poll.h
  1625. check_header sys/mman.h
  1626. check_header sys/resource.h
  1627. check_header sys/select.h
  1628. check_header termios.h
  1629. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1630. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1631. fi
  1632. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  1633. disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1634. # check for some common methods of building with pthread support
  1635. # do this before the optional library checks as some of them require pthreads
  1636. if enabled pthreads; then
  1637. if check_func pthread_create; then
  1638. :
  1639. elif check_func pthread_create -pthread; then
  1640. add_cflags -pthread
  1641. add_extralibs -pthread
  1642. elif check_func pthread_create -pthreads; then
  1643. add_cflags -pthreads
  1644. add_extralibs -pthreads
  1645. elif check_func pthread_create -lpthreadGC2; then
  1646. add_extralibs -lpthreadGC2
  1647. elif ! check_lib pthread.h pthread_create -lpthread; then
  1648. die "ERROR: can't find pthreads library"
  1649. fi
  1650. fi
  1651. for thread in $THREADS_LIST; do
  1652. if enabled $thread; then
  1653. test -n "$thread_type" &&
  1654. die "ERROR: Only one thread type must be selected." ||
  1655. thread_type="$thread"
  1656. fi
  1657. done
  1658. check_lib math.h sin -lm
  1659. # test for C99 functions in math.h
  1660. for func in llrint lrint lrintf round roundf; do
  1661. check_exec <<EOF && enable $func || disable $func
  1662. #include <math.h>
  1663. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1664. EOF
  1665. done
  1666. # these are off by default, so fail if requested and not available
  1667. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1668. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1669. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1670. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  1671. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
  1672. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1673. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1674. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1675. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1676. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  1677. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1678. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  1679. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1680. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  1681. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1682. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1683. enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
  1684. { check_cpp_condition x264.h "X264_BUILD >= 65" ||
  1685. die "ERROR: libx264 version must be >= 0.65."; }
  1686. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  1687. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1688. # libdc1394 check
  1689. if enabled libdc1394; then
  1690. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1691. enable libdc1394_2; } ||
  1692. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1693. enable libdc1394_1; } ||
  1694. die "ERROR: No version of libdc1394 found "
  1695. fi
  1696. _restrict=
  1697. for restrict_keyword in restrict __restrict__ __restrict; do
  1698. check_cc <<EOF && _restrict=$restrict_keyword && break
  1699. void foo(char * $restrict_keyword p);
  1700. EOF
  1701. done
  1702. test "$vhook" = "default" && vhook="$dlopen"
  1703. if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
  1704. disable vhook
  1705. echo
  1706. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1707. echo "Patches welcome."
  1708. echo
  1709. fi
  1710. if enabled vhook; then
  1711. check_ldflags -rdynamic
  1712. check_ldflags -export-dynamic
  1713. fi
  1714. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1715. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1716. ##########################################
  1717. # SDL check
  1718. disable sdl_too_old
  1719. disable sdl
  1720. SDL_CONFIG="${cross_prefix}sdl-config"
  1721. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1722. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1723. temp_cflags $sdl_cflags
  1724. temp_extralibs `"${SDL_CONFIG}" --libs`
  1725. if check_lib2 SDL.h SDL_Init; then
  1726. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1727. if test "$_sdlversion" -lt 121 ; then
  1728. enable sdl_too_old
  1729. else
  1730. enable sdl
  1731. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1732. #include <SDL.h>
  1733. int main(int argc, char **argv){
  1734. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1735. int w = vi->current_w;
  1736. return 0;
  1737. }
  1738. EOF
  1739. fi
  1740. fi
  1741. restore_flags
  1742. fi
  1743. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1744. ##########################################
  1745. # Network check
  1746. if enabled network; then
  1747. check_type sys/socket.h socklen_t
  1748. # Prefer arpa/inet.h over winsock2
  1749. if check_header arpa/inet.h ; then
  1750. check_func closesocket
  1751. elif check_header winsock2.h ; then
  1752. network_extralibs="-lws2_32"
  1753. check_type ws2tcpip.h socklen_t
  1754. check_func_headers winsock2.h closesocket
  1755. fi
  1756. fi
  1757. ##########################################
  1758. # IPv6 check
  1759. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1760. #include <sys/types.h>
  1761. #include <sys/socket.h>
  1762. #include <netinet/in.h>
  1763. #include <netdb.h>
  1764. int main(void) {
  1765. struct sockaddr_storage saddr;
  1766. struct ipv6_mreq mreq6;
  1767. getaddrinfo(0,0,0,0);
  1768. getnameinfo(0,0,0,0,0,0,0);
  1769. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1770. }
  1771. EOF
  1772. check_header linux/videodev.h
  1773. check_header linux/videodev2.h
  1774. check_header sys/videoio.h
  1775. check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1776. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1777. { check_header dev/bktr/ioctl_meteor.h &&
  1778. check_header dev/bktr/ioctl_bt848.h; } ||
  1779. { check_header machine/ioctl_meteor.h &&
  1780. check_header machine/ioctl_bt848.h; } ||
  1781. { check_header dev/video/meteor/ioctl_meteor.h &&
  1782. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1783. check_header dev/ic/bt8xx.h
  1784. check_header sys/soundcard.h
  1785. check_header soundcard.h
  1786. # deal with the X11 frame grabber
  1787. enabled x11grab &&
  1788. check_header X11/Xlib.h &&
  1789. check_header X11/extensions/XShm.h &&
  1790. check_func XOpenDisplay -lX11 &&
  1791. check_func XShmCreateImage -lX11 -lXext
  1792. enabled debug && add_cflags -g"$debuglevel"
  1793. # add some useful compiler flags if supported
  1794. check_cflags -Wdeclaration-after-statement
  1795. check_cflags -Wall
  1796. check_cflags -Wno-switch
  1797. check_cflags -Wdisabled-optimization
  1798. check_cflags -Wpointer-arith
  1799. check_cflags -Wredundant-decls
  1800. check_cflags -Wno-pointer-sign
  1801. check_cflags -Wcast-qual
  1802. check_cflags -Wwrite-strings
  1803. check_cflags -Wtype-limits
  1804. enabled extra_warnings && check_cflags -Winline
  1805. # add some linker flags
  1806. check_ldflags -Wl,--warn-common
  1807. check_ldflags -Wl,--as-needed
  1808. 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'
  1809. check_ldflags -Wl,-Bsymbolic
  1810. if enabled small; then
  1811. check_cflags -Os # not all compilers support -Os
  1812. optimizations="small"
  1813. elif enabled optimizations; then
  1814. if $cc -v 2>&1 | grep -q xlc; then
  1815. add_cflags "-O5"
  1816. add_ldflags "-O5"
  1817. else
  1818. add_cflags "-O3"
  1819. fi
  1820. fi
  1821. check_cflags -fno-math-errno
  1822. check_cflags -fno-signed-zeros
  1823. # add some flags for Intel C Compiler
  1824. if $cc --version 2> /dev/null | grep -q Intel; then
  1825. # Just warnings, no remarks
  1826. check_cflags -w1
  1827. # -wd: Disable following warnings
  1828. # 144, 167, 556: -Wno-pointer-sign
  1829. # 10006: ignoring unknown option -fno-signed-zeros
  1830. # 10156: ignoring option '-W'; no argument required
  1831. check_cflags -wd144,167,556,10006,10156
  1832. # 11030: Warning unknown option --as-needed
  1833. # 10156: ignoring option '-export'; no argument required
  1834. check_ldflags -wd10156,11030
  1835. # Allow to compile with optimizations
  1836. check_ldflags -march=$cpu
  1837. fi
  1838. # PIC flags for shared library objects where they are needed
  1839. if enabled shared; then
  1840. # LIBOBJFLAGS may have already been set in the OS configuration
  1841. if test -z "$LIBOBJFLAGS" ; then
  1842. case "$arch" in
  1843. x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  1844. esac
  1845. fi
  1846. fi
  1847. if enabled gprof; then
  1848. add_cflags "-p"
  1849. add_ldflags "-p"
  1850. fi
  1851. VHOOKCFLAGS="-fPIC"
  1852. # Find out if the .align argument is a power of two or not.
  1853. if test $asmalign_pot = "unknown"; then
  1854. disable asmalign_pot
  1855. echo '__asm__ (".align 3");' | check_cc && enable asmalign_pot
  1856. fi
  1857. enabled_any $DECODER_LIST && enable decoders
  1858. enabled_any $ENCODER_LIST && enable encoders
  1859. enabled_any $BSF_LIST && enable bsfs
  1860. enabled_any $DEMUXER_LIST && enable demuxers
  1861. enabled_any $MUXER_LIST && enable muxers
  1862. enabled_any $FILTER_LIST && enable filters
  1863. enabled_any $INDEV_LIST && enable demuxers
  1864. enabled_any $OUTDEV_LIST && enable muxers
  1865. enabled_any $PROTOCOL_LIST && enable protocols
  1866. enabled_any $THREADS_LIST && enable threads
  1867. check_deps $CONFIG_LIST \
  1868. $CONFIG_EXTRA \
  1869. $HAVE_LIST \
  1870. $DECODER_LIST \
  1871. $ENCODER_LIST \
  1872. $PARSER_LIST \
  1873. $BSF_LIST \
  1874. $DEMUXER_LIST \
  1875. $MUXER_LIST \
  1876. $FILTER_LIST \
  1877. $INDEV_LIST \
  1878. $OUTDEV_LIST \
  1879. $PROTOCOL_LIST \
  1880. enabled libdc1394 && append pkg_requires "libraw1394"
  1881. enabled libdirac && append pkg_requires "dirac"
  1882. enabled libtheora && append pkg_requires "theora"
  1883. enabled libvorbis && append pkg_requires "vorbisenc"
  1884. echo "install prefix $prefix"
  1885. echo "source path $source_path"
  1886. echo "C compiler $cc"
  1887. echo ".align is power-of-two $asmalign_pot"
  1888. echo "ARCH $arch ($cpu)"
  1889. if test "$build_suffix" != ""; then
  1890. echo "build suffix $build_suffix"
  1891. fi
  1892. if test "$extra_version" != ""; then
  1893. echo "version string suffix $extra_version"
  1894. fi
  1895. echo "big-endian ${bigendian-no}"
  1896. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1897. echo "yasm ${yasm-no}"
  1898. echo "MMX enabled ${mmx-no}"
  1899. echo "CMOV enabled ${cmov-no}"
  1900. echo "CMOV is fast ${fast_cmov-no}"
  1901. echo "EBX available ${ebx_available-no}"
  1902. echo "EBP available ${ebp_available-no}"
  1903. fi
  1904. if test $arch = "armv4l"; then
  1905. echo "ARMv5TE enabled ${armv5te-no}"
  1906. echo "ARMv6 enabled ${armv6-no}"
  1907. echo "ARM VFP enabled ${armvfp-no}"
  1908. echo "IWMMXT enabled ${iwmmxt-no}"
  1909. echo "NEON enabled ${neon-no}"
  1910. fi
  1911. if test $arch = "mips"; then
  1912. echo "MMI enabled ${mmi-no}"
  1913. fi
  1914. if test $arch = "powerpc"; then
  1915. echo "AltiVec enabled ${altivec-no}"
  1916. echo "dcbzl available ${dcbzl-no}"
  1917. fi
  1918. echo "gprof enabled ${gprof-no}"
  1919. echo "debug symbols ${debug-no}"
  1920. echo "strip symbols ${stripping-no}"
  1921. echo "optimizations ${optimizations-no}"
  1922. echo "static ${static-no}"
  1923. echo "shared ${shared-no}"
  1924. echo "postprocessing support ${postproc-no}"
  1925. echo "software scaler enabled ${swscale-no}"
  1926. echo "new filter support ${avfilter-no}"
  1927. echo "filters using lavformat ${avfilter_lavf-no}"
  1928. echo "video hooking ${vhook-no}"
  1929. if enabled vhook; then
  1930. echo "Imlib2 support ${imlib2-no}"
  1931. echo "FreeType support ${freetype2-no}"
  1932. fi
  1933. echo "network support ${network-no}"
  1934. if enabled network; then
  1935. echo "IPv6 support ${ipv6-no}"
  1936. fi
  1937. echo "threading support ${thread_type-no}"
  1938. echo "SDL support ${sdl-no}"
  1939. if enabled sdl_too_old; then
  1940. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1941. fi
  1942. echo "Sun medialib support ${mlib-no}"
  1943. echo "AVISynth enabled ${avisynth-no}"
  1944. echo "libamr-nb support ${libamr_nb-no}"
  1945. echo "libamr-wb support ${libamr_wb-no}"
  1946. echo "libdc1394 support ${libdc1394-no}"
  1947. echo "libdirac enabled ${libdirac-no}"
  1948. echo "libfaac enabled ${libfaac-no}"
  1949. echo "libfaad enabled ${libfaad-no}"
  1950. echo "libfaad dlopened ${libfaadbin-no}"
  1951. echo "libgsm enabled ${libgsm-no}"
  1952. echo "libmp3lame enabled ${libmp3lame-no}"
  1953. echo "libnut enabled ${libnut-no}"
  1954. echo "libschroedinger enabled ${libschroedinger-no}"
  1955. echo "libspeex enabled ${libspeex-no}"
  1956. echo "libtheora enabled ${libtheora-no}"
  1957. echo "libvorbis enabled ${libvorbis-no}"
  1958. echo "libx264 enabled ${libx264-no}"
  1959. echo "libxvid enabled ${libxvid-no}"
  1960. echo "zlib enabled ${zlib-no}"
  1961. echo "bzlib enabled ${bzlib-no}"
  1962. echo
  1963. for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
  1964. echo "Enabled ${type}s:"
  1965. eval list=\$$(toupper $type)_LIST
  1966. for part in $list; do
  1967. enabled $part && echo ${part%_*}
  1968. done | sort | pr -3 -t
  1969. echo
  1970. done
  1971. license="LGPL"
  1972. if enabled nonfree; then
  1973. license="unredistributable"
  1974. elif enabled gpl; then
  1975. license="GPL"
  1976. fi
  1977. echo "License: $license"
  1978. echo "Creating config.mak and config.h..."
  1979. echo "# Automatically generated by configure - do not modify!" > config.mak
  1980. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1981. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1982. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1983. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1984. echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  1985. echo "prefix=$prefix" >> config.mak
  1986. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1987. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1988. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1989. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1990. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1991. echo "CC=$cc" >> config.mak
  1992. echo "YASM=$yasmexe" >> config.mak
  1993. echo "AR=$ar" >> config.mak
  1994. echo "RANLIB=$ranlib" >> config.mak
  1995. echo "LN_S=$ln_s" >> config.mak
  1996. enabled stripping &&
  1997. echo "STRIP=$strip" >> config.mak ||
  1998. echo "STRIP=echo ignoring strip" >> config.mak
  1999. echo "OPTFLAGS=$CFLAGS" >> config.mak
  2000. echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
  2001. echo "LDFLAGS=$LDFLAGS" >> config.mak
  2002. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  2003. echo "SHFLAGS=$SHFLAGS" >> config.mak
  2004. echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  2005. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  2006. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  2007. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  2008. echo "BUILD_STATIC=$static" >> config.mak
  2009. echo "BUILDSUF=$build_suffix" >> config.mak
  2010. echo "FULLNAME=$FULLNAME" >> config.mak
  2011. echo "LIBPREF=$LIBPREF" >> config.mak
  2012. echo "LIBSUF=$LIBSUF" >> config.mak
  2013. echo "LIBNAME=$LIBNAME" >> config.mak
  2014. echo "SLIBPREF=$SLIBPREF" >> config.mak
  2015. echo "SLIBSUF=$SLIBSUF" >> config.mak
  2016. echo "EXESUF=$EXESUF" >> config.mak
  2017. echo "EXTRA_VERSION=$extra_version" >> config.mak
  2018. echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  2019. if enabled bigendian; then
  2020. echo "WORDS_BIGENDIAN=yes" >> config.mak
  2021. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  2022. fi
  2023. if enabled sdl; then
  2024. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  2025. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  2026. fi
  2027. if enabled texi2html; then
  2028. echo "BUILD_DOC=yes" >> config.mak
  2029. fi
  2030. get_version(){
  2031. name=$1
  2032. file=$source_path/$2
  2033. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2034. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2035. lcname=$(tolower $name)
  2036. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2037. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2038. }
  2039. get_version LIBSWSCALE libswscale/swscale.h
  2040. get_version LIBPOSTPROC libpostproc/postprocess.h
  2041. get_version LIBAVCODEC libavcodec/avcodec.h
  2042. get_version LIBAVDEVICE libavdevice/avdevice.h
  2043. get_version LIBAVFORMAT libavformat/avformat.h
  2044. get_version LIBAVUTIL libavutil/avutil.h
  2045. get_version LIBAVFILTER libavfilter/avfilter.h
  2046. if enabled shared; then
  2047. echo "BUILD_SHARED=yes" >> config.mak
  2048. echo "PIC=-fPIC -DPIC" >> config.mak
  2049. echo "LIBTARGET=${LIBTARGET}" >> config.mak
  2050. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  2051. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  2052. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  2053. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  2054. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  2055. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  2056. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  2057. fi
  2058. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  2059. echo "EXTRALIBS=$extralibs" >> config.mak
  2060. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2061. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2062. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2063. $CONFIG_EXTRA \
  2064. $DECODER_LIST \
  2065. $ENCODER_LIST \
  2066. $PARSER_LIST \
  2067. $BSF_LIST \
  2068. $DEMUXER_LIST \
  2069. $MUXER_LIST \
  2070. $FILTER_LIST \
  2071. $PROTOCOL_LIST \
  2072. $INDEV_LIST \
  2073. $OUTDEV_LIST \
  2074. echo "#define restrict $_restrict" >> $TMPH
  2075. if enabled small; then
  2076. echo "#define av_always_inline" >> $TMPH
  2077. fi
  2078. echo "SRC_PATH=\"$source_path\"" >> config.mak
  2079. echo "SRC_PATH_BARE=$source_path" >> config.mak
  2080. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  2081. # Apparently it's not possible to portably echo a backslash.
  2082. enabled asmalign_pot &&
  2083. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  2084. printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
  2085. echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  2086. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2087. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2088. cmp -s $TMPH config.h &&
  2089. echo "config.h is unchanged" ||
  2090. mv -f $TMPH config.h
  2091. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  2092. # build tree in object directory if source path is different from current one
  2093. if enabled source_path_used; then
  2094. DIRS="\
  2095. doc \
  2096. libavcodec \
  2097. libavcodec/alpha \
  2098. libavcodec/armv4l \
  2099. libavcodec/bfin \
  2100. libavcodec/i386 \
  2101. libavcodec/mlib \
  2102. libavcodec/ppc \
  2103. libavcodec/sh4 \
  2104. libavcodec/sparc \
  2105. libavdevice \
  2106. libavfilter \
  2107. libavformat \
  2108. libavutil \
  2109. libpostproc \
  2110. libswscale \
  2111. tests \
  2112. tools \
  2113. vhook \
  2114. "
  2115. FILES="\
  2116. Makefile \
  2117. common.mak \
  2118. subdir.mak \
  2119. doc/texi2pod.pl \
  2120. libavcodec/Makefile \
  2121. libavdevice/Makefile \
  2122. libavfilter/Makefile \
  2123. libavformat/Makefile \
  2124. libavutil/Makefile \
  2125. libpostproc/Makefile \
  2126. libswscale/Makefile \
  2127. "
  2128. for dir in $DIRS ; do
  2129. mkdir -p $dir
  2130. done
  2131. for f in $FILES ; do
  2132. $ln_s "$source_path/$f" $f
  2133. done
  2134. fi
  2135. # build pkg-config files
  2136. pkgconfig_generate(){
  2137. name=$1
  2138. shortname=${name#lib}${build_suffix}
  2139. comment=$2
  2140. version=$3
  2141. libs=$4
  2142. requires=$5
  2143. cat <<EOF > $name/$name.pc
  2144. prefix=$prefix
  2145. exec_prefix=\${prefix}
  2146. libdir=$libdir
  2147. includedir=$incdir
  2148. Name: $name
  2149. Description: $comment
  2150. Version: $version
  2151. Requires: $(disabled shared && echo $requires)
  2152. Requires.private: $(enabled shared && echo $requires)
  2153. Conflicts:
  2154. Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  2155. Libs.private: $(enabled shared && echo $libs)
  2156. Cflags: -I\${includedir}
  2157. EOF
  2158. cat <<EOF > $name/$name-uninstalled.pc
  2159. prefix=
  2160. exec_prefix=
  2161. libdir=\${pcfiledir}
  2162. includedir=${source_path}
  2163. Name: $name
  2164. Description: $comment
  2165. Version: $version
  2166. Requires: $requires
  2167. Conflicts:
  2168. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2169. Cflags: -I\${includedir}
  2170. EOF
  2171. }
  2172. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2173. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2174. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2175. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
  2176. enabled avfilter &&
  2177. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2178. enabled postproc &&
  2179. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2180. if enabled swscale; then
  2181. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  2182. else
  2183. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2184. apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
  2185. fi