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.

2241 lines
65KB

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