ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/trunk/xvidcore/build/generic/configure.in
Revision: 2199
Committed: Thu May 2 15:04:57 2024 UTC (5 months ago) by Isibaar
File size: 23667 byte(s)
Log Message:
Various Makefile and configure script fixes for MacOS target - thanks to Ryan Schmidt and macports

File Contents

# Content
1 dnl ==========================================================================
2 dnl
3 dnl Autoconf script for Xvid
4 dnl
5 dnl Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr>
6 dnl
7 dnl ==========================================================================
8
9 AC_PREREQ([2.50])
10
11 AC_INIT([Xvid], [1.4.0], [xvid-devel@xvid.org])
12 AC_CONFIG_SRCDIR(configure.in)
13
14 dnl Do not forget to increase that when needed.
15 API_MAJOR="4"
16 API_MINOR="4"
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"
23 yasm_prog="yasm"
24
25 dnl Default CFLAGS -- Big impact on overall speed
26 our_cflags_defaults="-Wall"
27 our_cflags_defaults="$our_cflags_defaults -O2"
28 our_cflags_defaults="$our_cflags_defaults -fstrength-reduce"
29 our_cflags_defaults="$our_cflags_defaults -finline-functions"
30 our_cflags_defaults="$our_cflags_defaults -ffast-math"
31 our_cflags_defaults="$our_cflags_defaults -fomit-frame-pointer"
32
33 dnl ==========================================================================
34 dnl Features - configure options
35 dnl ==========================================================================
36
37 FEATURES=""
38
39 dnl Internal Debug
40 AC_ARG_ENABLE(idebug,
41 AC_HELP_STRING([--enable-idebug],
42 [Enable internal debug function]),
43 [if test "$enable_idebug" = "yes" ; then
44 FEATURES="$FEATURES -D_DEBUG"
45 fi])
46
47 dnl Internal Profile
48 AC_ARG_ENABLE(iprofile,
49 AC_HELP_STRING([--enable-iprofile],
50 [Enable internal profiling]),
51 [if test "$enable_iprofile" = "yes" ; then
52 FEATURES="$FEATURES -D_PROFILING_"
53 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
65 AC_ARG_ENABLE(assembly,
66 AC_HELP_STRING([--disable-assembly],
67 [Disable assembly code]),
68 [if test "$enable_assembly" = "no" ; then
69 assembly="no"
70 else
71 if test "$enable_assembly" = "yes" ; then
72 assembly="yes"
73 fi
74 fi],
75 [assembly="yes"])
76
77 dnl pthread code
78 AC_ARG_ENABLE(pthread,
79 AC_HELP_STRING([--disable-pthread],
80 [Disable pthread dependent code]),
81 [if test "$enable_pthread" = "no" ; then
82 pthread="no"
83 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 ==========================================================================
102 dnl Default install prefix and checks build type
103 dnl ==========================================================================
104
105 AC_PREFIX_DEFAULT("/usr/local")
106 AC_CANONICAL_BUILD
107 AC_CANONICAL_HOST
108 AC_CANONICAL_TARGET
109
110 dnl ==========================================================================
111 dnl Check for the C compiler (could be passed on command line)
112 dnl ==========================================================================
113
114 dnl
115 dnl First we test if CFLAGS have been passed on command line
116 dnl I do that because autoconf defaults (-g -O2) suck and they would kill
117 dnl performance. To prevent that we define a good defult CFLAGS at the end
118 dnl of the script if and only if CFLAGS has not been passed on the command
119 dnl line
120 dnl
121 AC_MSG_CHECKING(whether to use default CFLAGS)
122 if test x"$CFLAGS" = x"" ; then
123 force_default_cc_options="yes"
124 AC_MSG_RESULT([yes])
125 else
126 force_default_cc_options="no"
127 AC_MSG_RESULT([no])
128 fi
129
130 dnl Now we can safely check for the C compiler
131 AC_PROG_CC
132
133 dnl ==========================================================================
134 dnl Check for the install program
135 dnl ==========================================================================
136
137 AC_PROG_INSTALL
138
139 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 Check how the system supports symlinks.
154 dnl ==========================================================================
155
156 AC_PROG_LN_S
157
158 dnl ==========================================================================
159 dnl
160 dnl This part looks for:
161 dnl
162 dnl ARCHITECTURE : The platform architecture
163 dnl - IA32 for mmx, mmx-ext, mmx2, sse assembly
164 dnl - IA64
165 dnl - PPC for PowerPC assembly routines
166 dnl - GENERIC for plain C sources only
167 dnl
168 dnl BUS: Address bus size (in bits)
169 dnl - 32
170 dnl - 64
171 dnl
172 dnl ENDIANNESS: I think you can guess what this thing means :-)
173 dnl - LITTLE_ENDIAN
174 dnl - BIG_ENDIAN
175 dnl
176 dnl ==========================================================================
177
178 dnl
179 dnl Looking what sources have to be compiled according to the CPU type
180 dnl
181
182 ARCHITECTURE=""
183
184 AC_MSG_CHECKING([for whether to use assembly code])
185 if test x"$assembly" = x"yes" ; then
186 AC_MSG_RESULT([yes])
187 AC_MSG_CHECKING([for architecture type])
188 case "$target_cpu" in
189 i[[3456]]86)
190 AC_MSG_RESULT(ia32)
191 ARCHITECTURE="IA32"
192 ;;
193 x86_64)
194 AC_MSG_RESULT(x86_64)
195 ARCHITECTURE="X86_64"
196 ;;
197 powerpc)
198 AC_MSG_RESULT(PowerPC)
199 ARCHITECTURE="PPC"
200 ;;
201 ia64)
202 AC_MSG_RESULT(ia64)
203 ARCHITECTURE="IA64"
204 ;;
205 *)
206 AC_MSG_RESULT($target_cpu)
207 ARCHITECTURE="GENERIC"
208 ;;
209 esac
210 else
211 AC_MSG_RESULT([no])
212 ARCHITECTURE="GENERIC"
213 fi
214
215 dnl
216 dnl Testing address bus length
217 dnl
218 BUS=""
219
220 AC_CHECK_SIZEOF([int *])
221 case "$ac_cv_sizeof_int_p" in
222 4)
223 BUS="32BIT"
224 ;;
225 8)
226 BUS="64BIT"
227 ;;
228 *)
229 AC_MSG_ERROR([Xvid supports only 32/64 bit architectures])
230 ;;
231 esac
232
233 dnl
234 dnl Testing endianness
235 dnl
236 ENDIANNESS=""
237
238 AC_C_BIGENDIAN(ENDIANNESS="BIG_ENDIAN", ENDIANNESS="LITTLE_ENDIAN")
239
240 dnl ==========================================================================
241 dnl
242 dnl Check for OS specific variables
243 dnl - SHARED_EXTENSION, STATIC_EXTENSION, OBJECT_EXTENSION
244 dnl
245 dnl ==========================================================================
246
247 AC_MSG_CHECKING(for build extensions)
248 SHARED_EXTENSION=""
249 STATIC_EXTENSION=""
250 OBJECT_EXTENSION=""
251 case "$target_os" in
252 *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*)
253 AC_MSG_RESULT([.so .a .o])
254 STATIC_EXTENSION="a"
255 SHARED_EXTENSION="so"
256 OBJECT_EXTENSION="o"
257 ;;
258 [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
259 AC_MSG_RESULT([.dll .a .obj])
260 STATIC_EXTENSION="a"
261 SHARED_EXTENSION="dll"
262 OBJECT_EXTENSION="obj"
263 ;;
264 darwin*)
265 if test x"$macosx_module" = x"yes"; then
266 AC_MSG_RESULT([.so .a .o])
267 SHARED_EXTENSION="so"
268 else
269 AC_MSG_RESULT([.dylib .a .o])
270 SHARED_EXTENSION="dylib"
271 fi
272 STATIC_EXTENSION="a"
273 OBJECT_EXTENSION="o"
274 ;;
275 amigaos)
276 { $as_echo "$as_me:${as_lineno-$LINENO}: result: .so .a .o" >&5
277 $as_echo ".so .a .o" >&6; }
278 STATIC_EXTENSION="a"
279 SHARED_EXTENSION="so"
280 OBJECT_EXTENSION="o"
281 ;;
282 *)
283 AC_MSG_RESULT([Unknown OS - Using .so .a .o])
284 STATIC_EXTENSION="a"
285 SHARED_EXTENSION="so"
286 OBJECT_EXTENSION="o"
287 ;;
288 esac
289
290 dnl ==========================================================================
291 dnl
292 dnl Determines best options for CC and LD
293 dnl - STATIC_LIB, SHARED_LIB, SPECIFIC_CFLAGS, SPECIFIC_LDLAGS
294 dnl
295 dnl ==========================================================================
296
297 AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS)
298 SPECIFIC_LDFLAGS=""
299 SPECIFIC_CFLAGS=""
300 ALTIVEC_CFLAGS=""
301 PRE_SHARED_LIB=""
302 SO_API_MAJOR_LINK=""
303 SO_LINK=""
304 IMPORT_LIB=""
305 case "$target_os" in
306 linux*|solaris*|gnu*|*qnx*)
307 AC_MSG_RESULT([ok])
308 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
309 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
310 SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)"
311 SO_LINK="libxvidcore.\$(SHARED_EXTENSION)"
312 SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm"
313 SPECIFIC_CFLAGS="-fPIC"
314 ;;
315 *bsd*|irix*)
316 AC_MSG_RESULT([ok])
317 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
318 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
319 SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)"
320 SO_LINK="libxvidcore.\$(SHARED_EXTENSION)"
321 SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm"
322 SPECIFIC_CFLAGS="-fPIC"
323 ;;
324 [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*)
325 AC_MSG_RESULT([ok])
326 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
327 SHARED_LIB="cygxvidcore.\$(SHARED_EXTENSION)"
328 IMPORT_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(STATIC_EXTENSION)"
329 SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def"
330 SPECIFIC_CFLAGS=""
331 ;;
332 mingw32*|mks*)
333 AC_MSG_RESULT([ok])
334 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
335 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
336 IMPORT_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(STATIC_EXTENSION)"
337 SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def"
338 SPECIFIC_CFLAGS=""
339 ;;
340 darwin*)
341 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
342 SO_LINK="libxvidcore.\$(SHARED_EXTENSION)"
343 SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp"
344 if test x"$macosx_module" = x"no"; then
345 AC_MSG_RESULT([dylib options])
346 SHARED_LIB="libxvidcore.\$(API_MAJOR).\$(SHARED_EXTENSION)"
347 SPECIFIC_LDFLAGS="-Wl,-read_only_relocs,suppress -dynamiclib -compatibility_version \$(API_MAJOR) -current_version \$(API_MAJOR).\$(API_MINOR) -install_name \$(libdir)/\$(SHARED_LIB)"
348 else
349 AC_MSG_RESULT([module options])
350 PRE_SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)-temp.o"
351 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)"
352 SPECIFIC_LDFLAGS="-r -keep_private_externs -nostdlib && \$(CC) \$(LDFLAGS) \$(PRE_SHARED_LIB) -o libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -bundle -flat_namespace -undefined suppress"
353 fi
354 ;;
355 beos)
356 AC_MSG_RESULT([ok])
357 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
358 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
359 SPECIFIC_LDFLAGS="-nostart"
360 SPECIFIC_CFLAGS="-fPIC"
361 ;;
362 amigaos)
363 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
364 $as_echo "ok" >&6; }
365 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
366 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
367 SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)"
368 SO_LINK="libxvidcore.\$(SHARED_EXTENSION)"
369 SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm"
370 SPECIFIC_CFLAGS="-fPIC"
371 ;;
372 *)
373 AC_MSG_RESULT([Unknown Platform (Using default -shared -lc -lm)])
374 STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
375 SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
376 SPECIFIC_LDFLAGS=""
377 SPECIFIC_CFLAGS=""
378 ;;
379 esac
380
381 if test x"$PRE_SHARED_LIB" = x; then
382 PRE_SHARED_LIB=$SHARED_LIB
383 fi
384
385 if test x"$IMPORT_LIB" = x; then
386 IMPORT_LIB=$SHARED_LIB
387 fi
388
389 dnl ==========================================================================
390 dnl
391 dnl Assembler stuff
392 dnl - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES
393 dnl
394 dnl ==========================================================================
395
396 AS=""
397 AFLAGS=""
398 ASSEMBLY_EXTENSION=""
399 GENERIC_SOURCES="SRC_GENERIC"
400 ASSEMBLY_SOURCES=""
401
402 dnl
403 dnl IA32
404 dnl
405
406 if test "$ARCHITECTURE" = "IA32" -o "$ARCHITECTURE" = "X86_64" ; then
407
408 dnl
409 dnl Checking for nasm compatible programs
410 dnl
411
412 found_nasm_comp_prog="no"
413 chosen_asm_prog=""
414
415 dnl Check for yasm first
416 AC_CHECK_PROG([ac_yasm], [$yasm_prog], [yes], [no], , [yes])
417 if test "$ac_yasm" = "yes" ; then
418 dnl
419 dnl Checking yasm version
420 dnl
421 AC_MSG_CHECKING([for yasm version])
422 yasm_major=`$yasm_prog --version | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 2`
423 if test -z $yasm_major ; then
424 yasm_major=-1
425 fi
426 AC_MSG_RESULT([$yasm_major])
427
428 dnl Actually, yasm >= 0.7.99.2161 should be ok
429 dnl But I'm too lazy to check also the patch version...
430 if test "$yasm_major" -lt "$minimum_yasm_major_version" ; then
431 AC_MSG_WARN([yasm version is too old])
432 else
433 found_nasm_comp_prog="yes"
434 chosen_asm_prog="$yasm_prog"
435 fi
436 fi
437
438 dnl Check for nasm (not buggy version)
439 if test "$found_nasm_comp_prog" = "no" ; then
440 AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes])
441 if test "$ac_nasm" = "yes" ; then
442 dnl
443 dnl Checking nasm version
444 dnl
445 AC_MSG_CHECKING([for nasm version])
446 nasm_minor=`$nasm_prog -v | cut -d '.' -f 2 | cut -d ' ' -f 1`
447 nasm_major=`$nasm_prog -v | cut -d '.' -f 1 | cut -d ' ' -f 3`
448 if test -z $nasm_minor ; then
449 nasm_minor=-1
450 fi
451 if test -z $nasm_major ; then
452 nasm_major=-1
453 fi
454 AC_MSG_RESULT([$nasm_major])
455
456 dnl need nasm 2.x for SSE3/4 and X86_64
457 if test "$nasm_major" -lt "$minimum_nasm_major_version" ; then
458 AC_MSG_WARN([nasm version is too old])
459 else
460 found_nasm_comp_prog="yes"
461 chosen_asm_prog="$nasm_prog"
462 fi
463 fi
464 fi
465
466 dnl
467 dnl Ok now sort what object format we must use
468 dnl
469 if test "$found_nasm_comp_prog" = "yes" ; then
470 AC_MSG_CHECKING([for asm object format])
471 case "$target_os" in
472 *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*)
473 if test "$ARCHITECTURE" = "X86_64" ; then
474 AC_MSG_RESULT([elf64])
475 NASM_FORMAT="elf64"
476 else
477 AC_MSG_RESULT([elf])
478 NASM_FORMAT="elf"
479 fi
480 MARK_FUNCS="-DMARK_FUNCS"
481 PREFIX=""
482 ;;
483 [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
484 if test "$ARCHITECTURE" = "X86_64" ; then
485 AC_MSG_RESULT([win64])
486 NASM_FORMAT="win64"
487 else
488 AC_MSG_RESULT([win32])
489 NASM_FORMAT="win32"
490 fi
491 PREFIX="-DWINDOWS"
492 if test "$GCC" = "yes" ; then
493 echo 'int main(void) {return 0;}' > conftest.c
494 $CC -S -o conftest conftest.c
495 if test `$EGREP -c '_main:' conftest` -eq 0 ; then
496 PREFIX="$PREFIX -DNO_PREFIX"
497 fi
498 rm -f conftest*
499 fi
500 MARK_FUNCS=""
501 ;;
502 *darwin*)
503 if test "$ARCHITECTURE" = "X86_64" ; then
504 AC_MSG_RESULT([macho64])
505 NASM_FORMAT="macho64"
506 else
507 AC_MSG_RESULT([macho32])
508 NASM_FORMAT="macho32"
509 fi
510 PREFIX="-DPREFIX"
511 MARK_FUNCS=""
512 ;;
513 esac
514
515 AS="$chosen_asm_prog"
516 ASSEMBLY_EXTENSION="asm"
517 AFLAGS="-I\$(<D)/ -I../../src/ -f $NASM_FORMAT $PREFIX $MARK_FUNCS"
518 ASSEMBLY_SOURCES="SRC_${ARCHITECTURE}"
519 if test "$ARCHITECTURE" = "X86_64" ; then
520 AFLAGS=${AFLAGS}" -DARCH_IS_X86_64"
521 fi
522 else
523 AC_MSG_WARN([no correct assembler was found - Compiling generic sources only])
524 ARCHITECTURE="GENERIC"
525 fi
526 fi
527
528 dnl
529 dnl PPC
530 dnl
531 dnl With the PPC platform we do not use assembly language, we better keep with
532 dnl intrinsic altivec functions and types as they are supported by both Apple
533 dnl and GNU gcc with very slight changes to code which can be sumed up by:
534 dnl
535 dnl Apple:
536 dnl - compile with the option -arch ppc -faltivec
537 dnl - define vectors with parentheses vec = (0,0,0,0)
538 dnl GNU
539 dnl - compile with -maltivec -mabi=altivec
540 dnl - include <altivec.h> before using intrincic
541 dnl - define vectors with vec = {0,0,0,0}
542 dnl
543 dnl * The compile time option will be "injected" into SPECIFIC_CFLAGS variable
544 dnl * The need for altivec.h will also be injected into SPECIFIC_CFLAGS through
545 dnl a -DHAVE_ALTIVEC_H
546 dnl * The vector definition is handled in portab.h thx to
547 dnl HAVE_PARENTHESES/BRACES_ALTIVEC_DECL
548 dnl
549 PPC_ALTIVEC_SOURCES=""
550 if test "$ARCHITECTURE" = "PPC" ; then
551 AS="\$(CC)"
552 AFLAGS=""
553 ASSEMBLY_EXTENSION=".s"
554 ASSEMBLY_SOURCES=""
555
556 AC_MSG_CHECKING([for altivec.h])
557 cat > conftest.c << EOF
558 #include <altivec.h>
559 int main() { return(0); }
560 EOF
561 if $CC -arch ppc -faltivec -c conftest.c 2>/dev/null 1>/dev/null || \
562 $CC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then
563 AC_MSG_RESULT(yes)
564 SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_H"
565 TEMP_ALTIVEC="-DHAVE_ALTIVEC_H"
566 else
567 AC_MSG_RESULT(no)
568 TEMP_ALTIVEC=""
569 fi
570
571 AC_MSG_CHECKING([for Altivec compiler support])
572 cat > conftest.c << EOF
573 #ifdef HAVE_ALTIVEC_H
574 #include <altivec.h>
575 #endif
576
577 int main()
578 {
579 vector unsigned int vartest2 = (vector unsigned int)(0);
580 vector unsigned int vartest3 = (vector unsigned int)(1);
581 vartest2 = vec_add(vartest2, vartest3);
582 return(0);
583 }
584 EOF
585 if $CC $TEMP_ALTIVEC -arch ppc -faltivec -c conftest.c 2>/dev/null 1>/dev/null ; then
586 AC_MSG_RESULT([yes (Apple)])
587 SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -arch ppc -faltivec -DHAVE_ALTIVEC_PARENTHESES_DECL $TEMP_ALTIVEC"
588 PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC"
589 else
590 cat > conftest.c << EOF
591 #ifdef HAVE_ALTIVEC_H
592 #include <altivec.h>
593 #endif
594
595 int main()
596 {
597 vector unsigned int vartest2 = (vector unsigned int){0};
598 vector unsigned int vartest3 = (vector unsigned int){1};
599 vartest2 = vec_add(vartest2, vartest3);
600 return(0);
601 }
602 EOF
603 if $CC $TEMP_ALTIVEC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then
604 AC_MSG_RESULT([yes (GNU)])
605 SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_BRACES_DECL $TEMP_ALTIVEC"
606 PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC"
607 ALTIVEC_CFLAGS="-maltivec -mabi=altivec"
608 else
609 AC_MSG_RESULT([no (ppc support won't be compiled in)])
610 dnl Only C code can be compiled :-(
611 ARCHITECTURE="GENERIC"
612 fi
613 fi
614
615 rm -f conftest.*
616 fi
617
618 dnl
619 dnl IA64
620 dnl
621
622 if test "$ARCHITECTURE" = "IA64" ; then
623 AS="\$(CC)"
624 AFLAGS="-c"
625 ASSEMBLY_EXTENSION="s"
626 ASSEMBLY_SOURCES="SRC_IA64"
627
628 case `basename $CC` in
629 *ecc*)
630 DCT_IA64_SOURCES="SRC_IA64_IDCT_ECC"
631
632 dnl If the compiler is ecc, then i don't know its options
633 dnl fallback to "no options"
634 if test "$force_default_cc_options" = "yes" ; then
635 our_cflags_defaults=""
636 fi
637 ;;
638 *)
639 DCT_IA64_SOURCES="SRC_IA64_IDCT_GCC"
640 ;;
641 esac
642
643 fi
644
645 dnl ==========================================================================
646 dnl
647 dnl Check for header files
648 dnl
649 dnl ==========================================================================
650
651 AC_CHECK_HEADERS(
652 stdio.h \
653 signal.h \
654 stdlib.h \
655 string.h \
656 assert.h \
657 math.h \
658 , , AC_MSG_ERROR(Missing header file))
659
660 dnl ==========================================================================
661 dnl
662 dnl Check for pthread
663 dnl
664 dnl ==========================================================================
665
666 if test x"$pthread" = x"yes" ; then
667 case "$target_os" in
668 mingw32*)
669 AC_CHECK_HEADER(
670 [pthread.h],
671 [AC_CHECK_LIB(
672 [pthreadGC2],
673 [pthread_create],
674 [SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD"
675 SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthreadGC2"],
676 [AC_CHECK_LIB(
677 [pthread],
678 [pthread_create],
679 [SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD"
680 SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread"],
681 AC_MSG_WARN(Pthread not supported. No SMP support))])],
682 AC_MSG_WARN(Pthread not supported. No SMP support))
683 ;;
684 *)
685 AC_CHECK_HEADER(
686 [pthread.h],
687 [AC_CHECK_LIB(
688 [pthread],
689 [pthread_create],
690 [SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD"
691 SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread"],
692 [AC_CHECK_LIB(
693 [c],
694 [pthread_create],
695 [SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD"
696 SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS"],
697 AC_MSG_WARN(Pthread not supported. No SMP support))])],
698 AC_MSG_WARN(Pthread not supported. No SMP support))
699 ;;
700 esac
701 else
702 AC_MSG_WARN(Pthread support disabled. No SMP support)
703 fi
704
705 dnl ==========================================================================
706 dnl
707 dnl Now we can set CFLAGS if needed
708 dnl
709 dnl ==========================================================================
710
711 if test "$force_default_cc_options" = "yes" ; then
712 CFLAGS="$our_cflags_defaults"
713 fi
714
715 dnl ==========================================================================
716 dnl
717 dnl Profiling stuff goes here
718 dnl - adds options to SPECIFIC_CFLAGS, SPECIFIC_LDLAGS
719 dnl - removes incompatible options from CFLAGS
720 dnl
721 dnl ==========================================================================
722
723 SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS $GNU_PROF_LDFLAGS"
724 SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS $GNU_PROF_CFLAGS"
725
726 if test "$enable_gnuprofile" = "yes" ; then
727 CFLAGS=`echo $CFLAGS | sed s/'-fomit-frame-pointer'/''/`
728 fi
729
730 dnl ==========================================================================
731 dnl Some gcc flags can't be used for gcc >= 3.4.0
732 dnl ==========================================================================
733
734 if test "$GCC" = "yes" ; then
735
736 GCC_MAJOR=`$CC -dumpversion | cut -d . -f 1`
737 GCC_MINOR=`$CC -dumpversion | cut -d . -f 2`
738
739 # GCC 4.x
740 if test "${GCC_MAJOR}" -gt 3 ; then
741 CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g`
742 CFLAGS=`echo $CFLAGS | sed s,'-freduce-all-givs','',g`
743 CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g`
744 CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g`
745 CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g`
746 fi
747
748 # GCC 3.4.x
749 if test "${GCC_MAJOR}" -eq 3 && test "${GCC_MINOR}" -gt 3 ; then
750 CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g`
751 fi
752 fi
753
754
755 dnl ==========================================================================
756 dnl
757 dnl Substitions
758 dnl
759 dnl ==========================================================================
760
761 AC_SUBST(FEATURES)
762 AC_SUBST(ARCHITECTURE)
763 AC_SUBST(BUS)
764 AC_SUBST(ENDIANNESS)
765 AC_SUBST(SHARED_EXTENSION)
766 AC_SUBST(STATIC_EXTENSION)
767 AC_SUBST(OBJECT_EXTENSION)
768 AC_SUBST(NASM_FORMAT)
769 AC_SUBST(AS)
770 AC_SUBST(AFLAGS)
771 AC_SUBST(ASSEMBLY_EXTENSION)
772 AC_SUBST(GENERIC_SOURCES)
773 AC_SUBST(ASSEMBLY_SOURCES)
774 AC_SUBST(CC)
775 AC_SUBST(CFLAGS)
776 AC_SUBST(LDFLAGS)
777 AC_SUBST(SPECIFIC_LDFLAGS)
778 AC_SUBST(SPECIFIC_CFLAGS)
779 AC_SUBST(DCT_IA64_SOURCES)
780 AC_SUBST(PPC_ALTIVEC_SOURCES)
781 AC_SUBST(LN_S)
782 AC_SUBST(RANLIB)
783 AC_SUBST(AR)
784 AC_SUBST(API_MAJOR)
785 AC_SUBST(API_MINOR)
786 AC_SUBST(STATIC_LIB)
787 AC_SUBST(PRE_SHARED_LIB)
788 AC_SUBST(SO_API_MAJOR_LINK)
789 AC_SUBST(SO_LINK)
790 AC_SUBST(SHARED_LIB)
791 AC_SUBST(IMPORT_LIB)
792 AC_SUBST(ALTIVEC_CFLAGS)
793
794 dnl ==========================================================================
795 dnl
796 dnl Output files
797 dnl
798 dnl ==========================================================================
799
800 AC_CONFIG_FILES(platform.inc)
801
802 AC_OUTPUT