configure 64.1 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 169 170 171 172 173 174 175 176 177 178 179 180
set_all(){
    value=$1
    shift
    for var in $*; do
        eval $var=$value
    done
}

enable(){
    set_all yes $*
}

disable(){
    set_all no $*
}

181 182 183 184 185 186 187 188
enabled(){
    eval test "\$$1" = "yes"
}

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

189
save_flags(){
190
    flags_saved && return
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
    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 $*"
}

220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
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 "$@"
}

239
check_cmd(){
Måns Rullgård's avatar
Måns Rullgård committed
240
    log "$@"
241
    "$@" >>$logfile 2>&1
242 243
}

244
check_cc(){
245 246
    log check_cc "$@"
    cat >$TMPC
247
    log_file $TMPC
248
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
249 250 251 252
}

check_cpp(){
    log check_cpp "$@"
253
    cat >$TMPC
254
    log_file $TMPC
255
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
256 257 258
}

check_ld(){
259
    log check_ld "$@"
260
    check_cc || return
261
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
262 263 264
}

check_cflags(){
265 266
    log check_cflags "$@"
    check_cc "$@" <<EOF && add_cflags "$@"
267 268 269 270 271
int x;
EOF
}

check_ldflags(){
272 273 274 275 276
    log check_ldflags "$@"
    check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
    return 0;
}
277 278 279 280
EOF
}

check_header(){
281
    log check_header "$@"
282 283
    header=$1
    shift
284
    check_cpp "$@" <<EOF
285 286 287 288 289 290
#include <$header>
int x;
EOF
}

check_func(){
291
    log check_func "$@"
292 293 294 295 296 297 298 299 300 301
    func=$1
    shift
    check_ld "$@" <<EOF
extern int $func();
int main(){
    $func();
}
EOF
}

302 303 304 305 306 307 308 309 310 311 312 313
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
}

314
check_exec(){
315
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
316 317 318 319 320 321 322 323
}

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

326
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
327
if test ! -z "$TMPDIR" ; then
328
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
329
elif test ! -z "$TEMPDIR" ; then
330
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
331
else
332
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
333 334
fi

335 336
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
337
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
338 339 340
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

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

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

670
;;
671 672 673
*)
targetos="${targetos}-UNKNOWN"
;;
674
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
675

676
# find source path
677
source_path="`dirname \"$0\"`"
678 679
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
680
    source_path="`pwd`"
681
    source_path_used="no"
682 683
else
    source_path="`cd \"$source_path\"; pwd`"
684 685
    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
686 687
fi

688 689 690 691
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    show_help
fi

692 693 694 695 696
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

697 698 699 700 701
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/'`
702

703 704
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST

Fabrice Bellard's avatar
Fabrice Bellard committed
705
for opt do
Måns Rullgård's avatar
Måns Rullgård committed
706
  optval="${opt#*=}"
Fabrice Bellard's avatar
Fabrice Bellard committed
707
  case "$opt" in
708 709
  --log)
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
710
  --log=*) logging="$optval"
711
  ;;
712
  --prefix=*) PREFIX="$optval"; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
713
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
714
  --libdir=*) libdir="$optval"; force_libdir=yes
715
  ;;
716 717
  --shlibdir=*) shlibdir="$optval"
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
718
  --incdir=*) incdir="$optval"
Diego Biurrun's avatar
Diego Biurrun committed
719
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
720
  --mandir=*) mandir="$optval"
721
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
722
  --source-path=*) source_path="$optval"
723
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
724
  --cross-prefix=*) cross_prefix="$optval"
725
  ;;
726 727
  --cross-compile) cross_compile=yes
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
728
  --cc=*) cc="$optval"
Fabrice Bellard's avatar
Fabrice Bellard committed
729
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
730
  --make=*) make="$optval"
731
  ;;
732
  --extra-cflags=*) add_cflags "$optval"
733
  ;;
734
  --extra-ldflags=*) add_ldflags "$optval"
735
  ;;
736
  --extra-libs=*) add_extralibs "$optval"
737
  ;;
Måns Rullgård's avatar
Måns Rullgård committed
738
  --build-suffix=*) BUILDSUF="$optval"
739
  ;;
740
  --arch=*) arch="$optval"
Fabrice Bellard's avatar
Fabrice Bellard committed
741
  ;;
742
  --cpu=*) cpu="$optval"
743
  ;;
744 745
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
746 747
  --disable-mmx) mmx="no"
  ;;
748 749
  --disable-armv5te) armv5te="no"
  ;;
750 751
  --disable-iwmmxt) iwmmxt="no"
  ;;
752 753
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
754 755
  --enable-gprof) gprof="yes"
  ;;
756
  --disable-v4l) video4linux="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
757
  ;;
758
  --disable-v4l2) video4linux2="no"
Luca Abeni's avatar
Luca Abeni committed
759
  ;;
Michael Niedermayer's avatar