Statistics
| Branch: | Revision:

ffmpeg / configure @ f3ec2d46

History | View | Annotate | Download (18.7 KB)

1
#!/bin/sh
2
#
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5
# set temporary file name
6
if test ! -z "$TMPDIR" ; then
7
    TMPDIR1="${TMPDIR}"
8
elif test ! -z "$TEMPDIR" ; then
9
    TMPDIR1="${TEMPDIR}"
10
else
11
    TMPDIR1="/tmp"
12
fi
13

    
14
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
16
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
17
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
18
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
19

    
20
# default parameters
21
prefix="/usr/local"
22
cross_prefix=""
23
cc="gcc"
24
ar="ar"
25
ranlib="ranlib"
26
make="make"
27
strip="strip"
28
cpu=`uname -m`
29
mmx="default"
30
altivec="default"
31
mmi="default"
32
case "$cpu" in
33
  i386|i486|i586|i686|i86pc|BePC)
34
    cpu="x86"
35
  ;;
36
  armv4l)
37
    cpu="armv4l"
38
  ;;
39
  alpha)
40
    cpu="alpha"
41
  ;;
42
  "Power Macintosh"|ppc)
43
    cpu="powerpc"
44
  ;;
45
  mips)
46
    cpu="mips"
47
  ;;
48
  *)
49
    cpu="unknown"
50
  ;;
51
esac
52
gprof="no"
53
v4l="yes"
54
audio_oss="yes"
55
audio_beos="no"
56
network="yes"
57
zlib="yes"
58
mp3lame="no"
59
vorbis="no"
60
a52="yes"
61
a52bin="no"
62
win32="no"
63
mingw32="no"
64
cygwin="no"
65
os2="no"
66
lshared="no"
67
extralibs="-lm"
68
simpleidct="yes"
69
bigendian="no"
70
vhook="no"
71
dlfcn="no"
72
dlopen="no"
73
mpegaudio_hp="yes"
74
SHFLAGS=-shared
75
netserver="no"
76
need_inet_aton="no"
77
ffserver="yes"
78
LDFLAGS=-Wl,--warn-common
79
FFSLDFLAGS=-Wl,-E
80
LIBPREF="lib"
81
LIBSUF=".a"
82
SLIBPREF="lib"
83
SLIBSUF=".so"
84

    
85
# OS specific
86
targetos=`uname -s`
87
case $targetos in
88
BeOS)
89
prefix="/boot/home/config"
90
# helps building libavcodec
91
CFLAGS="-O3 -DPIC -fomit-frame-pointer"
92
# 3 gcc releases known for BeOS, each with ugly bugs
93
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
94
case "$gcc_version" in
95
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
96
mmx="no"
97
;;
98
*20010315*) echo "BeBits gcc"
99
CFLAGS="$CFLAGS -fno-expensive-optimizations"
100
;;
101
esac
102
SHFLAGS=-nostart
103
# disable linux things
104
audio_oss="no"
105
v4l="no"
106
# enable beos things
107
audio_beos="yes"
108
# no need for libm, but the inet stuff
109
# Check for BONE
110
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
111
extralibs="-lbind -lsocket"
112
else
113
netserver="yes"
114
need_inet_aton="yes"
115
extralibs="-lnet"
116
fi ;;
117
SunOS)
118
v4l="no"
119
audio_oss="no"
120
make="gmake"
121
LDFLAGS=""
122
FFSLDFLAGS=""
123
need_inet_aton="yes"
124
extralibs="$extralibs -lsocket -lnsl"
125
;;
126
FreeBSD)
127
v4l="no"
128
audio_oss="yes"
129
make="gmake"
130
LDFLAGS="$LDFLAGS -export-dynamic"
131
;;
132
BSD/OS)
133
v4l="no"
134
audio_oss="yes"
135
extralibs="-lpoll -lgnugetopt -lm"
136
make="gmake"
137
;;
138
Darwin)
139
cc="cc"
140
v4l="no"
141
audio_oss="no"
142
SHFLAGS="-dynamiclib"
143
extralibs=""
144
darwin="yes"
145
strip="strip -x"
146
LDFLAGS="-d"
147
FFSLDFLAGS=-Wl,-bind_at_load
148
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
149
case "$gcc_version" in
150
*2.95*) 
151
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
152
;;
153
*) 
154
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
155
;;
156
esac
157
;;
158
MINGW32*)
159
v4l="no"
160
audio_oss="no"
161
ffserver="no"
162
network="no"
163
mingw32="yes"
164
;;
165
CYGWIN*)
166
v4l="no"
167
audio_oss="yes"
168
extralibs=""
169
cygwin="yes"
170
test -f /usr/include/inttypes.h || \
171
test -f /usr/local/include/inttypes.h || \
172
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
173
     "/usr/include/inttypes.h !!!"
