Statistics
| Branch: | Revision:

ffmpeg / configure @ 6194731a

History | View | Annotate | Download (63.8 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-vhook          disable video hooking support"
95
  echo "  --enable-gprof           enable profiling with gprof [$gprof]"
96
  echo "  --disable-debug          disable debugging symbols"
97
  echo "  --disable-opts           disable compiler optimizations"
98
  echo "  --enable-extra-warnings  enable more compiler warnings"
99
  echo "  --disable-mpegaudio-hp   faster (but less accurate)"
100
  echo "                           MPEG audio decoding [default=no]"
101
  echo "  --disable-protocols      disable I/O protocols support [default=no]"
102
  echo "  --disable-ffmpeg         disable ffmpeg build"
103
  echo "  --disable-ffserver       disable ffserver build"
104
  echo "  --disable-ffplay         disable ffplay build"
105
  echo "  --enable-small           optimize for size instead of speed"
106
  echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
107
  echo "  --disable-strip          disable stripping of executables and shared libraries"
108
  echo "  --disable-encoder=NAME   disables encoder NAME"
109
  echo "  --enable-encoder=NAME    enables encoder NAME"
110
  echo "  --disable-decoder=NAME   disables decoder NAME"
111
  echo "  --enable-decoder=NAME    enables decoder NAME"
112
  echo "  --disable-encoders       disables all encoders"
113
  echo "  --disable-decoders       disables all decoders"
114
  echo "  --disable-muxer=NAME     disables muxer NAME"
115
  echo "  --enable-muxer=NAME      enables muxer NAME"
116
  echo "  --disable-muxers         disables all muxers"
117
  echo "  --disable-demuxer=NAME   disables demuxer NAME"
118
  echo "  --enable-demuxer=NAME    enables demuxer NAME"
119
  echo "  --disable-demuxers       disables all demuxers"
120
  echo "  --enable-parser=NAME     enables parser NAME"
121
  echo "  --disable-parser=NAME    disables parser NAME"
122
  echo "  --disable-parsers        disables all parsers"
123
  echo ""
124
  echo "NOTE: Object files are built at the place where configure is launched."
125
  exit 1
126
}
127

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

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

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

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

    
165
set_all(){
166
    value=$1
167
    shift
168
    for var in $*; do
169
        eval $var=$value
170
    done
171
}
172

    
173
enable(){
174
    set_all yes $*
175
}
176

    
177
disable(){
178
    set_all no $*
179
}
180

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

    
185
flags_saved(){
186
    (: ${SAVE_CFLAGS?}) 2>/dev/null
187
}
188

    
189
save_flags(){
190
    flags_saved && return
191
    SAVE_CFLAGS="$CFLAGS"
192
    SAVE_LDFLAGS="$LDFLAGS"
193
    SAVE_extralibs="$extralibs"
194
}
195

    
196
restore_flags(){
197
    CFLAGS="$SAVE_CFLAGS"
198
    LDFLAGS="$SAVE_LDFLAGS"
199
    extralibs="$SAVE_extralibs"
200
    unset SAVE_CFLAGS
201
    unset SAVE_LDFLAGS
202
    unset SAVE_extralibs
203
}
204

    
205
temp_cflags(){
206
    save_flags
207
    CFLAGS="$CFLAGS $*"
208
}
209

    
210
temp_ldflags(){
211
    save_flags
212
    LDFLAGS="$LDFLAGS $*"
213
}
214

    
215
temp_extralibs(){
216
    save_flags
217
    extralibs="$extralibs $*"
218
}
219

    
220
append(){
221
    var=$1
222
    shift
223
    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
224
    eval "$var=\"\$$var $*\""
225
}
226

    
227
add_cflags(){
228
    append CFLAGS "$@"
229
}
230

    
231
add_ldflags(){
232
    append LDFLAGS "$@"
233
}
234

    
235
add_extralibs(){
236
    append extralibs "$@"
237
}
238

    
239
check_cmd(){
240
    log "$@"
241
    "$@" >>$logfile 2>&1
242
}
243

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

    
251
check_cpp(){
252
    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
    log check_cflags "$@"
266
    check_cc "$@" <<EOF && add_cflags "$@"
267
int x;
268
EOF
269
}
270

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

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

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

    
302
check_lib(){
303
    log check_lib "$@"
304
    header="$1"
305
    func="$2"
306
    shift 2
307
    temp_extralibs "$@"
308
    check_header $header && check_func $func && add_extralibs "$@"
309
    err=$?
310
    restore_flags
311
    return $err
312
}
313

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

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

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

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

    
341
# default parameters
342
logging="yes"
343
logfile="config.err"
344
PREFIX="/usr/local"
345
libdir='${PREFIX}/lib'
346
shlibdir="$libdir"
347
incdir='${PREFIX}/include/ffmpeg'
348
mandir='${PREFIX}/man'
349
bindir='${PREFIX}/bin'
350
cross_prefix=""
351
cross_compile="no"
352
cc="gcc"
353
ar="ar"
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"
371
  ;;
372
  x86_64|amd64)
373
    arch="x86_32"
374
    canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
375
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
376
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
377
        arch="x86_64"
378
      fi
379
    fi
380
  ;;
381
  # armv4l is a subset of armv[567]*l
382
  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
  ;;
400
  sh4)
401
    arch="sh4"
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
  ;;
415
  bfin)
416
    arch="bfin"
417
  ;;
418
  *)
419
    arch="unknown"
420
  ;;
