configure 58.8 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
# make sure we are running under a compatible shell
Måns Rullgård's avatar
Måns Rullgård committed
7 8
unset foo
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
9 10 11 12 13 14 15 16 17 18 19 20
if test "$?" != 0; then
    if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
        FFMPEG_CONFIGURE_EXEC=1
        export FFMPEG_CONFIGURE_EXEC
        exec bash "$0" "$@"
        exec ksh "$0" "$@"
        exec /usr/xpg4/bin/sh "$0" "$@"
    fi
    echo "No compatible shell script interpreter found."
    exit 1
fi

21 22 23 24 25 26
show_help(){
  echo "Usage: configure [options]"
  echo "Options: [defaults in brackets after descriptions]"
  echo
  echo "Standard options:"
  echo "  --help                   print this message"
27
  echo "  --log[=FILE|yes|no]      log tests and output to FILE [config.err]"
28
  echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
29
  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
30
  echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
31 32 33
  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]"
34
  echo "  --enable-libnut          enable NUT support via libnut [default=no]"
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
  echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
  echo "  --enable-vorbis          enable Vorbis support via libvorbis [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]"
Luca Abeni's avatar
Luca Abeni committed
61
  echo "  --enable-swscaler        software scaler support [default=no]"
62
  echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
63 64 65 66 67 68
  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]"
69
  echo "  --cross-compile          assume a cross-compiler is used"
70 71 72 73 74 75
  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 []"
76
  echo "  --arch=ARCH              select architecture  [$arch]"
77 78
  echo "  --cpu=CPU                selects the minimum cpu required (affects
                                   instruction selection, may crash on older CPUs)"
79 80 81
  echo "  --powerpc-perf-enable    enable performance report on PPC"
  echo "                           (requires enabling PMC)"
  echo "  --disable-mmx            disable MMX usage"
82
  echo "  --disable-armv5te        disable armv5te usage"
83 84 85 86 87 88 89 90 91
  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]"
92
  echo "  --disable-ipv6           disable ipv6 support [default=no]"
93 94 95 96 97
  echo "  --disable-zlib           disable zlib [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"
98
  echo "  --enable-extra-warnings  enable more compiler warnings"
99 100 101
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
  echo "                           MPEG audio decoding [default=no]"
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
102
  echo "  --disable-ffmpeg         disable ffmpeg build"
103 104 105 106 107 108 109 110 111 112 113
  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"
114 115
  echo "  --disable-muxer=NAME     disables muxer NAME"
  echo "  --enable-muxer=NAME      enables muxer NAME"
116
  echo "  --disable-muxers         disables all muxers"
117 118
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
119
  echo "  --disable-demuxers       disables all demuxers"
120 121 122
  echo "  --enable-parser=NAME     enables parser NAME"
  echo "  --disable-parser=NAME    disables parser NAME"
  echo "  --disable-parsers        disables all parsers"
123 124 125 126
  echo ""
  echo "NOTE: Object files are built at the place where configure is launched."
  exit 1
}
127

128 129 130 131
log(){
    echo "$@" >>$logfile
}

132
log_file(){
Måns Rullgård's avatar
Måns Rullgård committed
133 134 135 136 137
    log BEGIN $1
    cat -n $1 >>$logfile
    log END $1
}

138
echolog(){
Måns Rullgård's avatar
Måns Rullgård committed
139
    log "$@"
140
    echo "$@"
141 142 143 144 145 146 147 148 149
}

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
150
    if enabled logging; then
151 152 153 154 155 156 157 158 159 160
        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
161 162 163 164
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
    exit 1
}

165 166 167 168
toupper(){
    echo "$@" | tr '[a-z]' '[A-Z]'
}

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
set_all(){
    value=$1
    shift
    for var in $*; do
        eval $var=$value
    done
}

enable(){
    set_all yes $*
}

disable(){
    set_all no $*
}

185
enabled(){
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
    eval test "x\$$1" = "xyes"
}

enabled_all(){
    for opt; do
        enabled $opt || return 1
    done
}

enabled_any(){
    for opt; do
        enabled $opt && return 0
    done
}

print_config(){
    pfx=$1
    header=$2
    makefile=$3
    shift 3
    for cfg; do
        if enabled $cfg; then
            ucname="${pfx}`toupper $cfg`"
            echo "#define ${ucname} 1" >> $header
            echo "${ucname}=yes" >> $makefile
        fi
    done
213 214 215 216 217 218
}

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

219
save_flags(){
220
    flags_saved && return
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
    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 $*"
}

250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
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 "$@"
}

269
check_cmd(){
Måns Rullgård's avatar
Måns Rullgård committed
270
    log "$@"
271
    "$@" >>$logfile 2>&1
272 273
}

274
check_cc(){
275 276
    log check_cc "$@"
    cat >$TMPC
277
    log_file $TMPC
278
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
279 280 281 282
}

check_cpp(){
    log check_cpp "$@"
283
    cat >$TMPC
284
    log_file $TMPC
285
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
286 287 288
}

check_ld(){
289
    log check_ld "$@"
290
    check_cc || return
291
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
292 293 294
}

check_cflags(){
295 296
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
297 298 299 300 301
int x;
EOF
}

check_ldflags(){
302 303 304 305 306
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
307 308 309 310
EOF
}

check_header(){
311
    log check_header "$@"
312 313
    header=$1
    shift
314
    check_cpp "$@" <<EOF
315 316 317 318 319 320
#include <$header>
int x;
EOF
}

check_func(){
321
    log check_func "$@"
322 323 324 325 326 327 328 329 330 331
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
}

332 333 334 335 336 337 338 339 340 341 342 343
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
}

344
check_exec(){
345
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
346 347 348 349 350 351 352 353
}

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

356
CONFIG_LIST='encoders decoders parsers muxers demuxers a52 a52bin amr amr_nb amr_nb_fixed amr_wb audio_beos audio_oss avisynth beos_netserver bktr dc1394 dts dv1394 faac faad faadbin ffmpeg ffplay ffserver gpl ipv6 libgsm libnut libogg libvorbis memalign_hack mp3lame mpegaudio_hp network pp protocols swscaler vhook video4linux video4linux2 x264 xvid zlib'
357 358 359

HAVE_LIST='altivec_h byteswap_h dcbzl dlfcn dlopen freetype2 gprof imlib2 localtime_r lrintf malloc_h memalign mlib sdl sdl_video_size'

360
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
361
if test ! -z "$TMPDIR" ; then
362
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
363
elif test ! -z "$TEMPDIR" ; then
364
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
365
else
366
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
367 368
fi

369 370
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
371
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
372 373 374
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
375
# default parameters
376
logging="yes"
377
logfile="config.err"
378 379
PREFIX="/usr/local"
libdir='${PREFIX}/lib'
380
shlibdir="$libdir"
381 382 383
incdir='${PREFIX}/include/ffmpeg'
mandir='${PREFIX}/man'
bindir='${PREFIX}/bin'
384
cross_prefix=""
385
cross_compile="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
386 387
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
388
ranlib="ranlib"
389
make="make"
390
strip="strip"
391
arch=`uname -m`
392
cpu="generic"
393
powerpc_perf="no"
394
mmx="default"
395
cmov="no"
396
cmov_is_fast="no"
397
armv5te="default"
398
iwmmxt="default"
399
altivec="default"
400
dcbzl="no"
401
mmi="default"
402
case "$arch" in
403
  i386|i486|i586|i686|i86pc|BePC)
404
    arch="x86_32"
Fabrice Bellard's avatar
Fabrice Bellard committed
405
  ;;
406
  x86_64|amd64)
Diego Biurrun's avatar
typo  
Diego Biurrun committed
407
    arch="x86_32"
408
    canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
409 410
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
411
        arch="x86_64"
412
      fi
413 414
    fi
  ;;
415 416
  # armv4l is a subset of armv[567]*l
  arm|armv[4567]*l)
417
    arch="armv4l"
418
  ;;
419
  alpha)
420
    arch="alpha"
421
  ;;
422
  "Power Macintosh"|ppc|ppc64|powerpc)
423
    arch="powerpc"
424
  ;;
425
  mips|mipsel|IP*)
426
    arch="mips"
427
  ;;
428
  sun4u|sparc64)
429
    arch="sparc64"
430
  ;;
431
  sparc)
432
    arch="sparc"
433
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
434
  sh4)
435
    arch="sh4"
Alex Beregszaszi's avatar
Alex Beregszaszi committed
436
  ;;
437
  parisc|parisc64)
438
    arch="parisc"
439 440
  ;;
  s390|s390x)
441
    arch="s390"
442 443
  ;;
  m68k)
444
    arch="m68k"
445 446
  ;;
  ia64)
447
    arch="ia64"
448
  ;;
Michael Benjamin's avatar
Michael Benjamin committed
449
  bfin)
450
    arch="bfin"
Michael Benjamin's avatar
Michael Benjamin committed
451
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
452
  *)
453
    arch="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
454 455 456
  ;;
esac
gprof="no"
457 458
video4linux="yes"
video4linux2="yes"
459
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
460
audio_oss="yes"
461
audio_beos="no"
462
dv1394="yes"
463
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
464
network="yes"
465
ipv6="yes"
466
zlib="yes"
467
libgsm="no"
468
mp3lame="no"
469
libnut="no"
470
libogg="no"
471
libvorbis="no"
472 473
faad="no"
faadbin="no"
474
faac="no"
475
xvid="no"
476
x264="no"
477
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
478
a52bin="no"
479
dts="no"
480
pp="no"
481
mingw32="no"
Gildas Bazin's avatar
Gildas Bazin committed
482
mingwce="no"
483
os2="no"
484
lstatic="yes"
485
lshared="no"
486 487
optimize="yes"
debug="yes"
488
extrawarnings="no"
489
dostrip="yes"
490
installstrip="-s"
491
extralibs="-lm"
492
bigendian="no"
493
inttypes="yes"
494
emu_fast_int="no"
495
vhook="default"
496
avisynth="no"
497 498
dlfcn="no"
dlopen="no"
499
mpegaudio_hp="yes"
500
SHFLAGS='-shared -Wl,-soname,$@'
501
VHOOKSHFLAGS='$(SHFLAGS)'
502
beos_netserver="no"
503
need_inet_aton="no"
504
protocols="yes"
505
ffmpeg="yes"
506
ffserver="yes"
507
ffplay="yes"
508
LIBOBJFLAGS=""
509
FFLDFLAGS=-Wl,--warn-common
510
LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
511
FFSERVERLDFLAGS=-Wl,-E
512
LDCONFIG="ldconfig"
513 514
LIBPREF="lib"
LIBSUF=".a"
515
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
516 517
SLIBPREF="lib"
SLIBSUF=".so"
518
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
519 520
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
Fabrice Bellard's avatar
Fabrice Bellard committed
521
EXESUF=""
522
BUILDSUF=""
523
amr_nb="no"
524
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
525
amr_nb_fixed="no"
526
amr_if2="no"
527
mlib="no"
528
pthreads="no"
Luca Abeni's avatar
Luca Abeni committed
529
swscaler="no"
530
gpl="no"
531
memalign_hack="no"
532
asmalign_pot="unknown"
533
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
534 535 536 537 538

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
539
PREFIX="/boot/home/config"
540
# helps building libavcodec
541
add_cflags "-DPIC -fomit-frame-pointer"
542
# 3 gcc releases known for BeOS, each with ugly bugs
543
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
544 545 546 547 548
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
mmx="no"
;;
*20010315*) echo "BeBits gcc"
549
add_cflags "-fno-expensive-optimizations"
550 551
;;
esac
552
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
553
# disable Linux things
554
audio_oss="no"
555 556
video4linux="no"
video4linux2="no"
557
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
558
# enable BeOS things
559
audio_beos="yes"
560 561 562 563 564
# 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
565
beos_netserver="yes"
566
need_inet_aton="yes"
567
extralibs="-lnet"
568
fi ;;
569
SunOS)
570 571
video4linux="no"
video4linux2="no"
572
audio_oss="no"
573
dv1394="no"
574
make="gmake"
575
FFLDFLAGS=""
576
FFSERVERLDFLAGS=""
577
SHFLAGS="-shared -Wl,-h,\$@"
578
need_inet_aton="yes"
579
add_extralibs "-lsocket -lnsl"
580
;;
581
NetBSD)
582 583
video4linux="no"
video4linux2="no"
584
bktr="yes"
585 586 587
audio_oss="yes"
dv1394="no"
make="gmake"
588
add_extralibs "-lossaudio"
589
;;
590
OpenBSD)
591 592
video4linux="no"
video4linux2="no"
593
bktr="yes"
594 595 596
audio_oss="yes"
dv1394="no"
make="gmake"
597
LIBOBJFLAGS="\$(PIC)"
598
LDCONFIG="ldconfig -m \$(shlibdir)"
599
add_extralibs "-lossaudio"
600
;;
601
FreeBSD)
602 603
video4linux="no"
video4linux2="no"
604
bktr="yes"
605
audio_oss="yes"
606
dv1394="no"
607
make="gmake"
608
add_cflags "-pthread"
609
;;
610
GNU/kFreeBSD)
611 612
video4linux="no"
video4linux2="no"
613 614 615
bktr="yes"
audio_oss="yes"
dv1394="no"
616
add_cflags "-pthread"
617
;;
618
BSD/OS)
619 620
video4linux="no"
video4linux2="no"
621
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
622
audio_oss="yes"
623
dv1394="no"
624 625
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
626 627
strip="strip -d"
installstrip=""
628
;;
629
Darwin)
630
cc="cc"
631 632
video4linux="no"
video4linux2="no"
633
audio_oss="no"
634
dv1394="no"
635
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
636
VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
637
extralibs=""
638
strip="strip -x"
639
installstrip=""
640
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
641
SLIBSUF=".dylib"
642 643
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
644
FFSERVERLDFLAGS=-Wl,-bind_at_load
645
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
646
;;
647
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
648
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
649
# can be forced on the command line for Linux cross compilation.
650 651
mingw32="yes"
;;
652
CYGWIN*)
653
targetos=CYGWIN
654
shlibdir='${PREFIX}/bin'
655 656
video4linux="no"
video4linux2="no"
657
audio_oss="yes"
658
dv1394="no"
659
VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
660
VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
661
extralibs=""
662
EXESUF=".exe"
663 664 665 666 667
SLIBPREF="cyg"
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
668
;;
669
Linux)
670
LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
671
;;
672
IRIX*)
673
targetos=IRIX
674
ranlib="echo ignoring ranlib"
675 676
video4linux="no"
video4linux2="no"
677 678 679
audio_oss="no"
make="gmake"
;;
680 681
OS/2)
TMPE=$TMPE".exe"
682
ar="emxomfar -p128"
683 684
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
685
add_cflags "-Zomf"
686
FFLDFLAGS="-Zomf -Zstack 16384 -s"
687
SHFLAGS="-Zdll -Zomf"
688
FFSERVERLDFLAGS=""
689 690 691 692
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
693
EXESUF=".exe"
694
extralibs=""
695
pkg_requires=""
696 697
video4linux="no"
video4linux2="no"
698
audio_oss="no"
699
dv1394="no"
700
ffserver="no"
701
vhook="no"
702
os2="yes"
703

704
;;
705 706 707
*)
targetos="${targetos}-UNKNOWN"
;;
708
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
709

710
# find source path
711
source_path="`dirname \"$0\"`"
712 713
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
714
    source_path="`pwd`"
715
    source_path_used="no"
716 717
else
    source_path="`cd \"$source_path\"; pwd`"
718 719
    echo "$source_path" | grep -q '[[:blank:]]' &&
      die "Out of tree builds are impossible with whitespace in source path."
Fabrice Bellard's avatar
Fabrice Bellard committed
720 721
fi

722 723 724 725
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
fi

726 727 728 729 730
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

731 732 733 734 735
ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
736

737 738
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST

Fabrice Bellard's avatar
Fabrice Bellard committed
739
for opt do
Måns Rullgård's avatar
Måns Rullgård committed
740
  optval="${opt#*=}"
Fabrice Bellard's avatar
Fabrice Bellard committed
741
  case "$opt" in
742 743
  --log)
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
744
  --log=*) logging="$optval"
745
  ;;
746
  --prefix=*) PREFIX="$optval"; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
747
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
748
  --libdir=*) libdir="$optval"; force_libdir=yes
749
  ;;
750 751
  --shlibdir=*) shlibdir="$optval"
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
752
  --incdir=*) incdir="$optval"
Diego Biurrun's avatar
Diego Biurrun committed
753
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
754
  --mandir=*) mandir="$optval"
755
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
756
  --source-path=*) source_path="$optval"
757
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
758
  --cross-prefix=*) cross_prefix="$optval"
759
  ;;
760 761
  --cross-compile) cross_compile=yes
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
762
  --cc=*) cc="$optval"
Fabrice Bellard's avatar
Fabrice Bellard committed
763
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
764
  --make=*) make="$optval"
765
  ;;
766
  --extra-cflags=*) add_cflags "$optval"
767
  ;;
768
  --extra-ldflags=*) add_ldflags "$optval"
769
  ;;
770
  --extra-libs=*) add_extralibs "$optval"
771
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
772
  --build-suffix=*) BUILDSUF="$optval"
773
  ;;
774
  --arch=*) arch="$optval"
Fabrice Bellard's avatar
Fabrice Bellard committed
775
  ;;
776
  --cpu=*) cpu="$optval"
777
  ;;
Romain Dolbeau's avatar