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