Statistics
| Branch: | Revision:

ffmpeg / configure @ 009cf97d

History | View | Annotate | Download (39.1 KB)

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

    
6
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
7
cat << EOF
8

    
9
Usage: configure [options]
10
Options: [defaults in brackets after descriptions]
11

    
12
EOF
13
echo "Standard options:"
14
echo "  --help                   print this message"
15
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
16
echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
17
echo "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
18
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
19
echo "  --enable-libogg          enable ogg support via libogg [default=no]"
20
echo "  --enable-vorbis          enable vorbis support via libvorbis [default=no]"
21
echo "  --enable-theora          enable theora support via libtheora [default=no]"
22
echo "  --enable-faad            enable faad support via libfaad [default=no]"
23
echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
24
echo "  --enable-faac            enable faac support via libfaac [default=no]"
25
echo "  --enable-xvid            enable xvid support via xvidcore [default=no]"
26
echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
27
echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
28
echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
29
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
30
echo "  --enable-dts             enable GPL'ed DTS support [default=no]"
31
echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
32
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
33
echo "  --enable-shared          build shared libraries [default=no]"
34
echo "  --enable-amr_nb          enable amr_nb float audio codec"
35
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
36
echo "  --enable-amr_wb          enable amr_wb float audio codec"
37
echo "  --enable-sunmlib         use Sun medialib [default=no]"
38
echo "  --enable-pthreads        use pthreads [default=no]"
39
echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]"
40
echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
41
echo ""
42
echo "Advanced options (experts only):"
43
echo "  --source-path=PATH       path of source code [$source_path]"
44
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
45
echo "  --cc=CC                  use C compiler CC [$cc]"
46
echo "  --make=MAKE              use specified make [$make]"
47
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
48
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
49
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
50
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
51
echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
52
echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
53
echo "  --disable-mmx            disable mmx usage"
54
echo "  --disable-altivec        disable AltiVec usage"
55
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
56
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
57
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
58
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
59
echo "  --disable-network        disable network support [default=no]"
60
echo "  --disable-zlib           disable zlib [default=no]"
61
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
62
echo "  --disable-vhook          disable video hooking support"
63
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
64
echo "  --disable-debug          disable debugging symbols"
65
echo "  --disable-opts           disable compiler optimizations"
66
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
67
echo "                           mpegaudio decoding [default=no]"
68
echo "  --disable-ffserver       disable ffserver build"
69
echo "  --disable-ffplay         disable ffplay build"
70
echo "  --enable-small           optimize for size instead of speed"
71
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
72
echo "  --disable-strip          disable stripping of executables and shared libraries"
73
echo "  --enable-code=codec      enables codec"
74
echo "  --disable-code=codec     disables codec"
75
echo "  --disable-encoders       disables all encoders"
76
echo ""
77
echo "NOTE: The object files are build at the place where configure is launched"
78
exit 1
79
fi
80

    
81
# set temporary file name
82
if test ! -z "$TMPDIR" ; then
83
    TMPDIR1="${TMPDIR}"
84
elif test ! -z "$TEMPDIR" ; then
85
    TMPDIR1="${TEMPDIR}"
86
else
87
    TMPDIR1="/tmp"
88
fi
89

    
90
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
91
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
92
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
93
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
94
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
95

    
96
# default parameters
97
prefix="/usr/local"
98
libdir=""
99
mandir=""
100
bindir=""
101
cross_prefix=""
102
cc="gcc"
103
ar="ar"
104
ranlib="ranlib"
105
make="make"
106
strip="strip"
107
cpu=`uname -m`
108
tune="generic"
109
powerpc_perf="no"
110
mmx="default"
111
altivec="default"
112
mmi="default"
113
case "$cpu" in
114
  i386|i486|i586|i686|i86pc|BePC)
115
    cpu="x86"
116
  ;;
117
  x86_64)
118
    if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
119
         -z "`echo $CFLAGS | grep -- -m32`"  ]; then
120
      cpu="x86_64"
121
    else
122
      cpu="x86"
123
    fi
124
  ;;
125
  # armv4l is a subset of armv5tel
126
  armv4l|armv5tel)
127
    cpu="armv4l"
128
  ;;
129
  alpha)
130
    cpu="alpha"
131
  ;;
132
  "Power Macintosh"|ppc)
133
    cpu="powerpc"
134
  ;;
135
  mips)
136
    cpu="mips"
137
  ;;
138
  sun4u|sparc64)
139
    cpu="sparc64"
140
  ;;
141
  sparc)
142
    cpu="sparc"
143
  ;;
144
  sh4)
145
    cpu="sh4"
146
  ;;
147
  *)
148
    cpu="unknown"
149
  ;;
