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.

2181 lines
62KB

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