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.

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