150
esac
151
gprof="no"
152
v4l="yes"
153
audio_oss="yes"
154
audio_beos="no"
155
dv1394="yes"
156
dc1394="no"
157
network="yes"
158
zlib="yes"
159
mp3lame="no"
160
libogg="no"
161
vorbis="no"
162
theora="no"
163
faad="no"
164
faadbin="no"
165
faac="no"
166
xvid="no"
167
x264="no"
168
a52="no"
169
a52bin="no"
170
dts="no"
171
pp="no"
172
shared_pp="no"
173
mingw32="no"
174
cygwin="no"
175
os2="no"
176
lshared="no"
177
optimize="yes"
178
debug="yes"
179
dostrip="yes"
180
extralibs="-lm"
181
simpleidct="yes"
182
bigendian="no"
183
inttypes="yes"
184
emu_fast_int="no"
185
vhook="default"
186
dlfcn="no"
187
dlopen="no"
188
mpegaudio_hp="yes"
189
SHFLAGS=-shared
190
netserver="no"
191
need_inet_aton="no"
192
ffserver="yes"
193
ffplay="yes"
194
LDFLAGS=-Wl,--warn-common
195
FFSLDFLAGS=-Wl,-E
196
LIBPREF="lib"
197
LIBSUF=".a"
198
SLIBPREF="lib"
199
SLIBSUF=".so"
200
EXESUF=""
201
amr_nb="no"
202
amr_wb="no"
203
amr_nb_fixed="no"
204
amr_if2="no"
205
sunmlib="no"
206
pthreads="no"
207
gpl="no"
208
memalignhack="no"
209

    
210
# OS specific
211
targetos=`uname -s`
212
case $targetos in
213
BeOS)
214
prefix="/boot/home/config"
215
# helps building libavcodec
216
CFLAGS="-DPIC -fomit-frame-pointer"
217
# 3 gcc releases known for BeOS, each with ugly bugs
218
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
219
case "$gcc_version" in
220
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
221
mmx="no"
222
;;
223
*20010315*) echo "BeBits gcc"
224
CFLAGS="$CFLAGS -fno-expensive-optimizations"
225
;;
226
esac
227
SHFLAGS=-nostart
228
# disable linux things
229
audio_oss="no"
230
v4l="no"
231
dv1394="no"
232
# enable beos things
233
audio_beos="yes"
234
# no need for libm, but the inet stuff
235
# Check for BONE
236
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
237
extralibs="-lbind -lsocket"
238
else
239
netserver="yes"
240
need_inet_aton="yes"
241
extralibs="-lnet"
242
fi ;;
243
SunOS)
244
v4l="no"
245
audio_oss="no"
246
dv1394="no"
247
make="gmake"
248
LDFLAGS=""
249
FFSLDFLAGS=""
250
need_inet_aton="yes"
251
extralibs="$extralibs -lsocket -lnsl"
252
;;
253
NetBSD)
254
v4l="no"
255
audio_oss="yes"
256
dv1394="no"
257
make="gmake"
258
LDFLAGS="$LDFLAGS -export-dynamic"
259
case `uname -r` in
260
2.*) extralibs="-lossaudio"
261
;;
262
esac
263
;;
264
FreeBSD)
265
v4l="no"
266
audio_oss="yes"
267
dv1394="no"
268
make="gmake"
269
CFLAGS="-pthread"
270
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
271
;;
272
BSD/OS)
273
v4l="no"
274
audio_oss="yes"
275
dv1394="no"
276
extralibs="-lpoll -lgnugetopt -lm"
277
make="gmake"
278
;;
279
Darwin)
280
cc="cc"
281
v4l="no"
282
audio_oss="no"
283
dv1394="no"
284
ffserver="no"
285
SHFLAGS="-dynamiclib"
286
extralibs=""
287
darwin="yes"
288
strip="strip -x"
289
LDFLAGS="-Wl,-d,-search_paths_first"
290
FFSLDFLAGS=-Wl,-bind_at_load
291
;;
292
MINGW32*)
293
# Note: the rest of the mingw32 config is done afterwards as mingw32
294
# can be forced on command line for linux cross compilation
295
mingw32="yes"
296
;;
297
CYGWIN*)
298
v4l="no"
299
audio_oss="yes"
300
dv1394="no"
301
ffserver="no"
302
extralibs=""
303
cygwin="yes"
304
EXESUF=".exe"
305
test -f /usr/include/inttypes.h || \
306
test -f /usr/local/include/inttypes.h || \
307
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
308
     "/usr/local/include/inttypes.h !!!"
309
;;
310
Linux)
311
LDFLAGS="$LDFLAGS -rdynamic"
312
;;
313
IRIX*)
314
ranlib="echo ignoring ranlib"
315
v4l="no"
316
audio_oss="no"
317
make="gmake"
318
;;
319
OS/2)
320
TMPE=$TMPE".exe"
321
ar="emxomfar -p128"
322
ranlib="echo ignoring ranlib"
323
strip="echo ignoring strip"
324
CFLAGS="-Zomf"
325
LDFLAGS="-Zomf -Zstack 16384 -s"
326
SHFLAGS="-Zdll -Zomf"
327
FFSLDFLAGS=""
328
LIBPREF=""
329
LIBSUF=".lib"
330
SLIBPREF=""
331
SLIBSUF=".dll"
332
EXESUF=".exe"
333
extralibs=""
334
v4l="no"
335
audio_oss="no"
336
dv1394="no"
337
network="no"
338
ffserver="no"
339
vhook="no"
340
os2="yes"
341

    
342
;;
343
*) ;;
344
esac
345

    
346
# From mplayer configure. We need TARGET_OS available
347
# to the Makefile, so it can distinguish between flavors
348
# of AltiVec on PowerPC
349
TARGET_OS=`( uname -s ) 2>&1`
350
  case "$TARGET_OS" in
351
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
352
    ;;
353
  IRIX*)
354
    TARGET_OS=IRIX
355
    ;;
356
  HP-UX*)
357
    TARGET_OS=HP-UX
358
    ;;
359
  [cC][yY][gG][wW][iI][nN]*)
360
    TARGET_OS=CYGWIN
361
    ;;
362
  *)
363
    TARGET_OS="$TARGET_OS-UNKNOWN"
364
    ;;
365
  esac
366

    
367
# find source path
368
# XXX: we assume an absolute path is given when launching configure, 
369
# except in './configure' case.
370
source_path="`echo $0 | sed -e 's#/configure##'`"
371
source_path_used="yes"
372
if test -z "$source_path" -o "$source_path" = "." ; then
373
    source_path=`pwd`
374
    source_path_used="no"
375
fi
376

    
377
FFMPEG_CONFIGURATION=" "
378
for opt do
379
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
380
done
381

    
382
CODEC_LIST=`grep 'register_avcodec(&[a-z]' libavcodec/allcodecs.c  | sed 's/.*&\(.*\)).*/\1/'`
383

    
384
for opt do
385
  case "$opt" in
386
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
387
  ;;
388
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
389
  ;;
390
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
391
  ;;
392
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
393
  ;;
394
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
395
  ;;
396
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
397
  ;;
398
  --make=*) make=`echo $opt | cut -d '=' -f 2`
399
  ;;
400
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
401
  ;;
402
  --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
403
  ;;
404
  --extra-libs=*) extralibs=${opt#--extra-libs=}
405
  ;;
406
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
407
  ;;
408
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
409
  ;;
410
  --powerpc-perf-enable) powerpc_perf="yes"
411
  ;;
412
  --disable-mmx) mmx="no"
413
  ;;
414
  --disable-altivec) altivec="no"
415
  ;;
416
  --enable-gprof) gprof="yes"
417
  ;;
418
  --disable-v4l) v4l="no"
419
  ;;
420
  --disable-audio-oss) audio_oss="no"
421
  ;;
422
  --disable-audio-beos) audio_beos="no"
423
  ;;
424
  --disable-dv1394) dv1394="no"
425
  ;;
426
  --disable-network) network="no"; ffserver="no"
427
  ;;
428
  --disable-zlib) zlib="no"
429
  ;;
430
  --enable-a52) a52="yes"
431
  ;;
432
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
433
  ;;
434
  --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
435
  ;;
436
  --enable-pp) pp="yes"
437
  ;;
438
  --enable-shared-pp) shared_pp="yes"
439
  ;;
440
  --enable-mp3lame) mp3lame="yes"
