Statistics
| Branch: | Revision:

ffmpeg / configure @ 732d9245

History | View | Annotate | Download (17.5 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
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
17
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
18

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

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

    
175
# find source path
176
# XXX: we assume an absolute path is given when launching configure, 
177
# except in './configure' case.
178
source_path=${0%configure}
179
source_path=${source_path%/}
180
source_path_used="yes"
181
if test -z "$source_path" -o "$source_path" = "." ; then
182
    source_path=`pwd`
183
    source_path_used="no"
184
fi
185

    
186
cat > $TMPC << EOF
187
#include <dlfcn.h>
188
int main( void ) { return (int) dlopen("foo", 0); }
189
EOF
190

    
191
ldl=-ldl
192

    
193
if $cc -o $TMPO $TMPC -ldl 2> /dev/null  ; then
194
vhook=yes
195
dlfcn=yes
196
dlopen=yes
197
fi
198

    
199
if $cc -o $TMPO $TMPC 2> /dev/null  ; then
200
vhook=yes
201
dlfcn=yes
202
dlopen=yes
203
ldl=""
204
fi
205

    
206
cat > $TMPC << EOF
207
int main( void ) { return (int) dlopen("foo", 0); }
208
EOF
209

    
210
if $cc -o $TMPO $TMPC -ldl 2> /dev/null  ; then
211
vhook=yes
212
dlopen=yes
213
fi
214

    
215
if $cc -o $TMPO $TMPC 2> /dev/null  ; then
216
vhook=yes
217
dlopen=yes
218
ldl=""
219
fi
220

    
221

    
222
cat > $TMPC << EOF
223
#include <X11/Xlib.h>
224
#include <Imlib2.h>
225
int main( void ) { return (int) imlib_load_font("foo"); }
226
EOF
227

    
228
imlib2=no
229
if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null  ; then
230
imlib2=yes
231
fi
232

    
233
for opt do
234
  case "$opt" in
235
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
236
  ;;
237
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
238
  ;;
239
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
240
  ;;
241
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
242
  ;;
243
  --make=*) make=`echo $opt | cut -d '=' -f 2`
244
  ;;
245
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
246
  ;;
247
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
248
  ;;
249
  --extra-libs=*) extralibs=${opt#--extra-libs=}
250
  ;;
251
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
252
  ;;
253
  --disable-mmx) mmx="no"
254
  ;;
255
  --disable-altivec) altivec="no"
256
  ;;
257
  --enable-gprof) gprof="yes"
258
  ;;
259
  --disable-v4l) v4l="no"
260
  ;;
261
  --disable-audio-oss) audio_oss="no"
262
  ;;
263
  --disable-audio-beos) audio_beos="no"
264
  ;;
265
  --disable-network) network="no"
266
  ;;
267
  --disable-zlib) zlib="no"
268
  ;;
269
  --disable-a52) a52="no"
270
  ;;
271
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
272
  ;;
273
  --enable-mp3lame) mp3lame="yes"
274
  ;;
275
  --enable-vorbis) vorbis="yes"
276
  ;;
277
  --disable-vhook) vhook="no"
278
  ;;
279
  --disable-simple_idct) simpleidct="no"
280
  ;;
281
  --enable-win32) win32="yes"
282
  ;;
283
  --enable-mingw32) mingw32="yes"
284
  ;;
285
  --enable-shared) lshared="yes"
286
  ;;
287
  --disable-mpegaudio-hp) mpegaudio_hp="no"
288
  ;;
289
  --disable-ffserver) ffserver="no"
290
  ;;
291
  esac
292
done
293

    
294
# compute mmx state
295
if test $mmx = "default"; then
296
    if test $cpu = "x86"; then
297
        mmx="yes"
298
    else
299
        mmx="no"
300
    fi
301
fi
302

    
303
# Can only do AltiVec on PowerPC
304
if test $altivec = "default"; then
305
    if test $cpu = "powerpc"; then
306
        altivec="yes"
307
    else
308
        altivec="no"
309
    fi
310
fi
311

    
312
# See does our compiler support Motorola AltiVec C API
313
if test $altivec = "yes"; then
314
cat > $TMPC << EOF
315
int main(void) {
316
    vector signed int v1, v2, v3;
317
    v1 = vec_add(v2,v3);
318
    return 0;
319
}
320
EOF
321
$cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
322
fi
323

    
324
# Can only do mmi on mips
325
if test $mmi = "default"; then
326
    if test $cpu = "mips"; then
327
        mmi="yes"
328
    else
329
        mmi="no"
330
    fi
