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 " --enable-shared build libx264.so"
19 echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
20 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
21 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
28 cat > conftest.c << EOF
30 int main () { $3 return 0; }
32 $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
34 rm -f conftest.c conftest*
38 rm -f config.h config.mak x264.pc
41 exec_prefix='${prefix}'
42 bindir='${exec_prefix}/bin'
43 libdir='${exec_prefix}/lib'
44 includedir='${prefix}/include'
58 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
71 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
75 CFLAGS="$CFLAGS -falign-loops=16"
76 LDFLAGS="$LDFLAGS -lm -lmx"
80 LDFLAGS="$LDFLAGS -lm"
84 LDFLAGS="$LDFLAGS -lm"
88 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
89 LDFLAGS="$LDFLAGS -lm"
93 CFLAGS="$CFLAGS -mno-cygwin"
94 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" = 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|ppc64)
142 CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
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"
255 if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then
260 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
261 CFLAGS="$CFLAGS -DVISUALIZE=1"
265 echo "Unknown option $opt, ignored"
270 # autodetect options that weren't forced nor disabled
272 if test "$pthread" = "auto" ; then
279 cc_check pthread.h -lpthread && pthread="yes"
283 if test "$pthread" = "yes" ; then
284 CFLAGS="$CFLAGS -DHAVE_PTHREAD"
288 *) LDFLAGS="$LDFLAGS -lpthread"
293 MP4_LDFLAGS="-lgpac_static"
294 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
295 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
297 if [ "$mp4_output" = "auto" ] ; then
299 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
301 if [ "$mp4_output" = "yes" ] ; then
302 echo "#define MP4_OUTPUT" >> config.h
303 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
306 if [ "$avis_input" = "auto" ] ; then
307 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
313 if [ "$avis_input" = "yes" ] ; then
314 echo "#define AVIS_INPUT" >> config.h
315 LDFLAGS="$LDFLAGS -lvfw32"
318 if [ "$pic" = "yes" ] ; then
319 CFLAGS="$CFLAGS -fPIC"
320 ASFLAGS="$ASFLAGS -D__PIC__"
323 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
324 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
325 LDFLAGS="$LDFLAGS -s"
326 VFW_LDFLAGS="$VFW_LDFLAGS -s"
329 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
330 echo "#define fseek fseeko" >> config.h
331 echo "#define ftell ftello" >> config.h
332 elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
333 echo "#define fseek fseeko64" >> config.h
334 echo "#define ftell ftello64" >> config.h
337 # generate config files
339 cat > config.mak << EOF
341 exec_prefix=$exec_prefix
344 includedir=$includedir
355 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
359 echo -n 'CONFIGURE_ARGS=' >> config.mak
361 echo -n " '$A'" >> config.mak
363 echo '' >> config.mak
365 cp config.mak gtk/config.mak
367 if [ "$vfw" = "yes" ]; then
368 rm -f vfw/build/cygwin/config.mak
369 cat > vfw/build/cygwin/config.mak << EOF
373 echo "default: x264vfw.dll" >> config.mak
376 if [ "$shared" = "yes" ]; then
377 API=`grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' '`
378 echo "SONAME=libx264.so.$API" >> config.mak
379 echo 'default: $(SONAME)' >> config.mak
384 pclibs="-L$libdir -lx264"
385 if test "$pthread" = "yes" ; then
389 *) pclibs="$pclibs -lpthread"
396 exec_prefix=$exec_prefix
398 includedir=$includedir
401 Description: H.264 (MPEG4 AVC) encoder library
402 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
404 Cflags: -I$includedir
408 echo "Platform: $ARCH"
410 echo "avis input: $avis_input"
411 echo "mp4 output: $mp4_output"
412 echo "pthread: $pthread"
417 echo "shared: $shared"
418 echo "visualize: $vis"
420 echo "You can run 'make' or 'make fprofiled' now."