configure 55 KB
Newer Older
Fabrice Bellard's avatar
Fabrice Bellard committed
1
#!/bin/sh
2
#
3 4 5 6 7
# FFmpeg configure script
#
# Copyright (c) 2000, 2001, 2002 Fabrice Bellard
# Copyright (c) 2005-2006 Diego Biurrun
# Copyright (c) 2005-2006 Mans Rullgard
8
#
9

10
# make sure we are running under a compatible shell
11 12 13 14 15 16
# try to make this part work with most shells

try_exec(){
    type "$1" >/dev/null 2>&1 && exec "$@"
}

Måns Rullgård's avatar
Måns Rullgård committed
17 18
unset foo
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
19
if test "$?" != 0; then
20 21 22 23 24 25 26 27 28 29 30 31
    export FF_CONF_EXEC
    if test "0$FF_CONF_EXEC" -lt 1; then
        FF_CONF_EXEC=1
        try_exec bash "$0" "$@"
    fi
    if test "0$FF_CONF_EXEC" -lt 2; then
        FF_CONF_EXEC=2
        try_exec ksh "$0" "$@"
    fi
    if test "0$FF_CONF_EXEC" -lt 3; then
        FF_CONF_EXEC=3
        try_exec /usr/xpg4/bin/sh "$0" "$@"
32 33
    fi
    echo "No compatible shell script interpreter found."
34 35 36 37 38 39
    echo "This configure script requires a POSIX compatible shell"
    echo "such as bash or ksh."
    if test "$BASH_VERSION" = '2.04.0(1)-release'; then
        echo "This bash version ($BASH_VERSION) is broken on your platform."
        echo "Upgrade to a later version if available."
    fi
40 41 42
    exit 1
fi

43 44 45 46 47 48
show_help(){
  echo "Usage: configure [options]"
  echo "Options: [defaults in brackets after descriptions]"
  echo
  echo "Standard options:"
  echo "  --help                   print this message"
49
  echo "  --log[=FILE|yes|no]      log tests and output to FILE [config.err]"
50
  echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
51
  echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
52
  echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
53 54 55
  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]"
56
  echo "  --enable-libnut          enable NUT support via libnut [default=no]"
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
  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
83
  echo "  --enable-swscaler        software scaler support [default=no]"
84
  echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
85 86 87 88 89 90
  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]"
91
  echo "  --cross-compile          assume a cross-compiler is used"
92 93 94 95 96 97
  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 []"
98
  echo "  --arch=ARCH              select architecture  [$arch]"
99 100
  echo "  --cpu=CPU                selects the minimum cpu required (affects
                                   instruction selection, may crash on older CPUs)"
101 102 103
  echo "  --powerpc-perf-enable    enable performance report on PPC"
  echo "                           (requires enabling PMC)"
  echo "  --disable-mmx            disable MMX usage"
104
  echo "  --disable-armv5te        disable armv5te usage"
105 106 107 108 109 110 111 112 113
  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]"
114
  echo "  --disable-ipv6           disable ipv6 support [default=no]"
115 116 117 118 119
  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"
120
  echo "  --enable-extra-warnings  enable more compiler warnings"
121 122 123
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
  echo "                           MPEG audio decoding [default=no]"
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
124
  echo "  --disable-ffmpeg         disable ffmpeg build"
125 126 127 128 129 130 131 132 133 134 135
  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"
136 137
  echo "  --disable-muxer=NAME     disables muxer NAME"
  echo "  --enable-muxer=NAME      enables muxer NAME"
138
  echo "  --disable-muxers         disables all muxers"
139 140
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
141
  echo "  --disable-demuxers       disables all demuxers"
142 143 144
  echo "  --enable-parser=NAME     enables parser NAME"
  echo "  --disable-parser=NAME    disables parser NAME"
  echo "  --disable-parsers        disables all parsers"
145 146 147 148
  echo ""
  echo "NOTE: Object files are built at the place where configure is launched."
  exit 1
}
149

150 151 152 153
log(){
    echo "$@" >>$logfile
}

154
log_file(){
Måns Rullgård's avatar
Måns Rullgård committed
155 156 157 158 159
    log BEGIN $1
    cat -n $1 >>$logfile
    log END $1
}

160
echolog(){
Måns Rullgård's avatar
Måns Rullgård committed
161
    log "$@"
162
    echo "$@"
163 164 165 166 167 168 169 170 171
}

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
172
    if enabled logging; then
173 174 175 176 177 178 179 180 181 182
        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
183 184 185 186
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
    exit 1
}

187
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
188 189 190 191
toupper(){
    echo "$@" | tr '[a-z]' '[A-Z]'
}

192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
set_all(){
    value=$1
    shift
    for var in $*; do
        eval $var=$value
    done
}

enable(){
    set_all yes $*
}

disable(){
    set_all no $*
}

208
enabled(){
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
    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
236 237 238 239 240 241
}

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

242
save_flags(){
243
    flags_saved && return
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
    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 $*"
}

273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
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 "$@"
}

292
check_cmd(){
Måns Rullgård's avatar
Måns Rullgård committed
293
    log "$@"
294
    "$@" >>$logfile 2>&1
295 296
}

297
check_cc(){
298 299
    log check_cc "$@"
    cat >$TMPC
300
    log_file $TMPC
301
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
302 303 304 305
}

check_cpp(){
    log check_cpp "$@"
306
    cat >$TMPC
307
    log_file $TMPC
308
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
309 310 311
}

check_ld(){
312
    log check_ld "$@"
313
    check_cc || return
314
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
315 316 317
}

check_cflags(){
318 319
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
320 321 322 323 324
int x;
EOF
}

check_ldflags(){
325 326 327 328 329
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
330 331 332 333
EOF
}

check_header(){
334
    log check_header "$@"
335 336
    header=$1
    shift
337
    check_cpp "$@" <<EOF
338 339 340
#include <$header>
int x;
EOF
341 342 343 344
    err=$?
    var=`echo $header | sed 's/[^[:alnum:]]/_/g'`
    test "$err" = 0 && enable $var || disable $var
    return $err
345 346 347
}

check_func(){
348
    log check_func "$@"
349 350 351 352 353 354 355 356
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
357 358 359
    err=$?
    test "$err" = 0 && enable $func || disable $func
    return $err
360 361
}

362 363 364 365 366 367 368 369 370 371 372 373
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
}

374
check_exec(){
375
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
376 377 378 379 380 381 382 383
}

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

386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
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
428
    wince
429 430 431 432 433 434 435
    x264
    xvid
    zlib
'

HAVE_LIST='
    altivec_h
436
    beosthreads
437 438
    byteswap_h
    dcbzl
439
    dlfcn_h
440 441 442 443
    dlopen
    freetype2
    gprof
    imlib2
444
    inet_aton
445 446 447 448 449
    localtime_r
    lrintf
    malloc_h
    memalign
    mlib
450
    os2
451 452
    os2threads
    pthreads
453 454
    sdl
    sdl_video_size
455 456
    threads
    w32threads
457
'
458

459
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
460
if test ! -z "$TMPDIR" ; then
461
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
462
elif test ! -z "$TEMPDIR" ; then
463
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
464
else
465
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
466 467
fi

468 469
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
470
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
471 472 473
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
474
# default parameters
475
logging="yes"
476
logfile="config.err"
477 478
PREFIX="/usr/local"
libdir='${PREFIX}/lib'
479
shlibdir="$libdir"
480 481 482
incdir='${PREFIX}/include/ffmpeg'
mandir='${PREFIX}/man'
bindir='${PREFIX}/bin'
483
cross_prefix=""
484
cross_compile="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
485 486
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
487
ranlib="ranlib"
488
make="make"
489
strip="strip"
490
arch=`uname -m`
491
cpu="generic"
492
powerpc_perf="no"
493
mmx="default"
494
cmov="no"
495
cmov_is_fast="no"
496
armv5te="default"
497
iwmmxt="default"
498
altivec="default"
499
dcbzl="no"
500
mmi="default"
501
case "$arch" in
502
  i386|i486|i586|i686|i86pc|BePC)
503
    arch="x86_32"
Fabrice Bellard's avatar
Fabrice Bellard committed
504
  ;;
505
  x86_64|amd64)
Diego Biurrun's avatar
typo  
Diego Biurrun committed
506
    arch="x86_32"
507
    canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
508 509
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
510
        arch="x86_64"
511
      fi
512 513
    fi
  ;;
514 515
  # armv4l is a subset of armv[567]*l
  arm|armv[4567]*l)
516
    arch="armv4l"
517
  ;;
518
  alpha)
519
    arch="alpha"
520
  ;;
521
  "Power Macintosh"|ppc|ppc64|powerpc)
522
    arch="powerpc"
523
  ;;
524
  mips|mipsel|IP*)
525
    arch="mips"
526
  ;;
527
  sun4u|sparc64)
528
    arch="sparc64"
529
  ;;
530
  sparc)
531
    arch="sparc"
532
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
533
  sh4)
534
    arch="sh4"
Alex Beregszaszi's avatar
Alex Beregszaszi committed
535
  ;;
536
  parisc|parisc64)
537
    arch="parisc"
538 539
  ;;
  s390|s390x)
540
    arch="s390"
541 542
  ;;
  m68k)
543
    arch="m68k"
544 545
  ;;
  ia64)
546
    arch="ia64"
547
  ;;
Michael Benjamin's avatar
Michael Benjamin committed
548
  bfin)
549
    arch="bfin"
Michael Benjamin's avatar
Michael Benjamin committed
550
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
551
  *)
552
    arch="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
553 554 555
  ;;
