configure 46.5 KB
Newer Older
Fabrice Bellard's avatar
Fabrice Bellard committed
1
#!/bin/sh
2
#
Fabrice Bellard's avatar
Fabrice Bellard committed
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5 6 7 8 9 10 11 12 13 14 15

if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat << EOF

Usage: configure [options]
Options: [defaults in brackets after descriptions]

EOF
echo "Standard options:"
echo "  --help                   print this message"
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
16
echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
Diego Biurrun's avatar
Diego Biurrun committed
17 18 19 20 21 22 23 24 25 26
echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
echo "  --enable-mp3lame         enable MP3 encoding via libmp3lame [default=no]"
echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
echo "  --enable-vorbis          enable Vorbis support via libvorbis [default=no]"
echo "  --enable-theora          enable Theora support via libtheora [default=no]"
echo "  --enable-faad            enable FAAD support via libfaad [default=no]"
echo "  --enable-faadbin         build FAAD support with runtime linking [default=no]"
echo "  --enable-faac            enable FAAC support via libfaac [default=no]"
echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
echo "  --enable-xvid            enable XviD support via xvidcore [default=no]"
27
echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
28 29
echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
echo "  --enable-a52             enable GPLed A52 support [default=no]"
30
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
31 32
echo "  --enable-dts             enable GPLed DTS support [default=no]"
echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
33 34 35 36
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
echo "  --enable-shared          build shared libraries [default=no]"
echo "  --enable-amr_nb          enable amr_nb float audio codec"
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
37
echo "  --enable-amr_wb          enable amr_wb float audio codec"
Diego Biurrun's avatar
Diego Biurrun committed
38
echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
39
echo "  --enable-sunmlib         use Sun medialib [default=no]"
40
echo "  --enable-pthreads        use pthreads [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
41 42 43 44
echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394"
echo "                           and libraw1394 [default=no]"
echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
echo "                           and ffmpeg will be under GPL [default=no]"
45 46
echo ""
echo "Advanced options (experts only):"
Diego Biurrun's avatar
Diego Biurrun committed
47 48
echo "  --source-path=PATH       path to source code [$source_path]"
echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
49 50 51 52 53
echo "  --cc=CC                  use C compiler CC [$cc]"
echo "  --make=MAKE              use specified make [$make]"
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
54
echo "  --build-suffix=SUFFIX    suffix for application specific build []"
55
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
Diego Biurrun's avatar
Diego Biurrun committed
56 57 58 59 60
echo "  --tune=CPU               tune code for a particular CPU"
echo "                           (may fail or perform badly on other CPUs)"
echo "  --powerpc-perf-enable    enable performance report on PPC"
echo "                           (requires enabling PMC)"
echo "  --disable-mmx            disable MMX usage"
61
echo "  --disable-iwmmxt         disable iwmmxt usage"
62 63 64 65
echo "  --disable-altivec        disable AltiVec usage"
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
66
echo "  --disable-bktr           disable bktr video grabbing [default=no]"
67 68 69 70 71 72 73 74 75
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
echo "  --disable-network        disable network support [default=no]"
echo "  --disable-zlib           disable zlib [default=no]"
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
echo "  --disable-vhook          disable video hooking support"
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
echo "  --disable-debug          disable debugging symbols"
echo "  --disable-opts           disable compiler optimizations"
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
Diego Biurrun's avatar
Diego Biurrun committed
76
echo "                           MPEG audio decoding [default=no]"
77 78 79
echo "  --disable-ffserver       disable ffserver build"
echo "  --disable-ffplay         disable ffplay build"
echo "  --enable-small           optimize for size instead of speed"
80
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
81
echo "  --disable-strip          disable stripping of executables and shared libraries"
Diego Biurrun's avatar
Diego Biurrun committed
82 83
echo "  --enable-codec=CODEC     enables CODEC"
echo "  --disable-codec=CODEC    disables CODEC"
84
echo "  --disable-encoders       disables all encoders"
85
echo "  --disable-decoders       disables all decoders"
86 87
echo "  --disable-muxers         disables all muxers"
echo "  --disable-demuxers       disables all demuxers"
88
echo ""
Diego Biurrun's avatar
Diego Biurrun committed
89
echo "NOTE: Object files are built at the place where configure is launched."
90 91 92
exit 1
fi