174
;;
175
Linux)
176
LDFLAGS="$LDFLAGS -rdynamic"
177
;;
178
OS/2)
179
TMPE=$TMPE".exe"
180
ar="emxomfar -p32"
181
strip="echo ignore strip"
182
CFLAGS="-Zomf"
183
LDFLAGS="-Zomf -Zstack 16384"
184
SHFLAGS=""
185
FFSLDFLAGS=""
186
LIBPREF=""
187
LIBSUF=".lib"
188
SLIBPREF=""
189
SLIBSUF=".dll"
190
extralibs=""
191
v4l="no"
192
audio_oss="no"
193
network="no"
194
ffserver="no"
195
os2="yes"
196
;;
197
*) ;;
198
esac
199

    
200
# find source path
201
# XXX: we assume an absolute path is given when launching configure, 
202
# except in './configure' case.
203
source_path=${0%configure}
204
source_path=${source_path%/}
205
source_path_used="yes"
206
if test -z "$source_path" -o "$source_path" = "." ; then
207
    source_path=`pwd`
208
    source_path_used="no"
209
fi
210

    
211
cat > $TMPC << EOF
212
#include <dlfcn.h>
213
int main( void ) { return (int) dlopen("foo", 0); }
214
EOF
215

    
216
ldl=-ldl
217

    
218
if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
219
vhook=yes
220
dlfcn=yes
221
dlopen=yes
222
fi
223

    
224
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
225
vhook=yes
226
dlfcn=yes
227
dlopen=yes
228
ldl=""
229
fi
230

    
231
cat > $TMPC << EOF
232
int main( void ) { return (int) dlopen("foo", 0); }
233
EOF
234

    
235
if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
236
vhook=yes
237
dlopen=yes
238
fi
239

    
240
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
241
vhook=yes
242
dlopen=yes
243
ldl=""
244
fi
245

    
246

    
247
cat > $TMPC << EOF
248
#include <X11/Xlib.h>
249
#include <Imlib2.h>
250
int main( void ) { return (int) imlib_load_font("foo"); }
251
EOF
252

    
253
imlib2=no
254
if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null  ; then
255
imlib2=yes
256
fi
257

    
258
for opt do
259
  case "$opt" in
260
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
261
  ;;
262
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
263
  ;;
264
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
265
  ;;
266
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
267
  ;;
268
  --make=*) make=`echo $opt | cut -d '=' -f 2`
269
  ;;
270
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
271
  ;;
272
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
273
  ;;
274
  --extra-libs=*) extralibs=${opt#--extra-libs=}
275
  ;;
276
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
277
  ;;
278
  --disable-mmx) mmx="no"
279
  ;;
280
  --disable-altivec) altivec="no"
281
  ;;
282
  --enable-gprof) gprof="yes"
283
  ;;
284
  --disable-v4l) v4l="no"
285
  ;;
286
  --disable-audio-oss) audio_oss="no"
287
  ;;
288
  --disable-audio-beos) audio_beos="no"
289
  ;;
290
  --disable-network) network="no"
291
  ;;
292
  --disable-zlib) zlib="no"
293
  ;;
294
  --disable-a52) a52="no"
295
  ;;
296
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
297
  ;;
298
  --enable-mp3lame) mp3lame="yes"
299
  ;;
300
  --enable-vorbis) vorbis="yes"
301
  ;;
302
  --disable-vhook) vhook="no"
303
  ;;
304
  --disable-simple_idct) simpleidct="no"
305
  ;;
306
  --enable-win32) win32="yes"
307
  ;;
308
  --enable-mingw32) mingw32="yes"
309
  ;;
