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.

2468 lines
71KB

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