93
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
94
if test ! -z "$TMPDIR" ; then
95
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
96
elif test ! -z "$TEMPDIR" ; then
97
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
98
else
99
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
100 101
fi

102 103
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
104
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
105 106 107
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
108 109
# default parameters
prefix="/usr/local"
110
libdir=""
111
mandir=""
Fabrice Bellard's avatar
Fabrice Bellard committed
112
bindir=""
113
cross_prefix=""
Fabrice Bellard's avatar
Fabrice Bellard committed
114 115
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
116
ranlib="ranlib"
117
make="make"
118
strip="strip"
Fabrice Bellard's avatar
Fabrice Bellard committed
119
cpu=`uname -m`
120
tune="generic"
121
powerpc_perf="no"
122
mmx="default"
123
iwmmxt="default"
124
altivec="default"
125
mmi="default"
Fabrice Bellard's avatar
Fabrice Bellard committed
126
case "$cpu" in
127
  i386|i486|i586|i686|i86pc|BePC)
Fabrice Bellard's avatar
Fabrice Bellard committed
128 129
    cpu="x86"
  ;;
130 131 132 133 134 135 136
  x86_64|amd64)
    cpu="x86"
    canon_arch="`cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
        cpu="x86_64"
      fi
137 138
    fi
  ;;
139 140
  # armv4l is a subset of armv5tel
  armv4l|armv5tel)
141 142
    cpu="armv4l"
  ;;
143 144 145
  alpha)
    cpu="alpha"
  ;;
146
  "Power Macintosh"|ppc)
147 148
    cpu="powerpc"
  ;;
149
  mips|mipsel)
150 151
    cpu="mips"
  ;;
152
  sun4u|sparc64)
153 154
    cpu="sparc64"
  ;;
155 156 157
  sparc)
    cpu="sparc"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
158 159 160
  sh4)
    cpu="sh4"
  ;;
161 162 163 164 165 166 167 168 169 170 171 172
  parisc|parisc64)
    cpu="parisc"
  ;;
  s390|s390x)
    cpu="s390"
  ;;
  m68k)
    cpu="m68k"
  ;;
  ia64)
    cpu="ia64"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
173
  *)
174
    cpu="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
175 176 177
  ;;
