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.

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