Statistics
| Branch: | Revision:

ffmpeg / configure @ ef0bc4c9

History | View | Annotate | Download (5.16 KB)

1
#!/bin/sh
2

    
3
TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
4
TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
5
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
6

    
7
if [ ! -z "$TMPDIR" ]; then
8
	TMPC="${TMPDIR}/${TMPC}"
9
	TMPCPP="${TMPDIR}/${TMPCPP}"
10
	TMPO="${TMPDIR}/${TMPO}"
11
	TMPS="${TMPDIR}/${TMPS}"
12
elif [ ! -z "$TEMPDIR" ]; then
13
	TMPC="${TEMPDIR}/${TMPC}"
14
	TMPCPP="${TEMPDIR}/${TMPCPP}"
15
	TMPO="${TEMPDIR}/${TMPO}"
16
	TMPS="${TEMPDIR}/${TMPS}"
17
else
18
	TMPC="/tmp/${TMPC}"
19
	TMPCPP="/tmp/${TMPCPP}"
20
	TMPO="/tmp/${TMPO}"
21
	TMPS="/tmp/${TMPS}"
22
fi
23

    
24
# default parameters
25
prefix="/usr/local"
26
cc="gcc"
27
ar="ar"
28
cpu=`uname -m`
29
case "$cpu" in
30
  i386|i486|i586|i686|i86pc|BePC)
31
    cpu="x86"
32
    mmx="yes"
33
  ;;
34
  armv4l)
35
    cpu="armv4l"
36
    mmx="no"
37
  ;;
38
  alpha)
39
    cpu="alpha"
40
    mmx="no"
41
  ;;
42
  *)
43
    mmx="no"
44
  ;;
45
esac
46
gprof="no"
47
grab="yes"
48
win32="no"
49
extralibs="-lm"
50

    
51
# OS specific
52
targetos=`uname -s`
53
case $targetos in
54
BeOS)
55
prefix="/boot/home/config"
56
# helps building libavcodec
57
grab="no"
58
CFLAGS="-O2 -DPIC"
59
# no need for libm, but the inet stuff
60
# Check for BONE
61
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
62
extralibs="-lbind -lsocket"
63
else
64
echo "Not sure building for net_server will succeed... good luck."
65
extralibs="-lsocket"
66
fi ;;
67
*) ;;
68
esac
69

    
70
if [ "$1" = "-h" -o "$1" = "--help" ] ; then
71
cat << EOF
72

    
73
Usage: configure [options]
74
Options: [defaults in brackets after descriptions]
75

    
76
  --help                  print this message
77
EOF
78
echo "  --prefix=PREFIX         install in PREFIX [$prefix]"
79
echo "  --cc=CC                 use C compiler CC [$cc]"
80
echo "  --cpu=CPU               force cpu to CPU  [$cpu]"
81
echo "  --disable-mmx           disable mmx usage"
82
echo "  --enable-gprof          enable profiling with gprof [$gprof]"
83
echo "  --disable-grab          disable audio/video grabbing code"
84
echo "  --enable-win32          enable win32 cross compile"
85
echo "  --enable-shared         build shared libraries [default=no]"
86
exit 1
87
fi
88

    
89
lshared=no
90
for 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
  ;;
102
  --disable-grab) grab="no"
103
  ;;
104
  --enable-win32) win32="yes"
105
  ;;
106
  --enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
107
  ;;
108
  esac
109
done
110

    
111
# Checking for CFLAGS
112
if test -z "$CFLAGS"; then
113
    CFLAGS="-O2"
114
fi
115

    
116
if [ "$win32" = "yes" ] ; then
117
    cross_prefix="i386-mingw32msvc-"
118
    cc="${cross_prefix}gcc"
119
    ar="${cross_prefix}ar"
120
    grab="no"
121
fi
122

    
123
# ---
124
# check availability of some header files
125

    
126
cat > $TMPC << EOF
127
#include <malloc.h>
128
int main( void ) { return 0; }
129
EOF
130

    
131
_memalign=no
132
_malloc_h=no
133
if $cc -o $TMPO $TMPC 2> /dev/null ; then
134
_malloc_h=yes
135
_memalign=yes
136
# check for memalign - atmos
137
cat > $TMPC << EOF
138
#include <malloc.h>
139
int main ( void ) {
140
char *string = NULL;
141
string = memalign(64, sizeof(char));
142
return 0;
143
}
144
EOF
145
$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
146
fi
147

    
148
echo "Install prefix   $prefix"
149
echo "C compiler       $cc"
150
echo "CPU              $cpu"
151
echo "MMX enabled      $mmx"
152
echo "gprof enabled    $gprof"
153
echo "grab enabled     $grab"
154

    
155
echo "Creating config.mak and config.h"
156

    
157
echo "# Automatically generated by configure - do not modify" > config.mak
158
echo "/* Automatically generated by configure - do not modify */" > config.h
159

    
160
echo "prefix=$prefix" >> config.mak
161
echo "MAKE=make" >> config.mak
162
echo "CC=$cc" >> config.mak
163
echo "AR=$ar" >> config.mak
164
echo "OPTFLAGS=$CFLAGS" >> config.mak
165
if [ "$cpu" = "x86" ] ; then
166
  echo "TARGET_ARCH_X86=yes" >> config.mak
167
  echo "#define ARCH_X86 1" >> config.h
168
fi
169
if [ "$cpu" = "armv4l" ]; then
170
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
171
  echo "#define ARCH_ARMV4L 1" >> config.h
172
fi
173
if [ "$cpu" = "alpha" ]; then
174
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
175
  echo "#define ARCH_ALPHA 1" >> config.h
176
fi
177
if [ "$mmx" = "yes" ] ; then
178
  echo "TARGET_MMX=yes" >> config.mak
179
  echo "#define HAVE_MMX 1" >> config.h
180
fi
181
if [ "$gprof" = "yes" ] ; then
182
  echo "TARGET_GPROF=yes" >> config.mak
183
  echo "#define HAVE_GPROF 1" >> config.h
184
fi
185
if [ "$lshared" = "yes" ] ; then
186
  echo "BUILD_SHARED=yes" >> config.mak
187
else
188
  echo "BUILD_SHARED=no" >> config.mak
189
fi
190
echo "EXTRALIBS=$extralibs" >> config.mak
191
echo -n "VERSION=" >>config.mak
192
head VERSION >>config.mak
193
echo "" >>config.mak
194
# if you do not want to use encoders, disable that.
195
echo "#define CONFIG_ENCODERS 1" >> config.h
196
echo "CONFIG_ENCODERS=yes" >> config.mak
197

    
198
# if you do not want to use decoders, disable that.
199
echo "#define CONFIG_DECODERS 1" >> config.h
200
echo "CONFIG_DECODERS=yes" >> config.mak
201

    
202
# special AC3 stuff in case you already have it
203
# without libavcodec.
204
echo "#define CONFIG_AC3 1" >> config.h
205
echo "CONFIG_AC3=yes" >> config.mak
206

    
207
if [ "$grab" = "yes" ] ; then
208
  echo "#define CONFIG_GRAB 1" >> config.h
209
  echo "CONFIG_GRAB=yes" >> config.mak
210
fi
211

    
212
if [ "$win32" = "yes" ] ; then
213
  echo "#define CONFIG_WIN32 1" >> config.h
214
  echo "CONFIG_WIN32=yes" >> config.mak
215
fi
216

    
217
if [ "$_malloc_h" = "yes" ]; then
218
  echo "#define HAVE_MALLOC_H 1" >> config.h
219
else
220
  echo "#undef  HAVE_MALLOC_H" >> config.h
221
fi
222

    
223
if [ "$_memalign" = "yes" ]; then
224
  echo "#define HAVE_MEMALIGN 1" >> config.h
225
else
226
  echo "#undef  HAVE_MEMALIGN" >> config.h
227
fi
228

    
229
rm -f $TMPO $TMPC $TMPS