configure 49.4 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
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
echo "  --disable-network        disable network support [default=no]"
echo "  --disable-zlib           disable zlib [default=no]"
70
echo "  --disable-lzo            disable lzo [default=no]"
71 72 73 74 75 76
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
77
echo "                           MPEG audio decoding [default=no]"
78 79 80
echo "  --disable-ffserver       disable ffserver build"
echo "  --disable-ffplay         disable ffplay build"
echo "  --enable-small           optimize for size instead of speed"
81
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
82
echo "  --disable-strip          disable stripping of executables and shared libraries"
83 84 85 86
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"
87
echo "  --disable-encoders       disables all encoders"
88
echo "  --disable-decoders       disables all decoders"
89 90
echo "  --disable-muxers         disables all muxers"
echo "  --disable-demuxers       disables all demuxers"
91
echo ""
Diego Biurrun's avatar
Diego Biurrun committed
92
echo "NOTE: Object files are built at the place where configure is launched."
93 94 95
exit 1
fi

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

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

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

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

395
;;
396 397
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
398

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

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

430 431 432 433 434
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

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

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

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

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

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

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

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

638
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
639
        echo "libdts is under GPL and --enable-gpl is not specified."
640 641
        fail="yes"
    fi
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
648

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

668

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
669
    if test "$fail" = "yes"; then
670 671 672 673
        exit 1
    fi
fi

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

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

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

697
#Darwin CC versions
698
needmdynamicnopic="no"
699
if test $targetos = Darwin; then
700
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
701
        CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
702
    else
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
        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
721 722 723
    fi
fi

724 725 726 727 728 729 730 731 732
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

733 734
# Add processor-specific flags
TUNECPU="generic"
735
POWERPCMODE="32bits"
736 737
if test $tune != "generic"; then
    case $tune in
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 782 783 784 785
        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