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.

2090 lines
57KB

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