esac
gprof="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
178
v4l="yes"
179
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
180
audio_oss="yes"
181
audio_beos="no"
182
dv1394="yes"
183
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
184
network="yes"
185
zlib="yes"
186
libgsm="no"
187
mp3lame="no"
188
libogg="no"
189
vorbis="no"
Nilesh Bansal's avatar
Nilesh Bansal committed
190
theora="no"
191 192
faad="no"
faadbin="no"
193
faac="no"
194
xvid="no"
195
x264="no"
196
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
197
a52bin="no"
198
dts="no"
199
pp="no"
200
shared_pp="no"
201
mingw32="no"
202
cygwin="no"
203
os2="no"
204
lshared="no"
205 206
optimize="yes"
debug="yes"
207
dostrip="yes"
208
extralibs="-lm"
209
simpleidct="yes"
210
bigendian="no"
211
inttypes="yes"
212
emu_fast_int="no"
213
vhook="default"
214 215
dlfcn="no"
dlopen="no"
216
mpegaudio_hp="yes"
217
SHFLAGS=-shared
218
netserver="no"
219
need_inet_aton="no"
220
ffserver="yes"
221
ffplay="yes"
222
LIBOBJFLAGS=""
223 224
LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E
225
LDCONFIG="ldconfig"
226 227 228 229
LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
Fabrice Bellard's avatar
Fabrice Bellard committed
230
EXESUF=""
231
BUILDSUF=""
232
amr_nb="no"
233
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
234
amr_nb_fixed="no"
235
amr_if2="no"
236
sunmlib="no"
237
pthreads="no"
238
gpl="no"
239
memalignhack="no"
240 241
muxers="yes"
demuxers="yes"
242 243 244 245 246 247 248

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
249
CFLAGS="-DPIC -fomit-frame-pointer"
250
# 3 gcc releases known for BeOS, each with ugly bugs
251
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
252 253 254 255 256 257 258 259
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
mmx="no"
;;
*20010315*) echo "BeBits gcc"
CFLAGS="$CFLAGS -fno-expensive-optimizations"
;;
esac
260
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
261
# disable Linux things
262
audio_oss="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
263
v4l="no"
264
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
265
# enable BeOS things
266
audio_beos="yes"
267 268 269 270 271
# no need for libm, but the inet stuff
# Check for BONE
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
extralibs="-lbind -lsocket"
else
272
netserver="yes"
273
need_inet_aton="yes"
274
extralibs="-lnet"
275
fi ;;
276 277 278
SunOS)
v4l="no"
audio_oss="no"
279
dv1394="no"
280 281 282 283 284 285
make="gmake"
LDFLAGS=""
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
286 287
NetBSD)
v4l="no"
288
bktr="yes"
289 290 291 292 293 294 295 296 297
audio_oss="yes"
dv1394="no"
make="gmake"
LDFLAGS="$LDFLAGS -export-dynamic"
case `uname -r` in
2.*) extralibs="-lossaudio"
;;
esac
;;
298 299
OpenBSD)
v4l="no"
300
bktr="yes"
301 302 303
audio_oss="yes"
dv1394="no"
make="gmake"
304
LIBOBJFLAGS="\$(PIC)"
305
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
306
LDCONFIG="ldconfig -m \$(libdir)"
307 308
extralibs="$extralibs -lossaudio"
;;
309 310
FreeBSD)
v4l="no"
311
bktr="yes"
312
audio_oss="yes"
313
dv1394="no"
314
make="gmake"
315 316
CFLAGS="-pthread"
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
317
;;
318
BSD/OS)
Fabrice Bellard's avatar
Fabrice Bellard committed
319
v4l="no"
320
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
321
audio_oss="yes"
322
dv1394="no"
323 324 325
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
;;
326
Darwin)
327
cc="cc"
328 329
v4l="no"
audio_oss="no"
330
dv1394="no"
331
ffserver="no"
332
SHFLAGS="-dynamiclib"
333
extralibs=""
334
darwin="yes"
335
strip="strip -x"
336
LDFLAGS="-Wl,-search_paths_first"
337
FFSLDFLAGS=-Wl,-bind_at_load
338
;;
339
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
340
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
341
# can be forced on the command line for Linux cross compilation.
342 343
mingw32="yes"
;;
344 345 346
CYGWIN*)
v4l="no"
audio_oss="yes"
347
dv1394="no"
348
ffserver="no"
349 350
extralibs=""
cygwin="yes"
351
EXESUF=".exe"
352
;;
353
Linux)
354
LDFLAGS="$LDFLAGS -rdynamic"
355
;;
356 357 358 359 360 361
IRIX*)
ranlib="echo ignoring ranlib"
v4l="no"
audio_oss="no"
make="gmake"
;;
362 363
OS/2)
TMPE=$TMPE".exe"
364
ar="emxomfar -p128"
365 366
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
367
CFLAGS="-Zomf"
368
LDFLAGS="-Zomf -Zstack 16384 -s"
369
SHFLAGS="-Zdll -Zomf"
370 371 372 373 374
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
375
EXESUF=".exe"
376 377 378
extralibs=""
v4l="no"
audio_oss="no"
379
dv1394="no"
380 381
network="no"
ffserver="no"
382
vhook="no"
383
os2="yes"
384

385
;;
386 387
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
388

Diego Biurrun's avatar
Diego Biurrun committed
389
# From MPlayer configure. We need TARGET_OS available
390
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
391
# of AltiVec on PowerPC.
392 393
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
394
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
    ;;
  IRIX*)
    TARGET_OS=IRIX
    ;;
  HP-UX*)
    TARGET_OS=HP-UX
    ;;
  [cC][yY][gG][wW][iI][nN]*)
    TARGET_OS=CYGWIN
    ;;
  *)
    TARGET_OS="$TARGET_OS-UNKNOWN"
    ;;
  esac

410
# find source path
411
source_path="`echo $0 | sed -e 's#/configure##'`"
412 413 414 415
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
416 417
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
418 419
fi

420 421 422 423 424
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