310
  --enable-shared) lshared="yes"
311
  ;;
312
  --disable-mpegaudio-hp) mpegaudio_hp="no"
313
  ;;
314
  --disable-ffserver) ffserver="no"
315
  ;;
316
  esac
317
done
318

    
319
# compute mmx state
320
if test $mmx = "default"; then
321
    if test $cpu = "x86"; then
322
        mmx="yes"
323
    else
324
        mmx="no"
325
    fi
326
fi
327

    
328
# Can only do AltiVec on PowerPC
329
if test $altivec = "default"; then
330
    if test $cpu = "powerpc"; then
331
        altivec="yes"
332
    else
333
        altivec="no"
334
    fi
335
fi
336

    
337
# See does our compiler support Motorola AltiVec C API
338
if test $altivec = "yes"; then
339
cat > $TMPC << EOF
340
int main(void) {
341
    vector signed int v1, v2, v3;
342
    v1 = vec_add(v2,v3);
343
    return 0;
344
}
345
EOF
346
$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
347
fi
348

    
349
# Can only do mmi on mips
350
if test $mmi = "default"; then
351
    if test $cpu = "mips"; then
352
        mmi="yes"
353
    else
354
        mmi="no"
355
    fi
356
fi
357

    
358
# See does our compiler support mmi
359
if test $mmi = "yes"; then
360
cat > $TMPC << EOF
361
int main(void) {
362
    __asm__ ("lq \$2, 0(\$2)");
363
    return 0;
364
}
365
EOF
366
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
367
fi
368

    
369
# Checking for CFLAGS
370
if test -z "$CFLAGS"; then
371
    CFLAGS="-O3"
372
fi
373

    
374
if test "$win32" = "yes" ; then
375
    cross_prefix="i386-mingw32msvc-"
376
    v4l="no"
377
    audio_oss="no"
378
    network="no"
379
fi
380

    
381
if test "$mingw32" = "yes" ; then
382
    cross_prefix=""
383
    v4l="no"
384
    audio_oss="no"
385
    network="no"
386
fi
387

    
388
cc="${cross_prefix}${cc}"
389
ar="${cross_prefix}${ar}"
390
ranlib="${cross_prefix}${ranlib}"
391
strip="${cross_prefix}${strip}"
392

    
393
if test -z "$cross_prefix" ; then
394

    
395
# ---
396
# big/little endian test
397
cat > $TMPC << EOF
398
#include <inttypes.h>
399
int main(int argc, char ** argv){
400
	volatile uint32_t i=0x01234567;
401
	return (*((uint8_t*)(&i))) == 0x67;
402
}
403
EOF
404

    
405
if $cc -o $TMPE $TMPC 2>/dev/null ; then
406
$TMPE && bigendian="yes"
407
else
408
echo big/little test failed
409
fi
410

    
411
else
412

    
413
# if cross compiling, cannot launch a program, so make a static guess
414
if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
415
    bigendian="yes"
416
fi
417

    
418
fi
419

    
420
# ---
421
# check availability of some header files
422

    
423
cat > $TMPC << EOF
424
#include <malloc.h>
425
int main( void ) { return 0; }
426
EOF
427

    
428
_memalign=no
429
_malloc_h=no
430
if $cc -o $TMPE $TMPC 2> /dev/null ; then
431
_malloc_h=yes
432
_memalign=yes
433
# check for memalign - atmos
434
cat > $TMPC << EOF
435
#include <malloc.h>
436
int main ( void ) {
437
char *string = NULL;
438
string = memalign(64, sizeof(char));
439
return 0;
440
}
441
EOF
442
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
443
fi
444

    
445
cat > $TMPC << EOF
446
#define _GNU_SOURCE
447
#include <time.h>
448
int main( void ) { return *strptime("", "", 0); }
449
EOF
450

    
451
strptime=no
452
if $cc -o $TMPE $TMPC 2> /dev/null ; then
453
  strptime=yes
