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.

2172 lines
62KB

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