441
  ;;
442
  --enable-libogg) libogg="yes"
443
  ;;
444
  --enable-vorbis) vorbis="yes"
445
  ;;
446
  --enable-theora) theora="yes"
447
  ;;
448
  --enable-faad) faad="yes"
449
  ;;
450
  --enable-faadbin) faadbin="yes"
451
  ;;
452
  --enable-faac) faac="yes"
453
  ;;
454
  --enable-xvid) xvid="yes"
455
  ;;
456
  --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
457
  ;;
458
  --enable-dc1394) dc1394="yes"
459
  ;;
460
  --disable-vhook) vhook="no"
461
  ;;
462
  --disable-simple_idct) simpleidct="no"
463
  ;;
464
  --enable-mingw32) mingw32="yes"
465
  ;;
466
  --enable-shared) lshared="yes"
467
  ;;
468
  --disable-debug) debug="no"
469
  ;;
470
  --disable-opts) optimize="no"
471
  ;;
472
  --disable-mpegaudio-hp) mpegaudio_hp="no"
473
  ;;
474
  --disable-ffserver) ffserver="no"
475
  ;;
476
  --disable-ffplay) ffplay="no"
477
  ;;
478
  --enable-small) optimize="small"
479
  ;;
480
  --enable-amr_nb) amr_nb="yes"
481
  ;;
482
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
483
  ;;
484
  --enable-amr_wb) amr_wb="yes"
485
  ;; 
486
  --enable-amr_if2) amr_if2="yes"
487
  ;;
488
  --enable-sunmlib) sunmlib="yes"
489
  ;;
490
  --enable-pthreads) pthreads="yes"
491
  ;;
492
  --enable-gpl) gpl="yes"
493
  ;;
494
  --enable-memalign-hack) memalignhack="yes"
495
  ;;
496
  --disable-strip) dostrip="no"
497
  ;;
498
  --enable-codec=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-codec=}"
499
  ;;
500
  --disable-codec=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-codec=}##\"`"
501
  ;;
502
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
503
  ;;
504
  esac
505
done
506

    
507
if test "$theora" = "yes" ; then
508
    if test "$libogg" = "no"; then
509
        echo "libogg must be enabled to enable Theora"     
510
        fail="yes"
511
        theora="no"
512
    fi
513
fi
514

    
515
if test "$vorbis" = "yes" ; then
516
    if test "$libogg" = "no"; then
517
        echo "libogg must be enabled to enable Vorbis"
518
        fail="yes"
519
        vorbis="no"
520
    fi
521
fi
522

    
523
if test "$gpl" != "yes"; then
524
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
525
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
526
        fail="yes"
527
    fi
528

    
529
    if test "$a52" != "no" -o "$a52bin" != "no"; then
530
        echo "liba52 is under GPL and --enable-gpl is not specified"
531
        fail="yes"
532
    fi
533

    
534
    if test "$xvid" != "no"; then
535
        echo "libxvidcore is under GPL and --enable-gpl is not specified"
536
        fail="yes"
537
    fi
538

    
539
    if test "$x264" != "no"; then
540
        echo "x264 is under GPL and --enable-gpl is not specified"
541
        fail="yes"
542
    fi
543

    
544
    if test "$dts" != "no"; then
545
        echo "libdts is under GPL and --enable-gpl is not specified"
546
        fail="yes"
547
    fi
548
    
549
    if test "$faad" != "no" -o "$faadbin" != "no"; then
550
        cat > $TMPC << EOF
551
            #include <faad.h>
552
            int main( void ) { return 0; }
553
EOF
554
    
555
        if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
556
            cat > $TMPC << EOF
557
                #include <faad.h>
558
                #ifndef FAAD2_VERSION
559
                ok faad1
560
                #endif
561
                int main( void ) { return 0; }
562
EOF
563
            if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
564
                echo "faad2 is under GPL and --enable-gpl is not specified"
565
                fail="yes"
566
            fi
567
        else
568
            faad="no"
569
            faadbin="no"
570
            echo "faad test failed"
571
        fi
572
    fi
573
   
574

    
575
    if test "$fail" = "yes"; then
576
        exit 1
577
    fi
578
fi
579

    
580
# compute mmx state
581
if test $mmx = "default"; then
582
    if test $cpu = "x86" -o $cpu = "x86_64"; then
583
        mmx="yes"
584
    else
585
        mmx="no"
586
    fi
587
fi
588

    
589
#Darwin CC versions
590
needmdynamicnopic="no"
591
if test $targetos = Darwin; then
592
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
593
	CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
594
    else
595
	gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
596
	case "$gcc_version" in
597
	    *2.95*) 
598
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
599
		;;
600
	    *3.*)
601
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
602
		if test "$lshared" = no; then
603
		   needmdynamicnopic="yes"
604
		fi
605
		;;
606
	    *)
607
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
608
		if test "$lshared" = no; then
609
		   needmdynamicnopic="yes"
610
		fi
611
		;;
612
	esac
613
    fi
614
fi
615

    
616
# Can only do AltiVec on PowerPC
617
if test $altivec = "default"; then
618
    if test $cpu = "powerpc"; then
619
        altivec="yes"
620
    else
621
        altivec="no"
622
    fi
623
fi
624

    
625
# Add processor-specific flags
626
TUNECPU="generic"
627
POWERPCMODE="32bits"
628
if test $tune != "generic"; then
629
    case $tune in
630
	601|ppc601|PowerPC601)
631
	    CFLAGS="$CFLAGS -mcpu=601"
632
	    if test $altivec = "yes"; then
633
		echo "WARNING: tuning for PPC601 but altivec enabled !";
634
	    fi
635
	    TUNECPU=ppc601
636
	;;
637
	603*|ppc603*|PowerPC603*)
638
	    CFLAGS="$CFLAGS -mcpu=603"
639
	    if test $altivec = "yes"; then
640
		echo "WARNING: tuning for PPC603 but altivec enabled !";
641
	    fi
642
	    TUNECPU=ppc603
643
	;;
644
	604*|ppc604*|PowerPC604*)
645
	    CFLAGS="$CFLAGS -mcpu=604"
646
	    if test $altivec = "yes"; then
647
		echo "WARNING: tuning for PPC604 but altivec enabled !";
648
	    fi
649
	    TUNECPU=ppc604
650
	;;
651
	G3|g3|75*|ppc75*|PowerPC75*)
652
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
653
	    if test $altivec = "yes"; then
654
		echo "WARNING: tuning for PPC75x but altivec enabled !";
655
	    fi
656
	    TUNECPU=ppc750
657
	;;