454
fi
455

    
456
if test "$zlib" = "yes"; then
457
# check for zlib - mmu_man
458
cat > $TMPC << EOF
459
#include <zlib.h>
460
int main ( void ) {
461
if (zlibVersion() != ZLIB_VERSION)
462
   puts("zlib version differs !!!");
463
   return 1;
464
return 0;
465
}
466
EOF
467
$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
468
# $TMPE 2> /dev/null > /dev/null || zlib="no"
469
# XXX: more tests needed - runtime test
470
fi
471
if test "$zlib" = "yes"; then
472
extralibs="$extralibs -lz"
473
fi
474

    
475
# test for lrintf in math.h
476
cat > $TMPC << EOF
477
#define _ISOC9X_SOURCE  1
478
#include <math.h>
479
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
480
EOF
481

    
482
have_lrintf="no"
483
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
484
  have_lrintf="yes"
485
  $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
486
fi
487

    
488
_restrict=
489
for restrict_keyword in restrict __restrict__ __restrict; do
490
  echo "void foo(char * $restrict_keyword p);" > $TMPC
491
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
492
    _restrict=$restrict_keyword
493
    break;
494
  fi
495
done
496

    
497
# test gcc version to see if vector builtins can be used
498
# currently only used on i386 for MMX builtins
499
cat > $TMPC << EOF
500
int main(void) { 
501
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
502
return 0;
503
#else
504
#error no vector builtins
505
#endif
506
}
507
EOF
508

    
509
builtin_vector=no
510
if $cc -o $TMPO $TMPC 2> /dev/null ; then
511
  builtin_vector=yes
512
  if test "$mmx" = "yes" ; then
513
     CFLAGS="$CFLAGS -msse"
514
  fi
515
fi
516

    
517
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
518
cat << EOF
519

    
520
Usage: configure [options]
521
Options: [defaults in brackets after descriptions]
522

    
523
EOF
524
echo "Standard options:"
525
echo "  --help                   print this message"
526
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
527
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
528
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
529
echo "  --enable-win32           enable win32 cross compile"
530
echo "  --enable-mingw32         enable mingw32 native windows compile"
531
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
532
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
533
echo "  --enable-shared          build shared libraries [default=no]"
534
echo ""
535
echo "Advanced options (experts only):"
536
echo "  --source-path=PATH       path of source code [$source_path]"
537
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
538
echo "  --cc=CC                  use C compiler CC [$cc]"
539
echo "  --make=MAKE              use specified make [$make]"
540
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
541
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
542
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
543
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
544
echo "  --disable-mmx            disable mmx usage"
545
echo "  --disable-altivec        disable AltiVec usage"
546
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
547
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
548
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
549
echo "  --disable-network        disable network support [default=no]"
550
echo "  --disable-zlib           disable zlib [default=no]"
551
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
552
echo "  --disable-vhook          disable video hooking support"
553
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
554
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
555
echo "                           mpegaudio decoding [default=no]"
556
echo "  --disable-ffserver       disable ffserver build"
557
echo ""
558
echo "NOTE: The object files are build at the place where configure is launched"
559
exit 1
560
fi
561

    
562
echo "Install prefix   $prefix"
563
echo "Source path      $source_path"
564
echo "C compiler       $cc"
565
echo "make             $make"
566
echo "CPU              $cpu"
567
echo "Big Endian       $bigendian"
568
if test $cpu = "x86"; then
569
echo "MMX enabled      $mmx"
570
echo "Vector Builtins  $builtin_vector"
571
fi
572
if test $cpu = "mips"; then
573
echo "MMI enabled      $mmi"
574
fi
575
if test $cpu = "powerpc"; then
576
echo "AltiVec enabled  $altivec"
577
fi
578
echo "gprof enabled    $gprof"
579
echo "zlib enabled     $zlib"
580
echo "mp3lame enabled  $mp3lame"
581
echo "vorbis enabled   $vorbis"
582
echo "a52 support      $a52"
583
echo "a52 dlopened     $a52bin"
584
echo "Video hooking    $vhook"
585

    
586
if test "$vhook" = "yes" ; then
587
echo "Imlib2 support   $imlib2"
588
fi
589

    
590
echo "Creating config.mak and config.h"
591

    
592
echo "# Automatically generated by configure - do not modify" > config.mak
593
echo "/* Automatically generated by configure - do not modify */" > $TMPH
594

    
595
echo "prefix=$prefix" >> config.mak
596
echo "MAKE=$make" >> config.mak
597
echo "CC=$cc" >> config.mak
598
echo "AR=$ar" >> config.mak
599
echo "RANLIB=$ranlib" >> config.mak
600
echo "STRIP=$strip" >> config.mak
601
echo "OPTFLAGS=$CFLAGS" >> config.mak
602
echo "LDFLAGS=$LDFLAGS" >> config.mak
603
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
604
echo "SHFLAGS=$SHFLAGS" >> config.mak
605
echo "LIBPREF=$LIBPREF" >> config.mak
606
echo "LIBSUF=$LIBSUF" >> config.mak
607
echo "SLIBPREF=$SLIBPREF" >> config.mak
608
echo "SLIBSUF=$SLIBSUF" >> config.mak
609
if test "$cpu" = "x86" ; then
610
  echo "TARGET_ARCH_X86=yes" >> config.mak
