Statistics
| Branch: | Revision:

ffmpeg / configure @ f956e129

History | View | Annotate | Download (63.7 KB)

1
#!/bin/sh
2
#
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5

    
6
# make sure we are running under a compatible shell
7
unset foo
8
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
9
if test "$?" != 0; then
10
    if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
11
        FFMPEG_CONFIGURE_EXEC=1
12
        export FFMPEG_CONFIGURE_EXEC
13
        exec bash "$0" "$@"
14
        exec ksh "$0" "$@"
15
        exec /usr/xpg4/bin/sh "$0" "$@"
16
    fi
17
    echo "No compatible shell script interpreter found."
18
    exit 1
19
fi
20

    
21
show_help(){
22
  echo "Usage: configure [options]"
23
  echo "Options: [defaults in brackets after descriptions]"
24
  echo
25
  echo "Standard options:"
26
  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
  echo "  --incdir=DIR             install includes in DIR [PREFIX/include/ffmpeg]"
32
  echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
33
  echo "  --enable-mp3lame         enable MP3 encoding via libmp3lame [default=no]"
34
  echo "  --enable-libnut          enable NUT support via libnut [default=no]"
35
  echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
36
  echo "  --enable-vorbis          enable Vorbis support via libvorbis [default=no]"
37
  echo "  --enable-faad            enable FAAD support via libfaad [default=no]"
38
  echo "  --enable-faadbin         build FAAD support with runtime linking [default=no]"
39
  echo "  --enable-faac            enable FAAC support via libfaac [default=no]"
40
  echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
41
  echo "  --enable-xvid            enable XviD support via xvidcore [default=no]"
42
  echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
43
  echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
44
  echo "  --enable-mingwce         enable MinGW native/cross WinCE compile"
45
  echo "  --enable-a52             enable GPLed A52 support [default=no]"
46
  echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
47
  echo "  --enable-dts             enable GPLed DTS support [default=no]"
48
  echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
49
  echo "  --enable-static          build static libraries [default=yes]"
50
  echo "  --disable-static         do not build static libraries [default=no]"
51
  echo "  --enable-shared          build shared libraries [default=no]"
52
  echo "  --disable-shared         do not build shared libraries [default=yes]"
53
  echo "  --enable-amr_nb          enable amr_nb float audio codec"
54
  echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
55
  echo "  --enable-amr_wb          enable amr_wb float audio codec"
56
  echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
57
  echo "  --enable-sunmlib         use Sun medialib [default=no]"
58
  echo "  --enable-pthreads        use pthreads [default=no]"
59
  echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394"
60
  echo "                           and libraw1394 [default=no]"
61
  echo "  --enable-swscaler        software scaler support [default=no]"
62
  echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
63
  echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
64
  echo "                           and ffmpeg will be under GPL [default=no]"
65
  echo ""
66
  echo "Advanced options (experts only):"
67
  echo "  --source-path=PATH       path to source code [$source_path]"
68
  echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
69
  echo "  --cross-compile          assume a cross-compiler is used"
70
  echo "  --cc=CC                  use C compiler CC [$cc]"
71
  echo "  --make=MAKE              use specified make [$make]"
72
  echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
73
  echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
74
  echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
75
  echo "  --build-suffix=SUFFIX    suffix for application specific build []"
76
  echo "  --arch=ARCH              select architecture  [$arch]"
77
  echo "  --cpu=CPU                selects the minimum cpu required (affects
78
                                   instruction selection, may crash on older CPUs)"
79
  echo "  --powerpc-perf-enable    enable performance report on PPC"
80
  echo "                           (requires enabling PMC)"
81
  echo "  --disable-mmx            disable MMX usage"
82
  echo "  --disable-armv5te        disable armv5te usage"
83
  echo "  --disable-iwmmxt         disable iwmmxt usage"
84
  echo "  --disable-altivec        disable AltiVec usage"
85
  echo "  --disable-audio-oss      disable OSS audio support [default=no]"
86
  echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
87
  echo "  --disable-v4l            disable video4linux grabbing [default=no]"
88
  echo "  --disable-v4l2           disable video4linux2 grabbing [default=no]"
89
  echo "  --disable-bktr           disable bktr video grabbing [default=no]"
90
  echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
91
  echo "  --disable-network        disable network support [default=no]"
92
  echo "  --disable-ipv6           disable ipv6 support [default=no]"
93
  echo "  --disable-zlib           disable zlib [default=no]"
94
  echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
95
  echo "  --disable-vhook          disable video hooking support"
96
  echo "  --enable-gprof           enable profiling with gprof [$gprof]"
97
  echo "  --disable-debug          disable debugging symbols"
98
  echo "  --disable-opts           disable compiler optimizations"
99
  echo "  --enable-extra-warnings  enable more compiler warnings"
100
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
101
  echo "                           MPEG audio decoding [default=no]"
102
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
103
  echo "  --disable-ffmpeg         disable ffmpeg build"
104
  echo "  --disable-ffserver       disable ffserver build"
105
  echo "  --disable-ffplay         disable ffplay build"
106
  echo "  --enable-small           optimize for size instead of speed"
107
  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
108
  echo "  --disable-strip          disable stripping of executables and shared libraries"
109
  echo "  --disable-encoder=NAME   disables encoder NAME"
110
  echo "  --enable-encoder=NAME    enables encoder NAME"
111
  echo "  --disable-decoder=NAME   disables decoder NAME"
112
  echo "  --enable-decoder=NAME    enables decoder NAME"
113
  echo "  --disable-encoders       disables all encoders"
114
  echo "  --disable-decoders       disables all decoders"
115
  echo "  --disable-muxer=NAME     disables muxer NAME"
116
  echo "  --enable-muxer=NAME      enables muxer NAME"
117
  echo "  --disable-muxers         disables all muxers"
118
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
119
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
120
  echo "  --disable-demuxers       disables all demuxers"
121
  echo "  --enable-parser=NAME     enables parser NAME"
122
  echo "  --disable-parser=NAME    disables parser NAME"
123
  echo "  --disable-parsers        disables all parsers"
124
  echo ""
125
  echo "NOTE: Object files are built at the place where configure is launched."
126
  exit 1
127
}
128

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

    
133
log_file(){
134
    log BEGIN $1
135
    cat -n $1 >>$logfile
136
    log END $1
137
}
138

    
139
echolog(){
140
    log "$@"
141
    echo "$@"
142
}
143

    
144
die(){
145
    echolog "$@"
146
    cat <<EOF
147
If you think configure made a mistake, make sure you are using the latest
148
version from SVN.  If the latest version fails, report the problem to the
149
ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
150
EOF
151
    if enabled logging; then
152
        cat <<EOF
153
Include the log file "$logfile" produced by configure as this will help
154
solving the problem.
155
EOF
156
    else
157
cat <<EOF
158
Rerun configure with logging enabled (do not use --log=no), and include the
159
log this produces with your report.
160
EOF
161
    fi
162
    rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
163
    exit 1
164
}
165

    
166
enabled(){
167
    eval test "\$$1" = "yes"
168
}
169

    
170
flags_saved(){
171
    (: ${SAVE_CFLAGS?}) 2>/dev/null
172
}
173

    
174
save_flags(){
175
    flags_saved && return
176
    SAVE_CFLAGS="$CFLAGS"
177
    SAVE_LDFLAGS="$LDFLAGS"
178
    SAVE_extralibs="$extralibs"
179
}
180

    
181
restore_flags(){
182
    CFLAGS="$SAVE_CFLAGS"
183
    LDFLAGS="$SAVE_LDFLAGS"
184
    extralibs="$SAVE_extralibs"
185
    unset SAVE_CFLAGS
186
    unset SAVE_LDFLAGS
187
    unset SAVE_extralibs
188
}
189

    
190
temp_cflags(){
191
    save_flags
192
    CFLAGS="$CFLAGS $*"
193
}
194

    
195
temp_ldflags(){
196
    save_flags
197
    LDFLAGS="$LDFLAGS $*"
198
}
199

    
200
temp_extralibs(){
201
    save_flags
202
    extralibs="$extralibs $*"
203
}
204

    
205
append(){
206
    var=$1
207
    shift
208
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
209
    eval "$var=\"\$$var $*\""
210
}
211

    
212
add_cflags(){
213
    append CFLAGS "$@"
214
}
215

    
216
add_ldflags(){
217
    append LDFLAGS "$@"
218
}
219

    
220
add_extralibs(){
221
    append extralibs "$@"
222
}
223

    
224
check_cmd(){
225
    log "$@"
226
    "$@" >>$logfile 2>&1
227
}
228

    
229
check_cc(){
230
    log check_cc "$@"
231
    cat >$TMPC
232
    log_file $TMPC
233
    check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
234
}
235

    
236
check_cpp(){
237
    log check_cpp "$@"
238
    cat >$TMPC
239
    log_file $TMPC
240
    check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
241
}
242

    
243
check_ld(){
244
    log check_ld "$@"
245
    check_cc || return
246
    check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
247
}
248

    
249
check_cflags(){
250
    log check_cflags "$@"
251
    check_cc "$@" <<EOF && add_cflags "$@"
252
int x;
253
EOF
254
}
255

    
256
check_ldflags(){
257
    log check_ldflags "$@"
258
    check_ld "$@" <<EOF && add_ldflags "$@"
259
int main(){
260
    return 0;
261
}
262
EOF
263
}
264

    
265
check_header(){
266
    log check_header "$@"
267
    header=$1
268
    shift
269
    check_cpp "$@" <<EOF
270
#include <$header>
271
int x;
272
EOF
273
}
274

    
275
check_func(){
276
    log check_func "$@"
277
    func=$1
278
    shift
279
    check_ld "$@" <<EOF
280
extern int $func();
281
int main(){
282
    $func();
283
}
284
EOF
285
}
286

    
287
check_lib(){
288
    log check_lib "$@"
289
    header="$1"
290
    func="$2"
291
    shift 2
292
    temp_extralibs "$@"
293
    check_header $header && check_func $func && add_extralibs "$@"
294
    err=$?
295
    restore_flags
296
    return $err
297
}
298

    
299
check_exec(){
300
    check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
301
}
302

    
303
require(){
304
    name="$1"
305
    header="$2"
306
    func="$3"
307
    shift 3
308
    check_lib $header $func "$@" || die "ERROR: $name not found"
309
}
310

    
311
filter_out(){
312
    pattern="$1"
313
    shift
314
    echo "$@" | sed "s%\\<$pattern\\>%%g"
315
}
316

    
317
# set temporary file name
318
if test ! -z "$TMPDIR" ; then
319
    TMPDIR1="${TMPDIR}"
