fixup cut/paste bugs in de.po, fix segv in tz/ntsc lookup, add debian
[goodguy/history.git] / cinelerra-5.1 / configure
1 #!/bin/bash
2 # configure reset  - resets probed config
3 # configure static - build all builtin static libraries
4 # configure shared - build only static libraries needed
5
6 #edit global_config and set HAVE_var to override probe
7
8 PROBED="STATIC_LIBRARIES HAVE_VIDEO4LINUX2 HAVE_DVB HAVE_GL"
9 PROBED="$PROBED HAVE_DL HAVE_NUMA"
10
11 if [ $# -gt 0 ]; then
12   if [ "$1" = "reset" ]; then
13      for v in $PROBED; do
14        sed -e "s/^$v := .*/#$v := y/" -i global_config
15      done
16      echo "configuration reset"
17      exit 0;
18   fi
19   if [ "$1" = "static" ]; then
20     STATIC_LIBRARIES=y
21   elif [ "$1" = "shared" ]; then
22     STATIC_LIBRARIES=n
23   else
24     echo usage: "./configure <shared | static>"
25     exit 1
26   fi
27 fi
28
29 if [ -z "$STATIC_LIBRARIES" ]; then
30 STATIC_LIBRARIES=y
31 fi
32
33 for v in $PROBED; do
34   vv=`grep "^$v := .*"  global_config`
35   if [ $? = 0 ]; then
36     echo "config probe override: $vv"
37   fi
38 done
39
40 # test for nasm
41 OBJDIR=`uname -m`
42 TOPDIR=`pwd`
43
44 if [ $OBJDIR = i686 ]; then
45   if [ ! -x /usr/bin/nasm -a ! -x /usr/local/bin/nasm ]; then
46     echo " *** Nasm is required."; 
47     exit 1
48   fi
49
50 fi
51
52 if [ ! -x /usr/bin/yasm -a ! -x /usr/local/bin/yasm ]; then
53   echo " *** Yasm is required."; 
54   exit 1
55 fi
56
57
58 # test for videodev2.h
59
60 rm -f a.out
61 cat > conftest.c << EOF
62 #include <asm/types.h>
63 #include <sys/time.h>
64 #include <linux/videodev2.h>
65 int main()
66 {
67   return 0;
68 }
69 EOF
70
71 gcc conftest.c > /dev/null 2>&1
72
73 if [ -x a.out ]; then HAVE_VIDEO4LINUX2=y; else HAVE_VIDEO4LINUX2=n; fi
74
75
76 # test for dvb
77
78 rm -f a.out
79 cat > conftest.c << EOF
80 #include <time.h>
81 #include <linux/dvb/dmx.h>
82 #include <linux/dvb/frontend.h>
83 int main()
84 {
85   return 0;
86 }
87 EOF
88
89 gcc conftest.c > /dev/null 2>&1
90
91 if [ -x a.out ]; then HAVE_DVB=y; else HAVE_DVB=n; fi
92
93 rm -f a.out conftest.c
94
95
96 # test for -msse support
97
98 rm -f a.out
99 cat > conftest.c << EOF
100 int main()
101 {
102   return 0;
103 }
104 EOF
105
106 gcc -msse conftest.c > /dev/null 2>&1
107
108 if [ -x a.out ]; then HAVE_GCC=y; else HAVE_GCC=n; fi
109
110 rm -f a.out conftest.c
111
112 if [ $HAVE_GCC = n ]; then
113   echo " *** GCC 3.2.2 or greater is required.  Download it from gcc.gnu.org"; 
114   exit 1
115 fi
116
117
118 # test for OpenGL 2.0
119
120 rm -f a.out
121 cat > conftest.c << EOF
122 #include <GL/gl.h>
123 #include <GL/glext.h>
124 #include <GL/glu.h>
125 int main()
126 {
127   glUseProgram(0);
128   return 0;
129 }
130 EOF
131
132 gcc conftest.c -lGL -lGLU > /dev/null 2>&1
133
134 if [ -x a.out ]; then HAVE_GL=y; else HAVE_GL=n; fi
135
136 rm -f a.out conftest.c
137
138
139 # test for libdl
140
141 rm -f a.out
142 cat > conftest.c << EOF
143 int main()
144 {
145   return 0;
146 }
147 EOF
148
149 gcc conftest.c -ldl > /dev/null 2>&1
150
151 if [ -x a.out ]; then HAVE_DL=y; else HAVE_DL=n; fi
152
153 rm -f a.out conftest.c
154
155
156 # test for libnuma
157
158 rm -f a.out
159 cat > conftest.c << EOF
160 int main()
161 {
162   return 0;
163 }
164 EOF
165
166 gcc conftest.c -lnuma > /dev/null 2>&1
167
168 if [ -x a.out ]; then HAVE_NUMA=y; else HAVE_NUMA=n; fi
169
170 rm -f a.out conftest.c
171
172
173 # update global_config with probe data
174
175 for v in $PROBED; do
176   sed -e "s/^#$v := .*/$v := ${!v}/" -i global_config
177 done
178
179 # configure thirdparty build
180
181 cd thirdparty
182 case "$STATIC_LIBRARIES" in
183  "y") ./configure static ;;
184  "n") ./configure shared ;;
185  *) echo "configuration failed"; exit 1;;
186 esac
187 if [ $? -ne 0 ]; then
188   echo "Error in thirdparty configuration."
189   exit 1
190 fi
191 cd ..
192
193 # configure libzmpeg3 build
194
195 echo CONFIGURING LIBZMPEG3
196 cd libzmpeg3* && ./configure && cd ..
197 if [ $? -ne 0 ]; then
198   echo "Error in libzmpeg3 configuration."
199   exit 1
200 fi
201
202 # success
203
204 echo "Configured successfully."
205 echo "Type 'make' to build me."
206 echo "If all ok, 'make install'";
207