611
  echo "#define ARCH_X86 1" >> $TMPH
612
elif test "$cpu" = "armv4l" ; then
613
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
614
  echo "#define ARCH_ARMV4L 1" >> $TMPH
615
elif test "$cpu" = "alpha" ; then
616
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
617
  echo "#define ARCH_ALPHA 1" >> $TMPH
618
elif test "$cpu" = "sparc64" ; then
619
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
620
  echo "#define ARCH_SPARC64 1" >> $TMPH
621
elif test "$cpu" = "powerpc" ; then
622
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
623
  echo "#define ARCH_POWERPC 1" >> $TMPH
624
elif test "$cpu" = "mips" ; then
625
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
626
  echo "#define ARCH_MIPS 1" >> $TMPH
627
fi
628
if test "$bigendian" = "yes" ; then
629
  echo "WORDS_BIGENDIAN=yes" >> config.mak
630
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
631
fi
632
if test "$mmx" = "yes" ; then
633
  echo "TARGET_MMX=yes" >> config.mak
634
  echo "#define HAVE_MMX 1" >> $TMPH
635
fi
636
if test "$builtin_vector" = "yes" ; then
637
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
638
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
639
fi
640
if test "$mmi" = "yes" ; then
641
  echo "TARGET_MMI=yes" >> config.mak
642
  echo "#define HAVE_MMI 1" >> $TMPH
643
fi
644
if test "$altivec" = "yes" ; then
645
  echo "TARGET_ALTIVEC=yes" >> config.mak
646
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
647
fi
648
if test "$gprof" = "yes" ; then
649
  echo "TARGET_GPROF=yes" >> config.mak
650
  echo "#define HAVE_GPROF 1" >> $TMPH
651
fi
652
if test "$strptime" = "yes" ; then
653
  echo "#define HAVE_STRPTIME 1" >> $TMPH
654
else
655
  echo "BUILD_STRPTIME=yes" >> config.mak
656
fi
657
if test "$imlib2" = "yes" ; then
658
  echo "HAVE_IMLIB2=yes" >> config.mak
659
fi
660
if test "$have_lrintf" = "yes" ; then
661
  echo "#define HAVE_LRINTF 1" >> $TMPH
662
fi
663
if test "$vhook" = "yes" ; then
664
  echo "BUILD_VHOOK=yes" >> config.mak
665
  echo "#define HAVE_VHOOK 1" >> $TMPH
666
  extralibs="$extralibs $ldl"
667
fi
668
if test "$lshared" = "yes" ; then
669
  echo "BUILD_SHARED=yes" >> config.mak
670
  echo "PIC=-fPIC" >> config.mak
671
fi
672
echo "EXTRALIBS=$extralibs" >> config.mak
673
echo -n "VERSION=" >>config.mak
674
head $source_path/VERSION >>config.mak
675
echo "" >>config.mak
676
# if you do not want to use encoders, disable that.
677
echo "#define CONFIG_ENCODERS 1" >> $TMPH
678
echo "CONFIG_ENCODERS=yes" >> config.mak
679

    
680
# if you do not want to use decoders, disable that.
681
echo "#define CONFIG_DECODERS 1" >> $TMPH
682
echo "CONFIG_DECODERS=yes" >> config.mak
683

    
684
# AC3
685
if test "$a52" = "yes" ; then
686
  echo "#define CONFIG_AC3 1" >> $TMPH
687
  echo "CONFIG_AC3=yes" >> config.mak
688

    
689
  if test "$a52bin" = "yes" ; then
690
    echo "#define CONFIG_A52BIN 1" >> $TMPH
691
    echo "CONFIG_A52BIN=yes" >> config.mak
692
  fi
693
fi
694

    
695
# mpeg audio high precision mode
696
if test "$mpegaudio_hp" = "yes" ; then
697
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
698
fi
699

    
700
if test "$v4l" = "yes" ; then
701
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
702
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
703
fi
704

    
705
if test "$dlopen" = "yes" ; then
706
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
707
fi
708

    
709
if test "$dlfcn" = "yes" ; then
710
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
711
fi
712

    
713
if test "$audio_oss" = "yes" ; then
714
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
715
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
716
fi
717

    
718
if test "$audio_beos" = "yes" ; then
719
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
720
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
721
fi
722

    
723
if test "$network" = "yes" ; then
724
  echo "#define CONFIG_NETWORK 1" >> $TMPH
725
  echo "CONFIG_NETWORK=yes" >> config.mak
726
fi
727

    
728
if test "$zlib" = "yes" ; then
729
  echo "#define CONFIG_ZLIB 1" >> $TMPH
730
  echo "CONFIG_ZLIB=yes" >> config.mak
731
fi
732

    
733
if test "$mp3lame" = "yes" ; then
734
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
735
  echo "CONFIG_MP3LAME=yes" >> config.mak
736
fi
737

    
738
if test "$vorbis" = "yes" ; then
739
  echo "#define CONFIG_VORBIS 1" >> $TMPH
740
  echo "CONFIG_VORBIS=yes" >> config.mak
741
fi
742

    
743
if test "$win32" = "yes" ; then
744
  echo "#define CONFIG_WIN32 1" >> $TMPH
745
  echo "CONFIG_WIN32=yes" >> config.mak
746
fi
747

    
748
if test "$mingw32" = "yes" ; then
749
  echo "#define CONFIG_WIN32 1" >> $TMPH
750
  echo "CONFIG_WIN32=yes" >> config.mak
751
  echo "#define __MINGW32__ 1" >> $TMPH
752
  echo "__MINGW32__=1" >> config.mak
753
fi
754

    
755
if test "$cygwin" = "yes" ; then
756
  # setup correct exesuffix
757
  echo "CONFIG_WIN32=yes" >> config.mak
758
fi
759

    
760
if test "$os2" = "yes" ; then
761
  echo "#define CONFIG_OS2 1" >> $TMPH
762
  echo "CONFIG_OS2=yes" >> config.mak
763
fi
764

    
765
if test "$darwin" = "yes"; then
766
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
767
  echo "CONFIG_DARWIN=yes" >> config.mak
768
fi
769

    
770
if test "$_malloc_h" = "yes" ; then
771
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
772
else
773
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
774
fi
775

    
776
if test "$_memalign" = "yes" ; then
777
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
778
else
779
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
780
fi
781

    
782
if test "$netserver" = "yes" ; then
783
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
784
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
785
fi
786

    
787
if test "$need_inet_aton" = "yes" ; then
788
  echo "NEED_INET_ATON=yes" >> config.mak
789
fi
790

    
791
if test "$simpleidct" = "yes" ; then
792
  echo "#define SIMPLE_IDCT 1" >> $TMPH
793
fi
794

    
795
if test "$ffserver" = "yes" ; then
796
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
797
  echo "CONFIG_FFSERVER=yes" >> config.mak
798
fi
799

    
800
echo "#define restrict $_restrict" >> $TMPH
801

    
802
# build tree in object directory if source path is different from current one
803
if test "$source_path_used" = "yes" ; then
804
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
805
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
806
    FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
807
    for dir in $DIRS ; do
808
            mkdir -p $dir
809
    done
810
    for f in $FILES ; do
811
        ln -sf $source_path/$f $f
812
    done
813
fi
814
echo "SRC_PATH=$source_path" >> config.mak
815

    
816
diff $TMPH config.h >/dev/null 2>&1
817
if test $? -ne 0 ; then
818
	mv -f $TMPH config.h
819
else
820
	echo "config.h is unchanged"
821
fi
822

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