configure 53.3 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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
show_help(){
  echo "Usage: configure [options]"
  echo "Options: [defaults in brackets after descriptions]"
  echo
  echo "Standard options:"
  echo "  --help                   print this message"
  echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
  echo "  --incdir=DIR             install includes in DIR [PREFIX/include/ffmpeg]"
  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]"
  echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
  echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
  echo "  --enable-mingwce         enable MinGW native/cross WinCE compile"
  echo "  --enable-a52             enable GPLed A52 support [default=no]"
  echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
  echo "  --enable-dts             enable GPLed DTS support [default=no]"
  echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
  echo "  --enable-static          build static libraries [default=yes]"
  echo "  --disable-static         do not build static libraries [default=no]"
  echo "  --enable-shared          build shared libraries [default=no]"
  echo "  --disable-shared         do not build shared libraries [default=yes]"
  echo "  --enable-amr_nb          enable amr_nb float audio codec"
  echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
  echo "  --enable-amr_wb          enable amr_wb float audio codec"
  echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
  echo "  --enable-sunmlib         use Sun medialib [default=no]"
  echo "  --enable-pthreads        use pthreads [default=no]"
  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]"
  echo ""
  echo "Advanced options (experts only):"
  echo "  --source-path=PATH       path to source code [$source_path]"
  echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
  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]"
  echo "  --build-suffix=SUFFIX    suffix for application specific build []"
  echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
  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"
  echo "  --disable-iwmmxt         disable iwmmxt usage"
  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]"
  echo "  --disable-v4l2           disable video4linux2 grabbing [default=no]"
  echo "  --disable-bktr           disable bktr video grabbing [default=no]"
  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-lzo            disable lzo [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)"
  echo "                           MPEG audio decoding [default=no]"
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
  echo "  --disable-ffserver       disable ffserver build"
  echo "  --disable-ffplay         disable ffplay build"
  echo "  --enable-small           optimize for size instead of speed"
  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
  echo "  --disable-strip          disable stripping of executables and shared libraries"
  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"
  echo "  --disable-encoders       disables all encoders"
  echo "  --disable-decoders       disables all decoders"
  echo "  --disable-muxers         disables all muxers"
  echo "  --disable-demuxers       disables all demuxers"
  echo ""
  echo "NOTE: Object files are built at the place where configure is launched."
  exit 1
}
98

99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
save_flags(){
    (:${SAVE_CFLAGS?}) 2>/dev/null && return
    SAVE_CFLAGS="$CFLAGS"
    SAVE_LDFLAGS="$LDFLAGS"
    SAVE_extralibs="$extralibs"
}

restore_flags(){
    CFLAGS="$SAVE_CFLAGS"
    LDFLAGS="$SAVE_LDFLAGS"
    extralibs="$SAVE_extralibs"
    unset SAVE_CFLAGS
    unset SAVE_LDFLAGS
    unset SAVE_extralibs
}

temp_cflags(){
    save_flags
    CFLAGS="$CFLAGS $*"
}

temp_ldflags(){
    save_flags
    LDFLAGS="$LDFLAGS $*"
}

temp_extralibs(){
    save_flags
    extralibs="$extralibs $*"
}

check_cc(){
    cat >$TMPC
132
    $cc $CFLAGS "$@" -c -o $TMPO $TMPC >/dev/null 2>&1
133 134 135 136
}

check_ld(){
    cat >$TMPC
137
    $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >/dev/null 2>&1
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
}

check_cflags(){
    check_cc "$@" <<EOF && CFLAGS="$CFLAGS $*"
int x;
EOF
}

check_ldflags(){
    check_ld "$@" <<EOF && LDFLAGS="$LDFLAGS $*"
int x;
EOF
}

check_header(){
    header=$1
    shift
    check_cc "$@" <<EOF
#include <$header>
int x;
EOF
}

check_func(){
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
}

check_exec(){
    check_ld "$@" && (test -z "$cross_prefix" && $TMPE || true)
}

176 177
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
178 179
fi

180
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
181
if test ! -z "$TMPDIR" ; then
182
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
183
elif test ! -z "$TEMPDIR" ; then
184
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
185
else
186
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
187 188
fi