320
elif test ! -z "$TEMPDIR" ; then
321
    TMPDIR1="${TEMPDIR}"
322
else
323
    TMPDIR1="/tmp"
324
fi
325

    
326
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
327
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
328
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
329
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
330
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
331

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

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

    
662
;;
663
*)
664
targetos="${targetos}-UNKNOWN"
665
;;
666
esac
667

    
668
# find source path
669
source_path="`dirname \"$0\"`"
670
source_path_used="yes"
671
if test -z "$source_path" -o "$source_path" = "." ; then
672
    source_path="`pwd`"
673
    source_path_used="no"
674
else
675
    source_path="`cd \"$source_path\"; pwd`"
676
    echo "$source_path" | grep -q '[[:blank:]]' &&
677
      die "Out of tree builds are impossible with whitespace in source path."
678
fi
679

    
680
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
681
    show_help
682
fi
683

    
684
FFMPEG_CONFIGURATION=" "
685
for opt do
686
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
687
done
688

    
689
ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
690
DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
691
PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
692
MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
693
DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
694

    
695
for opt do
696
  optval="${opt#*=}"
697
  case "$opt" in
698
  --log)
699
  ;;
700
  --log=*) logging="$optval"
701
  ;;
702
  --prefix=*) PREFIX="$optval"; force_prefix=yes
703
  ;;
704
  --libdir=*) libdir="$optval"; force_libdir=yes
705
  ;;
706
  --shlibdir=*) shlibdir="$optval"
707
  ;;
708
  --incdir=*) incdir="$optval"
709
  ;;
710
  --mandir=*) mandir="$optval"
711
  ;;
712
  --source-path=*) source_path="$optval"
713
  ;;
714
  --cross-prefix=*) cross_prefix="$optval"
715
  ;;
716
  --cross-compile) cross_compile=yes
717
  ;;
718
  --cc=*) cc="$optval"
719
  ;;
720
  --make=*) make="$optval"
721
  ;;
722
  --extra-cflags=*) add_cflags "$optval"
723
  ;;
724
  --extra-ldflags=*) add_ldflags "$optval"
725
  ;;
726
  --extra-libs=*) add_extralibs "$optval"
727
  ;;
728
  --build-suffix=*) BUILDSUF="$optval"
729
  ;;
730
  --arch=*) arch="$optval"
731
  ;;
732
  --cpu=*) cpu="$optval"
733
  ;;
734
  --powerpc-perf-enable) powerpc_perf="yes"
735
  ;;
736
  --disable-mmx) mmx="no"
737
  ;;
738
  --disable-armv5te) armv5te="no"
739
  ;;
740
  --disable-iwmmxt) iwmmxt="no"
741
  ;;
742
  --disable-altivec) altivec="no"
743
  ;;
744
  --enable-gprof) gprof="yes"
745
  ;;
746
  --disable-v4l) v4l="no"
747
  ;;
748
  --disable-v4l2) v4l2="no"
749
  ;;
750
  --disable-bktr) bktr="no"
751
  ;;
752
  --disable-audio-oss) audio_oss="no"
753
  ;;
754
  --disable-audio-beos) audio_beos="no"
755
  ;;
756
  --disable-dv1394) dv1394="no"
757
  ;;
758
  --disable-network) network="no"; ffserver="no"
759
  ;;
760
  --disable-ipv6) ipv6="no";
761
  ;;
762
  --disable-zlib) zlib="no"
763
  ;;
764
  --enable-a52) a52="yes"
765
  ;;
766
  --enable-a52bin) a52bin="yes"
767
  ;;
768
  --enable-dts) dts="yes"
769
  ;;
770
  --enable-pp) pp="yes"
771
  ;;
772
  --enable-libgsm) libgsm="yes"
773
  ;;
774
  --enable-mp3lame) mp3lame="yes"
775
  ;;
776
  --enable-libnut) libnut="yes"
777
  ;;
778
  --enable-libogg) libogg="yes"
779
    pkg_requires="$pkg_requires ogg >= 1.1"
780
  ;;
781
  --enable-vorbis) vorbis="yes"
782
    pkg_requires="$pkg_requires vorbis vorbisenc"
783
  ;;
784
  --enable-faad) faad="yes"
785
  ;;
786
  --enable-faadbin) faadbin="yes"
787
  ;;
788
  --enable-faac) faac="yes"
789
  ;;
790
  --enable-xvid) xvid="yes"
791
  ;;
792
  --enable-x264) x264="yes"
793
  ;;
794
  --enable-avisynth) avisynth="yes";
795
  ;;
796
  --enable-dc1394) dc1394="yes"
797
    pkg_requires="$pkg_requires libraw1394"
798
  ;;
799
  --disable-vhook) vhook="no"
800
  ;;
801
  --disable-simple_idct) simpleidct="no"
802
  ;;
803
  --enable-mingw32) mingw32="yes"
804
  ;;
805
  --enable-mingwce) mingwce="yes"
806
  ;;
807
  --enable-static) lstatic="yes"
808
  ;;
809
  --disable-static) lstatic="no"
810
  ;;
811
  --enable-shared) lshared="yes"
812
  ;;
813
  --disable-shared) lshared="no"
814
  ;;
815
  --disable-debug) debug="no"
816
  ;;
817
  --disable-opts) optimize="no"
818
  ;;
819
  --enable-extra-warnings) extrawarnings="yes"
820
  ;;
821
  --disable-mpegaudio-hp) mpegaudio_hp="no"
822
  ;;
823
  --disable-protocols) protocols="no"; network="no"; ffserver="no"
824
  ;;
825
  --disable-ffmpeg) ffmpeg="no"
826
  ;;
827
  --disable-ffserver) ffserver="no"
828
  ;;
829
  --disable-ffplay) ffplay="no"
830
  ;;
831
  --enable-small) optimize="small"
832
  ;;
833
  --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
834
  ;;
835
  --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
836
  ;;
837
  --enable-amr_wb) amr="yes"; amr_wb="yes"
838
  ;;
839
  --enable-amr_if2) amr="yes"; amr_if2="yes"
840
  ;;
841
  --enable-sunmlib) sunmlib="yes"
842
  ;;
843
  --enable-pthreads) pthreads="yes"
844
  ;;
845
  --enable-swscaler) swscaler="yes"
846
  ;;
847
  --enable-gpl) gpl="yes"
848
  ;;
849
  --enable-memalign-hack) memalignhack="yes"
850
  ;;
851
  --disable-strip) dostrip="no"
852
  ;;
853
  --enable-encoder=*) ENCODER_LIST="$ENCODER_LIST ${optval}_encoder"
854
  ;;
855
  --enable-decoder=*) DECODER_LIST="$DECODER_LIST ${optval}_decoder"
856
  ;;
857
  --disable-encoder=*) ENCODER_LIST="`filter_out ${optval}_encoder $ENCODER_LIST`"
858
  ;;
859
  --disable-decoder=*) DECODER_LIST="`filter_out ${optval}_decoder $DECODER_LIST`"
860
  ;;
861
  --disable-encoders) ENCODER_LIST=""
862
  ;;
863
  --disable-decoders) DECODER_LIST=""
864
  ;;
865
  --enable-muxer=*) MUXER_LIST="$MUXER_LIST ${optval}_muxer"
866
  ;;
867
  --disable-muxer=*) MUXER_LIST="`filter_out ${optval}_muxer $MUXER_LIST`"
868
  ;;
869
  --disable-muxers) MUXER_LIST=""; ffserver="no"
870
  ;;
871
  --enable-demuxer=*) DEMUXER_LIST="$DEMUXER_LIST ${optval}_demuxer"
872
  ;;
873
  --disable-demuxer=*) DEMUXER_LIST="`filter_out ${optval}_demuxer $DEMUXER_LIST`"
874
  ;;
875
  --disable-demuxers) DEMUXER_LIST=""
