Move library name generation to configure, simplifies build system a bit more.
[ffmpeg.git] / 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 "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
17 echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
18 echo "  --enable-mp3lame         enable MP3 encoding via libmp3lame [default=no]"
19 echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
20 echo "  --enable-vorbis          enable Vorbis support via libvorbis [default=no]"
21 echo "  --enable-theora          enable Theora support via libtheora [default=no]"
22 echo "  --enable-faad            enable FAAD support via libfaad [default=no]"
23 echo "  --enable-faadbin         build FAAD support with runtime linking [default=no]"
24 echo "  --enable-faac            enable FAAC support via libfaac [default=no]"
25 echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
26 echo "  --enable-xvid            enable XviD support via xvidcore [default=no]"
27 echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
28 echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
29 echo "  --enable-a52             enable GPLed A52 support [default=no]"
30 echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
31 echo "  --enable-dts             enable GPLed DTS support [default=no]"
32 echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
33 echo "  --enable-shared-pp       use libpostproc.so [default=no]"
34 echo "  --enable-shared          build shared libraries [default=no]"
35 echo "  --enable-amr_nb          enable amr_nb float audio codec"
36 echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
37 echo "  --enable-amr_wb          enable amr_wb float audio codec"
38 echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
39 echo "  --enable-sunmlib         use Sun medialib [default=no]"
40 echo "  --enable-pthreads        use pthreads [default=no]"
41 echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394"
42 echo "                           and libraw1394 [default=no]"
43 echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
44 echo "                           and ffmpeg will be under GPL [default=no]"
45 echo ""
46 echo "Advanced options (experts only):"
47 echo "  --source-path=PATH       path to source code [$source_path]"
48 echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
49 echo "  --cc=CC                  use C compiler CC [$cc]"
50 echo "  --make=MAKE              use specified make [$make]"
51 echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
52 echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
53 echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
54 echo "  --build-suffix=SUFFIX    suffix for application specific build []"
55 echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
56 echo "  --tune=CPU               tune code for a particular CPU"
57 echo "                           (may fail or perform badly on other CPUs)"
58 echo "  --powerpc-perf-enable    enable performance report on PPC"
59 echo "                           (requires enabling PMC)"
60 echo "  --disable-mmx            disable MMX usage"
61 echo "  --disable-iwmmxt         disable iwmmxt usage"
62 echo "  --disable-altivec        disable AltiVec usage"
63 echo "  --disable-audio-oss      disable OSS audio support [default=no]"
64 echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
65 echo "  --disable-v4l            disable video4linux grabbing [default=no]"
66 echo "  --disable-bktr           disable bktr video grabbing [default=no]"
67 echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
68 echo "  --disable-network        disable network support [default=no]"
69 echo "  --disable-zlib           disable zlib [default=no]"
70 echo "  --disable-lzo            disable lzo [default=no]"
71 echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
72 echo "  --disable-vhook          disable video hooking support"
73 echo "  --enable-gprof           enable profiling with gprof [$gprof]"
74 echo "  --disable-debug          disable debugging symbols"
75 echo "  --disable-opts           disable compiler optimizations"
76 echo "  --disable-mpegaudio-hp   faster (but less accurate)"
77 echo "                           MPEG audio decoding [default=no]"
78 echo "  --disable-ffserver       disable ffserver build"
79 echo "  --disable-ffplay         disable ffplay build"
80 echo "  --enable-small           optimize for size instead of speed"
81 echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
82 echo "  --disable-strip          disable stripping of executables and shared libraries"
83 echo "  --disable-encoder=NAME   disables encoder NAME"
84 echo "  --enable-encoder=NAME    enables encoder NAME"
85 echo "  --disable-decoder=NAME   disables decoder NAME"
86 echo "  --enable-decoder=NAME    enables decoder NAME"
87 echo "  --disable-encoders       disables all encoders"
88 echo "  --disable-decoders       disables all decoders"
89 echo "  --disable-muxers         disables all muxers"
90 echo "  --disable-demuxers       disables all demuxers"
91 echo ""
92 echo "NOTE: Object files are built at the place where configure is launched."
93 exit 1
94 fi
95
96 # set temporary file name
97 if test ! -z "$TMPDIR" ; then
98     TMPDIR1="${TMPDIR}"
99 elif test ! -z "$TEMPDIR" ; then
100     TMPDIR1="${TEMPDIR}"
101 else
102     TMPDIR1="/tmp"
103 fi
104
105 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
106 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
107 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
108 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
109 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
110
111 # default parameters
112 prefix="/usr/local"
113 libdir=""
114 mandir=""
115 bindir=""
116 cross_prefix=""
117 cc="gcc"
118 ar="ar"
119 ranlib="ranlib"
120 make="make"
121 strip="strip"
122 cpu=`uname -m`
123 tune="generic"
124 powerpc_perf="no"
125 mmx="default"
126 iwmmxt="default"
127 altivec="default"
128 mmi="default"
129 case "$cpu" in
130   i386|i486|i586|i686|i86pc|BePC)
131     cpu="x86"
132   ;;
133   x86_64|amd64)
134     cpu="x86"
135     canon_arch="`cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
136     if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
137       if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
138         cpu="x86_64"
139       fi
140     fi
141   ;;
142   # armv4l is a subset of armv5tel
143   armv4l|armv5tel)
144     cpu="armv4l"
145   ;;
146   alpha)
147     cpu="alpha"
148   ;;
149   "Power Macintosh"|ppc|powerpc)
150     cpu="powerpc"
151   ;;
152   mips|mipsel)
153     cpu="mips"
154   ;;
155   sun4u|sparc64)
156     cpu="sparc64"
157   ;;
158   sparc)
159     cpu="sparc"
160   ;;
161   sh4)
162     cpu="sh4"
163   ;;
164   parisc|parisc64)
165     cpu="parisc"
166   ;;
167   s390|s390x)
168     cpu="s390"
169   ;;
170   m68k)
171     cpu="m68k"
172   ;;
173   ia64)
174     cpu="ia64"
175   ;;
176   *)
177     cpu="unknown"
178   ;;
179 esac
180 gprof="no"
181 v4l="yes"
182 bktr="no"
183 audio_oss="yes"
184 audio_beos="no"
185 dv1394="yes"
186 dc1394="no"
187 network="yes"
188 zlib="yes"
189 lzo="yes"
190 libgsm="no"
191 mp3lame="no"
192 libogg="no"
193 vorbis="no"
194 theora="no"
195 faad="no"
196 faadbin="no"
197 faac="no"
198 xvid="no"
199 x264="no"
200 a52="no"
201 a52bin="no"
202 dts="no"
203 pp="no"
204 shared_pp="no"
205 mingw32="no"
206 cygwin="no"
207 os2="no"
208 lshared="no"
209 optimize="yes"
210 debug="yes"
211 dostrip="yes"
212 installstrip="-s"
213 extralibs="-lm"
214 simpleidct="yes"
215 bigendian="no"
216 inttypes="yes"
217 emu_fast_int="no"
218 vhook="default"
219 dlfcn="no"
220 dlopen="no"
221 mpegaudio_hp="yes"
222 SHFLAGS='-shared -Wl,-soname,$@.$(LIBMAJOR)'
223 netserver="no"
224 need_inet_aton="no"
225 ffserver="yes"
226 ffplay="yes"
227 LIBOBJFLAGS=""
228 LDFLAGS=-Wl,--warn-common
229 FFSLDFLAGS=-Wl,-E
230 LDCONFIG="ldconfig"
231 LIBPREF="lib"
232 LIBSUF=".a"
233 LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
234 SLIBPREF="lib"
235 SLIBSUF=".so"
236 SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
237 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)'
238 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBMAJOR)'
239 EXESUF=""
240 BUILDSUF=""
241 amr_nb="no"
242 amr_wb="no"
243 amr_nb_fixed="no"
244 amr_if2="no"
245 sunmlib="no"
246 pthreads="no"
247 gpl="no"
248 memalignhack="no"
249 muxers="yes"
250 demuxers="yes"
251
252 # OS specific
253 targetos=`uname -s`
254 case $targetos in
255 BeOS)
256 prefix="/boot/home/config"
257 # helps building libavcodec
258 CFLAGS="-DPIC -fomit-frame-pointer"
259 # 3 gcc releases known for BeOS, each with ugly bugs
260 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
261 case "$gcc_version" in
262 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
263 mmx="no"
264 ;;
265 *20010315*) echo "BeBits gcc"
266 CFLAGS="$CFLAGS -fno-expensive-optimizations"
267 ;;
268 esac
269 SHFLAGS=-nostart
270 # disable Linux things
271 audio_oss="no"
272 v4l="no"
273 dv1394="no"
274 # enable BeOS things
275 audio_beos="yes"
276 # no need for libm, but the inet stuff
277 # Check for BONE
278 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
279 extralibs="-lbind -lsocket"
280 else
281 netserver="yes"
282 need_inet_aton="yes"
283 extralibs="-lnet"
284 fi ;;
285 SunOS)
286 v4l="no"
287 audio_oss="no"
288 dv1394="no"
289 make="gmake"
290 LDFLAGS=""
291 FFSLDFLAGS=""
292 need_inet_aton="yes"
293 extralibs="$extralibs -lsocket -lnsl"
294 ;;
295 NetBSD)
296 v4l="no"
297 bktr="yes"
298 audio_oss="yes"
299 dv1394="no"
300 make="gmake"
301 LDFLAGS="$LDFLAGS -export-dynamic"
302 case `uname -r` in
303 2.*) extralibs="$extralibs -lossaudio"
304 ;;
305 esac
306 ;;
307 OpenBSD)
308 v4l="no"
309 bktr="yes"
310 audio_oss="yes"
311 dv1394="no"
312 make="gmake"
313 LIBOBJFLAGS="\$(PIC)"
314 LDFLAGS="$LDFLAGS -export-dynamic -pthread"
315 LDCONFIG="ldconfig -m \$(libdir)"
316 extralibs="$extralibs -lossaudio"
317 ;;
318 FreeBSD)
319 v4l="no"
320 bktr="yes"
321 audio_oss="yes"
322 dv1394="no"
323 make="gmake"
324 CFLAGS="-pthread"
325 LDFLAGS="$LDFLAGS -export-dynamic -pthread"
326 ;;
327 BSD/OS)
328 v4l="no"
329 bktr="yes"
330 audio_oss="yes"
331 dv1394="no"
332 extralibs="-lpoll -lgnugetopt -lm"
333 make="gmake"
334 strip="strip -d"
335 installstrip=""
336 ;;
337 Darwin)
338 cc="cc"
339 v4l="no"
340 audio_oss="no"
341 dv1394="no"
342 ffserver="no"
343 SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
344 extralibs=""
345 darwin="yes"
346 strip="strip -x"
347 installstrip=""
348 LDFLAGS="-Wl,-dynamic,-search_paths_first"
349 SLIBSUF=".dylib"
350 SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
351 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
352 FFSLDFLAGS=-Wl,-bind_at_load
353 ;;
354 MINGW32*)
355 # Note: the rest of the mingw32 config is done afterwards as mingw32
356 # can be forced on the command line for Linux cross compilation.
357 mingw32="yes"
358 ;;
359 CYGWIN*)
360 v4l="no"
361 audio_oss="yes"
362 dv1394="no"
363 vhook="no"
364 extralibs=""
365 cygwin="yes"
366 EXESUF=".exe"
367 ;;
368 Linux)
369 LDFLAGS="$LDFLAGS -rdynamic"
370 ;;
371 IRIX*)
372 ranlib="echo ignoring ranlib"
373 v4l="no"
374 audio_oss="no"
375 make="gmake"
376 ;;
377 OS/2)
378 TMPE=$TMPE".exe"
379 ar="emxomfar -p128"
380 ranlib="echo ignoring ranlib"
381 strip="echo ignoring strip"
382 CFLAGS="-Zomf"
383 LDFLAGS="-Zomf -Zstack 16384 -s"
384 SHFLAGS="-Zdll -Zomf"
385 FFSLDFLAGS=""
386 LIBPREF=""
387 LIBSUF=".lib"
388 SLIBPREF=""
389 SLIBSUF=".dll"
390 EXESUF=".exe"
391 extralibs=""
392 pkg_requires=""
393 v4l="no"
394 audio_oss="no"
395 dv1394="no"
396 network="no"
397 ffserver="no"
398 vhook="no"
399 os2="yes"
400
401 ;;
402 *) ;;
403 esac
404
405 # From MPlayer configure. We need TARGET_OS available
406 # to the Makefile, so it can distinguish between flavors
407 # of AltiVec on PowerPC.
408 TARGET_OS=`( uname -s ) 2>&1`
409   case "$TARGET_OS" in
410   Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
411     ;;
412   IRIX*)
413     TARGET_OS=IRIX
414     ;;
415   HP-UX*)
416     TARGET_OS=HP-UX
417     ;;
418   [cC][yY][gG][wW][iI][nN]*)
419     TARGET_OS=CYGWIN
420     ;;
421   *)
422     TARGET_OS="$TARGET_OS-UNKNOWN"
423     ;;
424   esac
425
426 # find source path
427 source_path="`dirname $0`"
428 source_path_used="yes"
429 if test -z "$source_path" -o "$source_path" = "." ; then
430     source_path=`pwd`
431     source_path_used="no"
432 else
433     source_path="`cd \"$source_path\"; pwd`"
434 fi
435
436 FFMPEG_CONFIGURATION=" "
437 for opt do
438   FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
439 done
440
441 CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c  | sed 's/.*&\(.*\)).*/\1/'`
442
443 for opt do
444   case "$opt" in
445   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
446   ;;
447   --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
448   ;;
449   --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
450   ;;
451   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
452   ;;
453   --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
454   ;;
455   --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
456   ;;
457   --make=*) make=`echo $opt | cut -d '=' -f 2`
458   ;;
459   --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
460   ;;
461   --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
462   ;;
463   --extra-libs=*) extralibs=${opt#--extra-libs=}
464   ;;
465   --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
466   ;;
467   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
468   ;;
469   --tune=*) tune=`echo $opt | cut -d '=' -f 2`
470   ;;
471   --powerpc-perf-enable) powerpc_perf="yes"
472   ;;
473   --disable-mmx) mmx="no"
474   ;;
475   --disable-iwmmxt) iwmmxt="no"
476   ;;
477   --disable-altivec) altivec="no"
478   ;;
479   --enable-gprof) gprof="yes"
480   ;;
481   --disable-v4l) v4l="no"
482   ;;
483   --disable-bktr) bktr="no"
484   ;;
485   --disable-audio-oss) audio_oss="no"
486   ;;
487   --disable-audio-beos) audio_beos="no"
488     extralibs="$extralibs -lbe -lmedia"
489   ;;
490   --disable-dv1394) dv1394="no"
491   ;;
492   --disable-network) network="no"; ffserver="no"
493   ;;
494   --disable-zlib) zlib="no"
495   ;;
496   --disable-lzo) lzo="no"
497   ;;
498   --enable-a52) a52="yes"
499   ;;
500   --enable-a52bin) a52bin="yes"
501   ;;
502   --enable-dts) dts="yes"
503     extralibs="$extralibs -ldts"
504   ;;
505   --enable-pp) pp="yes"
506   ;;
507   --enable-shared-pp) pp="yes"; shared_pp="yes"
508   ;;
509   --enable-libgsm) libgsm="yes"
510     extralibs="$extralibs -lgsm"
511   ;;
512   --enable-mp3lame) mp3lame="yes"
513     extralibs="$extralibs -lmp3lame"
514   ;;
515   --enable-libogg) libogg="yes"
516     extralibs="$extralibs -logg"
517     pkg_requires="$pkg_requires ogg >= 1.1"
518   ;;
519   --enable-vorbis) vorbis="yes"
520     extralibs="$extralibs -lvorbis -lvorbisenc"
521     pkg_requires="$pkg_requires vorbis vorbisenc"
522   ;;
523   --enable-theora) theora="yes"
524     extralibs="$extralibs -ltheora"
525     pkg_requires="$pkg_requires theora"
526   ;;
527   --enable-faad) faad="yes"
528     extralibs="$extralibs -lfaad"
529   ;;
530   --enable-faadbin) faadbin="yes"
531   ;;
532   --enable-faac) faac="yes"
533     extralibs="$extralibs -lfaac"
534   ;;
535   --enable-xvid) xvid="yes"
536     extralibs="$extralibs -lxvidcore"
537   ;;
538   --enable-x264) x264="yes"
539     extralibs="$extralibs -lx264"
540   ;;
541   --enable-dc1394) dc1394="yes"
542     extralibs="$extralibs -ldc1394_control -lraw1394"
543     pkg_requires="$pkg_requires libraw1394"
544   ;;
545   --disable-vhook) vhook="no"
546   ;;
547   --disable-simple_idct) simpleidct="no"
548   ;;
549   --enable-mingw32) mingw32="yes"
550   ;;
551   --enable-shared) lshared="yes"
552   ;;
553   --disable-debug) debug="no"
554   ;;
555   --disable-opts) optimize="no"
556   ;;
557   --disable-mpegaudio-hp) mpegaudio_hp="no"
558   ;;
559   --disable-ffserver) ffserver="no"
560   ;;
561   --disable-ffplay) ffplay="no"
562   ;;
563   --enable-small) optimize="small"
564   ;;
565   --enable-amr_nb) amr_nb="yes"
566   ;;
567   --enable-amr_nb-fixed) amr_nb_fixed="yes"
568   ;;
569   --enable-amr_wb) amr_wb="yes"
570   ;;
571   --enable-amr_if2) amr_if2="yes"
572   ;;
573   --enable-sunmlib) sunmlib="yes"
574   ;;
575   --enable-pthreads) pthreads="yes"
576   ;;
577   --enable-gpl) gpl="yes"
578   ;;
579   --enable-memalign-hack) memalignhack="yes"
580   ;;
581   --disable-strip) dostrip="no"
582   ;;
583   --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
584   ;;
585   --enable-decoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-decoder=}_decoder"
586   ;;
587   --disable-encoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-encoder=}_encoder##\"`"
588   ;;
589   --disable-decoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-decoder=}_decoder##\"`"
590   ;;
591   --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
592   ;;
593   --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
594   ;;
595   --disable-muxers) muxers="no"
596   ;;
597   --disable-demuxers) demuxers="no"
598   ;;
599   *)
600   echo "Unknown option \"$opt\"."
601   echo "See $0 --help for available options."
602   exit 1
603   ;;
604   esac
605 done
606
607 if test "$theora" = "yes" ; then
608     if test "$libogg" = "no"; then
609         echo "libogg must be enabled to enable Theora."
610         fail="yes"
611         theora="no"
612     fi
613 fi
614
615 if test "$vorbis" = "yes" ; then
616     if test "$libogg" = "no"; then
617         echo "libogg must be enabled to enable Vorbis."
618         fail="yes"
619         vorbis="no"
620     fi
621 fi
622
623 if test "$gpl" != "yes"; then
624     if test "$pp" != "no" -o "$shared_pp" != "no"; then
625         echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
626         fail="yes"
627     fi
628
629     if test "$a52" != "no" -o "$a52bin" != "no"; then
630         echo "liba52 is under GPL and --enable-gpl is not specified."
631         fail="yes"
632     fi
633
634     if test "$xvid" != "no"; then
635         echo "libxvidcore is under GPL and --enable-gpl is not specified."
636         fail="yes"
637     fi
638
639     if test "$x264" != "no"; then
640         echo "x264 is under GPL and --enable-gpl is not specified."
641         fail="yes"
642     fi
643
644     if test "$dts" != "no"; then
645         echo "libdts is under GPL and --enable-gpl is not specified."
646         fail="yes"
647     fi
648
649     if test "$faad" != "no" -o "$faadbin" != "no"; then
650         cat > $TMPC << EOF
651             #include <faad.h>
652             int main( void ) { return 0; }
653 EOF
654
655         if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
656             cat > $TMPC << EOF
657                 #include <faad.h>
658                 #ifndef FAAD2_VERSION
659                 ok faad1
660                 #endif
661                 int main( void ) { return 0; }
662 EOF
663             if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
664                 echo "FAAD2 is under GPL and --enable-gpl is not specified."
665                 fail="yes"
666             fi
667         else
668             faad="no"
669             faadbin="no"
670             echo "FAAD test failed."
671         fi
672     fi
673
674
675     if test "$fail" = "yes"; then
676         exit 1
677     fi
678 fi
679
680 # compute MMX state
681 if test $mmx = "default"; then
682     if test $cpu = "x86" -o $cpu = "x86_64"; then
683         mmx="yes"
684     else
685         mmx="no"
686     fi
687 fi
688
689 # check iwmmxt support
690 if test $iwmmxt = "default" -a $cpu = "armv4l"; then
691     cat > $TMPC << EOF
692         int main(void) {
693         __asm__ __volatile__ ("wunpckelub wr6, wr4");
694         }
695 EOF
696
697     iwmmxt=no
698     if ${cross_prefix}${cc} -o $TMPO $TMPC 2> /dev/null ; then
699         iwmmxt=yes
700     fi
701 fi
702
703 #Darwin CC versions
704 needmdynamicnopic="no"
705 if test $targetos = Darwin; then
706     if test -n "`$cc -v 2>&1 | grep xlc`"; then
707         CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
708     else
709         gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
710         case "$gcc_version" in
711             *2.95*)
712                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
713                 ;;
714             *[34].*)
715                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
716                 if test "$lshared" = no; then
717                    needmdynamicnopic="yes"
718                 fi
719                 ;;
720             *)
721                 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
722                 if test "$lshared" = no; then
723                    needmdynamicnopic="yes"
724                 fi
725                 ;;
726         esac
727     fi
728 fi
729
730 # Can only do AltiVec on PowerPC
731 if test $altivec = "default"; then
732     if test $cpu = "powerpc"; then
733         altivec="yes"
734     else
735         altivec="no"
736     fi
737 fi
738
739 # Add processor-specific flags
740 TUNECPU="generic"
741 POWERPCMODE="32bits"
742 if test $tune != "generic"; then
743     case $tune in
744         601|ppc601|PowerPC601)
745             CFLAGS="$CFLAGS -mcpu=601"
746             if test $altivec = "yes"; then
747                 echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
748             fi
749             TUNECPU=ppc601
750         ;;
751         603*|ppc603*|PowerPC603*)
752             CFLAGS="$CFLAGS -mcpu=603"
753             if test $altivec = "yes"; then
754                 echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
755             fi
756             TUNECPU=ppc603
757         ;;
758         604*|ppc604*|PowerPC604*)
759             CFLAGS="$CFLAGS -mcpu=604"
760             if test $altivec = "yes"; then
761                 echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
762             fi
763             TUNECPU=ppc604
764         ;;
765         G3|g3|75*|ppc75*|PowerPC75*)
766             CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
767             if test $altivec = "yes"; then
768                 echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
769             fi
770             TUNECPU=ppc750
771         ;;
772         G4|g4|745*|ppc745*|PowerPC745*)
773             CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
774             if test $altivec = "no"; then
775                 echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
776             fi
777             TUNECPU=ppc7450
778         ;;
779         74*|ppc74*|PowerPC74*)
780             CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
781             if test $altivec = "no"; then
782                 echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
783             fi
784             TUNECPU=ppc7400
785         ;;
786         G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
787             CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
788             if test $altivec = "no"; then
789                 echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
790             fi
791             TUNECPU=ppc970
792             POWERPCMODE="64bits"
793         ;;
794         i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6|k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6|winchip2|c3|nocona|athlon64|k8|opteron|athlon-fx)
795             CFLAGS="$CFLAGS -march=$tune"
796         ;;
797         *)
798         echo "WARNING: Unknown CPU \"$tune\", ignored."
799         ;;
800     esac
801 fi
802
803 # AltiVec flags: The FSF version of GCC differs from the Apple version
804 if test $cpu = "powerpc"; then
805     if test $altivec = "yes"; then
806         if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
807             CFLAGS="$CFLAGS -faltivec"
808         else
809             CFLAGS="$CFLAGS -maltivec -mabi=altivec"
810         fi
811     fi
812 fi
813
814 # check if we have <altivec.h>
815 cat > $TMPC << EOF
816 #include <altivec.h>
817 int main( void ) { return 0; }
818 EOF
819
820 _altivec_h="no"
821 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
822 _altivec_h="yes"
823 fi
824
825 # check if our compiler supports Motorola AltiVec C API
826 if test $altivec = "yes"; then
827 if test $_altivec_h = "yes"; then
828 cat > $TMPC << EOF
829 #include <altivec.h>
830 int main(void) {
831     vector signed int v1, v2, v3;
832     v1 = vec_add(v2,v3);
833     return 0;
834 }
835 EOF
836 else
837 cat > $TMPC << EOF
838 int main(void) {
839     vector signed int v1, v2, v3;
840     v1 = vec_add(v2,v3);
841     return 0;
842 }
843 EOF
844 fi
845 $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
846 fi
847
848 # mmi only available on mips
849 if test $mmi = "default"; then
850     if test $cpu = "mips"; then
851         mmi="yes"
852     else
853         mmi="no"
854     fi
855 fi
856
857 # check if our compiler supports mmi
858 if test $mmi = "yes"; then
859 cat > $TMPC << EOF
860 int main(void) {
861     __asm__ ("lq \$2, 0(\$2)");
862     return 0;
863 }
864 EOF
865 $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
866 fi
867
868 if test "$mingw32" = "yes" ; then
869     v4l="no"
870     bktr="no"
871     audio_oss="no"
872     dv1394="no"
873     dc1394="no"
874     ffserver="no"
875     network="no"
876     SLIBPREF=""
877     SLIBSUF=".dll"
878     EXESUF=".exe"
879     if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
880     if test "$force_libdir" != yes; then bindir="$prefix"; fi
881 fi
882
883 cc="${cross_prefix}${cc}"
884 ar="${cross_prefix}${ar}"
885 ranlib="${cross_prefix}${ranlib}"
886 strip="${cross_prefix}${strip}"
887
888 if test -z "$cross_prefix" ; then
889
890 # ---
891 # big/little-endian test
892 cat > $TMPC << EOF
893 #include <inttypes.h>
894 int main(int argc, char ** argv){
895         volatile uint32_t i=0x01234567;
896         return (*((uint8_t*)(&i))) == 0x67;
897 }
898 EOF
899
900 if $cc -o $TMPE $TMPC 2>/dev/null ; then
901 $TMPE && bigendian="yes"
902 else
903 echo big/little test failed
904 fi
905
906 else
907
908 # programs cannot be launched if cross compiling, so make a static guess
909 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
910     bigendian="yes"
911 fi
912
913 fi
914
915 # ---
916 # *inttypes.h* test
917 cat > $TMPC << EOF
918 #include <inttypes.h>
919 int main(int argc, char ** argv){
920     return 0;
921 }
922 EOF
923
924 $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
925
926 # ---
927 # *int_fast* test
928 cat > $TMPC << EOF
929 #include <inttypes.h>
930 int main(int argc, char ** argv){
931         volatile uint_fast64_t i=0x01234567;
932         return 0;
933 }
934 EOF
935
936 $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
937
938 # ---
939 # check availability of some header files
940
941 cat > $TMPC << EOF
942 #include <malloc.h>
943 int main( void ) { return 0; }
944 EOF
945
946 _memalign=no
947 _malloc_h=no
948 if $cc -o $TMPE $TMPC 2> /dev/null ; then
949 _malloc_h=yes
950 _memalign=yes
951 # check for memalign - atmos
952 cat > $TMPC << EOF
953 #include <stdio.h>
954 #include <malloc.h>
955 int main ( void ) {
956 char *string = NULL;
957 string = memalign(64, sizeof(char));
958 return 0;
959 }
960 EOF
961 $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
962 fi
963
964 if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
965     echo "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
966     exit 1
967 fi
968
969 cat > $TMPC << EOF
970 #include <time.h>
971 int main( void ) { localtime_r(NULL, NULL); }
972 EOF
973
974 localtime_r=no
975 if $cc -o $TMPE $TMPC 2> /dev/null ; then
976   localtime_r=yes
977 fi
978
979 if test "$zlib" = "yes"; then
980 # check for zlib - mmu_man
981 cat > $TMPC << EOF
982 #include <zlib.h>
983 int main ( void ) {
984 if (zlibVersion() != ZLIB_VERSION)
985    puts("zlib version differs !!!");
986    return 1;
987 return 0;
988 }
989 EOF
990 $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
991 # $TMPE 2> /dev/null > /dev/null || zlib="no"
992 # XXX: more tests needed - runtime test
993 fi
994 if test "$zlib" = "yes"; then
995 extralibs="$extralibs -lz"
996 fi
997
998 if test "$lzo" = "yes" -a "$gpl" = "yes"; then
999 # check for liblzo
1000 cat > $TMPC << EOF
1001 #include <lzo1x.h>
1002 int main ( void ) {
1003 lzo_init();
1004 return 0;
1005 }
1006 EOF
1007 $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -llzo 2> /dev/null || lzo="no"
1008 else
1009 lzo="no"
1010 fi
1011 if test "$lzo" = "yes"; then
1012 extralibs="$extralibs -llzo"
1013 fi
1014
1015 # test for lrintf in math.h
1016 cat > $TMPC << EOF
1017 #define _ISOC9X_SOURCE  1
1018 #include <math.h>
1019 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1020 EOF
1021
1022 have_lrintf="no"
1023 if $cc $CFLAGS $LDFLAGS $extralibs -o $TMPE $TMPC 2> /dev/null ; then
1024   have_lrintf="yes"
1025   # allanc@chickenandporn.com: cannot execute cross-compiled
1026   # code on the host.  Only execute if not cross-compiling.
1027   if test -z "$cross_prefix" ; then
1028     $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
1029   fi
1030 fi
1031
1032 _restrict=
1033 for restrict_keyword in restrict __restrict__ __restrict; do
1034   echo "void foo(char * $restrict_keyword p);" > $TMPC
1035   if $cc -c -o $TMPO $TMPC 2> /dev/null; then
1036     _restrict=$restrict_keyword
1037     break;
1038   fi
1039 done
1040
1041 # test gcc version to see if vector builtins can be used
1042 # currently only used on i386 for MMX builtins
1043 cat > $TMPC << EOF
1044 #include <xmmintrin.h>
1045 int main(void) {
1046 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
1047 return 0;
1048 #else
1049 #error no vector builtins
1050 #endif
1051 }
1052 EOF
1053
1054 builtin_vector=no
1055 if $cc -msse -o $TMPO $TMPC 2> /dev/null ; then
1056   builtin_vector=yes
1057 fi
1058
1059 # Probe for -Wdeclaration-after-statement
1060 if test "$cc" = "gcc"; then
1061   cat > $TMPC << EOF
1062   int main( void ) { return 0; }
1063 EOF
1064
1065   if $cc -Wdeclaration-after-statement -Werror -o $TMPE $TMPC 2> /dev/null ; then
1066     CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1067   fi
1068 fi
1069
1070 # dlopen/dlfcn.h probing
1071
1072 cat > $TMPC << EOF
1073 #include <dlfcn.h>
1074 int main( void ) { return (int) dlopen("foo", 0); }
1075 EOF
1076
1077 ldl=-ldl
1078
1079 if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
1080 dlfcn=yes
1081 dlopen=yes
1082 fi
1083
1084 if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC > /dev/null 2>&1 ; then
1085 dlfcn=yes
1086 dlopen=yes
1087 ldl=""
1088 fi
1089
1090 cat > $TMPC << EOF
1091 int main( void ) { return (int) dlopen("foo", 0); }
1092 EOF
1093
1094 if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
1095 dlopen=yes
1096 fi
1097
1098 if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC > /dev/null 2>&1  ; then
1099 dlopen=yes
1100 ldl=""
1101 fi
1102
1103 if test "$vhook" = "default" ; then
1104   vhook="$dlopen"
1105 fi
1106
1107 if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
1108   extralibs="$extralibs $ldl"
1109 fi
1110
1111
1112 ##########################################
1113 # imlib check
1114
1115 cat > $TMPC << EOF
1116 #include <X11/Xlib.h>
1117 #include <Imlib2.h>
1118 int main( void ) { return (int) imlib_load_font("foo"); }
1119 EOF
1120
1121 imlib2=no
1122 if $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
1123 imlib2=yes
1124 fi
1125
1126 ##########################################
1127 # FreeType check
1128
1129 cat > $TMPC << EOF
1130 #include <ft2build.h>
1131 int main( void ) { return (int) FT_Init_FreeType(0); }
1132 EOF
1133
1134 freetype2=no
1135 if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
1136   if (freetype-config --version) >/dev/null 2>&1 ; then
1137     if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
1138       freetype2=yes
1139     fi
1140   fi
1141 fi
1142
1143 ##########################################
1144 # SDL check
1145
1146 cat > $TMPC << EOF
1147 #include <SDL.h>
1148 #undef main /* We don't want SDL to override our main() */
1149 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1150 EOF
1151
1152 sdl_too_old=no
1153 sdl=no
1154 if (sdl-config --version) >/dev/null 2>&1 ; then
1155 if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
1156 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
1157 if test "$_sdlversion" -lt 121 ; then
1158 sdl_too_old=yes
1159 else
1160 sdl=yes
1161 fi
1162 fi
1163 fi
1164
1165 ##########################################
1166 # texi2html check
1167
1168 texi2html=no
1169 if (texi2html -version) >/dev/null 2>&1; then
1170 texi2html=yes
1171 fi
1172
1173 if test "$network" = "yes" ; then
1174 ##########################################
1175 # IPv6 check
1176
1177 cat > $TMPC << EOF
1178 #include <sys/types.h>
1179 #include <sys/socket.h>
1180 #include <netinet/in.h>
1181 #include <netdb.h>
1182 int main( void ) {
1183   struct sockaddr_storage saddr;
1184   struct ipv6_mreq mreq6;
1185   getaddrinfo(0,0,0,0);
1186   getnameinfo(0,0,0,0,0,0,0);
1187   IN6_IS_ADDR_MULTICAST(0);
1188 }
1189 EOF
1190
1191 ipv6=no
1192 if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
1193 ipv6=yes
1194 fi
1195 fi
1196
1197 case "`$cc -v 2>&1 | grep version`" in
1198     *gcc*)
1199         CFLAGS="-Wall -Wno-switch $CFLAGS"
1200         ;;
1201     *)
1202         ;;
1203 esac
1204
1205 if test "$sdl" = "no" ; then
1206    ffplay=no
1207 fi
1208
1209 if test "$debug" = "yes"; then
1210         CFLAGS="-g $CFLAGS"
1211 fi
1212
1213 if test "$optimize" = "small"; then
1214 #  CFLAGS=${CFLAGS//-O3/-Os}
1215   CFLAGS="$CFLAGS -Os"
1216 fi
1217
1218 if test "$optimize" = "yes"; then
1219     if test -n "`$cc -v 2>&1 | grep xlc`"; then
1220         CFLAGS="$CFLAGS -O5"
1221         LDFLAGS="$LDFLAGS -O5"
1222     else
1223         CFLAGS="-O3 $CFLAGS"
1224     fi
1225 fi
1226
1227 # PIC flags for shared library objects where they are needed
1228 if test "$lshared" = "yes" ; then
1229   # LIBOBJFLAGS may have already been set in the OS configuration
1230   if test -z "$LIBOBJFLAGS" ; then
1231     if test "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "alpha" ; then
1232       LIBOBJFLAGS="\$(PIC)"
1233     fi
1234   fi
1235 fi
1236
1237 if test x"$bindir" = x""; then
1238 bindir="${prefix}/bin"
1239 fi
1240
1241 if test x"$libdir" = x""; then
1242 libdir="${prefix}/lib"
1243 fi
1244
1245 if test x"$mandir" = x""; then
1246 mandir="${prefix}/man"
1247 fi
1248
1249 echo "install prefix   $prefix"
1250 echo "source path      $source_path"
1251 echo "C compiler       $cc"
1252 echo "make             $make"
1253 echo "CPU              $cpu ($tune)"
1254 if test "$BUILDSUF" != ""; then
1255 echo "build suffix     $BUILDSUF"
1256 fi
1257 echo "big-endian       $bigendian"
1258 echo "inttypes.h       $inttypes"
1259 echo "broken inttypes.h $emu_fast_int"
1260 if test $cpu = "x86" -o $cpu = "x86_64"; then
1261 echo "MMX enabled      $mmx"
1262 echo "Vector Builtins  $builtin_vector"
1263 fi
1264 if test $cpu = "armv4l"; then
1265 echo "IWMMXT enabled   $iwmmxt"
1266 fi
1267 if test $cpu = "mips"; then
1268 echo "MMI enabled      $mmi"
1269 fi
1270 if test $cpu = "powerpc"; then
1271 echo "AltiVec enabled  $altivec"
1272 fi
1273 echo "gprof enabled    $gprof"
1274 echo "zlib enabled     $zlib"
1275 echo "lzo enabled      $lzo"
1276 echo "libgsm enabled   $libgsm"
1277 echo "mp3lame enabled  $mp3lame"
1278 echo "libogg enabled   $libogg"
1279 echo "Vorbis enabled   $vorbis"
1280 echo "Theora enabled   $theora"
1281 echo "FAAD enabled     $faad"
1282 echo "faadbin enabled  $faadbin"
1283 echo "FAAC enabled     $faac"
1284 echo "XviD enabled     $xvid"
1285 echo "x264 enabled     $x264"
1286 echo "a52 support      $a52"
1287 echo "a52 dlopened     $a52bin"
1288 echo "DTS support      $dts"
1289 echo "pp support       $pp"
1290 echo "debug symbols    $debug"
1291 echo "strip symbols    $dostrip"
1292 echo "optimize         $optimize"
1293 echo "shared pp        $shared_pp"
1294 echo "video hooking    $vhook"
1295 echo "SDL support      $sdl"
1296 if test $sdl_too_old = "yes"; then
1297 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1298 fi
1299
1300 if test "$vhook" = "yes" ; then
1301 echo "Imlib2 support   $imlib2"
1302 echo "FreeType support $freetype2"
1303 fi
1304 echo "Sun medialib support"  $sunmlib
1305 echo "pthreads support"      $pthreads
1306 echo "AMR-NB float support"  $amr_nb
1307 echo "AMR-NB fixed support"  $amr_nb_fixed
1308 echo "AMR-WB float support"  $amr_wb
1309 echo "AMR-WB IF2 support"    $amr_if2
1310 echo "network support      $network"
1311 if test "$network" = "yes" ; then
1312 echo "IPv6 support         $ipv6"
1313 fi
1314 if test "$gpl" = "no" ; then
1315 echo "License: LGPL"
1316 else
1317 echo "License: GPL"
1318 fi
1319
1320 echo "Creating config.mak and config.h..."
1321
1322 date >> config.log
1323 echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1324 echo "# Automatically generated by configure - do not modify!" > config.mak
1325 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1326 echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1327
1328 echo "prefix=\$(DESTDIR)$prefix" >> config.mak
1329 echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1330 echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1331 echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1332 echo "MAKE=$make" >> config.mak
1333 echo "CC=$cc" >> config.mak
1334 echo "AR=$ar" >> config.mak
1335 echo "RANLIB=$ranlib" >> config.mak
1336 if test "$dostrip" = "yes" ; then
1337 echo "STRIP=$strip" >> config.mak
1338 echo "INSTALLSTRIP=$installstrip" >> config.mak
1339 else
1340 echo "STRIP=echo ignoring strip" >> config.mak
1341 echo "INSTALLSTRIP=" >> config.mak
1342 fi
1343
1344 # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic, used when building
1345 # shared modules on OS/X (vhook/Makefile).
1346 SHCFLAGS=$CFLAGS
1347 if test "$needmdynamicnopic" = yes; then
1348    CFLAGS="$CFLAGS -mdynamic-no-pic"
1349 fi
1350
1351 echo "OPTFLAGS=$CFLAGS" >> config.mak
1352 echo "SHCFLAGS=$SHCFLAGS">>config.mak
1353 echo "LDFLAGS=$LDFLAGS" >> config.mak
1354 echo "LDCONFIG=$LDCONFIG" >> config.mak
1355 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1356 echo "SHFLAGS=$SHFLAGS" >> config.mak
1357 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
1358 echo "BUILDSUF=$BUILDSUF" >> config.mak
1359 echo "LIBPREF=$LIBPREF" >> config.mak
1360 echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
1361 echo "LIB=$LIB" >> config.mak
1362 echo "SLIBPREF=$SLIBPREF" >> config.mak
1363 echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1364 echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
1365 echo "TARGET_OS=$TARGET_OS" >> config.mak
1366 if test "$cpu" = "x86" ; then
1367   echo "TARGET_ARCH_X86=yes" >> config.mak
1368   echo "#define ARCH_X86 1" >> $TMPH
1369 elif test "$cpu" = "x86_64" ; then
1370   echo "TARGET_ARCH_X86_64=yes" >> config.mak
1371   echo "#define ARCH_X86_64 1" >> $TMPH
1372 elif test "$cpu" = "armv4l" ; then
1373   echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1374   echo "#define ARCH_ARMV4L 1" >> $TMPH
1375 elif test "$cpu" = "alpha" ; then
1376   echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1377   echo "#define ARCH_ALPHA 1" >> $TMPH
1378 elif test "$cpu" = "sparc64" ; then
1379   echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1380   echo "#define ARCH_SPARC64 1" >> $TMPH
1381   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1382   echo "#define ARCH_SPARC 1" >> $TMPH
1383 elif test "$cpu" = "sparc" ; then
1384   echo "TARGET_ARCH_SPARC=yes" >> config.mak
1385   echo "#define ARCH_SPARC 1" >> $TMPH
1386 elif test "$cpu" = "powerpc" ; then
1387   echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1388   echo "#define ARCH_POWERPC 1" >> $TMPH
1389   if test $POWERPCMODE = "32bits"; then
1390     echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1391   else
1392     echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1393   fi
1394   if test "$powerpc_perf" = "yes"; then
1395     echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1396   fi
1397 elif test "$cpu" = "mips" ; then
1398   echo "TARGET_ARCH_MIPS=yes" >> config.mak
1399   echo "#define ARCH_MIPS 1" >> $TMPH
1400 elif test "$cpu" = "sh4" ; then
1401   echo "TARGET_ARCH_SH4=yes" >> config.mak
1402   echo "#define ARCH_SH4 1" >> $TMPH
1403 elif test "$cpu" = "parisc" ; then
1404   echo "TARGET_ARCH_PARISC=yes" >> config.mak
1405   echo "#define ARCH_PARISC 1" >> $TMPH
1406 elif test "$cpu" = "s390" ; then
1407   echo "TARGET_ARCH_S390=yes" >> config.mak
1408   echo "#define ARCH_S390 1" >> $TMPH
1409 elif test "$cpu" = "m68k" ; then
1410   echo "TARGET_ARCH_M68K=yes" >> config.mak
1411   echo "#define ARCH_M68K 1" >> $TMPH
1412 elif test "$cpu" = "ia64" ; then
1413   echo "TARGET_ARCH_IA64=yes" >> config.mak
1414   echo "#define ARCH_IA64 1" >> $TMPH
1415 fi
1416 echo "#define TUNECPU $TUNECPU" >> $TMPH
1417 if test "$bigendian" = "yes" ; then
1418   echo "WORDS_BIGENDIAN=yes" >> config.mak
1419   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1420 fi
1421 if test "$inttypes" != "yes" ; then
1422   echo "#define EMULATE_INTTYPES 1" >> $TMPH
1423 fi
1424 if test "$emu_fast_int" = "yes" ; then
1425   echo "#define EMULATE_FAST_INT 1" >> $TMPH
1426 fi
1427 if test "$mmx" = "yes" ; then
1428   echo "TARGET_MMX=yes" >> config.mak
1429   echo "#define HAVE_MMX 1" >> $TMPH
1430   echo "#define __CPU__ 586" >> $TMPH
1431 fi
1432 if test "$builtin_vector" = "yes" ; then
1433   echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1434   echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1435 fi
1436 if test "$iwmmxt" = "yes" ; then
1437   echo "TARGET_IWMMXT=yes" >> config.mak
1438   echo "#define HAVE_IWMMXT 1" >> $TMPH
1439 fi
1440 if test "$mmi" = "yes" ; then
1441   echo "TARGET_MMI=yes" >> config.mak
1442   echo "#define HAVE_MMI 1" >> $TMPH
1443 fi
1444 if test "$altivec" = "yes" ; then
1445   echo "TARGET_ALTIVEC=yes" >> config.mak
1446   echo "#define HAVE_ALTIVEC 1" >> $TMPH
1447   echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1448   echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1449   if test "$_altivec_h" = "yes" ; then
1450     echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1451   else
1452     echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1453   fi
1454 fi
1455 if test "$gprof" = "yes" ; then
1456   echo "TARGET_GPROF=yes" >> config.mak
1457   echo "#define HAVE_GPROF 1" >> $TMPH
1458 fi
1459 if test "$localtime_r" = "yes" ; then
1460   echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1461 fi
1462 if test "$imlib2" = "yes" ; then
1463   echo "HAVE_IMLIB2=yes" >> config.mak
1464 fi
1465 if test "$freetype2" = "yes" ; then
1466   echo "HAVE_FREETYPE2=yes" >> config.mak
1467 fi
1468 if test "$sunmlib" = "yes" ; then
1469   echo "HAVE_MLIB=yes" >> config.mak
1470   echo "#define HAVE_MLIB 1" >> $TMPH
1471   extralibs="$extralibs -lmlib"
1472 fi
1473 if test "$pthreads" = "yes" ; then
1474   echo "HAVE_PTHREADS=yes" >> config.mak
1475   echo "#define HAVE_PTHREADS 1" >> $TMPH
1476   echo "#define HAVE_THREADS 1" >> $TMPH
1477   if test $targetos != FreeBSD -a $targetos != OpenBSD ; then
1478      extralibs="$extralibs -lpthread"
1479   fi
1480 fi
1481 if test "$sdl" = "yes" ; then
1482   echo "CONFIG_SDL=yes" >> config.mak
1483   echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1484   echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1485 fi
1486 if test "$texi2html" = "yes"; then
1487   echo "BUILD_DOC=yes" >> config.mak
1488 fi
1489 if test "$have_lrintf" = "yes" ; then
1490   echo "#define HAVE_LRINTF 1" >> $TMPH
1491 fi
1492 if test "$vhook" = "yes" ; then
1493   echo "BUILD_VHOOK=yes" >> config.mak
1494   echo "#define HAVE_VHOOK 1" >> $TMPH
1495 fi
1496
1497 lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1498 lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1499 lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1500
1501
1502
1503 if test "$lshared" = "yes" ; then
1504   echo "BUILD_SHARED=yes" >> config.mak
1505   echo "PIC=-fPIC -DPIC" >> config.mak
1506   echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
1507   echo "SPPVERSION=$lavc_version" >> config.mak
1508   echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
1509   echo "LAVCVERSION=$lavc_version" >> config.mak
1510   echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
1511   echo "LAVFVERSION=$lavf_version" >> config.mak
1512   echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
1513   echo "LAVUVERSION=$lavu_version" >> config.mak
1514   echo "SLIBNAME=${SLIBNAME}" >> config.mak
1515   echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1516   echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
1517 fi
1518 echo "EXTRALIBS=$extralibs" >> config.mak
1519 version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
1520  cut -d '"' -f 2`
1521 echo "VERSION=$version" >>config.mak
1522 # If you do not want to use encoders, disable them.
1523 echo "#define CONFIG_ENCODERS 1" >> $TMPH
1524 echo "CONFIG_ENCODERS=yes" >> config.mak
1525
1526 # If you do not want to use decoders, disable them.
1527 echo "#define CONFIG_DECODERS 1" >> $TMPH
1528 echo "CONFIG_DECODERS=yes" >> config.mak
1529
1530 # muxers
1531 if test "$muxers" = "yes" ; then
1532   echo "#define CONFIG_MUXERS 1" >> $TMPH
1533   echo "CONFIG_MUXERS=yes" >> config.mak
1534 fi
1535
1536 # demuxers
1537 if test "$demuxers" = "yes" ; then
1538   echo "#define CONFIG_DEMUXERS 1" >> $TMPH
1539   echo "CONFIG_DEMUXERS=yes" >> config.mak
1540 fi
1541
1542 # AC3
1543 if test "$a52" = "yes" ; then
1544   echo "#define CONFIG_AC3 1" >> $TMPH
1545   echo "CONFIG_AC3=yes" >> config.mak
1546
1547   if test "$a52bin" = "yes" ; then
1548     echo "#define CONFIG_A52BIN 1" >> $TMPH
1549     echo "CONFIG_A52BIN=yes" >> config.mak
1550   fi
1551 fi
1552
1553 # DTS
1554 if test "$dts" = "yes" ; then
1555   echo "#define CONFIG_DTS 1" >> $TMPH
1556   echo "CONFIG_DTS=yes" >> config.mak
1557 fi
1558
1559 # PP
1560 if test "$pp" = "yes" ; then
1561   echo "#define CONFIG_PP 1" >> $TMPH
1562   echo "CONFIG_PP=yes" >> config.mak
1563
1564   if test "$shared_pp" = "yes" ; then
1565     echo "#define SHARED_PP 1" >> $TMPH
1566     echo "SHARED_PP=yes" >> config.mak
1567   fi
1568 fi
1569
1570 # MPEG audio high precision mode
1571 if test "$mpegaudio_hp" = "yes" ; then
1572   echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1573 fi
1574
1575 if test "$v4l" = "yes" ; then
1576   echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1577   echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1578 fi
1579
1580 if test "$bktr" = "yes" ; then
1581   echo "#define CONFIG_BKTR 1" >> $TMPH
1582   echo "CONFIG_BKTR=yes" >> config.mak
1583 fi
1584
1585 if test "$dv1394" = "yes" ; then
1586   echo "#define CONFIG_DV1394 1" >> $TMPH
1587   echo "CONFIG_DV1394=yes" >> config.mak
1588 fi
1589
1590 if test "$dc1394" = "yes" ; then
1591   echo "#define CONFIG_DC1394 1" >> $TMPH
1592   echo "CONFIG_DC1394=yes" >> config.mak
1593 fi
1594
1595 if test "$dlopen" = "yes" ; then
1596   echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1597 fi
1598
1599 if test "$dlfcn" = "yes" ; then
1600   echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1601 fi
1602
1603 if test "$audio_oss" = "yes" ; then
1604   echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1605   echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1606 fi
1607
1608 if test "$audio_beos" = "yes" ; then
1609   echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1610   echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1611 fi
1612
1613 if test "$network" = "yes" ; then
1614   echo "#define CONFIG_NETWORK 1" >> $TMPH
1615   echo "CONFIG_NETWORK=yes" >> config.mak
1616 fi
1617
1618 if test "$ipv6" = "yes" ; then
1619   echo "#define CONFIG_IPV6 1" >> $TMPH
1620 fi
1621
1622 if test "$zlib" = "yes" ; then
1623   echo "#define CONFIG_ZLIB 1" >> $TMPH
1624   echo "CONFIG_ZLIB=yes" >> config.mak
1625 fi
1626
1627 if test "$lzo" = "yes" ; then
1628   echo "#define CONFIG_LZO 1" >> $TMPH
1629   echo "CONFIG_LZO=yes" >> config.mak
1630 fi
1631
1632 if test "$libgsm" = "yes" ; then
1633   echo "#define CONFIG_LIBGSM 1" >> $TMPH
1634   echo "CONFIG_LIBGSM=yes" >> config.mak
1635 fi
1636
1637 if test "$mp3lame" = "yes" ; then
1638   echo "#define CONFIG_MP3LAME 1" >> $TMPH
1639   echo "CONFIG_MP3LAME=yes" >> config.mak
1640 fi
1641
1642 if test "$libogg" = "yes" ; then
1643   echo "#define CONFIG_LIBOGG 1" >> $TMPH
1644   echo "CONFIG_LIBOGG=yes" >> config.mak
1645 fi
1646
1647 if test "$vorbis" = "yes" ; then
1648   echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
1649   echo "CONFIG_LIBVORBIS=yes" >> config.mak
1650 fi
1651
1652 if test "$theora" = "yes" ; then
1653   echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
1654   echo "CONFIG_LIBTHEORA=yes" >> config.mak
1655 fi
1656
1657 if test "$faad" = "yes" ; then
1658   echo "#define CONFIG_FAAD 1" >> $TMPH
1659   echo "CONFIG_FAAD=yes" >> config.mak
1660 fi
1661
1662 if test "$faadbin" = "yes" ; then
1663   echo "#define CONFIG_FAADBIN 1" >> $TMPH
1664   echo "CONFIG_FAADBIN=yes" >> config.mak
1665 fi
1666
1667 if test "$faac" = "yes" ; then
1668   echo "#define CONFIG_FAAC 1" >> $TMPH
1669   echo "CONFIG_FAAC=yes" >> config.mak
1670 fi
1671
1672 if test "$xvid" = "yes" ; then
1673   echo "#define CONFIG_XVID 1" >> $TMPH
1674   echo "CONFIG_XVID=yes" >> config.mak
1675 fi
1676
1677 if test "$x264" = "yes" ; then
1678   echo "#define CONFIG_X264 1" >> $TMPH
1679   echo "CONFIG_X264=yes" >> config.mak
1680 fi
1681
1682 if test "$mingw32" = "yes" ; then
1683   echo "#define CONFIG_WIN32 1" >> $TMPH
1684   echo "CONFIG_WIN32=yes" >> config.mak
1685   echo "HAVE_W32THREADS=yes" >> config.mak
1686   echo "#define HAVE_W32THREADS 1" >> $TMPH
1687   echo "#define HAVE_THREADS 1" >> $TMPH
1688   echo "#ifndef __MINGW32__" >> $TMPH
1689   echo "#define __MINGW32__ 1" >> $TMPH
1690   echo "#endif" >> $TMPH
1691 fi
1692
1693 if test "$os2" = "yes" ; then
1694   echo "#define CONFIG_OS2 1" >> $TMPH
1695   echo "CONFIG_OS2=yes" >> config.mak
1696 fi
1697
1698 if test "$TARGET_OS" = "SunOS" ; then
1699   echo "#define CONFIG_SUNOS 1" >> $TMPH
1700 fi
1701
1702 if test "$TARGET_OS" = "BeOS" ; then
1703   echo "HAVE_BEOSTHREADS=yes" >> config.mak
1704   echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
1705   echo "#define HAVE_THREADS 1" >> $TMPH
1706 fi
1707
1708 if test "$darwin" = "yes"; then
1709   echo "#define CONFIG_DARWIN 1"  >> $TMPH
1710   echo "CONFIG_DARWIN=yes" >> config.mak
1711 fi
1712
1713 if test "$_malloc_h" = "yes" ; then
1714   echo "#define HAVE_MALLOC_H 1" >> $TMPH
1715 else
1716   echo "#undef  HAVE_MALLOC_H" >> $TMPH
1717 fi
1718
1719 if test "$_memalign" = "yes" ; then
1720   echo "#define HAVE_MEMALIGN 1" >> $TMPH
1721 else
1722   echo "#undef  HAVE_MEMALIGN" >> $TMPH
1723 fi
1724
1725 if test "$memalignhack" = "yes" ; then
1726   echo "#define MEMALIGN_HACK 1" >> $TMPH
1727 fi
1728
1729
1730 if test "$netserver" = "yes" ; then
1731   echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1732   echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1733 fi
1734
1735 if test "$need_inet_aton" = "yes" ; then
1736   echo "NEED_INET_ATON=yes" >> config.mak
1737 fi
1738
1739 if test "$simpleidct" = "yes" ; then
1740   echo "#define SIMPLE_IDCT 1" >> $TMPH
1741 fi
1742
1743 if test "$ffserver" = "yes" ; then
1744   echo "#define CONFIG_FFSERVER 1" >> $TMPH
1745   echo "CONFIG_FFSERVER=yes" >> config.mak
1746 fi
1747
1748 if test "$ffplay" = "yes" ; then
1749   echo "CONFIG_FFPLAY=yes" >> config.mak
1750 fi
1751
1752 if test "$gpl" = "yes" ; then
1753   echo "#define CONFIG_GPL 1" >> $TMPH
1754   echo "CONFIG_GPL=yes" >> config.mak
1755 fi
1756
1757 echo "#define restrict $_restrict" >> $TMPH
1758
1759 if test "$optimize" = "small"; then
1760   echo "#define always_inline"  >> $TMPH
1761 fi
1762
1763 # build tree in object directory if source path is different from current one
1764 if test "$source_path_used" = "yes" ; then
1765     DIRS="\
1766          doc \
1767          libavformat \
1768          libavcodec \
1769          libavcodec/alpha \
1770          libavcodec/armv4l \
1771          libavcodec/i386 \
1772          libavcodec/sparc \
1773          libavcodec/mlib \
1774          libavcodec/ppc \
1775          libavcodec/liba52 \
1776          libavcodec/libpostproc \
1777          libavutil \
1778          tests \
1779          vhook \
1780          "
1781     FILES="\
1782           Makefile \
1783           libavformat/Makefile \
1784           libavcodec/Makefile \
1785           libavcodec/libpostproc/Makefile \
1786           libavutil/Makefile \
1787           tests/Makefile \
1788           vhook/Makefile \
1789           doc/Makefile \
1790           doc/texi2pod.pl \
1791           "
1792     for dir in $DIRS ; do
1793             mkdir -p $dir
1794     done
1795     for f in $FILES ; do
1796         ln -sf "$source_path/$f" $f
1797     done
1798     echo "SRC_PATH=$source_path" >> config.mak
1799 else
1800     echo "SRC_PATH='$source_path'" >> config.mak
1801 fi
1802
1803 if test "$amr_wb" = "yes" ; then
1804   echo "#define AMR_WB 1" >> $TMPH
1805   echo "AMR_WB=yes" >> config.mak
1806   echo
1807   echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1808   echo "V5.1.0 from "
1809   echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1810   echo "and extracted the source to libavcodec/amrwb_float"
1811   echo
1812 fi
1813
1814 if test "$amr_nb" = "yes" ; then
1815   echo "#define AMR_NB 1" >> $TMPH
1816   echo "AMR_NB=yes" >> config.mak
1817   echo
1818 if test "$amr_nb_fixed" = "yes" ; then
1819   echo "AMR_NB_FIXED=yes" >> config.mak
1820   echo "#define AMR_NB_FIXED 1" >> $TMPH
1821   echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1822   echo "REL-5 version 5.1.0 from "
1823   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
1824   echo "and extracted src to libavcodec/amr"
1825   echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1826   echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1827   echo
1828 else
1829   echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1830   echo "REL-5 V5.1.0 from "
1831   echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
1832   echo "and extracted the source to libavcodec/amr_float"
1833   echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1834   echo
1835 fi
1836
1837 if test "$amr_if2" = "yes" ; then
1838   echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1839 fi
1840
1841 fi
1842
1843 for codec in $CODEC_LIST ; do
1844     echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
1845     echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
1846 done
1847
1848 diff $TMPH config.h >/dev/null 2>&1
1849 if test $? -ne 0 ; then
1850         mv -f $TMPH config.h
1851 else
1852         echo "config.h is unchanged"
1853 fi
1854
1855 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
1856
1857
1858 # build pkg-config files libav*.pc and libpostproc.pc
1859 # libavutil.pc
1860 cat <<EOF >libavutil.pc
1861 prefix=$prefix
1862 exec_prefix=\${prefix}
1863 libdir=\${exec_prefix}/lib
1864 includedir=\${prefix}/include
1865
1866 Name: libavutil
1867 Description: FFmpeg utility library
1868 Version: $lavu_version
1869 Requires:
1870 Conflicts:
1871 Libs: -L\${libdir} -lavutil
1872 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
1873 EOF
1874
1875 cat <<EOF >libavutil-uninstalled.pc
1876 prefix=
1877 exec_prefix=
1878 libdir=\${pcfiledir}/libavutil
1879 includedir=\${pcfiledir}/libavutil
1880
1881 Name: libavutil
1882 Description: FFmpeg utility library
1883 Version: $lavu_version
1884 Requires:
1885 Conflicts:
1886 Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
1887 Cflags: -I\${includedir}
1888 EOF
1889
1890 # libavcodec.pc
1891 cat <<EOF >libavcodec.pc
1892 prefix=$prefix
1893 exec_prefix=\${prefix}
1894 libdir=\${exec_prefix}/lib
1895 includedir=\${prefix}/include
1896
1897 Name: libavcodec
1898 Description: FFmpeg codec library
1899 Version: $lavc_version
1900 Requires: $pkg_requires libavutil = $lavu_version
1901 Conflicts:
1902 Libs: -L\${libdir} -lavcodec $extralibs
1903 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
1904 EOF
1905
1906 cat <<EOF >libavcodec-uninstalled.pc
1907 prefix=
1908 exec_prefix=
1909 libdir=\${pcfiledir}/libavcodec
1910 includedir=\${pcfiledir}/libavcodec
1911
1912 Name: libavcodec
1913 Description: FFmpeg codec library
1914 Version: $lavc_version
1915 Requires: $pkg_requires libavutil = $lavu_version
1916 Conflicts:
1917 Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
1918 Cflags: -I\${includedir}
1919 EOF
1920
1921 # libavformat.pc
1922 cat <<EOF >libavformat.pc
1923 prefix=$prefix
1924 exec_prefix=\${prefix}
1925 libdir=\${exec_prefix}/lib
1926 includedir=\${prefix}/include
1927
1928 Name: libavformat
1929 Description: FFmpeg container format library
1930 Version: $lavf_version
1931 Requires: $pkg_requires libavcodec = $lavc_version
1932 Conflicts:
1933 Libs: -L\${libdir} -lavformat $extralibs
1934 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
1935 EOF
1936
1937 cat <<EOF >libavformat-uninstalled.pc
1938 prefix=
1939 exec_prefix=
1940 libdir=\${pcfiledir}/libavformat
1941 includedir=\${pcfiledir}/libavformat
1942
1943 Name: libavformat
1944 Description: FFmpeg container format library
1945 Version: $lavf_version
1946 Requires: $pkg_requires libavcodec = $lavc_version
1947 Conflicts:
1948 Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
1949 Cflags: -I\${includedir}
1950 EOF
1951
1952
1953 # libpostproc.pc
1954 cat <<EOF >libpostproc.pc
1955 prefix=$prefix
1956 exec_prefix=\${prefix}
1957 libdir=\${exec_prefix}/lib
1958 includedir=\${prefix}/include
1959
1960 Name: libpostproc
1961 Description: FFmpeg post processing library
1962 Version: $lavc_version
1963 Requires:
1964 Conflicts:
1965 Libs: -L\${libdir} -lpostproc
1966 Cflags: -I\${includedir} -I\${includedir}/postproc
1967 EOF
1968
1969 cat <<EOF >libpostproc-uninstalled.pc
1970 prefix=
1971 exec_prefix=
1972 libdir=\${pcfiledir}/libavcodec/libpostproc
1973 includedir=\${pcfiledir}/libavcodec/libpostproc
1974
1975 Name: libpostproc
1976 Description: FFmpeg post processing library
1977 Version: $lavc_version
1978 Requires:
1979 Conflicts:
1980 Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
1981 Cflags: -I\${includedir}
1982 EOF