421
esac
422
gprof="no"
423
v4l="yes"
424
v4l2="yes"
425
bktr="no"
426
audio_oss="yes"
427
audio_beos="no"
428
dv1394="yes"
429
dc1394="no"
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
faad="no"
439
faadbin="no"
440
faac="no"
441
xvid="no"
442
x264="no"
443
a52="no"
444
a52bin="no"
445
dts="no"
446
pp="no"
447
mingw32="no"
448
mingwce="no"
449
os2="no"
450
lstatic="yes"
451
lshared="no"
452
optimize="yes"
453
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
dlfcn="no"
464
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
LIBPREF="lib"
480
LIBSUF=".a"
481
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
482
SLIBPREF="lib"
483
SLIBSUF=".so"
484
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
485
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
486
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
487
EXESUF=""
488
BUILDSUF=""
489
amr_nb="no"
490
amr_wb="no"
491
amr_nb_fixed="no"
492
amr_if2="no"
493
sunmlib="no"
494
pthreads="no"
495
swscaler="no"
496
gpl="no"
497
memalignhack="no"
498
asmalign_pot="unknown"
499
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
500

    
501
# OS specific
502
targetos=`uname -s`
503
case $targetos in
504
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
case "$gcc_version" in
511
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
512
mmx="no"
513
;;
514
*20010315*) echo "BeBits gcc"
515
add_cflags "-fno-expensive-optimizations"
516
;;
517
esac
518
SHFLAGS=-nostart
519
# disable Linux things
520
audio_oss="no"
521
v4l="no"
522
v4l2="no"
523
dv1394="no"
524
# enable BeOS things
525
audio_beos="yes"
526
# no need for libm, but the inet stuff
527
# Check for BONE
528
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
529
extralibs="-lbind -lsocket"
530
else
531
beos_netserver="yes"
532
need_inet_aton="yes"
533
extralibs="-lnet"
534
fi ;;
535
SunOS)
536
v4l="no"
537
v4l2="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
v4l="no"
549
v4l2="no"
550
bktr="yes"
551
audio_oss="yes"
552
dv1394="no"
553
make="gmake"
554
add_extralibs "-lossaudio"
555
;;
556
OpenBSD)
557
v4l="no"
558
v4l2="no"
559
bktr="yes"
560
audio_oss="yes"
561
dv1394="no"
562
make="gmake"
563
LIBOBJFLAGS="\$(PIC)"
564
LDCONFIG="ldconfig -m \$(shlibdir)"
565
add_extralibs "-lossaudio"
566
;;
567
FreeBSD)
568
v4l="no"
569
v4l2="no"
570
bktr="yes"
571
audio_oss="yes"
572
dv1394="no"
573
make="gmake"
574
add_cflags "-pthread"
575
;;
576
GNU/kFreeBSD)
577
v4l="no"
578
v4l2="no"
579
bktr="yes"
580
audio_oss="yes"
581
dv1394="no"
582
add_cflags "-pthread"
583
;;
584
BSD/OS)
585
v4l="no"
586
v4l2="no"
587
bktr="yes"
588
audio_oss="yes"
589
dv1394="no"
590
extralibs="-lpoll -lgnugetopt -lm"
591
make="gmake"
592
strip="strip -d"
593
installstrip=""
594
;;
595
Darwin)
596
cc="cc"
597
v4l="no"
598
v4l2="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
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
609
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
610
FFSERVERLDFLAGS=-Wl,-bind_at_load
611
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
612
;;
613
MINGW32*)
614
# Note: the rest of the mingw32 config is done afterwards as mingw32
615
# can be forced on the command line for Linux cross compilation.
616
mingw32="yes"
617
;;
618
CYGWIN*)
619
targetos=CYGWIN
620
shlibdir='${PREFIX}/bin'
621
v4l="no"
622
v4l2="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
SLIBPREF="cyg"
630
SLIBSUF=".dll"
631
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
632
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
633
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
v4l="no"
642
v4l2="no"
643
audio_oss="no"
644
make="gmake"
645
;;
646
OS/2)
647
TMPE=$TMPE".exe"
648
ar="emxomfar -p128"
649
ranlib="echo ignoring ranlib"
650
strip="echo ignoring strip"
651
add_cflags "-Zomf"
652
FFLDFLAGS="-Zomf -Zstack 16384 -s"
653
SHFLAGS="-Zdll -Zomf"
654
FFSERVERLDFLAGS=""
655
LIBPREF=""
656
LIBSUF=".lib"
657
SLIBPREF=""
658
SLIBSUF=".dll"
659
EXESUF=".exe"
660
extralibs=""
661
pkg_requires=""
662
v4l="no"
663
v4l2="no"
664
audio_oss="no"
665
dv1394="no"
666
ffserver="no"
667
vhook="no"
668
os2="yes"
669

    
670
;;
671
*)
672
targetos="${targetos}-UNKNOWN"
673
;;
674
esac
675

    
676
# find source path
677
source_path="`dirname \"$0\"`"
678
source_path_used="yes"
679
if test -z "$source_path" -o "$source_path" = "." ; then
680
    source_path="`pwd`"
681
    source_path_used="no"
682
else
683
    source_path="`cd \"$source_path\"; pwd`"
684
    echo "$source_path" | grep -q '[[:blank:]]' &&
685
      die "Out of tree builds are impossible with whitespace in source path."
686
fi
687

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

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

    
697
ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
698
DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
699
PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c"  | sed 's/.*&\(.*\)).*/\1/'`
700
MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
701
DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c"  | sed 's/.*&\(.*\)).*/\1/'`
702

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

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

    
901
if test "$logging" != no; then
902
    test "$logging" = yes || logfile="$logging"
903
    echo "# $0 $@" >$logfile