876
  ;;
877
  --enable-parser=*) PARSER_LIST="$PARSER_LIST ${optval}_parser"
878
  ;;
879
  --disable-parser=*) PARSER_LIST="`filter_out ${optval}_parser $PARSER_LIST`"
880
  ;;
881
  --disable-parsers) PARSER_LIST=""
882
  ;;
883
  --help) show_help
884
  ;;
885
  *)
886
  echo "Unknown option \"$opt\"."
887
  echo "See $0 --help for available options."
888
  exit 1
889
  ;;
890
  esac
891
done
892

    
893
if test "$logging" != no; then
894
    test "$logging" = yes || logfile="$logging"
895
    echo "# $0 $@" >$logfile
896
    set >>$logfile
897
else
898
    logfile=/dev/null
899
fi
900

    
901
if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
902
    if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
903
        cat <<EOF
904
You can only build one library type at once on MinGW.
905
Specify --disable-static --enable-shared to only build
906
the shared libraries. To build only the static libraries
907
you do not need to pass additional options.
908
EOF
909
        exit 1
910
    fi
911
    v4l="no"
912
    v4l2="no"
913
    bktr="no"
914
    audio_oss="no"
915
    dv1394="no"
916
    dc1394="no"
917
    ffserver="no"
918
    network="no"
919
    if test "$mingwce" = "yes"; then
920
        protocols="no"
921
    fi
922
    SLIBPREF=""
923
    SLIBSUF=".dll"
924
    EXESUF=".exe"
925
    SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
926
    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
927
    SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
928
    SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
929
    if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
930
    if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
931
    shlibdir='${PREFIX}'
932
fi
933

    
934
# Combine FFLDFLAGS and the LDFLAGS environment variable.
935
LDFLAGS="$FFLDFLAGS $LDFLAGS"
936

    
937
test -n "$cross_prefix" && cross_compile=yes
938
cc="${cross_prefix}${cc}"
939
ar="${cross_prefix}${ar}"
940
ranlib="${cross_prefix}${ranlib}"
941
strip="${cross_prefix}${strip}"
942

    
943
# we need to build at least one lib type
944
if test "$lstatic" = "no" && test "$lshared" = "no" ; then
945
    cat <<EOF
946
At least one library type must be built.
947
Specify --enable-static to build the static libraries or --enable-shared to
948
build the shared libraries as well. To only build the shared libraries specify
949
--disable-static in addition to --enable-shared.
950
EOF
951
    exit 1;
952
fi
953

    
954
if test "$vorbis" = "yes" ; then
955
    if test "$libogg" = "no"; then
956
        echo "libogg must be enabled to enable Vorbis."
957
        fail="yes"
958
    fi
959
fi
960

    
961
if test "$gpl" != "yes"; then
962
    if test "$pp" != "no"; then
963
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
964
        fail="yes"
965
    fi
966

    
967
    if test "$a52" != "no" -o "$a52bin" != "no"; then
968
        echo "liba52 is under GPL and --enable-gpl is not specified."
969
        fail="yes"
970
    fi
971

    
972
    if test "$xvid" != "no"; then
973
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
974
        fail="yes"
975
    fi
976

    
977
    if test "$x264" != "no"; then
978
        echo "x264 is under GPL and --enable-gpl is not specified."
979
        fail="yes"
980
    fi
981

    
982
    if test "$dts" != "no"; then
983
        echo "libdts is under GPL and --enable-gpl is not specified."
984
        fail="yes"
985
    fi
986

    
987
    if test "$faad" != "no" -o "$faadbin" != "no"; then
988
        if check_header faad.h; then
989
            check_cc << EOF
990
                #include <faad.h>
991
                #ifndef FAAD2_VERSION
992
                ok faad1
993
                #endif
994
                int main( void ) { return 0; }
995
EOF
996
            if test $? = 0 ; then
997
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
998
                fail="yes"
999
            fi
1000
        else
1001
            faad="no"
1002
            faadbin="no"
1003
            echo "FAAD test failed."
1004
        fi
1005
    fi
1006

    
1007
    if test "$swscaler" != "no"; then
1008
        echo "The software scaler is under GPL and --enable-gpl is not specified."
1009
        fail="yes"
1010
    fi
1011
fi
1012

    
1013
if test "$fail" = "yes"; then
1014
    exit 1
1015
fi
1016

    
1017
# compute MMX state
1018
if test $mmx = "default"; then
1019
    if test $arch = "x86_32" -o $arch = "x86_64"; then
1020
        mmx="yes"
1021
    else
1022
        mmx="no"
1023
    fi
1024
fi
1025

    
1026
#Darwin CC versions
1027
needmdynamicnopic="no"
1028
if test $targetos = Darwin; then
1029
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1030
        add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1031
    else
1032
        gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1033
        case "$gcc_version" in
1034
            *2.95*)
1035
                add_cflags "-no-cpp-precomp -pipe"
1036
                ;;
1037
            *[34].*)
1038
                add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
1039
                if test "$lshared" = no; then
1040
                   needmdynamicnopic="yes"
1041
                fi
1042
                ;;
1043
            *)
1044
                add_cflags "-no-cpp-precomp -pipe"
1045
                if test "$lshared" = no; then
1046
                   needmdynamicnopic="yes"
1047
                fi
1048
                ;;
1049
        esac
1050
    fi
1051
fi
1052

    
1053
if test $optimize != "no"; then
1054
    add_cflags "-fomit-frame-pointer"
1055
fi
1056

    
1057
# Can only do AltiVec on PowerPC
1058
if test $altivec = "default"; then
1059
    if test $arch = "powerpc"; then
1060
        altivec="yes"
1061
    else
1062
        altivec="no"
1063
    fi
1064
fi
1065

    
1066
# Add processor-specific flags
1067
TUNECPU="generic"
1068
POWERPCMODE="32bits"
1069
if test $cpu != "generic"; then
1070
    case $cpu in
1071
        601|ppc601|PowerPC601)
1072
            add_cflags "-mcpu=601"
1073
            if test $altivec = "yes"; then
1074
                echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
1075
            fi
1076
            TUNECPU=ppc601
1077
        ;;
1078
        603*|ppc603*|PowerPC603*)
1079
            add_cflags "-mcpu=603"
1080
            if test $altivec = "yes"; then
1081
                echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
1082
            fi
1083
            TUNECPU=ppc603
1084
        ;;
1085
        604*|ppc604*|PowerPC604*)
1086
            add_cflags "-mcpu=604"
1087
            if test $altivec = "yes"; then
1088
                echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
1089
            fi
1090
            TUNECPU=ppc604
1091
        ;;
1092
        G3|g3|75*|ppc75*|PowerPC75*)
1093
            add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1094
            if test $altivec = "yes"; then
1095
                echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
1096
            fi
1097
            TUNECPU=ppc750
1098
        ;;
1099
        G4|g4|745*|ppc745*|PowerPC745*)
1100
            add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1101
            if test $altivec = "no"; then
1102
                echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
1103
            fi
1104
            TUNECPU=ppc7450
1105
        ;;
1106
        74*|ppc74*|PowerPC74*)
1107
            add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1108
            if test $altivec = "no"; then
1109
                echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
1110
            fi
1111
            TUNECPU=ppc7400
1112
        ;;
1113
        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1114
            add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1115
            if test $altivec = "no"; then
1116
                echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
1117
            fi
1118
            TUNECPU=ppc970
1119
            POWERPCMODE="64bits"
1120
        ;;
1121
        # targets that do NOT support conditional mov (cmov)
1122
        i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1123
            add_cflags "-march=$cpu"
1124
            cmov="no"
1125
        ;;
1126
        # targets that do support conditional mov (cmov)
1127
        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
1128
            add_cflags "-march=$cpu"
1129
            cmov="yes"
1130
            cmov_is_fast="yes"
1131
        ;;
1132
        # targets that do support conditional mov but on which it's slow
1133
        pentium4|prescott|nocona)
1134
            add_cflags "-march=$cpu"
1135
            cmov="yes"
1136
            cmov_is_fast="no"
1137
        ;;
1138
        sparc64)
1139
            add_cflags "-mcpu=v9"
1140
        ;;
1141
        *)
1142
        echo "WARNING: Unknown CPU \"$cpu\", ignored."
1143
        ;;
1144
    esac
1145
fi
1146

    
1147
# make sure we can execute files in $TMPDIR
1148
cat >$TMPE 2>>$logfile <<EOF
1149
#! /bin/sh
1150
EOF
1151
chmod +x $TMPE >>$logfile 2>&1
1152
if ! $TMPE >>$logfile 2>&1; then
1153
    cat <<EOF
1154
Unable to create and execute files in $TMPDIR1.  Set the TMPDIR environment
1155
variable to another directory and make sure that $TMPDIR1 is not mounted
1156
noexec.
1157
EOF
1158
    die "Sanity test failed."
1159
fi
1160
rm $TMPE
1161

    
1162
# compiler sanity check
1163
check_exec <<EOF
1164
int main(){
1165
    return 0;
1166
}
1167
EOF
1168
if test "$?" != 0; then
1169
    echo "$cc is unable to create an executable file."
1170
    if test -z "$cross_prefix" -a "$cross_compile" = no; then
1171
        echo "If $cc is a cross-compiler, use the --cross-compile option."
