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.

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