331
fi
332

    
333
# See does our compiler support mmi
334
if test $mmi = "yes"; then
335
cat > $TMPC << EOF
336
int main(void) {
337
    __asm__ ("lq \$2, 0(\$2)");
338
    return 0;
339
}
340
EOF
341
$cc -o $TMPO $TMPC 2> /dev/null || mmi="no"
342
fi
343

    
344
# Checking for CFLAGS
345
if test -z "$CFLAGS"; then
346
    CFLAGS="-O3"
347
fi
348

    
349
if test "$win32" = "yes" ; then
350
    cross_prefix="i386-mingw32msvc-"
351
    v4l="no"
352
    audio_oss="no"
353
    network="no"
354
fi
355

    
356
if test "$mingw32" = "yes" ; then
357
    cross_prefix=""
358
    v4l="no"
359
    audio_oss="no"
360
    network="no"
361
fi
362

    
363
cc="${cross_prefix}${cc}"
364
ar="${cross_prefix}${ar}"
365
ranlib="${cross_prefix}${ranlib}"
366
strip="${cross_prefix}${strip}"
367

    
368
if test -z "$cross_prefix" ; then
369

    
370
# ---
371
# big/little endian test
372
cat > $TMPC << EOF
373
#include <inttypes.h>
374
int main(int argc, char ** argv){
375
	volatile uint32_t i=0x01234567;
376
	return (*((uint8_t*)(&i))) == 0x67;
377
}
378
EOF
379

    
380
if $cc -o $TMPO $TMPC 2>/dev/null ; then
381
$TMPO && bigendian="yes"
382
else
383
echo big/little test failed
384
fi
385

    
386
else
387

    
388
# if cross compiling, cannot launch a program, so make a static guess
389
if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
390
    bigendian="yes"
391
fi
392

    
393
fi
394

    
395
# ---
396
# check availability of some header files
397

    
398
cat > $TMPC << EOF
399
#include <malloc.h>
400
int main( void ) { return 0; }
401
EOF
402

    
403
_memalign=no
404
_malloc_h=no
405
if $cc -o $TMPO $TMPC 2> /dev/null ; then
406
_malloc_h=yes
407
_memalign=yes
408
# check for memalign - atmos
409
cat > $TMPC << EOF
410
#include <malloc.h>
411
int main ( void ) {
412
char *string = NULL;
413
string = memalign(64, sizeof(char));
414
return 0;
415
}
416
EOF
417
$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
418
fi
419

    
420
cat > $TMPC << EOF
421
#define _GNU_SOURCE
422
#include <time.h>
423
int main( void ) { return *strptime("", "", 0); }
424
EOF
425

    
426
strptime=no
427
if $cc -o $TMPO $TMPC 2> /dev/null ; then
428
  strptime=yes
429
fi
430

    
431
if test "$zlib" = "yes"; then
432
# check for zlib - mmu_man
433
cat > $TMPC << EOF
434
#include <zlib.h>
435
int main ( void ) {
436
if (zlibVersion() != ZLIB_VERSION)
437
   puts("zlib version differs !!!");
438
   return 1;
439
return 0;
440
}
441
EOF
442
$cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
443
# $TMPO 2> /dev/null > /dev/null || zlib="no"
444
# XXX: more tests needed - runtime test
445
fi
446
if test "$zlib" = "yes"; then
447
extralibs="$extralibs -lz"
448
fi
449

    
450
# test for lrintf in math.h
451
cat > $TMPC << EOF
452
#define _ISOC9X_SOURCE  1
453
#include <math.h>
454
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
455
EOF
456

    
457
have_lrintf="no"
458
if $cc $extralibs -o $TMPO $TMPC 2> /dev/null ; then
459
  have_lrintf="yes"
460
  $TMPO 2> /dev/null > /dev/null || have_lrintf="no"
461
fi
462

    
463
_restrict=
464
for restrict_keyword in restrict __restrict__ __restrict; do
465
  echo "void foo(char * $restrict_keyword p);" > $TMPC
466
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
467
    _restrict=$restrict_keyword
468
    break;
469
  fi
470
done
471

    
472
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
473
cat << EOF
474

    
475
Usage: configure [options]
476
Options: [defaults in brackets after descriptions]
477

    
478
EOF
479
echo "Standard options:"
480
echo "  --help                   print this message"
481
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
482
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
483
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
484
echo "  --enable-win32           enable win32 cross compile"
485
echo "  --enable-mingw32         enable mingw32 native windows compile"
486
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
487
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
488
echo "  --enable-shared          build shared libraries [default=no]"
489
echo ""
490
echo "Advanced options (experts only):"
491
echo "  --source-path=PATH       path of source code [$source_path]"
492
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
493
echo "  --cc=CC                  use C compiler CC [$cc]"
494
echo "  --make=MAKE              use specified make [$make]"
495
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
496
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
497
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
498
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
499
echo "  --disable-mmx            disable mmx usage"
500
echo "  --disable-altivec        disable AltiVec usage"
501
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
502
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
503
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
504
echo "  --disable-network        disable network support [default=no]"
505
echo "  --disable-zlib           disable zlib [default=no]"
506
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
507
echo "  --disable-vhook          disable video hooking support"
508
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
509
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
510
echo "                           mpegaudio decoding [default=no]"
511
echo "  --disable-ffserver       disable ffserver build"
512
echo ""
513
echo "NOTE: The object files are build at the place where configure is launched"
514
exit 1
515
fi
516

    
517
echo "Install prefix   $prefix"
518
echo "Source path      $source_path"
519
echo "C compiler       $cc"
520
echo "make             $make"
521
echo "CPU              $cpu"
522
echo "Big Endian       $bigendian"
523
if test $cpu = "x86"; then
524
echo "MMX enabled      $mmx"
525
fi
526
if test $cpu = "mips"; then
527
echo "MMI enabled      $mmi"
528
fi
529
if test $cpu = "powerpc"; then
530
echo "AltiVec enabled  $altivec"
531
fi
532
echo "gprof enabled    $gprof"
533
echo "zlib enabled     $zlib"
534
echo "mp3lame enabled  $mp3lame"
535
echo "vorbis enabled   $vorbis"
536
echo "a52 support      $a52"
537
echo "a52 dlopened     $a52bin"
538
echo "Video hooking    $vhook"
539

    
540
if test "$vhook" = "yes" ; then
541
echo "Imlib2 support   $imlib2"
542
fi
543

    
544
echo "Creating config.mak and config.h"
545

    
546
echo "# Automatically generated by configure - do not modify" > config.mak
547
echo "/* Automatically generated by configure - do not modify */" > $TMPH
548

    
549
echo "prefix=$prefix" >> config.mak
550
echo "MAKE=$make" >> config.mak
551
echo "CC=$cc" >> config.mak
552
echo "AR=$ar" >> config.mak
553
echo "RANLIB=$ranlib" >> config.mak
554
echo "STRIP=$strip" >> config.mak
555
echo "OPTFLAGS=$CFLAGS" >> config.mak
556
echo "LDFLAGS=$LDFLAGS" >> config.mak
557
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
558
echo "SHFLAGS=$SHFLAGS" >> config.mak
559
if test "$cpu" = "x86" ; then
560
  echo "TARGET_ARCH_X86=yes" >> config.mak
561
  echo "#define ARCH_X86 1" >> $TMPH
562
elif test "$cpu" = "armv4l" ; then
563
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
564
  echo "#define ARCH_ARMV4L 1" >> $TMPH
565
elif test "$cpu" = "alpha" ; then
566
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
567
  echo "#define ARCH_ALPHA 1" >> $TMPH
568
elif test "$cpu" = "sparc64" ; then
569
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
570
  echo "#define ARCH_SPARC64 1" >> $TMPH
571
elif test "$cpu" = "powerpc" ; then
572
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
573
  echo "#define ARCH_POWERPC 1" >> $TMPH
574
elif test "$cpu" = "mips" ; then
575
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
576
  echo "#define ARCH_MIPS 1" >> $TMPH
577
fi
578
if test "$bigendian" = "yes" ; then
579
  echo "WORDS_BIGENDIAN=yes" >> config.mak
580
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
581
fi
582
if test "$mmx" = "yes" ; then
583
  echo "TARGET_MMX=yes" >> config.mak
584
  echo "#define HAVE_MMX 1" >> $TMPH
585
fi
586
if test "$mmi" = "yes" ; then
587
  echo "TARGET_MMI=yes" >> config.mak
588
  echo "#define HAVE_MMI 1" >> $TMPH
589
fi
590
if test "$altivec" = "yes" ; then
591
  echo "TARGET_ALTIVEC=yes" >> config.mak
592
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
593
fi
594
if test "$gprof" = "yes" ; then
595
  echo "TARGET_GPROF=yes" >> config.mak
596
  echo "#define HAVE_GPROF 1" >> $TMPH
597
fi
598
if test "$strptime" = "yes" ; then
599
  echo "#define HAVE_STRPTIME 1" >> $TMPH
600
else
601
  echo "BUILD_STRPTIME=yes" >> config.mak
602
fi
603
if test "$imlib2" = "yes" ; then
604
  echo "HAVE_IMLIB2=yes" >> config.mak
605
fi
606
if test "$have_lrintf" = "yes" ; then
607
  echo "#define HAVE_LRINTF 1" >> $TMPH
608
fi
609
if test "$vhook" = "yes" ; then
610
  echo "BUILD_VHOOK=yes" >> config.mak
611
  echo "#define HAVE_VHOOK 1" >> $TMPH
612
  extralibs="$extralibs $ldl"
613
fi
614
if test "$lshared" = "yes" ; then
615
  echo "BUILD_SHARED=yes" >> config.mak
616
  echo "PIC=-fPIC" >> config.mak
617
fi
618
echo "EXTRALIBS=$extralibs" >> config.mak
619
echo -n "VERSION=" >>config.mak
620
head $source_path/VERSION >>config.mak
621
echo "" >>config.mak
622
# if you do not want to use encoders, disable that.
623
echo "#define CONFIG_ENCODERS 1" >> $TMPH
624
echo "CONFIG_ENCODERS=yes" >> config.mak
625

    
626
# if you do not want to use decoders, disable that.
627
echo "#define CONFIG_DECODERS 1" >> $TMPH
628
echo "CONFIG_DECODERS=yes" >> config.mak
629

    
630
# AC3
631
if test "$a52" = "yes" ; then
632
  echo "#define CONFIG_AC3 1" >> $TMPH
633
  echo "CONFIG_AC3=yes" >> config.mak
634

    
635
  if test "$a52bin" = "yes" ; then
636
    echo "#define CONFIG_A52BIN 1" >> $TMPH
637
    echo "CONFIG_A52BIN=yes" >> config.mak
638
  fi
639
fi
640

    
641
# mpeg audio high precision mode
642
if test "$mpegaudio_hp" = "yes" ; then
643
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
644
fi
645

    
646
if test "$v4l" = "yes" ; then
647
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
648
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
649
fi
650

    
651
if test "$dlopen" = "yes" ; then
652
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
653
fi
654

    
655
if test "$dlfcn" = "yes" ; then
656
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
657
fi
658

    
659
if test "$audio_oss" = "yes" ; then
660
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
661
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
662
fi
663

    
664
if test "$audio_beos" = "yes" ; then
665
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
666
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
667
fi
668

    
669
if test "$network" = "yes" ; then
670
  echo "#define CONFIG_NETWORK 1" >> $TMPH
671
  echo "CONFIG_NETWORK=yes" >> config.mak
672
fi
673

    
674
if test "$zlib" = "yes" ; then
675
  echo "#define CONFIG_ZLIB 1" >> $TMPH
676
  echo "CONFIG_ZLIB=yes" >> config.mak
677
fi
678

    
679
if test "$mp3lame" = "yes" ; then
680
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
681
  echo "CONFIG_MP3LAME=yes" >> config.mak
682
fi
683

    
684
if test "$vorbis" = "yes" ; then
685
  echo "#define CONFIG_VORBIS 1" >> $TMPH
686
  echo "CONFIG_VORBIS=yes" >> config.mak
687
fi
688

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

    
694
if test "$mingw32" = "yes" ; then
695
  echo "#define CONFIG_WIN32 1" >> $TMPH
696
  echo "CONFIG_WIN32=yes" >> config.mak
697
  echo "#define __MINGW32__ 1" >> $TMPH
698
  echo "__MINGW32__=1" >> config.mak
699
fi
700

    
701
if test "$cygwin" = "yes" ; then
702
  # setup correct exesuffix
703
  echo "CONFIG_WIN32=yes" >> config.mak
704
fi
705

    
706
if test "$darwin" = "yes"; then
707
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
708
  echo "CONFIG_DARWIN=yes" >> config.mak
709
fi
710

    
711
if test "$_malloc_h" = "yes" ; then
712
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
713
else
714
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
715
fi
716

    
717
if test "$_memalign" = "yes" ; then
718
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
719
else
720
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
721
fi
722

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

    
728
if test "$need_inet_aton" = "yes" ; then
729
  echo "NEED_INET_ATON=yes" >> config.mak
730
fi
731

    
732
if test "$simpleidct" = "yes" ; then
733
  echo "#define SIMPLE_IDCT 1" >> $TMPH
734
fi
735

    
736
if test "$ffserver" = "yes" ; then
737
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
738
  echo "CONFIG_FFSERVER=yes" >> config.mak
739
fi
740

    
741
echo "#define restrict $_restrict" >> $TMPH
742

    
743
# build tree in object directory if source path is different from current one
744
if test "$source_path_used" = "yes" ; then
745
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
746
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
747
    FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
748
    for dir in $DIRS ; do
749
            mkdir -p $dir
750
    done
751
    for f in $FILES ; do
752
        ln -sf $source_path/$f $f
753
    done
754
fi
755
echo "SRC_PATH=$source_path" >> config.mak
756

    
757
diff $TMPH config.h >/dev/null 2>&1
758
if test $? -ne 0 ; then
759
	mv -f $TMPH config.h
760
else
761
	echo "config.h is unchanged"
762
fi
763

    
764
rm -f $TMPO $TMPC $TMPS $TMPH