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.

2177 lines
58KB

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