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