189 190
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
191
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
192 193 194
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
195 196
# default parameters
prefix="/usr/local"
197
libdir=""
Diego Biurrun's avatar
Diego Biurrun committed
198
incdir=""
199
mandir=""
Fabrice Bellard's avatar
Fabrice Bellard committed
200
bindir=""
201
cross_prefix=""
Fabrice Bellard's avatar
Fabrice Bellard committed
202 203
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
204
ranlib="ranlib"
205
make="make"
206
strip="strip"
Fabrice Bellard's avatar
Fabrice Bellard committed
207
cpu=`uname -m`
208
tune="generic"
209
powerpc_perf="no"
210
mmx="default"
211
iwmmxt="default"
212
altivec="default"
213
mmi="default"
Fabrice Bellard's avatar
Fabrice Bellard committed
214
case "$cpu" in
215
  i386|i486|i586|i686|i86pc|BePC)
Fabrice Bellard's avatar
Fabrice Bellard committed
216 217
    cpu="x86"
  ;;
218 219 220 221 222 223 224
  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
225 226
    fi
  ;;
227 228
  # armv4l is a subset of armv5tel
  armv4l|armv5tel)
229 230
    cpu="armv4l"
  ;;
231 232 233
  alpha)
    cpu="alpha"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
234
  "Power Macintosh"|ppc|powerpc)
235 236
    cpu="powerpc"
  ;;
237
  mips|mipsel)
238 239
    cpu="mips"
  ;;
240
  sun4u|sparc64)
241 242
    cpu="sparc64"
  ;;
243 244 245
  sparc)
    cpu="sparc"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
246 247 248
  sh4)
    cpu="sh4"
  ;;
249 250 251 252 253 254 255 256 257 258 259 260
  parisc|parisc64)
    cpu="parisc"
  ;;
  s390|s390x)
    cpu="s390"
  ;;
  m68k)
    cpu="m68k"
  ;;
  ia64)
    cpu="ia64"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
261
  *)
262
    cpu="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
263 264 265
  ;;