425
CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c  | sed 's/.*&\(.*\)).*/\1/'`
426

Fabrice Bellard's avatar
Fabrice Bellard committed
427 428
for opt do
  case "$opt" in
429
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
430
  ;;
431
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
432
  ;;
433 434
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  ;;
435 436 437 438
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
439
  --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
Fabrice Bellard's avatar
Fabrice Bellard committed
440
  ;;
441 442
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
443
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
444
  ;;
445
  --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
446 447 448
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
449 450
  --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
451 452
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
453 454
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  ;;
455 456
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
457 458
  --disable-mmx) mmx="no"
  ;;
459 460
  --disable-iwmmxt) iwmmxt="no"
  ;;
461 462
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
463 464
  --enable-gprof) gprof="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
465 466
  --disable-v4l) v4l="no"
  ;;
467 468
  --disable-bktr) bktr="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
469 470
  --disable-audio-oss) audio_oss="no"
  ;;
471 472
  --disable-audio-beos) audio_beos="no"
  ;;
473 474
  --disable-dv1394) dv1394="no"
  ;;
475
  --disable-network) network="no"; ffserver="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
476
  ;;
477 478
  --disable-zlib) zlib="no"
  ;;
479
  --enable-a52) a52="yes"
480
  ;;
Michael Niedermayer's avatar
Michael Niedermayer committed
481
  --enable-a52bin) a52bin="yes"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
482
  ;;
483 484
  --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
  ;;
485
  --enable-pp) pp="yes"
486 487 488
  ;;
  --enable-shared-pp) shared_pp="yes"
  ;;
489 490
  --enable-libgsm) libgsm="yes"
  ;;
491 492
  --enable-mp3lame) mp3lame="yes"
  ;;
493
  --enable-libogg) libogg="yes"
Nilesh Bansal's avatar
Nilesh Bansal committed
494
  ;;
495 496
  --enable-vorbis) vorbis="yes"
  ;;
Nilesh Bansal's avatar
Nilesh Bansal committed
497 498
  --enable-theora) theora="yes"
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
499 500 501 502
  --enable-faad) faad="yes"
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
503 504
  --enable-faac) faac="yes"
  ;;
505 506
  --enable-xvid) xvid="yes"
  ;;
507 508
  --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
  ;;
509 510
  --enable-dc1394) dc1394="yes"
  ;;
511 512
  --disable-vhook) vhook="no"
  ;;
513
  --disable-simple_idct) simpleidct="no"
514
  ;;
515 516
  --enable-mingw32) mingw32="yes"
  ;;
517
  --enable-shared) lshared="yes"
Nick Kurshev's avatar
Nick Kurshev committed
518
  ;;
519 520 521 522
  --disable-debug) debug="no"
  ;;
  --disable-opts) optimize="no"
  ;;
523 524
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
525 526
  --disable-ffserver) ffserver="no"
  ;;
527 528
  --disable-ffplay) ffplay="no"
  ;;
529
  --enable-small) optimize="small"
530
  ;;
531 532
  --enable-amr_nb) amr_nb="yes"
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
533 534
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
  ;;
535 536
  --enable-amr_wb) amr_wb="yes"
  ;; 
537 538
  --enable-amr_if2) amr_if2="yes"
  ;;
539 540
  --enable-sunmlib) sunmlib="yes"
  ;;
541 542
  --enable-pthreads) pthreads="yes"
  ;;
543 544
  --enable-gpl) gpl="yes"
  ;;
545 546
  --enable-memalign-hack) memalignhack="yes"
  ;;
547 548
  --disable-strip) dostrip="no"
  ;;
549 550 551 552 553 554
  --enable-codec=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-codec=}"
  ;;
  --disable-codec=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-codec=}##\"`"
  ;;
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  ;;
555 556
  --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  ;;
557 558 559 560
  --disable-muxers) muxers="no"
  ;;
  --disable-demuxers) demuxers="no"
  ;;
561 562 563 564 565
  *)
  echo "Unknown option \"$opt\"."
  echo "See $0 --help for available options."
  exit 1
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
566 567 568
  esac
done

Nilesh Bansal's avatar
Nilesh Bansal committed
569
if test "$theora" = "yes" ; then
570
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
571
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
572 573 574 575 576 577
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
578
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
579
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
580 581 582 583 584
        fail="yes"
        vorbis="no"
    fi
fi

585 586
if test "$gpl" != "yes"; then
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
587
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
588 589 590 591
        fail="yes"
    fi

    if test "$a52" != "no" -o "$a52bin" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
592
        echo "liba52 is under GPL and --enable-gpl is not specified."
593 594
        fail="yes"
    fi
595

596
    if test "$xvid" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
597
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
598 599 600
        fail="yes"
    fi

