configure 57 KB

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