1172
        echo "Only do this if you know what cross compiling means."
1173
    fi
1174
    die "C compiler test failed."
1175
fi
1176

    
1177
# check for assembler specific support
1178

    
1179
if test $arch = "powerpc"; then
1180
check_cc <<EOF && dcbzl=yes
1181
int main(void) {
1182
    register long zero = 0;
1183
    char data[1024];
1184
    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1185
return 0;
1186
}
1187
EOF
1188
fi
1189

    
1190
# check for SIMD availability
1191

    
1192
# AltiVec flags: The FSF version of GCC differs from the Apple version
1193
if test $arch = "powerpc"; then
1194
    if test $altivec = "yes"; then
1195
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
1196
            add_cflags "-faltivec"
1197
        else
1198
            add_cflags "-maltivec -mabi=altivec"
1199
        fi
1200
    fi
1201
fi
1202

    
1203
check_header altivec.h && _altivec_h=yes || _altivec_h=no
1204

    
1205
# check if our compiler supports Motorola AltiVec C API
1206
if test $altivec = "yes"; then
1207
    if test $_altivec_h = "yes"; then
1208
        inc_altivec_h="#include <altivec.h>"
1209
    else
1210
        inc_altivec_h=
1211
    fi
1212
    check_cc <<EOF || altivec=no
1213
$inc_altivec_h
1214
int main(void) {
1215
    vector signed int v1, v2, v3;
1216
    v1 = vec_add(v2,v3);
1217
    return 0;
1218
}
1219
EOF
1220
fi
1221

    
1222
# check armv5te instructions support
1223
if test $armv5te = "default" -a $arch = "armv4l"; then
1224
    armv5te=no
1225
    check_cc <<EOF && armv5te=yes
1226
        int main(void) {
1227
        __asm__ __volatile__ ("qadd r0, r0, r0");
1228
        }
1229
EOF
1230
fi
1231

    
1232
# check iwmmxt support
1233
if test $iwmmxt = "default" -a $arch = "armv4l"; then
1234
    iwmmxt=no
1235
    check_cc <<EOF && iwmmxt=yes
1236
        int main(void) {
1237
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
1238
        }
1239
EOF
1240
fi
1241

    
1242
# mmi only available on mips
1243
if test $mmi = "default"; then
1244
    if test $arch = "mips"; then
1245
        mmi="yes"
1246
    else
1247
        mmi="no"
1248
    fi
1249
fi
1250

    
1251
# check if our compiler supports mmi
1252
enabled mmi && check_cc <<EOF || mmi="no"
1253
int main(void) {
1254
    __asm__ ("lq \$2, 0(\$2)");
1255
    return 0;
1256
}
1257
EOF
1258

    
1259
# ---
1260
# big/little-endian test
1261
if test "$cross_compile" = "no"; then
1262
    check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
1263
#include <inttypes.h>
1264
int main(int argc, char ** argv){
1265
        volatile uint32_t i=0x01234567;
1266
        return (*((uint8_t*)(&i))) == 0x67;
1267
}
1268
EOF
1269
else
1270
    # programs cannot be launched if cross compiling, so make a static guess
1271
    if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
1272
        bigendian="yes"
1273
    fi
1274
fi
1275

    
1276
# ---
1277
# *inttypes.h* test
1278
check_header inttypes.h || inttypes=no
1279

    
1280
# ---
1281
# *int_fast* test
1282
check_cc <<EOF || emu_fast_int=yes
1283
#include <inttypes.h>
1284
int main(int argc, char ** argv){
1285
        volatile uint_fast64_t i=0x01234567;
1286
        return 0;
1287
}
1288
EOF
1289

    
1290
# ---
1291
# check availability of some header files
1292

    
1293
_memalign=no
1294
_malloc_h=no
1295
if check_header malloc.h; then
1296
    _malloc_h=yes
1297
    _memalign=yes
1298
    check_func memalign || _memalign="no"
1299
fi
1300

    
1301
if test "$_memalign" = "no" -a "$mmx" = "yes" -a \
1302
        "$memalignhack" != "yes" -a "$targetos" != "Darwin" -a \
1303
        "$targetos" != "FreeBSD" ; then
1304
    die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1305
fi
1306

    
1307
check_header byteswap.h && byteswap_h=yes || byteswap_h=no
1308

    
1309
check_func localtime_r && localtime_r=yes || localtime_r=no
1310
enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1311

    
1312
# check for some common methods of building with pthread support
1313
# do this before the optional library checks as some of them require pthreads
1314
if enabled pthreads; then
1315
    { check_cflags -pthread && check_ldflags -pthread; } ||
1316
    { check_cflags -pthreads && check_ldflags -pthreads; } ||
1317
    check_lib pthread.h pthread_create -lpthread ||
1318
    check_func pthread_create ||
1319
    die "ERROR: can't find pthreads library"
1320
fi
1321

    
1322
# these are off by default, so fail if requested and not available
1323
enabled dts     && require libdts dts.h dts_init -ldts -lm
1324
enabled libgsm  && require libgsm gsm.h gsm_create -lgsm
1325
enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1326
enabled vorbis  && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
1327
enabled libogg  && require libogg ogg/ogg.h ogg_sync_init -logg
1328
enabled libnut  && require libnut nut.h nut_demuxer_init -lnut
1329
enabled xvid    && require XviD xvid.h xvid_global -lxvidcore
1330
enabled x264    && require x264 x264.h x264_encoder_open -lx264
1331
enabled dc1394  && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1332
enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1333

    
1334
# Ugh, faac uses stdcall calling convention on win32 so we can't use
1335
# the generic test functions
1336
if enabled faac; then
1337
    save_flags
1338
    temp_extralibs -lfaac
1339
    check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1340
#include <stdint.h>
1341
#include <faac.h>
1342
int main(){
1343
    char *id, *cpr;
1344
    faacEncGetVersion(&id, &cpr);
1345
    return 0;
1346
}
1347
EOF
1348
    restore_flags
1349
fi
1350

    
1351
# Ugh, recent faad2 versions have renamed all functions and #define the
1352
# old names in faad.h.  Generic tests won't work.
1353
if enabled faad; then
1354
    save_flags
1355
    temp_extralibs -lfaad
1356
    check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1357
#include <faad.h>
1358
int main(){
1359
    faacDecOpen();
1360
    return 0;
1361
}
1362
EOF
1363
    restore_flags
1364
fi
1365

    
1366
# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1367
if enabled avisynth; then
1368
    save_flags
1369
    temp_extralibs -lvfw32
1370
    check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1371
#include <windows.h>
1372
#include <vfw.h>
1373
int main(){
1374
    AVIFileInit();
1375
    return 0;
1376
}
1377
EOF
1378
    restore_flags
1379
fi
1380

    
1381

    
1382
# test for lrintf in math.h
1383
check_exec <<EOF && have_lrintf=yes || have_lrintf=no
1384
#define _ISOC9X_SOURCE  1
1385
#include <math.h>
1386
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1387
EOF
1388

    
1389
_restrict=
1390
for restrict_keyword in restrict __restrict__ __restrict; do
1391
    check_cc <<EOF && _restrict=$restrict_keyword && break
1392
void foo(char * $restrict_keyword p);
1393
EOF
1394
done
1395

    
1396
# dlopen/dlfcn.h probing
1397

    
1398
check_header dlfcn.h && dlfcn=yes
1399

    
1400
temp_extralibs -ldl
1401
if check_func dlopen; then
1402
    dlopen=yes
1403
    ldl=-ldl
1404
fi
1405
restore_flags
1406

    
1407
if check_func dlopen; then
1408
    dlopen=yes
1409
    ldl=
1410
fi
1411

    
1412
if test "$vhook" = "default"; then
1413
    vhook="$dlopen"
1414
fi
1415

    
1416
if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
1417
    add_extralibs $ldl
1418
fi
1419

    
1420
if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1421
    vhook="no"
1422
    echo
1423
    echo "At the moment vhooks don't work on Cygwin static builds."
1424
    echo "Patches welcome."
1425
    echo
1426
fi
1427

    
1428
if enabled vhook; then
1429
    check_ldflags -rdynamic
1430
    check_ldflags -export-dynamic
1431
fi
1432

    
1433
##########################################
1434
# imlib check
1435

    
1436
temp_extralibs -lImlib2
1437
check_ld <<EOF && imlib2=yes || imlib2=no
1438
#include <X11/Xlib.h>
1439
#include <Imlib2.h>
1440
int main( void ) { return (int) imlib_load_font("foo"); }
1441
EOF
1442
restore_flags
1443

    
1444
##########################################
1445
# FreeType check
1446

    
1447
freetype2=no
1448
if test "x$targetos" != "xBeOS"; then
1449
  if (freetype-config --version) >/dev/null 2>&1 ; then
1450
      temp_cflags `freetype-config --cflags`
1451
      temp_extralibs `freetype-config --libs`
1452
      check_ld <<EOF && freetype2=yes
1453
#include <ft2build.h>
1454
int main( void ) { return (int) FT_Init_FreeType(0); }
1455
EOF
1456
      restore_flags
1457
  fi
