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