configure 57 KB

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