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.

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