904
    set >>$logfile
905
else
906
    logfile=/dev/null
907
fi
908

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

    
942
# Combine FFLDFLAGS and the LDFLAGS environment variable.
943
LDFLAGS="$FFLDFLAGS $LDFLAGS"
944

    
945
test -n "$cross_prefix" && cross_compile=yes
946
cc="${cross_prefix}${cc}"
947
ar="${cross_prefix}${ar}"
948
ranlib="${cross_prefix}${ranlib}"
949
strip="${cross_prefix}${strip}"
950

    
951
# we need to build at least one lib type
952
if test "$lstatic" = "no" && test "$lshared" = "no" ; then
953
    cat <<EOF
954
At least one library type must be built.
955
Specify --enable-static to build the static libraries or --enable-shared to
956
build the shared libraries as well. To only build the shared libraries specify
957
--disable-static in addition to --enable-shared.
958
EOF
959
    exit 1;
960
fi
961

    
962
if test "$libvorbis" = "yes" ; then
963
    if test "$libogg" = "no"; then
964
        echo "libogg must be enabled to enable Vorbis."
965
        fail="yes"
966
    fi
967
fi
968

    
969
if test "$gpl" != "yes"; then
970
    if test "$pp" != "no"; then
971
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
972
        fail="yes"
973
    fi
974

    
975
    if test "$a52" != "no" -o "$a52bin" != "no"; then
976
        echo "liba52 is under GPL and --enable-gpl is not specified."
977
        fail="yes"
978
    fi
979

    
980
    if test "$xvid" != "no"; then
981
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
982
        fail="yes"
983
    fi
984

    
985
    if test "$x264" != "no"; then
986
        echo "x264 is under GPL and --enable-gpl is not specified."
987
        fail="yes"
988
    fi
989

    
990
    if test "$dts" != "no"; then
991
        echo "libdts is under GPL and --enable-gpl is not specified."
992
        fail="yes"
993
    fi
994

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

    
1015
    if test "$swscaler" != "no"; then
1016
        echo "The software scaler is under GPL and --enable-gpl is not specified."
1017
        fail="yes"
1018
    fi
1019
fi
1020

    
1021
if test "$fail" = "yes"; then
1022
    exit 1
1023
fi
1024

    
1025
# compute MMX state
1026
if test $mmx = "default"; then
1027
    if test $arch = "x86_32" -o $arch = "x86_64"; then
1028
        mmx="yes"
1029
    else
1030
        mmx="no"
1031
    fi
1032
fi
1033

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

    
1061
if test $optimize != "no"; then
1062
    add_cflags "-fomit-frame-pointer"
1063
fi
1064

    
1065
# Can only do AltiVec on PowerPC
1066
if test $altivec = "default"; then
1067
    if test $arch = "powerpc"; then
1068
        altivec="yes"
1069
    else
1070
        altivec="no"
1071
    fi
1072
fi
1073

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

    
1155
# make sure we can execute files in $TMPDIR
1156
cat >$TMPE 2>>$logfile <<EOF
1157
#! /bin/sh
1158
EOF
1159
chmod +x $TMPE >>$logfile 2>&1
1160
if ! $TMPE >>$logfile 2>&1; then
1161
    cat <<EOF
1162
Unable to create and execute files in $TMPDIR1.  Set the TMPDIR environment
1163
variable to another directory and make sure that $TMPDIR1 is not mounted
1164
noexec.
1165
EOF
1166
    die "Sanity test failed."
1167
fi
1168
rm $TMPE
1169

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

    
1185
# check for assembler specific support
1186

    
1187
if test $arch = "powerpc"; then
1188
check_cc <<EOF && dcbzl=yes
1189
int main(void) {
1190
    register long zero = 0;
1191
    char data[1024];
1192
    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1193
return 0;
1194
}
1195
EOF
1196
fi
1197

    
1198
# check for SIMD availability
1199

    
1200
# AltiVec flags: The FSF version of GCC differs from the Apple version
1201
if test $arch = "powerpc"; then
1202
    if test $altivec = "yes"; then
1203
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
1204
            add_cflags "-faltivec"
1205
        else
1206
            add_cflags "-maltivec -mabi=altivec"
1207
        fi
1208
    fi
1209
fi
1210

    
1211
check_header altivec.h && _altivec_h=yes || _altivec_h=no
1212

    
1213
# check if our compiler supports Motorola AltiVec C API
1214
if test $altivec = "yes"; then
1215
    if test $_altivec_h = "yes"; then
1216
        inc_altivec_h="#include <altivec.h>"
1217
    else
1218
        inc_altivec_h=
1219
    fi
1220
    check_cc <<EOF || altivec=no
1221
$inc_altivec_h
1222
int main(void) {
1223
    vector signed int v1, v2, v3;
1224
    v1 = vec_add(v2,v3);
1225
    return 0;
1226
}
1227
EOF
1228
fi
1229

    
1230
# check armv5te instructions support
1231
if test $armv5te = "default" -a $arch = "armv4l"; then
1232
    armv5te=no
1233
    check_cc <<EOF && armv5te=yes
1234
        int main(void) {
1235
        __asm__ __volatile__ ("qadd r0, r0, r0");
1236
        }
1237
EOF
1238
fi
1239

    
1240
# check iwmmxt support
1241
if test $iwmmxt = "default" -a $arch = "armv4l"; then
1242
    iwmmxt=no
1243
    check_cc <<EOF && iwmmxt=yes
1244
        int main(void) {
1245
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
1246
        }
1247
EOF
1248
fi
1249

    
1250
# mmi only available on mips
1251
if test $mmi = "default"; then
1252
    if test $arch = "mips"; then
