Parent Directory | Revision Log
Revision 824 - (view) (download)
1 : | edgomez | 824 | dnl ========================================================================== |
2 : | dnl | ||
3 : | dnl Autoconf script for XviD | ||
4 : | dnl | ||
5 : | dnl Copyright(C) 2003 Edouard Gomez <ed.gomez@free.fr> | ||
6 : | dnl | ||
7 : | dnl ========================================================================== | ||
8 : | |||
9 : | AC_INIT([XviD], [0.9.1 (wip)], [xvid-devel@xvid.org]) | ||
10 : | AC_CONFIG_SRCDIR(configure.in) | ||
11 : | |||
12 : | dnl NASM version requirement | ||
13 : | minimum_nasm_patch_version=34 | ||
14 : | nasm_prog="nasm" | ||
15 : | |||
16 : | dnl Default CFLAGS -- Big impact on overall speed | ||
17 : | our_cflags_defaults="-Wall" | ||
18 : | our_cflags_defaults="$our_cflags_defaults -O2" | ||
19 : | our_cflags_defaults="$our_cflags_defaults -fPIC" | ||
20 : | our_cflags_defaults="$our_cflags_defaults -fomit-frame-pointer" | ||
21 : | our_cflags_defaults="$our_cflags_defaults -ffast-math" | ||
22 : | our_cflags_defaults="$our_cflags_defaults -funroll-loops" | ||
23 : | our_cflags_defaults="$our_cflags_defaults -fschedule-insns" | ||
24 : | our_cflags_defaults="$our_cflags_defaults -fschedule-insns2" | ||
25 : | |||
26 : | dnl ========================================================================== | ||
27 : | dnl Features - configure options | ||
28 : | dnl ========================================================================== | ||
29 : | |||
30 : | FEATURES="" | ||
31 : | DIVX4COMPAT_SOURCES="" | ||
32 : | |||
33 : | dnl BIGLUT aka old VLC code | ||
34 : | AC_ARG_ENABLE(oldvlc, | ||
35 : | AC_HELP_STRING([--enable-oldvlc], | ||
36 : | [Enable old VLC code (Needs much more memory ~10MB)]), | ||
37 : | [if test "$enable_oldvlc" = "yes" ; then | ||
38 : | FEATURES="$FEATURES -DBIGLUT" | ||
39 : | fi]) | ||
40 : | |||
41 : | dnl Internal Debug | ||
42 : | AC_ARG_ENABLE(idebug, | ||
43 : | AC_HELP_STRING([--enable-idebug], | ||
44 : | [Enable internal debug function]), | ||
45 : | [if test "$enable_idebug" = "yes" ; then | ||
46 : | FEATURES="$FEATURES -D_DEBUG" | ||
47 : | fi]) | ||
48 : | |||
49 : | dnl Internal Profile | ||
50 : | AC_ARG_ENABLE(iprofile, | ||
51 : | AC_HELP_STRING([--enable-iprofile], | ||
52 : | [Enable internal profiling]), | ||
53 : | [if test "$enable_iprofile" = "yes" ; then | ||
54 : | FEATURES="$FEATURES -D_PROFILING_" | ||
55 : | fi]) | ||
56 : | |||
57 : | dnl Assembly code | ||
58 : | AC_ARG_ENABLE(assembly, | ||
59 : | AC_HELP_STRING([--disable-assembly], | ||
60 : | [Disable assembly code]), | ||
61 : | [if test "$enable_assembly" = "no" ; then | ||
62 : | assembly="no" | ||
63 : | else | ||
64 : | if test "$enable_assembly" = "yes" ; then | ||
65 : | assembly="yes" | ||
66 : | fi | ||
67 : | fi], | ||
68 : | [assembly="yes"]) | ||
69 : | |||
70 : | dnl Internal Debug | ||
71 : | AC_ARG_ENABLE(divx4compat, | ||
72 : | AC_HELP_STRING([--enable-divx4compat], | ||
73 : | [Enable DivX4 compatibility API]), | ||
74 : | [if test "$enable_divx4compat" = "yes" ; then | ||
75 : | DIVX4COMPAT_SOURCES="SRC_DIVX4COMPAT" | ||
76 : | fi]) | ||
77 : | |||
78 : | |||
79 : | dnl ========================================================================== | ||
80 : | dnl Default install prefix and checks build type | ||
81 : | dnl ========================================================================== | ||
82 : | |||
83 : | AC_PREFIX_DEFAULT("/usr/local") | ||
84 : | AC_CANONICAL_BUILD | ||
85 : | AC_CANONICAL_HOST | ||
86 : | AC_CANONICAL_TARGET | ||
87 : | |||
88 : | dnl ========================================================================== | ||
89 : | dnl Check for the C compiler (could be passed on command line) | ||
90 : | dnl ========================================================================== | ||
91 : | |||
92 : | dnl | ||
93 : | dnl First we test if CFLAGS have been passed on command line | ||
94 : | dnl I do that because autoconf defaults (-g -O2) suck and they would kill | ||
95 : | dnl performance. To prevent that we define a good defult CFLAGS at the end | ||
96 : | dnl of the script if and only if CFLAGS has not been passed on the command | ||
97 : | dnl line | ||
98 : | dnl | ||
99 : | AC_MSG_CHECKING(whether to use default CFLAGS) | ||
100 : | if test x"$CFLAGS" = x"" ; then | ||
101 : | force_default_cc_options="yes" | ||
102 : | CFLAGS="$our_cflags_defaults" | ||
103 : | AC_MSG_RESULT([yes]) | ||
104 : | else | ||
105 : | force_default_cc_options="no" | ||
106 : | AC_MSG_RESULT([no]) | ||
107 : | fi | ||
108 : | |||
109 : | dnl Now we can safely check for the C compiler | ||
110 : | AC_PROG_CC | ||
111 : | |||
112 : | dnl ========================================================================== | ||
113 : | dnl Check for the install program | ||
114 : | dnl ========================================================================== | ||
115 : | |||
116 : | AC_PROG_INSTALL | ||
117 : | |||
118 : | dnl ========================================================================== | ||
119 : | dnl | ||
120 : | dnl This part looks for: | ||
121 : | dnl | ||
122 : | dnl ARCHITECTURE : The platform architecture | ||
123 : | dnl - IA32 for mmx, mmx-ext, mmx2, sse assembly | ||
124 : | dnl - IA64 | ||
125 : | dnl - PPC for PowerPC assembly routines | ||
126 : | dnl - GENERIC for plain C sources only | ||
127 : | dnl | ||
128 : | dnl BUS: Address bus size (in bits) | ||
129 : | dnl - 32 | ||
130 : | dnl - 64 | ||
131 : | dnl | ||
132 : | dnl ENDIANNESS: I think you can guess what this thing means :-) | ||
133 : | dnl - LITTLE_ENDIAN | ||
134 : | dnl - BIG_ENDIAN | ||
135 : | dnl | ||
136 : | dnl ========================================================================== | ||
137 : | |||
138 : | dnl | ||
139 : | dnl Looking what sources have to be compiled according to the CPU type | ||
140 : | dnl | ||
141 : | |||
142 : | ARCHITECTURE="" | ||
143 : | |||
144 : | AC_MSG_CHECKING([for whether to use assembly code]) | ||
145 : | if test x"$assembly" = x"yes" ; then | ||
146 : | AC_MSG_RESULT([yes]) | ||
147 : | AC_MSG_CHECKING([for architecture type]) | ||
148 : | case "$target_cpu" in | ||
149 : | i[[3456]]86) | ||
150 : | AC_MSG_RESULT(ia32) | ||
151 : | ARCHITECTURE="IA32" | ||
152 : | ;; | ||
153 : | powerpc) | ||
154 : | AC_MSG_RESULT(PowerPC) | ||
155 : | ARCHITECTURE="PPC" | ||
156 : | ;; | ||
157 : | ia64) | ||
158 : | AC_MSG_RESULT(ia64) | ||
159 : | ARCHITECTURE="IA64" | ||
160 : | ;; | ||
161 : | *) | ||
162 : | AC_MSG_RESULT($target_cpu) | ||
163 : | ARCHITECTURE="GENERIC" | ||
164 : | ;; | ||
165 : | esac | ||
166 : | else | ||
167 : | AC_MSG_RESULT([no]) | ||
168 : | ARCHITECTURE="GENERIC" | ||
169 : | fi | ||
170 : | |||
171 : | dnl | ||
172 : | dnl Testing address bus length | ||
173 : | dnl | ||
174 : | BUS="" | ||
175 : | |||
176 : | AC_CHECK_SIZEOF([int *]) | ||
177 : | case "$ac_cv_sizeof_int_p" in | ||
178 : | 4) | ||
179 : | BUS="32BIT" | ||
180 : | ;; | ||
181 : | 8) | ||
182 : | BUS="64BIT" | ||
183 : | ;; | ||
184 : | *) | ||
185 : | AC_MSG_ERROR([XviD supports only 32/64 bit architectures]) | ||
186 : | ;; | ||
187 : | esac | ||
188 : | |||
189 : | dnl | ||
190 : | dnl Testing endianness | ||
191 : | dnl | ||
192 : | ENDIANNESS="" | ||
193 : | |||
194 : | AC_C_BIGENDIAN(ENDIANNESS="BIG_ENDIAN", ENDIANNESS="LITTLE_ENDIAN") | ||
195 : | |||
196 : | dnl ========================================================================== | ||
197 : | dnl | ||
198 : | dnl Check for OS specific variables | ||
199 : | dnl - SHARED_EXTENSION, STATIC_EXTENSION, OBJECT_EXTENSION | ||
200 : | dnl | ||
201 : | dnl ========================================================================== | ||
202 : | |||
203 : | AC_MSG_CHECKING(for build extensions) | ||
204 : | SHARED_EXTENSION="" | ||
205 : | STATIC_EXTENSION="" | ||
206 : | OBJECT_EXTENSION="" | ||
207 : | case "$target_os" in | ||
208 : | *bsd*|linux*|beos|irix*|solaris*) | ||
209 : | AC_MSG_RESULT([.so .a .o]) | ||
210 : | STATIC_EXTENSION="a" | ||
211 : | SHARED_EXTENSION="so" | ||
212 : | OBJECT_EXTENSION="o" | ||
213 : | ;; | ||
214 : | [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) | ||
215 : | AC_MSG_RESULT([.dll .lib .obj]) | ||
216 : | STATIC_EXTENSION="lib" | ||
217 : | SHARED_EXTENSION="dll" | ||
218 : | OBJECT_EXTENSION="obj" | ||
219 : | ;; | ||
220 : | darwin*|raphsody*) | ||
221 : | AC_MSG_RESULT([.dynlib .a .o]) | ||
222 : | STATIC_EXTENSION="a" | ||
223 : | SHARED_EXTENSION="dylib" | ||
224 : | OBJECT_EXTENSION="o" | ||
225 : | ;; | ||
226 : | *) | ||
227 : | AC_MSG_RESULT([Unknown OS - Using .so .a .o]) | ||
228 : | STATIC_EXTENSION="a" | ||
229 : | SHARED_EXTENSION="so" | ||
230 : | OBJECT_EXTENSION="o" | ||
231 : | ;; | ||
232 : | esac | ||
233 : | |||
234 : | AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS) | ||
235 : | OS_LDFLAGS="" | ||
236 : | case "$target_os" in | ||
237 : | *bsd*|linux*|irix*|solaris*) | ||
238 : | AC_MSG_RESULT([-shared -lc -lm]) | ||
239 : | OS_LDFLAGS="-shared -lc -lm" | ||
240 : | ;; | ||
241 : | [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) | ||
242 : | AC_MSG_RESULT([-shared -Wl,--dll,--out-implib,\$@.a]) | ||
243 : | OS_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" | ||
244 : | CFLAGS="$CFLAGS -mno-cygwin" | ||
245 : | ;; | ||
246 : | darwin*|raphsody*) | ||
247 : | AC_MSG_RESULT([-dynamiclib]) | ||
248 : | OS_LDFLAGS="-dynamiclib" | ||
249 : | CFLAGS="$CFLAGS -fno-common" | ||
250 : | ;; | ||
251 : | beos) | ||
252 : | AC_MSG_RESULT([-nostart]) | ||
253 : | OS_LDFLAGS="-nostart" | ||
254 : | ;; | ||
255 : | *) | ||
256 : | AC_MSG_RESULT([Unknown OS - -shared -lc -lm]) | ||
257 : | OS_LDFLAGS="" | ||
258 : | ;; | ||
259 : | esac | ||
260 : | |||
261 : | dnl ========================================================================== | ||
262 : | dnl | ||
263 : | dnl Assembler stuff - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES | ||
264 : | dnl | ||
265 : | dnl ========================================================================== | ||
266 : | |||
267 : | AS="" | ||
268 : | AFLAGS="" | ||
269 : | ASSEMBLY_EXTENSION="" | ||
270 : | GENERIC_SOURCES="SRC_GENERIC" | ||
271 : | ASSEMBLY_SOURCES="" | ||
272 : | |||
273 : | dnl | ||
274 : | dnl IA32 | ||
275 : | dnl | ||
276 : | |||
277 : | if test "$ARCHITECTURE" = "IA32" ; then | ||
278 : | |||
279 : | dnl | ||
280 : | dnl Checking nasm existence | ||
281 : | dnl | ||
282 : | AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) | ||
283 : | if test "$ac_nasm" = "yes" ; then | ||
284 : | |||
285 : | dnl | ||
286 : | dnl Checking nasm patch version | ||
287 : | dnl | ||
288 : | AC_MSG_CHECKING([for nasm patch version]) | ||
289 : | nasm_patch=`nasm -r | cut -d '.' -f 3 | cut -d ' ' -f 1` | ||
290 : | AC_MSG_RESULT([$nasm_patch]) | ||
291 : | |||
292 : | if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then | ||
293 : | AC_MSG_WARN([nasm patch version too old - Compiling generic sources only]) | ||
294 : | ARCHITECTURE="GENERIC" | ||
295 : | else | ||
296 : | |||
297 : | dnl | ||
298 : | dnl Checking nasm format - win32 or elf | ||
299 : | dnl | ||
300 : | AC_MSG_CHECKING([for nasm object format]) | ||
301 : | case "$target_os" in | ||
302 : | *bsd*|linux*|beos|irix*|solaris*) | ||
303 : | AC_MSG_RESULT([elf]) | ||
304 : | NASM_FORMAT="elf" | ||
305 : | PREFIX="" | ||
306 : | ;; | ||
307 : | [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) | ||
308 : | AC_MSG_RESULT([win32]) | ||
309 : | NASM_FORMAT="win32" | ||
310 : | PREFIX="-DPREFIX" | ||
311 : | ;; | ||
312 : | esac | ||
313 : | |||
314 : | AS=nasm | ||
315 : | AFLAGS="-I\$(<D) -f $NASM_FORMAT $PREFIX" | ||
316 : | ASSEMBLY_EXTENSION="asm" | ||
317 : | ASSEMBLY_SOURCES="SRC_IA32" | ||
318 : | fi | ||
319 : | |||
320 : | else | ||
321 : | AC_MSG_WARN([nasm not found - Compiling generic sources only]) | ||
322 : | ARCHITECTURE="GENERIC" | ||
323 : | fi | ||
324 : | |||
325 : | fi | ||
326 : | |||
327 : | dnl | ||
328 : | dnl PPC | ||
329 : | dnl | ||
330 : | |||
331 : | if test "$ARCHITECTURE" = "PPC" ; then | ||
332 : | AS="\$(CC)" | ||
333 : | AFLAGS="-c" | ||
334 : | ASSEMBLY_EXTENSION="s" | ||
335 : | ASSEMBLY_SOURCES="SRC_PPC" | ||
336 : | AC_MSG_CHECKING([for Altivec support]) | ||
337 : | cat > conftest.S << EOF | ||
338 : | .text | ||
339 : | vxor 0,0,0 | ||
340 : | EOF | ||
341 : | if $CC -c conftest.S 2>/dev/null 1>/dev/null ; then | ||
342 : | AC_MSG_RESULT(yes) | ||
343 : | CFLAGS="$CFLAGS -DARCH_IS_PPC_ALTIVEC" | ||
344 : | ASSEMBLY_SOURCES="SRC_ALTIVEC" | ||
345 : | else | ||
346 : | AC_MSG_RESULT(no) | ||
347 : | fi | ||
348 : | rm -f conftest.* | ||
349 : | fi | ||
350 : | |||
351 : | dnl | ||
352 : | dnl IA64 | ||
353 : | dnl | ||
354 : | |||
355 : | if test "$ARCHITECTURE" = "IA64" ; then | ||
356 : | AS="\$(CC)" | ||
357 : | AFLAGS="-c" | ||
358 : | ASSEMBLY_EXTENSION="s" | ||
359 : | ASSEMBLY_SOURCES="SRC_IA64" | ||
360 : | fi | ||
361 : | |||
362 : | dnl ========================================================================== | ||
363 : | dnl | ||
364 : | dnl Check for header files | ||
365 : | dnl | ||
366 : | dnl ========================================================================== | ||
367 : | |||
368 : | AC_CHECK_HEADERS( | ||
369 : | stdio.h \ | ||
370 : | signal.h \ | ||
371 : | , , AC_MSG_ERROR(Missing header file)) | ||
372 : | |||
373 : | dnl ========================================================================== | ||
374 : | dnl | ||
375 : | dnl Substitions | ||
376 : | dnl | ||
377 : | dnl ========================================================================== | ||
378 : | |||
379 : | AC_SUBST(FEATURES) | ||
380 : | AC_SUBST(ARCHITECTURE) | ||
381 : | AC_SUBST(BUS) | ||
382 : | AC_SUBST(ENDIANNESS) | ||
383 : | AC_SUBST(SHARED_EXTENSION) | ||
384 : | AC_SUBST(STATIC_EXTENSION) | ||
385 : | AC_SUBST(OBJECT_EXTENSION) | ||
386 : | AC_SUBST(NASM_FORMAT) | ||
387 : | AC_SUBST(AS) | ||
388 : | AC_SUBST(AFLAGS) | ||
389 : | AC_SUBST(ASSEMBLY_EXTENSION) | ||
390 : | AC_SUBST(GENERIC_SOURCES) | ||
391 : | AC_SUBST(ASSEMBLY_SOURCES) | ||
392 : | AC_SUBST(CC) | ||
393 : | AC_SUBST(CFLAGS) | ||
394 : | AC_SUBST(OS_LDFLAGS) | ||
395 : | AC_SUBST(DIVX4COMPAT_SOURCES) | ||
396 : | |||
397 : | dnl ========================================================================== | ||
398 : | dnl | ||
399 : | dnl Output files | ||
400 : | dnl | ||
401 : | dnl ========================================================================== | ||
402 : | |||
403 : | AC_CONFIG_FILES(platform.inc) | ||
404 : | |||
405 : | AC_OUTPUT |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |