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.

2232 lines
64KB

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