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.

2475 lines
72KB

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