]> git.sesse.net Git - mlt/blob - configure
- configure: bump version
[mlt] / configure
1 #!/bin/bash
2
3 show_help()
4 {
5         cat << EOF
6 Non-autotool config script for MLT.
7
8 Help options:
9
10   --help                  - this information
11
12 General build options:
13
14   --prefix=directory      - install prefix for path (default: $prefix)
15   --libdir=directory      - lib directory (default: $prefix/lib)
16   --enable-gpl            - Enable GPL components
17   --enable-motion-est     - Enable motion estimation components
18   --disable-debug         - Compile without debug support (default: on)
19   --disable-mmx           - Compile without MMX support (default: on)
20   --cpu='cpu'             - Compile for a specific CPU/architectre (default: none)
21
22 Module disables options:
23
24 EOF
25
26         for i in src/modules/*
27         do
28                 [ -d $i ] && [ "`basename $i`" != "CVS" ] && echo `basename $i` `[ -f $i/gpl ] && echo [GPL]`
29         done |
30         awk '{ printf( "  --disable-%-14.14s- Disable the %s module %s\n", $1, $1, $2 ); }'
31
32         echo
33         echo "  NOTE: libraries marked [GPL] will not be built unless --enable-gpl is stipulated."
34         echo
35 }
36
37 build_config()
38 {
39         (
40                 echo "version=$version"
41                 echo "prefix=$prefix"
42                 echo "libdir=$libdir"
43                 echo "bindir=$prefix/bin"
44                 echo "targetos=$targetos"
45
46                 [ "$mmx" = "true" ] && 
47                 echo "MMX_FLAGS=-DUSE_MMX"
48
49                 [ "$debug" = "true" ] && 
50                 echo "DEBUG_FLAGS=-g"
51
52                 echo "LARGE_FILE=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
53
54                 [ "$cpu" != "" ] &&
55                 echo "TARGETARCH=-march=$cpu" &&
56                 echo "TARGETCPU=-mcpu=$cpu"
57                 echo "OPTIMISATIONS=-O4 -pipe -fomit-frame-pointer"
58
59                 echo "CFLAGS+=-Wall -fPIC -DPIC \$(TARGETARCH) \$(TARGETCPU) \$(OPTIMISATIONS) \$(MMX_FLAGS) \$(DEBUG_FLAGS) \$(LARGE_FILE)"
60
61                 case $targetos in
62                 Darwin)
63                 echo "CFLAGS+=-D__DARWIN__ `sdl-config --cflags`"
64                 echo "SHFLAGS=-dynamiclib"
65                 echo "LDFLAGS+=`sdl-config --libs`"
66                 ;;
67                 Linux)
68                 echo "OPTIMISATIONS+=-ffast-math"
69                 echo "CFLAGS+=-pthread"
70                 echo "SHFLAGS=-shared"
71                 echo "LIBDL=-ldl"
72                 echo "RDYNAMIC=-rdynamic"
73                 ;;
74                 *)
75                 ;;
76                 esac
77                 echo "LIBSUF=$LIBSUF"
78         ) > config.mak
79
80         echo "#!/bin/sh" > mlt-config
81         (
82                 echo export version=$version
83                 echo export prefix=$prefix
84                 echo export libdir=$libdir
85                 echo export bindir=$prefix/bin
86         ) >> mlt-config
87
88         cat < mlt-config-template >> mlt-config
89
90         echo -n > packages.dat
91 }
92
93 build_pkgconfig()
94 {
95         for i in framework valerie miracle
96         do
97                 echo prefix="$prefix" > mlt-$i.pc
98                 (
99                         echo exec_prefix=$prefix
100                         echo libdir=$libdir
101                         echo includedir=$prefix/include
102                         echo version=$version
103                         echo cflags=`grep ^$i packages.dat | cut -f 2`
104                         echo libs=`grep ^$i packages.dat | cut -f 3`
105                 ) >> mlt-$i.pc
106                 cat mlt-$i.pc.in >>mlt-$i.pc
107         done
108 }
109
110 # Debug mode
111 set +x
112
113 # Define build directory for scripts called
114 export build_dir=`dirname $0`
115 export prefix=/usr/local
116 export libdir=""
117 export help=0
118 export version=0.2.5
119 export debug=true
120 export mmx=true
121 export gpl=false
122 export cpu=
123 export motionest=false
124
125 # Determine OS
126 targetos=$(uname -s)
127 # Chose appropriate suffix for libraries
128 case $targetos in
129         Darwin)
130         LIBSUF=".dylib"
131         mmx=false
132         ;;
133         Linux)
134         LIBSUF=".so"
135         ;;
136         *)
137         LIBSUF=".so"
138         ;;
139 esac
140 export LIBSUF
141
142 # Iterate through arguments
143 for i in "$@"
144 do
145         case $i in
146                 --help )                        help=1 ;;
147                 --prefix=* )            prefix="${i#--prefix=}" ;;
148                 --libdir=* )            libdir="${i#--libdir=}" ;;
149                 --disable-debug )       debug=false ;;
150                 --disable-mmx )         mmx=false ;;
151                 --enable-gpl )          gpl=true ;;
152                 --enable-motion-est )   motionest=true ;;
153                 --cpu=* )                       cpu="${i#--cpu=}" ;;
154         esac
155 done
156
157 # Determine the libdir if it's not specified in the args
158 [ "$libdir" = "" ] && libdir=$prefix/lib
159
160 # Double check mmx (may end up disabling mmx on non-linux platforms incorrectly)
161 if [ "$mmx" = "true" ]
162 then
163         grep mmx /proc/cpuinfo > /dev/null 2>&1 || mmx=false
164 fi
165
166 # Show help if requested
167 if [ $help = 1 ]
168 then
169         show_help
170 else
171         # Log the configuration history
172         date >> config.log
173         echo "$0 $@" >> config.log
174
175         build_config
176 fi
177
178 # Iterate through each of the components
179 for i in framework modules inigo valerie miracle humperdink
180 do
181         if [ -x src/$i/configure ]
182         then
183                 [ $help = 0 ] && echo "Configuring `basename $i`:"
184                 olddir=`pwd`
185                 cd src/$i
186                 ./configure "$@"
187                 [ $? != 0 ] && exit 1
188                 cd $olddir
189         fi
190 done
191
192 # Build the pkg-config files
193 build_pkgconfig
194
195 # Report GPL Usage
196 [ $help != 1 ] && 
197 ( [ "$gpl" = "false" ] && 
198 echo "GPL Components are disabled" || 
199 echo "GPL License Used" )
200
201 if [ "$motionest" = "true" -a "$gpl" = "false" ]
202 then
203         echo "Add the --enable-gpl flag to build the motion estimation components."
204 fi