configure 47.6 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"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
146
  "Power Macintosh"|ppc|powerpc)
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
installstrip="-s"
209
extralibs="-lm"
210
simpleidct="yes"
211
bigendian="no"
212
inttypes="yes"
213
emu_fast_int="no"
214
vhook="default"
215 216
dlfcn="no"
dlopen="no"
217
mpegaudio_hp="yes"
Luca Barbato's avatar
Luca Barbato committed
218
SHFLAGS='-shared -Wl,-soname,$@.$(LIBVERSION)'
219
netserver="no"
220
need_inet_aton="no"
221
ffserver="yes"
222
ffplay="yes"
223
LIBOBJFLAGS=""
224 225
LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E
226
LDCONFIG="ldconfig"
227 228 229 230
LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
Fabrice Bellard's avatar
Fabrice Bellard committed
231
EXESUF=""
232
BUILDSUF=""
233
amr_nb="no"
234
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
235
amr_nb_fixed="no"
236
amr_if2="no"
237
sunmlib="no"
238
pthreads="no"
239
gpl="no"
240
memalignhack="no"
241 242
muxers="yes"
demuxers="yes"
243 244 245 246 247 248 249

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

391
;;
392 393
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
394

Diego Biurrun's avatar
Diego Biurrun committed
395
# From MPlayer configure. We need TARGET_OS available
396
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
397
# of AltiVec on PowerPC.
398 399
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
400
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
    ;;
  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

416
# find source path
417
source_path="`echo $0 | sed -e 's#/configure##'`"
418 419 420 421
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
422 423
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
424 425
fi

426 427 428 429 430
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

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

Nilesh Bansal's avatar
Nilesh Bansal committed
591
if test "$theora" = "yes" ; then
592
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
593
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
594 595 596 597 598 599
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
600
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
601
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
602 603 604 605 606
        fail="yes"
        vorbis="no"
    fi
fi

607 608
if test "$gpl" != "yes"; then
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
609
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
610 611 612 613
        fail="yes"
    fi

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

618
    if test "$xvid" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
619
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
620 621 622
        fail="yes"
    fi

623
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
624
        echo "x264 is under GPL and --enable-gpl is not specified."
625 626 627
        fail="yes"
    fi

628
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
629
        echo "libdts is under GPL and --enable-gpl is not specified."
630 631
        fail="yes"
    fi
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
    
    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
648
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
649 650 651 652 653
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
654
            echo "FAAD test failed."
655 656 657 658
        fi
    fi
   

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
659
    if test "$fail" = "yes"; then
660 661 662 663
        exit 1
    fi
fi

Diego Biurrun's avatar
Diego Biurrun committed
664
# compute MMX state
665
if test $mmx = "default"; then
666
    if test $cpu = "x86" -o $cpu = "x86_64"; then
667 668 669 670 671 672
        mmx="yes"
    else
        mmx="no"
    fi
fi

673 674 675 676 677 678 679 680 681 682 683 684 685 686
# 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

687
#Darwin CC versions
688
needmdynamicnopic="no"
689
if test $targetos = Darwin; then
690
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
691
	CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
692
    else
693
	gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
694 695
	case "$gcc_version" in
	    *2.95*) 
696
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
697
		;;
698
	    *[34].*)
699
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
700 701 702
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
703 704
		;;
	    *)
705
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
706 707 708
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
709 710 711 712 713
		;;
	esac
    fi
fi

714 715 716 717 718 719 720 721 722
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

723 724
# Add processor-specific flags
TUNECPU="generic"
725
POWERPCMODE="32bits"
726 727 728 729 730
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
731
		echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
732 733 734 735 736 737
	    fi
	    TUNECPU=ppc601
	;;
	603*|ppc603*|PowerPC603*)
	    CFLAGS="$CFLAGS -mcpu=603"
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
738
		echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
739 740 741 742 743 744
	    fi
	    TUNECPU=ppc603
	;;
	604*|ppc604*|PowerPC604*)
	    CFLAGS="$CFLAGS -mcpu=604"
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
745
		echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
746 747 748
	    fi
	    TUNECPU=ppc604
	;;
749
	G3|g3|75*|ppc75*|PowerPC75*)
750
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
751
	    if test $altivec = "yes"; then
Diego Biurrun's avatar
Diego Biurrun committed
752
		echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
753 754 755
	    fi
	    TUNECPU=ppc750
	;;
756
	G4|g4|745*|ppc745*|PowerPC745*)
757
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
758
	    if test $altivec = "no"; then