]> git.sesse.net Git - ffmpeg/blob - configure
Help debugging by keeping symbols ans line numbers patch by (Michel Bardiaux <mbardia...
[ffmpeg] / configure
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 "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
17 echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
18 echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
19 echo "  --enable-faad            enable faad support via libfaad [default=no]"
20 echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
21 echo "  --enable-faac            enable faac support via libfaac [default=no]"
22 echo "  --enable-xvid            enable xvid support via xvidcore [default=no]"
23 echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
24 echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
25 echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
26 echo "  --enable-dts             enable GPL'ed DTS support [default=no]"
27 echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
28 echo "  --enable-shared-pp       use libpostproc.so [default=no]"
29 echo "  --enable-shared          build shared libraries [default=no]"
30 echo "  --enable-amr_nb          enable amr_nb float audio codec"
31 echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
32 echo "  --enable-amr_wb          enable amr_wb float audio codec"
33 echo "  --enable-sunmlib         use Sun medialib [default=no]"
34 echo "  --enable-pthreads        use pthreads [default=no]"
35 echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
36 echo ""
37 echo "Advanced options (experts only):"
38 echo "  --source-path=PATH       path of source code [$source_path]"
39 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
40 echo "  --cc=CC                  use C compiler CC [$cc]"
41 echo "  --make=MAKE              use specified make [$make]"
42 echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
43 echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
44 echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
45 echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
46 echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
47 echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
48 echo "  --disable-mmx            disable mmx usage"
49 echo "  --disable-altivec        disable AltiVec usage"
50 echo "  --disable-audio-oss      disable OSS audio support [default=no]"
51 echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
52 echo "  --disable-v4l            disable video4linux grabbing [default=no]"
53 echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
54 echo "  --disable-network        disable network support [default=no]"
55 echo "  --disable-zlib           disable zlib [default=no]"
56 echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
57 echo "  --disable-vhook          disable video hooking support"
58 echo "  --enable-gprof           enable profiling with gprof [$gprof]"
59 echo "  --disable-debug          disable debugging symbols"
60 echo "  --disable-opts           disable compiler optimizations"
61 echo "  --disable-mpegaudio-hp   faster (but less accurate)"
62 echo "                           mpegaudio decoding [default=no]"
63 echo "  --disable-ffserver       disable ffserver build"
64 echo "  --disable-ffplay         disable ffplay build"
65 echo "  --disable-risky          disables patent encumbered codecs"
66 echo "  --enable-small           optimize for size instead of speed"
67 echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
68 echo "  --disable-strip          disable stripping of executables and shared libraries"
69 echo ""
70 echo "NOTE: The object files are build at the place where configure is launched"
71 exit 1
72 fi
73
74 # set temporary file name
75 if test ! -z "$TMPDIR" ; then
76     TMPDIR1="${TMPDIR}"
77 elif test ! -z "$TEMPDIR" ; then
78     TMPDIR1="${TEMPDIR}"
79 else
80     TMPDIR1="/tmp"
81 fi
82
83 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
84 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
85 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
86 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
87 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
88
89 # default parameters
90 prefix="/usr/local"
91 mandir=""
92 bindir=""
93 cross_prefix=""
94 cc="gcc"
95 ar="ar"
96 ranlib="ranlib"
97 make="make"
98 strip="strip"
99 cpu=`uname -m`
100 tune="generic"
101 powerpc_perf="no"
102 mmx="default"
103 altivec="default"
104 mmi="default"
105 case "$cpu" in
106   i386|i486|i586|i686|i86pc|BePC)
107     cpu="x86"
108   ;;
109   # armv4l is a subset of armv5tel
110   armv4l|armv5tel)
111     cpu="armv4l"
112   ;;
113   alpha)
114     cpu="alpha"
115   ;;
116   "Power Macintosh"|ppc)
117     cpu="powerpc"
118   ;;
119   mips)
120     cpu="mips"
121   ;;
122   sun4u|sparc64)
123     cpu="sparc64"
124   ;;
125   sparc)
126     cpu="sparc"
127   ;;
128   sh4)
129     cpu="sh4"
130   ;;
131   *)
132     cpu="unknown"
133   ;;
134 esac
135 gprof="no"
136 v4l="yes"
137 audio_oss="yes"
138 audio_beos="no"
139 dv1394="yes"
140 network="yes"
141 zlib="yes"
142 mp3lame="no"
143 vorbis="no"
144 faad="no"
145 faadbin="no"
146 faac="no"
147 xvid="no"
148 a52="no"
149 a52bin="no"
150 dts="no"
151 pp="no"
152 shared_pp="no"
153 mingw32="no"
154 cygwin="no"
155 os2="no"
156 lshared="no"
157 optimize="yes"
158 debug="yes"
159 dostrip="yes"
160 extralibs="-lm"
161 simpleidct="yes"
162 bigendian="no"
163 inttypes="yes"
164 emu_fast_int="no"
165 vhook="default"
166 dlfcn="no"
167 dlopen="no"
168 mpegaudio_hp="yes"
169 SHFLAGS=-shared
170 netserver="no"
171 need_inet_aton="no"
172 ffserver="yes"
173 ffplay="yes"
174 LDFLAGS=-Wl,--warn-common
175 FFSLDFLAGS=-Wl,-E
176 LIBPREF="lib"
177 LIBSUF=".a"
178 SLIBPREF="lib"
179 SLIBSUF=".so"
180 EXESUF=""
181 risky="yes"
182 amr_nb="no"
183 amr_wb="no"
184 amr_nb_fixed="no"
185 sunmlib="no"
186 pthreads="no"
187 gpl="no"
188 memalignhack="no"
189
190 # OS specific
191 targetos=`uname -s`
192 case $targetos in
193 BeOS)
194 prefix="/boot/home/config"
195 # helps building libavcodec
196 CFLAGS="-DPIC -fomit-frame-pointer"
197 # 3 gcc releases known for BeOS, each with ugly bugs
198 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
199 case "$gcc_version" in
200 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
201 mmx="no"
202 ;;
203 *20010315*) echo "BeBits gcc"
204 CFLAGS="$CFLAGS -fno-expensive-optimizations"
205 ;;
206 esac
207 SHFLAGS=-nostart
208 # disable linux things
209 audio_oss="no"
210 v4l="no"
211 dv1394="no"
212 # enable beos things
213 audio_beos="yes"
214 # no need for libm, but the inet stuff
215 # Check for BONE
216 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
217 extralibs="-lbind -lsocket"
218 else
219 netserver="yes"
220 need_inet_aton="yes"
221 extralibs="-lnet"
222 fi ;;
223 SunOS)
224 v4l="no"
225 audio_oss="no"
226 dv1394="no"
227 make="gmake"
228 LDFLAGS=""
229 FFSLDFLAGS=""
230 need_inet_aton="yes"
231 extralibs="$extralibs -lsocket -lnsl"
232 ;;
233 FreeBSD)
234 v4l="no"
235 audio_oss="yes"
236 dv1394="no"
237 make="gmake"
238 CFLAGS="-pthread"
239 LDFLAGS="$LDFLAGS -export-dynamic -pthread"
240 ;;
241 BSD/OS)
242 v4l="no"
243 audio_oss="yes"
244 dv1394="no"
245 extralibs="-lpoll -lgnugetopt -lm"
246 make="gmake"
247 ;;
248 Darwin)
249 cc="cc"
250 v4l="no"
251 audio_oss="no"
252 dv1394="no"
253 ffserver="no"
254 SHFLAGS="-dynamiclib"
255 extralibs=""
256 darwin="yes"
257 strip="strip -x"
258 LDFLAGS="-Wl,-d"
259 FFSLDFLAGS=-Wl,-bind_at_load
260 ;;
261 MINGW32*)
262 # Note: the rest of the mingw32 config is done afterwards as mingw32
263 # can be forced on command line for linux cross compilation
264 mingw32="yes"
265 ;;
266 CYGWIN*)
267 v4l="no"
268 audio_oss="yes"
269 dv1394="no"
270 extralibs=""
271 cygwin="yes"
272 test -f /usr/include/inttypes.h || \
273 test -f /usr/local/include/inttypes.h || \
274 echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
275      "/usr/local/include/inttypes.h !!!"
276 ;;
277 Linux)
278 LDFLAGS="$LDFLAGS -rdynamic"
279 ;;
280 IRIX*)
281 ranlib="echo ignoring ranlib"
282 v4l="no"
283 audio_oss="no"
284 make="gmake"
285 ;;
286 OS/2)
287 TMPE=$TMPE".exe"
288 ar="emxomfar -p64"
289 ranlib="echo ignoring ranlib"
290 strip="echo ignoring strip"
291 CFLAGS="-Zomf"
292 LDFLAGS="-Zomf -Zstack 16384 -s"
293 SHFLAGS=""
294 FFSLDFLAGS=""
295 LIBPREF=""
296 LIBSUF=".lib"
297 SLIBPREF=""
298 SLIBSUF=".dll"
299 EXESUF=".exe"
300 extralibs=""
301 v4l="no"
302 audio_oss="no"
303 dv1394="no"
304 network="no"
305 ffserver="no"
306 os2="yes"
307 ;;
308 *) ;;
309 esac
310
311 # From mplayer configure. We need TARGET_OS available
312 # to the Makefile, so it can distinguish between flavors
313 # of AltiVec on PowerPC
314 TARGET_OS=`( uname -s ) 2>&1`
315   case "$TARGET_OS" in
316   Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
317     ;;
318   IRIX*)
319     TARGET_OS=IRIX
320     ;;
321   HP-UX*)
322     TARGET_OS=HP-UX
323     ;;
324   [cC][yY][gG][wW][iI][nN]*)
325     TARGET_OS=CYGWIN
326     ;;
327   *)
328     TARGET_OS="$TARGET_OS-UNKNOWN"
329     ;;
330   esac
331
332 # find source path
333 # XXX: we assume an absolute path is given when launching configure, 
334 # except in './configure' case.
335 source_path="`echo $0 | sed -e 's#/configure##'`"
336 source_path_used="yes"
337 if test -z "$source_path" -o "$source_path" = "." ; then
338     source_path=`pwd`
339     source_path_used="no"
340 fi
341
342 for opt do
343   case "$opt" in
344   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
345   ;;
346   --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
347   ;;
348   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
349   ;;
350   --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
351   ;;
352   --cc=*) cc=`echo $opt | cut -d '=' -f 2`
353   ;;
354   --make=*) make=`echo $opt | cut -d '=' -f 2`
355   ;;
356   --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
357   ;;
358   --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
359   ;;
360   --extra-libs=*) extralibs=${opt#--extra-libs=}
361   ;;
362   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
363   ;;
364   --tune=*) tune=`echo $opt | cut -d '=' -f 2`
365   ;;
366   --powerpc-perf-enable) powerpc_perf="yes"
367   ;;
368   --disable-mmx) mmx="no"
369   ;;
370   --disable-altivec) altivec="no"
371   ;;
372   --enable-gprof) gprof="yes"
373   ;;
374   --disable-v4l) v4l="no"
375   ;;
376   --disable-audio-oss) audio_oss="no"
377   ;;
378   --disable-audio-beos) audio_beos="no"
379   ;;
380   --disable-dv1394) dv1394="no"
381   ;;
382   --disable-network) network="no"; ffserver="no"
383   ;;
384   --disable-zlib) zlib="no"
385   ;;
386   --enable-a52) a52="yes"
387   ;;
388   --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
389   ;;
390   --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
391   ;;
392   --enable-pp) pp="yes"
393   ;;
394   --enable-shared-pp) shared_pp="yes"
395   ;;
396   --enable-mp3lame) mp3lame="yes"
397   ;;
398   --enable-vorbis) vorbis="yes"
399   ;;
400   --enable-faad) faad="yes"
401   ;;
402   --enable-faadbin) faadbin="yes"
403   ;;
404   --enable-faac) faac="yes"
405   ;;
406   --enable-xvid) xvid="yes"
407   ;;
408   --disable-vhook) vhook="no"
409   ;;
410   --disable-simple_idct) simpleidct="no"
411   ;;
412   --enable-mingw32) mingw32="yes"
413   ;;
414   --enable-shared) lshared="yes"
415   ;;
416   --disable-debug) debug="no"
417   ;;
418   --disable-opts) optimize="no"
419   ;;
420   --disable-mpegaudio-hp) mpegaudio_hp="no"
421   ;;
422   --disable-ffserver) ffserver="no"
423   ;;
424   --disable-ffplay) ffplay="no"
425   ;;
426   --disable-risky) risky="no"
427   ;;
428   --enable-small) optimize="small"
429   ;;
430   --enable-amr_nb) amr_nb="yes"
431   ;;
432   --enable-amr_nb-fixed) amr_nb_fixed="yes"
433   ;;
434   --enable-amr_wb) amr_wb="yes"
435   ;; 
436   --enable-sunmlib) sunmlib="yes"
437   ;;
438   --enable-pthreads) pthreads="yes"
439   ;;
440   --enable-gpl) gpl="yes"
441   ;;
442   --enable-memalign-hack) memalignhack="yes"
443   ;;
444   --disable-strip) dostrip="no"
445   ;;
446   esac
447 done
448
449 if test "$gpl" != "yes"; then
450     if test "$pp" != "no" -o "$shared_pp" != "no"; then
451         echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
452         fail="yes"
453     fi
454
455     if test "$a52" != "no" -o "$a52bin" != "no"; then
456         echo "liba52 is under GPL and --enable-gpl is not specified"
457         fail="yes"
458     fi
459
460     if test "$xvid" != "no"; then
461         echo "libxvidcore is under GPL and --enable-gpl is not specified"
462         fail="yes"
463     fi
464
465     if test "$dts" != "no"; then
466         echo "libdts is under GPL and --enable-gpl is not specified"
467         fail="yes"
468     fi
469     
470     if test "$faad" != "no" -o "$faadbin" != "no"; then
471         cat > $TMPC << EOF
472             #include <faad.h>
473             int main( void ) { return 0; }
474 EOF
475     
476         if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
477             cat > $TMPC << EOF
478                 #include <faad.h>
479                 #ifndef FAAD2_VERSION
480                 ok faad1
481                 #endif
482                 int main( void ) { return 0; }
483 EOF
484             if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
485                 echo "faad2 is under GPL and --enable-gpl is not specified"
486                 fail="yes"
487             fi
488         else
489             faad="no"
490             faadbin="no"
491             echo "faad test failed"
492         fi
493     fi
494    
495
496     if test "$fail" = "yes"; then
497         exit 1
498     fi
499 fi
500
501 # compute mmx state
502 if test $mmx = "default"; then
503     if test $cpu = "x86"; then
504         mmx="yes"
505     else
506         mmx="no"
507     fi
508 fi
509
510 #Darwin CC versions
511 needmdynamicnopic="no"
512 if test $targetos = Darwin; then
513     if test -n "`$cc -v 2>&1 | grep xlc`"; then
514         CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
515     else
516         gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
517         case "$gcc_version" in
518             *2.95*) 
519                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
520                 ;;
521             *3.*)
522                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
523                 if test "$lshared" = no; then
524                    needmdynamicnopic="yes"
525                 fi
526                 ;;
527             *)
528                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
529                 if test "$lshared" = no; then
530                    needmdynamicnopic="yes"
531                 fi
532                 ;;
533         esac
534     fi
535 fi
536
537 # Can only do AltiVec on PowerPC
538 if test $altivec = "default"; then
539     if test $cpu = "powerpc"; then
540         altivec="yes"
541     else
542         altivec="no"
543     fi
544 fi
545
546 # Add processor-specific flags
547 TUNECPU="generic"
548 POWERPCMODE="32bits"
549 if test $tune != "generic"; then
550     case $tune in
551         601|ppc601|PowerPC601)
552             CFLAGS="$CFLAGS -mcpu=601"
553             if test $altivec = "yes"; then
554                 echo "WARNING: tuning for PPC601 but altivec enabled !";
555             fi
556             TUNECPU=ppc601
557         ;;
558         603*|ppc603*|PowerPC603*)
559             CFLAGS="$CFLAGS -mcpu=603"
560             if test $altivec = "yes"; then
561                 echo "WARNING: tuning for PPC603 but altivec enabled !";
562             fi
563             TUNECPU=ppc603
564         ;;
565         604*|ppc604*|PowerPC604*)
566             CFLAGS="$CFLAGS -mcpu=604"
567             if test $altivec = "yes"; then
568                 echo "WARNING: tuning for PPC604 but altivec enabled !";
569             fi
570             TUNECPU=ppc604
571         ;;
572         G3|g3|75*|ppc75*|PowerPC75*)
573             CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
574             if test $altivec = "yes"; then
575                 echo "WARNING: tuning for PPC75x but altivec enabled !";
576             fi
577             TUNECPU=ppc750
578         ;;
579         G4|g4|745*|ppc745*|PowerPC745*)
580             CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
581             if test $altivec = "no"; then
582                 echo "WARNING: tuning for PPC745x but altivec disabled !";
583             fi
584             TUNECPU=ppc7450
585         ;;
586         74*|ppc74*|PowerPC74*)
587             CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
588             if test $altivec = "no"; then
589                 echo "WARNING: tuning for PPC74xx but altivec disabled !";
590             fi
591             TUNECPU=ppc7400
592         ;;
593         G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
594             CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
595             if test $altivec = "no"; then
596                 echo "WARNING: tuning for PPC970 but altivec disabled !";
597             fi
598             TUNECPU=ppc970
599             POWERPCMODE="64bits"
600         ;;
601         *)
602         echo "WARNING: unknown CPU "$tune", ignored"
603         ;;
604     esac
605 fi
606
607 # AltiVec flags: The FSF version of GCC differs from the Apple version 
608 if test $cpu = "powerpc"; then
609     if test $altivec = "yes"; then
610         if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
611             CFLAGS="$CFLAGS -faltivec"
612         else
613             CFLAGS="$CFLAGS -maltivec -mabi=altivec"
614         fi
615     fi
616 fi
617
618 # See if we have <altivec.h>
619 cat > $TMPC << EOF
620 #include <altivec.h>
621 int main( void ) { return 0; }
622 EOF
623
624 _altivec_h="no"
625 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
626 _altivec_h="yes"
627 fi
628
629 # See does our compiler support Motorola AltiVec C API
630 if test $altivec = "yes"; then
631 if test $_altivec_h = "yes"; then
632 cat > $TMPC << EOF
633 #include <altivec.h>
634 int main(void) {
635     vector signed int v1, v2, v3;
636     v1 = vec_add(v2,v3);
637     return 0;
638 }
639 EOF
640 else
641 cat > $TMPC << EOF
642 int main(void) {
643     vector signed int v1, v2, v3;
644     v1 = vec_add(v2,v3);
645     return 0;
646 }
647 EOF
648 fi
649 $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
650 fi
651
652 # Can only do mmi on mips
653 if test $mmi = "default"; then
654     if test $cpu = "mips"; then
655         mmi="yes"
656     else
657         mmi="no"
658     fi
659 fi
660
661 # See does our compiler support mmi
662 if test $mmi = "yes"; then
663 cat > $TMPC << EOF
664 int main(void) {
665     __asm__ ("lq \$2, 0(\$2)");
666     return 0;
667 }
668 EOF
669 $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
670 fi
671
672 if test "$mingw32" = "yes" ; then
673     v4l="no"
674     audio_oss="no"
675     dv1394="no"
676     ffserver="no"
677     network="no"
678     LIBPREF=""
679     LIBSUF=".lib"
680     SLIBPREF=""
681     SLIBSUF=".dll"
682     EXESUF=".exe"
683     prefix="/c/Program Files/FFmpeg"
684     bindir="$prefix"
685 fi
686
687 cc="${cross_prefix}${cc}"
688 ar="${cross_prefix}${ar}"
689 ranlib="${cross_prefix}${ranlib}"
690 strip="${cross_prefix}${strip}"
691
692 if test -z "$cross_prefix" ; then
693
694 # ---
695 # big/little endian test
696 cat > $TMPC << EOF
697 #include <inttypes.h>
698 int main(int argc, char ** argv){
699         volatile uint32_t i=0x01234567;
700         return (*((uint8_t*)(&i))) == 0x67;
701 }
702 EOF
703
704 if $cc -o $TMPE $TMPC 2>/dev/null ; then
705 $TMPE && bigendian="yes"
706 else
707 echo big/little test failed
708 fi
709
710 else
711
712 # if cross compiling, cannot launch a program, so make a static guess
713 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
714     bigendian="yes"
715 fi
716
717 fi
718
719 # ---
720 # *inttypes.h* test
721 cat > $TMPC << EOF
722 #include <inttypes.h>
723 int main(int argc, char ** argv){
724     return 0;
725 }
726 EOF
727
728 $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
729
730 # ---
731 # *int_fast* test
732 cat > $TMPC << EOF
733 #include <inttypes.h>
734 int main(int argc, char ** argv){
735         volatile uint_fast64_t i=0x01234567;
736         return 0;
737 }
738 EOF
739
740 $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
741
742 # ---
743 # check availability of some header files
744
745 cat > $TMPC << EOF
746 #include <malloc.h>
747 int main( void ) { return 0; }
748 EOF
749
750 _memalign=no
751 _malloc_h=no
752 if $cc -o $TMPE $TMPC 2> /dev/null ; then
753 _malloc_h=yes
754 _memalign=yes
755 # check for memalign - atmos
756 cat > $TMPC << EOF
757 #include <malloc.h>
758 int main ( void ) {
759 char *string = NULL;
760 string = memalign(64, sizeof(char));
761 return 0;
762 }
763 EOF
764 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
765 fi
766
767 if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
768     echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
769     exit 1
770 fi
771
772 cat > $TMPC << EOF
773 #include <time.h>
774 int main( void ) { localtime_r(NULL, NULL); }
775 EOF
776
777 localtime_r=no
778 if $cc -o $TMPE $TMPC 2> /dev/null ; then
779   localtime_r=yes
780 fi
781
782 if test "$zlib" = "yes"; then
783 # check for zlib - mmu_man
784 cat > $TMPC << EOF
785 #include <zlib.h>
786 int main ( void ) {
787 if (zlibVersion() != ZLIB_VERSION)
788    puts("zlib version differs !!!");
789    return 1;
790 return 0;
791 }
792 EOF
793 $cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
794 # $TMPE 2> /dev/null > /dev/null || zlib="no"
795 # XXX: more tests needed - runtime test
796 fi
797 if test "$zlib" = "yes"; then
798 extralibs="$extralibs -lz"
799 fi
800
801 # test for lrintf in math.h
802 cat > $TMPC << EOF
803 #define _ISOC9X_SOURCE  1
804 #include <math.h>
805 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
806 EOF
807
808 have_lrintf="no"
809 if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
810   have_lrintf="yes"
811   # allanc@chickenandporn.com: cannot execute cross-compiled
812   # code on the host.  Only execute if not cross-compiling.
813   if test -z "$cross_prefix" ; then
814     $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
815   fi
816 fi
817
818 _restrict=
819 for restrict_keyword in restrict __restrict__ __restrict; do
820   echo "void foo(char * $restrict_keyword p);" > $TMPC
821   if $cc -c -o $TMPO $TMPC 2> /dev/null; then
822     _restrict=$restrict_keyword
823     break;
824   fi
825 done
826
827 # test gcc version to see if vector builtins can be used
828 # currently only used on i386 for MMX builtins
829 cat > $TMPC << EOF
830 int main(void) { 
831 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
832 return 0;
833 #else
834 #error no vector builtins
835 #endif
836 }
837 EOF
838
839 builtin_vector=no
840 if $cc -o $TMPO $TMPC 2> /dev/null ; then
841   builtin_vector=yes
842 fi
843
844 # dlopen/dlfcn.h probing
845
846 cat > $TMPC << EOF
847 #include <dlfcn.h>
848 int main( void ) { return (int) dlopen("foo", 0); }
849 EOF
850
851 ldl=-ldl
852
853 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
854 dlfcn=yes
855 dlopen=yes
856 fi
857
858 if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
859 dlfcn=yes
860 dlopen=yes
861 ldl=""
862 fi
863
864 cat > $TMPC << EOF
865 int main( void ) { return (int) dlopen("foo", 0); }
866 EOF
867
868 if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
869 dlopen=yes
870 fi
871
872 if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
873 dlopen=yes
874 ldl=""
875 fi
876
877 if test "$vhook" = "default" ; then
878   vhook="$dlopen"
879 fi
880
881 ##########################################
882 # imlib probe
883
884 cat > $TMPC << EOF
885 #include <X11/Xlib.h>
886 #include <Imlib2.h>
887 int main( void ) { return (int) imlib_load_font("foo"); }
888 EOF
889
890 imlib2=no
891 if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
892 imlib2=yes
893 fi
894
895 ##########################################
896 # freetype probe
897
898 cat > $TMPC << EOF
899 #include <ft2build.h>
900 int main( void ) { return (int) FT_Init_FreeType(0); }
901 EOF
902
903 freetype2=no
904 if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
905   if (freetype-config --version) >/dev/null 2>&1 ; then
906     if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
907       freetype2=yes
908     fi
909   fi
910 fi
911
912 ##########################################
913 # SDL probe
914
915 cat > $TMPC << EOF
916 #include <SDL.h>
917 #undef main /* We don't want SDL to override our main() */
918 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
919 EOF
920
921 sdl_too_old=no
922 sdl=no
923 if (sdl-config --version) >/dev/null 2>&1 ; then
924 if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
925 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
926 if test "$_sdlversion" -lt 121 ; then
927 sdl_too_old=yes
928 else
929 sdl=yes
930 fi
931 fi
932 fi
933
934 ##########################################
935 # texi2html probe
936
937 texi2html=no
938 if (texi2html -version) >/dev/null 2>&1; then
939 texi2html=yes
940 fi
941
942 case "`$cc -v 2>&1 | grep version`" in
943     *gcc*)
944         CFLAGS="-Wall $CFLAGS"
945         ;;
946     *)
947         ;;
948 esac
949
950 if test "$sdl" = "no" ; then
951    ffplay=no
952 fi
953
954 if test "$debug" = "yes"; then
955         CFLAGS="-g $CFLAGS"
956 fi
957
958 if test "$optimize" = "small"; then
959 #  CFLAGS=${CFLAGS//-O3/-Os}
960   CFLAGS="$CFLAGS -Os"
961 fi
962
963 if test "$optimize" = "yes"; then
964     if test -n "`$cc -v 2>&1 | grep xlc`"; then
965         CFLAGS="$CFLAGS -O5"
966         LDFLAGS="$LDFLAGS -O5"
967     else
968         CFLAGS="-O3 $CFLAGS"
969     fi
970 fi
971
972 if test x"$bindir" = x""; then
973 bindir="${prefix}/bin"
974 fi
975
976 if test x"$mandir" = x""; then
977 mandir="${prefix}/man"
978 fi
979
980 echo "Install prefix   $prefix"
981 echo "Source path      $source_path"
982 echo "C compiler       $cc"
983 echo "make             $make"
984 echo "CPU              $cpu ($tune)"
985 echo "Big Endian       $bigendian"
986 echo "inttypes.h       $inttypes"
987 echo "broken inttypes.h $emu_fast_int"
988 if test $cpu = "x86"; then
989 echo "MMX enabled      $mmx"
990 echo "Vector Builtins  $builtin_vector"
991 fi
992 if test $cpu = "mips"; then
993 echo "MMI enabled      $mmi"
994 fi
995 if test $cpu = "powerpc"; then
996 echo "AltiVec enabled  $altivec"
997 fi
998 echo "gprof enabled    $gprof"
999 echo "zlib enabled     $zlib"
1000 echo "mp3lame enabled  $mp3lame"
1001 echo "vorbis enabled   $vorbis"
1002 echo "faad enabled     $faad"
1003 echo "faadbin enabled  $faadbin"
1004 echo "faac enabled     $faac"
1005 echo "xvid enabled     $xvid"
1006 echo "a52 support      $a52"
1007 echo "a52 dlopened     $a52bin"
1008 echo "dts support      $dts"
1009 echo "pp support       $pp"
1010 echo "debug symbols    $debug"
1011 echo "strip symbols    $dostrip"
1012 echo "optimize         $optimize"
1013 echo "shared pp        $shared_pp"
1014 echo "Video hooking    $vhook"
1015 echo "SDL support      $sdl"
1016 if test $sdl_too_old = "yes"; then
1017 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1018 fi
1019 echo "risky / patent encumbered codecs $risky"
1020
1021 if test "$vhook" = "yes" ; then
1022 echo "Imlib2 support   $imlib2"
1023 echo "freetype support $freetype2"
1024 fi
1025 echo "Sun medialib support"  $sunmlib
1026 echo "pthreads support"      $pthreads
1027 echo "AMR-NB float support"  $amr_nb
1028 echo "AMR-NB fixed support"  $amr_nb_fixed
1029 echo "AMR-WB float support"  $amr_wb
1030 if test "$gpl" = "no" ; then
1031 echo "License: LGPL"
1032 else
1033 echo "License: GPL"
1034 fi
1035
1036 echo "Creating config.mak and config.h"
1037
1038 echo "# Automatically generated by configure - do not modify" > config.mak
1039 echo "/* Automatically generated by configure - do not modify */" > $TMPH
1040
1041 echo "prefix=$prefix" >> config.mak
1042 echo "bindir=$bindir" >> config.mak
1043 echo "mandir=$mandir" >> config.mak
1044 echo "MAKE=$make" >> config.mak
1045 echo "CC=$cc" >> config.mak
1046 echo "AR=$ar" >> config.mak
1047 echo "RANLIB=$ranlib" >> config.mak
1048 if test "$dostrip" = "yes" ; then
1049 echo "STRIP=$strip" >> config.mak
1050 echo "INSTALLSTRIP=-s" >> config.mak
1051 else
1052 echo "STRIP=echo ignoring strip" >> config.mak
1053 echo "INSTALLSTRIP=" >> config.mak
1054 fi
1055
1056 # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
1057 # shared modules on OS/X (vhook/Makefile).
1058 SHCFLAGS=$CFLAGS
1059 if test "$needmdynamicnopic" = yes; then
1060    CFLAGS="$CFLAGS -mdynamic-no-pic"
1061 fi
1062
1063 echo "OPTFLAGS=$CFLAGS" >> config.mak
1064 echo "SHCFLAGS=$SHCFLAGS">>config.mak
1065 echo "LDFLAGS=$LDFLAGS" >> config.mak
1066 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1067 echo "SHFLAGS=$SHFLAGS" >> config.mak
1068 echo "LIBPREF=$LIBPREF" >> config.mak
1069 echo "LIBSUF=$LIBSUF" >> config.mak
1070 echo "SLIBPREF=$SLIBPREF" >> config.mak
1071 echo "SLIBSUF=$SLIBSUF" >> config.mak
1072 echo "EXESUF=$EXESUF" >> config.mak
1073 echo "TARGET_OS=$TARGET_OS" >> config.mak
1074 if test "$cpu" = "x86" ; then
1075   echo "TARGET_ARCH_X86=yes" >> config.mak
1076   echo "#define ARCH_X86 1" >> $TMPH
1077 elif test "$cpu" = "armv4l" ; then
1078   echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1079   echo "#define ARCH_ARMV4L 1" >> $TMPH
1080 elif test "$cpu" = "alpha" ; then
1081   echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1082   echo "#define ARCH_ALPHA 1" >> $TMPH
1083 elif test "$cpu" = "sparc64" ; then
1084   echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1085   echo "#define ARCH_SPARC64 1" >> $TMPH
1086   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1087   echo "#define ARCH_SPARC 1" >> $TMPH
1088 elif test "$cpu" = "sparc" ; then
1089   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1090   echo "#define ARCH_SPARC 1" >> $TMPH
1091 elif test "$cpu" = "powerpc" ; then
1092   echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1093   echo "#define ARCH_POWERPC 1" >> $TMPH
1094   if test $POWERPCMODE = "32bits"; then
1095     echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1096   else
1097     echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1098   fi
1099   if test "$powerpc_perf" = "yes"; then
1100     echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1101   fi
1102 elif test "$cpu" = "mips" ; then
1103   echo "TARGET_ARCH_MIPS=yes" >> config.mak
1104   echo "#define ARCH_MIPS 1" >> $TMPH
1105 elif test "$cpu" = "sh4" ; then
1106   echo "TARGET_ARCH_SH4=yes" >> config.mak
1107   echo "#define ARCH_SH4 1" >> $TMPH
1108 fi
1109 echo "#define TUNECPU $TUNECPU" >> $TMPH
1110 if test "$bigendian" = "yes" ; then
1111   echo "WORDS_BIGENDIAN=yes" >> config.mak
1112   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1113 fi
1114 if test "$inttypes" != "yes" ; then
1115   echo "#define EMULATE_INTTYPES 1" >> $TMPH
1116 fi
1117 if test "$emu_fast_int" = "yes" ; then
1118   echo "#define EMULATE_FAST_INT 1" >> $TMPH
1119 fi
1120 if test "$mmx" = "yes" ; then
1121   echo "TARGET_MMX=yes" >> config.mak
1122   echo "#define HAVE_MMX 1" >> $TMPH
1123   echo "#define __CPU__ 586" >> $TMPH
1124 fi
1125 if test "$builtin_vector" = "yes" ; then
1126   echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1127   echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1128 fi
1129 if test "$mmi" = "yes" ; then
1130   echo "TARGET_MMI=yes" >> config.mak
1131   echo "#define HAVE_MMI 1" >> $TMPH
1132 fi
1133 if test "$altivec" = "yes" ; then
1134   echo "TARGET_ALTIVEC=yes" >> config.mak
1135   echo "#define HAVE_ALTIVEC 1" >> $TMPH
1136   echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1137   echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1138   if test "$_altivec_h" = "yes" ; then
1139     echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1140   else
1141     echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1142   fi
1143 fi
1144 if test "$gprof" = "yes" ; then
1145   echo "TARGET_GPROF=yes" >> config.mak
1146   echo "#define HAVE_GPROF 1" >> $TMPH
1147 fi
1148 if test "$localtime_r" = "yes" ; then
1149   echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1150 fi
1151 if test "$imlib2" = "yes" ; then
1152   echo "HAVE_IMLIB2=yes" >> config.mak
1153 fi
1154 if test "$freetype2" = "yes" ; then
1155   echo "HAVE_FREETYPE2=yes" >> config.mak
1156 fi
1157 if test "$sunmlib" = "yes" ; then
1158   echo "HAVE_MLIB=yes" >> config.mak
1159   echo "#define HAVE_MLIB 1" >> $TMPH
1160   extralibs="$extralibs -lmlib"
1161 fi
1162 if test "$pthreads" = "yes" ; then
1163   echo "HAVE_PTHREADS=yes" >> config.mak
1164   echo "#define HAVE_PTHREADS 1" >> $TMPH
1165   if test $targetos != FreeBSD; then
1166      extralibs="$extralibs -lpthread"
1167   fi
1168 fi
1169 if test "$sdl" = "yes" ; then
1170   echo "CONFIG_SDL=yes" >> config.mak
1171   echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1172   echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1173 fi
1174 if test "$texi2html" = "yes"; then
1175   echo "BUILD_DOC=yes" >> config.mak
1176 fi
1177 if test "$have_lrintf" = "yes" ; then
1178   echo "#define HAVE_LRINTF 1" >> $TMPH
1179 fi
1180 if test "$vhook" = "yes" ; then
1181   echo "BUILD_VHOOK=yes" >> config.mak
1182   echo "#define HAVE_VHOOK 1" >> $TMPH
1183   extralibs="$extralibs $ldl"
1184 fi
1185 if test "$lshared" = "yes" ; then
1186   echo "BUILD_SHARED=yes" >> config.mak
1187   echo "PIC=-fPIC" >> config.mak
1188 fi
1189 echo "EXTRALIBS=$extralibs" >> config.mak
1190 version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1191  cut -d '"' -f 2`
1192 echo "VERSION=$version" >>config.mak
1193 # if you do not want to use encoders, disable that.
1194 echo "#define CONFIG_ENCODERS 1" >> $TMPH
1195 echo "CONFIG_ENCODERS=yes" >> config.mak
1196
1197 # if you do not want to use decoders, disable that.
1198 echo "#define CONFIG_DECODERS 1" >> $TMPH
1199 echo "CONFIG_DECODERS=yes" >> config.mak
1200
1201 # AC3
1202 if test "$a52" = "yes" ; then
1203   echo "#define CONFIG_AC3 1" >> $TMPH
1204   echo "CONFIG_AC3=yes" >> config.mak
1205
1206   if test "$a52bin" = "yes" ; then
1207     echo "#define CONFIG_A52BIN 1" >> $TMPH
1208     echo "CONFIG_A52BIN=yes" >> config.mak
1209   fi
1210 fi
1211
1212 # DTS
1213 if test "$dts" = "yes" ; then
1214   echo "#define CONFIG_DTS 1" >> $TMPH
1215   echo "CONFIG_DTS=yes" >> config.mak
1216 fi
1217
1218 # PP
1219 if test "$pp" = "yes" ; then
1220   echo "#define CONFIG_PP 1" >> $TMPH
1221   echo "CONFIG_PP=yes" >> config.mak
1222
1223   if test "$shared_pp" = "yes" ; then
1224     echo "#define SHARED_PP 1" >> $TMPH
1225     echo "SHARED_PP=yes" >> config.mak
1226   fi
1227 fi
1228
1229 # mpeg audio high precision mode
1230 if test "$mpegaudio_hp" = "yes" ; then
1231   echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1232 fi
1233
1234 if test "$v4l" = "yes" ; then
1235   echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1236   echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1237 fi
1238
1239 if test "$dv1394" = "yes" ; then
1240   echo "#define CONFIG_DV1394 1" >> $TMPH
1241   echo "CONFIG_DV1394=yes" >> config.mak
1242 fi
1243
1244 if test "$dlopen" = "yes" ; then
1245   echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1246 fi
1247
1248 if test "$dlfcn" = "yes" ; then
1249   echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1250 fi
1251
1252 if test "$audio_oss" = "yes" ; then
1253   echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1254   echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1255 fi
1256
1257 if test "$audio_beos" = "yes" ; then
1258   echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1259   echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1260 fi
1261
1262 if test "$network" = "yes" ; then
1263   echo "#define CONFIG_NETWORK 1" >> $TMPH
1264   echo "CONFIG_NETWORK=yes" >> config.mak
1265 fi
1266
1267 if test "$zlib" = "yes" ; then
1268   echo "#define CONFIG_ZLIB 1" >> $TMPH
1269   echo "CONFIG_ZLIB=yes" >> config.mak
1270 fi
1271
1272 if test "$mp3lame" = "yes" ; then
1273   echo "#define CONFIG_MP3LAME 1" >> $TMPH
1274   echo "CONFIG_MP3LAME=yes" >> config.mak
1275 fi
1276
1277 if test "$vorbis" = "yes" ; then
1278   echo "#define CONFIG_VORBIS 1" >> $TMPH
1279   echo "CONFIG_VORBIS=yes" >> config.mak
1280 fi
1281
1282 if test "$faad" = "yes" ; then
1283   echo "#define CONFIG_FAAD 1" >> $TMPH
1284   echo "CONFIG_FAAD=yes" >> config.mak
1285 fi
1286
1287 if test "$faadbin" = "yes" ; then
1288   echo "#define CONFIG_FAADBIN 1" >> $TMPH
1289   echo "CONFIG_FAADBIN=yes" >> config.mak
1290 fi
1291
1292 if test "$faac" = "yes" ; then
1293   echo "#define CONFIG_FAAC 1" >> $TMPH
1294   echo "CONFIG_FAAC=yes" >> config.mak
1295 fi
1296
1297 if test "$xvid" = "yes" ; then
1298   echo "#define CONFIG_XVID 1" >> $TMPH
1299   echo "CONFIG_XVID=yes" >> config.mak
1300 fi
1301
1302 if test "$mingw32" = "yes" ; then
1303   echo "#define CONFIG_WIN32 1" >> $TMPH
1304   echo "CONFIG_WIN32=yes" >> config.mak
1305   echo "HAVE_W32THREADS=yes" >> config.mak
1306   echo "#define HAVE_W32THREADS 1" >> $TMPH
1307   echo "#ifndef __MINGW32__" >> $TMPH
1308   echo "#define __MINGW32__ 1" >> $TMPH
1309   echo "#endif" >> $TMPH
1310 fi
1311
1312 if test "$os2" = "yes" ; then
1313   echo "#define CONFIG_OS2 1" >> $TMPH
1314   echo "CONFIG_OS2=yes" >> config.mak
1315 fi
1316
1317 if test "$TARGET_OS" = "SunOS" ; then
1318   echo "#define CONFIG_SUNOS 1" >> $TMPH
1319 fi
1320
1321 if test "$darwin" = "yes"; then
1322   echo "#define CONFIG_DARWIN 1"  >> $TMPH
1323   echo "CONFIG_DARWIN=yes" >> config.mak
1324 fi
1325
1326 if test "$_malloc_h" = "yes" ; then
1327   echo "#define HAVE_MALLOC_H 1" >> $TMPH
1328 else
1329   echo "#undef  HAVE_MALLOC_H" >> $TMPH
1330 fi
1331
1332 if test "$_memalign" = "yes" ; then
1333   echo "#define HAVE_MEMALIGN 1" >> $TMPH
1334 else
1335   echo "#undef  HAVE_MEMALIGN" >> $TMPH
1336 fi
1337
1338 if test "$memalignhack" = "yes" ; then
1339   echo "#define MEMALIGN_HACK 1" >> $TMPH
1340 fi
1341
1342
1343 if test "$netserver" = "yes" ; then
1344   echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1345   echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1346 fi
1347
1348 if test "$need_inet_aton" = "yes" ; then
1349   echo "NEED_INET_ATON=yes" >> config.mak
1350 fi
1351
1352 if test "$simpleidct" = "yes" ; then
1353   echo "#define SIMPLE_IDCT 1" >> $TMPH
1354 fi
1355
1356 if test "$ffserver" = "yes" ; then
1357   echo "#define CONFIG_FFSERVER 1" >> $TMPH
1358   echo "CONFIG_FFSERVER=yes" >> config.mak
1359 fi
1360
1361 if test "$ffplay" = "yes" ; then
1362   echo "CONFIG_FFPLAY=yes" >> config.mak
1363 fi
1364
1365 if test "$risky" = "yes" ; then
1366   echo "#define CONFIG_RISKY 1" >> $TMPH
1367   echo "CONFIG_RISKY=yes" >> config.mak
1368 fi
1369
1370 if test "$gpl" = "yes" ; then
1371   echo "#define CONFIG_GPL 1" >> $TMPH
1372   echo "CONFIG_GPL=yes" >> config.mak
1373 fi
1374
1375 echo "#define restrict $_restrict" >> $TMPH
1376
1377 if test "$optimize" = "small"; then
1378   echo "#define always_inline"  >> $TMPH
1379 fi
1380
1381 # build tree in object directory if source path is different from current one
1382 if test "$source_path_used" = "yes" ; then
1383     DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1384           libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1385     FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1386     for dir in $DIRS ; do
1387             mkdir -p $dir
1388     done
1389     for f in $FILES ; do
1390         ln -sf $source_path/$f $f
1391     done
1392 fi
1393 echo "SRC_PATH=$source_path" >> config.mak
1394
1395 if test "$amr_wb" = "yes" ; then
1396   echo "#define AMR_WB 1" >> $TMPH
1397   echo "AMR_WB=yes" >> config.mak
1398   echo
1399   echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1400   echo "V5.1.0 from "
1401   echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1402   echo "and extracted the source to libavcodec/amrwb_float"
1403   echo
1404 fi
1405
1406 if test "$amr_nb" = "yes" ; then
1407   echo "#define AMR_NB 1" >> $TMPH
1408   echo "AMR_NB=yes" >> config.mak
1409   echo
1410 if test "$amr_nb_fixed" = "yes" ; then
1411   echo "AMR_NB_FIXED=yes" >> config.mak
1412   echo "#define AMR_NB_FIXED 1" >> $TMPH
1413   echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1414   echo "REL-5 version 5.1.0 from "
1415   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1416   echo "and extracted src to libavcodec/amr"
1417   echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1418   echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1419   echo
1420 else
1421   echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1422   echo "REL-5 V5.1.0 from "
1423   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1424   echo "and extracted the source to libavcodec/amr_float"
1425   echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1426   echo
1427 fi
1428
1429 fi
1430
1431 diff $TMPH config.h >/dev/null 2>&1
1432 if test $? -ne 0 ; then
1433         mv -f $TMPH config.h
1434 else
1435         echo "config.h is unchanged"
1436 fi
1437
1438 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH