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.

2205 lines
63KB

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