1458
fi
1459

    
1460
##########################################
1461
# SDL check
1462

    
1463
sdl_too_old=no
1464
sdl=no
1465
SDL_CONFIG="${cross_prefix}sdl-config"
1466
if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
1467
    temp_cflags `"${SDL_CONFIG}" --cflags`
1468
    temp_extralibs `"${SDL_CONFIG}" --libs`
1469
    check_ld <<EOF
1470
#include <SDL.h>
1471
#undef main /* We don't want SDL to override our main() */
1472
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1473
EOF
1474
    if test $? = 0; then
1475
        _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1476
        if test "$_sdlversion" -lt 121 ; then
1477
            sdl_too_old=yes
1478
        else
1479
            sdl=yes
1480
            check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
1481
#include <SDL.h>
1482
int main(void){
1483
    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1484
    int w = vi->current_w;
1485
    return 0;
1486
}
1487
EOF
1488
        fi
1489
    fi
1490
    restore_flags
1491
fi
1492

    
1493
enabled sdl || ffplay=no
1494

    
1495
##########################################
1496
# texi2html check
1497

    
1498
texi2html=no
1499
if (texi2html -version) >/dev/null 2>&1; then
1500
texi2html=yes
1501
fi
1502

    
1503
##########################################
1504
# IPv6 check
1505

    
1506
enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
1507
#include <sys/types.h>
1508
#include <sys/socket.h>
1509
#include <netinet/in.h>
1510
#include <netdb.h>
1511
int main( void ) {
1512
  struct sockaddr_storage saddr;
1513
  struct ipv6_mreq mreq6;
1514
  getaddrinfo(0,0,0,0);
1515
  getnameinfo(0,0,0,0,0,0,0);
1516
  IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1517
}
1518
EOF
1519

    
1520
# check for video4linux2 --- V4L2_PIX_FMT_YUV420
1521
enabled v4l2 && check_cc <<EOF || v4l2="no"
1522
#include <sys/time.h>
1523
#include <asm/types.h>
1524
#include <linux/videodev2.h>
1525
int dummy = V4L2_PIX_FMT_YUV420;
1526
struct v4l2_buffer dummy1;
1527
EOF
1528

    
1529
enabled debug && add_cflags -g
1530

    
1531
# add some useful compiler flags if supported
1532
check_cflags -Wdeclaration-after-statement
1533
check_cflags -Wall
1534
check_cflags -Wno-switch
1535
check_cflags -Wdisabled-optimization
1536
check_cflags -Wpointer-arith
1537
check_cflags -Wredundant-decls
1538
enabled extrawarnings && check_cflags -Winline
1539

    
1540
# add some linker flags
1541
check_ldflags $LDLATEFLAGS
1542

    
1543
# not all compilers support -Os
1544
test "$optimize" = "small" && check_cflags -Os
1545

    
1546
if enabled optimize; then
1547
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1548
        add_cflags  "-O5"
1549
        add_ldflags "-O5"
1550
    else
1551
        add_cflags "-O3"
1552
    fi
1553
fi
1554

    
1555
# PIC flags for shared library objects where they are needed
1556
if test "$lshared" = "yes" ; then
1557
    # LIBOBJFLAGS may have already been set in the OS configuration
1558
    if test -z "$LIBOBJFLAGS" ; then
1559
        case "$arch" in
1560
            x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1561
        esac
1562
    fi
1563
fi
1564

    
1565
if test "$gprof" = "yes" ; then
1566
    add_cflags  "-p"
1567
    add_ldflags "-p"
1568
fi
1569

    
1570
# find if .align arg is power-of-two or not
1571
if test $asmalign_pot = "unknown"; then
1572
    asmalign_pot="no"
1573
    echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1574
fi
1575

    
1576
echo "install prefix   $PREFIX"
1577
echo "source path      $source_path"
1578
echo "C compiler       $cc"
1579
echo "make             $make"
1580
echo "ARCH             $arch ($cpu)"
1581
if test "$BUILDSUF" != ""; then
1582
    echo "build suffix     $BUILDSUF"
1583
fi
1584
echo "big-endian       $bigendian"
1585
echo "inttypes.h       $inttypes"
1586
echo "broken inttypes.h $emu_fast_int"
1587
if test $arch = "x86_32" -o $arch = "x86_64"; then
1588
    echo "MMX enabled      $mmx"
1589
    echo "CMOV enabled     $cmov"
1590
    echo "CMOV is fast     $cmov_is_fast"
1591
fi
1592
if test $arch = "armv4l"; then
1593
    echo "ARMv5TE enabled  $armv5te"
1594
    echo "IWMMXT enabled   $iwmmxt"
1595
fi
1596
if test $arch = "mips"; then
1597
    echo "MMI enabled      $mmi"
1598
fi
1599
if test $arch = "powerpc"; then
1600
    echo "AltiVec enabled  $altivec"
1601
    echo "dcbzl available  $dcbzl"
1602
fi
1603
echo "gprof enabled    $gprof"
1604
echo "zlib enabled     $zlib"
1605
echo "libgsm enabled   $libgsm"
1606
echo "mp3lame enabled  $mp3lame"
1607
echo "libnut enabled   $libnut"
1608
echo "libogg enabled   $libogg"
1609
echo "Vorbis enabled   $vorbis"
1610
echo "FAAD enabled     $faad"
1611
echo "faadbin enabled  $faadbin"
1612
echo "FAAC enabled     $faac"
1613
echo "XviD enabled     $xvid"
1614
echo "x264 enabled     $x264"
1615
echo "a52 support      $a52"
1616
echo "a52 dlopened     $a52bin"
1617
echo "DTS support      $dts"
1618
echo "pp support       $pp"
1619
echo "Software Scaler enabled $swscaler"
1620
echo "AVISynth enabled $avisynth"
1621
echo "debug symbols    $debug"
1622
echo "strip symbols    $dostrip"
1623
echo "optimize         $optimize"
1624
echo "static           $lstatic"
1625
echo "shared           $lshared"
1626
echo "video hooking    $vhook"
1627
echo "SDL support      $sdl"
1628
if test $sdl_too_old = "yes"; then
1629
    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1630
fi
1631

    
1632
if test "$vhook" = "yes"; then
1633
    echo "Imlib2 support   $imlib2"
1634
    echo "FreeType support $freetype2"
1635
fi
1636
echo "Sun medialib support"  $sunmlib
1637
echo "pthreads support"      $pthreads
1638
echo "AMR-NB float support"  $amr_nb
1639
echo "AMR-NB fixed support"  $amr_nb_fixed
1640
echo "AMR-WB float support"  $amr_wb
1641
echo "AMR-WB IF2 support"    $amr_if2
1642
echo "network support      $network"
1643
if test "$network" = "yes" ; then
1644
    echo "IPv6 support         $ipv6"
1645
fi
1646
echo ".align is power-of-two" $asmalign_pot
1647
if test "$gpl" = "no" ; then
1648
    echo "License: LGPL"
1649
else
1650
    echo "License: GPL"
1651
fi
1652

    
1653
echo "Creating config.mak and config.h..."
1654

    
1655
date >> config.log
1656
echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1657
echo "# Automatically generated by configure - do not modify!" > config.mak
1658
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1659
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1660

    
1661
echo "PREFIX=$PREFIX" >> config.mak
1662
echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
1663
echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1664
echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1665
echo "incdir=\$(DESTDIR)$incdir" >> config.mak
1666
echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1667
echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1668
echo "MAKE=$make" >> config.mak
1669
echo "CC=$cc" >> config.mak
1670
echo "AR=$ar" >> config.mak
1671
echo "RANLIB=$ranlib" >> config.mak
1672
if test "$dostrip" = "yes" ; then
1673
    echo "STRIP=$strip" >> config.mak
1674
    echo "INSTALLSTRIP=$installstrip" >> config.mak
1675
else
1676
    echo "STRIP=echo ignoring strip" >> config.mak
1677
    echo "INSTALLSTRIP=" >> config.mak
1678
fi
1679

    
1680
VHOOKCFLAGS="-fPIC $CFLAGS"
1681
test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
1682

    
1683
echo "OPTFLAGS=$CFLAGS" >> config.mak
1684
echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
1685
echo "LDFLAGS=$LDFLAGS" >> config.mak
1686
echo "LDCONFIG=$LDCONFIG" >> config.mak
1687
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
1688
echo "SHFLAGS=$SHFLAGS" >> config.mak
1689
echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
1690
echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
1691
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
1692
echo "BUILD_STATIC=$lstatic" >> config.mak
1693
echo "BUILDSUF=$BUILDSUF" >> config.mak
1694
echo "LIBPREF=$LIBPREF" >> config.mak
1695
echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
1696
if test "$lstatic" = "yes" ; then
1697
  echo "LIB=$LIB" >> config.mak
1698
else # Some Make complain if this variable does not exist.
1699
  echo "LIB=" >> config.mak
1700
fi
1701
echo "SLIBPREF=$SLIBPREF" >> config.mak
1702
echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1703
echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
1704
echo "TARGET_OS=$targetos" >> config.mak
1705
if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then
1706
  echo "TARGET_ARCH_X86=yes" >> config.mak
1707
  echo "#define ARCH_X86 1" >> $TMPH
1708
fi
1709
if test "$arch" = "x86_32" ; then
1710
  echo "TARGET_ARCH_X86_32=yes" >> config.mak