658
	G4|g4|745*|ppc745*|PowerPC745*)
659
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
660
	    if test $altivec = "no"; then
661
		echo "WARNING: tuning for PPC745x but altivec disabled !";
662
	    fi
663
	    TUNECPU=ppc7450
664
	;;
665
	74*|ppc74*|PowerPC74*)
666
	    CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
667
	    if test $altivec = "no"; then
668
		echo "WARNING: tuning for PPC74xx but altivec disabled !";
669
	    fi
670
	    TUNECPU=ppc7400
671
	;;
672
	G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
673
	    CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
674
	    if test $altivec = "no"; then
675
		echo "WARNING: tuning for PPC970 but altivec disabled !";
676
	    fi
677
	    TUNECPU=ppc970
678
            POWERPCMODE="64bits"
679
	;;
680
	*)
681
	echo "WARNING: unknown CPU "$tune", ignored"
682
	;;
683
    esac
684
fi
685

    
686
# AltiVec flags: The FSF version of GCC differs from the Apple version 
687
if test $cpu = "powerpc"; then
688
    if test $altivec = "yes"; then
689
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
690
            CFLAGS="$CFLAGS -faltivec"
691
        else
692
            CFLAGS="$CFLAGS -maltivec -mabi=altivec"
693
        fi
694
    fi
695
fi
696

    
697
# See if we have <altivec.h>
698
cat > $TMPC << EOF
699
#include <altivec.h>
700
int main( void ) { return 0; }
701
EOF
702

    
703
_altivec_h="no"
704
if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
705
_altivec_h="yes"
706
fi
707

    
708
# See does our compiler support Motorola AltiVec C API
709
if test $altivec = "yes"; then
710
if test $_altivec_h = "yes"; then
711
cat > $TMPC << EOF
712
#include <altivec.h>
713
int main(void) {
714
    vector signed int v1, v2, v3;
715
    v1 = vec_add(v2,v3);
716
    return 0;
717
}
718
EOF
719
else
720
cat > $TMPC << EOF
721
int main(void) {
722
    vector signed int v1, v2, v3;
723
    v1 = vec_add(v2,v3);
724
    return 0;
725
}
726
EOF
727
fi
728
$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
729
fi
730

    
731
# Can only do mmi on mips
732
if test $mmi = "default"; then
733
    if test $cpu = "mips"; then
734
        mmi="yes"
735
    else
736
        mmi="no"
737
    fi
738
fi
739

    
740
# See does our compiler support mmi
741
if test $mmi = "yes"; then
742
cat > $TMPC << EOF
743
int main(void) {
744
    __asm__ ("lq \$2, 0(\$2)");
745
    return 0;
746
}
747
EOF
748
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
749
fi
750

    
751
if test "$mingw32" = "yes" ; then
752
    v4l="no"
753
    audio_oss="no"
754
    dv1394="no"
755
    dc1394="no"
756
    ffserver="no"
757
    network="no"
758
    LIBPREF=""
759
    LIBSUF=".lib"
760
    SLIBPREF=""
761
    SLIBSUF=".dll"
762
    EXESUF=".exe"
763
    prefix="/c/Program Files/FFmpeg"
764
    bindir="$prefix"
765
fi
766

    
767
cc="${cross_prefix}${cc}"
768
ar="${cross_prefix}${ar}"
769
ranlib="${cross_prefix}${ranlib}"
770
strip="${cross_prefix}${strip}"
771

    
772
if test -z "$cross_prefix" ; then
773

    
774
# ---
775
# big/little endian test
776
cat > $TMPC << EOF
777
#include <inttypes.h>
778
int main(int argc, char ** argv){
779
	volatile uint32_t i=0x01234567;
780
	return (*((uint8_t*)(&i))) == 0x67;
781
}
782
EOF
783

    
784
if $cc -o $TMPE $TMPC 2>/dev/null ; then
785
$TMPE && bigendian="yes"
786
else
787
echo big/little test failed
788
fi
789

    
790
else
791

    
792
# if cross compiling, cannot launch a program, so make a static guess
793
if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
794
    bigendian="yes"
795
fi
796

    
797
fi
798

    
799
# ---
800
# *inttypes.h* test
801
cat > $TMPC << EOF
802
#include <inttypes.h>
803
int main(int argc, char ** argv){
804
    return 0;
805
}
806
EOF
807

    
808
$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
809

    
810
# ---
811
# *int_fast* test
812
cat > $TMPC << EOF
813
#include <inttypes.h>
814
int main(int argc, char ** argv){
815
	volatile uint_fast64_t i=0x01234567;
816
	return 0;
817
}
818
EOF
819

    
820
$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
821

    
822
# ---
823
# check availability of some header files
824

    
825
cat > $TMPC << EOF
826
#include <malloc.h>
827
int main( void ) { return 0; }
828
EOF
829

    
830
_memalign=no
831
_malloc_h=no
832
if $cc -o $TMPE $TMPC 2> /dev/null ; then
833
_malloc_h=yes
834
_memalign=yes
835
# check for memalign - atmos
836
cat > $TMPC << EOF
837
#include <stdio.h>
838
#include <malloc.h>
839
int main ( void ) {
840
char *string = NULL;
841
string = memalign(64, sizeof(char));
842
return 0;
843
}
844
EOF
845
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
846
fi
847

    
848
if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
849
    echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
850
    exit 1
851
fi
852

    
853
cat > $TMPC << EOF
854
#include <time.h>
855
int main( void ) { localtime_r(NULL, NULL); }
856
EOF
857

    
858
localtime_r=no
859
if $cc -o $TMPE $TMPC 2> /dev/null ; then
860
  localtime_r=yes
861
fi
862

    
863
if test "$zlib" = "yes"; then
864
# check for zlib - mmu_man
865
cat > $TMPC << EOF
866
#include <zlib.h>
867
int main ( void ) {
868
if (zlibVersion() != ZLIB_VERSION)
869
   puts("zlib version differs !!!");
870
   return 1;
871
return 0;
872
}
873
EOF
874
$cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
875
# $TMPE 2> /dev/null > /dev/null || zlib="no"
876
# XXX: more tests needed - runtime test
877
fi
878
if test "$zlib" = "yes"; then
879
extralibs="$extralibs -lz"
880
fi
881

    
882
# test for lrintf in math.h
883
cat > $TMPC << EOF
884
#define _ISOC9X_SOURCE  1
885
#include <math.h>
886
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
887
EOF
888

    
889
have_lrintf="no"
890
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
891
  have_lrintf="yes"
892
  # allanc@chickenandporn.com: cannot execute cross-compiled
