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.

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