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
# 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
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
166 167 168 169
toupper(){
    echo "$@" | tr '[a-z]' '[A-Z]'
}

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

enable(){
    set_all yes $*
}

disable(){
    set_all no $*
}

186
enabled(){
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 213
    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
214 215 216 217 218 219
}

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

220
save_flags(){
221
    flags_saved && return
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 250
    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 $*"
}

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

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

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

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

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

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

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

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

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

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

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

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

357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 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
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
'

HAVE_LIST='
    altivec_h
406
    beosthreads
407 408 409 410 411 412 413
    byteswap_h
    dcbzl
    dlfcn
    dlopen
    freetype2
    gprof
    imlib2
414
    inet_aton
415 416 417 418 419
    localtime_r
    lrintf
    malloc_h
    memalign
    mlib
420 421
    os2threads
    pthreads
422 423
    sdl
    sdl_video_size
424 425
    threads
    w32threads
426
'
427

428
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
429
if test ! -z "$TMPDIR" ; then
430
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
431
elif test ! -z "$TEMPDIR" ; then
432
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
433
else
434
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
435 436
fi

437 438
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
439
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
440 441 442
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

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

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

774
# find source path
775
source_path="`dirname \"$0\"`"
776 777
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
778
    source_path="`pwd`"
779
    source_path_used="no"
780 781
else
    source_path="`cd \"$source_path\"; pwd`"
782 783
    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
784 785
fi

786 787 788 789
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
fi

790 791 792 793 794
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

795 796 797 798 799
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/'`
800

801 802
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST

Fabrice Bellard's avatar
Fabrice Bellard committed
803
for opt do
Måns Rullgård's avatar
Måns Rullgård committed
804
  optval="${opt#*=}"
Fabrice Bellard's avatar
Fabrice Bellard committed
805
  case "$opt" in
806 807
  --log)
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
808
  --log=*) logging="$optval"
809
  ;;
810
  --prefix=*) PREFIX="$optval"; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
811
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
812
  --libdir=*) libdir="$optval"; force_libdir=yes
813
  ;;
814 815
  --shlibdir=*) shlibdir="$optval"
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
816
  --incdir=*) incdir="$optval"
Diego Biurrun's avatar
Diego Biurrun committed
817
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
818
  --mandir=*) mandir="$optval"
819
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
820
  --source-path=*) source_path="$optval"
821
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
822
  --cross-prefix=*) cross_prefix="$optval"
823
  ;;
824 825
  --cross-compile) cross_compile=yes
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
826
  --cc=*) cc="$optval"