configure 55.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
show_help(){
  echo "Usage: configure [options]"
  echo "Options: [defaults in brackets after descriptions]"
  echo
  echo "Standard options:"
  echo "  --help                   print this message"
12
  echo "  --log                    log tests and output to config.err"
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 98
  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
}
99

100 101 102 103
log(){
    echo "$@" >>$logfile
}

Måns Rullgård's avatar
Måns Rullgård committed
104 105 106 107 108 109
logfile(){
    log BEGIN $1
    cat -n $1 >>$logfile
    log END $1
}

110
die(){
Måns Rullgård's avatar
Måns Rullgård committed
111
    log "$@"
112 113 114 115 116 117 118 119 120 121 122 123 124
    echo "$@"
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
    exit 1
}

enabled(){
    eval test "\$$1" = "yes"
}

flags_saved(){
    (: ${SAVE_CFLAGS?}) 2>/dev/null
}

125
save_flags(){
126
    flags_saved && return
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    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 $*"
}

156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
append(){
    var=$1
    shift
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
    eval "$var=\"\$$var $*\""
}

add_cflags(){
    append CFLAGS "$@"
}

add_ldflags(){
    append LDFLAGS "$@"
}

add_extralibs(){
    append extralibs "$@"
}

175
check_cc(){
176 177
    log check_cc "$@"
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
178
    logfile $TMPC
179 180 181 182 183 184
    log $cc $CFLAGS "$@" -c -o $TMPO $TMPC
    $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
}

check_cpp(){
    log check_cpp "$@"
185
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
186
    logfile $TMPC
187 188
    log $cc $CFLAGS "$@" -E -o $TMPO $TMPC
    $cc $CFLAGS "$@" -E -o $TMPO $TMPC >>$logfile 2>&1
189 190 191
}

check_ld(){
192
    log check_ld "$@"
193
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
194
    logfile $TMPC
195
    log $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs
Måns Rullgård's avatar
Måns Rullgård committed
196
    $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >>$logfile 2>&1
197 198 199
}

check_cflags(){
200 201
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
202 203 204 205 206
int x;
EOF
}

check_ldflags(){
207 208 209 210 211
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
212 213 214 215
EOF
}

check_header(){
216
    log check_header "$@"
217 218
    header=$1
    shift
219
    check_cpp "$@" <<EOF
220 221 222 223 224 225
#include <$header>
int x;
EOF
}

check_func(){
226
    log check_func "$@"
227 228 229 230 231 232 233 234 235 236
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
}

237 238 239 240 241 242 243 244 245 246 247 248
check_lib(){
    log check_lib "$@"
    header="$1"
    func="$2"
    shift 2
    temp_extralibs "$@"
    check_header $header && check_func $func && add_extralibs "$@"
    err=$?
    restore_flags
    return $err
}

249
check_exec(){
250 251 252 253 254 255 256 257 258
    check_ld "$@" && { test -n "$cross_prefix" || $TMPE; }
}

require(){
    name="$1"
    header="$2"
    func="$3"
    shift 3
    check_lib $header $func "$@" || die "ERROR: $name not found"
259 260
}

261 262
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
263 264
fi

265
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
266
if test ! -z "$TMPDIR" ; then
267
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
268
elif test ! -z "$TEMPDIR" ; then
269
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
270
else
271
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
272 273
fi

274 275
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
276
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
277 278 279
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
280
# default parameters
281 282
log="no"
logfile="/dev/null"
Fabrice Bellard's avatar
Fabrice Bellard committed
283
prefix="/usr/local"
284
libdir=""
Diego Biurrun's avatar
Diego Biurrun committed
285
incdir=""
286
mandir=""
Fabrice Bellard's avatar
Fabrice Bellard committed
287
bindir=""
288
cross_prefix=""
Fabrice Bellard's avatar
Fabrice Bellard committed
289 290
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
291
ranlib="ranlib"
292
make="make"
293
strip="strip"
Fabrice Bellard's avatar
Fabrice Bellard committed
294
cpu=`uname -m`
295
tune="generic"
296
powerpc_perf="no"
297
mmx="default"
298
iwmmxt="default"
299
altivec="default"
300
mmi="default"
Fabrice Bellard's avatar
Fabrice Bellard committed
301
case "$cpu" in
302
  i386|i486|i586|i686|i86pc|BePC)
