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.

2186 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-user@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. libdc1394_1
  661. libdc1394_2
  662. llrint
  663. lrint
  664. lrintf
  665. machine_ioctl_bt848_h
  666. machine_ioctl_meteor_h
  667. malloc_h
  668. memalign
  669. mkstemp
  670. mlib
  671. ppc64
  672. round
  673. roundf
  674. sdl
  675. sdl_video_size
  676. socklen_t
  677. soundcard_h
  678. sys_poll_h
  679. sys_select_h
  680. sys_soundcard_h
  681. termios_h
  682. threads
  683. winsock2_h
  684. "
  685. CMDLINE_SELECT="
  686. $ARCH_EXT_LIST
  687. $CONFIG_LIST
  688. $THREADS_LIST
  689. debug
  690. extra_warnings
  691. optimizations
  692. shared
  693. static
  694. "
  695. # code dependency declarations
  696. # architecture extensions
  697. altivec_deps="powerpc"
  698. armv5te_deps="armv4l"
  699. armv6_deps="armv4l"
  700. iwmmxt_deps="armv4l"
  701. mmi_deps="mips"
  702. mmx_deps="x86"
  703. ssse3_deps="x86"
  704. vis_deps="sparc"
  705. # decoders / encoders
  706. ac3_decoder_deps="gpl"
  707. dxa_decoder_deps="zlib"
  708. flashsv_decoder_deps="zlib"
  709. flashsv_encoder_deps="zlib"
  710. flv_decoder_deps="h263_decoder"
  711. h263_decoder_deps="h263_parser mpeg4video_parser"
  712. h263i_decoder_deps="h263_decoder"
  713. h264_decoder_deps="h264_parser"
  714. mpeg_xvmc_decoder_deps="xvmc"
  715. mpeg4_decoder_deps="h263_decoder"
  716. msmpeg4v1_decoder_deps="h263_decoder"
  717. msmpeg4v2_decoder_deps="h263_decoder"
  718. msmpeg4v3_decoder_deps="h263_decoder"
  719. png_decoder_deps="zlib"
  720. png_encoder_deps="zlib"
  721. svq3_decoder_deps="h264_parser"
  722. vc1_decoder_deps="h263_decoder"
  723. wmv1_decoder_deps="h263_decoder"
  724. wmv2_decoder_deps="h263_decoder"
  725. wmv3_decoder_deps="h263_decoder"
  726. zmbv_decoder_deps="zlib"
  727. zmbv_encoder_deps="zlib"
  728. # external libraries
  729. liba52_decoder_deps="liba52"
  730. liba52bin_decoder_extralibs='$ldl'
  731. libamr_nb_decoder_deps="libamr_nb"
  732. libamr_nb_encoder_deps="libamr_nb"
  733. libamr_wb_decoder_deps="libamr_wb"
  734. libamr_wb_encoder_deps="libamr_wb"
  735. libfaac_encoder_deps="libfaac"
  736. libfaad_decoder_deps="libfaad"
  737. libfaadbin_decoder_extralibs='$ldl'
  738. libgsm_decoder_deps="libgsm"
  739. libgsm_encoder_deps="libgsm"
  740. libgsm_ms_decoder_deps="libgsm"
  741. libgsm_ms_encoder_deps="libgsm"
  742. libmp3lame_encoder_deps="libmp3lame"
  743. libtheora_encoder_deps="libtheora"
  744. libvorbis_encoder_deps="libvorbis"
  745. libx264_encoder_deps="libx264"
  746. libxvid_encoder_deps="libxvid"
  747. mpeg4aac_decoder_deps="libfaad"
  748. # demuxers / muxers
  749. ac3_demuxer_deps="ac3_parser"
  750. audio_beos_demuxer_deps="audio_beos"
  751. audio_beos_demuxer_extralibs="-lmedia -lbe"
  752. audio_beos_muxer_deps="audio_beos"
  753. audio_beos_muxer_extralibs="-lmedia -lbe"
  754. avisynth_demuxer_deps="avisynth"
  755. bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  756. dv1394_demuxer_deps="dv1394 dv_demuxer"
  757. libdc1394_demuxer_deps="libdc1394"
  758. libnut_demuxer_deps="libnut"
  759. libnut_muxer_deps="libnut"
  760. mp3_demuxer_deps="mpegaudio_parser"
  761. oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  762. oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  763. redir_demuxer_deps="network"
  764. rtp_muxer_deps="network rtp_protocol"
  765. rtsp_demuxer_deps="sdp_demuxer"
  766. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  767. v4l2_demuxer_deps="linux_videodev2_h"
  768. v4l_demuxer_deps="linux_videodev_h"
  769. x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  770. x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  771. # protocols
  772. http_protocol_deps="network"
  773. rtp_protocol_deps="udp_protocol"
  774. tcp_protocol_deps="network"
  775. udp_protocol_deps="network"
  776. # programs
  777. ffplay_deps="sdl"
  778. ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  779. ffserver_extralibs='$ldl'
  780. vhook_extralibs='$ldl'
  781. # set temporary file name
  782. if test ! -z "$TMPDIR" ; then
  783. TMPDIR1="${TMPDIR}"
  784. elif test ! -z "$TEMPDIR" ; then
  785. TMPDIR1="${TEMPDIR}"
  786. else
  787. TMPDIR1="/tmp"
  788. fi
  789. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  790. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  791. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  792. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  793. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  794. # default parameters
  795. enable logging
  796. logfile="config.err"
  797. # installation paths
  798. PREFIX="/usr/local"
  799. libdir='$(PREFIX)/lib'
  800. shlibdir="$libdir"
  801. incdir='$(PREFIX)/include/ffmpeg'
  802. mandir='$(PREFIX)/share/man'
  803. bindir='$(PREFIX)/bin'
  804. # toolchain
  805. cc="gcc"
  806. ar="ar"
  807. ranlib="ranlib"
  808. make="make"
  809. strip="strip"
  810. asmalign_pot="unknown"
  811. ln_s="ln -sf"
  812. # machine
  813. arch=`uname -m`
  814. cpu="generic"
  815. # OS
  816. targetos=$(tolower $(uname -s))
  817. # libraries
  818. enable zlib
  819. # configurable options
  820. enable debug
  821. enable dostrip
  822. enable ffmpeg
  823. enable ffplay
  824. enable ffserver
  825. enable ipv6
  826. enable static
  827. enable mpegaudio_hp
  828. enable network
  829. enable optimizations
  830. enable protocols
  831. vhook="default"
  832. # build settings
  833. SHFLAGS='-shared -Wl,-soname,$@'
  834. VHOOKSHFLAGS='$(SHFLAGS)'
  835. LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  836. FFSERVERLDFLAGS=-Wl,-E
  837. LDCONFIG="ldconfig"
  838. LIBPREF="lib"
  839. LIBSUF=".a"
  840. FULLNAME='$(NAME)$(BUILDSUF)'
  841. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  842. SLIBPREF="lib"
  843. SLIBSUF=".so"
  844. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  845. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  846. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  847. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  848. # find source path
  849. source_path="`dirname \"$0\"`"
  850. enable source_path_used
  851. if test -z "$source_path" -o "$source_path" = "." ; then
  852. source_path="`pwd`"
  853. disable source_path_used
  854. else
  855. source_path="`cd \"$source_path\"; pwd`"
  856. echo "$source_path" | grep -q '[[:blank:]]' &&
  857. die "Out of tree builds are impossible with whitespace in source path."
  858. fi
  859. FFMPEG_CONFIGURATION="$@"
  860. ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
  861. DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
  862. PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
  863. BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
  864. MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
  865. DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
  866. OUTDEV_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavdevice/alldevices.c"`
  867. INDEV_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavdevice/alldevices.c"`
  868. PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
  869. enable $ARCH_EXT_LIST \
  870. $DECODER_LIST \
  871. $ENCODER_LIST \
  872. $PARSER_LIST \
  873. $BSF_LIST \
  874. $DEMUXER_LIST \
  875. $MUXER_LIST \
  876. $PROTOCOL_LIST \
  877. $INDEV_LIST \
  878. $OUTDEV_LIST \
  879. die_unknown(){
  880. echo "Unknown option \"$1\"."
  881. echo "See $0 --help for available options."
  882. exit 1
  883. }
  884. show_list() {
  885. suffix=_$1
  886. shift
  887. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  888. exit 0
  889. }
  890. for opt do
  891. optval="${opt#*=}"
  892. case "$opt" in
  893. --log)
  894. ;;
  895. --log=*) logging="$optval"
  896. ;;
  897. --prefix=*) PREFIX="$optval"
  898. ;;
  899. --libdir=*) libdir="$optval"
  900. ;;
  901. --shlibdir=*) shlibdir="$optval"
  902. ;;
  903. --incdir=*) incdir="$optval"
  904. ;;
  905. --mandir=*) mandir="$optval"
  906. ;;
  907. --source-path=*) source_path="$optval"
  908. ;;
  909. --cross-prefix=*) cross_prefix="$optval"
  910. ;;
  911. --cross-compile) enable cross_compile
  912. ;;
  913. --target-os=*) targetos="$optval"
  914. ;;
  915. --cc=*) cc="$optval"
  916. ;;
  917. --make=*) make="$optval"
  918. ;;
  919. --extra-cflags=*) add_cflags "$optval"
  920. ;;
  921. --extra-ldflags=*) add_ldflags "$optval"
  922. ;;
  923. --extra-libs=*) add_extralibs "$optval"
  924. ;;
  925. --build-suffix=*) BUILDSUF="$optval"
  926. ;;
  927. --arch=*) arch="$optval"
  928. ;;
  929. --cpu=*) cpu="$optval"
  930. ;;
  931. --enable-sunmlib) enable mlib
  932. ;;
  933. --disable-strip) disable dostrip
  934. ;;
  935. --disable-encoders) disable $ENCODER_LIST
  936. ;;
  937. --disable-decoders) disable $DECODER_LIST
  938. ;;
  939. --disable-muxers) disable $MUXER_LIST
  940. ;;
  941. --disable-demuxers) disable $DEMUXER_LIST
  942. ;;
  943. --disable-parsers) disable $PARSER_LIST
  944. ;;
  945. --disable-bsfs) disable $BSF_LIST
  946. ;;
  947. --disable-protocols) disable $PROTOCOL_LIST
  948. ;;
  949. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  950. ;;
  951. --enable-*=*|--disable-*=*)
  952. eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
  953. case "$thing" in
  954. encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;;
  955. *) die_unknown "$opt" ;;
  956. esac
  957. ;;
  958. --enable-?*|--disable-?*)
  959. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  960. echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
  961. $action $option
  962. ;;
  963. --list-*)
  964. NAME="${opt#--list-}"
  965. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  966. NAME=${NAME%s}
  967. eval show_list $NAME \$$(toupper $NAME)_LIST
  968. ;;
  969. --help|-h) show_help
  970. ;;
  971. *)
  972. die_unknown $opt
  973. ;;
  974. esac
  975. done
  976. case "$arch" in
  977. i386|i486|i586|i686|i86pc|BePC)
  978. arch="x86_32"
  979. enable fast_unaligned
  980. ;;
  981. x86_64|amd64)
  982. arch="x86_32"
  983. enable fast_unaligned
  984. canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
  985. if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
  986. if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
  987. arch="x86_64"
  988. enable fast_64bit
  989. fi
  990. fi
  991. ;;
  992. # armv4l is a subset of armv[567]*l
  993. arm|armv[4567]*l)
  994. arch="armv4l"
  995. ;;
  996. alpha)
  997. arch="alpha"
  998. enable fast_64bit
  999. ;;
  1000. "Power Macintosh"|ppc|powerpc)
  1001. arch="powerpc"
  1002. ;;
  1003. ppc64)
  1004. arch="powerpc"
  1005. enable fast_64bit
  1006. ;;
  1007. mips|mipsel|IP*)
  1008. arch="mips"
  1009. ;;
  1010. sun4u|sparc64)
  1011. arch="sparc64"
  1012. enable fast_64bit
  1013. ;;
  1014. sparc)
  1015. arch="sparc"
  1016. ;;
  1017. sh4)
  1018. arch="sh4"
  1019. ;;
  1020. parisc)
  1021. arch="parisc"
  1022. ;;
  1023. parisc64)
  1024. arch="parisc"
  1025. enable fast_64bit
  1026. ;;
  1027. s390|s390x)
  1028. arch="s390"
  1029. ;;
  1030. m68k)
  1031. arch="m68k"
  1032. ;;
  1033. ia64)
  1034. arch="ia64"
  1035. enable fast_64bit
  1036. ;;
  1037. bfin)
  1038. arch="bfin"
  1039. ;;
  1040. *)
  1041. arch="unknown"
  1042. ;;
  1043. esac
  1044. enable $arch
  1045. enabled_any x86_32 x86_64 && enable x86
  1046. enabled sparc64 && enable sparc
  1047. # OS specific
  1048. case $targetos in
  1049. beos|haiku|zeta)
  1050. PREFIX="$HOME/config"
  1051. # helps building libavcodec
  1052. add_cflags "-DPIC -fomit-frame-pointer"
  1053. # 3 gcc releases known for BeOS, each with ugly bugs
  1054. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1055. case "$gcc_version" in
  1056. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1057. disable mmx
  1058. ;;
  1059. *20010315*) echo "BeBits gcc"
  1060. add_cflags "-fno-expensive-optimizations"
  1061. ;;
  1062. esac
  1063. LDCONFIG="echo ignoring ldconfig"
  1064. SHFLAGS=-nostart
  1065. # enable BeOS things
  1066. enable audio_beos
  1067. # no need for libm, but the inet stuff
  1068. # Check for BONE
  1069. # XXX: actually should check for NOT net_server
  1070. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  1071. network_extralibs="-lbind -lsocket"
  1072. else
  1073. enable beos_netserver
  1074. network_extralibs="-lnet"
  1075. fi ;;
  1076. sunos)
  1077. FFSERVERLDFLAGS=""
  1078. SHFLAGS='-shared -Wl,-h,$@'
  1079. network_extralibs="-lsocket -lnsl"
  1080. ;;
  1081. netbsd)
  1082. oss_demuxer_extralibs="-lossaudio"
  1083. oss_muxer_extralibs="-lossaudio"
  1084. ;;
  1085. openbsd)
  1086. disable need_memalign
  1087. LIBOBJFLAGS='$(PIC)'
  1088. LDCONFIG='ldconfig -m $(SHLIBDIR)'
  1089. SHFLAGS='-shared'
  1090. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
  1091. SLIBNAME_WITH_VERSION='$(SLIBNAME)'
  1092. SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
  1093. oss_demuxer_extralibs="-lossaudio"
  1094. oss_muxer_extralibs="-lossaudio"
  1095. ;;
  1096. freebsd)
  1097. disable need_memalign
  1098. ;;
  1099. bsd/os)
  1100. osextralibs="-lpoll -lgnugetopt"
  1101. strip="strip -d"
  1102. ;;
  1103. darwin)
  1104. disable need_memalign
  1105. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION) -Wl,-read_only_relocs,suppress'
  1106. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$@'
  1107. strip="strip -x"
  1108. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1109. SLIBSUF=".dylib"
  1110. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1111. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1112. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1113. ;;
  1114. mingw32*)
  1115. targetos=mingw32
  1116. shlibdir="$bindir"
  1117. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1118. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1119. if enabled swscaler; then
  1120. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1121. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1122. fi
  1123. disable ffserver
  1124. SLIBPREF=""
  1125. SLIBSUF=".dll"
  1126. EXESUF=".exe"
  1127. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1128. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1129. SLIB_EXTRA_CMD='-lib /machine:i386 /def:$(@:$(SLIBSUF)=.def)'
  1130. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1131. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1132. SHFLAGS='-shared -Wl,--output-def,$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1133. ;;
  1134. cygwin*)
  1135. targetos=cygwin
  1136. shlibdir="$bindir"
  1137. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1138. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1139. if enabled swscaler; then
  1140. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1141. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1142. fi
  1143. EXESUF=".exe"
  1144. SLIBPREF="cyg"
  1145. SLIBSUF=".dll"
  1146. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1147. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1148. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1149. ;;
  1150. *-dos|freedos|opendos)
  1151. enable memalign_hack
  1152. disable ffplay ffserver vhook
  1153. disable $INDEV_LIST $OUTDEV_LIST
  1154. network_extralibs="-lsocket"
  1155. EXESUF=".exe"
  1156. ;;
  1157. linux)
  1158. LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
  1159. enable dv1394
  1160. ;;
  1161. irix*)
  1162. targetos=irix
  1163. ranlib="echo ignoring ranlib"
  1164. ;;
  1165. os/2*)
  1166. ar="emxomfar -p256"
  1167. ranlib="echo ignoring ranlib"
  1168. strip="lxlite"
  1169. ln_s="cp -f"
  1170. add_cflags "-Zomf"
  1171. EXESUF=".exe"
  1172. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1173. SHFLAGS='$(NAME).def -Zdll -Zomf'
  1174. FFSERVERLDFLAGS=""
  1175. LIBSUF="_s.lib"
  1176. SLIBPREF=""
  1177. SLIBSUF=".dll"
  1178. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1179. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1180. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(NAME).def; \
  1181. echo PROTMODE >> $(NAME).def; \
  1182. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \
  1183. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \
  1184. echo EXPORTS >> $(NAME).def; \
  1185. emxexp -o $(OBJS) >> $(NAME).def'
  1186. SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \
  1187. emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;'
  1188. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1189. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1190. vhook="no"
  1191. ;;
  1192. *)
  1193. targetos="${targetos}-UNKNOWN"
  1194. ;;
  1195. esac
  1196. add_extralibs $osextralibs
  1197. if ! disabled logging ; then
  1198. enabled logging || logfile="$logging"
  1199. echo "# $0 $@" >$logfile
  1200. set >>$logfile
  1201. else
  1202. logfile=/dev/null
  1203. fi
  1204. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1205. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1206. test -n "$cross_prefix" && enable cross_compile
  1207. cc="${cross_prefix}${cc}"
  1208. ar="${cross_prefix}${ar}"
  1209. ranlib="${cross_prefix}${ranlib}"
  1210. strip="${cross_prefix}${strip}"
  1211. # we need to build at least one lib type
  1212. if ! enabled_any static shared; then
  1213. cat <<EOF
  1214. At least one library type must be built.
  1215. Specify --enable-static to build the static libraries or --enable-shared to
  1216. build the shared libraries as well. To only build the shared libraries specify
  1217. --disable-static in addition to --enable-shared.
  1218. EOF
  1219. exit 1;
  1220. fi
  1221. disabled static && LIBNAME=""
  1222. if enabled_any libfaad libfaadbin ; then
  1223. if check_header faad.h; then
  1224. check_cc << EOF
  1225. #include <faad.h>
  1226. #ifndef FAAD2_VERSION
  1227. ok faad1
  1228. #endif
  1229. int main(void) { return 0; }
  1230. EOF
  1231. test $? = 0 && enable libfaad2
  1232. else
  1233. die "FAAD test failed."
  1234. fi
  1235. fi
  1236. if ! enabled gpl; then
  1237. die_gpl_disabled(){
  1238. name=$1
  1239. shift
  1240. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1241. }
  1242. die_gpl_disabled "The Postprocessing code" pp
  1243. die_gpl_disabled "liba52" liba52
  1244. die_gpl_disabled "libx264" libx264
  1245. die_gpl_disabled "libxvidcore" libxvid
  1246. die_gpl_disabled "FAAD2" libfaad2
  1247. die_gpl_disabled "The X11 grabber" x11grab
  1248. die_gpl_disabled "The software scaler" swscaler
  1249. fi
  1250. check_deps $ARCH_EXT_LIST
  1251. test -z "$need_memalign" && need_memalign="$mmx"
  1252. #Darwin CC versions
  1253. if test $targetos = darwin; then
  1254. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1255. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1256. else
  1257. add_cflags "-no-cpp-precomp -pipe"
  1258. check_cflags "-force_cpusubtype_ALL"
  1259. check_cflags "-Wno-sign-compare"
  1260. disabled shared && add_cflags -mdynamic-no-pic
  1261. fi
  1262. fi
  1263. disabled optimizations || add_cflags -fomit-frame-pointer
  1264. # Add processor-specific flags
  1265. if test $cpu != "generic"; then
  1266. warn_altivec(){
  1267. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1268. }
  1269. case $cpu in
  1270. 601|ppc601|PowerPC601)
  1271. add_cflags "-mcpu=601"
  1272. warn_altivec enabled PPC601
  1273. ;;
  1274. 603*|ppc603*|PowerPC603*)
  1275. add_cflags "-mcpu=603"
  1276. warn_altivec enabled PPC603
  1277. ;;
  1278. 604*|ppc604*|PowerPC604*)
  1279. add_cflags "-mcpu=604"
  1280. warn_altivec enabled PPC604
  1281. ;;
  1282. G3|g3|75*|ppc75*|PowerPC75*)
  1283. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1284. warn_altivec enabled PPC75x
  1285. ;;
  1286. G4|g4|745*|ppc745*|PowerPC745*)
  1287. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1288. warn_altivec disabled PPC745x
  1289. ;;
  1290. 74*|ppc74*|PowerPC74*)
  1291. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1292. warn_altivec disabled PPC74xx
  1293. ;;
  1294. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1295. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1296. warn_altivec disabled PPC970
  1297. enable ppc64
  1298. ;;
  1299. Cell|CELL|cell)
  1300. add_cflags "-mcpu=cell"
  1301. warn_altivec disabled Cell
  1302. enable ppc64
  1303. ;;
  1304. # targets that do NOT support conditional mov (cmov)
  1305. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1306. add_cflags "-march=$cpu"
  1307. disable cmov
  1308. ;;
  1309. # targets that do support conditional mov (cmov)
  1310. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1311. add_cflags "-march=$cpu"
  1312. enable cmov
  1313. enable fast_cmov
  1314. ;;
  1315. # targets that do support conditional mov but on which it's slow
  1316. pentium4|prescott|nocona)
  1317. add_cflags "-march=$cpu"
  1318. enable cmov
  1319. disable fast_cmov
  1320. ;;
  1321. sparc64)
  1322. add_cflags "-mcpu=v9"
  1323. ;;
  1324. bf*) #bf531 bf532 bf533 bf561 bf5xx all get this config
  1325. add_cflags "-mfdpic"
  1326. add_ldflags "-mfdpic"
  1327. ;;
  1328. arm*)
  1329. add_cflags "-mcpu=$cpu"
  1330. ;;
  1331. *)
  1332. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1333. ;;
  1334. esac
  1335. fi
  1336. gnu_make(){
  1337. $1 --version 2>&1 | grep -q GNU
  1338. }
  1339. if ! gnu_make $make; then
  1340. gnu_make gmake && make=gmake || die "GNU make not found."
  1341. fi
  1342. # make sure we can execute files in $TMPDIR
  1343. cat >$TMPE 2>>$logfile <<EOF
  1344. #! /bin/sh
  1345. EOF
  1346. chmod +x $TMPE >>$logfile 2>&1
  1347. if ! $TMPE >>$logfile 2>&1; then
  1348. cat <<EOF
  1349. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1350. variable to another directory and make sure that $TMPDIR1 is not mounted
  1351. noexec.
  1352. EOF
  1353. die "Sanity test failed."
  1354. fi
  1355. rm $TMPE
  1356. # compiler sanity check
  1357. check_exec <<EOF
  1358. int main(void){
  1359. return 0;
  1360. }
  1361. EOF
  1362. if test "$?" != 0; then
  1363. echo "$cc is unable to create an executable file."
  1364. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1365. echo "If $cc is a cross-compiler, use the --cross-compile option."
  1366. echo "Only do this if you know what cross compiling means."
  1367. fi
  1368. die "C compiler test failed."
  1369. fi
  1370. if enabled x86; then
  1371. # check whether EBP is available on x86
  1372. # As 'i' is stored on the stack, this program will crash
  1373. # if the base pointer is used to access it because the
  1374. # base pointer is cleared in the inline assembly code.
  1375. check_exec_crash <<EOF && enable ebp_available
  1376. volatile int i=0;
  1377. asm volatile (
  1378. "xorl %%ebp, %%ebp"
  1379. ::: "%ebp");
  1380. return i;
  1381. EOF
  1382. # check wether EBX is available on x86
  1383. check_asm ebx_available '"":::"%ebx"'
  1384. # check whether binutils is new enough to compile SSSE3
  1385. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1386. fi
  1387. # check for assembler specific support
  1388. if test $arch = "powerpc"; then
  1389. check_cc <<EOF && enable dcbzl
  1390. int main(void) {
  1391. register long zero = 0;
  1392. char data[1024];
  1393. asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
  1394. return 0;
  1395. }
  1396. EOF
  1397. fi
  1398. # check for SIMD availability
  1399. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1400. if enabled altivec; then
  1401. test -n "`$cc -v 2>&1 | grep version | grep Apple`" &&
  1402. add_cflags "-faltivec" ||
  1403. add_cflags "-maltivec -mabi=altivec"
  1404. check_header altivec.h
  1405. # check if our compiler supports Motorola AltiVec C API
  1406. enabled altivec_h &&
  1407. inc_altivec_h="#include <altivec.h>" ||
  1408. inc_altivec_h=
  1409. check_cc <<EOF || disable altivec
  1410. $inc_altivec_h
  1411. int main(void) {
  1412. vector signed int v1, v2, v3;
  1413. v1 = vec_add(v2,v3);
  1414. return 0;
  1415. }
  1416. EOF
  1417. fi
  1418. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1419. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1420. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1421. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1422. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1423. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1424. # ---
  1425. # big/little-endian test
  1426. check_cc <<EOF || die "endian test failed"
  1427. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1428. EOF
  1429. grep -q BIGE $TMPO && enable bigendian
  1430. # ---
  1431. # check availability of some header files
  1432. if check_func dlopen; then
  1433. ldl=
  1434. elif check_func dlopen -ldl; then
  1435. ldl=-ldl
  1436. fi
  1437. check_func fork
  1438. check_func gethrtime
  1439. check_func getrusage
  1440. check_func inet_aton
  1441. check_func memalign
  1442. check_func mkstemp
  1443. check_func2 windows.h GetProcessTimes
  1444. check_header byteswap.h
  1445. check_header conio.h
  1446. check_header dlfcn.h
  1447. check_header malloc.h
  1448. check_header termios.h
  1449. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1450. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1451. fi
  1452. enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
  1453. # ffserver uses poll(),
  1454. # if it's not found we can emulate it using select().
  1455. if enabled ffserver; then
  1456. check_header sys/poll.h
  1457. check_header sys/select.h
  1458. fi
  1459. # check for some common methods of building with pthread support
  1460. # do this before the optional library checks as some of them require pthreads
  1461. if enabled pthreads; then
  1462. if check_func pthread_create; then
  1463. :
  1464. elif check_func pthread_create -pthread; then
  1465. add_cflags -pthread
  1466. add_ldflags -pthread
  1467. elif check_func pthread_create -pthreads; then
  1468. add_cflags -pthreads
  1469. add_ldflags -pthreads
  1470. elif ! check_lib pthread.h pthread_create -lpthread; then
  1471. die "ERROR: can't find pthreads library"
  1472. fi
  1473. fi
  1474. for thread in $THREADS_LIST; do
  1475. if enabled $thread; then
  1476. test -n "$thread_type" &&
  1477. die "ERROR: Only one thread type must be selected." ||
  1478. thread_type="$thread"
  1479. fi
  1480. done
  1481. check_lib math.h sin -lm
  1482. # test for C99 functions in math.h
  1483. for func in llrint lrint lrintf round roundf; do
  1484. check_exec <<EOF && enable $func || disable $func
  1485. #define _ISOC9X_SOURCE 1
  1486. #include <math.h>
  1487. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1488. EOF
  1489. done
  1490. enabled_any libamr_nb libamr_wb && enable libamr
  1491. # these are off by default, so fail if requested and not available
  1492. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1493. enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
  1494. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1495. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1496. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1497. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1498. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1499. enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
  1500. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1501. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1502. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1503. enabled libx264 && require x264 x264.h x264_encoder_open -lx264
  1504. enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
  1505. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1506. # disable the native AC-3 decoder if liba52 is enabled
  1507. enabled liba52 && disable ac3_decoder
  1508. # libdc1394 check
  1509. if enabled libdc1394; then
  1510. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1511. enable libdc1394_2; } ||
  1512. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1513. enable libdc1394_1; } ||
  1514. die "ERROR: No version of libdc1394 found "
  1515. fi
  1516. _restrict=
  1517. for restrict_keyword in restrict __restrict__ __restrict; do
  1518. check_cc <<EOF && _restrict=$restrict_keyword && break
  1519. void foo(char * $restrict_keyword p);
  1520. EOF
  1521. done
  1522. test "$vhook" = "default" && vhook="$dlopen"
  1523. if test "$targetos" = cygwin -o "$targetos" = mingw32 && enabled_all static vhook ; then
  1524. disable vhook
  1525. echo
  1526. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1527. echo "Patches welcome."
  1528. echo
  1529. fi
  1530. if enabled vhook; then
  1531. check_ldflags -rdynamic
  1532. check_ldflags -export-dynamic
  1533. fi
  1534. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1535. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1536. ##########################################
  1537. # SDL check
  1538. disable sdl_too_old
  1539. disable sdl
  1540. SDL_CONFIG="${cross_prefix}sdl-config"
  1541. if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
  1542. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1543. temp_cflags $sdl_cflags
  1544. temp_extralibs `"${SDL_CONFIG}" --libs`
  1545. if check_lib SDL.h SDL_Init; then
  1546. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1547. if test "$_sdlversion" -lt 121 ; then
  1548. enable sdl_too_old
  1549. else
  1550. enable sdl
  1551. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1552. #include <SDL.h>
  1553. int main(void){
  1554. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1555. int w = vi->current_w;
  1556. return 0;
  1557. }
  1558. EOF
  1559. fi
  1560. fi
  1561. restore_flags
  1562. fi
  1563. texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html
  1564. check_type sys/socket.h socklen_t
  1565. ##########################################
  1566. # Network check
  1567. if enabled network; then
  1568. # Prefer arpa/inet.h over winsock2
  1569. if check_header arpa/inet.h ; then
  1570. check_func closesocket
  1571. elif check_header winsock2.h ; then
  1572. network_extralibs="-lws2_32"
  1573. check_type ws2tcpip.h socklen_t
  1574. check_func2 winsock2.h closesocket
  1575. fi
  1576. fi
  1577. ##########################################
  1578. # IPv6 check
  1579. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1580. #include <sys/types.h>
  1581. #include <sys/socket.h>
  1582. #include <netinet/in.h>
  1583. #include <netdb.h>
  1584. int main(void) {
  1585. struct sockaddr_storage saddr;
  1586. struct ipv6_mreq mreq6;
  1587. getaddrinfo(0,0,0,0);
  1588. getnameinfo(0,0,0,0,0,0,0);
  1589. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1590. }
  1591. EOF
  1592. check_header linux/videodev.h
  1593. check_header linux/videodev2.h
  1594. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1595. { check_header dev/bktr/ioctl_meteor.h &&
  1596. check_header dev/bktr/ioctl_bt848.h; } ||
  1597. { check_header machine/ioctl_meteor.h &&
  1598. check_header machine/ioctl_bt848.h; } ||
  1599. { check_header dev/video/meteor/ioctl_meteor.h &&
  1600. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1601. check_header dev/ic/bt8xx.h
  1602. check_header sys/soundcard.h
  1603. check_header soundcard.h
  1604. # deal with the X11 frame grabber
  1605. enabled x11grab &&
  1606. check_header X11/Xlib.h &&
  1607. check_header X11/extensions/XShm.h &&
  1608. check_func XOpenDisplay -lX11 &&
  1609. check_func XShmCreateImage -lX11 -lXext
  1610. enabled debug && add_cflags -g
  1611. # add some useful compiler flags if supported
  1612. check_cflags -Wdeclaration-after-statement
  1613. check_cflags -Wall
  1614. check_cflags -Wno-switch
  1615. check_cflags -Wdisabled-optimization
  1616. check_cflags -Wpointer-arith
  1617. check_cflags -Wredundant-decls
  1618. check_cflags -Wno-pointer-sign
  1619. enabled extra_warnings && check_cflags -Winline
  1620. # add some linker flags
  1621. check_ldflags -Wl,--warn-common
  1622. check_ldflags $LDLATEFLAGS
  1623. check_ldflags -Wl,-Bsymbolic
  1624. if enabled small; then
  1625. check_cflags -Os # not all compilers support -Os
  1626. optimizations="small"
  1627. elif enabled optimizations; then
  1628. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1629. add_cflags "-O5"
  1630. add_ldflags "-O5"
  1631. else
  1632. add_cflags "-O3"
  1633. fi
  1634. fi
  1635. # PIC flags for shared library objects where they are needed
  1636. if enabled shared; then
  1637. # LIBOBJFLAGS may have already been set in the OS configuration
  1638. if test -z "$LIBOBJFLAGS" ; then
  1639. case "$arch" in
  1640. x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS='$(PIC)' ;;
  1641. esac
  1642. fi
  1643. fi
  1644. if enabled gprof; then
  1645. add_cflags "-p"
  1646. add_ldflags "-p"
  1647. fi
  1648. VHOOKCFLAGS="-fPIC"
  1649. # Find out if the .align argument is a power of two or not.
  1650. if test $asmalign_pot = "unknown"; then
  1651. disable asmalign_pot
  1652. echo 'asm (".align 3");' | check_cc && enable asmalign_pot
  1653. fi
  1654. enabled_any $DECODER_LIST && enable decoders
  1655. enabled_any $ENCODER_LIST && enable encoders
  1656. enabled_any $BSF_LIST && enable bsfs
  1657. enabled_any $DEMUXER_LIST && enable demuxers
  1658. enabled_any $MUXER_LIST && enable muxers
  1659. enabled_any $INDEV_LIST && enable demuxers
  1660. enabled_any $OUTDEV_LIST && enable muxers
  1661. enabled_any $PROTOCOL_LIST && enable protocols
  1662. enabled_any $THREADS_LIST && enable threads
  1663. check_deps $CONFIG_LIST \
  1664. $HAVE_LIST \
  1665. $DECODER_LIST \
  1666. $ENCODER_LIST \
  1667. $PARSER_LIST \
  1668. $BSF_LIST \
  1669. $DEMUXER_LIST \
  1670. $MUXER_LIST \
  1671. $INDEV_LIST \
  1672. $OUTDEV_LIST \
  1673. $PROTOCOL_LIST \
  1674. enabled libdc1394 && append pkg_requires "libraw1394"
  1675. enabled libtheora && append pkg_requires "theora"
  1676. enabled libvorbis && append pkg_requires "vorbisenc"
  1677. echo "install prefix $PREFIX"
  1678. echo "source path $source_path"
  1679. echo "C compiler $cc"
  1680. echo "make $make"
  1681. echo ".align is power-of-two $asmalign_pot"
  1682. echo "ARCH $arch ($cpu)"
  1683. if test "$BUILDSUF" != ""; then
  1684. echo "build suffix $BUILDSUF"
  1685. fi
  1686. echo "big-endian ${bigendian-no}"
  1687. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1688. echo "MMX enabled ${mmx-no}"
  1689. echo "CMOV enabled ${cmov-no}"
  1690. echo "CMOV is fast ${fast_cmov-no}"
  1691. echo "EBX available ${ebx_available-no}"
  1692. echo "EBP available ${ebp_available-no}"
  1693. fi
  1694. if test $arch = "armv4l"; then
  1695. echo "ARMv5TE enabled ${armv5te-no}"
  1696. echo "ARMv6 enabled ${armv6-no}"
  1697. echo "IWMMXT enabled ${iwmmxt-no}"
  1698. fi
  1699. if test $arch = "mips"; then
  1700. echo "MMI enabled ${mmi-no}"
  1701. fi
  1702. if test $arch = "powerpc"; then
  1703. echo "AltiVec enabled ${altivec-no}"
  1704. echo "dcbzl available ${dcbzl-no}"
  1705. fi
  1706. echo "gprof enabled ${gprof-no}"
  1707. echo "debug symbols ${debug-no}"
  1708. echo "strip symbols ${dostrip-no}"
  1709. echo "optimizations ${optimizations-no}"
  1710. echo "static ${static-no}"
  1711. echo "shared ${shared-no}"
  1712. echo "postprocessing support ${pp-no}"
  1713. echo "software scaler enabled ${swscaler-no}"
  1714. echo "video hooking ${vhook-no}"
  1715. if enabled vhook; then
  1716. echo "Imlib2 support ${imlib2-no}"
  1717. echo "FreeType support ${freetype2-no}"
  1718. fi
  1719. echo "network support ${network-no}"
  1720. if enabled network; then
  1721. echo "IPv6 support ${ipv6-no}"
  1722. fi
  1723. echo "threading support ${thread_type-no}"
  1724. echo "SDL support ${sdl-no}"
  1725. if enabled sdl_too_old; then
  1726. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1727. fi
  1728. echo "Sun medialib support ${mlib-no}"
  1729. echo "AVISynth enabled ${avisynth-no}"
  1730. echo "liba52 support ${liba52-no}"
  1731. echo "liba52 dlopened ${liba52bin-no}"
  1732. echo "libamr-nb support ${libamr_nb-no}"
  1733. echo "libamr-wb support ${libamr_wb-no}"
  1734. echo "libdc1394 support ${libdc1394-no}"
  1735. echo "libfaac enabled ${libfaac-no}"
  1736. echo "libfaad enabled ${libfaad-no}"
  1737. echo "libfaad dlopened ${libfaadbin-no}"
  1738. echo "libgsm enabled ${libgsm-no}"
  1739. echo "libmp3lame enabled ${libmp3lame-no}"
  1740. echo "libnut enabled ${libnut-no}"
  1741. echo "libtheora enabled ${libtheora-no}"
  1742. echo "libvorbis enabled ${libvorbis-no}"
  1743. echo "x264 enabled ${libx264-no}"
  1744. echo "XviD enabled ${libxvid-no}"
  1745. echo "zlib enabled ${zlib-no}"
  1746. for type in decoder encoder parser demuxer muxer protocol bsf indev outdev; do
  1747. echo "Enabled ${type}s:"
  1748. ucname="\$`toupper $type`_LIST"
  1749. list="`eval echo $ucname`"
  1750. partlist=""
  1751. for part in $list; do
  1752. enabled $part && partlist="$partlist $part"
  1753. done
  1754. partlist=`echo $partlist | sed s/_$type//g | tr ' ' '\n' | sort`
  1755. echo $partlist
  1756. done
  1757. echo "Creating config.mak and config.h..."
  1758. enabled gpl &&
  1759. echo "License: GPL" ||
  1760. echo "License: LGPL"
  1761. echo "# Automatically generated by configure - do not modify!" > config.mak
  1762. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1763. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1764. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1765. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1766. echo "PREFIX=$PREFIX" >> config.mak
  1767. echo "prefix=\$(DESTDIR)\$(PREFIX)" >> config.mak
  1768. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1769. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1770. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1771. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1772. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1773. echo "MAKE=$make" >> config.mak
  1774. echo "CC=$cc" >> config.mak
  1775. echo "AR=$ar" >> config.mak
  1776. echo "RANLIB=$ranlib" >> config.mak
  1777. echo "LDCONFIG=$LDCONFIG" >> config.mak
  1778. echo "LN_S=$ln_s" >> config.mak
  1779. enabled dostrip &&
  1780. echo "STRIP=$strip" >> config.mak ||
  1781. echo "STRIP=echo ignoring strip" >> config.mak
  1782. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1783. echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
  1784. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1785. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1786. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1787. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  1788. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  1789. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1790. echo "BUILD_STATIC=$static" >> config.mak
  1791. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1792. echo "FULLNAME=$FULLNAME" >> config.mak
  1793. echo "LIBPREF=$LIBPREF" >> config.mak
  1794. echo "LIBSUF=$LIBSUF" >> config.mak
  1795. echo "LIBNAME=$LIBNAME" >> config.mak
  1796. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1797. echo "SLIBSUF=$SLIBSUF" >> config.mak
  1798. echo "EXESUF=$EXESUF" >> config.mak
  1799. if enabled bigendian; then
  1800. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1801. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1802. fi
  1803. if enabled mmx; then
  1804. echo "#define __CPU__ 586" >> $TMPH
  1805. fi
  1806. if enabled sdl; then
  1807. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1808. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1809. fi
  1810. if enabled texi2html; then
  1811. echo "BUILD_DOC=yes" >> config.mak
  1812. fi
  1813. sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
  1814. pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
  1815. lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
  1816. lavd_version=`grep '#define LIBAVDEVICE_VERSION ' "$source_path/libavdevice/avdevice.h" | sed 's/[^0-9\.]//g'`
  1817. lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
  1818. lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
  1819. if enabled shared; then
  1820. echo "BUILD_SHARED=yes" >> config.mak
  1821. echo "PIC=-fPIC -DPIC" >> config.mak
  1822. echo "SPPMAJOR=${pp_version%%.*}" >> config.mak
  1823. echo "SPPVERSION=$pp_version" >> config.mak
  1824. echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
  1825. echo "LAVCVERSION=$lavc_version" >> config.mak
  1826. echo "LAVDMAJOR=${lavd_version%%.*}" >> config.mak
  1827. echo "LAVDVERSION=$lavd_version" >> config.mak
  1828. echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
  1829. echo "LAVFVERSION=$lavf_version" >> config.mak
  1830. echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
  1831. echo "LAVUVERSION=$lavu_version" >> config.mak
  1832. echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
  1833. echo "SWSVERSION=$sws_version" >> config.mak
  1834. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1835. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1836. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1837. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  1838. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1839. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  1840. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  1841. fi
  1842. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1843. echo "EXTRALIBS=$extralibs" >> config.mak
  1844. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  1845. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  1846. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  1847. $DECODER_LIST \
  1848. $ENCODER_LIST \
  1849. $PARSER_LIST \
  1850. $BSF_LIST \
  1851. $DEMUXER_LIST \
  1852. $MUXER_LIST \
  1853. $PROTOCOL_LIST \
  1854. $INDEV_LIST \
  1855. $OUTDEV_LIST \
  1856. echo "#define restrict $_restrict" >> $TMPH
  1857. if enabled small; then
  1858. echo "#define av_always_inline" >> $TMPH
  1859. fi
  1860. echo "SRC_PATH=\"$source_path\"" >> config.mak
  1861. echo "SRC_PATH_BARE=$source_path" >> config.mak
  1862. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  1863. # Apparently it's not possible to portably echo a backslash.
  1864. enabled asmalign_pot &&
  1865. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  1866. printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
  1867. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  1868. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  1869. cmp -s $TMPH config.h &&
  1870. echo "config.h is unchanged" ||
  1871. mv -f $TMPH config.h
  1872. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
  1873. # build tree in object directory if source path is different from current one
  1874. if enabled source_path_used; then
  1875. DIRS="\
  1876. doc \
  1877. libavcodec \
  1878. libavcodec/alpha \
  1879. libavcodec/armv4l \
  1880. libavcodec/bfin \
  1881. libavcodec/i386 \
  1882. libavcodec/mlib \
  1883. libavcodec/ppc \
  1884. libavcodec/sh4 \
  1885. libavcodec/sparc \
  1886. libavdevice \
  1887. libavformat \
  1888. libavutil \
  1889. libpostproc \
  1890. libswscale \
  1891. tests \
  1892. tools \
  1893. vhook \
  1894. "
  1895. FILES="\
  1896. Makefile \
  1897. common.mak \
  1898. doc/texi2pod.pl \
  1899. libavcodec/Makefile \
  1900. libavdevice/Makefile \
  1901. libavformat/Makefile \
  1902. libavutil/Makefile \
  1903. libpostproc/Makefile \
  1904. libswscale/Makefile \
  1905. "
  1906. for dir in $DIRS ; do
  1907. mkdir -p $dir
  1908. done
  1909. for f in $FILES ; do
  1910. $ln_s "$source_path/$f" $f
  1911. done
  1912. fi
  1913. # build pkg-config files
  1914. # FIXME: libdir and includedir are hardcoded and may differ from the real path.
  1915. pkgconfig_generate(){
  1916. name=$1
  1917. comment=$2
  1918. version=$3
  1919. libs=$4
  1920. requires=$5
  1921. include=$6
  1922. cat <<EOF >$name.pc
  1923. prefix=$PREFIX
  1924. exec_prefix=\${prefix}
  1925. libdir=\${exec_prefix}/lib
  1926. includedir=\${prefix}/include
  1927. Name: $name
  1928. Description: $comment
  1929. Version: $version
  1930. Requires: $requires
  1931. Conflicts:
  1932. Libs: -L\${libdir} $libs
  1933. Cflags: -I\${includedir}/$include
  1934. EOF
  1935. }
  1936. pkgconfig_generate_uninstalled(){
  1937. name=$1
  1938. shortname=${name#lib}
  1939. comment=$2
  1940. version=$3
  1941. libs=$4
  1942. requires=$5
  1943. cat <<EOF >$name-uninstalled.pc
  1944. prefix=
  1945. exec_prefix=
  1946. libdir=\${pcfiledir}/$name
  1947. includedir=\${pcfiledir}/$name
  1948. Name: $name
  1949. Description: $comment
  1950. Version: $version
  1951. Requires: $requires
  1952. Conflicts:
  1953. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  1954. Cflags: -I\${includedir}
  1955. EOF
  1956. }
  1957. pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
  1958. pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
  1959. pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
  1960. pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
  1961. pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
  1962. pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
  1963. pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version" ffmpeg
  1964. pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$lavd_version" "$extralibs" "$pkg_requires libavformat = $lavf_version"
  1965. if enabled pp; then
  1966. pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
  1967. pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
  1968. fi
  1969. if enabled swscaler; then
  1970. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version" ffmpeg
  1971. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version"
  1972. else
  1973. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" ffmpeg
  1974. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
  1975. apply libswscale.pc sed s/^Libs:.*$/Libs:/
  1976. apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/
  1977. fi