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.

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