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.

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