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.

2280 lines
66KB

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