1253
        mmi="yes"
1254
    else
1255
        mmi="no"
1256
    fi
1257
fi
1258

    
1259
# check if our compiler supports mmi
1260
enabled mmi && check_cc <<EOF || mmi="no"
1261
int main(void) {
1262
    __asm__ ("lq \$2, 0(\$2)");
1263
    return 0;
1264
}
1265
EOF
1266

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

    
1284
# ---
1285
# *inttypes.h* test
1286
check_header inttypes.h || inttypes=no
1287

    
1288
# ---
1289
# *int_fast* test
1290
check_cc <<EOF || emu_fast_int=yes
1291
#include <inttypes.h>
1292
int main(int argc, char ** argv){
1293
        volatile uint_fast64_t i=0x01234567;
1294
        return 0;
1295
}
1296
EOF
1297

    
1298
# ---
1299
# check availability of some header files
1300

    
1301
_memalign=no
1302
malloc_h=no
1303
if check_header malloc.h; then
1304
    malloc_h=yes
1305
    _memalign=yes
1306
    check_func memalign || _memalign="no"
1307
fi
1308

    
1309
if test "$_memalign" = "no" -a "$mmx" = "yes" -a \
1310
        "$memalignhack" != "yes" -a "$targetos" != "Darwin" -a \
1311
        "$targetos" != "FreeBSD" ; then
1312
    die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1313
fi
1314

    
1315
check_header byteswap.h && byteswap_h=yes || byteswap_h=no
1316

    
1317
check_func localtime_r && localtime_r=yes || localtime_r=no
1318
enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1319

    
1320
# check for some common methods of building with pthread support
1321
# do this before the optional library checks as some of them require pthreads
1322
if enabled pthreads; then
1323
    { check_cflags -pthread && check_ldflags -pthread; } ||
1324
    { check_cflags -pthreads && check_ldflags -pthreads; } ||
1325
    check_lib pthread.h pthread_create -lpthread ||
1326
    check_func pthread_create ||
1327
    die "ERROR: can't find pthreads library"
1328
fi
1329

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

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

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

    
1374
# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1375
if enabled avisynth; then
1376
    save_flags
1377
    temp_extralibs -lvfw32
1378
    check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1379
#include <windows.h>
1380
#include <vfw.h>
1381
int main(){
1382
    AVIFileInit();
1383
    return 0;
1384
}
1385
EOF
1386
    restore_flags
1387
fi
1388

    
1389

    
1390
# test for lrintf in math.h
1391
check_exec <<EOF && have_lrintf=yes || have_lrintf=no
1392
#define _ISOC9X_SOURCE  1
1393
#include <math.h>
1394
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1395
EOF
1396

    
1397
_restrict=
1398
for restrict_keyword in restrict __restrict__ __restrict; do
1399
    check_cc <<EOF && _restrict=$restrict_keyword && break
1400
void foo(char * $restrict_keyword p);
1401
EOF
1402
done
1403

    
1404
# dlopen/dlfcn.h probing
1405

    
1406
check_header dlfcn.h && dlfcn=yes
1407

    
1408
temp_extralibs -ldl
1409
if check_func dlopen; then
1410
    dlopen=yes
1411
    ldl=-ldl
1412
fi
1413
restore_flags
1414

    
1415
if check_func dlopen; then
1416
    dlopen=yes
1417
    ldl=
1418
fi
1419

    
1420
if test "$vhook" = "default"; then
1421
    vhook="$dlopen"
1422
fi
1423

    
1424
if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
1425
    add_extralibs $ldl
1426
fi
1427

    
1428
if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1429
    vhook="no"
1430
    echo
1431
    echo "At the moment vhooks don't work on Cygwin static builds."
1432
    echo "Patches welcome."
1433
    echo
1434
fi
1435

    
1436
if enabled vhook; then
1437
    check_ldflags -rdynamic
1438
    check_ldflags -export-dynamic
1439
fi
1440

    
1441
##########################################
1442
# imlib check
1443

    
1444
temp_extralibs -lImlib2
1445
check_ld <<EOF && imlib2=yes || imlib2=no
1446
#include <X11/Xlib.h>
1447
#include <Imlib2.h>
1448
int main( void ) { return (int) imlib_load_font("foo"); }
1449
EOF
1450
restore_flags
1451

    
1452
##########################################
1453
# FreeType check
1454

    
1455
freetype2=no
1456
if test "x$targetos" != "xBeOS"; then
1457
  if (freetype-config --version) >/dev/null 2>&1 ; then
1458
      temp_cflags `freetype-config --cflags`
1459
      temp_extralibs `freetype-config --libs`
1460
      check_ld <<EOF && freetype2=yes
1461
#include <ft2build.h>
1462
int main( void ) { return (int) FT_Init_FreeType(0); }
1463
EOF
1464
      restore_flags
1465
  fi
