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.

2438 lines
71KB

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