3 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
5 echo "Usage: ./configure [options]"
7 echo "available options:"
9 echo " --help print this message"
10 echo " --enable-avis-input enables avisynth input (win32 only)"
11 echo " --enable-mp4-output enables mp4 output (using gpac)"
12 echo " --enable-vfw compiles the VfW frontend"
13 echo " --enable-pthread enables multithreaded encoding"
14 echo " --enable-debug adds -g, doesn't strip"
15 echo " --enable-gprof adds -pg, doesn't strip"
16 echo " --enable-visualize enables visualization (X11 only)"
17 echo " --enable-pic build position-independent code"
18 echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
19 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
20 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
27 cat > conftest.c << EOF
29 int main () { $3 return 0; }
31 $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
33 rm -f conftest.c conftest*
37 rm -f config.h config.mak x264.pc
40 exec_prefix='${prefix}'
41 bindir='${exec_prefix}/bin'
42 libdir='${exec_prefix}/lib'
43 includedir='${prefix}/include'
56 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
69 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
73 CFLAGS="$CFLAGS -falign-loops=16"
74 LDFLAGS="$LDFLAGS -lm -lmx"
78 LDFLAGS="$LDFLAGS -lm"
82 LDFLAGS="$LDFLAGS -lm"
86 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
87 LDFLAGS="$LDFLAGS -lm"
91 CFLAGS="$CFLAGS -mno-cygwin"
92 LDFLAGS="$LDFLAGS -mno-cygwin"
105 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
106 LDFLAGS="$LDFLAGS -lm"
110 echo "Unknown system $UNAMES, edit the configure"
117 i386|i486|i586|i686|BePC)
119 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
122 if [ "$SYS" = MACOSX ]; then
123 ASFLAGS="$ASFLAGS -f macho -DPREFIX"
124 elif [ "$SYS" = CYGWIN -o "$SYS" = MINGW ]; then
125 ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
126 elif [ "$SYS" = FREEBSD -o "$SYS" = NETBSD ]; then
127 ASFLAGS="$ASFLAGS -f aoutb"
129 ASFLAGS="$ASFLAGS -f elf"
134 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
136 ASFLAGS="-f elf -m amd64"
138 "Power Macintosh"|ppc)
142 CFLAGS="$CFLAGS -faltivec"
144 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
147 sun4m|sun4d|sparc|sparc64)
152 CFLAGS="$CFLAGS -mcpu=ultrasparc"
153 LDFLAGS="$LDFLAGS -mcpu=ultrasparc"
155 ASFLAGS="-xarch=v8plusa"
179 echo "Unknown platform $UNAMEM, edit the configure"
184 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
195 exec_prefix="$optarg"
209 --disable-avis-input)
215 --disable-mp4-output)
219 ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
222 CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
223 VFW_CFLAGS="${opt#--extra-cflags=}"
226 LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
227 VFW_LDFLAGS="${opt#--extra-ldflags=}"
241 LDFLAGS="$LDFLAGS -pg"
245 CFLAGS="$CFLAGS -fPIC"
246 ASFLAGS="$ASFLAGS -D__PIC__"
256 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
257 CFLAGS="$CFLAGS -DVISUALIZE=1"
261 echo "Unknown option $opt, ignored"
266 # autodetect options that weren't forced nor disabled
268 if test "$pthread" = "auto" ; then
275 cc_check pthread.h -lpthread && pthread="yes"
279 if test "$pthread" = "yes" ; then
280 CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
284 *) LDFLAGS="$LDFLAGS -lpthread"
289 MP4_LDFLAGS="-lgpac_static"
290 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
291 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
293 if [ "$mp4_output" = "auto" ] ; then
295 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
297 if [ "$mp4_output" = "yes" ] ; then
298 echo "#define MP4_OUTPUT" >> config.h
299 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
302 if [ "$avis_input" = "auto" ] ; then
303 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
309 if [ "$avis_input" = "yes" ] ; then
310 echo "#define AVIS_INPUT" >> config.h
311 LDFLAGS="$LDFLAGS -lvfw32"
314 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
315 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
316 LDFLAGS="$LDFLAGS -s"
317 VFW_LDFLAGS="$VFW_LDFLAGS -s"
320 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
321 echo "#define fseek fseeko" >> config.h
322 echo "#define ftell ftello" >> config.h
323 elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
324 echo "#define fseek fseeko64" >> config.h
325 echo "#define ftell ftello64" >> config.h
328 # generate config files
330 cat > config.mak << EOF
332 exec_prefix=$exec_prefix
335 includedir=$includedir
346 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
351 if [ "$vfw" = "yes" ]; then
352 rm -f vfw/build/cygwin/config.mak
353 cat > vfw/build/cygwin/config.mak << EOF
357 echo "default: x264vfw.dll" >> config.mak
364 exec_prefix=$exec_prefix
366 includedir=$includedir
369 Description: H.264 (MPEG4 AVC) encoder library
370 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
371 Libs: -L$libdir -lx264
372 Cflags: -I$includedir
376 echo "Platform: $ARCH"
378 echo "avis input: $avis_input"
379 echo "mp4 output: $mp4_output"
380 echo "pthread: $pthread"
385 echo "visualize: $vis"
387 echo "You can run 'make' or 'make fprofiled' now."