John Reck | 1176bda | 2013-07-25 15:07:40 -0700 | [diff] [blame] | 1 | dnl Copyright 2005 Red Hat, Inc. |
| 2 | dnl |
| 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. |
| 12 | dnl |
| 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. |
| 20 | dnl |
| 21 | dnl Process this file with autoconf to create configure. |
| 22 | |
| 23 | AC_PREREQ([2.57]) |
| 24 | |
| 25 | # Pixman versioning scheme |
| 26 | # |
| 27 | # - The version in git has an odd MICRO version number |
| 28 | # |
| 29 | # - Released versions, both development and stable, have an |
| 30 | # even MICRO version number |
| 31 | # |
| 32 | # - Released development versions have an odd MINOR number |
| 33 | # |
| 34 | # - Released stable versions have an even MINOR number |
| 35 | # |
| 36 | # - Versions that break ABI must have a new MAJOR number |
| 37 | # |
| 38 | # - If you break the ABI, then at least this must be done: |
| 39 | # |
| 40 | # - increment MAJOR |
| 41 | # |
| 42 | # - In the first development release where you break ABI, find |
| 43 | # all instances of "pixman-n" and change them to pixman-(n+1) |
| 44 | # |
| 45 | # This needs to be done at least in |
| 46 | # configure.ac |
| 47 | # all Makefile.am's |
| 48 | # pixman-n.pc.in |
| 49 | # |
| 50 | # This ensures that binary incompatible versions can be installed |
| 51 | # in parallel. See http://www106.pair.com/rhp/parallel.html for |
| 52 | # more information |
| 53 | # |
| 54 | |
| 55 | m4_define([pixman_major], 0) |
| 56 | m4_define([pixman_minor], 30) |
| 57 | m4_define([pixman_micro], 0) |
| 58 | |
| 59 | m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro]) |
| 60 | |
| 61 | AC_INIT(pixman, pixman_version, [pixman@lists.freedesktop.org], pixman) |
| 62 | AM_INIT_AUTOMAKE([foreign dist-bzip2]) |
| 63 | |
| 64 | # Suppress verbose compile lines |
| 65 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 66 | |
| 67 | AC_CONFIG_HEADERS(config.h) |
| 68 | |
| 69 | AC_CANONICAL_HOST |
| 70 | |
| 71 | test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS. |
| 72 | |
| 73 | AC_PROG_CC |
| 74 | AM_PROG_AS |
| 75 | AC_PROG_LIBTOOL |
| 76 | AC_CHECK_FUNCS([getisax]) |
| 77 | AC_C_BIGENDIAN |
| 78 | AC_C_INLINE |
| 79 | |
| 80 | dnl PIXMAN_LINK_WITH_ENV(env-setup, program, true-action, false-action) |
| 81 | dnl |
| 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 |
| 85 | save_CFLAGS="$CFLAGS" |
| 86 | save_LDFLAGS="$LDFLAGS" |
| 87 | save_LIBS="$LIBS" |
| 88 | CFLAGS="" |
| 89 | LDFLAGS="" |
| 90 | LIBS="" |
| 91 | $1 |
| 92 | CFLAGS="$save_CFLAGS $CFLAGS" |
| 93 | LDFLAGS="$save_LDFLAGS $LDFLAGS" |
| 94 | LIBS="$save_LIBS $LIBS" |
| 95 | AC_LINK_IFELSE( |
| 96 | [AC_LANG_SOURCE([$2])], |
| 97 | [pixman_cc_stderr=`test -f conftest.err && cat conftest.err` |
| 98 | pixman_cc_flag=yes], |
| 99 | [pixman_cc_stderr=`test -f conftest.err && cat conftest.err` |
| 100 | pixman_cc_flag=no]) |
| 101 | |
| 102 | if test "x$pixman_cc_stderr" != "x"; then |
| 103 | pixman_cc_flag=no |
| 104 | fi |
| 105 | |
| 106 | if test "x$pixman_cc_flag" = "xyes"; then |
| 107 | ifelse([$3], , :, [$3]) |
| 108 | else |
| 109 | ifelse([$4], , :, [$4]) |
| 110 | fi |
| 111 | CFLAGS="$save_CFLAGS" |
| 112 | LDFLAGS="$save_LDFLAGS" |
| 113 | LIBS="$save_LIBS" |
| 114 | ]) |
| 115 | |
| 116 | dnl Find a -Werror for catching warnings. |
| 117 | WERROR= |
| 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( |
| 122 | [CFLAGS=$w], |
| 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) |
| 126 | fi |
| 127 | done |
| 128 | |
| 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"], |
| 135 | [$2 |
| 136 | int main(int c, char **v) { (void)c; (void)v; return 0; } |
| 137 | ], |
| 138 | [_yesno=yes], |
| 139 | [_yesno=no]) |
| 140 | if test "x$_yesno" = xyes; then |
| 141 | CFLAGS="$CFLAGS $1" |
| 142 | fi |
| 143 | AC_MSG_RESULT($_yesno) |
| 144 | ]) |
| 145 | |
| 146 | AC_CHECK_SIZEOF(long) |
| 147 | |
| 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"]) |
| 151 | |
| 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 |
| 154 | # has set CFLAGS. |
| 155 | if test $SUNCC = yes && \ |
| 156 | test "x$test_CFLAGS" = "x" && \ |
| 157 | test "$CFLAGS" = "-g" |
| 158 | then |
| 159 | CFLAGS="-O -g" |
| 160 | fi |
| 161 | |
| 162 | # |
| 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: |
| 165 | # |
| 166 | # pixman-$(pixman_major).0.minor.micro |
| 167 | # |
| 168 | m4_define([lt_current], [pixman_minor]) |
| 169 | m4_define([lt_revision], [pixman_micro]) |
| 170 | m4_define([lt_age], [pixman_minor]) |
| 171 | |
| 172 | LT_VERSION_INFO="lt_current:lt_revision:lt_age" |
| 173 | |
| 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) |
| 180 | |
| 181 | AC_SUBST(LT_VERSION_INFO) |
| 182 | |
| 183 | # Check for dependencies |
| 184 | |
| 185 | PIXMAN_CHECK_CFLAG([-Wall]) |
| 186 | PIXMAN_CHECK_CFLAG([-fno-strict-aliasing]) |
| 187 | |
| 188 | dnl ========================================================================= |
| 189 | dnl OpenMP for the test suite? |
| 190 | dnl |
| 191 | |
| 192 | # Check for OpenMP support only when autoconf support that (require autoconf >=2.62) |
| 193 | OPENMP_CFLAGS= |
| 194 | m4_ifdef([AC_OPENMP], [AC_OPENMP]) |
| 195 | |
| 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]) |
| 198 | fi |
| 199 | |
| 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 |
| 205 | #include <stdio.h> |
| 206 | |
| 207 | extern unsigned int lcg_seed; |
| 208 | #pragma omp threadprivate(lcg_seed) |
| 209 | unsigned int lcg_seed; |
| 210 | |
| 211 | unsigned function(unsigned a, unsigned b) |
| 212 | { |
| 213 | lcg_seed ^= b; |
| 214 | return ((a + b) ^ a ) + lcg_seed; |
| 215 | } |
| 216 | |
| 217 | int main(int argc, char **argv) |
| 218 | { |
| 219 | int i; |
| 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++) |
| 228 | { |
| 229 | unsigned crc = test_function (i, 0); |
| 230 | if (verbose) |
| 231 | printf ("%d: %08X\n", i, crc); |
| 232 | checksum += crc; |
| 233 | } |
| 234 | printf("%u\n", checksum); |
| 235 | return 0; |
| 236 | } |
| 237 | ]) |
| 238 | |
| 239 | PIXMAN_LINK_WITH_ENV( |
| 240 | [CFLAGS="$OPENMP_CFLAGS" LDFLAGS="$OPENMP_CFLAGS"], |
| 241 | [openmp_test_program], |
| 242 | [have_openmp=yes], |
| 243 | [have_openmp=no]) |
| 244 | if test "x$have_openmp" = "xyes" ; then |
| 245 | AC_DEFINE(USE_OPENMP, 1, [use OpenMP in the test suite]) |
| 246 | fi |
| 247 | fi |
| 248 | AC_SUBST(OPENMP_CFLAGS) |
| 249 | |
| 250 | dnl ========================================================================= |
| 251 | dnl -fvisibility stuff |
| 252 | |
| 253 | PIXMAN_CHECK_CFLAG([-fvisibility=hidden], [dnl |
| 254 | #if defined(__GNUC__) && (__GNUC__ >= 4) |
| 255 | #ifdef _WIN32 |
| 256 | #error Have -fvisibility but it is ignored and generates a warning |
| 257 | #endif |
| 258 | #else |
| 259 | #error Need GCC 4.0 for visibility |
| 260 | #endif |
| 261 | ]) |
| 262 | |
| 263 | PIXMAN_CHECK_CFLAG([-xldscope=hidden], [dnl |
| 264 | #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) |
| 265 | #else |
| 266 | #error Need Sun Studio 8 for visibility |
| 267 | #endif |
| 268 | ]) |
| 269 | |
| 270 | dnl =========================================================================== |
| 271 | dnl Check for Loongson Multimedia Instructions |
| 272 | |
| 273 | if test "x$LS_CFLAGS" = "x" ; then |
| 274 | LS_CFLAGS="-march=loongson2f" |
| 275 | fi |
| 276 | |
| 277 | have_loongson_mmi=no |
| 278 | AC_MSG_CHECKING(whether to use Loongson MMI assembler) |
| 279 | |
| 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" |
| 285 | #endif |
| 286 | #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) |
| 287 | #error "Need GCC >= 4.4 for Loongson MMI compilation" |
| 288 | #endif |
| 289 | #include "pixman/loongson-mmintrin.h" |
| 290 | int main () { |
| 291 | union { |
| 292 | __m64 v; |
| 293 | char c[8]; |
| 294 | } a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} }; |
| 295 | int b = 4; |
| 296 | __m64 c = _mm_srli_pi16 (a.v, b); |
| 297 | return 0; |
| 298 | }]])], have_loongson_mmi=yes) |
| 299 | CFLAGS=$xserver_save_CFLAGS |
| 300 | |
| 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]) |
| 305 | |
| 306 | if test $enable_loongson_mmi = no ; then |
| 307 | have_loongson_mmi=disabled |
| 308 | fi |
| 309 | |
| 310 | if test $have_loongson_mmi = yes ; then |
| 311 | AC_DEFINE(USE_LOONGSON_MMI, 1, [use Loongson Multimedia Instructions]) |
| 312 | else |
| 313 | LS_CFLAGS= |
| 314 | fi |
| 315 | |
| 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]) |
| 319 | fi |
| 320 | |
| 321 | AM_CONDITIONAL(USE_LOONGSON_MMI, test $have_loongson_mmi = yes) |
| 322 | |
| 323 | dnl =========================================================================== |
| 324 | dnl Check for MMX |
| 325 | |
| 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" |
| 333 | fi |
| 334 | else |
| 335 | MMX_CFLAGS="-mmmx -Winline" |
| 336 | fi |
| 337 | fi |
| 338 | |
| 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" |
| 346 | #endif |
| 347 | #include <mmintrin.h> |
| 348 | int main () { |
| 349 | __m64 v = _mm_cvtsi32_si64 (1); |
| 350 | __m64 w; |
| 351 | |
| 352 | /* Some versions of clang will choke on K */ |
| 353 | asm ("pshufw %2, %1, %0\n\t" |
| 354 | : "=y" (w) |
| 355 | : "y" (v), "K" (5) |
| 356 | ); |
| 357 | |
| 358 | return _mm_cvtsi64_si32 (v); |
| 359 | }]])], have_mmx_intrinsics=yes) |
| 360 | CFLAGS=$xserver_save_CFLAGS |
| 361 | |
| 362 | AC_ARG_ENABLE(mmx, |
| 363 | [AC_HELP_STRING([--disable-mmx], |
| 364 | [disable x86 MMX fast paths])], |
| 365 | [enable_mmx=$enableval], [enable_mmx=auto]) |
| 366 | |
| 367 | if test $enable_mmx = no ; then |
| 368 | have_mmx_intrinsics=disabled |
| 369 | fi |
| 370 | |
| 371 | if test $have_mmx_intrinsics = yes ; then |
| 372 | AC_DEFINE(USE_X86_MMX, 1, [use x86 MMX compiler intrinsics]) |
| 373 | else |
| 374 | MMX_CFLAGS= |
| 375 | fi |
| 376 | |
| 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]) |
| 380 | fi |
| 381 | |
| 382 | AM_CONDITIONAL(USE_X86_MMX, test $have_mmx_intrinsics = yes) |
| 383 | |
| 384 | dnl =========================================================================== |
| 385 | dnl Check for SSE2 |
| 386 | |
| 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" |
| 392 | fi |
| 393 | else |
| 394 | SSE2_CFLAGS="-msse2 -Winline" |
| 395 | fi |
| 396 | fi |
| 397 | |
| 398 | have_sse2_intrinsics=no |
| 399 | AC_MSG_CHECKING(whether to use SSE2 intrinsics) |
| 400 | xserver_save_CFLAGS=$CFLAGS |
| 401 | CFLAGS="$SSE2_CFLAGS $CFLAGS" |
| 402 | |
| 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" |
| 407 | # endif |
| 408 | #endif |
| 409 | #include <mmintrin.h> |
| 410 | #include <xmmintrin.h> |
| 411 | #include <emmintrin.h> |
| 412 | int main () { |
| 413 | __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c; |
| 414 | c = _mm_xor_si128 (a, b); |
| 415 | return 0; |
| 416 | }]])], have_sse2_intrinsics=yes) |
| 417 | CFLAGS=$xserver_save_CFLAGS |
| 418 | |
| 419 | AC_ARG_ENABLE(sse2, |
| 420 | [AC_HELP_STRING([--disable-sse2], |
| 421 | [disable SSE2 fast paths])], |
| 422 | [enable_sse2=$enableval], [enable_sse2=auto]) |
| 423 | |
| 424 | if test $enable_sse2 = no ; then |
| 425 | have_sse2_intrinsics=disabled |
| 426 | fi |
| 427 | |
| 428 | if test $have_sse2_intrinsics = yes ; then |
| 429 | AC_DEFINE(USE_SSE2, 1, [use SSE2 compiler intrinsics]) |
| 430 | fi |
| 431 | |
| 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]) |
| 435 | fi |
| 436 | |
| 437 | AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes) |
| 438 | |
| 439 | dnl =========================================================================== |
| 440 | dnl Other special flags needed when building code using MMX or SSE instructions |
| 441 | case $host_os in |
| 442 | solaris*) |
| 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 |
| 448 | use_hwcap_mapfile=no |
| 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, |
| 455 | HWCAP_LDFLAGS="") |
| 456 | LDFLAGS="$hwcap_save_LDFLAGS" |
| 457 | AC_MSG_RESULT($use_hwcap_mapfile) |
| 458 | fi |
| 459 | if test "x$MMX_LDFLAGS" = "x" ; then |
| 460 | MMX_LDFLAGS="$HWCAP_LDFLAGS" |
| 461 | fi |
| 462 | if test "x$SSE2_LDFLAGS" = "x" ; then |
| 463 | SSE2_LDFLAGS="$HWCAP_LDFLAGS" |
| 464 | fi |
| 465 | ;; |
| 466 | esac |
| 467 | |
| 468 | AC_SUBST(LS_CFLAGS) |
| 469 | AC_SUBST(IWMMXT_CFLAGS) |
| 470 | AC_SUBST(MMX_CFLAGS) |
| 471 | AC_SUBST(MMX_LDFLAGS) |
| 472 | AC_SUBST(SSE2_CFLAGS) |
| 473 | AC_SUBST(SSE2_LDFLAGS) |
| 474 | |
| 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" |
| 479 | else |
| 480 | VMX_CFLAGS="-maltivec -mabi=altivec" |
| 481 | fi |
| 482 | |
| 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" |
| 490 | #endif |
| 491 | #include <altivec.h> |
| 492 | int main () { |
| 493 | vector unsigned int v = vec_splat_u32 (1); |
| 494 | v = vec_sub (v, v); |
| 495 | return 0; |
| 496 | }]])], have_vmx_intrinsics=yes) |
| 497 | CFLAGS=$xserver_save_CFLAGS |
| 498 | |
| 499 | AC_ARG_ENABLE(vmx, |
| 500 | [AC_HELP_STRING([--disable-vmx], |
| 501 | [disable VMX fast paths])], |
| 502 | [enable_vmx=$enableval], [enable_vmx=auto]) |
| 503 | |
| 504 | if test $enable_vmx = no ; then |
| 505 | have_vmx_intrinsics=disabled |
| 506 | fi |
| 507 | |
| 508 | if test $have_vmx_intrinsics = yes ; then |
| 509 | AC_DEFINE(USE_VMX, 1, [use VMX compiler intrinsics]) |
| 510 | else |
| 511 | VMX_CFLAGS= |
| 512 | fi |
| 513 | |
| 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]) |
| 517 | fi |
| 518 | |
| 519 | AC_SUBST(VMX_CFLAGS) |
| 520 | |
| 521 | AM_CONDITIONAL(USE_VMX, test $have_vmx_intrinsics = yes) |
| 522 | |
| 523 | dnl ========================================================================== |
| 524 | dnl Check if assembler is gas compatible and supports ARM SIMD instructions |
| 525 | have_arm_simd=no |
| 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([[ |
| 530 | .text |
| 531 | .arch armv6 |
| 532 | .object_arch armv4 |
| 533 | .arm |
| 534 | .altmacro |
| 535 | #ifndef __ARM_EABI__ |
| 536 | #error EABI is required (to be sure that calling conventions are compatible) |
| 537 | #endif |
| 538 | pld [r0] |
| 539 | uqadd8 r0, r0, r0]])], have_arm_simd=yes) |
| 540 | CFLAGS=$xserver_save_CFLAGS |
| 541 | |
| 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]) |
| 546 | |
| 547 | if test $enable_arm_simd = no ; then |
| 548 | have_arm_simd=disabled |
| 549 | fi |
| 550 | |
| 551 | if test $have_arm_simd = yes ; then |
| 552 | AC_DEFINE(USE_ARM_SIMD, 1, [use ARM SIMD assembly optimizations]) |
| 553 | fi |
| 554 | |
| 555 | AM_CONDITIONAL(USE_ARM_SIMD, test $have_arm_simd = yes) |
| 556 | |
| 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]) |
| 560 | fi |
| 561 | |
| 562 | dnl ========================================================================== |
| 563 | dnl Check if assembler is gas compatible and supports NEON instructions |
| 564 | have_arm_neon=no |
| 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([[ |
| 569 | .text |
| 570 | .fpu neon |
| 571 | .arch armv7a |
| 572 | .object_arch armv4 |
| 573 | .eabi_attribute 10, 0 |
| 574 | .arm |
| 575 | .altmacro |
| 576 | #ifndef __ARM_EABI__ |
| 577 | #error EABI is required (to be sure that calling conventions are compatible) |
| 578 | #endif |
| 579 | pld [r0] |
| 580 | vmovn.u16 d0, q0]])], have_arm_neon=yes) |
| 581 | CFLAGS=$xserver_save_CFLAGS |
| 582 | |
| 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]) |
| 587 | |
| 588 | if test $enable_arm_neon = no ; then |
| 589 | have_arm_neon=disabled |
| 590 | fi |
| 591 | |
| 592 | if test $have_arm_neon = yes ; then |
| 593 | AC_DEFINE(USE_ARM_NEON, 1, [use ARM NEON assembly optimizations]) |
| 594 | fi |
| 595 | |
| 596 | AM_CONDITIONAL(USE_ARM_NEON, test $have_arm_neon = yes) |
| 597 | |
| 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]) |
| 601 | fi |
| 602 | |
| 603 | dnl =========================================================================== |
| 604 | dnl Check for IWMMXT |
| 605 | |
| 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]) |
| 610 | |
| 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]) |
| 615 | |
| 616 | if test "x$IWMMXT_CFLAGS" = "x" ; then |
| 617 | IWMMXT_CFLAGS="-flax-vector-conversions -Winline -march=iwmmxt" |
| 618 | if test $enable_iwmmxt2 != no ; then |
| 619 | IWMMXT_CFLAGS+="2" |
| 620 | fi |
| 621 | fi |
| 622 | |
| 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([[ |
| 628 | #ifndef __arm__ |
| 629 | #error "IWMMXT is only available on ARM" |
| 630 | #endif |
| 631 | #ifndef __IWMMXT__ |
| 632 | #error "IWMMXT not enabled (with -march=iwmmxt)" |
| 633 | #endif |
| 634 | #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)) |
| 635 | #error "Need GCC >= 4.5 for IWMMXT intrinsics" |
| 636 | #endif |
| 637 | #include <mmintrin.h> |
| 638 | int main () { |
| 639 | union { |
| 640 | __m64 v; |
| 641 | char c[8]; |
| 642 | } a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} }; |
| 643 | int b = 4; |
| 644 | __m64 c = _mm_srli_si64 (a.v, b); |
| 645 | }]])], have_iwmmxt_intrinsics=yes) |
| 646 | CFLAGS=$xserver_save_CFLAGS |
| 647 | |
| 648 | if test $enable_iwmmxt = no ; then |
| 649 | have_iwmmxt_intrinsics=disabled |
| 650 | fi |
| 651 | |
| 652 | if test $have_iwmmxt_intrinsics = yes ; then |
| 653 | AC_DEFINE(USE_ARM_IWMMXT, 1, [use ARM IWMMXT compiler intrinsics]) |
| 654 | else |
| 655 | IWMMXT_CFLAGS= |
| 656 | fi |
| 657 | |
| 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]) |
| 661 | fi |
| 662 | |
| 663 | AM_CONDITIONAL(USE_ARM_IWMMXT, test $have_iwmmxt_intrinsics = yes) |
| 664 | |
| 665 | dnl ========================================================================== |
| 666 | dnl Check if assembler is gas compatible and supports MIPS DSPr2 instructions |
| 667 | |
| 668 | have_mips_dspr2=no |
| 669 | AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler) |
| 670 | xserver_save_CFLAGS=$CFLAGS |
| 671 | CFLAGS="-mdspr2 $CFLAGS" |
| 672 | |
| 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. |
| 676 | #endif |
| 677 | int |
| 678 | main () |
| 679 | { |
| 680 | int c = 0, a = 0, b = 0; |
| 681 | __asm__ __volatile__ ( |
| 682 | "precr.qb.ph %[c], %[a], %[b] \n\t" |
| 683 | : [c] "=r" (c) |
| 684 | : [a] "r" (a), [b] "r" (b) |
| 685 | ); |
| 686 | return c; |
| 687 | }]])], have_mips_dspr2=yes) |
| 688 | CFLAGS=$xserver_save_CFLAGS |
| 689 | |
| 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]) |
| 694 | |
| 695 | if test $enable_mips_dspr2 = no ; then |
| 696 | have_mips_dspr2=disabled |
| 697 | fi |
| 698 | |
| 699 | if test $have_mips_dspr2 = yes ; then |
| 700 | AC_DEFINE(USE_MIPS_DSPR2, 1, [use MIPS DSPr2 assembly optimizations]) |
| 701 | fi |
| 702 | |
| 703 | AM_CONDITIONAL(USE_MIPS_DSPR2, test $have_mips_dspr2 = yes) |
| 704 | |
| 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]) |
| 708 | fi |
| 709 | |
| 710 | dnl ========================================================================================= |
| 711 | dnl Check for GNU-style inline assembly support |
| 712 | |
| 713 | have_gcc_inline_asm=no |
| 714 | AC_MSG_CHECKING(whether to use GNU-style inline assembler) |
| 715 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 716 | int main () { |
| 717 | /* Most modern architectures have a NOP instruction, so this is a fairly generic test. */ |
| 718 | asm volatile ( "\tnop\n" : : : "cc", "memory" ); |
| 719 | return 0; |
| 720 | }]])], have_gcc_inline_asm=yes) |
| 721 | |
| 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]) |
| 726 | |
| 727 | if test $enable_gcc_inline_asm = no ; then |
| 728 | have_gcc_inline_asm=disabled |
| 729 | fi |
| 730 | |
| 731 | if test $have_gcc_inline_asm = yes ; then |
| 732 | AC_DEFINE(USE_GCC_INLINE_ASM, 1, [use GNU-style inline assembler]) |
| 733 | fi |
| 734 | |
| 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]) |
| 738 | fi |
| 739 | |
| 740 | AM_CONDITIONAL(USE_GCC_INLINE_ASM, test $have_gcc_inline_asm = yes) |
| 741 | |
| 742 | dnl ============================================== |
| 743 | dnl Static test programs |
| 744 | |
| 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]) |
| 749 | |
| 750 | TESTPROGS_EXTRA_LDFLAGS= |
| 751 | if test "x$enable_static_testprogs" = "xyes" ; then |
| 752 | TESTPROGS_EXTRA_LDFLAGS="-all-static" |
| 753 | fi |
| 754 | AC_SUBST(TESTPROGS_EXTRA_LDFLAGS) |
| 755 | |
| 756 | dnl ============================================== |
| 757 | dnl Timers |
| 758 | |
| 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]) |
| 763 | |
| 764 | if test $enable_timers = yes ; then |
| 765 | AC_DEFINE(PIXMAN_TIMERS, 1, [enable TIMER_BEGIN/TIMER_END macros]) |
| 766 | fi |
| 767 | AC_SUBST(PIXMAN_TIMERS) |
| 768 | |
| 769 | dnl =================================== |
| 770 | dnl GTK+ |
| 771 | |
| 772 | AC_ARG_ENABLE(gtk, |
| 773 | [AC_HELP_STRING([--enable-gtk], |
| 774 | [enable tests using GTK+ [default=auto]])], |
| 775 | [enable_gtk=$enableval], [enable_gtk=auto]) |
| 776 | |
| 777 | PKG_PROG_PKG_CONFIG |
| 778 | |
| 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]) |
| 782 | fi |
| 783 | |
| 784 | if test $enable_gtk = auto ; then |
| 785 | AC_CHECK_LIB([pixman-1], [pixman_version_string], [enable_gtk=auto], [enable_gtk=no]) |
| 786 | fi |
| 787 | |
| 788 | if test $enable_gtk = auto ; then |
| 789 | PKG_CHECK_MODULES(GTK, [gtk+-2.0 pixman-1], [enable_gtk=yes], [enable_gtk=no]) |
| 790 | fi |
| 791 | |
| 792 | AM_CONDITIONAL(HAVE_GTK, [test "x$enable_gtk" = xyes]) |
| 793 | |
| 794 | AC_SUBST(GTK_CFLAGS) |
| 795 | AC_SUBST(GTK_LIBS) |
| 796 | |
| 797 | dnl ===================================== |
| 798 | dnl posix_memalign, sigaction, alarm, gettimeofday |
| 799 | |
| 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()]) |
| 803 | fi |
| 804 | |
| 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()]) |
| 808 | fi |
| 809 | |
| 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()]) |
| 813 | fi |
| 814 | |
| 815 | AC_CHECK_HEADER([sys/mman.h], |
| 816 | [AC_DEFINE(HAVE_SYS_MMAN_H, [1], [Define to 1 if we have <sys/mman.h>])]) |
| 817 | |
| 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()]) |
| 821 | fi |
| 822 | |
| 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()]) |
| 826 | fi |
| 827 | |
| 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()]) |
| 831 | fi |
| 832 | |
| 833 | AC_CHECK_HEADER([fenv.h], |
| 834 | [AC_DEFINE(HAVE_FENV_H, [1], [Define to 1 if we have <fenv.h>])]) |
| 835 | |
| 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()]) |
| 839 | fi |
| 840 | |
| 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()]) |
| 845 | fi |
| 846 | |
| 847 | dnl ===================================== |
| 848 | dnl Check for missing sqrtf() as, e.g., for Solaris 9 |
| 849 | |
| 850 | AC_SEARCH_LIBS([sqrtf], [m], [], |
| 851 | [AC_DEFINE([sqrtf], [sqrt], |
| 852 | [Define to sqrt if you do not have the `sqrtf' function.])]) |
| 853 | |
| 854 | dnl ===================================== |
| 855 | dnl Thread local storage |
| 856 | |
| 857 | AC_MSG_CHECKING(for thread local storage (TLS) support) |
| 858 | AC_CACHE_VAL(ac_cv_tls, [ |
| 859 | ac_cv_tls=none |
| 860 | keywords="__thread __declspec(thread)" |
| 861 | for kw in $keywords ; do |
| 862 | AC_TRY_COMPILE([ |
| 863 | #if defined(__MINGW32__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) |
| 864 | #error This MinGW version has broken __thread support |
| 865 | #endif |
| 866 | #ifdef __OpenBSD__ |
| 867 | #error OpenBSD has broken __thread support |
| 868 | #endif |
| 869 | |
| 870 | int $kw test;], [], [ac_cv_tls=$kw; break]) |
| 871 | done |
| 872 | ]) |
| 873 | AC_MSG_RESULT($ac_cv_tls) |
| 874 | |
| 875 | if test "$ac_cv_tls" != "none"; then |
| 876 | AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [The compiler supported TLS storage class]) |
| 877 | fi |
| 878 | |
| 879 | dnl |
| 880 | dnl posix tls |
| 881 | dnl |
| 882 | |
| 883 | m4_define([pthread_test_program],AC_LANG_SOURCE([[dnl |
| 884 | #include <stdlib.h> |
| 885 | #include <pthread.h> |
| 886 | |
| 887 | static pthread_once_t once_control = PTHREAD_ONCE_INIT; |
| 888 | static pthread_key_t key; |
| 889 | |
| 890 | static void |
| 891 | make_key (void) |
| 892 | { |
| 893 | pthread_key_create (&key, NULL); |
| 894 | } |
| 895 | |
| 896 | int |
| 897 | main () |
| 898 | { |
| 899 | void *value = NULL; |
| 900 | |
| 901 | if (pthread_once (&once_control, make_key) != 0) |
| 902 | { |
| 903 | value = NULL; |
| 904 | } |
| 905 | else |
| 906 | { |
| 907 | value = pthread_getspecific (key); |
| 908 | if (!value) |
| 909 | { |
| 910 | value = malloc (100); |
| 911 | pthread_setspecific (key, value); |
| 912 | } |
| 913 | } |
| 914 | return 0; |
| 915 | } |
| 916 | ]])) |
| 917 | |
| 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" |
| 923 | PTHREAD_LIBS="$LIBS" |
| 924 | PTHREAD_LDFLAGS="$LDFLAGS" |
| 925 | support_for_pthread_setspecific=yes]) |
| 926 | fi |
| 927 | ]) |
| 928 | |
| 929 | if test $ac_cv_tls = none ; then |
| 930 | support_for_pthread_setspecific=no |
| 931 | |
| 932 | AC_MSG_CHECKING(for pthread_setspecific) |
| 933 | |
| 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"]) |
| 937 | |
| 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]) |
| 941 | fi |
| 942 | |
| 943 | AC_MSG_RESULT($support_for_pthread_setspecific); |
| 944 | fi |
| 945 | |
| 946 | AC_SUBST(TOOLCHAIN_SUPPORTS__THREAD) |
| 947 | AC_SUBST(HAVE_PTHREAD_SETSPECIFIC) |
| 948 | AC_SUBST(PTHREAD_LDFLAGS) |
| 949 | AC_SUBST(PTHREAD_LIBS) |
| 950 | |
| 951 | dnl ===================================== |
| 952 | dnl __attribute__((constructor)) |
| 953 | |
| 954 | support_for_attribute_constructor=no |
| 955 | |
| 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 |
| 961 | */ |
| 962 | static int x = 1; |
| 963 | static void __attribute__((constructor)) constructor_function () { x = 0; } |
| 964 | int main (void) { return x; } |
| 965 | #else |
| 966 | #error not gcc or gcc version is older than 2.7 |
| 967 | #endif |
| 968 | ]])], support_for_attribute_constructor=yes) |
| 969 | |
| 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))]) |
| 973 | fi |
| 974 | |
| 975 | AC_MSG_RESULT($support_for_attribute_constructor) |
| 976 | AC_SUBST(TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR) |
| 977 | |
| 978 | dnl ===================================== |
| 979 | dnl __float128 |
| 980 | |
| 981 | support_for_float128=no |
| 982 | |
| 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) |
| 987 | |
| 988 | if test x$support_for_float128 = xyes; then |
| 989 | AC_DEFINE([HAVE_FLOAT128], [], [Whether the tool chain supports __float128]) |
| 990 | fi |
| 991 | |
| 992 | AC_MSG_RESULT($support_for_float128) |
| 993 | |
| 994 | dnl ================== |
| 995 | dnl libpng |
| 996 | |
| 997 | AC_ARG_ENABLE(libpng, AS_HELP_STRING([--enable-libpng], [Build support for libpng (default: auto)]), |
| 998 | [have_libpng=$enableval], [have_libpng=auto]) |
| 999 | |
| 1000 | case x$have_libpng in |
| 1001 | xyes) PKG_CHECK_MODULES(PNG, [libpng]) ;; |
| 1002 | xno) ;; |
| 1003 | *) PKG_CHECK_MODULES(PNG, [libpng], have_libpng=yes, have_libpng=no) ;; |
| 1004 | esac |
| 1005 | |
| 1006 | if test x$have_libpng = xyes; then |
| 1007 | AC_DEFINE([HAVE_LIBPNG], [1], [Whether we have libpng]) |
| 1008 | fi |
| 1009 | |
| 1010 | AC_SUBST(HAVE_LIBPNG) |
| 1011 | |
| 1012 | AC_OUTPUT([pixman-1.pc |
| 1013 | pixman-1-uninstalled.pc |
| 1014 | Makefile |
| 1015 | pixman/Makefile |
| 1016 | pixman/pixman-version.h |
| 1017 | demos/Makefile |
| 1018 | test/Makefile]) |
| 1019 | |
| 1020 | m4_if(m4_eval(pixman_minor % 2), [1], [ |
| 1021 | echo |
| 1022 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" |
| 1023 | echo |
| 1024 | echo " Thanks for testing this development snapshot of pixman. Please" |
| 1025 | echo " report any problems you find, either by sending email to " |
| 1026 | echo |
| 1027 | echo " pixman@lists.freedesktop.org" |
| 1028 | echo |
| 1029 | echo " or by filing a bug at " |
| 1030 | echo |
| 1031 | echo " https://bugs.freedesktop.org/enter_bug.cgi?product=pixman " |
| 1032 | echo |
| 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 " |
| 1037 | echo " features. " |
| 1038 | echo |
| 1039 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" |
| 1040 | echo |
| 1041 | ]) |