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.

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