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.

2458 lines
71KB

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