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.

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