1711
  echo "#define ARCH_X86_32 1" >> $TMPH
1712
elif test "$arch" = "x86_64" ; then
1713
  echo "TARGET_ARCH_X86_64=yes" >> config.mak
1714
  echo "#define ARCH_X86_64 1" >> $TMPH
1715
elif test "$arch" = "armv4l" ; then
1716
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1717
  echo "#define ARCH_ARMV4L 1" >> $TMPH
1718
elif test "$arch" = "alpha" ; then
1719
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1720
  echo "#define ARCH_ALPHA 1" >> $TMPH
1721
elif test "$arch" = "sparc64" ; then
1722
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1723
  echo "#define ARCH_SPARC64 1" >> $TMPH
1724
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1725
  echo "#define ARCH_SPARC 1" >> $TMPH
1726
elif test "$arch" = "sparc" ; then
1727
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1728
  echo "#define ARCH_SPARC 1" >> $TMPH
1729
elif test "$arch" = "powerpc" ; then
1730
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1731
  echo "#define ARCH_POWERPC 1" >> $TMPH
1732
  if test $POWERPCMODE = "32bits"; then
1733
    echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1734
  else
1735
    echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1736
  fi
1737
  if test "$powerpc_perf" = "yes"; then
1738
    echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1739
  fi
1740
elif test "$arch" = "mips" ; then
1741
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
1742
  echo "#define ARCH_MIPS 1" >> $TMPH
1743
elif test "$arch" = "sh4" ; then
1744
  echo "TARGET_ARCH_SH4=yes" >> config.mak
1745
  echo "#define ARCH_SH4 1" >> $TMPH
1746
elif test "$arch" = "parisc" ; then
1747
  echo "TARGET_ARCH_PARISC=yes" >> config.mak
1748
  echo "#define ARCH_PARISC 1" >> $TMPH
1749
elif test "$arch" = "s390" ; then
1750
  echo "TARGET_ARCH_S390=yes" >> config.mak
1751
  echo "#define ARCH_S390 1" >> $TMPH
1752
elif test "$arch" = "m68k" ; then
1753
  echo "TARGET_ARCH_M68K=yes" >> config.mak
1754
  echo "#define ARCH_M68K 1" >> $TMPH
1755
elif test "$arch" = "ia64" ; then
1756
  echo "TARGET_ARCH_IA64=yes" >> config.mak
1757
  echo "#define ARCH_IA64 1" >> $TMPH
1758
elif test "$arch" = "bfin" ; then
1759
  echo "TARGET_ARCH_BFIN=yes" >> config.mak
1760
  echo "#define ARCH_BFIN 1" >> $TMPH
1761
fi
1762
echo "#define TUNECPU $TUNECPU" >> $TMPH
1763
if test "$bigendian" = "yes" ; then
1764
  echo "WORDS_BIGENDIAN=yes" >> config.mak
1765
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1766
fi
1767
if test "$inttypes" != "yes" ; then
1768
  echo "#define EMULATE_INTTYPES 1" >> $TMPH
1769
fi
1770
if test "$emu_fast_int" = "yes" ; then
1771
  echo "#define EMULATE_FAST_INT 1" >> $TMPH
1772
fi
1773
if test "$mmx" = "yes" ; then
1774
  echo "TARGET_MMX=yes" >> config.mak
1775
  echo "#define HAVE_MMX 1" >> $TMPH
1776
  echo "#define __CPU__ 586" >> $TMPH
1777
fi
1778
if test "$cmov" = "yes" ; then
1779
  echo "TARGET_CMOV=yes" >> config.mak
1780
  echo "#define HAVE_CMOV 1" >> $TMPH
1781
fi
1782
if test "$cmov_is_fast" = "yes" ; then
1783
  echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
1784
  echo "#define CMOV_IS_FAST 1" >> $TMPH
1785
fi
1786
if test "$armv5te" = "yes" ; then
1787
  echo "TARGET_ARMV5TE=yes" >> config.mak
1788
  echo "#define HAVE_ARMV5TE 1" >> $TMPH
1789
fi
1790
if test "$iwmmxt" = "yes" ; then
1791
  echo "TARGET_IWMMXT=yes" >> config.mak
1792
  echo "#define HAVE_IWMMXT 1" >> $TMPH
1793
fi
1794
if test "$mmi" = "yes" ; then
1795
  echo "TARGET_MMI=yes" >> config.mak
1796
  echo "#define HAVE_MMI 1" >> $TMPH
1797
fi
1798

    
1799
if test "$dcbzl" = "yes" ; then
1800
  echo "#define HAVE_DCBZL 1" >> $TMPH
1801
else
1802
  echo "#undef HAVE_DCBZL" >> $TMPH
1803
fi
1804

    
1805
if test "$altivec" = "yes" ; then
1806
  echo "TARGET_ALTIVEC=yes" >> config.mak
1807
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
1808
  if test "$_altivec_h" = "yes" ; then
1809
    echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1810
  else
1811
    echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1812
  fi
1813
fi
1814
if test "$gprof" = "yes" ; then
1815
  echo "#define HAVE_GPROF 1" >> $TMPH
1816
fi
1817
if test "$localtime_r" = "yes" ; then
1818
  echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1819
fi
1820
if test "$imlib2" = "yes" ; then
1821
  echo "HAVE_IMLIB2=yes" >> config.mak
1822
fi
1823
if test "$freetype2" = "yes" ; then
1824
  echo "HAVE_FREETYPE2=yes" >> config.mak
1825
fi
1826
if test "$sunmlib" = "yes" ; then
1827
  echo "HAVE_MLIB=yes" >> config.mak
1828
  echo "#define HAVE_MLIB 1" >> $TMPH
1829
fi
1830
if test "$pthreads" = "yes" ; then
1831
  echo "HAVE_PTHREADS=yes" >> config.mak
1832
  echo "#define HAVE_PTHREADS 1" >> $TMPH
1833
  echo "#define HAVE_THREADS 1" >> $TMPH
1834
fi
1835
if test "$sdl" = "yes" ; then
1836
  echo "HAVE_SDL=yes" >> config.mak
1837
  echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
1838
  echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
1839
  if test "$sdl_video_size" = "yes"; then
1840
    echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
1841
  fi
1842
fi
1843
if test "$texi2html" = "yes"; then
1844
  echo "BUILD_DOC=yes" >> config.mak
1845
fi
1846
if test "$have_lrintf" = "yes" ; then
1847
  echo "#define HAVE_LRINTF 1" >> $TMPH
1848
fi
1849
if test "$vhook" = "yes" ; then
1850
  echo "CONFIG_VHOOK=yes" >> config.mak
1851
  echo "#define CONFIG_VHOOK 1" >> $TMPH
1852
fi
1853

    
1854
sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
1855
pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
1856
lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1857
lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1858
lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1859

    
1860

    
1861

    
1862
if test "$lshared" = "yes" ; then
1863
  echo "#define BUILD_SHARED_AV 1" >> $TMPH
1864
  echo "BUILD_SHARED=yes" >> config.mak
1865
  echo "PIC=-fPIC -DPIC" >> config.mak
1866
  echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
1867
  echo "SPPVERSION=$lavc_version" >> config.mak
1868
  echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
1869
  echo "LAVCVERSION=$lavc_version" >> config.mak
1870
  echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
1871
  echo "LAVFVERSION=$lavf_version" >> config.mak
1872
  echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
1873
  echo "LAVUVERSION=$lavu_version" >> config.mak
1874
  echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
1875
  echo "SWSVERSION=$sws_version" >> config.mak
1876
  echo "SLIBNAME=${SLIBNAME}" >> config.mak
1877
  echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1878
  echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
1879
  echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
1880
fi
1881
echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
1882
echo "EXTRALIBS=$extralibs" >> config.mak
1883

    
1884
# If you do not want to use encoders, disable them.
1885
if echo "$ENCODER_LIST" | grep -q encoder; then
1886
    echo "#define CONFIG_ENCODERS 1" >> $TMPH
1887
    echo "CONFIG_ENCODERS=yes" >> config.mak
1888
fi
1889

    
1890
# If you do not want to use decoders, disable them.
1891
if echo "$DECODER_LIST" | grep -q decoder; then
1892
    echo "#define CONFIG_DECODERS 1" >> $TMPH
1893
    echo "CONFIG_DECODERS=yes" >> config.mak
1894
fi
1895

    
1896
# muxers
1897
if echo "$MUXER_LIST" | grep -q muxer; then
1898
  echo "#define CONFIG_MUXERS 1" >> $TMPH
1899
  echo "CONFIG_MUXERS=yes" >> config.mak
1900
fi
1901

    
1902
# demuxers
1903
if echo "$DEMUXER_LIST" | grep -q demuxer; then
1904
  echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1905
  echo "CONFIG_DEMUXERS=yes" >> config.mak
1906
fi
1907

    
1908
# AC3
1909
if test "$a52" = "yes" ; then
1910
  echo "#define CONFIG_AC3 1" >> $TMPH
1911
  echo "CONFIG_AC3=yes" >> config.mak
1912

    
1913
  if test "$a52bin" = "yes" ; then
1914
    echo "#define CONFIG_A52BIN 1" >> $TMPH
