]> git.sesse.net Git - ffmpeg/blob - configure
468774d0b0337c1a42c62e7276c885fed370484a
[ffmpeg] / configure
1 #!/bin/sh
2
3 # default parameters
4 prefix="/usr/local"
5 cc="gcc"
6 ar="ar"
7 cpu=`uname -m`
8 case "$cpu" in
9   i386|i486|i586|i686)
10     cpu="x86"
11     mmx="yes"
12   ;;
13   armv4l)
14     cpu="armv4l"
15     mmx="no"
16   ;;
17   *)
18     mmx="no"
19   ;;
20 esac
21 gprof="no"
22 mp3lib="yes"
23 grab="yes"
24 win32="no"
25
26 if [ "$1" = "-h" -o "$1" = "--help" ] ; then
27 cat << EOF
28
29 Usage: configure [options]
30 Options: [defaults in brackets after descriptions]
31
32   --help                  print this message
33 EOF
34 echo "  --prefix=PREFIX         install in PREFIX [$prefix]"
35 echo "  --cc=CC                 use C compiler CC [$cc]"
36 echo "  --cpu=CPU               force cpu to CPU  [$cpu]"
37 echo "  --disable-mmx           disable mmx usage"
38 echo "  --enable-gprof          enable profiling with gprof [$gprof]"
39 echo "  --disable-mp3lib        disable mp3 lib compiling"
40 echo "  --disable-grab          disable audio/video grabbing code"
41 echo "  --enable-win32          enable win32 cross compile"
42 exit 1
43 fi
44
45 for opt do
46   case "$opt" in
47   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
48   ;;
49   --cc=*) cc=`echo $opt | cut -d '=' -f 2`
50   ;;
51   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
52   ;;
53   --disable-mmx) mmx="no"
54   ;;
55   --enable-gprof) gprof="yes"
56   ;;
57   --disable-mp3lib) mp3lib="no"
58   ;;
59   --disable-grab) grab="no"
60   ;;
61   --enable-win32) win32="yes"
62   ;;
63   esac
64 done
65
66 # Checking for CFLAGS
67 if test -z "$CFLAGS"; then
68     CFLAGS="-O2"
69 fi
70
71 if [ "$win32" = "yes" ] ; then
72     cross_prefix="i386-mingw32msvc-"
73     cc="${cross_prefix}gcc"
74     ar="${cross_prefix}ar"
75     grab="no"
76 fi
77
78 echo "Install prefix   $prefix"
79 echo "C compiler       $cc"
80 echo "CPU              $cpu"
81 echo "MMX enabled      $mmx"
82 echo "gprof enabled    $gprof"
83 echo "grab enabled     $grab"
84
85 echo "Creating config.mak and config.h"
86
87 echo "# Automatically generated by configure - do not modify" > config.mak
88 echo "/* Automatically generated by configure - do not modify */" > config.h
89
90 echo "prefix=$prefix" >> config.mak
91 echo "MAKE=make" >> config.mak
92 echo "CC=$cc" >> config.mak
93 echo "AR=$ar" >> config.mak
94 echo "OPTFLAGS=$CFLAGS" >> config.mak
95 if [ "$cpu" = "x86" ] ; then
96   echo "TARGET_ARCH_X86=yes" >> config.mak
97   echo "#define ARCH_X86 1" >> config.h
98 fi
99 if [ "$cpu" = "armv4l" ]; then
100   echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
101   echo "#define ARCH_ARMV4L 1" >> config.h
102 fi
103 if [ "$mmx" = "yes" ] ; then
104   echo "TARGET_MMX=yes" >> config.mak
105   echo "#define HAVE_MMX 1" >> config.h
106 fi
107 if [ "$gprof" = "yes" ] ; then
108   echo "TARGET_GPROF=yes" >> config.mak
109   echo "#define HAVE_GPROF 1" >> config.h
110 fi
111
112 # if you do not want to use encoders, disable that.
113 echo "#define CONFIG_ENCODERS 1" >> config.h
114 echo "CONFIG_ENCODERS=yes" >> config.mak
115
116 # if you do not want to use decoders, disable that.
117 echo "#define CONFIG_DECODERS 1" >> config.h
118 echo "CONFIG_DECODERS=yes" >> config.mak
119
120 # special AC3 and MPGLIB enabling stuff in case you already have it
121 # without libavcodec.
122 echo "#define CONFIG_AC3 1" >> config.h
123 echo "CONFIG_AC3=yes" >> config.mak
124
125 if [ "$mp3lib" = "yes" ] ; then
126   echo "#define CONFIG_MPGLIB 1" >> config.h
127   echo "CONFIG_MPGLIB=yes" >> config.mak
128 fi
129
130 if [ "$grab" = "yes" ] ; then
131   echo "#define CONFIG_GRAB 1" >> config.h
132   echo "CONFIG_GRAB=yes" >> config.mak
133 fi
134
135 if [ "$win32" = "yes" ] ; then
136   echo "#define CONFIG_WIN32 1" >> config.h
137   echo "CONFIG_WIN32=yes" >> config.mak
138 fi