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.

2210 lines
63KB

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