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.

2282 lines
66KB

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