893
  # code on the host.  Only execute if not cross-compiling.
894
  if test -z "$cross_prefix" ; then
895
    $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
896
  fi
897
fi
898

    
899
_restrict=
900
for restrict_keyword in restrict __restrict__ __restrict; do
901
  echo "void foo(char * $restrict_keyword p);" > $TMPC
902
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
903
    _restrict=$restrict_keyword
904
    break;
905
  fi
906
done
907

    
908
# test gcc version to see if vector builtins can be used
909
# currently only used on i386 for MMX builtins
910
cat > $TMPC << EOF
911
#include <xmmintrin.h>
912
int main(void) { 
913
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
914
return 0;
915
#else
916
#error no vector builtins
917
#endif
918
}
919
EOF
920

    
921
builtin_vector=no
922
if $cc -o $TMPO $TMPC 2> /dev/null ; then
923
  builtin_vector=yes
924
fi
925

    
926
# dlopen/dlfcn.h probing
927

    
928
cat > $TMPC << EOF
929
#include <dlfcn.h>
930
int main( void ) { return (int) dlopen("foo", 0); }
931
EOF
932

    
933
ldl=-ldl
934

    
935
if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
936
dlfcn=yes
937
dlopen=yes
938
fi
939

    
940
if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
941
dlfcn=yes
942
dlopen=yes
943
ldl=""
944
fi
945

    
946
cat > $TMPC << EOF
947
int main( void ) { return (int) dlopen("foo", 0); }
948
EOF
949

    
950
if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
951
dlopen=yes
952
fi
953

    
954
if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
955
dlopen=yes
956
ldl=""
957
fi
958

    
959
if test "$vhook" = "default" ; then
960
  vhook="$dlopen"
961
fi
962

    
963
##########################################
964
# imlib probe
965

    
966
cat > $TMPC << EOF
967
#include <X11/Xlib.h>
968
#include <Imlib2.h>
969
int main( void ) { return (int) imlib_load_font("foo"); }
970
EOF
971

    
972
imlib2=no
973
if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
974
imlib2=yes
975
fi
976

    
977
##########################################
978
# freetype probe
979

    
980
cat > $TMPC << EOF
981
#include <ft2build.h>
982
int main( void ) { return (int) FT_Init_FreeType(0); }
983
EOF
984

    
985
freetype2=no
986
if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
987
  if (freetype-config --version) >/dev/null 2>&1 ; then
988
    if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
989
      freetype2=yes
990
    fi
991
  fi
992
fi
993

    
994
##########################################
995
# SDL probe
996

    
997
cat > $TMPC << EOF
998
#include <SDL.h>
999
#undef main /* We don't want SDL to override our main() */
1000
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1001
EOF
1002

    
1003
sdl_too_old=no
1004
sdl=no
1005
if (sdl-config --version) >/dev/null 2>&1 ; then
1006
if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
1007
_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
1008
if test "$_sdlversion" -lt 121 ; then
1009
sdl_too_old=yes
1010
else
1011
sdl=yes
1012
fi
1013
fi
1014
fi
1015

    
1016
##########################################
1017
# texi2html probe
1018

    
1019
texi2html=no
1020
if (texi2html -version) >/dev/null 2>&1; then
1021
texi2html=yes
1022
fi
1023

    
1024
if test "$network" = "yes" ; then
1025
##########################################
1026
# IPv6 probe
1027

    
1028
cat > $TMPC << EOF
1029
#include <sys/types.h>
1030
#include <sys/socket.h>
1031
#include <netinet/in.h>
1032
#include <netdb.h>
1033
int main( void ) {
1034
  struct sockaddr_storage saddr;
1035
  struct ipv6_mreq mreq6;
1036
  getaddrinfo(0,0,0,0);
1037
  getnameinfo(0,0,0,0,0,0,0);
1038
  IN6_IS_ADDR_MULTICAST(0);
1039
}
1040
EOF
1041

    
1042
ipv6=no
1043
if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
1044
ipv6=yes
1045
fi
1046
fi
1047

    
1048
case "`$cc -v 2>&1 | grep version`" in
1049
    *gcc*)
1050
	CFLAGS="-Wall -Wno-switch $CFLAGS"
1051
	;;
1052
    *)
1053
	;;
1054
esac
1055

    
1056
if test "$sdl" = "no" ; then
1057
   ffplay=no
1058
fi
1059

    
1060
if test "$debug" = "yes"; then
1061
	CFLAGS="-g $CFLAGS"
1062
fi
1063

    
1064
if test "$optimize" = "small"; then
1065
#  CFLAGS=${CFLAGS//-O3/-Os}
1066
  CFLAGS="$CFLAGS -Os"
1067
fi
1068

    
1069
if test "$optimize" = "yes"; then
1070
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1071
	CFLAGS="$CFLAGS -O5"
1072
	LDFLAGS="$LDFLAGS -O5"
1073
    else
1074
	CFLAGS="-O3 $CFLAGS"
1075
    fi