1915
    echo "CONFIG_A52BIN=yes" >> config.mak
1916
  fi
1917
fi
1918

    
1919
# DTS
1920
if test "$dts" = "yes" ; then
1921
  echo "#define CONFIG_DTS 1" >> $TMPH
1922
  echo "CONFIG_DTS=yes" >> config.mak
1923
fi
1924

    
1925
# PP
1926
if test "$pp" = "yes" ; then
1927
  echo "#define CONFIG_PP 1" >> $TMPH
1928
  echo "CONFIG_PP=yes" >> config.mak
1929
fi
1930

    
1931
if test "$swscaler" = "yes" ; then
1932
  echo "#define CONFIG_SWSCALER 1" >> $TMPH
1933
  echo "CONFIG_SWSCALER=yes" >> config.mak
1934
fi
1935

    
1936
# MPEG audio high precision mode
1937
if test "$mpegaudio_hp" = "yes" ; then
1938
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1939
fi
1940

    
1941
if test "$v4l" = "yes" ; then
1942
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1943
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1944
fi
1945

    
1946
if test "$v4l2" = "yes" ; then
1947
  echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
1948
  echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
1949
fi
1950

    
1951
if test "$bktr" = "yes" ; then
1952
  echo "#define CONFIG_BKTR 1" >> $TMPH
1953
  echo "CONFIG_BKTR=yes" >> config.mak
1954
fi
1955

    
1956
if test "$dv1394" = "yes" ; then
1957
  echo "#define CONFIG_DV1394 1" >> $TMPH
1958
  echo "CONFIG_DV1394=yes" >> config.mak
1959
fi
1960

    
1961
if test "$dc1394" = "yes" ; then
1962
  echo "#define CONFIG_DC1394 1" >> $TMPH
1963
  echo "CONFIG_DC1394=yes" >> config.mak
1964
fi
1965

    
1966
if test "$dlopen" = "yes" ; then
1967
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1968
fi
1969

    
1970
if test "$dlfcn" = "yes" ; then
1971
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1972
fi
1973

    
1974
if test "$audio_oss" = "yes" ; then
1975
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1976
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1977
fi
1978

    
1979
if test "$audio_beos" = "yes" ; then
1980
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1981
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1982
fi
1983

    
1984
if test "$network" = "yes" ; then
1985
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1986
  echo "CONFIG_NETWORK=yes" >> config.mak
1987
fi
1988

    
1989
if test "$ipv6" = "yes" ; then
1990
  echo "#define CONFIG_IPV6 1" >> $TMPH
1991
fi
1992

    
1993
if test "$zlib" = "yes" ; then
1994
  echo "#define CONFIG_ZLIB 1" >> $TMPH
1995
  echo "CONFIG_ZLIB=yes" >> config.mak
1996
fi
1997

    
1998
if test "$libgsm" = "yes" ; then
1999
  echo "#define CONFIG_LIBGSM 1" >> $TMPH
2000
  echo "CONFIG_LIBGSM=yes" >> config.mak
2001
fi
2002

    
2003
if test "$mp3lame" = "yes" ; then
2004
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
2005
  echo "CONFIG_MP3LAME=yes" >> config.mak
2006
fi
2007

    
2008
if test "$libnut" = "yes" ; then
2009
  echo "#define CONFIG_LIBNUT 1" >> $TMPH
2010
  echo "CONFIG_LIBNUT=yes" >> config.mak
2011
fi
2012

    
2013
if test "$libogg" = "yes" ; then
2014
  echo "#define CONFIG_LIBOGG 1" >> $TMPH
2015
  echo "CONFIG_LIBOGG=yes" >> config.mak
2016
fi
2017

    
2018
if test "$vorbis" = "yes" ; then
2019
  echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
2020
  echo "CONFIG_LIBVORBIS=yes" >> config.mak
2021
fi
2022

    
2023
if test "$faad" = "yes" ; then
2024
  echo "#define CONFIG_FAAD 1" >> $TMPH
2025
  echo "CONFIG_FAAD=yes" >> config.mak
2026
fi
2027

    
2028
if test "$faadbin" = "yes" ; then
2029
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
2030
  echo "CONFIG_FAADBIN=yes" >> config.mak
2031
fi
2032

    
2033
if test "$faac" = "yes" ; then
2034
  echo "#define CONFIG_FAAC 1" >> $TMPH
2035
  echo "CONFIG_FAAC=yes" >> config.mak
2036
fi
2037

    
2038
if test "$xvid" = "yes" ; then
2039
  echo "#define CONFIG_XVID 1" >> $TMPH
2040
  echo "CONFIG_XVID=yes" >> config.mak
2041
fi
2042

    
2043
if test "$x264" = "yes" ; then
2044
  echo "#define CONFIG_X264 1" >> $TMPH
2045
  echo "CONFIG_X264=yes" >> config.mak
2046
fi
2047

    
2048
if test "$avisynth" = "yes" ; then
2049
  echo "#define CONFIG_AVISYNTH 1" >> $TMPH
2050
  echo "CONFIG_AVISYNTH=yes" >> config.mak
2051
fi
2052

    
2053
if test "$mingw32" = "yes" ; then
2054
  echo "CONFIG_MINGW=yes" >> config.mak
2055
  echo "HAVE_W32THREADS=yes" >> config.mak
2056
  echo "#define HAVE_W32THREADS 1" >> $TMPH
2057
  echo "#define HAVE_THREADS 1" >> $TMPH
2058
  echo "#ifndef __MINGW32__" >> $TMPH
2059
  echo "#define __MINGW32__ 1" >> $TMPH
2060
  echo "#endif" >> $TMPH
2061
fi
2062

    
2063
if test "$mingwce" = "yes" ; then
2064
  echo "CONFIG_MINGW=yes" >> config.mak
2065
  echo "#define CONFIG_WINCE 1" >> $TMPH
2066
  echo "CONFIG_WINCE=yes" >> config.mak
2067
  echo "#ifndef __MINGW32__" >> $TMPH
2068
  echo "#define __MINGW32__ 1" >> $TMPH
2069
  echo "#endif" >> $TMPH
2070
fi
2071

    
2072
if test "$os2" = "yes" ; then
2073
  echo "#define CONFIG_OS2 1" >> $TMPH
2074
  echo "CONFIG_OS2=yes" >> config.mak
2075
  echo "HAVE_OS2THREADS=yes" >> config.mak
2076
  echo "#define HAVE_OS2THREADS 1" >> $TMPH
2077
  echo "#define HAVE_THREADS 1" >> $TMPH
2078
fi
2079

    
2080
if test "$targetos" = "SunOS" ; then
2081
  echo "#define CONFIG_SUNOS 1" >> $TMPH
2082
fi
2083

    
2084
if test "$targetos" = "BeOS" ; then
2085
  echo "HAVE_BEOSTHREADS=yes" >> config.mak
2086
  echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
2087
  echo "#define HAVE_THREADS 1" >> $TMPH
2088
fi
2089

    
2090
if test "$targetos" = "Darwin"; then
2091
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
2092
  echo "CONFIG_DARWIN=yes" >> config.mak
2093
fi
2094

    
2095
if test "$_malloc_h" = "yes" ; then
2096
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
2097
else
2098
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
2099
fi
2100

    
2101
if test "$_memalign" = "yes" ; then
2102
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
2103
else
2104
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
2105
fi
2106

    
2107
if test "$memalignhack" = "yes" ; then
2108
  echo "#define MEMALIGN_HACK 1" >> $TMPH
2109
fi
2110

    
2111
if test "$byteswap_h" = "yes"; then
2112
  echo "#define HAVE_BYTESWAP_H 1" >> $TMPH
2113
fi
2114

    
2115
if test "$netserver" = "yes" ; then
2116
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
2117
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
2118
fi
2119

    
2120
if test "$need_inet_aton" = "yes" ; then
2121
  echo "NEED_INET_ATON=yes" >> config.mak
2122
fi
2123

    
2124
if test "$simpleidct" = "yes" ; then
2125
  echo "#define SIMPLE_IDCT 1" >> $TMPH
2126
fi
2127

    
2128
if test "$protocols" = "yes" ; then
2129
  echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
2130
  echo "CONFIG_PROTOCOLS=yes" >> config.mak
2131
fi
2132

    
2133
if test "$ffmpeg" = "yes" ; then
2134
  echo "#define CONFIG_FFMPEG 1" >> $TMPH
2135
  echo "CONFIG_FFMPEG=yes" >> config.mak
2136
fi
2137

    
2138
if test "$ffserver" = "yes" ; then
2139
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
2140
  echo "CONFIG_FFSERVER=yes" >> config.mak
2141
fi
2142

    
2143
if test "$ffplay" = "yes" ; then
2144
  echo "CONFIG_FFPLAY=yes" >> config.mak
2145
fi
2146

    
2147
if test "$gpl" = "yes" ; then
2148
  echo "#define CONFIG_GPL 1" >> $TMPH
2149
  echo "CONFIG_GPL=yes" >> config.mak
2150
fi
2151

    
2152
echo "#define restrict $_restrict" >> $TMPH
2153

    
2154
if test "$optimize" = "small"; then
2155
  echo "#define always_inline"  >> $TMPH
2156
  echo "#define CONFIG_SMALL 1" >> $TMPH
