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.

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