1076
fi
1077

    
1078
if test x"$bindir" = x""; then
1079
bindir="${prefix}/bin"
1080
fi
1081

    
1082
if test x"$libdir" = x""; then
1083
libdir="${prefix}/lib"
1084
fi
1085

    
1086
if test x"$mandir" = x""; then
1087
mandir="${prefix}/man"
1088
fi
1089

    
1090
echo "Install prefix   $prefix"
1091
echo "Source path      $source_path"
1092
echo "C compiler       $cc"
1093
echo "make             $make"
1094
echo "CPU              $cpu ($tune)"
1095
echo "Big Endian       $bigendian"
1096
echo "inttypes.h       $inttypes"
1097
echo "broken inttypes.h $emu_fast_int"
1098
if test $cpu = "x86" -o $cpu = "x86_64"; then
1099
echo "MMX enabled      $mmx"
1100
echo "Vector Builtins  $builtin_vector"
1101
fi
1102
if test $cpu = "mips"; then
1103
echo "MMI enabled      $mmi"
1104
fi
1105
if test $cpu = "powerpc"; then
1106
echo "AltiVec enabled  $altivec"
1107
fi
1108
echo "gprof enabled    $gprof"
1109
echo "zlib enabled     $zlib"
1110
echo "mp3lame enabled  $mp3lame"
1111
echo "libogg enabled   $libogg"
1112
echo "vorbis enabled   $vorbis"
1113
echo "theora enabled   $theora"
1114
echo "faad enabled     $faad"
1115
echo "faadbin enabled  $faadbin"
1116
echo "faac enabled     $faac"
1117
echo "xvid enabled     $xvid"
1118
echo "x264 enabled     $x264"
1119
echo "a52 support      $a52"
1120
echo "a52 dlopened     $a52bin"
1121
echo "dts support      $dts"
1122
echo "pp support       $pp"
1123
echo "debug symbols    $debug"
1124
echo "strip symbols    $dostrip"
1125
echo "optimize         $optimize"
1126
echo "shared pp        $shared_pp"
1127
echo "Video hooking    $vhook"
1128
echo "SDL support      $sdl"
1129
if test $sdl_too_old = "yes"; then
1130
echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1131
fi
1132

    
1133
if test "$vhook" = "yes" ; then
1134
echo "Imlib2 support   $imlib2"
1135
echo "freetype support $freetype2"
1136
fi
1137
echo "Sun medialib support"  $sunmlib
1138
echo "pthreads support"      $pthreads
1139
echo "AMR-NB float support"  $amr_nb
1140
echo "AMR-NB fixed support"  $amr_nb_fixed
1141
echo "AMR-WB float support"  $amr_wb
1142
echo "AMR-WB IF2 support"    $amr_if2
1143
echo "network support      $network"
1144
if test "$network" = "yes" ; then
1145
echo "IPv6 support         $ipv6"
1146
fi
1147
if test "$gpl" = "no" ; then
1148
echo "License: LGPL"
1149
else
1150
echo "License: GPL"
1151
fi
1152

    
1153
echo "Creating config.mak and config.h"
1154

    
1155
date >> config.log
1156
echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1157
echo "# Automatically generated by configure - do not modify" > config.mak
1158
echo "/* Automatically generated by configure - do not modify */" > $TMPH
1159
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1160

    
1161
echo "prefix=$prefix" >> config.mak
1162
echo "libdir=$libdir" >> config.mak
1163
echo "bindir=$bindir" >> config.mak
1164
echo "mandir=$mandir" >> config.mak
1165
echo "MAKE=$make" >> config.mak
1166
echo "CC=$cc" >> config.mak
1167
echo "AR=$ar" >> config.mak
1168
echo "RANLIB=$ranlib" >> config.mak
1169
if test "$dostrip" = "yes" ; then
1170
echo "STRIP=$strip" >> config.mak
1171
echo "INSTALLSTRIP=-s" >> config.mak
1172
else
1173
echo "STRIP=echo ignoring strip" >> config.mak
1174
echo "INSTALLSTRIP=" >> config.mak
1175
fi
1176

    
1177
# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
1178
# shared modules on OS/X (vhook/Makefile).
1179
SHCFLAGS=$CFLAGS
1180
if test "$needmdynamicnopic" = yes; then
1181
   CFLAGS="$CFLAGS -mdynamic-no-pic"
1182
fi
1183

    
1184
echo "OPTFLAGS=$CFLAGS" >> config.mak
1185
echo "SHCFLAGS=$SHCFLAGS">>config.mak
1186
echo "LDFLAGS=$LDFLAGS" >> config.mak
1187
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1188
echo "SHFLAGS=$SHFLAGS" >> config.mak
1189
echo "LIBPREF=$LIBPREF" >> config.mak
1190
echo "LIBSUF=$LIBSUF" >> config.mak
1191
echo "SLIBPREF=$SLIBPREF" >> config.mak
1192
echo "SLIBSUF=$SLIBSUF" >> config.mak
1193
echo "EXESUF=$EXESUF" >> config.mak
1194
echo "TARGET_OS=$TARGET_OS" >> config.mak
1195
if test "$cpu" = "x86" ; then
1196
  echo "TARGET_ARCH_X86=yes" >> config.mak
1197
  echo "#define ARCH_X86 1" >> $TMPH
1198
elif test "$cpu" = "x86_64" ; then
1199
  echo "TARGET_ARCH_X86_64=yes" >> config.mak
1200
  echo "#define ARCH_X86_64 1" >> $TMPH
1201
elif test "$cpu" = "armv4l" ; then
1202
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1203
  echo "#define ARCH_ARMV4L 1" >> $TMPH
1204
elif test "$cpu" = "alpha" ; then
1205
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1206
  echo "#define ARCH_ALPHA 1" >> $TMPH
1207
elif test "$cpu" = "sparc64" ; then
1208
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1209
  echo "#define ARCH_SPARC64 1" >> $TMPH
1210
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1211
  echo "#define ARCH_SPARC 1" >> $TMPH
1212
elif test "$cpu" = "sparc" ; then
1213
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1214
  echo "#define ARCH_SPARC 1" >> $TMPH
1215
elif test "$cpu" = "powerpc" ; then
1216
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1217
  echo "#define ARCH_POWERPC 1" >> $TMPH
1218
  if test $POWERPCMODE = "32bits"; then
1219
    echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1220
  else
1221
    echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1222
  fi
1223
  if test "$powerpc_perf" = "yes"; then
1224
    echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1225
  fi
1226
elif test "$cpu" = "mips" ; then
1227
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
1228
  echo "#define ARCH_MIPS 1" >> $TMPH
1229
elif test "$cpu" = "sh4" ; then
1230
  echo "TARGET_ARCH_SH4=yes" >> config.mak
1231
  echo "#define ARCH_SH4 1" >> $TMPH
1232
fi
1233
echo "#define TUNECPU $TUNECPU" >> $TMPH
1234
if test "$bigendian" = "yes" ; then
1235
  echo "WORDS_BIGENDIAN=yes" >> config.mak
1236
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1237
fi
1238
if test "$inttypes" != "yes" ; then
1239
  echo "#define EMULATE_INTTYPES 1" >> $TMPH
1240
fi
1241
if test "$emu_fast_int" = "yes" ; then
1242
  echo "#define EMULATE_FAST_INT 1" >> $TMPH
1243
fi
1244
if test "$mmx" = "yes" ; then
1245
  echo "TARGET_MMX=yes" >> config.mak
1246
  echo "#define HAVE_MMX 1" >> $TMPH
1247
  echo "#define __CPU__ 586" >> $TMPH
1248
fi
1249
if test "$builtin_vector" = "yes" ; then
1250
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1251
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1252
fi
1253
if test "$mmi" = "yes" ; then
1254
  echo "TARGET_MMI=yes" >> config.mak
1255
  echo "#define HAVE_MMI 1" >> $TMPH
1256
fi
1257
if test "$altivec" = "yes" ; then
1258
  echo "TARGET_ALTIVEC=yes" >> config.mak
1259
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
1260
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1261
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1262
  if test "$_altivec_h" = "yes" ; then
