configure 48.9 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"
82 83 84 85
echo "  --disable-encoder=NAME   disables encoder NAME"
echo "  --enable-encoder=NAME    enables encoder NAME"
echo "  --disable-decoder=NAME   disables decoder NAME"
echo "  --enable-decoder=NAME    enables decoder NAME"
86
echo "  --disable-encoders       disables all encoders"
87
echo "  --disable-decoders       disables all decoders"
88 89
echo "  --disable-muxers         disables all muxers"
echo "  --disable-demuxers       disables all demuxers"
90
echo ""
Diego Biurrun's avatar
Diego Biurrun committed
91
echo "NOTE: Object files are built at the place where configure is launched."
92 93 94
exit 1
fi

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

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

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

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

393
;;
394 395
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
396

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

418
# find source path
419
source_path="`dirname $0`"
420 421 422 423
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
424 425
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
426 427
fi

428 429 430 431 432
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

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

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

if test "$vorbis" = "yes" ; then
606
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
607
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
608 609 610 611 612
        fail="yes"
        vorbis="no"
    fi
fi

613 614
if test "$gpl" != "yes"; then
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
615
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
616 617 618 619
        fail="yes"
    fi

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

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

629
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
630
        echo "x264 is under GPL and --enable-gpl is not specified."
631 632 633
        fail="yes"
    fi

634
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
635
        echo "libdts is under GPL and --enable-gpl is not specified."
636 637
        fail="yes"
    fi
638

639 640 641 642 643
    if test "$faad" != "no" -o "$faadbin" != "no"; then
        cat > $TMPC << EOF
            #include <faad.h>
            int main( void ) { return 0; }
EOF
644

645 646 647 648 649 650 651 652 653
        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
654
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
655 656 657 658 659
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
660
            echo "FAAD test failed."
661 662
        fi
    fi
663

664

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
665
    if test "$fail" = "yes"; then
666 667 668 669
        exit 1
    fi
fi

Diego Biurrun's avatar
Diego Biurrun committed
670
# compute MMX state
671
if test $mmx = "default"; then
672
    if test $cpu = "x86" -o $cpu = "x86_64"; then
673 674 675 676 677 678
        mmx="yes"
    else
        mmx="no"
    fi
fi

679 680 681
# check iwmmxt support
if test $iwmmxt = "default" -a $cpu = "armv4l"; then
    cat > $TMPC << EOF
682
        int main(void) {
683 684 685 686 687 688 689 690 691 692
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
        }
EOF

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

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

720 721 722 723 724 725 726 727 728
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

729 730
# Add processor-specific flags
TUNECPU="generic"
731
POWERPCMODE="32bits"
732 733
if test $tune != "generic"; then
    case $tune in
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
        601|ppc601|PowerPC601)
            CFLAGS="$CFLAGS -mcpu=601"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
            fi
            TUNECPU=ppc601
        ;;
        603*|ppc603*|PowerPC603*)
            CFLAGS="$CFLAGS -mcpu=603"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
            fi
            TUNECPU=ppc603
        ;;
        604*|ppc604*|PowerPC604*)
            CFLAGS="$CFLAGS -mcpu=604"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
            fi
            TUNECPU=ppc604
        ;;
        G3|g3|75*|ppc75*|PowerPC75*)
            CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
            fi
            TUNECPU=ppc750
        ;;
        G4|g4|745*|ppc745*|PowerPC745*)
            CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
            if test $altivec = "no"; then
                echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
            fi
            TUNECPU=ppc7450
        ;;
        74*|ppc74*|PowerPC74*)
            CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
            if test $altivec = "no"; then
                echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
            fi
            TUNECPU=ppc7400
        ;;
        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
            CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
            if test $altivec = "no"; then
                echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
            fi
            TUNECPU=ppc970
782
            POWERPCMODE="64bits"