1466
fi
1467

    
1468
##########################################
1469
# SDL check
1470

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

    
1501
enabled sdl || ffplay=no
1502

    
1503
##########################################
1504
# texi2html check
1505

    
1506
texi2html=no
1507
if (texi2html -version) >/dev/null 2>&1; then
1508
texi2html=yes
1509
fi
1510

    
1511
##########################################
1512
# IPv6 check
1513

    
1514
enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
1515
#include <sys/types.h>
1516
#include <sys/socket.h>
1517
#include <netinet/in.h>
1518
#include <netdb.h>
1519
int main( void ) {
1520
  struct sockaddr_storage saddr;
1521
  struct ipv6_mreq mreq6;
1522
  getaddrinfo(0,0,0,0);
1523
  getnameinfo(0,0,0,0,0,0,0);
1524
  IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1525
}
1526
EOF
1527

    
1528
# check for video4linux2 --- V4L2_PIX_FMT_YUV420
1529
enabled v4l2 && check_cc <<EOF || v4l2="no"
1530
#include <sys/time.h>
1531
#include <asm/types.h>
1532
#include <linux/videodev2.h>
1533
int dummy = V4L2_PIX_FMT_YUV420;
1534
struct v4l2_buffer dummy1;
1535
EOF
1536

    
1537
enabled debug && add_cflags -g
1538

    
1539
# add some useful compiler flags if supported
1540
check_cflags -Wdeclaration-after-statement
1541
check_cflags -Wall
1542
check_cflags -Wno-switch
1543
check_cflags -Wdisabled-optimization
1544
check_cflags -Wpointer-arith
1545
check_cflags -Wredundant-decls
1546
enabled extrawarnings && check_cflags -Winline
1547

    
1548
# add some linker flags
1549
check_ldflags $LDLATEFLAGS
1550

    
1551
# not all compilers support -Os
1552
test "$optimize" = "small" && check_cflags -Os
1553

    
1554
if enabled optimize; then
1555
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1556
        add_cflags  "-O5"
1557
        add_ldflags "-O5"
1558
    else
1559
        add_cflags "-O3"
1560
    fi
1561
fi
1562

    
1563
# PIC flags for shared library objects where they are needed
1564
if test "$lshared" = "yes" ; then
1565
    # LIBOBJFLAGS may have already been set in the OS configuration
1566
    if test -z "$LIBOBJFLAGS" ; then
1567
        case "$arch" in
1568
            x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1569
        esac
1570
    fi
1571
fi
1572

    
1573
if test "$gprof" = "yes" ; then
1574
    add_cflags  "-p"
1575
    add_ldflags "-p"
1576
fi
1577

    
1578
# find if .align arg is power-of-two or not
1579
if test $asmalign_pot = "unknown"; then
1580
    asmalign_pot="no"
1581
    echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1582
fi
1583

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

    
1640
if test "$vhook" = "yes"; then
1641
    echo "Imlib2 support   $imlib2"
1642
    echo "FreeType support $freetype2"
1643
fi
1644
echo "Sun medialib support"  $sunmlib
1645
echo "pthreads support"      $pthreads
1646
echo "AMR-NB float support"  $amr_nb
1647
echo "AMR-NB fixed support"  $amr_nb_fixed
1648
echo "AMR-WB float support"  $amr_wb
1649
echo "AMR-WB IF2 support"    $amr_if2
1650
echo "network support      $network"
1651
if test "$network" = "yes" ; then
1652
    echo "IPv6 support         $ipv6"
1653
fi
1654
echo ".align is power-of-two" $asmalign_pot
1655
if test "$gpl" = "no" ; then
1656
    echo "License: LGPL"
1657
else
1658
    echo "License: GPL"
1659
fi
1660

    
1661
echo "Creating config.mak and config.h..."
1662

    
1663
date >> config.log
1664
echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1665
echo "# Automatically generated by configure - do not modify!" > config.mak
1666
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1667
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1668

    
1669
echo "PREFIX=$PREFIX" >> config.mak
1670
echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
1671
echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1672
echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1673
echo "incdir=\$(DESTDIR)$incdir" >> config.mak
1674
echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1675
echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1676
echo "MAKE=$make" >> config.mak
1677
echo "CC=$cc" >> config.mak
1678
echo "AR=$ar" >> config.mak
1679
echo "RANLIB=$ranlib" >> config.mak
1680
if test "$dostrip" = "yes" ; then
1681
    echo "STRIP=$strip" >> config.mak
1682
    echo "INSTALLSTRIP=$installstrip" >> config.mak
1683
else
1684
    echo "STRIP=echo ignoring strip" >> config.mak
1685
    echo "INSTALLSTRIP=" >> config.mak
1686
fi
1687

    
1688
VHOOKCFLAGS="-fPIC $CFLAGS"
1689
test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
1690

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

    
1807
if test "$dcbzl" = "yes" ; then
1808
  echo "#define HAVE_DCBZL 1" >> $TMPH
1809
else
1810
  echo "#undef HAVE_DCBZL" >> $TMPH
1811
fi
1812

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

    
1862
sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
1863
pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
1864
lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1865
lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1866
lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1867

    
1868

    
1869

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

    
1892
# If you do not want to use encoders, disable them.
1893
if echo "$ENCODER_LIST" | grep -q encoder; then
1894
    echo "#define CONFIG_ENCODERS 1" >> $TMPH
1895
    echo "CONFIG_ENCODERS=yes" >> config.mak
1896
fi
1897

    
1898
# If you do not want to use decoders, disable them.
1899
if echo "$DECODER_LIST" | grep -q decoder; then
1900
    echo "#define CONFIG_DECODERS 1" >> $TMPH
1901
    echo "CONFIG_DECODERS=yes" >> config.mak
1902
fi
1903

    
1904
# muxers
1905
if echo "$MUXER_LIST" | grep -q muxer; then
1906
  echo "#define CONFIG_MUXERS 1" >> $TMPH
1907
  echo "CONFIG_MUXERS=yes" >> config.mak
1908
fi
1909

    
1910
# demuxers
1911
if echo "$DEMUXER_LIST" | grep -q demuxer; then
1912
  echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1913
  echo "CONFIG_DEMUXERS=yes" >> config.mak