esac
gprof="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
266
v4l="yes"
Luca Abeni's avatar
Luca Abeni committed
267
v4l2="yes"
268
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
269
audio_oss="yes"
270
audio_beos="no"
271
dv1394="yes"
272
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
273
network="yes"
274
zlib="yes"
275
lzo="yes"
276
libgsm="no"
277
mp3lame="no"
278
libogg="no"
279
vorbis="no"
Nilesh Bansal's avatar
Nilesh Bansal committed
280
theora="no"
281 282
faad="no"
faadbin="no"
283
faac="no"
284
xvid="no"
285
x264="no"
286
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
287
a52bin="no"
288
dts="no"
289
pp="no"
290
mingw32="no"
Gildas Bazin's avatar
Gildas Bazin committed
291
mingwce="no"
292
cygwin="no"
293
os2="no"
294
lstatic="yes"
295
lshared="no"
296 297
optimize="yes"
debug="yes"
298
dostrip="yes"
299
installstrip="-s"
300
extralibs="-lm"
301
simpleidct="yes"
302
bigendian="no"
303
inttypes="yes"
304
emu_fast_int="no"
305
vhook="default"
306 307
dlfcn="no"
dlopen="no"
308
mpegaudio_hp="yes"
309
SHFLAGS='-shared -Wl,-soname,$@'
310
netserver="no"
311
need_inet_aton="no"
312
protocols="yes"
313
ffserver="yes"
314
ffplay="yes"
315
LIBOBJFLAGS=""
316
FFLDFLAGS=-Wl,--warn-common
317
FFSLDFLAGS=-Wl,-E
318
LDCONFIG="ldconfig"
319 320
LIBPREF="lib"
LIBSUF=".a"
321
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
322 323
SLIBPREF="lib"
SLIBSUF=".so"
324
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
325 326
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
Fabrice Bellard's avatar
Fabrice Bellard committed
327
EXESUF=""
328
BUILDSUF=""
329
amr_nb="no"
330
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
331
amr_nb_fixed="no"
332
amr_if2="no"
333
sunmlib="no"
334
pthreads="no"
335
gpl="no"
336
memalignhack="no"
337 338
muxers="yes"
demuxers="yes"
339 340 341 342 343 344 345

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
346
CFLAGS="$CFLAGS -DPIC -fomit-frame-pointer"
347
# 3 gcc releases known for BeOS, each with ugly bugs
348
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
349 350 351 352 353 354 355 356
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
357
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
358
# disable Linux things
359
audio_oss="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
360
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
361
v4l2="no"
362
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
363
# enable BeOS things
364
audio_beos="yes"
365 366 367 368 369
# 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
370
netserver="yes"
371
need_inet_aton="yes"
372
extralibs="-lnet"
373
fi ;;
374 375
SunOS)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
376
v4l2="no"
377
audio_oss="no"
378
dv1394="no"
379
make="gmake"
380
FFLDFLAGS=""
381 382 383 384
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
385 386
NetBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
387
v4l2="no"
388
bktr="yes"
389 390 391
audio_oss="yes"
dv1394="no"
make="gmake"
392
FFLDFLAGS="$FFLDFLAGS -export-dynamic"
393
extralibs="$extralibs -lossaudio"
394
;;
395 396
OpenBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
397
v4l2="no"
398
bktr="yes"
399 400 401
audio_oss="yes"
dv1394="no"
make="gmake"
402
LIBOBJFLAGS="\$(PIC)"
403
FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
404
LDCONFIG="ldconfig -m \$(libdir)"
405 406
extralibs="$extralibs -lossaudio"
;;
407 408
FreeBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
409
v4l2="no"
410
bktr="yes"
411
audio_oss="yes"
412
dv1394="no"
413
make="gmake"
414
CFLAGS="$CFLAGS -pthread"
415
FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
416
;;
417 418 419 420 421 422 423 424 425
GNU/kFreeBSD)
v4l="no"
v4l2="no"
bktr="yes"
audio_oss="yes"
dv1394="no"
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -rdynamic"
;;
426
BSD/OS)
Fabrice Bellard's avatar
Fabrice Bellard committed
427
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
428
v4l2="no"
429
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
430
audio_oss="yes"
431
dv1394="no"
432 433
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
434 435
strip="strip -d"
installstrip=""
436
;;
437
Darwin)
438
cc="cc"
439
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
440
v4l2="no"
441
audio_oss="no"
442
dv1394="no"
443
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
444
extralibs=""
445
darwin="yes"
446
strip="strip -x"
447
installstrip=""
448
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
449
SLIBSUF=".dylib"
450 451
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
452
FFSLDFLAGS=-Wl,-bind_at_load
453
;;
454
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
455
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
456
# can be forced on the command line for Linux cross compilation.
457 458
mingw32="yes"
;;
459 460
CYGWIN*)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
461
v4l2="no"
462
audio_oss="yes"
463
dv1394="no"
464
vhook="no"
465 466
extralibs=""
cygwin="yes"
467
EXESUF=".exe"
468
;;
469
Linux)
470
FFLDFLAGS="$FFLDFLAGS -rdynamic -Wl,--as-needed -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil"
471
;;
472 473 474
IRIX*)
ranlib="echo ignoring ranlib"
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
475
v4l2="no"
476 477 478
audio_oss="no"
make="gmake"
;;
479 480
OS/2)
TMPE=$TMPE".exe"
481
ar="emxomfar -p128"
482 483
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
484
CFLAGS="$CFLAGS -Zomf"
485
FFLDFLAGS="-Zomf -Zstack 16384 -s"
486
SHFLAGS="-Zdll -Zomf"
487 488 489 490 491
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
492
EXESUF=".exe"
493
extralibs=""
494
pkg_requires=""
495
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
496
v4l2="no"
497
audio_oss="no"
498
dv1394="no"
499
ffserver="no"
500
vhook="no"
501
os2="yes"
502

503
;;
504 505
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
506

Diego Biurrun's avatar
Diego Biurrun committed
507
# From MPlayer configure. We need TARGET_OS available
508
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
509
# of AltiVec on PowerPC.
510 511
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
512
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
    ;;
  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

528
# find source path
529
source_path="`dirname $0`"
530 531 532 533
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
534 535
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
536 537
fi

538 539 540 541 542
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

Fabrice Bellard's avatar
Fabrice Bellard committed
545 546
for opt do
  case "$opt" in
547
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
548
  ;;
549
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
550
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
551 552
  --incdir=*) incdir=`echo $opt | cut -d '=' -f 2`;
  ;;
553 554
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  ;;
555 556 557 558
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
559
  --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
Fabrice Bellard's avatar
Fabrice Bellard committed
560
  ;;
561 562
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
563
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
564
  ;;
565
  --extra-ldflags=*) FFLDFLAGS="$FFLDFLAGS ${opt#--extra-ldflags=}"
566 567 568
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
569 570
  --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
571 572
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
573 574
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  ;;
575 576
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
577 578
  --disable-mmx) mmx="no"
  ;;
579 580
  --disable-iwmmxt) iwmmxt="no"
  ;;
581 582
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
583 584
  --enable-gprof) gprof="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
585 586
  --disable-v4l) v4l="no"
  ;;
Luca Abeni's avatar
Luca Abeni committed
587 588
  --disable-v4l2) v4l2="no"
  ;;
589 590
  --disable-bktr) bktr="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
591 592
  --disable-audio-oss) audio_oss="no"
  ;;
593 594
  --disable-audio-beos) audio_beos="no"
  ;;
595 596
  --disable-dv1394) dv1394="no"
  ;;
597
  --disable-network) network="no"; ffserver="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
598
  ;;
599 600
  --disable-zlib) zlib="no"
  ;;
601 602
  --disable-lzo) lzo="no"
  ;;
603
  --enable-a52) a52="yes"
604
  ;;
Michael Niedermayer's avatar
Michael Niedermayer committed
605
  --enable-a52bin) a52bin="yes"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
606
  ;;
607 608
  --enable-dts) dts="yes"
    extralibs="$extralibs -ldts"
609
  ;;
610
  --enable-pp) pp="yes"
611
  ;;
612
  --enable-libgsm) libgsm="yes"
613
    extralibs="$extralibs -lgsm"
614
  ;;
615 616
  --enable-mp3lame) mp3lame="yes"
    extralibs="$extralibs -lmp3lame"
617
  ;;
618
  --enable-libogg) libogg="yes"
619 620
    extralibs="$extralibs -logg"
    pkg_requires="$pkg_requires ogg >= 1.1"
Nilesh Bansal's avatar
Nilesh Bansal committed
621
  ;;
622
  --enable-vorbis) vorbis="yes"
623 624
    extralibs="$extralibs -lvorbis -lvorbisenc"
    pkg_requires="$pkg_requires vorbis vorbisenc"
625
  ;;
Nilesh Bansal's avatar
Nilesh Bansal committed
626
  --enable-theora) theora="yes"
627 628
    extralibs="$extralibs -ltheora"
    pkg_requires="$pkg_requires theora"
Nilesh Bansal's avatar
Nilesh Bansal committed
629
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
630
  --enable-faad) faad="yes"
631
    extralibs="$extralibs -lfaad"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
632 633 634
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
635 636
  --enable-faac) faac="yes"
    extralibs="$extralibs -lfaac"
637
  ;;
638
  --enable-xvid) xvid="yes"
639
    extralibs="$extralibs -lxvidcore"
640
  ;;
641 642
  --enable-x264) x264="yes"
    extralibs="$extralibs -lx264"
643
  ;;
644
  --enable-dc1394) dc1394="yes"
645 646
    extralibs="$extralibs -ldc1394_control -lraw1394"
    pkg_requires="$pkg_requires libraw1394"
647
  ;;
648 649
  --disable-vhook) vhook="no"
  ;;
650
  --disable-simple_idct) simpleidct="no"
651
  ;;
652 653
  --enable-mingw32) mingw32="yes"
  ;;
Gildas Bazin's avatar
Gildas Bazin committed
654 655
  --enable-mingwce) mingwce="yes"
  ;;
656 657 658 659
  --enable-static) lstatic="yes"
  ;;
  --disable-static) lstatic="no"
  ;;
660
  --enable-shared) lshared="yes"
Nick Kurshev's avatar
Nick Kurshev committed
661
  ;;
662 663
  --disable-shared) lshared="no"
  ;;
664 665 666 667
  --disable-debug) debug="no"
  ;;
  --disable-opts) optimize="no"
  ;;
668 669
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
670 671
  --disable-protocols) protocols="no"; network="no"; ffserver="no"
  ;;
672 673
  --disable-ffserver) ffserver="no"
  ;;
674 675
  --disable-ffplay) ffplay="no"
  ;;
676
  --enable-small) optimize="small"
677
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
678
  --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
679
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
680
  --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
681
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
682
  --enable-amr_wb) amr="yes"; amr_wb="yes"
683
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
684
  --enable-amr_if2) amr="yes"; amr_if2="yes"
685
  ;;
686 687
  --enable-sunmlib) sunmlib="yes"
  ;;
688 689
  --enable-pthreads) pthreads="yes"
  ;;
690 691
  --enable-gpl) gpl="yes"
  ;;
692 693
  --enable-memalign-hack) memalignhack="yes"
  ;;
694 695
  --disable-strip) dostrip="no"
  ;;
696
  --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
697
  ;;
698 699 700 701 702
  --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##\"`"
703 704 705
  ;;
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  ;;
706 707
  --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  ;;
708
  --disable-muxers) muxers="no"; ffserver="no"
709 710 711
  ;;
  --disable-demuxers) demuxers="no"
  ;;
712 713
  --help) show_help
  ;;
714 715 716 717 718
  *)
  echo "Unknown option \"$opt\"."
  echo "See $0 --help for available options."
  exit 1
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
719 720 721
  esac
done

722 723 724 725

# Combine FFLDFLAGS and the LDFLAGS environment variable
LDFLAGS="$FFLDFLAGS $LDFLAGS"

726 727 728 729 730
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"

731 732 733 734 735 736 737 738 739 740 741
# we need to build at least one lib type
if test "$lstatic" = "no" && test "$lshared" = "no" ; then
    cat <<EOF
At least one library type must be built.
Specify --enable-static to build the static libraries or --enable-shared to
build the shared libraries as well. To only build the shared libraries specify
--disable-static in addition to --enable-shared.
EOF
    exit 1;
fi

Nilesh Bansal's avatar
Nilesh Bansal committed
742
if test "$theora" = "yes" ; then
743
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
744
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
745 746 747 748 749 750
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
751
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
752
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
753 754 755 756 757
        fail="yes"
        vorbis="no"
    fi
fi

758
if test "$gpl" != "yes"; then
759
    if test "$pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
760
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
761 762 763 764
        fail="yes"
    fi

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

769
    if test "$xvid" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
770
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
771 772 773
        fail="yes"
    fi

774
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
775
        echo "x264 is under GPL and --enable-gpl is not specified."
776 777 778
        fail="yes"
    fi

779
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
780
        echo "libdts is under GPL and --enable-gpl is not specified."
781 782
        fail="yes"
    fi
783

784
    if test "$faad" != "no" -o "$faadbin" != "no"; then
785 786
        if check_header faad.h; then
            check_cc << EOF
787 788 789 790 791 792
                #include <faad.h>
                #ifndef FAAD2_VERSION
                ok faad1
                #endif
                int main( void ) { return 0; }
EOF
793
            if test $? = 0 ; then
Diego Biurrun's avatar
Diego Biurrun committed
794
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
795 796 797 798 799
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
800
            echo "FAAD test failed."
801 802
        fi
    fi
803

804

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
805
    if test "$fail" = "yes"; then
806 807 808 809
        exit 1
    fi
fi

Diego Biurrun's avatar
Diego Biurrun committed
810
# compute MMX state
811
if test $mmx = "default"; then
812
    if test $cpu = "x86" -o $cpu = "x86_64"; then
813 814 815 816 817 818
        mmx="yes"
    else
        mmx="no"
    fi
fi

Gildas Bazin's avatar