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.

2460 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. ar="ar"
  1010. cc_default="gcc"
  1011. host_cc_default="gcc"
  1012. ln_s="ln -sf"
  1013. nm_default="nm"
  1014. objformat="elf"
  1015. ranlib="ranlib"
  1016. strip="strip"
  1017. yasmexe="yasm"
  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. ar="${cross_prefix}${ar}"
  1160. cc_default="${cross_prefix}${cc_default}"
  1161. nm_default="${cross_prefix}${nm_default}"
  1162. ranlib="${cross_prefix}${ranlib}"
  1163. strip="${cross_prefix}${strip}"
  1164. set_default cc nm
  1165. enabled cross_compile || host_cc_default=$cc
  1166. set_default host_cc
  1167. # set temporary file name
  1168. : ${TMPDIR:=$TEMPDIR}
  1169. : ${TMPDIR:=$TMP}
  1170. : ${TMPDIR:=/tmp}
  1171. TMPC="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  1172. TMPE="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
  1173. TMPH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  1174. TMPO="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  1175. TMPS="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  1176. TMPSH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
  1177. check_cflags -std=c99
  1178. case "$arch" in
  1179. i386|i486|i586|i686|i86pc|BePC)
  1180. arch="x86_32"
  1181. enable fast_unaligned
  1182. ;;
  1183. x86_64|amd64)
  1184. arch="x86_32"
  1185. enable cmov
  1186. enable fast_cmov
  1187. enable fast_unaligned
  1188. check_cc <<EOF && enable fast_64bit && arch="x86_64"
  1189. int test[sizeof(char*) - 7];
  1190. EOF
  1191. ;;
  1192. arm|armv[4567]*l)
  1193. arch="arm"
  1194. ;;
  1195. alpha)
  1196. arch="alpha"
  1197. enable fast_64bit
  1198. ;;
  1199. "Power Macintosh"|ppc|powerpc)
  1200. arch="ppc"
  1201. enable fast_unaligned
  1202. ;;
  1203. ppc64)
  1204. arch="ppc"
  1205. enable fast_64bit
  1206. enable fast_unaligned
  1207. ;;
  1208. mips|mipsel|IP*)
  1209. arch="mips"
  1210. ;;
  1211. mips64)
  1212. arch="mips"
  1213. enable fast_64bit
  1214. ;;
  1215. sun4u|sparc64)
  1216. arch="sparc64"
  1217. enable fast_64bit
  1218. ;;
  1219. sparc)
  1220. arch="sparc"
  1221. ;;
  1222. sh4|sh)
  1223. arch="sh4"
  1224. ;;
  1225. parisc|hppa)
  1226. arch="parisc"
  1227. ;;
  1228. parisc64|hppa64)
  1229. arch="parisc"
  1230. enable fast_64bit
  1231. ;;
  1232. s390|s390x)
  1233. arch="s390"
  1234. ;;
  1235. m68k)
  1236. arch="m68k"
  1237. ;;
  1238. ia64)
  1239. arch="ia64"
  1240. enable fast_64bit
  1241. ;;
  1242. bfin)
  1243. arch="bfin"
  1244. ;;
  1245. *)
  1246. arch="unknown"
  1247. ;;
  1248. esac
  1249. enable $arch
  1250. enabled_any x86_32 x86_64 && enable x86
  1251. enabled sparc64 && enable sparc
  1252. # OS specific
  1253. case $target_os in
  1254. beos|haiku|zeta)
  1255. prefix_default="$HOME/config"
  1256. # helps building libavcodec
  1257. add_cflags "-DPIC -fomit-frame-pointer"
  1258. # 3 gcc releases known for BeOS, each with ugly bugs
  1259. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1260. case "$gcc_version" in
  1261. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1262. disable mmx
  1263. ;;
  1264. *20010315*) echo "BeBits gcc"
  1265. add_cflags "-fno-expensive-optimizations"
  1266. ;;
  1267. esac
  1268. SHFLAGS=-nostart
  1269. # enable BeOS things
  1270. enable audio_beos
  1271. # no need for libm, but the inet stuff
  1272. # Check for BONE
  1273. # XXX: actually should check for NOT net_server
  1274. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1275. network_extralibs="-lbind -lsocket"
  1276. else
  1277. enable beos_netserver
  1278. network_extralibs="-lnet"
  1279. fi ;;
  1280. sunos)
  1281. FFSERVERLDFLAGS=""
  1282. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1283. network_extralibs="-lsocket -lnsl"
  1284. add_cflags -D__EXTENSIONS__
  1285. ;;
  1286. netbsd)
  1287. oss_demuxer_extralibs="-lossaudio"
  1288. oss_muxer_extralibs="-lossaudio"
  1289. ;;
  1290. openbsd)
  1291. disable need_memalign
  1292. LIBOBJFLAGS='$(PIC)'
  1293. SHFLAGS='-shared'
  1294. oss_demuxer_extralibs="-lossaudio"
  1295. oss_muxer_extralibs="-lossaudio"
  1296. ;;
  1297. freebsd)
  1298. disable need_memalign
  1299. ;;
  1300. bsd/os)
  1301. osextralibs="-lpoll -lgnugetopt"
  1302. strip="strip -d"
  1303. ;;
  1304. darwin)
  1305. disable need_memalign
  1306. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1307. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
  1308. strip="strip -x"
  1309. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1310. SLIBSUF=".dylib"
  1311. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1312. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1313. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1314. objformat="macho"
  1315. enabled x86_64 && objformat="macho64"
  1316. ;;
  1317. mingw32*)
  1318. target_os=mingw32
  1319. LIBTARGET=i386
  1320. if test $arch = x86_64; then
  1321. disable need_memalign
  1322. LIBTARGET=x64
  1323. fi
  1324. shlibdir_default="$bindir_default"
  1325. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1326. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1327. if enabled swscale; then
  1328. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1329. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1330. fi
  1331. disable ffserver
  1332. SLIBPREF=""
  1333. SLIBSUF=".dll"
  1334. EXESUF=".exe"
  1335. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1336. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1337. SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1338. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1339. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1340. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1341. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1342. objformat="win32"
  1343. enable dos_paths
  1344. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1345. die "ERROR: MinGW runtime version must be >= 3.15."
  1346. enabled_any avisynth vfwcap_demuxer &&
  1347. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  1348. die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.13 or later."; }
  1349. ;;
  1350. cygwin*)
  1351. target_os=cygwin
  1352. shlibdir_default="$bindir_default"
  1353. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1354. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1355. if enabled swscale; then
  1356. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1357. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1358. fi
  1359. EXESUF=".exe"
  1360. SLIBPREF="cyg"
  1361. SLIBSUF=".dll"
  1362. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1363. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1364. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1365. objformat="win32"
  1366. enable dos_paths
  1367. ;;
  1368. *-dos|freedos|opendos)
  1369. disable ffplay ffserver vhook
  1370. disable $INDEV_LIST $OUTDEV_LIST
  1371. network_extralibs="-lsocket"
  1372. EXESUF=".exe"
  1373. objformat="win32"
  1374. enable dos_paths
  1375. ;;
  1376. linux)
  1377. enable dv1394
  1378. ;;
  1379. irix*)
  1380. target_os=irix
  1381. ranlib="echo ignoring ranlib"
  1382. ;;
  1383. os/2*)
  1384. strip="lxlite"
  1385. ln_s="cp -f"
  1386. EXESUF=".exe"
  1387. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1388. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1389. FFSERVERLDFLAGS=""
  1390. LIBSUF="_s.a"
  1391. SLIBPREF=""
  1392. SLIBSUF=".dll"
  1393. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1394. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1395. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1396. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1397. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1398. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1399. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1400. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1401. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1402. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1403. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1404. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1405. disable vhook
  1406. enable dos_paths
  1407. ;;
  1408. interix)
  1409. disable vhook
  1410. ;;
  1411. *)
  1412. target_os="${target_os}-UNKNOWN"
  1413. ;;
  1414. esac
  1415. set_default $PATHS_LIST
  1416. add_extralibs $osextralibs
  1417. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1418. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1419. # we need to build at least one lib type
  1420. if ! enabled_any static shared; then
  1421. cat <<EOF
  1422. At least one library type must be built.
  1423. Specify --enable-static to build the static libraries or --enable-shared to
  1424. build the shared libraries as well. To only build the shared libraries specify
  1425. --disable-static in addition to --enable-shared.
  1426. EOF
  1427. exit 1;
  1428. fi
  1429. disabled static && LIBNAME=""
  1430. if enabled_any libfaad libfaadbin ; then
  1431. if check_header faad.h; then
  1432. check_cc <<EOF
  1433. #include <faad.h>
  1434. #ifndef FAAD2_VERSION
  1435. ok faad1
  1436. #endif
  1437. int main(void) { return 0; }
  1438. EOF
  1439. test $? = 0 && enable libfaad2
  1440. else
  1441. die "FAAD test failed."
  1442. fi
  1443. fi
  1444. if ! enabled gpl; then
  1445. die_gpl_disabled(){
  1446. name=$1
  1447. shift
  1448. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1449. }
  1450. die_gpl_disabled "The Postprocessing code" postproc
  1451. die_gpl_disabled "libx264" libx264
  1452. die_gpl_disabled "libxvidcore" libxvid
  1453. die_gpl_disabled "FAAD2" libfaad2
  1454. die_gpl_disabled "The X11 grabber" x11grab
  1455. die_gpl_disabled "The software scaler" swscale
  1456. fi
  1457. if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1458. die "libamr is nonfree and --enable-nonfree is not specified."
  1459. fi
  1460. check_deps $ARCH_EXT_LIST
  1461. test -z "$need_memalign" && need_memalign="$mmx"
  1462. #Darwin CC versions
  1463. if test $target_os = darwin; then
  1464. if $cc -v 2>&1 | grep -q xlc; then
  1465. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1466. else
  1467. add_cflags "-pipe"
  1468. check_cflags "-force_cpusubtype_ALL"
  1469. check_cflags "-Wno-sign-compare"
  1470. enabled shared || check_cflags -mdynamic-no-pic
  1471. fi
  1472. fi
  1473. disabled optimizations || check_cflags -fomit-frame-pointer
  1474. # Add processor-specific flags
  1475. if test $cpu != "generic"; then
  1476. warn_altivec(){
  1477. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1478. }
  1479. case $cpu in
  1480. 601|ppc601|PowerPC601)
  1481. add_cflags "-mcpu=601"
  1482. warn_altivec enabled PPC601
  1483. ;;
  1484. 603*|ppc603*|PowerPC603*)
  1485. add_cflags "-mcpu=603"
  1486. warn_altivec enabled PPC603
  1487. ;;
  1488. 604*|ppc604*|PowerPC604*)
  1489. add_cflags "-mcpu=604"
  1490. warn_altivec enabled PPC604
  1491. ;;
  1492. G3|g3|75*|ppc75*|PowerPC75*)
  1493. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1494. warn_altivec enabled PPC75x
  1495. ;;
  1496. G4|g4|745*|ppc745*|PowerPC745*)
  1497. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1498. warn_altivec disabled PPC745x
  1499. ;;
  1500. 74*|ppc74*|PowerPC74*)
  1501. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1502. warn_altivec disabled PPC74xx
  1503. ;;
  1504. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1505. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1506. warn_altivec disabled PPC970
  1507. enable ppc64
  1508. ;;
  1509. Cell|CELL|cell)
  1510. add_cflags "-mcpu=cell"
  1511. warn_altivec disabled Cell
  1512. enable ppc64
  1513. ;;
  1514. # targets that do NOT support conditional mov (cmov)
  1515. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1516. add_cflags "-march=$cpu"
  1517. disable cmov
  1518. ;;
  1519. # targets that do support conditional mov (cmov)
  1520. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1521. add_cflags "-march=$cpu"
  1522. enable cmov
  1523. enable fast_cmov
  1524. ;;
  1525. # targets that do support conditional mov but on which it's slow
  1526. pentium4|pentium4m|prescott|nocona)
  1527. add_cflags "-march=$cpu"
  1528. enable cmov
  1529. disable fast_cmov
  1530. ;;
  1531. sparc64)
  1532. add_cflags "-mcpu=v9"
  1533. ;;
  1534. arm11*|cortex*)
  1535. add_cflags "-mcpu=$cpu"
  1536. enable fast_unaligned
  1537. ;;
  1538. armv*)
  1539. add_cflags "-march=$cpu"
  1540. ;;
  1541. arm*)
  1542. add_cflags "-mcpu=$cpu"
  1543. ;;
  1544. *)
  1545. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1546. ;;
  1547. esac
  1548. fi
  1549. # make sure we can execute files in $TMPDIR
  1550. cat > $TMPSH 2>> $logfile <<EOF
  1551. #! /bin/sh
  1552. EOF
  1553. chmod +x $TMPSH >> $logfile 2>&1
  1554. if ! $TMPSH >> $logfile 2>&1; then
  1555. cat <<EOF
  1556. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1557. variable to another directory and make sure that it is not mounted noexec.
  1558. EOF
  1559. die "Sanity test failed."
  1560. fi
  1561. rm $TMPSH
  1562. # compiler sanity check
  1563. check_exec <<EOF
  1564. int main(void){ return 0; }
  1565. EOF
  1566. if test "$?" != 0; then
  1567. echo "$cc is unable to create an executable file."
  1568. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1569. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1570. echo "Only do this if you know what cross compiling means."
  1571. fi
  1572. die "C compiler test failed."
  1573. fi
  1574. check_cc <<EOF || die "Symbol mangling check failed."
  1575. int ff_extern;
  1576. EOF
  1577. sym=$($nm -P -g $TMPO | grep ff_extern)
  1578. extern_prefix=${sym%%ff_extern*}
  1579. check_asm inline_asm '""'
  1580. if enabled x86; then
  1581. # check whether EBP is available on x86
  1582. # As 'i' is stored on the stack, this program will crash
  1583. # if the base pointer is used to access it because the
  1584. # base pointer is cleared in the inline assembly code.
  1585. check_exec_crash <<EOF && enable ebp_available
  1586. volatile int i=0;
  1587. __asm__ volatile (
  1588. "xorl %%ebp, %%ebp"
  1589. ::: "%ebp");
  1590. return i;
  1591. EOF
  1592. # check wether EBX is available on x86
  1593. check_asm ebx_available '"":::"%ebx"'
  1594. # check whether binutils is new enough to compile SSSE3/MMX2
  1595. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1596. enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
  1597. check_asm bswap '"bswap %%eax" ::: "%eax"'
  1598. YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
  1599. enabled x86_64 && append YASMFLAGS "-m amd64"
  1600. enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1601. case "$objformat" in
  1602. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1603. macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
  1604. *) append YASMFLAGS "-DPREFIX" ;;
  1605. esac
  1606. check_yasm "pabsw xmm0, xmm0" && enable yasm
  1607. fi
  1608. # check for assembler specific support
  1609. if test $arch = "ppc"; then
  1610. check_asm dcbzl '"dcbzl 0, 1"'
  1611. fi
  1612. # check for SIMD availability
  1613. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1614. if enabled altivec; then
  1615. check_cflags -maltivec -mabi=altivec &&
  1616. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1617. check_cflags -faltivec
  1618. # check if our compiler supports Motorola AltiVec C API
  1619. check_cc <<EOF || disable altivec
  1620. $inc_altivec_h
  1621. int main(void) {
  1622. vector signed int v1, v2, v3;
  1623. v1 = vec_add(v2,v3);
  1624. return 0;
  1625. }
  1626. EOF
  1627. # check if our compiler supports braces for vector declarations
  1628. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1629. $inc_altivec_h
  1630. int main (void) { (vector int) {1}; return 0; }
  1631. EOF
  1632. fi
  1633. # We have to check if pld is a nop and disable it.
  1634. enabled arm && check_asm pld '"pld [r0]"'
  1635. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1636. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1637. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  1638. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  1639. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1640. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1641. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  1642. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1643. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1644. # ---
  1645. # big/little-endian test
  1646. check_cc <<EOF || die "endian test failed"
  1647. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1648. EOF
  1649. od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1650. # ---
  1651. # check availability of some header files
  1652. if check_func dlopen; then
  1653. ldl=
  1654. elif check_func dlopen -ldl; then
  1655. ldl=-ldl
  1656. fi
  1657. check_func fork
  1658. check_func gethrtime
  1659. check_func getrusage
  1660. check_func inet_aton $network_extralibs
  1661. check_func memalign
  1662. check_func mkstemp
  1663. check_func_headers windows.h GetProcessTimes
  1664. check_header conio.h
  1665. check_header dlfcn.h
  1666. check_header malloc.h
  1667. check_header poll.h
  1668. check_header sys/mman.h
  1669. check_header sys/resource.h
  1670. check_header sys/select.h
  1671. check_header termios.h
  1672. check_header vdpau/vdpau.h
  1673. check_header vdpau/vdpau_x11.h
  1674. check_header X11/extensions/XvMClib.h
  1675. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1676. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1677. fi
  1678. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  1679. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1680. # check for some common methods of building with pthread support
  1681. # do this before the optional library checks as some of them require pthreads
  1682. if enabled pthreads; then
  1683. if check_func pthread_create; then
  1684. :
  1685. elif check_func pthread_create -pthread; then
  1686. add_cflags -pthread
  1687. add_extralibs -pthread
  1688. elif check_func pthread_create -pthreads; then
  1689. add_cflags -pthreads
  1690. add_extralibs -pthreads
  1691. elif check_func pthread_create -lpthreadGC2; then
  1692. add_extralibs -lpthreadGC2
  1693. elif ! check_lib pthread.h pthread_create -lpthread; then
  1694. die "ERROR: can't find pthreads library"
  1695. fi
  1696. fi
  1697. for thread in $THREADS_LIST; do
  1698. if enabled $thread; then
  1699. test -n "$thread_type" &&
  1700. die "ERROR: Only one thread type must be selected." ||
  1701. thread_type="$thread"
  1702. fi
  1703. done
  1704. check_lib math.h sin -lm
  1705. # test for C99 functions in math.h
  1706. for func in llrint lrint lrintf round roundf; do
  1707. check_exec <<EOF && enable $func || disable $func
  1708. #include <math.h>
  1709. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1710. EOF
  1711. done
  1712. # these are off by default, so fail if requested and not available
  1713. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1714. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1715. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1716. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  1717. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
  1718. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1719. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1720. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1721. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1722. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  1723. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1724. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  1725. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1726. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  1727. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1728. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1729. enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
  1730. { check_cpp_condition x264.h "X264_BUILD >= 65" ||
  1731. die "ERROR: libx264 version must be >= 0.65."; }
  1732. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  1733. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1734. # libdc1394 check
  1735. if enabled libdc1394; then
  1736. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1737. enable libdc1394_2; } ||
  1738. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1739. enable libdc1394_1; } ||
  1740. die "ERROR: No version of libdc1394 found "
  1741. fi
  1742. _restrict=
  1743. for restrict_keyword in restrict __restrict__ __restrict; do
  1744. check_cc <<EOF && _restrict=$restrict_keyword && break
  1745. void foo(char * $restrict_keyword p);
  1746. EOF
  1747. done
  1748. test "$vhook" = "default" && vhook="$dlopen"
  1749. if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
  1750. disable vhook
  1751. echo
  1752. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1753. echo "Patches welcome."
  1754. echo
  1755. fi
  1756. if enabled vhook; then
  1757. check_ldflags -rdynamic
  1758. check_ldflags -export-dynamic
  1759. fi
  1760. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1761. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1762. ##########################################
  1763. # SDL check
  1764. disable sdl_too_old
  1765. disable sdl
  1766. SDL_CONFIG="${cross_prefix}sdl-config"
  1767. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1768. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1769. temp_cflags $sdl_cflags
  1770. temp_extralibs `"${SDL_CONFIG}" --libs`
  1771. if check_lib2 SDL.h SDL_Init; then
  1772. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1773. if test "$_sdlversion" -lt 121 ; then
  1774. enable sdl_too_old
  1775. else
  1776. enable sdl
  1777. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1778. #include <SDL.h>
  1779. int main(int argc, char **argv){
  1780. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1781. int w = vi->current_w;
  1782. return 0;
  1783. }
  1784. EOF
  1785. fi
  1786. fi
  1787. restore_flags
  1788. fi
  1789. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1790. ##########################################
  1791. # Network check
  1792. if enabled network; then
  1793. check_type "sys/types.h sys/socket.h" socklen_t
  1794. # Prefer arpa/inet.h over winsock2
  1795. if check_header arpa/inet.h ; then
  1796. check_func closesocket
  1797. elif check_header winsock2.h ; then
  1798. network_extralibs="-lws2_32"
  1799. check_type ws2tcpip.h socklen_t
  1800. check_func_headers winsock2.h closesocket
  1801. fi
  1802. fi
  1803. ##########################################
  1804. # IPv6 check
  1805. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1806. #include <sys/types.h>
  1807. #include <sys/socket.h>
  1808. #include <netinet/in.h>
  1809. #include <netdb.h>
  1810. int main(void) {
  1811. struct sockaddr_storage saddr;
  1812. struct ipv6_mreq mreq6;
  1813. getaddrinfo(0,0,0,0);
  1814. getnameinfo(0,0,0,0,0,0,0);
  1815. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1816. }
  1817. EOF
  1818. check_header linux/videodev.h
  1819. check_header linux/videodev2.h
  1820. check_header sys/videoio.h
  1821. check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1822. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1823. { check_header dev/bktr/ioctl_meteor.h &&
  1824. check_header dev/bktr/ioctl_bt848.h; } ||
  1825. { check_header machine/ioctl_meteor.h &&
  1826. check_header machine/ioctl_bt848.h; } ||
  1827. { check_header dev/video/meteor/ioctl_meteor.h &&
  1828. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1829. check_header dev/ic/bt8xx.h
  1830. check_header sys/soundcard.h
  1831. check_header soundcard.h
  1832. # deal with the X11 frame grabber
  1833. enabled x11grab &&
  1834. check_header X11/Xlib.h &&
  1835. check_header X11/extensions/XShm.h &&
  1836. check_func XOpenDisplay -lX11 &&
  1837. check_func XShmCreateImage -lX11 -lXext
  1838. enabled debug && add_cflags -g"$debuglevel"
  1839. # add some useful compiler flags if supported
  1840. check_cflags -Wdeclaration-after-statement
  1841. check_cflags -Wall
  1842. check_cflags -Wno-switch
  1843. check_cflags -Wdisabled-optimization
  1844. check_cflags -Wpointer-arith
  1845. check_cflags -Wredundant-decls
  1846. check_cflags -Wno-pointer-sign
  1847. check_cflags -Wcast-qual
  1848. check_cflags -Wwrite-strings
  1849. check_cflags -Wtype-limits
  1850. enabled extra_warnings && check_cflags -Winline
  1851. # add some linker flags
  1852. check_ldflags -Wl,--warn-common
  1853. check_ldflags -Wl,--as-needed
  1854. 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'
  1855. check_ldflags -Wl,-Bsymbolic
  1856. if enabled small; then
  1857. check_cflags -Os # not all compilers support -Os
  1858. optimizations="small"
  1859. elif enabled optimizations; then
  1860. if $cc -v 2>&1 | grep -q xlc; then
  1861. add_cflags "-O5"
  1862. add_ldflags "-O5"
  1863. else
  1864. add_cflags "-O3"
  1865. fi
  1866. fi
  1867. check_cflags -fno-math-errno
  1868. check_cflags -fno-signed-zeros
  1869. # add some flags for Intel C Compiler
  1870. if $cc --version 2> /dev/null | grep -q Intel; then
  1871. # Just warnings, no remarks
  1872. check_cflags -w1
  1873. # -wd: Disable following warnings
  1874. # 144, 167, 556: -Wno-pointer-sign
  1875. # 10006: ignoring unknown option -fno-signed-zeros
  1876. # 10156: ignoring option '-W'; no argument required
  1877. check_cflags -wd144,167,556,10006,10156
  1878. # 11030: Warning unknown option --as-needed
  1879. # 10156: ignoring option '-export'; no argument required
  1880. check_ldflags -wd10156,11030
  1881. # Allow to compile with optimizations
  1882. check_ldflags -march=$cpu
  1883. fi
  1884. # PIC flags for shared library objects where they are needed
  1885. if enabled shared; then
  1886. # LIBOBJFLAGS may have already been set in the OS configuration
  1887. if test -z "$LIBOBJFLAGS" ; then
  1888. case "$arch" in
  1889. x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  1890. esac
  1891. fi
  1892. fi
  1893. if enabled gprof; then
  1894. add_cflags "-p"
  1895. add_ldflags "-p"
  1896. fi
  1897. VHOOKCFLAGS="-fPIC"
  1898. # Find out if the .align argument is a power of two or not.
  1899. check_asm asmalign_pot '".align 3"'
  1900. enabled_any $DECODER_LIST && enable decoders
  1901. enabled_any $ENCODER_LIST && enable encoders
  1902. enabled_any $BSF_LIST && enable bsfs
  1903. enabled_any $DEMUXER_LIST && enable demuxers
  1904. enabled_any $MUXER_LIST && enable muxers
  1905. enabled_any $FILTER_LIST && enable filters
  1906. enabled_any $INDEV_LIST && enable demuxers
  1907. enabled_any $OUTDEV_LIST && enable muxers
  1908. enabled_any $PROTOCOL_LIST && enable protocols
  1909. enabled_any $THREADS_LIST && enable threads
  1910. check_deps $CONFIG_LIST \
  1911. $CONFIG_EXTRA \
  1912. $HAVE_LIST \
  1913. $DECODER_LIST \
  1914. $ENCODER_LIST \
  1915. $PARSER_LIST \
  1916. $BSF_LIST \
  1917. $DEMUXER_LIST \
  1918. $MUXER_LIST \
  1919. $FILTER_LIST \
  1920. $INDEV_LIST \
  1921. $OUTDEV_LIST \
  1922. $PROTOCOL_LIST \
  1923. echo "install prefix $prefix"
  1924. echo "source path $source_path"
  1925. echo "C compiler $cc"
  1926. echo ".align is power-of-two $asmalign_pot"
  1927. echo "ARCH $arch ($cpu)"
  1928. if test "$build_suffix" != ""; then
  1929. echo "build suffix $build_suffix"
  1930. fi
  1931. if test "$extra_version" != ""; then
  1932. echo "version string suffix $extra_version"
  1933. fi
  1934. echo "big-endian ${bigendian-no}"
  1935. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1936. echo "yasm ${yasm-no}"
  1937. echo "MMX enabled ${mmx-no}"
  1938. echo "CMOV enabled ${cmov-no}"
  1939. echo "CMOV is fast ${fast_cmov-no}"
  1940. echo "EBX available ${ebx_available-no}"
  1941. echo "EBP available ${ebp_available-no}"
  1942. fi
  1943. if test $arch = "arm"; then
  1944. echo "ARMv5TE enabled ${armv5te-no}"
  1945. echo "ARMv6 enabled ${armv6-no}"
  1946. echo "ARMv6T2 enabled ${armv6t2-no}"
  1947. echo "ARM VFP enabled ${armvfp-no}"
  1948. echo "IWMMXT enabled ${iwmmxt-no}"
  1949. echo "NEON enabled ${neon-no}"
  1950. fi
  1951. if test $arch = "mips"; then
  1952. echo "MMI enabled ${mmi-no}"
  1953. fi
  1954. if test $arch = "ppc"; then
  1955. echo "AltiVec enabled ${altivec-no}"
  1956. echo "dcbzl available ${dcbzl-no}"
  1957. fi
  1958. echo "gprof enabled ${gprof-no}"
  1959. echo "debug symbols ${debug-no}"
  1960. echo "strip symbols ${stripping-no}"
  1961. echo "optimizations ${optimizations-no}"
  1962. echo "static ${static-no}"
  1963. echo "shared ${shared-no}"
  1964. echo "postprocessing support ${postproc-no}"
  1965. echo "software scaler enabled ${swscale-no}"
  1966. echo "new filter support ${avfilter-no}"
  1967. echo "filters using lavformat ${avfilter_lavf-no}"
  1968. echo "video hooking ${vhook-no}"
  1969. if enabled vhook; then
  1970. echo "Imlib2 support ${imlib2-no}"
  1971. echo "FreeType support ${freetype2-no}"
  1972. fi
  1973. echo "network support ${network-no}"
  1974. if enabled network; then
  1975. echo "IPv6 support ${ipv6-no}"
  1976. fi
  1977. echo "threading support ${thread_type-no}"
  1978. echo "SDL support ${sdl-no}"
  1979. if enabled sdl_too_old; then
  1980. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1981. fi
  1982. echo "Sun medialib support ${mlib-no}"
  1983. echo "AVISynth enabled ${avisynth-no}"
  1984. echo "libamr-nb support ${libamr_nb-no}"
  1985. echo "libamr-wb support ${libamr_wb-no}"
  1986. echo "libdc1394 support ${libdc1394-no}"
  1987. echo "libdirac enabled ${libdirac-no}"
  1988. echo "libfaac enabled ${libfaac-no}"
  1989. echo "libfaad enabled ${libfaad-no}"
  1990. echo "libfaad dlopened ${libfaadbin-no}"
  1991. echo "libgsm enabled ${libgsm-no}"
  1992. echo "libmp3lame enabled ${libmp3lame-no}"
  1993. echo "libnut enabled ${libnut-no}"
  1994. echo "libschroedinger enabled ${libschroedinger-no}"
  1995. echo "libspeex enabled ${libspeex-no}"
  1996. echo "libtheora enabled ${libtheora-no}"
  1997. echo "libvorbis enabled ${libvorbis-no}"
  1998. echo "libx264 enabled ${libx264-no}"
  1999. echo "libxvid enabled ${libxvid-no}"
  2000. echo "vdpau enabled ${vdpau-no}"
  2001. echo "zlib enabled ${zlib-no}"
  2002. echo "bzlib enabled ${bzlib-no}"
  2003. echo
  2004. for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
  2005. echo "Enabled ${type}s:"
  2006. eval list=\$$(toupper $type)_LIST
  2007. for part in $list; do
  2008. enabled $part && echo ${part%_*}
  2009. done | sort | pr -3 -t
  2010. echo
  2011. done
  2012. license="LGPL"
  2013. if enabled nonfree; then
  2014. license="unredistributable"
  2015. elif enabled gpl; then
  2016. license="GPL"
  2017. fi
  2018. echo "License: $license"
  2019. echo "Creating config.mak and config.h..."
  2020. echo "# Automatically generated by configure - do not modify!" > config.mak
  2021. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  2022. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  2023. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  2024. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  2025. echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  2026. echo "prefix=$prefix" >> config.mak
  2027. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  2028. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  2029. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  2030. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  2031. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  2032. echo "CC=$cc" >> config.mak
  2033. echo "YASM=$yasmexe" >> config.mak
  2034. echo "AR=$ar" >> config.mak
  2035. echo "RANLIB=$ranlib" >> config.mak
  2036. echo "LN_S=$ln_s" >> config.mak
  2037. enabled stripping &&
  2038. echo "STRIP=$strip" >> config.mak ||
  2039. echo "STRIP=echo ignoring strip" >> config.mak
  2040. echo "OPTFLAGS=$CFLAGS" >> config.mak
  2041. echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
  2042. echo "LDFLAGS=$LDFLAGS" >> config.mak
  2043. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  2044. echo "SHFLAGS=$SHFLAGS" >> config.mak
  2045. echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  2046. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  2047. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  2048. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  2049. echo "BUILD_STATIC=$static" >> config.mak
  2050. echo "BUILDSUF=$build_suffix" >> config.mak
  2051. echo "FULLNAME=$FULLNAME" >> config.mak
  2052. echo "LIBPREF=$LIBPREF" >> config.mak
  2053. echo "LIBSUF=$LIBSUF" >> config.mak
  2054. echo "LIBNAME=$LIBNAME" >> config.mak
  2055. echo "SLIBPREF=$SLIBPREF" >> config.mak
  2056. echo "SLIBSUF=$SLIBSUF" >> config.mak
  2057. echo "EXESUF=$EXESUF" >> config.mak
  2058. echo "EXTRA_VERSION=$extra_version" >> config.mak
  2059. echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  2060. echo "HOSTCC=$host_cc" >> config.mak
  2061. echo "HOSTCFLAGS=$host_cflags" >> config.mak
  2062. echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
  2063. echo "HOSTLIBS=$host_libs" >> config.mak
  2064. echo "TARGET_EXEC=$target_exec" >> config.mak
  2065. echo "TARGET_PATH=$target_path" >> config.mak
  2066. if enabled bigendian; then
  2067. echo "WORDS_BIGENDIAN=yes" >> config.mak
  2068. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  2069. fi
  2070. if enabled sdl; then
  2071. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  2072. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  2073. fi
  2074. if enabled texi2html; then
  2075. echo "BUILD_DOC=yes" >> config.mak
  2076. fi
  2077. get_version(){
  2078. name=$1
  2079. file=$source_path/$2
  2080. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2081. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2082. lcname=$(tolower $name)
  2083. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2084. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2085. }
  2086. get_version LIBSWSCALE libswscale/swscale.h
  2087. get_version LIBPOSTPROC libpostproc/postprocess.h
  2088. get_version LIBAVCODEC libavcodec/avcodec.h
  2089. get_version LIBAVDEVICE libavdevice/avdevice.h
  2090. get_version LIBAVFORMAT libavformat/avformat.h
  2091. get_version LIBAVUTIL libavutil/avutil.h
  2092. get_version LIBAVFILTER libavfilter/avfilter.h
  2093. if enabled shared; then
  2094. echo "BUILD_SHARED=yes" >> config.mak
  2095. echo "PIC=-fPIC -DPIC" >> config.mak
  2096. echo "LIBTARGET=${LIBTARGET}" >> config.mak
  2097. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  2098. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  2099. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  2100. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  2101. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  2102. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  2103. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  2104. fi
  2105. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  2106. echo "EXTRALIBS=$extralibs" >> config.mak
  2107. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2108. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2109. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2110. $CONFIG_EXTRA \
  2111. $DECODER_LIST \
  2112. $ENCODER_LIST \
  2113. $PARSER_LIST \
  2114. $BSF_LIST \
  2115. $DEMUXER_LIST \
  2116. $MUXER_LIST \
  2117. $FILTER_LIST \
  2118. $PROTOCOL_LIST \
  2119. $INDEV_LIST \
  2120. $OUTDEV_LIST \
  2121. echo "#define restrict $_restrict" >> $TMPH
  2122. if enabled small; then
  2123. echo "#define av_always_inline" >> $TMPH
  2124. fi
  2125. echo "SRC_PATH=\"$source_path\"" >> config.mak
  2126. echo "SRC_PATH_BARE=$source_path" >> config.mak
  2127. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  2128. # Apparently it's not possible to portably echo a backslash.
  2129. enabled asmalign_pot &&
  2130. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  2131. printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
  2132. echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  2133. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2134. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2135. cmp -s $TMPH config.h &&
  2136. echo "config.h is unchanged" ||
  2137. mv -f $TMPH config.h
  2138. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  2139. # build tree in object directory if source path is different from current one
  2140. if enabled source_path_used; then
  2141. DIRS="\
  2142. doc \
  2143. libavcodec \
  2144. libavcodec/alpha \
  2145. libavcodec/arm \
  2146. libavcodec/bfin \
  2147. libavcodec/mlib \
  2148. libavcodec/ppc \
  2149. libavcodec/sh4 \
  2150. libavcodec/sparc \
  2151. libavcodec/x86 \
  2152. libavdevice \
  2153. libavfilter \
  2154. libavformat \
  2155. libavutil \
  2156. libpostproc \
  2157. libswscale \
  2158. tests \
  2159. tools \
  2160. vhook \
  2161. "
  2162. FILES="\
  2163. Makefile \
  2164. common.mak \
  2165. subdir.mak \
  2166. doc/texi2pod.pl \
  2167. libavcodec/Makefile \
  2168. libavdevice/Makefile \
  2169. libavfilter/Makefile \
  2170. libavformat/Makefile \
  2171. libavutil/Makefile \
  2172. libpostproc/Makefile \
  2173. libswscale/Makefile \
  2174. "
  2175. for dir in $DIRS ; do
  2176. mkdir -p $dir
  2177. done
  2178. for f in $FILES ; do
  2179. $ln_s "$source_path/$f" $f
  2180. done
  2181. fi
  2182. # build pkg-config files
  2183. pkgconfig_generate(){
  2184. name=$1
  2185. shortname=${name#lib}${build_suffix}
  2186. comment=$2
  2187. version=$3
  2188. libs=$4
  2189. requires=$5
  2190. cat <<EOF > $name/$name.pc
  2191. prefix=$prefix
  2192. exec_prefix=\${prefix}
  2193. libdir=$libdir
  2194. includedir=$incdir
  2195. Name: $name
  2196. Description: $comment
  2197. Version: $version
  2198. Requires: $(disabled shared && echo $requires)
  2199. Requires.private: $(enabled shared && echo $requires)
  2200. Conflicts:
  2201. Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  2202. Libs.private: $(enabled shared && echo $libs)
  2203. Cflags: -I\${includedir}
  2204. EOF
  2205. cat <<EOF > $name/$name-uninstalled.pc
  2206. prefix=
  2207. exec_prefix=
  2208. libdir=\${pcfiledir}
  2209. includedir=${source_path}
  2210. Name: $name
  2211. Description: $comment
  2212. Version: $version
  2213. Requires: $requires
  2214. Conflicts:
  2215. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2216. Cflags: -I\${includedir}
  2217. EOF
  2218. }
  2219. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2220. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2221. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2222. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2223. enabled avfilter &&
  2224. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2225. enabled postproc &&
  2226. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2227. if enabled swscale; then
  2228. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  2229. else
  2230. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavcodec = $LIBAVCODEC_VERSION"
  2231. apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
  2232. fi