601
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
602
        echo "x264 is under GPL and --enable-gpl is not specified."
603 604 605
        fail="yes"
    fi

606
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
607
        echo "libdts is under GPL and --enable-gpl is not specified."
608 609
        fail="yes"
    fi
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
    
    if test "$faad" != "no" -o "$faadbin" != "no"; then
        cat > $TMPC << EOF
            #include <faad.h>
            int main( void ) { return 0; }
EOF
    
        if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
            cat > $TMPC << EOF
                #include <faad.h>
                #ifndef FAAD2_VERSION
                ok faad1
                #endif
                int main( void ) { return 0; }
EOF
            if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
Diego Biurrun's avatar
Diego Biurrun committed
626
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
627 628 629 630 631
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
632
            echo "FAAD test failed."
633 634 635 636
        fi
    fi
   

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
637
    if test "$fail" = "yes"; then
638 639 640 641
        exit 1
    fi
fi

Diego Biurrun's avatar
Diego Biurrun committed
642
# compute MMX state
643
if test $mmx = "default"; then
644
    if test $cpu = "x86" -o $cpu = "x86_64"; then
645 646 647 648 649 650
        mmx="yes"
    else
        mmx="no"
    fi
fi

651 652 653 654 655 656 657 658 659 660 661 662 663 664
# check iwmmxt support
if test $iwmmxt = "default" -a $cpu = "armv4l"; then
    cat > $TMPC << EOF
        int main(void) { 
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
        }
EOF

    iwmmxt=no
    if ${cross_prefix}${cc} -o $TMPO $TMPC 2> /dev/null ; then
        iwmmxt=yes
    fi
fi

665
#Darwin CC versions
666
needmdynamicnopic="no"
667
if test $targetos = Darwin; then
668
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
669
	CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
670
    else
671
	gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
672 673
	case "$gcc_version" in
	    *2.95*) 
674
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
675
		;;
676
	    *[34].*)
677
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
678 679 680
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
681 682
		;;
	    *)
683
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
684 685 686
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
687 688 689 690 691
		;;
	esac
    fi
fi

692 693 694 695 696 697 698 699 700
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

701 702
# Add processor-specific flags
TUNECPU="generic"
703
POWERPCMODE="32bits"
704 705 706 707 708
if test $tune != "generic"; then
    case $tune in
	601|ppc601|PowerPC601)
	    CFLAGS="$CFLAGS -mcpu=601"
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
709
		echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
710 711 712 713 714 715
	    fi
	    TUNECPU=ppc601
	;;
	603*|ppc603*|PowerPC603*)
	    CFLAGS="$CFLAGS -mcpu=603"
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
716
		echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
717 718 719 720 721 722
	    fi
	    TUNECPU=ppc603
	;;
	604*|ppc604*|PowerPC604*)
	    CFLAGS="$CFLAGS -mcpu=604"
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
723
		echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
724 725 726
	    fi
	    TUNECPU=ppc604
	;;
727
	G3|g3|75*|ppc75*|PowerPC75*)
728
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
729
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
730
		echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
731 732 733
	    fi
	    TUNECPU=ppc750
	;;
734
	G4|g4|745*|ppc745*|PowerPC745*)
735
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
736
	    if test $altivec = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
737
		echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
738 739 740 741
	    fi
	    TUNECPU=ppc7450
	;;
	74*|ppc74*|PowerPC74*)
742
	    CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
743
	    if test $altivec = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
744
		echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
745
	    fi
746
	    TUNECPU=ppc7400
747
	;;
748
	G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
749
	    CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
750
	    if test $altivec = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
751
		echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
752 753
	    fi
	    TUNECPU=ppc970
754
            POWERPCMODE="64bits"
755
	;;
756 757 758
	i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6|k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6|winchip2|c3|nocona)
	    CFLAGS="$CFLAGS -march=$tune"
	;;
759
	*)
Diego Biurrun's avatar
Diego Biurrun committed
760
	echo "WARNING: Unknown CPU \"$tune\", ignored."
761 762 763 764
	;;
    esac
fi

765
# AltiVec flags: The FSF version of GCC differs from the Apple version 
766 767
if test $cpu = "powerpc"; then
    if test $altivec = "yes"; then
768
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
Steven M. Schultz's avatar
Steven M. Schultz committed
769
            CFLAGS="$CFLAGS -faltivec"