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.

2078 lines
56KB

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