s/\t/ /g for indentation fairies
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305 4#
cf9d24ad
DC
5
6if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
7cat << EOF
8
9Usage: configure [options]
10Options: [defaults in brackets after descriptions]
11
12EOF
13echo "Standard options:"
14echo " --help print this message"
15echo " --prefix=PREFIX install in PREFIX [$prefix]"
16echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
17echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
5c5dea3f
NB
18echo " --enable-ogg enable ogg support via libogg [default=no]"
19echo " --enable-vorbis enable vorbis support via libvorbis [default=no]"
20echo " --enable-theora enable theora support via libtheora [default=no]"
cf9d24ad
DC
21echo " --enable-faad enable faad support via libfaad [default=no]"
22echo " --enable-faadbin build faad support with runtime linking [default=no]"
23echo " --enable-faac enable faac support via libfaac [default=no]"
1ddadfa9 24echo " --enable-xvid enable xvid support via xvidcore [default=no]"
6662ec29 25echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
cf9d24ad
DC
26echo " --enable-mingw32 enable mingw32 native/cross windows compile"
27echo " --enable-a52 enable GPL'ed A52 support [default=no]"
28echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
23c99253 29echo " --enable-dts enable GPL'ed DTS support [default=no]"
cf9d24ad
DC
30echo " --enable-pp enable GPL'ed post processing support [default=no]"
31echo " --enable-shared-pp use libpostproc.so [default=no]"
32echo " --enable-shared build shared libraries [default=no]"
33echo " --enable-amr_nb enable amr_nb float audio codec"
34echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
64cba748 35echo " --enable-amr_wb enable amr_wb float audio codec"
cf9d24ad 36echo " --enable-sunmlib use Sun medialib [default=no]"
9c3d33d6 37echo " --enable-pthreads use pthreads [default=no]"
f02be79d 38echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]"
b2e3c528 39echo " --enable-gpl allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
cf9d24ad
DC
40echo ""
41echo "Advanced options (experts only):"
42echo " --source-path=PATH path of source code [$source_path]"
43echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
44echo " --cc=CC use C compiler CC [$cc]"
45echo " --make=MAKE use specified make [$make]"
46echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
47echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
48echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
49echo " --cpu=CPU force cpu to CPU [$cpu]"
50echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
51echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
52echo " --disable-mmx disable mmx usage"
53echo " --disable-altivec disable AltiVec usage"
54echo " --disable-audio-oss disable OSS audio support [default=no]"
55echo " --disable-audio-beos disable BeOS audio support [default=no]"
56echo " --disable-v4l disable video4linux grabbing [default=no]"
57echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
58echo " --disable-network disable network support [default=no]"
59echo " --disable-zlib disable zlib [default=no]"
60echo " --disable-simple_idct disable simple IDCT routines [default=no]"
61echo " --disable-vhook disable video hooking support"
62echo " --enable-gprof enable profiling with gprof [$gprof]"
63echo " --disable-debug disable debugging symbols"
64echo " --disable-opts disable compiler optimizations"
65echo " --disable-mpegaudio-hp faster (but less accurate)"
66echo " mpegaudio decoding [default=no]"
67echo " --disable-ffserver disable ffserver build"
68echo " --disable-ffplay disable ffplay build"
cf9d24ad 69echo " --enable-small optimize for size instead of speed"
da9b170c 70echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
65d1bea2 71echo " --disable-strip disable stripping of executables and shared libraries"
cf9d24ad
DC
72echo ""
73echo "NOTE: The object files are build at the place where configure is launched"
74exit 1
75fi
76
0f3cb305 77# set temporary file name
57514323 78if test ! -z "$TMPDIR" ; then
0f3cb305 79 TMPDIR1="${TMPDIR}"
57514323 80elif test ! -z "$TEMPDIR" ; then
0f3cb305 81 TMPDIR1="${TEMPDIR}"
3d204385 82else
0f3cb305 83 TMPDIR1="/tmp"
3d204385
NK
84fi
85
0f3cb305
FB
86TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
87TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 88TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
89TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
90TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
91
de6d9b64
FB
92# default parameters
93prefix="/usr/local"
23a65308 94mandir=""
951bf3e6 95bindir=""
0f3cb305 96cross_prefix=""
de6d9b64
FB
97cc="gcc"
98ar="ar"
be7109c1 99ranlib="ranlib"
4a908fbc 100make="make"
0f3cb305 101strip="strip"
de6d9b64 102cpu=`uname -m`
a4adb608 103tune="generic"
e45a2872 104powerpc_perf="no"
0f3cb305 105mmx="default"
ab6c65f6 106altivec="default"
d46aba26 107mmi="default"
de6d9b64 108case "$cpu" in
ef0bc4c9 109 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 110 cpu="x86"
de6d9b64 111 ;;
053dea12
AJ
112 x86_64)
113 if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
114 -z "`echo $CFLAGS | grep -- -m32`" ]; then
115 cpu="x86_64"
116 else
117 cpu="x86"
118 fi
119 ;;
93caefc7
AB
120 # armv4l is a subset of armv5tel
121 armv4l|armv5tel)
6ed7422a 122 cpu="armv4l"
6ed7422a 123 ;;
91d1f1a4
NK
124 alpha)
125 cpu="alpha"
91d1f1a4 126 ;;
a43bd1d7 127 "Power Macintosh"|ppc)
90cee0c3
MN
128 cpu="powerpc"
129 ;;
d46aba26
LS
130 mips)
131 cpu="mips"
132 ;;
bb476ff3 133 sun4u|sparc64)
a7beab73
RS
134 cpu="sparc64"
135 ;;
bb476ff3
JM
136 sparc)
137 cpu="sparc"
138 ;;
bdb2e37c
AB
139 sh4)
140 cpu="sh4"
141 ;;
de6d9b64 142 *)
0f3cb305 143 cpu="unknown"
de6d9b64
FB
144 ;;
145esac
146gprof="no"
5cbcf02c
FB
147v4l="yes"
148audio_oss="yes"
dfdfa47c 149audio_beos="no"
8aa3ee32 150dv1394="yes"
f02be79d 151dc1394="no"
5cbcf02c 152network="yes"
0147f198 153zlib="yes"
a6741398 154mp3lame="no"
5c5dea3f 155ogg="no"
81e0d0b4 156vorbis="no"
5c5dea3f 157theora="no"
0fc50e58
ZK
158faad="no"
159faadbin="no"
29d48296 160faac="no"
1ddadfa9 161xvid="no"
6662ec29 162x264="no"
ba9261e5 163a52="no"
57514323 164a52bin="no"
23c99253 165dts="no"
ba9261e5 166pp="no"
bba9b16c 167shared_pp="no"
732d9245 168mingw32="no"
3f027ca7 169cygwin="no"
f3ec2d46 170os2="no"
83286d2a 171lshared="no"
cddf3f45
GM
172optimize="yes"
173debug="yes"
65d1bea2 174dostrip="yes"
ef0bc4c9 175extralibs="-lm"
c02dbee1 176simpleidct="yes"
0f3cb305 177bigendian="no"
7f965c1c 178inttypes="yes"
b5c950c4 179emu_fast_int="no"
a8721c09 180vhook="default"
adbc0510
PG
181dlfcn="no"
182dlopen="no"
1eb2212e 183mpegaudio_hp="yes"
e1707f52 184SHFLAGS=-shared
26b35efb 185netserver="no"
4baca069 186need_inet_aton="no"
8154d2e0 187ffserver="yes"
a86b921c 188ffplay="yes"
4baca069
PG
189LDFLAGS=-Wl,--warn-common
190FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
191LIBPREF="lib"
192LIBSUF=".a"
193SLIBPREF="lib"
194SLIBSUF=".so"
951bf3e6 195EXESUF=""
891f64b3 196amr_nb="no"
d663a1fd 197amr_wb="no"
bc634f6f 198amr_nb_fixed="no"
2a515c08 199amr_if2="no"
f80f7964 200sunmlib="no"
9c3d33d6 201pthreads="no"
b2e3c528 202gpl="no"
da9b170c 203memalignhack="no"
ef0bc4c9
FR
204
205# OS specific
206targetos=`uname -s`
207case $targetos in
208BeOS)
209prefix="/boot/home/config"
210# helps building libavcodec
cddf3f45 211CFLAGS="-DPIC -fomit-frame-pointer"
31ba0b4d 212# 3 gcc releases known for BeOS, each with ugly bugs
b2924696 213gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
31ba0b4d
FR
214case "$gcc_version" in
2152.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
216mmx="no"
217;;
218*20010315*) echo "BeBits gcc"
219CFLAGS="$CFLAGS -fno-expensive-optimizations"
220;;
221esac
e1707f52
MN
222SHFLAGS=-nostart
223# disable linux things
224audio_oss="no"
5cbcf02c 225v4l="no"
8aa3ee32 226dv1394="no"
dfdfa47c
FR
227# enable beos things
228audio_beos="yes"
ef0bc4c9
FR
229# no need for libm, but the inet stuff
230# Check for BONE
231if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
232extralibs="-lbind -lsocket"
233else
26b35efb 234netserver="yes"
4baca069 235need_inet_aton="yes"
26b35efb 236extralibs="-lnet"
ef0bc4c9 237fi ;;
4baca069
PG
238SunOS)
239v4l="no"
240audio_oss="no"
8aa3ee32 241dv1394="no"
4baca069
PG
242make="gmake"
243LDFLAGS=""
244FFSLDFLAGS=""
245need_inet_aton="yes"
246extralibs="$extralibs -lsocket -lnsl"
247;;
b7aa4a59
SS
248NetBSD)
249v4l="no"
250audio_oss="yes"
251dv1394="no"
252make="gmake"
253LDFLAGS="$LDFLAGS -export-dynamic"
254case `uname -r` in
2552.*) extralibs="-lossaudio"
256;;
257esac
258;;
9c938e77
PG
259FreeBSD)
260v4l="no"
261audio_oss="yes"
8aa3ee32 262dv1394="no"
9c938e77 263make="gmake"
12043e1d
SS
264CFLAGS="-pthread"
265LDFLAGS="$LDFLAGS -export-dynamic -pthread"
9c938e77 266;;
4a908fbc 267BSD/OS)
5cbcf02c 268v4l="no"
6063bce7 269audio_oss="yes"
8aa3ee32 270dv1394="no"
4a908fbc
AB
271extralibs="-lpoll -lgnugetopt -lm"
272make="gmake"
273;;
90cee0c3 274Darwin)
a43bd1d7 275cc="cc"
90cee0c3
MN
276v4l="no"
277audio_oss="no"
8aa3ee32 278dv1394="no"
d3b15036 279ffserver="no"
a43bd1d7 280SHFLAGS="-dynamiclib"
90cee0c3 281extralibs=""
a43bd1d7 282darwin="yes"
47930f09 283strip="strip -x"
ad5a429c 284LDFLAGS="-Wl,-d,-search_paths_first"
4baca069 285FFSLDFLAGS=-Wl,-bind_at_load
90cee0c3 286;;
732d9245 287MINGW32*)
951bf3e6
FB
288# Note: the rest of the mingw32 config is done afterwards as mingw32
289# can be forced on command line for linux cross compilation
732d9245
BE
290mingw32="yes"
291;;
3f027ca7
FB
292CYGWIN*)
293v4l="no"
294audio_oss="yes"
8aa3ee32 295dv1394="no"
487c2fad 296ffserver="no"
3f027ca7
FB
297extralibs=""
298cygwin="yes"
487c2fad 299EXESUF=".exe"
3f027ca7
FB
300test -f /usr/include/inttypes.h || \
301test -f /usr/local/include/inttypes.h || \
302echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
24689bce 303 "/usr/local/include/inttypes.h !!!"
3f027ca7 304;;
b55e4ef4 305Linux)
4baca069 306LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 307;;
99614dd4
MB
308IRIX*)
309ranlib="echo ignoring ranlib"
310v4l="no"
311audio_oss="no"
312make="gmake"
313;;
f3ec2d46
SG
314OS/2)
315TMPE=$TMPE".exe"
69db4e10
SG
316ar="emxomfar -p64"
317ranlib="echo ignoring ranlib"
318strip="echo ignoring strip"
cddf3f45 319CFLAGS="-Zomf"
69db4e10 320LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
321SHFLAGS=""
322FFSLDFLAGS=""
323LIBPREF=""
324LIBSUF=".lib"
325SLIBPREF=""
326SLIBSUF=".dll"
951bf3e6 327EXESUF=".exe"
f3ec2d46
SG
328extralibs=""
329v4l="no"
330audio_oss="no"
8aa3ee32 331dv1394="no"
f3ec2d46
SG
332network="no"
333ffserver="no"
334os2="yes"
335;;
ef0bc4c9
FR
336*) ;;
337esac
de6d9b64 338
6852ac95
RD
339# From mplayer configure. We need TARGET_OS available
340# to the Makefile, so it can distinguish between flavors
341# of AltiVec on PowerPC
342TARGET_OS=`( uname -s ) 2>&1`
343 case "$TARGET_OS" in
2450cff2 344 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
6852ac95
RD
345 ;;
346 IRIX*)
347 TARGET_OS=IRIX
348 ;;
349 HP-UX*)
350 TARGET_OS=HP-UX
351 ;;
352 [cC][yY][gG][wW][iI][nN]*)
353 TARGET_OS=CYGWIN
354 ;;
355 *)
356 TARGET_OS="$TARGET_OS-UNKNOWN"
357 ;;
358 esac
359
0f3cb305
FB
360# find source path
361# XXX: we assume an absolute path is given when launching configure,
362# except in './configure' case.
586bc755 363source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
364source_path_used="yes"
365if test -z "$source_path" -o "$source_path" = "." ; then
366 source_path=`pwd`
367 source_path_used="no"
de6d9b64
FB
368fi
369
f255e0ab
MB
370FFMPEG_CONFIGURATION=" "
371for opt do
372 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
373done
374
de6d9b64
FB
375for opt do
376 case "$opt" in
377 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
378 ;;
23a65308
FB
379 --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
380 ;;
0f3cb305
FB
381 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
382 ;;
383 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
384 ;;
de6d9b64
FB
385 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
386 ;;
4a908fbc
AB
387 --make=*) make=`echo $opt | cut -d '=' -f 2`
388 ;;
f4e2c4b1 389 --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
0f3cb305 390 ;;
f4e2c4b1 391 --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
0f3cb305
FB
392 ;;
393 --extra-libs=*) extralibs=${opt#--extra-libs=}
394 ;;
de6d9b64
FB
395 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
396 ;;
a4adb608
MN
397 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
398 ;;
e45a2872
RD
399 --powerpc-perf-enable) powerpc_perf="yes"
400 ;;
de6d9b64
FB
401 --disable-mmx) mmx="no"
402 ;;
ab6c65f6
BF
403 --disable-altivec) altivec="no"
404 ;;
de6d9b64
FB
405 --enable-gprof) gprof="yes"
406 ;;
5cbcf02c
FB
407 --disable-v4l) v4l="no"
408 ;;
409 --disable-audio-oss) audio_oss="no"
410 ;;
dfdfa47c
FR
411 --disable-audio-beos) audio_beos="no"
412 ;;
8aa3ee32
MK
413 --disable-dv1394) dv1394="no"
414 ;;
ffc0ef96 415 --disable-network) network="no"; ffserver="no"
5cbcf02c 416 ;;
0147f198
FR
417 --disable-zlib) zlib="no"
418 ;;
ba9261e5 419 --enable-a52) a52="yes"
6ed7422a 420 ;;
9c938e77 421 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 422 ;;
23c99253
MN
423 --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
424 ;;
ba9261e5 425 --enable-pp) pp="yes"
bba9b16c
MN
426 ;;
427 --enable-shared-pp) shared_pp="yes"
428 ;;
a6741398
J
429 --enable-mp3lame) mp3lame="yes"
430 ;;
5c5dea3f
NB
431 --enable-ogg) ogg="yes"
432 ;;
81e0d0b4
MH
433 --enable-vorbis) vorbis="yes"
434 ;;
5c5dea3f
NB
435 --enable-theora) theora="yes"
436 ;;
445ad18d
ZK
437 --enable-faad) faad="yes"
438 ;;
439 --enable-faadbin) faadbin="yes"
440 ;;
29d48296
MN
441 --enable-faac) faac="yes"
442 ;;
1ddadfa9
AT
443 --enable-xvid) xvid="yes"
444 ;;
6662ec29
MN
445 --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
446 ;;
f02be79d
RS
447 --enable-dc1394) dc1394="yes"
448 ;;
68892110
PG
449 --disable-vhook) vhook="no"
450 ;;
c02dbee1 451 --disable-simple_idct) simpleidct="no"
045ed63f 452 ;;
732d9245
BE
453 --enable-mingw32) mingw32="yes"
454 ;;
83286d2a 455 --enable-shared) lshared="yes"
0319c531 456 ;;
cddf3f45
GM
457 --disable-debug) debug="no"
458 ;;
459 --disable-opts) optimize="no"
460 ;;
1eb2212e
FB
461 --disable-mpegaudio-hp) mpegaudio_hp="no"
462 ;;
8154d2e0
FB
463 --disable-ffserver) ffserver="no"
464 ;;
a86b921c
FB
465 --disable-ffplay) ffplay="no"
466 ;;
cddf3f45 467 --enable-small) optimize="small"
553a6284 468 ;;
891f64b3 469 --enable-amr_nb) amr_nb="yes"
470 ;;
bc634f6f
ZK
471 --enable-amr_nb-fixed) amr_nb_fixed="yes"
472 ;;
64cba748
MN
473 --enable-amr_wb) amr_wb="yes"
474 ;;
2a515c08
TM
475 --enable-amr_if2) amr_if2="yes"
476 ;;
f80f7964
RS
477 --enable-sunmlib) sunmlib="yes"
478 ;;
9c3d33d6
MN
479 --enable-pthreads) pthreads="yes"
480 ;;
b2e3c528
MN
481 --enable-gpl) gpl="yes"
482 ;;
da9b170c
MN
483 --enable-memalign-hack) memalignhack="yes"
484 ;;
65d1bea2
MB
485 --disable-strip) dostrip="no"
486 ;;
de6d9b64
FB
487 esac
488done
489
5c5dea3f
NB
490if test "$theora" = "yes" ; then
491 if test "$ogg" = "no" ; then
492 echo "Ogg must be enabled to enable Theora"
493 fail="yes"
494 theora="no"
495 fi
496fi
497
498if test "$vorbis" = "yes" ; then
499 if test "$ogg" = "no" ; then
500 echo "Ogg must be enabled to enable Vorbis"
501 fail="yes"
502 vorbis="no"
503 fi
504fi
505
b2e3c528
MN
506if test "$gpl" != "yes"; then
507 if test "$pp" != "no" -o "$shared_pp" != "no"; then
508 echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
509 fail="yes"
510 fi
511
512 if test "$a52" != "no" -o "$a52bin" != "no"; then
513 echo "liba52 is under GPL and --enable-gpl is not specified"
514 fail="yes"
515 fi
23c99253 516
1ddadfa9
AT
517 if test "$xvid" != "no"; then
518 echo "libxvidcore is under GPL and --enable-gpl is not specified"
519 fail="yes"
520 fi
521
6662ec29
MN
522 if test "$x264" != "no"; then
523 echo "x264 is under GPL and --enable-gpl is not specified"
524 fail="yes"
525 fi
526
23c99253
MN
527 if test "$dts" != "no"; then
528 echo "libdts is under GPL and --enable-gpl is not specified"
529 fail="yes"
530 fi
b2e3c528
MN
531
532 if test "$faad" != "no" -o "$faadbin" != "no"; then
533 cat > $TMPC << EOF
534 #include <faad.h>
535 int main( void ) { return 0; }
536EOF
537
538 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
539 cat > $TMPC << EOF
540 #include <faad.h>
541 #ifndef FAAD2_VERSION
542 ok faad1
543 #endif
544 int main( void ) { return 0; }
545EOF
546 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
547 echo "faad2 is under GPL and --enable-gpl is not specified"
548 fail="yes"
549 fi
550 else
551 faad="no"
552 faadbin="no"
553 echo "faad test failed"
554 fi
555 fi
556
557
a18b5183 558 if test "$fail" = "yes"; then
b2e3c528
MN
559 exit 1
560 fi
561fi
562
0f3cb305
FB
563# compute mmx state
564if test $mmx = "default"; then
053dea12 565 if test $cpu = "x86" -o $cpu = "x86_64"; then
0f3cb305
FB
566 mmx="yes"
567 else
568 mmx="no"
569 fi
570fi
571
cf9d24ad 572#Darwin CC versions
75388c74 573needmdynamicnopic="no"
cf9d24ad 574if test $targetos = Darwin; then
b2924696 575 if test -n "`$cc -v 2>&1 | grep xlc`"; then
747a0554 576 CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
cf9d24ad 577 else
b2924696 578 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
cf9d24ad
DC
579 case "$gcc_version" in
580 *2.95*)
747a0554 581 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
cf9d24ad 582 ;;
75388c74 583 *3.*)
747a0554 584 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
75388c74
MN
585 if test "$lshared" = no; then
586 needmdynamicnopic="yes"
587 fi
cf9d24ad
DC
588 ;;
589 *)
747a0554 590 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
75388c74
MN
591 if test "$lshared" = no; then
592 needmdynamicnopic="yes"
593 fi
cf9d24ad
DC
594 ;;
595 esac
596 fi
597fi
598
ab6c65f6
BF
599# Can only do AltiVec on PowerPC
600if test $altivec = "default"; then
601 if test $cpu = "powerpc"; then
602 altivec="yes"
603 else
604 altivec="no"
605 fi
606fi
607
a4adb608
MN
608# Add processor-specific flags
609TUNECPU="generic"
9007f514 610POWERPCMODE="32bits"
a4adb608
MN
611if test $tune != "generic"; then
612 case $tune in
613 601|ppc601|PowerPC601)
614 CFLAGS="$CFLAGS -mcpu=601"
615 if test $altivec = "yes"; then
616 echo "WARNING: tuning for PPC601 but altivec enabled !";
617 fi
618 TUNECPU=ppc601
619 ;;
620 603*|ppc603*|PowerPC603*)
621 CFLAGS="$CFLAGS -mcpu=603"
622 if test $altivec = "yes"; then
623 echo "WARNING: tuning for PPC603 but altivec enabled !";
624 fi
625 TUNECPU=ppc603
626 ;;
627 604*|ppc604*|PowerPC604*)
628 CFLAGS="$CFLAGS -mcpu=604"
629 if test $altivec = "yes"; then
630 echo "WARNING: tuning for PPC604 but altivec enabled !";
631 fi
632 TUNECPU=ppc604
633 ;;
8d6625b6 634 G3|g3|75*|ppc75*|PowerPC75*)
fe0f2a97 635 CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
a4adb608
MN
636 if test $altivec = "yes"; then
637 echo "WARNING: tuning for PPC75x but altivec enabled !";
638 fi
639 TUNECPU=ppc750
640 ;;
8d6625b6 641 G4|g4|745*|ppc745*|PowerPC745*)
fe0f2a97 642 CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
3efd4952
RD
643 if test $altivec = "no"; then
644 echo "WARNING: tuning for PPC745x but altivec disabled !";
645 fi
646 TUNECPU=ppc7450
647 ;;
648 74*|ppc74*|PowerPC74*)
fe0f2a97 649 CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
a4adb608
MN
650 if test $altivec = "no"; then
651 echo "WARNING: tuning for PPC74xx but altivec disabled !";
652 fi
e45a2872 653 TUNECPU=ppc7400
a4adb608 654 ;;
8d6625b6 655 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
9007f514 656 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
a4adb608
MN
657 if test $altivec = "no"; then
658 echo "WARNING: tuning for PPC970 but altivec disabled !";
659 fi
660 TUNECPU=ppc970
9007f514 661 POWERPCMODE="64bits"
a4adb608
MN
662 ;;
663 *)
664 echo "WARNING: unknown CPU "$tune", ignored"
665 ;;
666 esac
667fi
668
cf9d24ad 669# AltiVec flags: The FSF version of GCC differs from the Apple version
b6e52719
MD
670if test $cpu = "powerpc"; then
671 if test $altivec = "yes"; then
b2924696 672 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
b6e52719
MD
673 CFLAGS="$CFLAGS -faltivec"
674 else
675 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
676 fi
677 fi
678fi
679
a9a07762
MN
680# See if we have <altivec.h>
681cat > $TMPC << EOF
682#include <altivec.h>
683int main( void ) { return 0; }
684EOF
685
686_altivec_h="no"
b6e52719 687if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
a9a07762
MN
688_altivec_h="yes"
689fi
690
ab6c65f6
BF
691# See does our compiler support Motorola AltiVec C API
692if test $altivec = "yes"; then
a9a07762 693if test $_altivec_h = "yes"; then
ab6c65f6 694cat > $TMPC << EOF
a9a07762 695#include <altivec.h>
ab6c65f6
BF
696int main(void) {
697 vector signed int v1, v2, v3;
698 v1 = vec_add(v2,v3);
699 return 0;
700}
701EOF
a9a07762
MN
702else
703cat > $TMPC << EOF
704int main(void) {
705 vector signed int v1, v2, v3;
706 v1 = vec_add(v2,v3);
707 return 0;
708}
709EOF
710fi
b6e52719 711$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
ab6c65f6
BF
712fi
713
d46aba26
LS
714# Can only do mmi on mips
715if test $mmi = "default"; then
716 if test $cpu = "mips"; then
717 mmi="yes"
718 else
719 mmi="no"
720 fi
721fi
722
723# See does our compiler support mmi
724if test $mmi = "yes"; then
725cat > $TMPC << EOF
726int main(void) {
727 __asm__ ("lq \$2, 0(\$2)");
728 return 0;
729}
730EOF
f3ec2d46 731$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
732fi
733
732d9245 734if test "$mingw32" = "yes" ; then
732d9245
BE
735 v4l="no"
736 audio_oss="no"
8aa3ee32 737 dv1394="no"
f02be79d 738 dc1394="no"
951bf3e6 739 ffserver="no"
732d9245 740 network="no"
951bf3e6
FB
741 LIBPREF=""
742 LIBSUF=".lib"
743 SLIBPREF=""
744 SLIBSUF=".dll"
745 EXESUF=".exe"
746 prefix="/c/Program Files/FFmpeg"
747 bindir="$prefix"
732d9245
BE
748fi
749
0f3cb305
FB
750cc="${cross_prefix}${cc}"
751ar="${cross_prefix}${ar}"
be7109c1 752ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
753strip="${cross_prefix}${strip}"
754
487a54d7
FB
755if test -z "$cross_prefix" ; then
756
3d204385 757# ---
a3999908
MN
758# big/little endian test
759cat > $TMPC << EOF
760#include <inttypes.h>
761int main(int argc, char ** argv){
762 volatile uint32_t i=0x01234567;
763 return (*((uint8_t*)(&i))) == 0x67;
764}
765EOF
766
f3ec2d46
SG
767if $cc -o $TMPE $TMPC 2>/dev/null ; then
768$TMPE && bigendian="yes"
a3999908
MN
769else
770echo big/little test failed
771fi
772
487a54d7
FB
773else
774
775# if cross compiling, cannot launch a program, so make a static guess
776if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
777 bigendian="yes"
778fi
779
780fi
781
a3999908 782# ---
7f965c1c
CF
783# *inttypes.h* test
784cat > $TMPC << EOF
785#include <inttypes.h>
786int main(int argc, char ** argv){
787 return 0;
788}
789EOF
790
791$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
792
793# ---
b5c950c4
MN
794# *int_fast* test
795cat > $TMPC << EOF
796#include <inttypes.h>
797int main(int argc, char ** argv){
798 volatile uint_fast64_t i=0x01234567;
799 return 0;
800}
801EOF
802
803$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
804
805# ---
3d204385
NK
806# check availability of some header files
807
808cat > $TMPC << EOF
809#include <malloc.h>
810int main( void ) { return 0; }
811EOF
812
813_memalign=no
814_malloc_h=no
f3ec2d46 815if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
816_malloc_h=yes
817_memalign=yes
818# check for memalign - atmos
819cat > $TMPC << EOF
487c2fad 820#include <stdio.h>
3d204385
NK
821#include <malloc.h>
822int main ( void ) {
823char *string = NULL;
824string = memalign(64, sizeof(char));
825return 0;
826}
827EOF
f3ec2d46 828$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
829fi
830
8bf5d58f
MN
831if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
832 echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
833 exit 1
834fi
835
68892110 836cat > $TMPC << EOF
5e4639e2
GM
837#include <time.h>
838int main( void ) { localtime_r(NULL, NULL); }
839EOF
840
841localtime_r=no
842if $cc -o $TMPE $TMPC 2> /dev/null ; then
843 localtime_r=yes
844fi
845
0147f198
FR
846if test "$zlib" = "yes"; then
847# check for zlib - mmu_man
848cat > $TMPC << EOF
849#include <zlib.h>
850int main ( void ) {
851if (zlibVersion() != ZLIB_VERSION)
852 puts("zlib version differs !!!");
853 return 1;
854return 0;
855}
856EOF
16806499 857$cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
f3ec2d46 858# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
859# XXX: more tests needed - runtime test
860fi
861if test "$zlib" = "yes"; then
862extralibs="$extralibs -lz"
863fi
864
95e2ce4a
MN
865# test for lrintf in math.h
866cat > $TMPC << EOF
867#define _ISOC9X_SOURCE 1
868#include <math.h>
869int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
870EOF
871
872have_lrintf="no"
f3ec2d46 873if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 874 have_lrintf="yes"
c2b9685e
MN
875 # allanc@chickenandporn.com: cannot execute cross-compiled
876 # code on the host. Only execute if not cross-compiling.
877 if test -z "$cross_prefix" ; then
878 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
879 fi
95e2ce4a
MN
880fi
881
c13e1abd
FH
882_restrict=
883for restrict_keyword in restrict __restrict__ __restrict; do
884 echo "void foo(char * $restrict_keyword p);" > $TMPC
885 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
886 _restrict=$restrict_keyword
887 break;
888 fi
889done
890
52b41d7f
FB
891# test gcc version to see if vector builtins can be used
892# currently only used on i386 for MMX builtins
893cat > $TMPC << EOF
053dea12 894#include <xmmintrin.h>
52b41d7f
FB
895int main(void) {
896#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
897return 0;
898#else
899#error no vector builtins
900#endif
901}
902EOF
903
904builtin_vector=no
905if $cc -o $TMPO $TMPC 2> /dev/null ; then
906 builtin_vector=yes
a8721c09
FB
907fi
908
909# dlopen/dlfcn.h probing
910
911cat > $TMPC << EOF
912#include <dlfcn.h>
913int main( void ) { return (int) dlopen("foo", 0); }
914EOF
915
916ldl=-ldl
917
cf9d24ad 918if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
919dlfcn=yes
920dlopen=yes
921fi
922
cf9d24ad 923if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
924dlfcn=yes
925dlopen=yes
926ldl=""
927fi
928
929cat > $TMPC << EOF
930int main( void ) { return (int) dlopen("foo", 0); }
931EOF
932
cf9d24ad 933if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
934dlopen=yes
935fi
936
cf9d24ad 937if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
938dlopen=yes
939ldl=""
940fi
941
942if test "$vhook" = "default" ; then
943 vhook="$dlopen"
944fi
945
a86b921c
FB
946##########################################
947# imlib probe
948
a8721c09
FB
949cat > $TMPC << EOF
950#include <X11/Xlib.h>
951#include <Imlib2.h>
952int main( void ) { return (int) imlib_load_font("foo"); }
953EOF
954
955imlib2=no
7802d373 956if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
a8721c09 957imlib2=yes
52b41d7f
FB
958fi
959
a86b921c
FB
960##########################################
961# freetype probe
962
04511d53
PG
963cat > $TMPC << EOF
964#include <ft2build.h>
965int main( void ) { return (int) FT_Init_FreeType(0); }
966EOF
967
968freetype2=no
69db4e10 969if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
e2a3cd59 970 if (freetype-config --version) >/dev/null 2>&1 ; then
cf9d24ad 971 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
dee076fc 972 freetype2=yes
04511d53 973 fi
dee076fc 974 fi
04511d53
PG
975fi
976
a86b921c
FB
977##########################################
978# SDL probe
979
980cat > $TMPC << EOF
981#include <SDL.h>
31319a8c 982#undef main /* We don't want SDL to override our main() */
a86b921c
FB
983int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
984EOF
985
986sdl_too_old=no
987sdl=no
e2a3cd59 988if (sdl-config --version) >/dev/null 2>&1 ; then
cf9d24ad 989if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
a86b921c
FB
990_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
991if test "$_sdlversion" -lt 121 ; then
992sdl_too_old=yes
993else
994sdl=yes
995fi
996fi
c3f6b472 997fi
a86b921c 998
146ea952
NB
999##########################################
1000# texi2html probe
1001
1002texi2html=no
e2a3cd59 1003if (texi2html -version) >/dev/null 2>&1; then
146ea952
NB
1004texi2html=yes
1005fi
1006
7a91333f
HZ
1007if test "$network" = "yes" ; then
1008##########################################
1009# IPv6 probe
1010
1011cat > $TMPC << EOF
1012#include <sys/types.h>
1013#include <sys/socket.h>
1014#include <netinet/in.h>
1015#include <netdb.h>
1016int main( void ) {
1017 struct sockaddr_storage saddr;
1018 struct ipv6_mreq mreq6;
1019 getaddrinfo(0,0,0,0);
1020 getnameinfo(0,0,0,0,0,0,0);
1021 IN6_IS_ADDR_MULTICAST(0);
1022}
1023EOF
1024
1025ipv6=no
1026if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
1027ipv6=yes
1028fi
1029fi
1030
b2924696 1031case "`$cc -v 2>&1 | grep version`" in
cf9d24ad 1032 *gcc*)
2f3eca08 1033 CFLAGS="-Wall -Wno-switch $CFLAGS"
cf9d24ad
DC
1034 ;;
1035 *)
1036 ;;
1037esac
1038
94a3401e
FB
1039if test "$sdl" = "no" ; then
1040 ffplay=no
1041fi
1042
cddf3f45 1043if test "$debug" = "yes"; then
7906085f 1044 CFLAGS="-g $CFLAGS"
cddf3f45
GM
1045fi
1046
1047if test "$optimize" = "small"; then
98ca7790 1048# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
1049 CFLAGS="$CFLAGS -Os"
1050fi
1051
cddf3f45 1052if test "$optimize" = "yes"; then
b2924696 1053 if test -n "`$cc -v 2>&1 | grep xlc`"; then
cf9d24ad
DC
1054 CFLAGS="$CFLAGS -O5"
1055 LDFLAGS="$LDFLAGS -O5"
1056 else
7906085f 1057 CFLAGS="-O3 $CFLAGS"
cf9d24ad 1058 fi
cddf3f45
GM
1059fi
1060
951bf3e6
FB
1061if test x"$bindir" = x""; then
1062bindir="${prefix}/bin"
1063fi
1064
23a65308
FB
1065if test x"$mandir" = x""; then
1066mandir="${prefix}/man"
1067fi
1068
de6d9b64 1069echo "Install prefix $prefix"
0f3cb305 1070echo "Source path $source_path"
de6d9b64 1071echo "C compiler $cc"
4a908fbc 1072echo "make $make"
a4adb608 1073echo "CPU $cpu ($tune)"
0f3cb305 1074echo "Big Endian $bigendian"
7f965c1c 1075echo "inttypes.h $inttypes"
b5c950c4 1076echo "broken inttypes.h $emu_fast_int"
053dea12 1077if test $cpu = "x86" -o $cpu = "x86_64"; then
de6d9b64 1078echo "MMX enabled $mmx"
52b41d7f 1079echo "Vector Builtins $builtin_vector"
e41e8342
FB
1080fi
1081if test $cpu = "mips"; then
d46aba26 1082echo "MMI enabled $mmi"
e41e8342
FB
1083fi
1084if test $cpu = "powerpc"; then
ab6c65f6 1085echo "AltiVec enabled $altivec"
e41e8342 1086fi
de6d9b64 1087echo "gprof enabled $gprof"
0147f198 1088echo "zlib enabled $zlib"
a6741398 1089echo "mp3lame enabled $mp3lame"
5c5dea3f 1090echo "ogg enabled $ogg"
81e0d0b4 1091echo "vorbis enabled $vorbis"
5c5dea3f 1092echo "theora enabled $theora"
445ad18d
ZK
1093echo "faad enabled $faad"
1094echo "faadbin enabled $faadbin"
29d48296 1095echo "faac enabled $faac"
1ddadfa9 1096echo "xvid enabled $xvid"
6662ec29 1097echo "x264 enabled $x264"
5cbcf02c 1098echo "a52 support $a52"
57514323 1099echo "a52 dlopened $a52bin"
23c99253 1100echo "dts support $dts"
bba9b16c 1101echo "pp support $pp"
cddf3f45 1102echo "debug symbols $debug"
65d1bea2 1103echo "strip symbols $dostrip"
cddf3f45 1104echo "optimize $optimize"
bba9b16c 1105echo "shared pp $shared_pp"
47930f09 1106echo "Video hooking $vhook"
a86b921c
FB
1107echo "SDL support $sdl"
1108if test $sdl_too_old = "yes"; then
1109echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1110fi
68892110
PG
1111
1112if test "$vhook" = "yes" ; then
47930f09 1113echo "Imlib2 support $imlib2"
04511d53 1114echo "freetype support $freetype2"
68892110 1115fi
f80f7964 1116echo "Sun medialib support" $sunmlib
9c3d33d6 1117echo "pthreads support" $pthreads
bc634f6f
ZK
1118echo "AMR-NB float support" $amr_nb
1119echo "AMR-NB fixed support" $amr_nb_fixed
d663a1fd 1120echo "AMR-WB float support" $amr_wb
2a515c08 1121echo "AMR-WB IF2 support" $amr_if2
7a91333f
HZ
1122echo "network support $network"
1123if test "$network" = "yes" ; then
1124echo "IPv6 support $ipv6"
1125fi
b2e3c528
MN
1126if test "$gpl" = "no" ; then
1127echo "License: LGPL"
1128else
1129echo "License: GPL"
1130fi
de6d9b64 1131
980fc7b8 1132echo "Creating config.mak and config.h"
de6d9b64 1133
f255e0ab
MB
1134date >> config.log
1135echo " $0 $FFMPEG_CONFIGURATION" >> config.log
980fc7b8 1136echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 1137echo "/* Automatically generated by configure - do not modify */" > $TMPH
f255e0ab 1138echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
de6d9b64 1139
980fc7b8 1140echo "prefix=$prefix" >> config.mak
951bf3e6 1141echo "bindir=$bindir" >> config.mak
23a65308 1142echo "mandir=$mandir" >> config.mak
4a908fbc 1143echo "MAKE=$make" >> config.mak
980fc7b8
FB
1144echo "CC=$cc" >> config.mak
1145echo "AR=$ar" >> config.mak
be7109c1 1146echo "RANLIB=$ranlib" >> config.mak
65d1bea2 1147if test "$dostrip" = "yes" ; then
0f3cb305 1148echo "STRIP=$strip" >> config.mak
65d1bea2
MB
1149echo "INSTALLSTRIP=-s" >> config.mak
1150else
1151echo "STRIP=echo ignoring strip" >> config.mak
1152echo "INSTALLSTRIP=" >> config.mak
1153fi
75388c74
MN
1154
1155# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
1156# shared modules on OS/X (vhook/Makefile).
1157SHCFLAGS=$CFLAGS
1158if test "$needmdynamicnopic" = yes; then
1159 CFLAGS="$CFLAGS -mdynamic-no-pic"
1160fi
1161
a9b3f630 1162echo "OPTFLAGS=$CFLAGS" >> config.mak
75388c74 1163echo "SHCFLAGS=$SHCFLAGS">>config.mak
0f3cb305 1164echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 1165echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 1166echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
1167echo "LIBPREF=$LIBPREF" >> config.mak
1168echo "LIBSUF=$LIBSUF" >> config.mak
1169echo "SLIBPREF=$SLIBPREF" >> config.mak
1170echo "SLIBSUF=$SLIBSUF" >> config.mak
951bf3e6 1171echo "EXESUF=$EXESUF" >> config.mak
6852ac95 1172echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 1173if test "$cpu" = "x86" ; then
980fc7b8 1174 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 1175 echo "#define ARCH_X86 1" >> $TMPH
053dea12
AJ
1176elif test "$cpu" = "x86_64" ; then
1177 echo "TARGET_ARCH_X86_64=yes" >> config.mak
1178 echo "#define ARCH_X86_64 1" >> $TMPH
0f3cb305 1179elif test "$cpu" = "armv4l" ; then
6ed7422a 1180 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 1181 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 1182elif test "$cpu" = "alpha" ; then
91d1f1a4 1183 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 1184 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
1185elif test "$cpu" = "sparc64" ; then
1186 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1187 echo "#define ARCH_SPARC64 1" >> $TMPH
bb476ff3
JM
1188 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1189 echo "#define ARCH_SPARC 1" >> $TMPH
1190elif test "$cpu" = "sparc" ; then
1191 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1192 echo "#define ARCH_SPARC 1" >> $TMPH
0f3cb305
FB
1193elif test "$cpu" = "powerpc" ; then
1194 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1195 echo "#define ARCH_POWERPC 1" >> $TMPH
9007f514
RD
1196 if test $POWERPCMODE = "32bits"; then
1197 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1198 else
1199 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1200 fi
e45a2872
RD
1201 if test "$powerpc_perf" = "yes"; then
1202 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1203 fi
d46aba26
LS
1204elif test "$cpu" = "mips" ; then
1205 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1206 echo "#define ARCH_MIPS 1" >> $TMPH
bdb2e37c
AB
1207elif test "$cpu" = "sh4" ; then
1208 echo "TARGET_ARCH_SH4=yes" >> config.mak
1209 echo "#define ARCH_SH4 1" >> $TMPH
1210fi
a4adb608 1211echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
1212if test "$bigendian" = "yes" ; then
1213 echo "WORDS_BIGENDIAN=yes" >> config.mak
1214 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 1215fi
d2a9bddd
MN
1216if test "$inttypes" != "yes" ; then
1217 echo "#define EMULATE_INTTYPES 1" >> $TMPH
7f965c1c 1218fi
b5c950c4 1219if test "$emu_fast_int" = "yes" ; then
19d053c5 1220 echo "#define EMULATE_FAST_INT 1" >> $TMPH
b5c950c4 1221fi
57514323 1222if test "$mmx" = "yes" ; then
980fc7b8 1223 echo "TARGET_MMX=yes" >> config.mak
045ed63f 1224 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 1225 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 1226fi
52b41d7f
FB
1227if test "$builtin_vector" = "yes" ; then
1228 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1229 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1230fi
d46aba26
LS
1231if test "$mmi" = "yes" ; then
1232 echo "TARGET_MMI=yes" >> config.mak
1233 echo "#define HAVE_MMI 1" >> $TMPH
1234fi
ab6c65f6
BF
1235if test "$altivec" = "yes" ; then
1236 echo "TARGET_ALTIVEC=yes" >> config.mak
1237 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
1238 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1239 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
1240 if test "$_altivec_h" = "yes" ; then
1241 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1242 else
e67e14d5 1243 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 1244 fi
ab6c65f6 1245fi
57514323 1246if test "$gprof" = "yes" ; then
980fc7b8 1247 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 1248 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 1249fi
5e4639e2
GM
1250if test "$localtime_r" = "yes" ; then
1251 echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
5e4639e2 1252fi
68892110
PG
1253if test "$imlib2" = "yes" ; then
1254 echo "HAVE_IMLIB2=yes" >> config.mak
1255fi
04511d53
PG
1256if test "$freetype2" = "yes" ; then
1257 echo "HAVE_FREETYPE2=yes" >> config.mak
1258fi
f80f7964
RS
1259if test "$sunmlib" = "yes" ; then
1260 echo "HAVE_MLIB=yes" >> config.mak
1261 echo "#define HAVE_MLIB 1" >> $TMPH
1262 extralibs="$extralibs -lmlib"
1263fi
9c3d33d6
MN
1264if test "$pthreads" = "yes" ; then
1265 echo "HAVE_PTHREADS=yes" >> config.mak
1266 echo "#define HAVE_PTHREADS 1" >> $TMPH
2450cff2 1267 echo "#define HAVE_THREADS 1" >> $TMPH
0abd6916 1268 if test $targetos != FreeBSD; then
12043e1d
SS
1269 extralibs="$extralibs -lpthread"
1270 fi
9c3d33d6 1271fi
a86b921c
FB
1272if test "$sdl" = "yes" ; then
1273 echo "CONFIG_SDL=yes" >> config.mak
1274 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1275 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1276fi
146ea952
NB
1277if test "$texi2html" = "yes"; then
1278 echo "BUILD_DOC=yes" >> config.mak
1279fi
95e2ce4a
MN
1280if test "$have_lrintf" = "yes" ; then
1281 echo "#define HAVE_LRINTF 1" >> $TMPH
1282fi
68892110
PG
1283if test "$vhook" = "yes" ; then
1284 echo "BUILD_VHOOK=yes" >> config.mak
1285 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 1286 extralibs="$extralibs $ldl"
68892110 1287fi
57514323 1288if test "$lshared" = "yes" ; then
0319c531 1289 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 1290 echo "PIC=-fPIC" >> config.mak
0319c531 1291fi
ef0bc4c9 1292echo "EXTRALIBS=$extralibs" >> config.mak
281a74da 1293version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
258207b7
FB
1294 cut -d '"' -f 2`
1295echo "VERSION=$version" >>config.mak
d771bcae 1296# if you do not want to use encoders, disable that.
045ed63f 1297echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
1298echo "CONFIG_ENCODERS=yes" >> config.mak
1299
1300# if you do not want to use decoders, disable that.
045ed63f 1301echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
1302echo "CONFIG_DECODERS=yes" >> config.mak
1303
5cbcf02c
FB
1304# AC3
1305if test "$a52" = "yes" ; then
1306 echo "#define CONFIG_AC3 1" >> $TMPH
1307 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 1308
5cbcf02c
FB
1309 if test "$a52bin" = "yes" ; then
1310 echo "#define CONFIG_A52BIN 1" >> $TMPH
1311 echo "CONFIG_A52BIN=yes" >> config.mak
1312 fi
1313fi
1314
23c99253
MN
1315# DTS
1316if test "$dts" = "yes" ; then
1317 echo "#define CONFIG_DTS 1" >> $TMPH
1318 echo "CONFIG_DTS=yes" >> config.mak
1319fi
1320
bba9b16c
MN
1321# PP
1322if test "$pp" = "yes" ; then
1323 echo "#define CONFIG_PP 1" >> $TMPH
1324 echo "CONFIG_PP=yes" >> config.mak
1325
1326 if test "$shared_pp" = "yes" ; then
1327 echo "#define SHARED_PP 1" >> $TMPH
1328 echo "SHARED_PP=yes" >> config.mak
1329 fi
1330fi
1331
1eb2212e
FB
1332# mpeg audio high precision mode
1333if test "$mpegaudio_hp" = "yes" ; then
1334 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1335fi
1336
5cbcf02c
FB
1337if test "$v4l" = "yes" ; then
1338 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1339 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1340fi
1341
8aa3ee32
MK
1342if test "$dv1394" = "yes" ; then
1343 echo "#define CONFIG_DV1394 1" >> $TMPH
1344 echo "CONFIG_DV1394=yes" >> config.mak
1345fi
1346
f02be79d
RS
1347if test "$dc1394" = "yes" ; then
1348 echo "#define CONFIG_DC1394 1" >> $TMPH
1349 echo "CONFIG_DC1394=yes" >> config.mak
1350fi
1351
adbc0510
PG
1352if test "$dlopen" = "yes" ; then
1353 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1354fi
1355
1356if test "$dlfcn" = "yes" ; then
1357 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1358fi
1359
5cbcf02c
FB
1360if test "$audio_oss" = "yes" ; then
1361 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1362 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
1363fi
1364
dfdfa47c
FR
1365if test "$audio_beos" = "yes" ; then
1366 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1367 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1368fi
1369
5cbcf02c
FB
1370if test "$network" = "yes" ; then
1371 echo "#define CONFIG_NETWORK 1" >> $TMPH
1372 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 1373fi
daf8e955 1374
7a91333f
HZ
1375if test "$ipv6" = "yes" ; then
1376 echo "#define CONFIG_IPV6 1" >> $TMPH
1377fi
1378
0147f198
FR
1379if test "$zlib" = "yes" ; then
1380 echo "#define CONFIG_ZLIB 1" >> $TMPH
1381 echo "CONFIG_ZLIB=yes" >> config.mak
1382fi
1383
57514323 1384if test "$mp3lame" = "yes" ; then
045ed63f 1385 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
1386 echo "CONFIG_MP3LAME=yes" >> config.mak
1387fi
1388
5c5dea3f
NB
1389if test "$ogg" = "yes" ; then
1390 echo "#define CONFIG_LIBOGG 1" >> $TMPH
1391 echo "CONFIG_LIBOGG=yes" >> config.mak
1392fi
1393
81e0d0b4 1394if test "$vorbis" = "yes" ; then
5c5dea3f
NB
1395 echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
1396 echo "CONFIG_LIBVORBIS=yes" >> config.mak
1397fi
1398
1399if test "$theora" = "yes" ; then
1400 echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
1401 echo "CONFIG_LIBTHEORA=yes" >> config.mak
81e0d0b4
MH
1402fi
1403
0fc50e58
ZK
1404if test "$faad" = "yes" ; then
1405 echo "#define CONFIG_FAAD 1" >> $TMPH
1406 echo "CONFIG_FAAD=yes" >> config.mak
1407fi
1408
1409if test "$faadbin" = "yes" ; then
1410 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1411 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1412fi
1413
29d48296
MN
1414if test "$faac" = "yes" ; then
1415 echo "#define CONFIG_FAAC 1" >> $TMPH
1416 echo "CONFIG_FAAC=yes" >> config.mak
1417fi
1418
1ddadfa9
AT
1419if test "$xvid" = "yes" ; then
1420 echo "#define CONFIG_XVID 1" >> $TMPH
1421 echo "CONFIG_XVID=yes" >> config.mak
1422fi
1423
6662ec29
MN
1424if test "$x264" = "yes" ; then
1425 echo "#define CONFIG_X264 1" >> $TMPH
1426 echo "CONFIG_X264=yes" >> config.mak
1427fi
1428
732d9245
BE
1429if test "$mingw32" = "yes" ; then
1430 echo "#define CONFIG_WIN32 1" >> $TMPH
1431 echo "CONFIG_WIN32=yes" >> config.mak
16806499
MN
1432 echo "HAVE_W32THREADS=yes" >> config.mak
1433 echo "#define HAVE_W32THREADS 1" >> $TMPH
2450cff2 1434 echo "#define HAVE_THREADS 1" >> $TMPH
7eea5766 1435 echo "#ifndef __MINGW32__" >> $TMPH
732d9245 1436 echo "#define __MINGW32__ 1" >> $TMPH
7eea5766 1437 echo "#endif" >> $TMPH
3f027ca7
FB
1438fi
1439
f3ec2d46
SG
1440if test "$os2" = "yes" ; then
1441 echo "#define CONFIG_OS2 1" >> $TMPH
1442 echo "CONFIG_OS2=yes" >> config.mak
1443fi
1444
6e023978
RS
1445if test "$TARGET_OS" = "SunOS" ; then
1446 echo "#define CONFIG_SUNOS 1" >> $TMPH
1447fi
1448
2450cff2
FR
1449if test "$TARGET_OS" = "BeOS" ; then
1450 echo "HAVE_BEOSTHREADS=yes" >> config.mak
1451 echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
1452 echo "#define HAVE_THREADS 1" >> $TMPH
1453fi
1454
90cee0c3
MN
1455if test "$darwin" = "yes"; then
1456 echo "#define CONFIG_DARWIN 1" >> $TMPH
1457 echo "CONFIG_DARWIN=yes" >> config.mak
1458fi
1459
57514323 1460if test "$_malloc_h" = "yes" ; then
045ed63f 1461 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1462else
045ed63f 1463 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1464fi
1465
57514323 1466if test "$_memalign" = "yes" ; then
045ed63f
ZK
1467 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1468else
1469 echo "#undef HAVE_MEMALIGN" >> $TMPH
1470fi
1471
da9b170c
MN
1472if test "$memalignhack" = "yes" ; then
1473 echo "#define MEMALIGN_HACK 1" >> $TMPH
1474fi
1475
1476
26b35efb
FR
1477if test "$netserver" = "yes" ; then
1478 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1479 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1480fi
1481
4baca069
PG
1482if test "$need_inet_aton" = "yes" ; then
1483 echo "NEED_INET_ATON=yes" >> config.mak
1484fi
1485
57514323 1486if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1487 echo "#define SIMPLE_IDCT 1" >> $TMPH
1488fi
1489
8154d2e0
FB
1490if test "$ffserver" = "yes" ; then
1491 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1492 echo "CONFIG_FFSERVER=yes" >> config.mak
1493fi
1494
a86b921c
FB
1495if test "$ffplay" = "yes" ; then
1496 echo "CONFIG_FFPLAY=yes" >> config.mak
1497fi
1498
b2e3c528
MN
1499if test "$gpl" = "yes" ; then
1500 echo "#define CONFIG_GPL 1" >> $TMPH
1501 echo "CONFIG_GPL=yes" >> config.mak
1502fi
1503
c13e1abd
FH
1504echo "#define restrict $_restrict" >> $TMPH
1505
bb801c97
MN
1506if test "$optimize" = "small"; then
1507 echo "#define always_inline" >> $TMPH
1508fi
1509
0f3cb305
FB
1510# build tree in object directory if source path is different from current one
1511if test "$source_path_used" = "yes" ; then
8b8e1c55
PMH
1512 DIRS="doc libavformat libavcodec libavcodec/alpha libavcodec/armv4l \
1513 libavcodec/i386 libavcodec/sparc libavcodec/mlib \
1514 libavcodec/ppc libavcodec/liba52 libavcodec/libpostproc tests vhook"
1515 FILES="Makefile libavformat/Makefile libavcodec/Makefile \
1516 libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile \
1517 doc/Makefile doc/texi2pod.pl"
0f3cb305
FB
1518 for dir in $DIRS ; do
1519 mkdir -p $dir
1520 done
1521 for f in $FILES ; do
281a74da 1522 ln -sf "$source_path/$f" $f
0f3cb305 1523 done
8b8e1c55
PMH
1524 echo "SRC_PATH=$source_path" >> config.mak
1525else
1526 echo "SRC_PATH='$source_path'" >> config.mak
0f3cb305 1527fi
0f3cb305 1528
d663a1fd
MN
1529if test "$amr_wb" = "yes" ; then
1530 echo "#define AMR_WB 1" >> $TMPH
1531 echo "AMR_WB=yes" >> config.mak
1532 echo
1533 echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1534 echo "V5.1.0 from "
1535 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1536 echo "and extracted the source to libavcodec/amrwb_float"
1537 echo
1538fi
1539
891f64b3 1540if test "$amr_nb" = "yes" ; then
1541 echo "#define AMR_NB 1" >> $TMPH
1542 echo "AMR_NB=yes" >> config.mak
1543 echo
bc634f6f
ZK
1544if test "$amr_nb_fixed" = "yes" ; then
1545 echo "AMR_NB_FIXED=yes" >> config.mak
1546 echo "#define AMR_NB_FIXED 1" >> $TMPH
1547 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1548 echo "REL-5 version 5.1.0 from "
184582de 1549 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
891f64b3 1550 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1551 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1552 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1553 echo
1554else
1555 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1556 echo "REL-5 V5.1.0 from "
184582de 1557 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
bc634f6f 1558 echo "and extracted the source to libavcodec/amr_float"
821e46f4 1559 echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
891f64b3 1560 echo
1561fi
1562
2a515c08
TM
1563if test "$amr_if2" = "yes" ; then
1564 echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1565fi
1566
bc634f6f
ZK
1567fi
1568
a7c02e25 1569diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
1570if test $? -ne 0 ; then
1571 mv -f $TMPH config.h
3d204385 1572else
045ed63f 1573 echo "config.h is unchanged"
3d204385
NK
1574fi
1575
f3ec2d46 1576rm -f $TMPO $TMPC $TMPE $TMPS $TMPH