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.

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