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.

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