configure 56.7 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[=FILE|yes|no]      log tests and output to FILE [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
  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]"
51
  echo "  --cross-compile          assume a cross-compiler is used"
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 99
  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
}
100

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

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

111
echolog(){
Måns Rullgård's avatar
Måns Rullgård committed
112
    log "$@"
113
    echo "$@"
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
}

die(){
    echolog "$@"
    cat <<EOF
If you think configure made a mistake, make sure you are using the latest
version from SVN.  If the latest version fails, report the problem to the
ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
EOF
    if enabled log; then
        cat <<EOF
Include the log file "$logfile" produced by configure as this will help
solving the problem.
EOF
    else
cat <<EOF
Rerun configure with logging enabled (do not use --log=no), and include the
log this produces with your report.
EOF
    fi
134 135 136 137 138 139 140 141 142 143 144 145
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
    exit 1
}

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

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

146
save_flags(){
147
    flags_saved && return
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 176
    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 $*"
}

177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
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 "$@"
}

196
check_cc(){
197 198
    log check_cc "$@"
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
199
    logfile $TMPC
200 201 202 203 204 205
    log $cc $CFLAGS "$@" -c -o $TMPO $TMPC
    $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
}

check_cpp(){
    log check_cpp "$@"
206
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
207
    logfile $TMPC
208 209
    log $cc $CFLAGS "$@" -E -o $TMPO $TMPC
    $cc $CFLAGS "$@" -E -o $TMPO $TMPC >>$logfile 2>&1
210 211 212
}

check_ld(){
213
    log check_ld "$@"
214
    cat >$TMPC
Måns Rullgård's avatar
Måns Rullgård committed
215
    logfile $TMPC
216
    log $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs
Måns Rullgård's avatar
Måns Rullgård committed
217
    $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >>$logfile 2>&1
218 219 220
}

check_cflags(){
221 222
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
223 224 225 226 227
int x;
EOF
}

check_ldflags(){
228 229 230 231 232
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
233 234 235 236
EOF
}

check_header(){
237
    log check_header "$@"
238 239
    header=$1
    shift
240
    check_cpp "$@" <<EOF
241 242 243 244 245 246
#include <$header>
int x;
EOF
}

check_func(){
247
    log check_func "$@"
248 249 250 251 252 253 254 255 256 257
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
}

258 259 260 261 262 263 264 265 266 267 268 269
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
}

270
check_exec(){
271
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE 2>&1 >>$logfile; }
272 273 274 275 276 277 278 279
}

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

282 283
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
284 285
fi

286
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
287
if test ! -z "$TMPDIR" ; then
288
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
289
elif test ! -z "$TEMPDIR" ; then
290
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
291
else
292
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
293 294
fi

295 296
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
297
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
298 299 300
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

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

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

607
;;
608 609
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
610

Diego Biurrun's avatar
Diego Biurrun committed
611
# From MPlayer configure. We need TARGET_OS available
612
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
613
# of AltiVec on PowerPC.
614 615
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
616
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
    ;;
  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

632
# find source path
633
source_path="`dirname $0`"
634 635 636 637
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
638 639
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
640 641
fi

642 643 644 645 646
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

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

821 822
if test "$log" != no; then
    test "$log" = yes || logfile="$log"
823 824
    echo "# $0 $@" >$logfile
    set >>$logfile
825 826
else
    logfile=/dev/null
827
fi
828 829 830 831

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

832
test -n "$cross_prefix" && cross_compile=yes