1263
    echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1264
  else
1265
    echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1266
  fi
1267
fi
1268
if test "$gprof" = "yes" ; then
1269
  echo "TARGET_GPROF=yes" >> config.mak
1270
  echo "#define HAVE_GPROF 1" >> $TMPH
1271
fi
1272
if test "$localtime_r" = "yes" ; then
1273
  echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1274
fi
1275
if test "$imlib2" = "yes" ; then
1276
  echo "HAVE_IMLIB2=yes" >> config.mak
1277
fi
1278
if test "$freetype2" = "yes" ; then
1279
  echo "HAVE_FREETYPE2=yes" >> config.mak
1280
fi
1281
if test "$sunmlib" = "yes" ; then
1282
  echo "HAVE_MLIB=yes" >> config.mak
1283
  echo "#define HAVE_MLIB 1" >> $TMPH
1284
  extralibs="$extralibs -lmlib"
1285
fi
1286
if test "$pthreads" = "yes" ; then
1287
  echo "HAVE_PTHREADS=yes" >> config.mak
1288
  echo "#define HAVE_PTHREADS 1" >> $TMPH
1289
  echo "#define HAVE_THREADS 1" >> $TMPH
1290
  if test $targetos != FreeBSD; then
1291
     extralibs="$extralibs -lpthread"
1292
  fi
1293
fi
1294
if test "$sdl" = "yes" ; then
1295
  echo "CONFIG_SDL=yes" >> config.mak
1296
  echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1297
  echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1298
fi
1299
if test "$texi2html" = "yes"; then
1300
  echo "BUILD_DOC=yes" >> config.mak
1301
fi
1302
if test "$have_lrintf" = "yes" ; then
1303
  echo "#define HAVE_LRINTF 1" >> $TMPH
1304
fi
1305
if test "$vhook" = "yes" ; then
1306
  echo "BUILD_VHOOK=yes" >> config.mak
1307
  echo "#define HAVE_VHOOK 1" >> $TMPH
1308
  extralibs="$extralibs $ldl"
1309
fi
1310
if test "$lshared" = "yes" ; then
1311
  echo "BUILD_SHARED=yes" >> config.mak
1312
  echo "PIC=-fPIC" >> config.mak