Fabrice Bellard's avatar
Fabrice Bellard committed
303 304
    cpu="x86"
  ;;
305 306 307 308 309 310 311
  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
312 313
    fi
  ;;
314 315
  # armv4l is a subset of armv5tel
  armv4l|armv5tel)
316 317
    cpu="armv4l"
  ;;
318 319 320
  alpha)
    cpu="alpha"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
321
  "Power Macintosh"|ppc|powerpc)
322 323
    cpu="powerpc"
  ;;
324
  mips|mipsel)
325 326
    cpu="mips"
  ;;
327
  sun4u|sparc64)
328 329
    cpu="sparc64"
  ;;
330 331 332
  sparc)
    cpu="sparc"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
333 334 335
  sh4)
    cpu="sh4"
  ;;
336 337 338 339 340 341 342 343 344 345 346 347
  parisc|parisc64)
    cpu="parisc"
  ;;
  s390|s390x)
    cpu="s390"
  ;;
  m68k)
    cpu="m68k"
  ;;
  ia64)
    cpu="ia64"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
348
  *)
349
    cpu="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
350 351 352
  ;;
esac
gprof="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
353
v4l="yes"
Luca Abeni's avatar
Luca Abeni committed
354
v4l2="yes"
355
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
356
audio_oss="yes"
357
audio_beos="no"
358
dv1394="yes"
359
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
360
network="yes"
361
zlib="yes"
362
lzo="yes"
363
libgsm="no"
364
mp3lame="no"
365
libogg="no"
366
vorbis="no"
Nilesh Bansal's avatar
Nilesh Bansal committed
367
theora="no"
368 369
faad="no"
faadbin="no"
370
faac="no"
371
xvid="no"
372
x264="no"
373
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
374
a52bin="no"
375
dts="no"
376
pp="no"
377
mingw32="no"
Gildas Bazin's avatar
Gildas Bazin committed
378
mingwce="no"
379
cygwin="no"
380
os2="no"
381
lstatic="yes"
382
lshared="no"
383 384
optimize="yes"
debug="yes"
385
dostrip="yes"
386
installstrip="-s"
387
extralibs="-lm"
388
simpleidct="yes"
389
bigendian="no"
390
inttypes="yes"
391
emu_fast_int="no"
392
vhook="default"
393 394
dlfcn="no"
dlopen="no"
395
mpegaudio_hp="yes"
396
SHFLAGS='-shared -Wl,-soname,$@'
397
netserver="no"
398
need_inet_aton="no"
399
protocols="yes"
400
ffserver="yes"
401
ffplay="yes"
402
LIBOBJFLAGS=""
403
FFLDFLAGS=-Wl,--warn-common
404
FFSLDFLAGS=-Wl,-E
405
LDCONFIG="ldconfig"
406 407
LIBPREF="lib"
LIBSUF=".a"
408
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
409 410
SLIBPREF="lib"
SLIBSUF=".so"
411
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
412 413
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
Fabrice Bellard's avatar
Fabrice Bellard committed
414
EXESUF=""
415
BUILDSUF=""
416
amr_nb="no"
417
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
418
amr_nb_fixed="no"
419
amr_if2="no"
420
sunmlib="no"
421
pthreads="no"
422
gpl="no"
423
memalignhack="no"
424 425
muxers="yes"
demuxers="yes"
426 427 428 429 430 431 432

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
433
CFLAGS="$CFLAGS -DPIC -fomit-frame-pointer"
434
# 3 gcc releases known for BeOS, each with ugly bugs
435
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
436 437 438 439 440 441 442 443
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
444
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
445
# disable Linux things
446
audio_oss="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
447
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
448
v4l2="no"
449
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
450
# enable BeOS things
451
audio_beos="yes"
452 453 454 455 456
# 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
457
netserver="yes"
458
need_inet_aton="yes"
459
extralibs="-lnet"
460
fi ;;
461 462
SunOS)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
463
v4l2="no"
464
audio_oss="no"
465
dv1394="no"
466
make="gmake"
467
FFLDFLAGS=""
468 469 470 471
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
472 473
NetBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
474
v4l2="no"
475
bktr="yes"
476 477 478
audio_oss="yes"
dv1394="no"
make="gmake"
479
FFLDFLAGS="$FFLDFLAGS -export-dynamic"
480
extralibs="$extralibs -lossaudio"
481
;;
482 483
OpenBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
484
v4l2="no"
485
bktr="yes"
486 487 488
audio_oss="yes"
dv1394="no"
make="gmake"
489
LIBOBJFLAGS="\$(PIC)"
490
FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
491
LDCONFIG="ldconfig -m \$(libdir)"
492 493
extralibs="$extralibs -lossaudio"
;;
494 495
FreeBSD)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
496
v4l2="no"
497
bktr="yes"
498
audio_oss="yes"
499
dv1394="no"
500
make="gmake"
501
CFLAGS="$CFLAGS -pthread"
502
FFLDFLAGS="$FFLDFLAGS -export-dynamic -pthread"
503
;;
504 505 506 507 508 509 510 511 512
GNU/kFreeBSD)
v4l="no"
v4l2="no"
bktr="yes"
audio_oss="yes"
dv1394="no"
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -rdynamic"
;;
513
BSD/OS)
Fabrice Bellard's avatar
Fabrice Bellard committed
514
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
515
v4l2="no"
516
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
517
audio_oss="yes"
518
dv1394="no"
519 520
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
521 522
strip="strip -d"
installstrip=""
523
;;
524
Darwin)
525
cc="cc"
526
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
527
v4l2="no"
528
audio_oss="no"
529
dv1394="no"
530
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
531
extralibs=""
532
darwin="yes"
533
strip="strip -x"
534
installstrip=""
535
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
536
SLIBSUF=".dylib"
537 538
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
539
FFSLDFLAGS=-Wl,-bind_at_load
540
;;
541
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
542
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
543
# can be forced on the command line for Linux cross compilation.
544 545
mingw32="yes"
;;
546 547
CYGWIN*)
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
548
v4l2="no"
549
audio_oss="yes"
550
dv1394="no"
551
vhook="no"
552 553
extralibs=""
cygwin="yes"
554
EXESUF=".exe"
555
;;
556
Linux)
557
FFLDFLAGS="$FFLDFLAGS -rdynamic"
558
;;
559 560 561
IRIX*)
ranlib="echo ignoring ranlib"
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
562
v4l2="no"
563 564 565
audio_oss="no"
make="gmake"
;;
566 567
OS/2)
TMPE=$TMPE".exe"
568
ar="emxomfar -p128"
569 570
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
571
CFLAGS="$CFLAGS -Zomf"
572
FFLDFLAGS="-Zomf -Zstack 16384 -s"
573
SHFLAGS="-Zdll -Zomf"
574 575 576 577 578
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
579
EXESUF=".exe"
580
extralibs=""
581
pkg_requires=""
582
v4l="no"
Luca Abeni's avatar
Luca Abeni committed
583
v4l2="no"
584
audio_oss="no"
585
dv1394="no"
586
ffserver="no"
587
vhook="no"
588
os2="yes"
589

590
;;
591 592
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
593

Diego Biurrun's avatar
Diego Biurrun committed
594
# From MPlayer configure. We need TARGET_OS available
595
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
596
# of AltiVec on PowerPC.
597 598
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
599
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614
    ;;
  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

615
# find source path
616
source_path="`dirname $0`"
617 618 619 620
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
621 622
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
623 624
fi

625 626 627 628 629
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

Fabrice Bellard's avatar
Fabrice Bellard committed
632 633
for opt do
  case "$opt" in
634 635
  --log) log=yes
  ;;
636
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
637
  ;;
638
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
639
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
640 641
  --incdir=*) incdir=`echo $opt | cut -d '=' -f 2`;
  ;;
642 643
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  ;;
644 645 646 647
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
648
  --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
Fabrice Bellard's avatar
Fabrice Bellard committed
649
  ;;
650 651
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
652
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
653
  ;;
654
  --extra-ldflags=*) FFLDFLAGS="$FFLDFLAGS ${opt#--extra-ldflags=}"
655 656 657
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
658 659
  --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
660 661
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
662 663
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  ;;
664 665
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
666 667
  --disable-mmx) mmx="no"
  ;;
668 669
  --disable-iwmmxt) iwmmxt="no"
  ;;
670 671
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
672 673
  --enable-gprof) gprof="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
674 675
  --disable-v4l) v4l="no"
  ;;
Luca Abeni's avatar
Luca Abeni committed
676 677
  --disable-v4l2) v4l2="no"
  ;;
678 679
  --disable-bktr) bktr="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
680 681
  --disable-audio-oss) audio_oss="no"
  ;;
682 683
  --disable-audio-beos) audio_beos="no"
  ;;
684 685
  --disable-dv1394) dv1394="no"
  ;;
686
  --disable-network) network="no"; ffserver="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
687
  ;;
688 689
  --disable-zlib) zlib="no"
  ;;
690 691
  --disable-lzo) lzo="no"
  ;;
692
  --enable-a52) a52="yes"
693
  ;;
Michael Niedermayer's avatar
Michael Niedermayer committed
694
  --enable-a52bin) a52bin="yes"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
695
  ;;
696
  --enable-dts) dts="yes"
697
  ;;
698
  --enable-pp) pp="yes"
699
  ;;
700 701
  --enable-libgsm) libgsm="yes"
  ;;
702
  --enable-mp3lame) mp3lame="yes"
703
  ;;
704
  --enable-libogg) libogg="yes"
705
    pkg_requires="$pkg_requires ogg >= 1.1"
Nilesh Bansal's avatar
Nilesh Bansal committed
706
  ;;
707
  --enable-vorbis) vorbis="yes"
708
    pkg_requires="$pkg_requires vorbis vorbisenc"
709
  ;;
Nilesh Bansal's avatar
Nilesh Bansal committed
710
  --enable-theora) theora="yes"
711
    pkg_requires="$pkg_requires theora"
Nilesh Bansal's avatar
Nilesh Bansal committed
712
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
713 714 715 716
  --enable-faad) faad="yes"
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
717
  --enable-faac) faac="yes"
718
  ;;
719 720
  --enable-xvid) xvid="yes"
  ;;
721
  --enable-x264) x264="yes"
722
  ;;
723
  --enable-dc1394) dc1394="yes"
724
    pkg_requires="$pkg_requires libraw1394"
725
  ;;
726 727
  --disable-vhook) vhook="no"
  ;;
728
  --disable-simple_idct) simpleidct="no"
729
  ;;
730 731
  --enable-mingw32) mingw32="yes"
  ;;
Gildas Bazin's avatar
Gildas Bazin committed
732 733
  --enable-mingwce) mingwce="yes"
  ;;
734 735 736 737
  --enable-static) lstatic="yes"
  ;;
  --disable-static) lstatic="no"
  ;;
738
  --enable-shared) lshared="yes"
Nick Kurshev's avatar
Nick Kurshev committed
739
  ;;
740 741
  --disable-shared) lshared="no"
  ;;
742 743 744 745
  --disable-debug) debug="no"
  ;;
  --disable-opts) optimize="no"
  ;;
746 747
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
748 749
  --disable-protocols) protocols="no"; network="no"; ffserver="no"
  ;;
750 751
  --disable-ffserver) ffserver="no"
  ;;
752 753
  --disable-ffplay) ffplay="no"
  ;;
754
  --enable-small) optimize="small"
755
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
756
  --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
757
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
758
  --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
759
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
760
  --enable-amr_wb) amr="yes"; amr_wb="yes"
761
  ;;
Diego Biurrun's avatar
Diego Biurrun committed
762
  --enable-amr_if2) amr="yes"; amr_if2="yes"
763
  ;;
764 765
  --enable-sunmlib) sunmlib="yes"
  ;;
766 767
  --enable-pthreads) pthreads="yes"
  ;;
768 769
  --enable-gpl) gpl="yes"
  ;;
770 771
  --enable-memalign-hack) memalignhack="yes"
  ;;
772 773
  --disable-strip) dostrip="no"
  ;;
774
  --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
775
  ;;
776 777 778 779 780
  --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##\"`"
781 782 783
  ;;
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  ;;
784 785
  --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  ;;
786
  --disable-muxers) muxers="no"; ffserver="no"
787 788 789
  ;;
  --disable-demuxers) demuxers="no"
  ;;
790 791
  --help) show_help
  ;;
792 793 794 795 796
  *)
  echo "Unknown option \"$opt\"."
  echo "See $0 --help for available options."
  exit 1
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
797 798 799
  esac
done

800 801 802 803 804
if enabled log; then
    logfile=config.err
    echo "# $0 $@" >$logfile
    set >>$logfile
fi
805 806 807 808

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

809 810 811 812 813
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"

814 815 816 817 818 819 820 821 822 823 824
# 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
825
if test "$theora" = "yes" ; then
826
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
827
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
828 829 830 831 832 833
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
834
    if test "$libogg" = "no"; then