Make dct_unquantize_h263 work on systems without MVI extension.
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305
FB
4#
5# set temporary file name
57514323 6if test ! -z "$TMPDIR" ; then
0f3cb305 7 TMPDIR1="${TMPDIR}"
57514323 8elif test ! -z "$TEMPDIR" ; then
0f3cb305 9 TMPDIR1="${TEMPDIR}"
3d204385 10else
0f3cb305 11 TMPDIR1="/tmp"
3d204385
NK
12fi
13
0f3cb305
FB
14TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
17TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
18
de6d9b64
FB
19# default parameters
20prefix="/usr/local"
0f3cb305 21cross_prefix=""
de6d9b64
FB
22cc="gcc"
23ar="ar"
4a908fbc 24make="make"
0f3cb305 25strip="strip"
de6d9b64 26cpu=`uname -m`
0f3cb305 27mmx="default"
de6d9b64 28case "$cpu" in
ef0bc4c9 29 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 30 cpu="x86"
de6d9b64 31 ;;
6ed7422a
FB
32 armv4l)
33 cpu="armv4l"
6ed7422a 34 ;;
91d1f1a4
NK
35 alpha)
36 cpu="alpha"
91d1f1a4 37 ;;
de6d9b64 38 *)
0f3cb305 39 cpu="unknown"
de6d9b64
FB
40 ;;
41esac
42gprof="no"
5cbcf02c
FB
43v4l="yes"
44audio_oss="yes"
45network="yes"
a6741398 46mp3lame="no"
5cbcf02c 47a52="yes"
57514323 48a52bin="no"
daf8e955 49win32="no"
83286d2a 50lshared="no"
ef0bc4c9 51extralibs="-lm"
c02dbee1 52simpleidct="yes"
0f3cb305 53bigendian="no"
1eb2212e 54mpegaudio_hp="yes"
ef0bc4c9
FR
55
56# OS specific
57targetos=`uname -s`
58case $targetos in
59BeOS)
60prefix="/boot/home/config"
61# helps building libavcodec
ef0bc4c9 62CFLAGS="-O2 -DPIC"
5cbcf02c 63v4l="no"
ef0bc4c9
FR
64# no need for libm, but the inet stuff
65# Check for BONE
66if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
67extralibs="-lbind -lsocket"
68else
69echo "Not sure building for net_server will succeed... good luck."
70extralibs="-lsocket"
71fi ;;
4a908fbc 72BSD/OS)
5cbcf02c 73v4l="no"
6063bce7 74audio_oss="yes"
4a908fbc
AB
75extralibs="-lpoll -lgnugetopt -lm"
76make="gmake"
77;;
ef0bc4c9
FR
78*) ;;
79esac
de6d9b64 80
0f3cb305
FB
81# find source path
82# XXX: we assume an absolute path is given when launching configure,
83# except in './configure' case.
84source_path=${0%configure}
85source_path=${source_path%/}
86source_path_used="yes"
87if test -z "$source_path" -o "$source_path" = "." ; then
88 source_path=`pwd`
89 source_path_used="no"
de6d9b64
FB
90fi
91
92for opt do
93 case "$opt" in
94 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
95 ;;
0f3cb305
FB
96 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
97 ;;
98 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
99 ;;
de6d9b64
FB
100 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
101 ;;
4a908fbc
AB
102 --make=*) make=`echo $opt | cut -d '=' -f 2`
103 ;;
0f3cb305
FB
104 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
105 ;;
106 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
107 ;;
108 --extra-libs=*) extralibs=${opt#--extra-libs=}
109 ;;
de6d9b64
FB
110 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
111 ;;
112 --disable-mmx) mmx="no"
113 ;;
114 --enable-gprof) gprof="yes"
115 ;;
5cbcf02c
FB
116 --disable-v4l) v4l="no"
117 ;;
118 --disable-audio-oss) audio_oss="no"
119 ;;
120 --disable-network) network="no"
121 ;;
122 --disable-a52) a52="no"
6ed7422a 123 ;;
57514323
ZK
124 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
125 ;;
a6741398
J
126 --enable-mp3lame) mp3lame="yes"
127 ;;
c02dbee1 128 --disable-simple_idct) simpleidct="no"
045ed63f 129 ;;
daf8e955
FB
130 --enable-win32) win32="yes"
131 ;;
83286d2a 132 --enable-shared) lshared="yes"
0319c531 133 ;;
1eb2212e
FB
134 --disable-mpegaudio-hp) mpegaudio_hp="no"
135 ;;
de6d9b64
FB
136 esac
137done
138
0f3cb305
FB
139# compute mmx state
140if test $mmx = "default"; then
141 if test $cpu = "x86"; then
142 mmx="yes"
143 else
144 mmx="no"
145 fi
146fi
147
daf8e955
FB
148# Checking for CFLAGS
149if test -z "$CFLAGS"; then
150 CFLAGS="-O2"
151fi
152
57514323 153if test "$win32" = "yes" ; then
daf8e955 154 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
155 v4l="no"
156 audio_oss="no"
157 network="no"
daf8e955
FB
158fi
159
0f3cb305
FB
160# endianness : guess with cpu type. Should also use prefix
161if test "$cpu" = "powerpc"; then
162 bigendian="yes"
163fi
164
165cc="${cross_prefix}${cc}"
166ar="${cross_prefix}${ar}"
167strip="${cross_prefix}${strip}"
168
3d204385
NK
169# ---
170# check availability of some header files
171
172cat > $TMPC << EOF
173#include <malloc.h>
174int main( void ) { return 0; }
175EOF
176
177_memalign=no
178_malloc_h=no
179if $cc -o $TMPO $TMPC 2> /dev/null ; then
180_malloc_h=yes
181_memalign=yes
182# check for memalign - atmos
183cat > $TMPC << EOF
184#include <malloc.h>
185int main ( void ) {
186char *string = NULL;
187string = memalign(64, sizeof(char));
188return 0;
189}
190EOF
191$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
192fi
193
6063bce7 194if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
195cat << EOF
196
197Usage: configure [options]
198Options: [defaults in brackets after descriptions]
199
200EOF
201echo "Standard options:"
202echo " --help print this message"
203echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305
FB
204echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
205echo " --enable-win32 enable win32 cross compile"
5cbcf02c 206echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305
FB
207echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
208echo " --enable-shared build shared libraries [default=no]"
209echo ""
210echo "Advanced options (experts only):"
211echo " --source-path=PATH path of source code [$source_path]"
212echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
213echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 214echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
215echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
216echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
217echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
218echo " --cpu=CPU force cpu to CPU [$cpu]"
219echo " --disable-mmx disable mmx usage"
5cbcf02c 220echo " --disable-audio-oss disable OSS audio support [default=no]"
6063bce7 221echo " --disable-v4l disable video4linux grabbing [default=no]"
5cbcf02c
FB
222echo " --disable-network disable network support [default=no]"
223echo " --disable-simple_idct disable simple IDCT routines [default=no]"
0f3cb305 224echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
225echo " --disable-mpegaudio-hp faster (but less accurate)"
226echo " mpegaudio decoding [default=no]"
0f3cb305
FB
227echo ""
228echo "NOTE: The object files are build at the place where configure is launched"
229exit 1
230fi
231
de6d9b64 232echo "Install prefix $prefix"
0f3cb305 233echo "Source path $source_path"
de6d9b64 234echo "C compiler $cc"
4a908fbc 235echo "make $make"
de6d9b64 236echo "CPU $cpu"
0f3cb305 237echo "Big Endian $bigendian"
de6d9b64
FB
238echo "MMX enabled $mmx"
239echo "gprof enabled $gprof"
a6741398 240echo "mp3lame enabled $mp3lame"
5cbcf02c 241echo "a52 support $a52"
57514323 242echo "a52 dlopened $a52bin"
de6d9b64 243
980fc7b8 244echo "Creating config.mak and config.h"
de6d9b64 245
980fc7b8 246echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 247echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 248
980fc7b8 249echo "prefix=$prefix" >> config.mak
4a908fbc 250echo "MAKE=$make" >> config.mak
980fc7b8
FB
251echo "CC=$cc" >> config.mak
252echo "AR=$ar" >> config.mak
0f3cb305 253echo "STRIP=$strip" >> config.mak
a9b3f630 254echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 255echo "LDFLAGS=$LDFLAGS" >> config.mak
57514323 256if test "$cpu" = "x86" ; then
980fc7b8 257 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 258 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 259elif test "$cpu" = "armv4l" ; then
6ed7422a 260 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 261 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 262elif test "$cpu" = "alpha" ; then
91d1f1a4 263 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 264 echo "#define ARCH_ALPHA 1" >> $TMPH
0f3cb305
FB
265elif test "$cpu" = "powerpc" ; then
266 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
267 echo "#define ARCH_POWERPC 1" >> $TMPH
268fi
269if test "$bigendian" = "yes" ; then
270 echo "WORDS_BIGENDIAN=yes" >> config.mak
271 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 272fi
57514323 273if test "$mmx" = "yes" ; then
980fc7b8 274 echo "TARGET_MMX=yes" >> config.mak
045ed63f 275 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 276fi
57514323 277if test "$gprof" = "yes" ; then
980fc7b8 278 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 279 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 280fi
57514323 281if test "$lshared" = "yes" ; then
0319c531 282 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 283 echo "PIC=-fPIC" >> config.mak
0319c531 284fi
ef0bc4c9 285echo "EXTRALIBS=$extralibs" >> config.mak
0319c531 286echo -n "VERSION=" >>config.mak
0f3cb305 287head $source_path/VERSION >>config.mak
0319c531 288echo "" >>config.mak
d771bcae 289# if you do not want to use encoders, disable that.
045ed63f 290echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
291echo "CONFIG_ENCODERS=yes" >> config.mak
292
293# if you do not want to use decoders, disable that.
045ed63f 294echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
295echo "CONFIG_DECODERS=yes" >> config.mak
296
5cbcf02c
FB
297# AC3
298if test "$a52" = "yes" ; then
299 echo "#define CONFIG_AC3 1" >> $TMPH
300 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 301
5cbcf02c
FB
302 if test "$a52bin" = "yes" ; then
303 echo "#define CONFIG_A52BIN 1" >> $TMPH
304 echo "CONFIG_A52BIN=yes" >> config.mak
305 fi
306fi
307
1eb2212e
FB
308# mpeg audio high precision mode
309if test "$mpegaudio_hp" = "yes" ; then
310 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
311fi
312
5cbcf02c
FB
313if test "$v4l" = "yes" ; then
314 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
315 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
316fi
317
318if test "$audio_oss" = "yes" ; then
319 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
320 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
321fi
322
5cbcf02c
FB
323if test "$network" = "yes" ; then
324 echo "#define CONFIG_NETWORK 1" >> $TMPH
325 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 326fi
daf8e955 327
57514323 328if test "$mp3lame" = "yes" ; then
045ed63f 329 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
330 echo "CONFIG_MP3LAME=yes" >> config.mak
331fi
332
57514323 333if test "$win32" = "yes" ; then
045ed63f 334 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
335 echo "CONFIG_WIN32=yes" >> config.mak
336fi
3d204385 337
57514323 338if test "$_malloc_h" = "yes" ; then
045ed63f 339 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 340else
045ed63f 341 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
342fi
343
57514323 344if test "$_memalign" = "yes" ; then
045ed63f
ZK
345 echo "#define HAVE_MEMALIGN 1" >> $TMPH
346else
347 echo "#undef HAVE_MEMALIGN" >> $TMPH
348fi
349
57514323 350if test "$simpleidct" = "yes" ; then
045ed63f
ZK
351 echo "#define SIMPLE_IDCT 1" >> $TMPH
352fi
353
0f3cb305
FB
354# build tree in object directory if source path is different from current one
355if test "$source_path_used" = "yes" ; then
356 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
357 libavcodec/liba52 libavcodec/mlib tests"
358 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
359 for dir in $DIRS ; do
360 mkdir -p $dir
361 done
362 for f in $FILES ; do
363 ln -sf $source_path/$f $f
364 done
365fi
366echo "SRC_PATH=$source_path" >> config.mak
367
a7c02e25 368diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
369if test $? -ne 0 ; then
370 mv -f $TMPH config.h
3d204385 371else
045ed63f 372 echo "config.h is unchanged"
3d204385
NK
373fi
374
045ed63f 375rm -f $TMPO $TMPC $TMPS $TMPH