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.

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