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.

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