1914
fi
1915

    
1916
# AC3
1917
if test "$a52" = "yes" ; then
1918
  echo "#define CONFIG_A52 1" >> $TMPH
1919
  echo "CONFIG_A52=yes" >> config.mak
1920

    
1921
  if test "$a52bin" = "yes" ; then
1922
    echo "#define CONFIG_A52BIN 1" >> $TMPH
1923
    echo "CONFIG_A52BIN=yes" >> config.mak
1924
  fi
1925
fi
1926

    
1927
# DTS
1928
if test "$dts" = "yes" ; then
1929
  echo "#define CONFIG_DTS 1" >> $TMPH
1930
  echo "CONFIG_DTS=yes" >> config.mak
1931
fi
1932

    
1933
# PP
1934
if test "$pp" = "yes" ; then
1935
  echo "#define CONFIG_PP 1" >> $TMPH
1936
  echo "CONFIG_PP=yes" >> config.mak
1937
fi
1938

    
1939
if test "$swscaler" = "yes" ; then
1940
  echo "#define CONFIG_SWSCALER 1" >> $TMPH
1941
  echo "CONFIG_SWSCALER=yes" >> config.mak
1942
fi
1943

    
1944
# MPEG audio high precision mode
1945
if test "$mpegaudio_hp" = "yes" ; then
1946
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1947
fi
1948

    
1949
if test "$v4l" = "yes" ; then
1950
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1951
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1952
fi
1953

    
1954
if test "$v4l2" = "yes" ; then
1955
  echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
1956
  echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
1957
fi
1958

    
1959
if test "$bktr" = "yes" ; then
1960
  echo "#define CONFIG_BKTR 1" >> $TMPH
1961
  echo "CONFIG_BKTR=yes" >> config.mak
1962
fi
1963

    
1964
if test "$dv1394" = "yes" ; then
1965
  echo "#define CONFIG_DV1394 1" >> $TMPH
1966
  echo "CONFIG_DV1394=yes" >> config.mak
1967
fi
1968

    
1969
if test "$dc1394" = "yes" ; then
1970
  echo "#define CONFIG_DC1394 1" >> $TMPH
1971
  echo "CONFIG_DC1394=yes" >> config.mak
1972
fi
1973

    
1974
if test "$dlopen" = "yes" ; then
1975
  echo "#define HAVE_DLOPEN 1" >> $TMPH
1976
fi
1977

    
1978
if test "$dlfcn" = "yes" ; then
1979
  echo "#define HAVE_DLFCN 1" >> $TMPH
1980
fi
1981

    
1982
if test "$audio_oss" = "yes" ; then
1983
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1984
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1985
fi
1986

    
1987
if test "$audio_beos" = "yes" ; then
1988
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1989
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1990
fi
1991

    
1992
if test "$network" = "yes" ; then
1993
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1994
  echo "CONFIG_NETWORK=yes" >> config.mak
1995
fi
1996

    
1997
if test "$ipv6" = "yes" ; then
1998
  echo "#define CONFIG_IPV6 1" >> $TMPH
1999
fi
2000

    
2001
if test "$zlib" = "yes" ; then
2002
  echo "#define CONFIG_ZLIB 1" >> $TMPH
2003
  echo "CONFIG_ZLIB=yes" >> config.mak
2004
fi
2005

    
2006
if test "$libgsm" = "yes" ; then
2007
  echo "#define CONFIG_LIBGSM 1" >> $TMPH
2008
  echo "CONFIG_LIBGSM=yes" >> config.mak
2009
fi
2010

    
2011
if test "$mp3lame" = "yes" ; then
2012
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
2013
  echo "CONFIG_MP3LAME=yes" >> config.mak
2014
fi
2015

    
2016
if test "$libnut" = "yes" ; then
2017
  echo "#define CONFIG_LIBNUT 1" >> $TMPH
2018
  echo "CONFIG_LIBNUT=yes" >> config.mak
2019
fi
2020

    
2021
if test "$libogg" = "yes" ; then
2022
  echo "#define CONFIG_LIBOGG 1" >> $TMPH
2023
  echo "CONFIG_LIBOGG=yes" >> config.mak
2024
fi
2025

    
2026
if test "$libvorbis" = "yes" ; then
2027
  echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
2028
  echo "CONFIG_LIBVORBIS=yes" >> config.mak
2029
fi
2030

    
2031
if test "$faad" = "yes" ; then
2032
  echo "#define CONFIG_FAAD 1" >> $TMPH
2033
  echo "CONFIG_FAAD=yes" >> config.mak
2034
fi
2035

    
2036
if test "$faadbin" = "yes" ; then
2037
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
2038
  echo "CONFIG_FAADBIN=yes" >> config.mak
2039
fi
2040

    
2041
if test "$faac" = "yes" ; then
2042
  echo "#define CONFIG_FAAC 1" >> $TMPH
2043
  echo "CONFIG_FAAC=yes" >> config.mak
2044
fi
2045

    
2046
if test "$xvid" = "yes" ; then
2047
  echo "#define CONFIG_XVID 1" >> $TMPH
2048
  echo "CONFIG_XVID=yes" >> config.mak
2049
fi
2050

    
2051
if test "$x264" = "yes" ; then
2052
  echo "#define CONFIG_X264 1" >> $TMPH
2053
  echo "CONFIG_X264=yes" >> config.mak
2054
fi
2055

    
2056
if test "$avisynth" = "yes" ; then
2057
  echo "#define CONFIG_AVISYNTH 1" >> $TMPH
2058
  echo "CONFIG_AVISYNTH=yes" >> config.mak
2059
fi
2060

    
2061
if test "$mingw32" = "yes" ; then
2062
  echo "CONFIG_MINGW=yes" >> config.mak
