1 |
dnl ========================================================================== |
dnl ========================================================================== |
2 |
dnl |
dnl |
3 |
dnl Autoconf script for XviD |
dnl Autoconf script for Xvid |
4 |
dnl |
dnl |
5 |
dnl Copyright(C) 2003 Edouard Gomez <ed.gomez@free.fr> |
dnl Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr> |
6 |
dnl |
dnl |
7 |
dnl ========================================================================== |
dnl ========================================================================== |
8 |
|
|
9 |
AC_INIT([XviD], [0.9.1 (wip)], [xvid-devel@xvid.org]) |
AC_PREREQ([2.50]) |
10 |
|
|
11 |
|
AC_INIT([Xvid], [1.3.2], [xvid-devel@xvid.org]) |
12 |
AC_CONFIG_SRCDIR(configure.in) |
AC_CONFIG_SRCDIR(configure.in) |
13 |
|
|
14 |
dnl NASM version requirement |
dnl Do not forget to increase that when needed. |
15 |
minimum_nasm_patch_version=34 |
API_MAJOR="4" |
16 |
|
API_MINOR="3" |
17 |
|
|
18 |
|
dnl NASM/YASM version requirement |
19 |
|
minimum_yasm_major_version=1 |
20 |
|
minimum_nasm_minor_version=0 |
21 |
|
minimum_nasm_major_version=2 |
22 |
nasm_prog="nasm" |
nasm_prog="nasm" |
23 |
|
yasm_prog="yasm" |
24 |
|
|
25 |
dnl Default CFLAGS -- Big impact on overall speed |
dnl Default CFLAGS -- Big impact on overall speed |
26 |
our_cflags_defaults="-Wall" |
our_cflags_defaults="-Wall" |
27 |
our_cflags_defaults="$our_cflags_defaults -O2" |
our_cflags_defaults="$our_cflags_defaults -O2" |
28 |
our_cflags_defaults="$our_cflags_defaults -fPIC" |
our_cflags_defaults="$our_cflags_defaults -fstrength-reduce" |
29 |
our_cflags_defaults="$our_cflags_defaults -fomit-frame-pointer" |
our_cflags_defaults="$our_cflags_defaults -finline-functions" |
30 |
our_cflags_defaults="$our_cflags_defaults -ffast-math" |
our_cflags_defaults="$our_cflags_defaults -ffast-math" |
31 |
our_cflags_defaults="$our_cflags_defaults -funroll-loops" |
our_cflags_defaults="$our_cflags_defaults -fomit-frame-pointer" |
|
our_cflags_defaults="$our_cflags_defaults -fschedule-insns" |
|
|
our_cflags_defaults="$our_cflags_defaults -fschedule-insns2" |
|
32 |
|
|
33 |
dnl ========================================================================== |
dnl ========================================================================== |
34 |
dnl Features - configure options |
dnl Features - configure options |
35 |
dnl ========================================================================== |
dnl ========================================================================== |
36 |
|
|
37 |
FEATURES="" |
FEATURES="" |
|
DIVX4COMPAT_SOURCES="" |
|
|
|
|
|
dnl BIGLUT aka old VLC code |
|
|
AC_ARG_ENABLE(oldvlc, |
|
|
AC_HELP_STRING([--enable-oldvlc], |
|
|
[Enable old VLC code (Needs much more memory ~10MB)]), |
|
|
[if test "$enable_oldvlc" = "yes" ; then |
|
|
FEATURES="$FEATURES -DBIGLUT" |
|
|
fi]) |
|
38 |
|
|
39 |
dnl Internal Debug |
dnl Internal Debug |
40 |
AC_ARG_ENABLE(idebug, |
AC_ARG_ENABLE(idebug, |
52 |
FEATURES="$FEATURES -D_PROFILING_" |
FEATURES="$FEATURES -D_PROFILING_" |
53 |
fi]) |
fi]) |
54 |
|
|
55 |
|
dnl GNU Profiling options |
56 |
|
AC_ARG_ENABLE(gnuprofile, |
57 |
|
AC_HELP_STRING([--enable-gnuprofile], |
58 |
|
[Enable profiling informations for gprof]), |
59 |
|
[if test "$enable_gnuprofile" = "yes" ; then |
60 |
|
GNU_PROF_CFLAGS="-pg -fprofile-arcs -ftest-coverage" |
61 |
|
GNU_PROF_LDFLAGS="-pg" |
62 |
|
fi]) |
63 |
|
|
64 |
dnl Assembly code |
dnl Assembly code |
65 |
AC_ARG_ENABLE(assembly, |
AC_ARG_ENABLE(assembly, |
66 |
AC_HELP_STRING([--disable-assembly], |
AC_HELP_STRING([--disable-assembly], |
74 |
fi], |
fi], |
75 |
[assembly="yes"]) |
[assembly="yes"]) |
76 |
|
|
77 |
dnl Internal Debug |
dnl pthread code |
78 |
AC_ARG_ENABLE(divx4compat, |
AC_ARG_ENABLE(pthread, |
79 |
AC_HELP_STRING([--enable-divx4compat], |
AC_HELP_STRING([--disable-pthread], |
80 |
[Enable DivX4 compatibility API]), |
[Disable pthread dependent code]), |
81 |
[if test "$enable_divx4compat" = "yes" ; then |
[if test "$enable_pthread" = "no" ; then |
82 |
DIVX4COMPAT_SOURCES="SRC_DIVX4COMPAT" |
pthread="no" |
83 |
fi]) |
else |
84 |
|
if test "$enable_pthread" = "yes" ; then |
85 |
|
pthread="yes" |
86 |
|
fi |
87 |
|
fi], |
88 |
|
[pthread="yes"]) |
89 |
|
|
90 |
|
dnl Build as a module not a shared lib on darwin |
91 |
|
AC_ARG_ENABLE(macosx_module, |
92 |
|
AC_HELP_STRING([--enable-macosx_module], |
93 |
|
[Build as a module on MacOS X]), |
94 |
|
[if test "$enable_macosx_module" = "yes" ; then |
95 |
|
macosx_module="yes" |
96 |
|
else |
97 |
|
macosx_module="no" |
98 |
|
fi], |
99 |
|
[macosx_module="no"]) |
100 |
|
|
101 |
dnl ========================================================================== |
dnl ========================================================================== |
102 |
dnl Default install prefix and checks build type |
dnl Default install prefix and checks build type |
121 |
AC_MSG_CHECKING(whether to use default CFLAGS) |
AC_MSG_CHECKING(whether to use default CFLAGS) |
122 |
if test x"$CFLAGS" = x"" ; then |
if test x"$CFLAGS" = x"" ; then |
123 |
force_default_cc_options="yes" |
force_default_cc_options="yes" |
|
CFLAGS="$our_cflags_defaults" |
|
124 |
AC_MSG_RESULT([yes]) |
AC_MSG_RESULT([yes]) |
125 |
else |
else |
126 |
force_default_cc_options="no" |
force_default_cc_options="no" |
137 |
AC_PROG_INSTALL |
AC_PROG_INSTALL |
138 |
|
|
139 |
dnl ========================================================================== |
dnl ========================================================================== |
140 |
|
dnl Check for the ranlib program to generate static library index |
141 |
|
dnl ========================================================================== |
142 |
|
|
143 |
|
AC_PROG_RANLIB |
144 |
|
AC_CHECK_TOOL([AR], [ar], [ar-not-found]) |
145 |
|
|
146 |
|
dnl ========================================================================== |
147 |
|
dnl Check for the egrep program |
148 |
|
dnl ========================================================================== |
149 |
|
|
150 |
|
AC_PROG_EGREP |
151 |
|
|
152 |
|
dnl ========================================================================== |
153 |
dnl |
dnl |
154 |
dnl This part looks for: |
dnl This part looks for: |
155 |
dnl |
dnl |
184 |
AC_MSG_RESULT(ia32) |
AC_MSG_RESULT(ia32) |
185 |
ARCHITECTURE="IA32" |
ARCHITECTURE="IA32" |
186 |
;; |
;; |
187 |
|
x86_64) |
188 |
|
AC_MSG_RESULT(x86_64) |
189 |
|
ARCHITECTURE="X86_64" |
190 |
|
;; |
191 |
powerpc) |
powerpc) |
192 |
AC_MSG_RESULT(PowerPC) |
AC_MSG_RESULT(PowerPC) |
193 |
ARCHITECTURE="PPC" |
ARCHITECTURE="PPC" |
220 |
BUS="64BIT" |
BUS="64BIT" |
221 |
;; |
;; |
222 |
*) |
*) |
223 |
AC_MSG_ERROR([XviD supports only 32/64 bit architectures]) |
AC_MSG_ERROR([Xvid supports only 32/64 bit architectures]) |
224 |
;; |
;; |
225 |
esac |
esac |
226 |
|
|
243 |
STATIC_EXTENSION="" |
STATIC_EXTENSION="" |
244 |
OBJECT_EXTENSION="" |
OBJECT_EXTENSION="" |
245 |
case "$target_os" in |
case "$target_os" in |
246 |
*bsd*|linux*|beos|irix*|solaris*) |
*bsd*|linux*|beos|irix*|solaris*|gnu*) |
247 |
AC_MSG_RESULT([.so .a .o]) |
AC_MSG_RESULT([.so .a .o]) |
248 |
STATIC_EXTENSION="a" |
STATIC_EXTENSION="a" |
249 |
SHARED_EXTENSION="so" |
SHARED_EXTENSION="so" |
250 |
OBJECT_EXTENSION="o" |
OBJECT_EXTENSION="o" |
251 |
;; |
;; |
252 |
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) |
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) |
253 |
AC_MSG_RESULT([.dll .lib .obj]) |
AC_MSG_RESULT([.dll .a .obj]) |
254 |
STATIC_EXTENSION="lib" |
STATIC_EXTENSION="a" |
255 |
SHARED_EXTENSION="dll" |
SHARED_EXTENSION="dll" |
256 |
OBJECT_EXTENSION="obj" |
OBJECT_EXTENSION="obj" |
257 |
;; |
;; |
258 |
darwin*|raphsody*) |
darwin*) |
259 |
|
if test x"$macosx_module" = x"yes"; then |
260 |
|
AC_MSG_RESULT([.so .a .o]) |
261 |
|
SHARED_EXTENSION="so" |
262 |
|
else |
263 |
AC_MSG_RESULT([.dynlib .a .o]) |
AC_MSG_RESULT([.dynlib .a .o]) |
|
STATIC_EXTENSION="a" |
|
264 |
SHARED_EXTENSION="dylib" |
SHARED_EXTENSION="dylib" |
265 |
|
fi |
266 |
|
STATIC_EXTENSION="a" |
267 |
OBJECT_EXTENSION="o" |
OBJECT_EXTENSION="o" |
268 |
;; |
;; |
269 |
*) |
*) |
274 |
;; |
;; |
275 |
esac |
esac |
276 |
|
|
277 |
|
dnl ========================================================================== |
278 |
|
dnl |
279 |
|
dnl Determines best options for CC and LD |
280 |
|
dnl - STATIC_LIB, SHARED_LIB, SPECIFIC_CFLAGS, SPECIFIC_LDLAGS |
281 |
|
dnl |
282 |
|
dnl ========================================================================== |
283 |
|
|
284 |
AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS) |
AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS) |
285 |
OS_LDFLAGS="" |
SPECIFIC_LDFLAGS="" |
286 |
|
SPECIFIC_CFLAGS="" |
287 |
|
ALTIVEC_CFLAGS="" |
288 |
|
PRE_SHARED_LIB="" |
289 |
case "$target_os" in |
case "$target_os" in |
290 |
*bsd*|linux*|irix*|solaris*) |
linux*|solaris*|gnu*) |
291 |
AC_MSG_RESULT([-shared -lc -lm]) |
AC_MSG_RESULT([ok]) |
292 |
OS_LDFLAGS="-shared -lc -lm" |
STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" |
293 |
;; |
SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" |
294 |
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) |
SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm" |
295 |
AC_MSG_RESULT([-shared -Wl,--dll,--out-implib,\$@.a]) |
SPECIFIC_CFLAGS="-fPIC" |
296 |
OS_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" |
;; |
297 |
CFLAGS="$CFLAGS -mno-cygwin" |
*bsd*|irix*) |
298 |
;; |
AC_MSG_RESULT([ok]) |
299 |
darwin*|raphsody*) |
STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" |
300 |
AC_MSG_RESULT([-dynamiclib]) |
SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" |
301 |
OS_LDFLAGS="-dynamiclib" |
SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm" |
302 |
CFLAGS="$CFLAGS -fno-common" |
SPECIFIC_CFLAGS="-fPIC" |
303 |
|
;; |
304 |
|
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) |
305 |
|
AC_MSG_RESULT([ok]) |
306 |
|
STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)" |
307 |
|
SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)" |
308 |
|
SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" |
309 |
|
SPECIFIC_CFLAGS="" |
310 |
|
;; |
311 |
|
darwin*) |
312 |
|
STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" |
313 |
|
SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp" |
314 |
|
if test x"$macosx_module" = x"no"; then |
315 |
|
AC_MSG_RESULT([dylib options]) |
316 |
|
SHARED_LIB="libxvidcore.\$(API_MAJOR).\$(SHARED_EXTENSION)" |
317 |
|
SPECIFIC_LDFLAGS="-Wl,-read_only_relocs,suppress -dynamiclib -flat_namespace -compatibility_version \$(API_MAJOR) -current_version \$(API_MAJOR).\$(API_MINOR) -install_name \$(libdir)/\$(SHARED_LIB)" |
318 |
|
else |
319 |
|
AC_MSG_RESULT([module options]) |
320 |
|
PRE_SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)-temp.o" |
321 |
|
SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)" |
322 |
|
SPECIFIC_LDFLAGS="-r -keep_private_externs -nostdlib && \$(CC) \$(LDFLAGS) \$(PRE_SHARED_LIB) -o libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -bundle -flat_namespace -undefined suppress" |
323 |
|
fi |
324 |
;; |
;; |
325 |
beos) |
beos) |
326 |
AC_MSG_RESULT([-nostart]) |
AC_MSG_RESULT([ok]) |
327 |
OS_LDFLAGS="-nostart" |
STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" |
328 |
|
SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)" |
329 |
|
SPECIFIC_LDFLAGS="-nostart" |
330 |
|
SPECIFIC_CFLAGS="-fPIC" |
331 |
;; |
;; |
332 |
*) |
*) |
333 |
AC_MSG_RESULT([Unknown OS - -shared -lc -lm]) |
AC_MSG_RESULT([Unknown Platform (Using default -shared -lc -lm)]) |
334 |
OS_LDFLAGS="" |
STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" |
335 |
|
SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)" |
336 |
|
SPECIFIC_LDFLAGS="" |
337 |
|
SPECIFIC_CFLAGS="" |
338 |
;; |
;; |
339 |
esac |
esac |
340 |
|
|
341 |
|
if test x"$PRE_SHARED_LIB" = x; then |
342 |
|
PRE_SHARED_LIB=$SHARED_LIB |
343 |
|
fi |
344 |
|
|
345 |
dnl ========================================================================== |
dnl ========================================================================== |
346 |
dnl |
dnl |
347 |
dnl Assembler stuff - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES |
dnl Assembler stuff |
348 |
|
dnl - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES |
349 |
dnl |
dnl |
350 |
dnl ========================================================================== |
dnl ========================================================================== |
351 |
|
|
359 |
dnl IA32 |
dnl IA32 |
360 |
dnl |
dnl |
361 |
|
|
362 |
if test "$ARCHITECTURE" = "IA32" ; then |
if test "$ARCHITECTURE" = "IA32" -o "$ARCHITECTURE" = "X86_64" ; then |
363 |
|
|
364 |
dnl |
dnl |
365 |
dnl Checking nasm existence |
dnl Checking for nasm compatible programs |
366 |
dnl |
dnl |
367 |
|
|
368 |
|
found_nasm_comp_prog="no" |
369 |
|
chosen_asm_prog="" |
370 |
|
|
371 |
|
dnl Check for yasm first |
372 |
|
AC_CHECK_PROG([ac_yasm], [$yasm_prog], [yes], [no], , [yes]) |
373 |
|
if test "$ac_yasm" = "yes" ; then |
374 |
|
dnl |
375 |
|
dnl Checking yasm version |
376 |
|
dnl |
377 |
|
AC_MSG_CHECKING([for yasm version]) |
378 |
|
yasm_major=`$yasm_prog --version | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 2` |
379 |
|
if test -z $yasm_major ; then |
380 |
|
yasm_major=-1 |
381 |
|
fi |
382 |
|
AC_MSG_RESULT([$yasm_major]) |
383 |
|
|
384 |
|
dnl Actually, yasm >= 0.7.99.2161 should be ok |
385 |
|
dnl But I'm too lazy to check also the patch version... |
386 |
|
if test "$yasm_major" -lt "$minimum_yasm_major_version" ; then |
387 |
|
AC_MSG_WARN([yasm version is too old]) |
388 |
|
else |
389 |
|
found_nasm_comp_prog="yes" |
390 |
|
chosen_asm_prog="$yasm_prog" |
391 |
|
fi |
392 |
|
fi |
393 |
|
|
394 |
|
dnl Check for nasm (not buggy version) |
395 |
|
if test "$found_nasm_comp_prog" = "no" ; then |
396 |
AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) |
AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) |
397 |
if test "$ac_nasm" = "yes" ; then |
if test "$ac_nasm" = "yes" ; then |
|
|
|
398 |
dnl |
dnl |
399 |
dnl Checking nasm patch version |
dnl Checking nasm version |
400 |
dnl |
dnl |
401 |
AC_MSG_CHECKING([for nasm patch version]) |
AC_MSG_CHECKING([for nasm version]) |
402 |
nasm_patch=`nasm -r | cut -d '.' -f 3 | cut -d ' ' -f 1` |
nasm_minor=`$nasm_prog -v | cut -d '.' -f 2 | cut -d ' ' -f 1` |
403 |
AC_MSG_RESULT([$nasm_patch]) |
nasm_major=`$nasm_prog -v | cut -d '.' -f 1 | cut -d ' ' -f 3` |
404 |
|
if test -z $nasm_minor ; then |
405 |
|
nasm_minor=-1 |
406 |
|
fi |
407 |
|
if test -z $nasm_major ; then |
408 |
|
nasm_major=-1 |
409 |
|
fi |
410 |
|
AC_MSG_RESULT([$nasm_major]) |
411 |
|
|
412 |
if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then |
dnl need nasm 2.x for SSE3/4 and X86_64 |
413 |
AC_MSG_WARN([nasm patch version too old - Compiling generic sources only]) |
if test "$nasm_major" -lt "$minimum_nasm_major_version" ; then |
414 |
ARCHITECTURE="GENERIC" |
AC_MSG_WARN([nasm version is too old]) |
415 |
else |
else |
416 |
|
found_nasm_comp_prog="yes" |
417 |
|
chosen_asm_prog="$nasm_prog" |
418 |
|
fi |
419 |
|
fi |
420 |
|
fi |
421 |
|
|
422 |
dnl |
dnl |
423 |
dnl Checking nasm format - win32 or elf |
dnl Ok now sort what object format we must use |
424 |
dnl |
dnl |
425 |
AC_MSG_CHECKING([for nasm object format]) |
if test "$found_nasm_comp_prog" = "yes" ; then |
426 |
|
AC_MSG_CHECKING([for asm object format]) |
427 |
case "$target_os" in |
case "$target_os" in |
428 |
*bsd*|linux*|beos|irix*|solaris*) |
*bsd*|linux*|beos|irix*|solaris*|gnu*) |
429 |
|
if test "$ARCHITECTURE" = "X86_64" ; then |
430 |
|
AC_MSG_RESULT([elf64]) |
431 |
|
NASM_FORMAT="elf64" |
432 |
|
else |
433 |
AC_MSG_RESULT([elf]) |
AC_MSG_RESULT([elf]) |
434 |
NASM_FORMAT="elf" |
NASM_FORMAT="elf" |
435 |
|
fi |
436 |
|
MARK_FUNCS="-DMARK_FUNCS" |
437 |
PREFIX="" |
PREFIX="" |
438 |
;; |
;; |
439 |
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]|mingw32|mks) |
[[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) |
440 |
|
if test "$ARCHITECTURE" = "X86_64" ; then |
441 |
|
AC_MSG_RESULT([win64]) |
442 |
|
NASM_FORMAT="win64" |
443 |
|
else |
444 |
AC_MSG_RESULT([win32]) |
AC_MSG_RESULT([win32]) |
445 |
NASM_FORMAT="win32" |
NASM_FORMAT="win32" |
446 |
|
fi |
447 |
|
PREFIX="-DWINDOWS" |
448 |
|
if test "$GCC" = "yes" ; then |
449 |
|
echo 'int main(void) {return 0;}' > conftest.c |
450 |
|
$CC -S -o conftest conftest.c |
451 |
|
if test `$EGREP -c '_main:' conftest` -eq 0 ; then |
452 |
|
PREFIX="$PREFIX -DNO_PREFIX" |
453 |
|
fi |
454 |
|
rm -f conftest* |
455 |
|
fi |
456 |
|
MARK_FUNCS="" |
457 |
|
;; |
458 |
|
*darwin*) |
459 |
|
if test "$ARCHITECTURE" = "X86_64" ; then |
460 |
|
AC_MSG_RESULT([macho64]) |
461 |
|
NASM_FORMAT="macho64" |
462 |
|
else |
463 |
|
AC_MSG_RESULT([macho32]) |
464 |
|
NASM_FORMAT="macho32" |
465 |
|
fi |
466 |
PREFIX="-DPREFIX" |
PREFIX="-DPREFIX" |
467 |
|
MARK_FUNCS="" |
468 |
;; |
;; |
469 |
esac |
esac |
470 |
|
|
471 |
AS=nasm |
AS="$chosen_asm_prog" |
|
AFLAGS="-I\$(<D) -f $NASM_FORMAT $PREFIX" |
|
472 |
ASSEMBLY_EXTENSION="asm" |
ASSEMBLY_EXTENSION="asm" |
473 |
ASSEMBLY_SOURCES="SRC_IA32" |
AFLAGS="-I\$(<D)/ -I../../src/ -f $NASM_FORMAT $PREFIX $MARK_FUNCS" |
474 |
|
ASSEMBLY_SOURCES="SRC_${ARCHITECTURE}" |
475 |
|
if test "$ARCHITECTURE" = "X86_64" ; then |
476 |
|
AFLAGS=${AFLAGS}" -DARCH_IS_X86_64" |
477 |
fi |
fi |
|
|
|
478 |
else |
else |
479 |
AC_MSG_WARN([nasm not found - Compiling generic sources only]) |
AC_MSG_WARN([no correct assembler was found - Compiling generic sources only]) |
480 |
ARCHITECTURE="GENERIC" |
ARCHITECTURE="GENERIC" |
481 |
fi |
fi |
|
|
|
482 |
fi |
fi |
483 |
|
|
484 |
dnl |
dnl |
485 |
dnl PPC |
dnl PPC |
486 |
dnl |
dnl |
487 |
|
dnl With the PPC platform we do not use assembly language, we better keep with |
488 |
|
dnl intrinsic altivec functions and types as they are supported by both Apple |
489 |
|
dnl and GNU gcc with very slight changes to code which can be sumed up by: |
490 |
|
dnl |
491 |
|
dnl Apple: |
492 |
|
dnl - compile with the option -arch ppc -faltivec |
493 |
|
dnl - define vectors with parentheses vec = (0,0,0,0) |
494 |
|
dnl GNU |
495 |
|
dnl - compile with -maltivec -mabi=altivec |
496 |
|
dnl - include <altivec.h> before using intrincic |
497 |
|
dnl - define vectors with vec = {0,0,0,0} |
498 |
|
dnl |
499 |
|
dnl * The compile time option will be "injected" into SPECIFIC_CFLAGS variable |
500 |
|
dnl * The need for altivec.h will also be injected into SPECIFIC_CFLAGS through |
501 |
|
dnl a -DHAVE_ALTIVEC_H |
502 |
|
dnl * The vector definition is handled in portab.h thx to |
503 |
|
dnl HAVE_PARENTHESES/BRACES_ALTIVEC_DECL |
504 |
|
dnl |
505 |
|
PPC_ALTIVEC_SOURCES="" |
506 |
if test "$ARCHITECTURE" = "PPC" ; then |
if test "$ARCHITECTURE" = "PPC" ; then |
507 |
AS="\$(CC)" |
AS="\$(CC)" |
508 |
AFLAGS="-c" |
AFLAGS="" |
509 |
ASSEMBLY_EXTENSION="s" |
ASSEMBLY_EXTENSION=".s" |
510 |
ASSEMBLY_SOURCES="SRC_PPC" |
ASSEMBLY_SOURCES="" |
511 |
AC_MSG_CHECKING([for Altivec support]) |
|
512 |
cat > conftest.S << EOF |
AC_MSG_CHECKING([for altivec.h]) |
513 |
.text |
cat > conftest.c << EOF |
514 |
vxor 0,0,0 |
#include <altivec.h> |
515 |
|
int main() { return(0); } |
516 |
EOF |
EOF |
517 |
if $CC -c conftest.S 2>/dev/null 1>/dev/null ; then |
if $CC -arch ppc -faltivec -c conftest.c 2>/dev/null 1>/dev/null || \ |
518 |
|
$CC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then |
519 |
AC_MSG_RESULT(yes) |
AC_MSG_RESULT(yes) |
520 |
CFLAGS="$CFLAGS -DARCH_IS_PPC_ALTIVEC" |
SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_H" |
521 |
ASSEMBLY_SOURCES="SRC_ALTIVEC" |
TEMP_ALTIVEC="-DHAVE_ALTIVEC_H" |
522 |
else |
else |
523 |
AC_MSG_RESULT(no) |
AC_MSG_RESULT(no) |
524 |
|
TEMP_ALTIVEC="" |
525 |
|
fi |
526 |
|
|
527 |
|
AC_MSG_CHECKING([for Altivec compiler support]) |
528 |
|
cat > conftest.c << EOF |
529 |
|
#ifdef HAVE_ALTIVEC_H |
530 |
|
#include <altivec.h> |
531 |
|
#endif |
532 |
|
|
533 |
|
int main() |
534 |
|
{ |
535 |
|
vector unsigned int vartest2 = (vector unsigned int)(0); |
536 |
|
vector unsigned int vartest3 = (vector unsigned int)(1); |
537 |
|
vartest2 = vec_add(vartest2, vartest3); |
538 |
|
return(0); |
539 |
|
} |
540 |
|
EOF |
541 |
|
if $CC $TEMP_ALTIVEC -arch ppc -faltivec -c conftest.c 2>/dev/null 1>/dev/null ; then |
542 |
|
AC_MSG_RESULT([yes (Apple)]) |
543 |
|
SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -arch ppc -faltivec -DHAVE_ALTIVEC_PARENTHESES_DECL $TEMP_ALTIVEC" |
544 |
|
PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC" |
545 |
|
else |
546 |
|
cat > conftest.c << EOF |
547 |
|
#ifdef HAVE_ALTIVEC_H |
548 |
|
#include <altivec.h> |
549 |
|
#endif |
550 |
|
|
551 |
|
int main() |
552 |
|
{ |
553 |
|
vector unsigned int vartest2 = (vector unsigned int){0}; |
554 |
|
vector unsigned int vartest3 = (vector unsigned int){1}; |
555 |
|
vartest2 = vec_add(vartest2, vartest3); |
556 |
|
return(0); |
557 |
|
} |
558 |
|
EOF |
559 |
|
if $CC $TEMP_ALTIVEC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then |
560 |
|
AC_MSG_RESULT([yes (GNU)]) |
561 |
|
SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_BRACES_DECL $TEMP_ALTIVEC" |
562 |
|
PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC" |
563 |
|
ALTIVEC_CFLAGS="-maltivec -mabi=altivec" |
564 |
|
else |
565 |
|
AC_MSG_RESULT([no (ppc support won't be compiled in)]) |
566 |
|
dnl Only C code can be compiled :-( |
567 |
|
ARCHITECTURE="GENERIC" |
568 |
|
fi |
569 |
fi |
fi |
570 |
|
|
571 |
rm -f conftest.* |
rm -f conftest.* |
572 |
fi |
fi |
573 |
|
|
580 |
AFLAGS="-c" |
AFLAGS="-c" |
581 |
ASSEMBLY_EXTENSION="s" |
ASSEMBLY_EXTENSION="s" |
582 |
ASSEMBLY_SOURCES="SRC_IA64" |
ASSEMBLY_SOURCES="SRC_IA64" |
583 |
|
|
584 |
|
case `basename $CC` in |
585 |
|
*ecc*) |
586 |
|
DCT_IA64_SOURCES="SRC_IA64_IDCT_ECC" |
587 |
|
|
588 |
|
dnl If the compiler is ecc, then i don't know its options |
589 |
|
dnl fallback to "no options" |
590 |
|
if test "$force_default_cc_options" = "yes" ; then |
591 |
|
our_cflags_defaults="" |
592 |
|
fi |
593 |
|
;; |
594 |
|
*) |
595 |
|
DCT_IA64_SOURCES="SRC_IA64_IDCT_GCC" |
596 |
|
;; |
597 |
|
esac |
598 |
|
|
599 |
fi |
fi |
600 |
|
|
601 |
dnl ========================================================================== |
dnl ========================================================================== |
607 |
AC_CHECK_HEADERS( |
AC_CHECK_HEADERS( |
608 |
stdio.h \ |
stdio.h \ |
609 |
signal.h \ |
signal.h \ |
610 |
|
stdlib.h \ |
611 |
|
string.h \ |
612 |
|
assert.h \ |
613 |
|
math.h \ |
614 |
, , AC_MSG_ERROR(Missing header file)) |
, , AC_MSG_ERROR(Missing header file)) |
615 |
|
|
616 |
dnl ========================================================================== |
dnl ========================================================================== |
617 |
dnl |
dnl |
618 |
|
dnl Check for pthread |
619 |
|
dnl |
620 |
|
dnl ========================================================================== |
621 |
|
|
622 |
|
if test x"$pthread" = x"yes" ; then |
623 |
|
case "$target_os" in |
624 |
|
mingw32*) |
625 |
|
AC_CHECK_HEADER( |
626 |
|
[pthread.h], |
627 |
|
[AC_CHECK_LIB( |
628 |
|
[pthreadGC2], |
629 |
|
[pthread_create], |
630 |
|
[SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" |
631 |
|
SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthreadGC2"], |
632 |
|
[AC_CHECK_LIB( |
633 |
|
[pthread], |
634 |
|
[pthread_create], |
635 |
|
[SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" |
636 |
|
SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread"], |
637 |
|
AC_MSG_WARN(Pthread not supported. No SMP support))])], |
638 |
|
AC_MSG_WARN(Pthread not supported. No SMP support)) |
639 |
|
;; |
640 |
|
*) |
641 |
|
AC_CHECK_HEADER( |
642 |
|
[pthread.h], |
643 |
|
[AC_CHECK_LIB( |
644 |
|
[pthread], |
645 |
|
[pthread_create], |
646 |
|
[SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" |
647 |
|
SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread"], |
648 |
|
AC_MSG_WARN(Pthread not supported. No SMP support))], |
649 |
|
AC_MSG_WARN(Pthread not supported. No SMP support)) |
650 |
|
;; |
651 |
|
esac |
652 |
|
else |
653 |
|
AC_MSG_WARN(Pthread support disabled. No SMP support) |
654 |
|
fi |
655 |
|
|
656 |
|
dnl ========================================================================== |
657 |
|
dnl |
658 |
|
dnl Now we can set CFLAGS if needed |
659 |
|
dnl |
660 |
|
dnl ========================================================================== |
661 |
|
|
662 |
|
if test "$force_default_cc_options" = "yes" ; then |
663 |
|
CFLAGS="$our_cflags_defaults" |
664 |
|
fi |
665 |
|
|
666 |
|
dnl ========================================================================== |
667 |
|
dnl |
668 |
|
dnl Profiling stuff goes here |
669 |
|
dnl - adds options to SPECIFIC_CFLAGS, SPECIFIC_LDLAGS |
670 |
|
dnl - removes incompatible options from CFLAGS |
671 |
|
dnl |
672 |
|
dnl ========================================================================== |
673 |
|
|
674 |
|
SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS $GNU_PROF_LDFLAGS" |
675 |
|
SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS $GNU_PROF_CFLAGS" |
676 |
|
|
677 |
|
if test "$enable_gnuprofile" = "yes" ; then |
678 |
|
CFLAGS=`echo $CFLAGS | sed s/'-fomit-frame-pointer'/''/` |
679 |
|
fi |
680 |
|
|
681 |
|
dnl ========================================================================== |
682 |
|
dnl Some gcc flags can't be used for gcc >= 3.4.0 |
683 |
|
dnl ========================================================================== |
684 |
|
|
685 |
|
if test "$GCC" = "yes" ; then |
686 |
|
|
687 |
|
GCC_MAJOR=`$CC -dumpversion | cut -d . -f 1` |
688 |
|
GCC_MINOR=`$CC -dumpversion | cut -d . -f 2` |
689 |
|
|
690 |
|
# GCC 4.x |
691 |
|
if test "${GCC_MAJOR}" -gt 3 ; then |
692 |
|
CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` |
693 |
|
CFLAGS=`echo $CFLAGS | sed s,'-freduce-all-givs','',g` |
694 |
|
CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g` |
695 |
|
CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g` |
696 |
|
CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g` |
697 |
|
fi |
698 |
|
|
699 |
|
# GCC 3.4.x |
700 |
|
if test "${GCC_MAJOR}" -eq 3 && test "${GCC_MINOR}" -gt 3 ; then |
701 |
|
CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` |
702 |
|
fi |
703 |
|
fi |
704 |
|
|
705 |
|
|
706 |
|
dnl ========================================================================== |
707 |
|
dnl |
708 |
dnl Substitions |
dnl Substitions |
709 |
dnl |
dnl |
710 |
dnl ========================================================================== |
dnl ========================================================================== |
724 |
AC_SUBST(ASSEMBLY_SOURCES) |
AC_SUBST(ASSEMBLY_SOURCES) |
725 |
AC_SUBST(CC) |
AC_SUBST(CC) |
726 |
AC_SUBST(CFLAGS) |
AC_SUBST(CFLAGS) |
727 |
AC_SUBST(OS_LDFLAGS) |
AC_SUBST(LDFLAGS) |
728 |
AC_SUBST(DIVX4COMPAT_SOURCES) |
AC_SUBST(SPECIFIC_LDFLAGS) |
729 |
|
AC_SUBST(SPECIFIC_CFLAGS) |
730 |
|
AC_SUBST(DCT_IA64_SOURCES) |
731 |
|
AC_SUBST(PPC_ALTIVEC_SOURCES) |
732 |
|
AC_SUBST(RANLIB) |
733 |
|
AC_SUBST(AR) |
734 |
|
AC_SUBST(API_MAJOR) |
735 |
|
AC_SUBST(API_MINOR) |
736 |
|
AC_SUBST(STATIC_LIB) |
737 |
|
AC_SUBST(PRE_SHARED_LIB) |
738 |
|
AC_SUBST(SHARED_LIB) |
739 |
|
AC_SUBST(ALTIVEC_CFLAGS) |
740 |
|
|
741 |
dnl ========================================================================== |
dnl ========================================================================== |
742 |
dnl |
dnl |