esac
gprof="no"
556 557
video4linux="yes"
video4linux2="yes"
558
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
559
audio_oss="yes"
560
audio_beos="no"
561
dv1394="yes"
562
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
563
network="yes"
564
ipv6="yes"
565
zlib="yes"
566
libgsm="no"
567
mp3lame="no"
568
libnut="no"
569
libogg="no"
570
libvorbis="no"
571 572
faad="no"
faadbin="no"
573
faac="no"
574
xvid="no"
575
x264="no"
576
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
577
a52bin="no"
578
dts="no"
579
pp="no"
580
mingw32="no"
581
wince="no"
582
os2="no"
583
lstatic="yes"
584
lshared="no"
585 586
optimize="yes"
debug="yes"
587
extrawarnings="no"
588
dostrip="yes"
589
installstrip="-s"
590
extralibs="-lm"
591
bigendian="no"
592
vhook="default"
593
avisynth="no"
594
dlfcn_h="no"
595
dlopen="no"
596
mpegaudio_hp="yes"
597
SHFLAGS='-shared -Wl,-soname,$@'
598
VHOOKSHFLAGS='$(SHFLAGS)'
599
beos_netserver="no"
600
protocols="yes"
601
ffmpeg="yes"
602
ffserver="yes"
603
ffplay="yes"
604
LIBOBJFLAGS=""
605
FFLDFLAGS=-Wl,--warn-common
606
LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
607
FFSERVERLDFLAGS=-Wl,-E
608
LDCONFIG="ldconfig"
609 610
LIBPREF="lib"
LIBSUF=".a"
611
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
612 613
SLIBPREF="lib"
SLIBSUF=".so"
614
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
615 616
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
Fabrice Bellard's avatar
Fabrice Bellard committed
617
EXESUF=""
618
BUILDSUF=""
619
amr_nb="no"
620
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
621
amr_nb_fixed="no"
622
amr_if2="no"
623
mlib="no"
624
pthreads="no"
Luca Abeni's avatar
Luca Abeni committed
625
swscaler="no"
626
gpl="no"
627
memalign_hack="no"
628
asmalign_pot="unknown"
629
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
630 631 632 633 634

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
635
PREFIX="/boot/home/config"
636
# helps building libavcodec
637
add_cflags "-DPIC -fomit-frame-pointer"
638
# 3 gcc releases known for BeOS, each with ugly bugs
639
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
640 641 642 643 644
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
mmx="no"
;;
*20010315*) echo "BeBits gcc"
645
add_cflags "-fno-expensive-optimizations"
646 647
;;
esac
648
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
649
# disable Linux things
650
audio_oss="no"
651 652
video4linux="no"
video4linux2="no"
653
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
654
# enable BeOS things
655
audio_beos="yes"
656
beosthreads="yes"
657 658 659 660 661
# 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
662
beos_netserver="yes"
663
extralibs="-lnet"
664
fi ;;
665
SunOS)
666 667
video4linux="no"
video4linux2="no"
668
audio_oss="no"
669
dv1394="no"
670
make="gmake"
671
FFLDFLAGS=""
672
FFSERVERLDFLAGS=""
673
SHFLAGS="-shared -Wl,-h,\$@"
674
add_extralibs "-lsocket -lnsl"
675
;;
676
NetBSD)
677 678
video4linux="no"
video4linux2="no"
679
bktr="yes"
680 681 682
audio_oss="yes"
dv1394="no"
make="gmake"
683
add_extralibs "-lossaudio"
684
;;
685
OpenBSD)
686 687
video4linux="no"
video4linux2="no"
688
bktr="yes"
689 690 691
audio_oss="yes"
dv1394="no"
make="gmake"
692
LIBOBJFLAGS="\$(PIC)"
693
LDCONFIG="ldconfig -m \$(shlibdir)"
694
add_extralibs "-lossaudio"
695
;;
696
FreeBSD)
697 698
video4linux="no"
video4linux2="no"
699
bktr="yes"
700
audio_oss="yes"
701
dv1394="no"
702
make="gmake"
703
add_cflags "-pthread"
704
;;
705
GNU/kFreeBSD)
706 707
video4linux="no"
video4linux2="no"
708 709 710
bktr="yes"
audio_oss="yes"
dv1394="no"
711
add_cflags "-pthread"
712
;;
713
BSD/OS)
714 715
video4linux="no"
video4linux2="no"
716
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
717
audio_oss="yes"
718
dv1394="no"
719 720
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
721 722
strip="strip -d"
installstrip=""
723
;;
724
Darwin)
725
cc="cc"
726 727
video4linux="no"
video4linux2="no"
728
audio_oss="no"
729
dv1394="no"
730
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
731
VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
732
extralibs=""
733
strip="strip -x"
734
installstrip=""
735
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
736
SLIBSUF=".dylib"
737 738
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
739
FFSERVERLDFLAGS=-Wl,-bind_at_load
740
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
741
;;
742
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
743
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
744
# can be forced on the command line for Linux cross compilation.
745 746
mingw32="yes"
;;
747
CYGWIN*)
748
targetos=CYGWIN
749
shlibdir="$bindir"
750 751
video4linux="no"
video4linux2="no"
752
audio_oss="yes"
753
dv1394="no"
754
VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
755
VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
756
extralibs=""
757
EXESUF=".exe"
758 759 760 761 762
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'
763
;;
764
Linux)
765
LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
766
;;
767
IRIX*)
768
targetos=IRIX
769
ranlib="echo ignoring ranlib"
770 771
video4linux="no"
video4linux2="no"
772 773 774
audio_oss="no"
make="gmake"
;;
775 776
OS/2)
TMPE=$TMPE".exe"
777
ar="emxomfar -p128"
778 779
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
780
add_cflags "-Zomf"
781
FFLDFLAGS="-Zomf -Zstack 16384 -s"
782
SHFLAGS="-Zdll -Zomf"
783
FFSERVERLDFLAGS=""
784 785 786 787
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
788
EXESUF=".exe"
789
extralibs=""
790
pkg_requires=""
791 792
video4linux="no"
video4linux2="no"
793
audio_oss="no"
794
dv1394="no"
795
ffserver="no"
796
vhook="no"
797
os2="yes"
798
os2threads="yes"
799
;;
800 801 802
*)
targetos="${targetos}-UNKNOWN"
;;
803
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
804

805
# find source path
806
source_path="`dirname \"$0\"`"
807 808
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
809
    source_path="`pwd`"
810
    source_path_used="no"
811 812
else
    source_path="`cd \"$source_path\"; pwd`"
813 814
    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
815 816
fi

817 818 819 820
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
fi

821 822 823 824 825
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

826 827 828
ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
829 830
MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
831

832 833
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST

Fabrice Bellard's avatar
Fabrice Bellard committed
834
for opt do
Måns Rullgård's avatar
Måns Rullgård committed
835
  optval="${opt#*=}"
Fabrice Bellard's avatar
Fabrice Bellard committed