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.

2490 lines
72KB

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