initial commit
[goodguy/history.git] / cinelerra-5.0 / configure
1 #!/bin/sh
2
3 if [ $# -gt 0 ]; then
4   if [ "$1" = "static" ]; then
5     STATIC_LIBRARIES=1
6   elif [ "$1" = "shared" ]; then
7     STATIC_LIBRARIES=0
8   else
9     echo usage: "./configure <shared | static>"
10     exit 1
11   fi
12 fi
13
14 ERROR=0
15 if [ -z "$STATIC_LIBRARIES" ]; then
16 STATIC_LIBRARIES=0
17 fi
18
19 # test for nasm
20 OBJDIR=`uname -m`
21 TOPDIR=`pwd`
22
23 if [ $OBJDIR = i686 ]; then
24   if [ ! -x /usr/bin/nasm -a ! -x /usr/local/bin/nasm ]; then
25     echo " *** Nasm is required."; 
26     exit 1
27   fi
28
29 fi
30
31 if [ ! -x /usr/bin/yasm -a ! -x /usr/local/bin/yasm ]; then
32   echo " *** Yasm is required."; 
33   exit 1
34 fi
35
36
37 # test for videodev2.h
38
39 rm -f a.out
40 cat > conftest.c << EOF
41 #include <asm/types.h>
42 #include <sys/time.h>
43 #include <linux/videodev2.h>
44 int main()
45 {
46   return 0;
47 }
48 EOF
49
50 gcc conftest.c > /dev/null 2>&1
51
52 if [ -x a.out ]; then HAVE_VIDEO4LINUX2=y; else HAVE_VIDEO4LINUX2=n; fi
53
54
55 # test for dvb
56
57 rm -f a.out
58 cat > conftest.c << EOF
59 #include <time.h>
60 #include <linux/dvb/dmx.h>
61 #include <linux/dvb/frontend.h>
62 int main()
63 {
64   return 0;
65 }
66 EOF
67
68 gcc conftest.c > /dev/null 2>&1
69
70 if [ -x a.out ]; then HAVE_DVB=y; else HAVE_DVB=n; fi
71
72 rm -f a.out conftest.c
73
74
75 # test for -msse support
76
77 rm -f a.out
78 cat > conftest.c << EOF
79 int main()
80 {
81   return 0;
82 }
83 EOF
84
85 gcc -msse conftest.c > /dev/null 2>&1
86
87 if [ -x a.out ]; then HAVE_GCC=y; else HAVE_GCC=n; fi
88
89 rm -f a.out conftest.c
90
91 if [ $HAVE_GCC = n ]; then
92   echo " *** GCC 3.2.2 or greater is required.  Download it from gcc.gnu.org"; 
93   exit 1
94 fi
95
96
97 # test for OpenGL 2.0
98
99 rm -f a.out
100 cat > conftest.c << EOF
101 #include <GL/gl.h>
102 #include <GL/glext.h>
103 #include <GL/glu.h>
104 int main()
105 {
106   glUseProgram(0);
107   return 0;
108 }
109 EOF
110
111 gcc conftest.c -lGL -lGLU > /dev/null 2>&1
112
113 if [ -x a.out ]; then HAVE_GL=y; else HAVE_GL=n; fi
114
115 rm -f a.out conftest.c
116
117
118 # write configuration header
119 echo "Writing hvirtual_config.h"
120 cat > hvirtual_config.h << EOF
121 // Configuration file made by configure.  Don't edit.
122 EOF
123
124 if [ "$HAVE_VIDEO4LINUX2" = "y" ]; then 
125   echo "#define HAVE_VIDEO4LINUX2" >> hvirtual_config.h
126   echo "Have Video4Linux 2"
127 else
128   echo "Don't have Video4Linux 2"
129 fi
130
131 if [ "$HAVE_DVB" = "y" ]; then 
132   echo "#define HAVE_DVB" >> hvirtual_config.h
133   echo "Have DVB"
134 else
135   echo "Don't have DVB"
136 fi
137
138
139 if [ "$HAVE_GL" = "y" ]; then 
140 cat >> hvirtual_config.h << EOF 
141 #ifndef HAVE_GL
142 #define HAVE_GL
143 #endif
144 EOF
145   echo "Have OpenGL 2.0"
146 else
147   echo "Don't have OpenGL 2.0"
148 fi
149
150 # probe for libraries
151 if [ $STATIC_LIBRARIES = 0 ]; then
152   sed -e "s/^STATIC_LIBRARIES := .*/STATIC_LIBRARIES := n/" -i global_config
153   cd thirdparty && ./configure shared && cd ..
154 else
155   sed -e "s/^STATIC_LIBRARIES := .*/STATIC_LIBRARIES := y/" -i global_config
156   cd thirdparty && ./configure static && cd ..
157 fi
158 if [ $? -ne 0 ]; then
159   echo "Error in thirdparty configuration."
160   exit 1
161 fi
162
163 # fix libraries
164 echo CONFIGURING QUICKTIME
165 cd quicktime* && ./configure && cd ..
166 if [ $? -ne 0 ]; then
167   echo "Error in quicktime configuration."
168   exit 1
169 fi
170
171 echo CONFIGURING LIBZMPEG3
172 cd libzmpeg3* && ./configure && cd ..
173 if [ $? -ne 0 ]; then
174   echo "Error in libzmpeg3 configuration."
175   exit 1
176 fi
177
178
179 # success
180 echo "Configured successfully."
181 echo "Type 'make' to build me."
182 echo "If all ok, 'make install'";
183