1313
fi
1314
echo "EXTRALIBS=$extralibs" >> config.mak
1315
version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
1316
 cut -d '"' -f 2`
1317
echo "VERSION=$version" >>config.mak
1318
# if you do not want to use encoders, disable that.
1319
echo "#define CONFIG_ENCODERS 1" >> $TMPH
1320
echo "CONFIG_ENCODERS=yes" >> config.mak
1321

    
1322
# if you do not want to use decoders, disable that.
1323
echo "#define CONFIG_DECODERS 1" >> $TMPH
1324
echo "CONFIG_DECODERS=yes" >> config.mak
1325

    
1326
# AC3
1327
if test "$a52" = "yes" ; then
1328
  echo "#define CONFIG_AC3 1" >> $TMPH
1329
  echo "CONFIG_AC3=yes" >> config.mak
1330

    
1331
  if test "$a52bin" = "yes" ; then
1332
    echo "#define CONFIG_A52BIN 1" >> $TMPH
1333
    echo "CONFIG_A52BIN=yes" >> config.mak
1334
  fi
1335
fi
1336

    
1337
# DTS
1338
if test "$dts" = "yes" ; then
1339
  echo "#define CONFIG_DTS 1" >> $TMPH
1340
  echo "CONFIG_DTS=yes" >> config.mak
1341
fi
1342

    
1343
# PP
1344
if test "$pp" = "yes" ; then
1345
  echo "#define CONFIG_PP 1" >> $TMPH
1346
  echo "CONFIG_PP=yes" >> config.mak
1347

    
1348
  if test "$shared_pp" = "yes" ; then
1349
    echo "#define SHARED_PP 1" >> $TMPH
1350
    echo "SHARED_PP=yes" >> config.mak
1351
  fi
1352
fi
1353

    
1354
# mpeg audio high precision mode
1355
if test "$mpegaudio_hp" = "yes" ; then
1356
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1357
fi
1358

    
1359
if test "$v4l" = "yes" ; then
1360
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1361
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1362
fi
1363

    
1364
if test "$dv1394" = "yes" ; then
1365
  echo "#define CONFIG_DV1394 1" >> $TMPH
1366
  echo "CONFIG_DV1394=yes" >> config.mak
1367
fi
1368

    
1369
if test "$dc1394" = "yes" ; then
1370
  echo "#define CONFIG_DC1394 1" >> $TMPH
1371
  echo "CONFIG_DC1394=yes" >> config.mak
1372
fi
1373

    
1374
if test "$dlopen" = "yes" ; then
1375
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1376
fi
1377

    
1378
if test "$dlfcn" = "yes" ; then
1379
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1380
fi
1381

    
1382
if test "$audio_oss" = "yes" ; then
1383
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1384
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1385
fi
1386

    
1387
if test "$audio_beos" = "yes" ; then
1388
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1389
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1390
fi
1391

    
1392
if test "$network" = "yes" ; then
1393
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1394
  echo "CONFIG_NETWORK=yes" >> config.mak
1395
fi
1396

    
1397
if test "$ipv6" = "yes" ; then
1398
  echo "#define CONFIG_IPV6 1" >> $TMPH
1399
fi
1400

    
1401
if test "$zlib" = "yes" ; then
1402
  echo "#define CONFIG_ZLIB 1" >> $TMPH
1403
  echo "CONFIG_ZLIB=yes" >> config.mak
1404
fi
1405

    
1406
if test "$mp3lame" = "yes" ; then
1407
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
1408
  echo "CONFIG_MP3LAME=yes" >> config.mak
1409
fi
1410

    
1411
if test "$libogg" = "yes" ; then
1412
  echo "#define CONFIG_LIBOGG 1" >> $TMPH
1413
  echo "CONFIG_LIBOGG=yes" >> config.mak
1414
fi
1415

    
1416
if test "$vorbis" = "yes" ; then
1417
  echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
1418
  echo "CONFIG_LIBVORBIS=yes" >> config.mak
1419
fi
1420

    
1421
if test "$theora" = "yes" ; then
1422
  echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
1423
  echo "CONFIG_LIBTHEORA=yes" >> config.mak
1424
fi
1425

    
1426
if test "$faad" = "yes" ; then
1427
  echo "#define CONFIG_FAAD 1" >> $TMPH
1428
  echo "CONFIG_FAAD=yes" >> config.mak
1429
fi
1430

    
1431
if test "$faadbin" = "yes" ; then
1432
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
1433
  echo "CONFIG_FAADBIN=yes" >> config.mak
1434
fi
1435

    
1436
if test "$faac" = "yes" ; then
1437
  echo "#define CONFIG_FAAC 1" >> $TMPH
1438
  echo "CONFIG_FAAC=yes" >> config.mak
1439
fi
1440

    
1441
if test "$xvid" = "yes" ; then
1442
  echo "#define CONFIG_XVID 1" >> $TMPH
1443
  echo "CONFIG_XVID=yes" >> config.mak
1444
fi
1445

    
1446
if test "$x264" = "yes" ; then
1447
  echo "#define CONFIG_X264 1" >> $TMPH
1448
  echo "CONFIG_X264=yes" >> config.mak
1449
fi
1450

    
1451
if test "$mingw32" = "yes" ; then
1452
  echo "#define CONFIG_WIN32 1" >> $TMPH
1453
  echo "CONFIG_WIN32=yes" >> config.mak
1454
  echo "HAVE_W32THREADS=yes" >> config.mak
1455
  echo "#define HAVE_W32THREADS 1" >> $TMPH
1456
  echo "#define HAVE_THREADS 1" >> $TMPH
1457
  echo "#ifndef __MINGW32__" >> $TMPH
1458
  echo "#define __MINGW32__ 1" >> $TMPH
1459
  echo "#endif" >> $TMPH
1460
fi
1461

    
1462
if test "$os2" = "yes" ; then
1463
  echo "#define CONFIG_OS2 1" >> $TMPH
1464
  echo "CONFIG_OS2=yes" >> config.mak
1465
fi
1466

    
1467
if test "$TARGET_OS" = "SunOS" ; then
1468
  echo "#define CONFIG_SUNOS 1" >> $TMPH
1469
fi
1470

    
1471
if test "$TARGET_OS" = "BeOS" ; then
1472
  echo "HAVE_BEOSTHREADS=yes" >> config.mak
1473
  echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
1474
  echo "#define HAVE_THREADS 1" >> $TMPH
1475
fi
1476

    
1477
if test "$darwin" = "yes"; then
1478
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
1479
  echo "CONFIG_DARWIN=yes" >> config.mak
1480
fi
1481

    
1482
if test "$_malloc_h" = "yes" ; then
1483
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
1484
else
1485
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
1486
fi
1487

    
1488
if test "$_memalign" = "yes" ; then
1489
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
1490
else
1491
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
1492
fi
1493

    
1494
if test "$memalignhack" = "yes" ; then
1495
  echo "#define MEMALIGN_HACK 1" >> $TMPH
1496
fi
1497

    
1498

    
1499
if test "$netserver" = "yes" ; then
1500
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1501
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1502
fi
1503

    
1504
if test "$need_inet_aton" = "yes" ; then
1505
  echo "NEED_INET_ATON=yes" >> config.mak
1506
fi
1507

    
1508
if test "$simpleidct" = "yes" ; then
1509
  echo "#define SIMPLE_IDCT 1" >> $TMPH
1510
fi
1511

    
1512
if test "$ffserver" = "yes" ; then
1513
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
1514
  echo "CONFIG_FFSERVER=yes" >> config.mak
1515
fi
1516

    
1517
if test "$ffplay" = "yes" ; then
1518
  echo "CONFIG_FFPLAY=yes" >> config.mak
1519
fi
1520

    
1521
if test "$gpl" = "yes" ; then
1522
  echo "#define CONFIG_GPL 1" >> $TMPH
1523
  echo "CONFIG_GPL=yes" >> config.mak
1524
fi
1525

    
1526
echo "#define restrict $_restrict" >> $TMPH
1527

    
1528
if test "$optimize" = "small"; then
1529
  echo "#define always_inline"  >> $TMPH
1530
fi
1531

    
1532
# build tree in object directory if source path is different from current one
1533
if test "$source_path_used" = "yes" ; then
1534
    DIRS="doc libavformat libavcodec libavcodec/alpha libavcodec/armv4l \
1535
          libavcodec/i386 libavcodec/sparc libavcodec/mlib \
1536
          libavcodec/ppc libavcodec/liba52 libavcodec/libpostproc tests vhook"
1537
    FILES="Makefile libavformat/Makefile libavcodec/Makefile \
1538
          libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile \
1539
          doc/Makefile doc/texi2pod.pl"
1540
    for dir in $DIRS ; do
1541
            mkdir -p $dir
1542
    done
1543
    for f in $FILES ; do
1544
        ln -sf "$source_path/$f" $f
1545
    done
1546
    echo "SRC_PATH=$source_path" >> config.mak
1547
else
1548
    echo "SRC_PATH='$source_path'" >> config.mak
1549
fi
1550

    
1551
if test "$amr_wb" = "yes" ; then
1552
  echo "#define AMR_WB 1" >> $TMPH
1553
  echo "AMR_WB=yes" >> config.mak
1554
  echo
1555
  echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1556
  echo "V5.1.0 from "
1557
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1558
  echo "and extracted the source to libavcodec/amrwb_float"
1559
  echo
1560
fi
1561

    
1562
if test "$amr_nb" = "yes" ; then
1563
  echo "#define AMR_NB 1" >> $TMPH
1564
  echo "AMR_NB=yes" >> config.mak
1565
  echo
1566
if test "$amr_nb_fixed" = "yes" ; then
1567
  echo "AMR_NB_FIXED=yes" >> config.mak
1568
  echo "#define AMR_NB_FIXED 1" >> $TMPH
1569
  echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1570
  echo "REL-5 version 5.1.0 from "
1571
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
1572
  echo "and extracted src to libavcodec/amr"
1573
  echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1574
  echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1575
  echo
1576
else
1577
  echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1578
  echo "REL-5 V5.1.0 from "
1579
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
1580
  echo "and extracted the source to libavcodec/amr_float"
1581
  echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1582
  echo
1583
fi
1584

    
1585
if test "$amr_if2" = "yes" ; then
1586
  echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1587
fi
1588

    
1589
fi
1590

    
1591
for codec in $CODEC_LIST ; do
1592
    echo "#define CONFIG_`echo $codec | awk '{$1=toupper($1)}1'` 1" >> $TMPH
1593
done
1594

    
1595
diff $TMPH config.h >/dev/null 2>&1
1596
if test $? -ne 0 ; then
1597
	mv -f $TMPH config.h
1598
else
1599
	echo "config.h is unchanged"
1600
fi
1601

    
1602
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH