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 " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
18 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
19 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
26 cat > conftest.c << EOF
28 int main () { $3 return 0; }
30 $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
32 rm -f conftest.c conftest
36 rm -f config.h config.mak x264.pc
39 exec_prefix='${prefix}'
40 bindir='${exec_prefix}/bin'
41 libdir='${exec_prefix}/lib'
42 includedir='${prefix}/include'
54 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
67 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
71 CFLAGS="$CFLAGS -falign-loops=16"
72 LDFLAGS="$LDFLAGS -lm -lmx"
76 LDFLAGS="$LDFLAGS -lm"
80 LDFLAGS="$LDFLAGS -lm"
84 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
85 LDFLAGS="$LDFLAGS -lm"
89 CFLAGS="$CFLAGS -mno-cygwin"
90 LDFLAGS="$LDFLAGS -mno-cygwin"
91 ASFLAGS="-f win32 -DPREFIX"
98 ASFLAGS="-f win32 -DPREFIX"
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 ASFLAGS="-f macho -DPREFIX"
127 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
129 ASFLAGS="-f elf -m amd64"
131 "Power Macintosh"|ppc)
135 CFLAGS="$CFLAGS -faltivec"
137 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
140 sun4m|sun4d|sparc|sparc64)
145 CFLAGS="$CFLAGS -mcpu=ultrasparc"
146 LDFLAGS="$LDFLAGS -mcpu=ultrasparc"
148 ASFLAGS="-xarch=v8plusa"
172 echo "Unknown platform $UNAMEM, edit the configure"
177 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
188 exec_prefix="$optarg"
202 --disable-avis-input)
208 --disable-mp4-output)
212 ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
215 CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
216 VFW_CFLAGS="${opt#--extra-cflags=}"
219 LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
220 VFW_LDFLAGS="${opt#--extra-ldflags=}"
234 LDFLAGS="$LDFLAGS -pg"
244 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
245 CFLAGS="$CFLAGS -DVISUALIZE=1"
249 echo "Unknown option $opt, ignored"
254 # autodetect options that weren't forced nor disabled
256 if test "$pthread" = "auto" ; then
263 cc_check pthread.h -lpthread && pthread="yes"
267 if test "$pthread" = "yes" ; then
268 CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
272 *) LDFLAGS="$LDFLAGS -lpthread"
277 MP4_LDFLAGS="-lgpac_static"
278 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
279 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
281 if [ "$mp4_output" = "auto" ] ; then
283 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
285 if [ "$mp4_output" = "yes" ] ; then
286 echo "#define MP4_OUTPUT" >> config.h
287 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
290 if [ "$avis_input" = "auto" ] ; then
291 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
297 if [ "$avis_input" = "yes" ] ; then
298 echo "#define AVIS_INPUT" >> config.h
299 LDFLAGS="$LDFLAGS -lvfw32"
302 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
303 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
304 LDFLAGS="$LDFLAGS -s"
305 VFW_LDFLAGS="$VFW_LDFLAGS -s"
308 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
309 echo "#define fseek fseeko" >> config.h
310 echo "#define ftell ftello" >> config.h
311 elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
312 echo "#define fseek fseeko64" >> config.h
313 echo "#define ftell ftello64" >> config.h
316 # generate config files
318 cat > config.mak << EOF
320 exec_prefix=$exec_prefix
323 includedir=$includedir
334 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
339 if [ "$vfw" = "yes" ]; then
340 rm -f vfw/build/cygwin/config.mak
341 cat > vfw/build/cygwin/config.mak << EOF
345 echo "default: x264vfw.dll" >> config.mak
352 exec_prefix=$exec_prefix
354 includedir=$includedir
357 Description: H.264 (MPEG4 AVC) encoder library
358 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
359 Libs: -L$libdir -lx264
360 Cflags: -I$includedir
364 echo "Platform: $ARCH"
366 echo "avis input: $avis_input"
367 echo "mp4 output: $mp4_output"
368 echo "pthread: $pthread"
372 echo "visualize: $vis"
374 echo "You can run 'make' or 'make fprofiled' now."