configure 56.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
7 8 9 10 11 12
# 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
13 14
unset foo
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
15
if test "$?" != 0; then
16 17 18 19 20 21 22 23 24 25 26 27
    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" "$@"
28 29
    fi
    echo "No compatible shell script interpreter found."
30 31 32 33 34 35
    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
36 37 38
    exit 1
fi

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

146 147 148 149
log(){
    echo "$@" >>$logfile
}

150
log_file(){
Måns Rullgård's avatar
Måns Rullgård committed
151 152 153 154 155
    log BEGIN $1
    cat -n $1 >>$logfile
    log END $1
}

156
echolog(){
Måns Rullgård's avatar
Måns Rullgård committed
157
    log "$@"
158
    echo "$@"
159 160 161 162 163 164 165 166 167
}

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

183
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
184 185 186 187
toupper(){
    echo "$@" | tr '[a-z]' '[A-Z]'
}

188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
set_all(){
    value=$1
    shift
    for var in $*; do
        eval $var=$value
    done
}

enable(){
    set_all yes $*
}

disable(){
    set_all no $*
}

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

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

238
save_flags(){
239
    flags_saved && return
240 241 242 243 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
    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 $*"
}

269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
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 "$@"
}

288
check_cmd(){
Måns Rullgård's avatar
Måns Rullgård committed
289
    log "$@"
290
    "$@" >>$logfile 2>&1
291 292
}

293
check_cc(){
294 295
    log check_cc "$@"
    cat >$TMPC
296
    log_file $TMPC
297
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
298 299 300 301
}

check_cpp(){
    log check_cpp "$@"
302
    cat >$TMPC
303
    log_file $TMPC
304
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
305 306 307
}

check_ld(){
308
    log check_ld "$@"
309
    check_cc || return
310
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
311 312 313
}

check_cflags(){
314 315
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
316 317 318 319 320
int x;
EOF
}

check_ldflags(){
321 322 323 324 325
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
326 327 328 329
EOF
}

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

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

358 359 360 361 362 363 364 365 366 367 368 369
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
}

370
check_exec(){
371
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
372 373 374 375 376 377 378 379
}

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

382 383 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
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
424
    wince
425 426 427 428 429 430 431
    x264
    xvid
    zlib
'

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

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

464 465
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
466
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
467 468 469
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

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

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

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

813 814 815 816
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
fi

817 818 819 820 821
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

822 823 824 825 826
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/'`
827

828 829
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST

Fabrice Bellard's avatar
Fabrice Bellard committed
830
for opt do
Måns Rullgård's avatar
Måns Rullgård committed
831
  optval="${opt#*=}"
Fabrice Bellard's avatar
Fabrice Bellard committed
832
  case "$opt" in
833 834
  --log)
  ;;