2063
  echo "HAVE_W32THREADS=yes" >> config.mak
2064
  echo "#define HAVE_W32THREADS 1" >> $TMPH
2065
  echo "#define HAVE_THREADS 1" >> $TMPH
2066
  echo "#ifndef __MINGW32__" >> $TMPH
2067
  echo "#define __MINGW32__ 1" >> $TMPH
2068
  echo "#endif" >> $TMPH
2069
fi
2070

    
2071
if test "$mingwce" = "yes" ; then
2072
  echo "CONFIG_MINGW=yes" >> config.mak
2073
  echo "#define CONFIG_WINCE 1" >> $TMPH
2074
  echo "CONFIG_WINCE=yes" >> config.mak
2075
  echo "#ifndef __MINGW32__" >> $TMPH
2076
  echo "#define __MINGW32__ 1" >> $TMPH
2077
  echo "#endif" >> $TMPH
2078
fi
2079

    
2080
if test "$os2" = "yes" ; then
2081
  echo "#define CONFIG_OS2 1" >> $TMPH
2082
  echo "CONFIG_OS2=yes" >> config.mak
2083
  echo "HAVE_OS2THREADS=yes" >> config.mak
2084
  echo "#define HAVE_OS2THREADS 1" >> $TMPH
2085
  echo "#define HAVE_THREADS 1" >> $TMPH
2086
fi
2087

    
2088
if test "$targetos" = "SunOS" ; then
2089
  echo "#define CONFIG_SUNOS 1" >> $TMPH
2090
fi
2091

    
2092
if test "$targetos" = "BeOS" ; then
2093
  echo "HAVE_BEOSTHREADS=yes" >> config.mak
2094
  echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
2095
  echo "#define HAVE_THREADS 1" >> $TMPH
2096
fi
2097

    
2098
if test "$targetos" = "Darwin"; then
2099
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
2100
  echo "CONFIG_DARWIN=yes" >> config.mak
2101
fi
2102

    
2103
if test "$malloc_h" = "yes" ; then
2104
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
2105
else
2106
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
2107
fi
2108

    
2109
if test "$_memalign" = "yes" ; then
2110
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
2111
else
2112
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
2113
fi
2114

    
2115
if test "$memalignhack" = "yes" ; then
2116
  echo "#define MEMALIGN_HACK 1" >> $TMPH
2117
fi
2118

    
2119
if test "$byteswap_h" = "yes"; then
2120
  echo "#define HAVE_BYTESWAP_H 1" >> $TMPH
2121
fi
2122

    
2123
if test "$beos_netserver" = "yes" ; then
2124
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
2125
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
2126
fi
2127

    
2128
if test "$need_inet_aton" = "yes" ; then
2129
  echo "NEED_INET_ATON=yes" >> config.mak
2130
fi
2131

    
2132
if test "$protocols" = "yes" ; then
2133
  echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
2134
  echo "CONFIG_PROTOCOLS=yes" >> config.mak
2135
fi
2136

    
2137
if test "$ffmpeg" = "yes" ; then
2138
  echo "#define CONFIG_FFMPEG 1" >> $TMPH
2139
  echo "CONFIG_FFMPEG=yes" >> config.mak
2140
fi
2141

    
2142
if test "$ffserver" = "yes" ; then
2143
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
2144
  echo "CONFIG_FFSERVER=yes" >> config.mak
2145
fi
2146

    
2147
if test "$ffplay" = "yes" ; then
2148
  echo "CONFIG_FFPLAY=yes" >> config.mak
2149
fi
2150

    
2151
if test "$gpl" = "yes" ; then
2152
  echo "#define CONFIG_GPL 1" >> $TMPH
2153
  echo "CONFIG_GPL=yes" >> config.mak
2154
fi
2155

    
2156
echo "#define restrict $_restrict" >> $TMPH
2157

    
2158
if test "$optimize" = "small"; then
2159
  echo "#define always_inline"  >> $TMPH
2160
  echo "#define CONFIG_SMALL 1" >> $TMPH
2161
fi
2162

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

    
2207
if test "$amr" = "yes" ; then
2208
  echo "#define CONFIG_AMR 1" >> $TMPH
2209
  echo "CONFIG_AMR=yes" >> config.mak
2210
fi
2211

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

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

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

    
2245
if test "$amr_if2" = "yes" ; then
2246
  echo "AMR_CFLAGS=-DIF2=1" >> config.mak
2247
fi
2248

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

    
2256

    
2257
# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
2258
for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
2259
    ucname="`echo $codec | tr '[a-z]' '[A-Z]'`"
2260
    config_name="CONFIG_$ucname"
2261
    enabled_name="ENABLE_$ucname"
2262
    if enabled $codec; then
2263
        echo "#define $config_name 1" >> $TMPH
2264
        echo "#define $enabled_name 1" >> $TMPH
2265
        echo "$config_name=yes" >> config.mak
2266
    else
2267
        echo "#define $enabled_name 0" >> $TMPH
2268
    fi
2269
done
2270

    
2271
# Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
2272
diff $TMPH config.h >/dev/null 2>&1
2273
if test "$?" != "0" ; then
2274
        mv -f $TMPH config.h
2275
else
2276
        echo "config.h is unchanged"
