- New switch to activate 4MV in ffmpeg.
[libav.git] / configure
CommitLineData
de6d9b64
FB
1#!/bin/sh
2
3d204385
NK
3TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
4TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
5TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
6
7if [ ! -z "$TMPDIR" ]; then
8 TMPC="${TMPDIR}/${TMPC}"
9 TMPCPP="${TMPDIR}/${TMPCPP}"
10 TMPO="${TMPDIR}/${TMPO}"
11 TMPS="${TMPDIR}/${TMPS}"
12elif [ ! -z "$TEMPDIR" ]; then
13 TMPC="${TEMPDIR}/${TMPC}"
14 TMPCPP="${TEMPDIR}/${TMPCPP}"
15 TMPO="${TEMPDIR}/${TMPO}"
16 TMPS="${TEMPDIR}/${TMPS}"
17else
18 TMPC="/tmp/${TMPC}"
19 TMPCPP="/tmp/${TMPCPP}"
20 TMPO="/tmp/${TMPO}"
21 TMPS="/tmp/${TMPS}"
22fi
23
de6d9b64
FB
24# default parameters
25prefix="/usr/local"
26cc="gcc"
27ar="ar"
28cpu=`uname -m`
29case "$cpu" in
ef0bc4c9 30 i386|i486|i586|i686|i86pc|BePC)
de6d9b64
FB
31 cpu="x86"
32 mmx="yes"
33 ;;
6ed7422a
FB
34 armv4l)
35 cpu="armv4l"
36 mmx="no"
37 ;;
91d1f1a4
NK
38 alpha)
39 cpu="alpha"
40 mmx="no"
41 ;;
de6d9b64
FB
42 *)
43 mmx="no"
44 ;;
45esac
46gprof="no"
6ed7422a 47grab="yes"
a6741398 48mp3lame="no"
daf8e955 49win32="no"
ef0bc4c9
FR
50extralibs="-lm"
51
52# OS specific
53targetos=`uname -s`
54case $targetos in
55BeOS)
56prefix="/boot/home/config"
57# helps building libavcodec
58grab="no"
59CFLAGS="-O2 -DPIC"
60# no need for libm, but the inet stuff
61# Check for BONE
62if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
63extralibs="-lbind -lsocket"
64else
65echo "Not sure building for net_server will succeed... good luck."
66extralibs="-lsocket"
67fi ;;
68*) ;;
69esac
de6d9b64
FB
70
71if [ "$1" = "-h" -o "$1" = "--help" ] ; then
72cat << EOF
73
74Usage: configure [options]
75Options: [defaults in brackets after descriptions]
76
77 --help print this message
78EOF
79echo " --prefix=PREFIX install in PREFIX [$prefix]"
80echo " --cc=CC use C compiler CC [$cc]"
81echo " --cpu=CPU force cpu to CPU [$cpu]"
82echo " --disable-mmx disable mmx usage"
83echo " --enable-gprof enable profiling with gprof [$gprof]"
6ed7422a 84echo " --disable-grab disable audio/video grabbing code"
a6741398 85echo " --enable-mp3lame enable mp3 encoding via libmp3lame"
daf8e955 86echo " --enable-win32 enable win32 cross compile"
0319c531 87echo " --enable-shared build shared libraries [default=no]"
de6d9b64
FB
88exit 1
89fi
90
0319c531 91lshared=no
de6d9b64
FB
92for opt do
93 case "$opt" in
94 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
95 ;;
96 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
97 ;;
98 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
99 ;;
100 --disable-mmx) mmx="no"
101 ;;
102 --enable-gprof) gprof="yes"
103 ;;
6ed7422a
FB
104 --disable-grab) grab="no"
105 ;;
a6741398
J
106 --enable-mp3lame) mp3lame="yes"
107 ;;
daf8e955
FB
108 --enable-win32) win32="yes"
109 ;;
0319c531
NK
110 --enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
111 ;;
de6d9b64
FB
112 esac
113done
114
daf8e955
FB
115# Checking for CFLAGS
116if test -z "$CFLAGS"; then
117 CFLAGS="-O2"
118fi
119
120if [ "$win32" = "yes" ] ; then
121 cross_prefix="i386-mingw32msvc-"
122 cc="${cross_prefix}gcc"
123 ar="${cross_prefix}ar"
124 grab="no"
125fi
126
3d204385
NK
127# ---
128# check availability of some header files
129
130cat > $TMPC << EOF
131#include <malloc.h>
132int main( void ) { return 0; }
133EOF
134
135_memalign=no
136_malloc_h=no
137if $cc -o $TMPO $TMPC 2> /dev/null ; then
138_malloc_h=yes
139_memalign=yes
140# check for memalign - atmos
141cat > $TMPC << EOF
142#include <malloc.h>
143int main ( void ) {
144char *string = NULL;
145string = memalign(64, sizeof(char));
146return 0;
147}
148EOF
149$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
150fi
151
de6d9b64
FB
152echo "Install prefix $prefix"
153echo "C compiler $cc"
154echo "CPU $cpu"
155echo "MMX enabled $mmx"
156echo "gprof enabled $gprof"
6ed7422a 157echo "grab enabled $grab"
a6741398 158echo "mp3lame enabled $mp3lame"
de6d9b64 159
980fc7b8 160echo "Creating config.mak and config.h"
de6d9b64 161
980fc7b8 162echo "# Automatically generated by configure - do not modify" > config.mak
de6d9b64
FB
163echo "/* Automatically generated by configure - do not modify */" > config.h
164
980fc7b8 165echo "prefix=$prefix" >> config.mak
2cc8ae96 166echo "MAKE=make" >> config.mak
980fc7b8
FB
167echo "CC=$cc" >> config.mak
168echo "AR=$ar" >> config.mak
a9b3f630 169echo "OPTFLAGS=$CFLAGS" >> config.mak
de6d9b64 170if [ "$cpu" = "x86" ] ; then
980fc7b8
FB
171 echo "TARGET_ARCH_X86=yes" >> config.mak
172 echo "#define ARCH_X86 1" >> config.h
de6d9b64 173fi
6ed7422a
FB
174if [ "$cpu" = "armv4l" ]; then
175 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
176 echo "#define ARCH_ARMV4L 1" >> config.h
177fi
91d1f1a4
NK
178if [ "$cpu" = "alpha" ]; then
179 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
180 echo "#define ARCH_ALPHA 1" >> config.h
181fi
de6d9b64 182if [ "$mmx" = "yes" ] ; then
980fc7b8
FB
183 echo "TARGET_MMX=yes" >> config.mak
184 echo "#define HAVE_MMX 1" >> config.h
de6d9b64
FB
185fi
186if [ "$gprof" = "yes" ] ; then
980fc7b8
FB
187 echo "TARGET_GPROF=yes" >> config.mak
188 echo "#define HAVE_GPROF 1" >> config.h
de6d9b64 189fi
0319c531
NK
190if [ "$lshared" = "yes" ] ; then
191 echo "BUILD_SHARED=yes" >> config.mak
192else
193 echo "BUILD_SHARED=no" >> config.mak
194fi
ef0bc4c9 195echo "EXTRALIBS=$extralibs" >> config.mak
0319c531
NK
196echo -n "VERSION=" >>config.mak
197head VERSION >>config.mak
198echo "" >>config.mak
d771bcae
FB
199# if you do not want to use encoders, disable that.
200echo "#define CONFIG_ENCODERS 1" >> config.h
201echo "CONFIG_ENCODERS=yes" >> config.mak
202
203# if you do not want to use decoders, disable that.
204echo "#define CONFIG_DECODERS 1" >> config.h
205echo "CONFIG_DECODERS=yes" >> config.mak
206
d2b7bcd2 207# special AC3 stuff in case you already have it
d771bcae
FB
208# without libavcodec.
209echo "#define CONFIG_AC3 1" >> config.h
210echo "CONFIG_AC3=yes" >> config.mak
211
6ed7422a
FB
212if [ "$grab" = "yes" ] ; then
213 echo "#define CONFIG_GRAB 1" >> config.h
214 echo "CONFIG_GRAB=yes" >> config.mak
215fi
daf8e955 216
a6741398
J
217if [ "$mp3lame" = "yes" ] ; then
218 echo "#define CONFIG_MP3LAME 1" >> config.h
219 echo "CONFIG_MP3LAME=yes" >> config.mak
220fi
221
daf8e955
FB
222if [ "$win32" = "yes" ] ; then
223 echo "#define CONFIG_WIN32 1" >> config.h
224 echo "CONFIG_WIN32=yes" >> config.mak
225fi
3d204385
NK
226
227if [ "$_malloc_h" = "yes" ]; then
228 echo "#define HAVE_MALLOC_H 1" >> config.h
229else
230 echo "#undef HAVE_MALLOC_H" >> config.h
231fi
232
233if [ "$_memalign" = "yes" ]; then
234 echo "#define HAVE_MEMALIGN 1" >> config.h
235else
236 echo "#undef HAVE_MEMALIGN" >> config.h
237fi
238
239rm -f $TMPO $TMPC $TMPS