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.

2206 lines
63KB

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