2277
fi
2278

    
2279
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
2280

    
2281

    
2282
# build pkg-config files libav*.pc and libpostproc.pc
2283
# libavutil.pc
2284
cat <<EOF >libavutil.pc
2285
prefix=$PREFIX
2286
exec_prefix=\${prefix}
2287
libdir=\${exec_prefix}/lib
2288
includedir=\${prefix}/include
2289

    
2290
Name: libavutil
2291
Description: FFmpeg utility library
2292
Version: $lavu_version
2293
Requires:
2294
Conflicts:
2295
Libs: -L\${libdir} -lavutil
2296
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2297
EOF
2298

    
2299
cat <<EOF >libavutil-uninstalled.pc
2300
prefix=
2301
exec_prefix=
2302
libdir=\${pcfiledir}/libavutil
2303
includedir=\${pcfiledir}/libavutil
2304

    
2305
Name: libavutil
2306
Description: FFmpeg utility library
2307
Version: $lavu_version
2308
Requires:
2309
Conflicts:
2310
Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2311
Cflags: -I\${includedir}
2312
EOF
2313

    
2314
# libavcodec.pc
2315
cat <<EOF >libavcodec.pc
2316
prefix=$PREFIX
2317
exec_prefix=\${prefix}
2318
libdir=\${exec_prefix}/lib
2319
includedir=\${prefix}/include
2320

    
2321
Name: libavcodec
2322
Description: FFmpeg codec library
2323
Version: $lavc_version
2324
Requires: $pkg_requires libavutil = $lavu_version
2325
Conflicts:
2326
Libs: -L\${libdir} -lavcodec $extralibs
2327
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2328
EOF
2329

    
2330
cat <<EOF >libavcodec-uninstalled.pc
2331
prefix=
2332
exec_prefix=
2333
libdir=\${pcfiledir}/libavcodec
2334
includedir=\${pcfiledir}/libavcodec
2335

    
2336
Name: libavcodec
2337
Description: FFmpeg codec library
2338
Version: $lavc_version
2339
Requires: $pkg_requires libavutil = $lavu_version
2340
Conflicts:
2341
Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2342
Cflags: -I\${includedir}
2343
EOF
2344

    
2345
# libavformat.pc
2346
cat <<EOF >libavformat.pc
2347
prefix=$PREFIX
2348
exec_prefix=\${prefix}
2349
libdir=\${exec_prefix}/lib
2350
includedir=\${prefix}/include
2351

    
2352
Name: libavformat
2353
Description: FFmpeg container format library
2354
Version: $lavf_version
2355
Requires: $pkg_requires libavcodec = $lavc_version
2356
Conflicts:
2357
Libs: -L\${libdir} -lavformat $extralibs
2358
Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2359
EOF
2360

    
2361
cat <<EOF >libavformat-uninstalled.pc
2362
prefix=
2363
exec_prefix=
2364
libdir=\${pcfiledir}/libavformat
2365
includedir=\${pcfiledir}/libavformat
2366

    
2367
Name: libavformat
2368
Description: FFmpeg container format library
2369
Version: $lavf_version
2370
Requires: $pkg_requires libavcodec = $lavc_version
2371
Conflicts:
2372
Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2373
Cflags: -I\${includedir}
2374
EOF
2375

    
2376

    
2377
# libpostproc.pc
2378
cat <<EOF >libpostproc.pc
2379
prefix=$PREFIX
2380
exec_prefix=\${prefix}
2381
libdir=\${exec_prefix}/lib
2382
includedir=\${prefix}/include
2383

    
2384
Name: libpostproc
2385
Description: FFmpeg post processing library
2386
Version: $lavc_version
2387
Requires:
2388
Conflicts:
2389
Libs: -L\${libdir} -lpostproc
2390
Cflags: -I\${includedir} -I\${includedir}/postproc
2391
EOF
2392

    
2393
cat <<EOF >libpostproc-uninstalled.pc
2394
prefix=
2395
exec_prefix=
2396
libdir=\${pcfiledir}/libpostproc
2397
includedir=\${pcfiledir}/libpostproc
2398

    
2399
Name: libpostproc
2400
Description: FFmpeg post processing library
2401
Version: $lavc_version
2402
Requires:
2403
Conflicts:
2404
Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2405
Cflags: -I\${includedir}
2406
EOF
2407

    
2408
if test "$swscaler" != "no"; then
2409
  sws_pc_libs="-L\${libdir} -lswscale"
2410
  sws_pc_uninstalled_libs="\${libdir}/${LIBPREF}swscale${LIBSUF}"
2411
  sws_pc_requires="$pkg_requires libavutil = $lavu_version"
2412
else
2413
  sws_pc_libs=""
2414
  sws_pc_uninstalled_libs=""
2415
  sws_pc_requires="$pkg_requires libavcodec = $lavc_version"
2416
fi
2417
# libswscale.pc
2418
cat <<EOF >libswscale.pc
2419
prefix=$PREFIX
2420
exec_prefix=\${prefix}
2421
libdir=\${exec_prefix}/lib
2422
includedir=\${prefix}/include
2423

    
2424
Name: libswscale
2425
Description: FFmpeg image rescaling library
2426
Version: $sws_version
2427
Requires: $sws_pc_requires
2428
Conflicts:
2429
Libs: $sws_pc_libs
2430
Cflags: -I\${includedir} -I\${includedir}/swscale
2431
EOF
2432

    
2433
cat <<EOF >libswscale-uninstalled.pc
2434
prefix=
2435
exec_prefix=
2436
libdir=\${pcfiledir}/libswscale
2437
includedir=\${pcfiledir}/libswscale
2438

    
2439
Name: libswscale
2440
Description: FFmpeg image rescaling library
2441
Version: $sws_version
2442
Requires: $sws_pc_requires
2443
Conflicts:
2444
Libs: $sws_pc_uninstalled_libs
2445
Cflags: -I\${includedir}
2446
EOF