1 dnl Copyright 2005 Red Hat, Inc.
3 dnl Permission to use, copy, modify, distribute, and sell this software and its
4 dnl documentation for any purpose is hereby granted without fee, provided that
5 dnl the above copyright notice appear in all copies and that both that
6 dnl copyright notice and this permission notice appear in supporting
7 dnl documentation, and that the name of Red Hat not be used in
8 dnl advertising or publicity pertaining to distribution of the software without
9 dnl specific, written prior permission. Red Hat makes no
10 dnl representations about the suitability of this software for any purpose. It
11 dnl is provided "as is" without express or implied warranty.
13 dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15 dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16 dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 dnl PERFORMANCE OF THIS SOFTWARE.
21 dnl Process this file with autoconf to create configure.
25 # Pixman versioning scheme
27 # - The version in git has an odd MICRO version number
29 # - Released versions, both development and stable, have an
30 # even MICRO version number
32 # - Released development versions have an odd MINOR number
34 # - Released stable versions have an even MINOR number
36 # - Versions that break ABI must have a new MAJOR number
38 # - If you break the ABI, then at least this must be done:
42 # - In the first development release where you break ABI, find
43 # all instances of "pixman-n" and change them to pixman-(n+1)
45 # This needs to be done at least in
50 # This ensures that binary incompatible versions can be installed
51 # in parallel. See http://www106.pair.com/rhp/parallel.html for
55 m4_define([pixman_major], 0)
56 m4_define([pixman_minor], 31)
57 m4_define([pixman_micro], 1)
59 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
61 AC_INIT(pixman, pixman_version, [pixman@lists.freedesktop.org], pixman)
62 AM_INIT_AUTOMAKE([foreign dist-bzip2])
64 # Suppress verbose compile lines
65 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
67 AC_CONFIG_HEADERS(config.h)
71 test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.
76 AC_CHECK_FUNCS([getisax])
80 dnl PIXMAN_LINK_WITH_ENV(env-setup, program, true-action, false-action)
82 dnl Compiles and links the given program in the environment setup by env-setup
83 dnl and executes true-action on success and false-action on failure.
84 AC_DEFUN([PIXMAN_LINK_WITH_ENV],[dnl
86 save_LDFLAGS="$LDFLAGS"
92 CFLAGS="$save_CFLAGS $CFLAGS"
93 LDFLAGS="$save_LDFLAGS $LDFLAGS"
94 LIBS="$save_LIBS $LIBS"
96 [AC_LANG_SOURCE([$2])],
97 [pixman_cc_stderr=`test -f conftest.err && cat conftest.err`
99 [pixman_cc_stderr=`test -f conftest.err && cat conftest.err`
102 if test "x$pixman_cc_stderr" != "x"; then
106 if test "x$pixman_cc_flag" = "xyes"; then
107 ifelse([$3], , :, [$3])
109 ifelse([$4], , :, [$4])
111 CFLAGS="$save_CFLAGS"
112 LDFLAGS="$save_LDFLAGS"
116 dnl Find a -Werror for catching warnings.
118 for w in -Werror -errwarn; do
119 if test "z$WERROR" = "z"; then
120 AC_MSG_CHECKING([whether the compiler supports $w])
121 PIXMAN_LINK_WITH_ENV(
123 [int main(int c, char **v) { (void)c; (void)v; return 0; }],
124 [WERROR=$w; yesno=yes], [yesno=no])
125 AC_MSG_RESULT($yesno)
129 dnl PIXMAN_CHECK_CFLAG(flag, [program])
130 dnl Adds flag to CFLAGS if the given program links without warnings or errors.
131 AC_DEFUN([PIXMAN_CHECK_CFLAG], [dnl
132 AC_MSG_CHECKING([whether the compiler supports $1])
133 PIXMAN_LINK_WITH_ENV(
134 [CFLAGS="$WERROR $1"],
136 int main(int c, char **v) { (void)c; (void)v; return 0; }
140 if test "x$_yesno" = xyes; then
143 AC_MSG_RESULT($_yesno)
146 AC_CHECK_SIZEOF(long)
148 # Checks for Sun Studio compilers
149 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
150 AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
152 # Default CFLAGS to -O -g rather than just the -g from AC_PROG_CC
153 # if we're using Sun Studio and neither the user nor a config.site
155 if test $SUNCC = yes && \
156 test "x$test_CFLAGS" = "x" && \
157 test "$CFLAGS" = "-g"
163 # We ignore pixman_major in the version here because the major version should
164 # always be encoded in the actual library name. Ie., the soname is:
166 # pixman-$(pixman_major).0.minor.micro
168 m4_define([lt_current], [pixman_minor])
169 m4_define([lt_revision], [pixman_micro])
170 m4_define([lt_age], [pixman_minor])
172 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
174 PIXMAN_VERSION_MAJOR=pixman_major()
175 AC_SUBST(PIXMAN_VERSION_MAJOR)
176 PIXMAN_VERSION_MINOR=pixman_minor()
177 AC_SUBST(PIXMAN_VERSION_MINOR)
178 PIXMAN_VERSION_MICRO=pixman_micro()
179 AC_SUBST(PIXMAN_VERSION_MICRO)
181 AC_SUBST(LT_VERSION_INFO)
183 # Check for dependencies
185 PIXMAN_CHECK_CFLAG([-Wall])
186 PIXMAN_CHECK_CFLAG([-fno-strict-aliasing])
188 dnl =========================================================================
189 dnl OpenMP for the test suite?
192 # Check for OpenMP support only when autoconf support that (require autoconf >=2.62)
194 m4_ifdef([AC_OPENMP], [AC_OPENMP])
196 if test "x$enable_openmp" = "xyes" && test "x$ac_cv_prog_c_openmp" = "xunsupported" ; then
197 AC_MSG_WARN([OpenMP support requested but found unsupported])
200 dnl May not fail to link without -Wall -Werror added
201 dnl So try to link only when openmp is supported
202 dnl ac_cv_prog_c_openmp is not defined when --disable-openmp is used
203 if test "x$ac_cv_prog_c_openmp" != "xunsupported" && test "x$ac_cv_prog_c_openmp" != "x"; then
204 m4_define([openmp_test_program],[dnl
207 extern unsigned int lcg_seed;
208 #pragma omp threadprivate(lcg_seed)
209 unsigned int lcg_seed;
211 unsigned function(unsigned a, unsigned b)
214 return ((a + b) ^ a ) + lcg_seed;
217 int main(int argc, char **argv)
220 int n1 = 0, n2 = argc;
221 unsigned checksum = 0;
222 int verbose = argv != NULL;
223 unsigned (*test_function)(unsigned, unsigned);
224 test_function = function;
225 #pragma omp parallel for reduction(+:checksum) default(none) \
226 shared(n1, n2, test_function, verbose)
227 for (i = n1; i < n2; i++)
229 unsigned crc = test_function (i, 0);
231 printf ("%d: %08X\n", i, crc);
234 printf("%u\n", checksum);
239 PIXMAN_LINK_WITH_ENV(
240 [CFLAGS="$OPENMP_CFLAGS" LDFLAGS="$OPENMP_CFLAGS"],
241 [openmp_test_program],
244 if test "x$have_openmp" = "xyes" ; then
245 AC_DEFINE(USE_OPENMP, 1, [use OpenMP in the test suite])
248 AC_SUBST(OPENMP_CFLAGS)
250 dnl =========================================================================
251 dnl -fvisibility stuff
253 PIXMAN_CHECK_CFLAG([-fvisibility=hidden], [dnl
254 #if defined(__GNUC__) && (__GNUC__ >= 4)
256 #error Have -fvisibility but it is ignored and generates a warning
259 #error Need GCC 4.0 for visibility
263 PIXMAN_CHECK_CFLAG([-xldscope=hidden], [dnl
264 #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
266 #error Need Sun Studio 8 for visibility
270 dnl ===========================================================================
271 dnl Check for Loongson Multimedia Instructions
273 if test "x$LS_CFLAGS" = "x" ; then
274 LS_CFLAGS="-march=loongson2f"
278 AC_MSG_CHECKING(whether to use Loongson MMI assembler)
280 xserver_save_CFLAGS=$CFLAGS
281 CFLAGS=" $LS_CFLAGS $CFLAGS -I$srcdir"
282 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
283 #ifndef __mips_loongson_vector_rev
284 #error "Loongson Multimedia Instructions are only available on Loongson"
286 #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
287 #error "Need GCC >= 4.4 for Loongson MMI compilation"
289 #include "pixman/loongson-mmintrin.h"
294 } a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} };
296 __m64 c = _mm_srli_pi16 (a.v, b);
298 }]])], have_loongson_mmi=yes)
299 CFLAGS=$xserver_save_CFLAGS
301 AC_ARG_ENABLE(loongson-mmi,
302 [AC_HELP_STRING([--disable-loongson-mmi],
303 [disable Loongson MMI fast paths])],
304 [enable_loongson_mmi=$enableval], [enable_loongson_mmi=auto])
306 if test $enable_loongson_mmi = no ; then
307 have_loongson_mmi=disabled
310 if test $have_loongson_mmi = yes ; then
311 AC_DEFINE(USE_LOONGSON_MMI, 1, [use Loongson Multimedia Instructions])
316 AC_MSG_RESULT($have_loongson_mmi)
317 if test $enable_loongson_mmi = yes && test $have_loongson_mmi = no ; then
318 AC_MSG_ERROR([Loongson MMI not detected])
321 AM_CONDITIONAL(USE_LOONGSON_MMI, test $have_loongson_mmi = yes)
323 dnl ===========================================================================
326 if test "x$MMX_CFLAGS" = "x" ; then
327 if test "x$SUNCC" = "xyes"; then
328 # Sun Studio doesn't have an -xarch=mmx flag, so we have to use sse
329 # but if we're building 64-bit, mmx & sse support is on by default and
330 # -xarch=sse throws an error instead
331 if test "$AMD64_ABI" = "no" ; then
332 MMX_CFLAGS="-xarch=sse"
335 MMX_CFLAGS="-mmmx -Winline"
339 have_mmx_intrinsics=no
340 AC_MSG_CHECKING(whether to use MMX intrinsics)
341 xserver_save_CFLAGS=$CFLAGS
342 CFLAGS="$MMX_CFLAGS $CFLAGS"
343 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
344 #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
345 #error "Need GCC >= 3.4 for MMX intrinsics"
347 #include <mmintrin.h>
349 __m64 v = _mm_cvtsi32_si64 (1);
352 /* Some versions of clang will choke on K */
353 asm ("pshufw %2, %1, %0\n\t"
358 return _mm_cvtsi64_si32 (v);
359 }]])], have_mmx_intrinsics=yes)
360 CFLAGS=$xserver_save_CFLAGS
363 [AC_HELP_STRING([--disable-mmx],
364 [disable x86 MMX fast paths])],
365 [enable_mmx=$enableval], [enable_mmx=auto])
367 if test $enable_mmx = no ; then
368 have_mmx_intrinsics=disabled
371 if test $have_mmx_intrinsics = yes ; then
372 AC_DEFINE(USE_X86_MMX, 1, [use x86 MMX compiler intrinsics])
377 AC_MSG_RESULT($have_mmx_intrinsics)
378 if test $enable_mmx = yes && test $have_mmx_intrinsics = no ; then
379 AC_MSG_ERROR([x86 MMX intrinsics not detected])
382 AM_CONDITIONAL(USE_X86_MMX, test $have_mmx_intrinsics = yes)
384 dnl ===========================================================================
387 if test "x$SSE2_CFLAGS" = "x" ; then
388 if test "x$SUNCC" = "xyes"; then
389 # SSE2 is enabled by default in the Sun Studio 64-bit environment
390 if test "$AMD64_ABI" = "no" ; then
391 SSE2_CFLAGS="-xarch=sse2"
394 SSE2_CFLAGS="-msse2 -Winline"
398 have_sse2_intrinsics=no
399 AC_MSG_CHECKING(whether to use SSE2 intrinsics)
400 xserver_save_CFLAGS=$CFLAGS
401 CFLAGS="$SSE2_CFLAGS $CFLAGS"
403 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
404 #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
405 # if !defined(__amd64__) && !defined(__x86_64__)
406 # error "Need GCC >= 4.2 for SSE2 intrinsics on x86"
409 #include <mmintrin.h>
410 #include <xmmintrin.h>
411 #include <emmintrin.h>
413 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
414 c = _mm_xor_si128 (a, b);
416 }]])], have_sse2_intrinsics=yes)
417 CFLAGS=$xserver_save_CFLAGS
420 [AC_HELP_STRING([--disable-sse2],
421 [disable SSE2 fast paths])],
422 [enable_sse2=$enableval], [enable_sse2=auto])
424 if test $enable_sse2 = no ; then
425 have_sse2_intrinsics=disabled
428 if test $have_sse2_intrinsics = yes ; then
429 AC_DEFINE(USE_SSE2, 1, [use SSE2 compiler intrinsics])
432 AC_MSG_RESULT($have_sse2_intrinsics)
433 if test $enable_sse2 = yes && test $have_sse2_intrinsics = no ; then
434 AC_MSG_ERROR([SSE2 intrinsics not detected])
437 AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes)
439 dnl ===========================================================================
440 dnl Other special flags needed when building code using MMX or SSE instructions
443 # When building 32-bit binaries, apply a mapfile to ensure that the
444 # binaries aren't flagged as only able to run on MMX+SSE capable CPUs
445 # since they check at runtime before using those instructions.
446 # Not all linkers grok the mapfile format so we check for that first.
447 if test "$AMD64_ABI" = "no" ; then
449 AC_MSG_CHECKING(whether to use a hardware capability map file)
450 hwcap_save_LDFLAGS="$LDFLAGS"
451 HWCAP_LDFLAGS='-Wl,-M,$(srcdir)/solaris-hwcap.mapfile'
452 LDFLAGS="$LDFLAGS -Wl,-M,pixman/solaris-hwcap.mapfile"
453 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
454 use_hwcap_mapfile=yes,
456 LDFLAGS="$hwcap_save_LDFLAGS"
457 AC_MSG_RESULT($use_hwcap_mapfile)
459 if test "x$MMX_LDFLAGS" = "x" ; then
460 MMX_LDFLAGS="$HWCAP_LDFLAGS"
462 if test "x$SSE2_LDFLAGS" = "x" ; then
463 SSE2_LDFLAGS="$HWCAP_LDFLAGS"
469 AC_SUBST(IWMMXT_CFLAGS)
471 AC_SUBST(MMX_LDFLAGS)
472 AC_SUBST(SSE2_CFLAGS)
473 AC_SUBST(SSE2_LDFLAGS)
475 dnl ===========================================================================
476 dnl Check for VMX/Altivec
477 if test -n "`$CC -v 2>&1 | grep version | grep Apple`"; then
478 VMX_CFLAGS="-faltivec"
480 VMX_CFLAGS="-maltivec -mabi=altivec"
483 have_vmx_intrinsics=no
484 AC_MSG_CHECKING(whether to use VMX/Altivec intrinsics)
485 xserver_save_CFLAGS=$CFLAGS
486 CFLAGS="$VMX_CFLAGS $CFLAGS"
487 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
488 #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
489 #error "Need GCC >= 3.4 for sane altivec support"
493 vector unsigned int v = vec_splat_u32 (1);
496 }]])], have_vmx_intrinsics=yes)
497 CFLAGS=$xserver_save_CFLAGS
500 [AC_HELP_STRING([--disable-vmx],
501 [disable VMX fast paths])],
502 [enable_vmx=$enableval], [enable_vmx=auto])
504 if test $enable_vmx = no ; then
505 have_vmx_intrinsics=disabled
508 if test $have_vmx_intrinsics = yes ; then
509 AC_DEFINE(USE_VMX, 1, [use VMX compiler intrinsics])
514 AC_MSG_RESULT($have_vmx_intrinsics)
515 if test $enable_vmx = yes && test $have_vmx_intrinsics = no ; then
516 AC_MSG_ERROR([VMX intrinsics not detected])
521 AM_CONDITIONAL(USE_VMX, test $have_vmx_intrinsics = yes)
523 dnl ==========================================================================
524 dnl Check if assembler is gas compatible and supports ARM SIMD instructions
526 AC_MSG_CHECKING(whether to use ARM SIMD assembler)
527 xserver_save_CFLAGS=$CFLAGS
528 CFLAGS="-x assembler-with-cpp $CFLAGS"
529 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
536 #error EABI is required (to be sure that calling conventions are compatible)
539 uqadd8 r0, r0, r0]])], have_arm_simd=yes)
540 CFLAGS=$xserver_save_CFLAGS
542 AC_ARG_ENABLE(arm-simd,
543 [AC_HELP_STRING([--disable-arm-simd],
544 [disable ARM SIMD fast paths])],
545 [enable_arm_simd=$enableval], [enable_arm_simd=auto])
547 if test $enable_arm_simd = no ; then
548 have_arm_simd=disabled
551 if test $have_arm_simd = yes ; then
552 AC_DEFINE(USE_ARM_SIMD, 1, [use ARM SIMD assembly optimizations])
555 AM_CONDITIONAL(USE_ARM_SIMD, test $have_arm_simd = yes)
557 AC_MSG_RESULT($have_arm_simd)
558 if test $enable_arm_simd = yes && test $have_arm_simd = no ; then
559 AC_MSG_ERROR([ARM SIMD intrinsics not detected])
562 dnl ==========================================================================
563 dnl Check if assembler is gas compatible and supports NEON instructions
565 AC_MSG_CHECKING(whether to use ARM NEON assembler)
566 xserver_save_CFLAGS=$CFLAGS
567 CFLAGS="-x assembler-with-cpp $CFLAGS"
568 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
573 .eabi_attribute 10, 0
577 #error EABI is required (to be sure that calling conventions are compatible)
580 vmovn.u16 d0, q0]])], have_arm_neon=yes)
581 CFLAGS=$xserver_save_CFLAGS
583 AC_ARG_ENABLE(arm-neon,
584 [AC_HELP_STRING([--disable-arm-neon],
585 [disable ARM NEON fast paths])],
586 [enable_arm_neon=$enableval], [enable_arm_neon=auto])
588 if test $enable_arm_neon = no ; then
589 have_arm_neon=disabled
592 if test $have_arm_neon = yes ; then
593 AC_DEFINE(USE_ARM_NEON, 1, [use ARM NEON assembly optimizations])
596 AM_CONDITIONAL(USE_ARM_NEON, test $have_arm_neon = yes)
598 AC_MSG_RESULT($have_arm_neon)
599 if test $enable_arm_neon = yes && test $have_arm_neon = no ; then
600 AC_MSG_ERROR([ARM NEON intrinsics not detected])
603 dnl ===========================================================================
606 AC_ARG_ENABLE(arm-iwmmxt,
607 [AC_HELP_STRING([--disable-arm-iwmmxt],
608 [disable ARM IWMMXT fast paths])],
609 [enable_iwmmxt=$enableval], [enable_iwmmxt=auto])
611 AC_ARG_ENABLE(arm-iwmmxt2,
612 [AC_HELP_STRING([--disable-arm-iwmmxt2],
613 [build ARM IWMMXT fast paths with -march=iwmmxt instead of -march=iwmmxt2])],
614 [enable_iwmmxt2=$enableval], [enable_iwmmxt2=auto])
616 if test "x$IWMMXT_CFLAGS" = "x" ; then
617 IWMMXT_CFLAGS="-flax-vector-conversions -Winline -march=iwmmxt"
618 if test $enable_iwmmxt2 != no ; then
623 have_iwmmxt_intrinsics=no
624 AC_MSG_CHECKING(whether to use ARM IWMMXT intrinsics)
625 xserver_save_CFLAGS=$CFLAGS
626 CFLAGS="$CFLAGS $IWMMXT_CFLAGS"
627 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
629 #error "IWMMXT is only available on ARM"
632 #error "IWMMXT not enabled (with -march=iwmmxt)"
634 #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
635 #error "Need GCC >= 4.5 for IWMMXT intrinsics"
637 #include <mmintrin.h>
642 } a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} };
644 __m64 c = _mm_srli_si64 (a.v, b);
645 }]])], have_iwmmxt_intrinsics=yes)
646 CFLAGS=$xserver_save_CFLAGS
648 if test $enable_iwmmxt = no ; then
649 have_iwmmxt_intrinsics=disabled
652 if test $have_iwmmxt_intrinsics = yes ; then
653 AC_DEFINE(USE_ARM_IWMMXT, 1, [use ARM IWMMXT compiler intrinsics])
658 AC_MSG_RESULT($have_iwmmxt_intrinsics)
659 if test $enable_iwmmxt = yes && test $have_iwmmxt_intrinsics = no ; then
660 AC_MSG_ERROR([IWMMXT intrinsics not detected])
663 AM_CONDITIONAL(USE_ARM_IWMMXT, test $have_iwmmxt_intrinsics = yes)
665 dnl ==========================================================================
666 dnl Check if assembler is gas compatible and supports MIPS DSPr2 instructions
669 AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler)
670 xserver_save_CFLAGS=$CFLAGS
671 CFLAGS="-mdspr2 $CFLAGS"
673 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
674 #if !(defined(__mips__) && __mips_isa_rev >= 2)
675 #error MIPS DSPr2 is currently only available on MIPS32r2 platforms.
680 int c = 0, a = 0, b = 0;
681 __asm__ __volatile__ (
682 "precr.qb.ph %[c], %[a], %[b] \n\t"
684 : [a] "r" (a), [b] "r" (b)
687 }]])], have_mips_dspr2=yes)
688 CFLAGS=$xserver_save_CFLAGS
690 AC_ARG_ENABLE(mips-dspr2,
691 [AC_HELP_STRING([--disable-mips-dspr2],
692 [disable MIPS DSPr2 fast paths])],
693 [enable_mips_dspr2=$enableval], [enable_mips_dspr2=auto])
695 if test $enable_mips_dspr2 = no ; then
696 have_mips_dspr2=disabled
699 if test $have_mips_dspr2 = yes ; then
700 AC_DEFINE(USE_MIPS_DSPR2, 1, [use MIPS DSPr2 assembly optimizations])
703 AM_CONDITIONAL(USE_MIPS_DSPR2, test $have_mips_dspr2 = yes)
705 AC_MSG_RESULT($have_mips_dspr2)
706 if test $enable_mips_dspr2 = yes && test $have_mips_dspr2 = no ; then
707 AC_MSG_ERROR([MIPS DSPr2 instructions not detected])
710 dnl =========================================================================================
711 dnl Check for GNU-style inline assembly support
713 have_gcc_inline_asm=no
714 AC_MSG_CHECKING(whether to use GNU-style inline assembler)
715 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
717 /* Most modern architectures have a NOP instruction, so this is a fairly generic test. */
718 asm volatile ( "\tnop\n" : : : "cc", "memory" );
720 }]])], have_gcc_inline_asm=yes)
722 AC_ARG_ENABLE(gcc-inline-asm,
723 [AC_HELP_STRING([--disable-gcc-inline-asm],
724 [disable GNU-style inline assembler])],
725 [enable_gcc_inline_asm=$enableval], [enable_gcc_inline_asm=auto])
727 if test $enable_gcc_inline_asm = no ; then
728 have_gcc_inline_asm=disabled
731 if test $have_gcc_inline_asm = yes ; then
732 AC_DEFINE(USE_GCC_INLINE_ASM, 1, [use GNU-style inline assembler])
735 AC_MSG_RESULT($have_gcc_inline_asm)
736 if test $enable_gcc_inline_asm = yes && test $have_gcc_inline_asm = no ; then
737 AC_MSG_ERROR([GNU-style inline assembler not detected])
740 AM_CONDITIONAL(USE_GCC_INLINE_ASM, test $have_gcc_inline_asm = yes)
742 dnl ==============================================
743 dnl Static test programs
745 AC_ARG_ENABLE(static-testprogs,
746 [AC_HELP_STRING([--enable-static-testprogs],
747 [build test programs as static binaries [default=no]])],
748 [enable_static_testprogs=$enableval], [enable_static_testprogs=no])
750 TESTPROGS_EXTRA_LDFLAGS=
751 if test "x$enable_static_testprogs" = "xyes" ; then
752 TESTPROGS_EXTRA_LDFLAGS="-all-static"
754 AC_SUBST(TESTPROGS_EXTRA_LDFLAGS)
756 dnl ==============================================
759 AC_ARG_ENABLE(timers,
760 [AC_HELP_STRING([--enable-timers],
761 [enable TIMER_BEGIN and TIMER_END macros [default=no]])],
762 [enable_timers=$enableval], [enable_timers=no])
764 if test $enable_timers = yes ; then
765 AC_DEFINE(PIXMAN_TIMERS, 1, [enable TIMER_BEGIN/TIMER_END macros])
767 AC_SUBST(PIXMAN_TIMERS)
769 dnl ===================================
773 [AC_HELP_STRING([--enable-gtk],
774 [enable tests using GTK+ [default=auto]])],
775 [enable_gtk=$enableval], [enable_gtk=auto])
779 if test $enable_gtk = yes ; then
780 AC_CHECK_LIB([pixman-1], [pixman_version_string])
781 PKG_CHECK_MODULES(GTK, [gtk+-2.0 pixman-1])
784 if test $enable_gtk = auto ; then
785 AC_CHECK_LIB([pixman-1], [pixman_version_string], [enable_gtk=auto], [enable_gtk=no])
788 if test $enable_gtk = auto ; then
789 PKG_CHECK_MODULES(GTK, [gtk+-2.0 pixman-1], [enable_gtk=yes], [enable_gtk=no])
792 AM_CONDITIONAL(HAVE_GTK, [test "x$enable_gtk" = xyes])
797 dnl =====================================
798 dnl posix_memalign, sigaction, alarm, gettimeofday
800 AC_CHECK_FUNC(posix_memalign, have_posix_memalign=yes, have_posix_memalign=no)
801 if test x$have_posix_memalign = xyes; then
802 AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [Whether we have posix_memalign()])
805 AC_CHECK_FUNC(sigaction, have_sigaction=yes, have_sigaction=no)
806 if test x$have_sigaction = xyes; then
807 AC_DEFINE(HAVE_SIGACTION, 1, [Whether we have sigaction()])
810 AC_CHECK_FUNC(alarm, have_alarm=yes, have_alarm=no)
811 if test x$have_alarm = xyes; then
812 AC_DEFINE(HAVE_ALARM, 1, [Whether we have alarm()])
815 AC_CHECK_HEADER([sys/mman.h],
816 [AC_DEFINE(HAVE_SYS_MMAN_H, [1], [Define to 1 if we have <sys/mman.h>])])
818 AC_CHECK_FUNC(mmap, have_mmap=yes, have_mmap=no)
819 if test x$have_mmap = xyes; then
820 AC_DEFINE(HAVE_MMAP, 1, [Whether we have mmap()])
823 AC_CHECK_FUNC(mprotect, have_mprotect=yes, have_mprotect=no)
824 if test x$have_mprotect = xyes; then
825 AC_DEFINE(HAVE_MPROTECT, 1, [Whether we have mprotect()])
828 AC_CHECK_FUNC(getpagesize, have_getpagesize=yes, have_getpagesize=no)
829 if test x$have_getpagesize = xyes; then
830 AC_DEFINE(HAVE_GETPAGESIZE, 1, [Whether we have getpagesize()])
833 AC_CHECK_HEADER([fenv.h],
834 [AC_DEFINE(HAVE_FENV_H, [1], [Define to 1 if we have <fenv.h>])])
836 AC_CHECK_LIB(m, feenableexcept, have_feenableexcept=yes, have_feenableexcept=no)
837 if test x$have_feenableexcept = xyes; then
838 AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()])
841 AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
842 AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
843 if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then
844 AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Whether we have gettimeofday()])
847 dnl =====================================
848 dnl Check for missing sqrtf() as, e.g., for Solaris 9
850 AC_SEARCH_LIBS([sqrtf], [m], [],
851 [AC_DEFINE([sqrtf], [sqrt],
852 [Define to sqrt if you do not have the `sqrtf' function.])])
854 dnl =====================================
855 dnl Thread local storage
857 AC_MSG_CHECKING(for thread local storage (TLS) support)
858 AC_CACHE_VAL(ac_cv_tls, [
860 keywords="__thread __declspec(thread)"
861 for kw in $keywords ; do
863 #if defined(__MINGW32__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
864 #error This MinGW version has broken __thread support
867 #error OpenBSD has broken __thread support
870 int $kw test;], [], [ac_cv_tls=$kw; break])
873 AC_MSG_RESULT($ac_cv_tls)
875 if test "$ac_cv_tls" != "none"; then
876 AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [The compiler supported TLS storage class])
883 m4_define([pthread_test_program],AC_LANG_SOURCE([[dnl
887 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
888 static pthread_key_t key;
893 pthread_key_create (&key, NULL);
901 if (pthread_once (&once_control, make_key) != 0)
907 value = pthread_getspecific (key);
910 value = malloc (100);
911 pthread_setspecific (key, value);
918 AC_DEFUN([PIXMAN_CHECK_PTHREAD],[dnl
919 if test "z$support_for_pthread_setspecific" != "zyes"; then
920 PIXMAN_LINK_WITH_ENV(
921 [$1], [pthread_test_program],
922 [PTHREAD_CFLAGS="$CFLAGS"
924 PTHREAD_LDFLAGS="$LDFLAGS"
925 support_for_pthread_setspecific=yes])
929 if test $ac_cv_tls = none ; then
930 support_for_pthread_setspecific=no
932 AC_MSG_CHECKING(for pthread_setspecific)
934 PIXMAN_CHECK_PTHREAD([CFLAGS="-pthread"; LDFLAGS="-pthread"])
935 PIXMAN_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LIBS="-lpthread"])
936 PIXMAN_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LDFLAGS="-lroot"])
938 if test $support_for_pthread_setspecific = yes; then
939 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
940 AC_DEFINE([HAVE_PTHREAD_SETSPECIFIC], [], [Whether pthread_setspecific() is supported])
943 AC_MSG_RESULT($support_for_pthread_setspecific);
946 AC_SUBST(TOOLCHAIN_SUPPORTS__THREAD)
947 AC_SUBST(HAVE_PTHREAD_SETSPECIFIC)
948 AC_SUBST(PTHREAD_LDFLAGS)
949 AC_SUBST(PTHREAD_LIBS)
951 dnl =====================================
952 dnl __attribute__((constructor))
954 support_for_attribute_constructor=no
956 AC_MSG_CHECKING(for __attribute__((constructor)))
957 AC_LINK_IFELSE([AC_LANG_SOURCE([[
958 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
959 /* attribute 'constructor' is supported since gcc 2.7, but some compilers
960 * may only pretend to be gcc, so let's try to actually use it
963 static void __attribute__((constructor)) constructor_function () { x = 0; }
964 int main (void) { return x; }
966 #error not gcc or gcc version is older than 2.7
968 ]])], support_for_attribute_constructor=yes)
970 if test x$support_for_attribute_constructor = xyes; then
971 AC_DEFINE([TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR],
972 [],[Whether the tool chain supports __attribute__((constructor))])
975 AC_MSG_RESULT($support_for_attribute_constructor)
976 AC_SUBST(TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR)
978 dnl =====================================
981 support_for_float128=no
983 AC_MSG_CHECKING(for __float128)
984 AC_LINK_IFELSE([AC_LANG_SOURCE([[
985 __float128 a = 1.0Q, b = 2.0Q; int main (void) { return a + b; }
986 ]])], support_for_float128=yes)
988 if test x$support_for_float128 = xyes; then
989 AC_DEFINE([HAVE_FLOAT128], [], [Whether the tool chain supports __float128])
992 AC_MSG_RESULT($support_for_float128)
994 dnl ==================
997 AC_ARG_ENABLE(libpng, AS_HELP_STRING([--enable-libpng], [Build support for libpng (default: auto)]),
998 [have_libpng=$enableval], [have_libpng=auto])
1000 case x$have_libpng in
1001 xyes) PKG_CHECK_MODULES(PNG, [libpng]) ;;
1003 *) PKG_CHECK_MODULES(PNG, [libpng], have_libpng=yes, have_libpng=no) ;;
1006 if test x$have_libpng = xyes; then
1007 AC_DEFINE([HAVE_LIBPNG], [1], [Whether we have libpng])
1010 AC_SUBST(HAVE_LIBPNG)
1012 AC_OUTPUT([pixman-1.pc
1013 pixman-1-uninstalled.pc
1016 pixman/pixman-version.h
1020 m4_if(m4_eval(pixman_minor % 2), [1], [
1022 echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
1024 echo " Thanks for testing this development snapshot of pixman. Please"
1025 echo " report any problems you find, either by sending email to "
1027 echo " pixman@lists.freedesktop.org"
1029 echo " or by filing a bug at "
1031 echo " https://bugs.freedesktop.org/enter_bug.cgi?product=pixman "
1033 echo " If you are looking for a stable release of pixman, please note "
1034 echo " that stable releases have _even_ minor version numbers. Ie., "
1035 echo " pixman-0.]m4_eval(pixman_minor & ~1)[.x are stable releases, whereas pixman-$PIXMAN_VERSION_MAJOR.$PIXMAN_VERSION_MINOR.$PIXMAN_VERSION_MICRO is a "
1036 echo " development snapshot that may contain bugs and experimental "
1039 echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"