2157
fi
2158

    
2159
# build tree in object directory if source path is different from current one
2160
if test "$source_path_used" = "yes" ; then
2161
    DIRS="\
2162
         doc \
2163
         libavformat \
2164
         libavcodec \
2165
         libavcodec/alpha \
2166
         libavcodec/armv4l \
2167
         libavcodec/bfin \
2168
         libavcodec/i386 \
2169
         libavcodec/sparc \
2170
         libavcodec/mlib \
2171
         libavcodec/ppc \
2172
         libavcodec/liba52 \
2173
         libpostproc \
2174
         libavutil \
2175
         libswscale \
2176
         tests \
2177
         vhook \
2178
         "
2179
    FILES="\
2180
          Makefile \
2181
          common.mak \
2182
          libavformat/Makefile \
2183
          libavcodec/Makefile \
2184
          libpostproc/Makefile \
2185
          libavutil/Makefile \
2186
          libswscale/Makefile \
2187
          tests/Makefile \
2188
          vhook/Makefile \
2189
          doc/Makefile \
2190
          doc/texi2pod.pl \
2191
          "
2192
    for dir in $DIRS ; do
2193
            mkdir -p $dir
2194
    done
2195
    for f in $FILES ; do
2196
        ln -sf "$source_path/$f" $f
2197
    done
2198
fi
2199
echo "SRC_PATH=\"$source_path\"" >> config.mak
2200
echo "SRC_PATH_BARE=$source_path" >> config.mak
2201
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2202

    
2203
if test "$amr" = "yes" ; then
2204
  echo "#define CONFIG_AMR 1" >> $TMPH
2205
  echo "CONFIG_AMR=yes" >> config.mak
2206
fi
2207

    
2208
if test "$amr_wb" = "yes" ; then
2209
  echo "#define CONFIG_AMR_WB 1" >> $TMPH
2210
  echo "CONFIG_AMR_WB=yes" >> config.mak
2211
  echo
2212
  echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
2213
  echo "V5.1.0 from "
2214
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
2215
  echo "and extracted the source to libavcodec/amrwb_float"
2216
fi
2217

    
2218
if test "$amr_nb" = "yes" ; then
2219
  echo "#define CONFIG_AMR_NB 1" >> $TMPH
2220
  echo "CONFIG_AMR_NB=yes" >> config.mak
2221
  echo
2222
  echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
2223
  echo "REL-5 V5.1.0 from "
2224
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
2225
  echo "and extracted the source to libavcodec/amr_float"
2226
  echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
2227
fi
2228

    
2229
if test "$amr_nb_fixed" = "yes" ; then
2230
  echo "#define CONFIG_AMR_NB_FIXED 1" >> $TMPH
2231
  echo "CONFIG_AMR_NB_FIXED=yes" >> config.mak
2232
  echo
2233
  echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
2234
  echo "REL-5 version 5.1.0 from "
2235
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
2236
  echo "and extracted src to libavcodec/amr"
2237
  echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
2238
  echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
2239
fi
2240

    
2241
if test "$amr_if2" = "yes" ; then
2242
  echo "AMR_CFLAGS=-DIF2=1" >> config.mak
2243
fi
2244

    
2245
# Apparently it's not possible to portably echo a backslash.
2246
if test "$asmalign_pot" = "yes" ; then
2247
  printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
2248
else
2249
  printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
2250
fi
2251

    
2252

    
2253
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
2254
for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
2255
    echo "#define CONFIG_`echo $codec | tr '[a-z]' '[A-Z]'` 1" >> $TMPH
2256
    echo "CONFIG_`echo $codec | tr '[a-z]' '[A-Z]'`=yes" >> config.mak
2257
done
2258

    
2259
# Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
2260
diff $TMPH config.h >/dev/null 2>&1
2261
if test "$?" != "0" ; then
2262
        mv -f $TMPH config.h
2263
else
2264
        echo "config.h is unchanged"
2265
fi
2266

    
2267
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
2268

    
2269

    
2270
# build pkg-config files libav*.pc and libpostproc.pc
2271
# libavutil.pc
2272
cat <<EOF >libavutil.pc
2273
prefix=$PREFIX
2274
exec_prefix=\${prefix}
2275
libdir=\${exec_prefix}/lib
2276
includedir=\${prefix}/include
2277

    
2278
Name: libavutil
2279
Description: FFmpeg utility library
2280
Version: $lavu_version
2281
Requires:
2282
Conflicts:
2283
Libs: -L\${libdir} -lavutil
2284
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2285
EOF
2286

    
2287
cat <<EOF >libavutil-uninstalled.pc
2288
prefix=
2289
exec_prefix=
2290
libdir=\${pcfiledir}/libavutil
2291
includedir=\${pcfiledir}/libavutil
2292

    
2293
Name: libavutil
2294
Description: FFmpeg utility library
2295
Version: $lavu_version
2296
Requires:
2297
Conflicts:
2298
Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2299
Cflags: -I\${includedir}
2300
EOF
2301

    
2302
# libavcodec.pc
2303
cat <<EOF >libavcodec.pc
2304
prefix=$PREFIX
2305
exec_prefix=\${prefix}
2306
libdir=\${exec_prefix}/lib
2307
includedir=\${prefix}/include
2308

    
2309
Name: libavcodec
2310
Description: FFmpeg codec library
2311
Version: $lavc_version
2312
Requires: $pkg_requires libavutil = $lavu_version
2313
Conflicts:
2314
Libs: -L\${libdir} -lavcodec $extralibs
2315
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2316
EOF
2317

    
2318
cat <<EOF >libavcodec-uninstalled.pc
2319
prefix=
2320
exec_prefix=
2321
libdir=\${pcfiledir}/libavcodec
2322
includedir=\${pcfiledir}/libavcodec
2323

    
2324
Name: libavcodec
2325
Description: FFmpeg codec library
2326
Version: $lavc_version
2327
Requires: $pkg_requires libavutil = $lavu_version
2328
Conflicts:
2329
Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2330
Cflags: -I\${includedir}
2331
EOF
2332

    
2333
# libavformat.pc
2334
cat <<EOF >libavformat.pc
2335
prefix=$PREFIX
2336
exec_prefix=\${prefix}
2337
libdir=\${exec_prefix}/lib
2338
includedir=\${prefix}/include
2339

    
2340
Name: libavformat
2341
Description: FFmpeg container format library
2342
Version: $lavf_version
2343
Requires: $pkg_requires libavcodec = $lavc_version
2344
Conflicts:
2345
Libs: -L\${libdir} -lavformat $extralibs
2346
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2347
EOF
2348

    
2349
cat <<EOF >libavformat-uninstalled.pc
2350
prefix=
2351
exec_prefix=
2352
libdir=\${pcfiledir}/libavformat
2353
includedir=\${pcfiledir}/libavformat
2354

    
2355
Name: libavformat
2356
Description: FFmpeg container format library
2357
Version: $lavf_version
2358
Requires: $pkg_requires libavcodec = $lavc_version
2359
Conflicts:
2360
Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2361
Cflags: -I\${includedir}
2362
EOF
2363

    
2364

    
2365
# libpostproc.pc
2366
cat <<EOF >libpostproc.pc
2367
prefix=$PREFIX
2368
exec_prefix=\${prefix}
2369
libdir=\${exec_prefix}/lib
2370
includedir=\${prefix}/include
2371

    
2372
Name: libpostproc
2373
Description: FFmpeg post processing library
2374
Version: $lavc_version
2375
Requires:
2376
Conflicts:
2377
Libs: -L\${libdir} -lpostproc
2378
Cflags: -I\${includedir} -I\${includedir}/postproc
2379
EOF
2380

    
2381
cat <<EOF >libpostproc-uninstalled.pc
2382
prefix=
2383
exec_prefix=
2384
libdir=\${pcfiledir}/libpostproc
2385
includedir=\${pcfiledir}/libpostproc
2386

    
2387
Name: libpostproc
2388
Description: FFmpeg post processing library
2389
Version: $lavc_version
2390
Requires:
2391
Conflicts:
2392
Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2393
Cflags: -I\${includedir}
2394
EOF
2395

    
2396
# libswscale.pc
2397
cat <<EOF >libswscale.pc
2398
prefix=$PREFIX
2399
exec_prefix=\${prefix}
2400
libdir=\${exec_prefix}/lib
2401
includedir=\${prefix}/include
2402

    
2403
Name: libswscale
2404
Description: FFmpeg image rescaling library
2405
Version: $sws_version
2406
Requires: $pkg_requires libavutil = $lavu_version
2407
Conflicts:
2408
Libs: -L\${libdir} -lswscale
2409
Cflags: -I\${includedir} -I\${includedir}/swscale
2410
EOF
2411

    
2412
cat <<EOF >libswscale-uninstalled.pc
2413
prefix=
2414
exec_prefix=
2415
libdir=\${pcfiledir}/libswscale
2416
includedir=\${pcfiledir}/libswscale
2417

    
2418
Name: libswscale
2419
Description: FFmpeg image rescaling library
2420
Version: $sws_version
2421
Requires: $pkg_requires libavutil = $lavu_version
2422
Conflicts:
2423
Libs: \${libdir}/${LIBPREF}swscale${LIBSUF}
2424
Cflags: -I\${includedir}
2425
EOF