build: Suppress verbose compile lines
[profile/ivi/pixman.git] / configure.ac
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 even MICRO 
30 #     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], 17)
57 m4_define([pixman_micro], 1)
58
59 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
60
61 AC_INIT(pixman, pixman_version, "sandmann@daimi.au.dk", pixman)
62 AM_INIT_AUTOMAKE([dist-bzip2])
63
64 # Suppress verbose compile lines
65 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
66
67 AM_CONFIG_HEADER(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 AC_PROG_LIBTOOL
75 AC_CHECK_FUNCS([getisax])
76 AC_C_BIGENDIAN
77 AC_C_INLINE
78
79 # Checks for Sun Studio compilers
80 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
81 AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
82
83 # Default CFLAGS to -O -g rather than just the -g from AC_PROG_CC
84 # if we're using Sun Studio and neither the user nor a config.site
85 # has set CFLAGS.
86 if test $SUNCC = yes &&                 \
87    test "$test_CFLAGS" == "" &&         \
88    test "$CFLAGS" = "-g"
89 then
90   CFLAGS="-O -g"
91 fi
92
93
94 # We ignore pixman_major in the version here because the major version should
95 # always be encoded in the actual library name. Ie., the soname is:
96 #
97 #      pixman-$(pixman_major).0.minor.micro
98 #
99 m4_define([lt_current], [pixman_minor])
100 m4_define([lt_revision], [pixman_micro])
101 m4_define([lt_age], [pixman_minor])
102
103 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
104
105 PIXMAN_VERSION_MAJOR=pixman_major()
106 AC_SUBST(PIXMAN_VERSION_MAJOR)
107 PIXMAN_VERSION_MINOR=pixman_minor()
108 AC_SUBST(PIXMAN_VERSION_MINOR)
109 PIXMAN_VERSION_MICRO=pixman_micro()
110 AC_SUBST(PIXMAN_VERSION_MICRO)
111
112 AC_SUBST(LT_VERSION_INFO)
113
114 # Check for dependencies
115 #PKG_CHECK_MODULES(DEP, x11)
116
117 changequote(,)dnl
118 if test "x$GCC" = "xyes"; then
119
120   case " $CFLAGS " in
121   *[\ \ ]-Wall[\ \      ]*) ;;
122   *) CFLAGS="$CFLAGS -Wall" ;;
123   esac 
124
125   case " $CFLAGS " in
126   *[\ \ ]-fno-strict-aliasing[\ \       ]*) ;;
127   *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;;
128   esac
129
130 fi changequote([,])dnl
131
132 AC_PATH_PROG(PERL, perl, no)
133 if test "x$PERL" = xno; then
134     AC_MSG_ERROR([Perl is required to build pixman.])
135 fi
136 AC_SUBST(PERL)
137
138 dnl =========================================================================
139 dnl -fvisibility stuff
140
141 have_gcc4=no
142 AC_MSG_CHECKING(for -fvisibility)
143 AC_COMPILE_IFELSE([
144 #if defined(__GNUC__) && (__GNUC__ >= 4)
145 #else
146 error Need GCC 4.0 for visibility
147 #endif
148 int main () { return 0; } 
149 ], have_gcc4=yes)
150
151 if test "x$have_gcc4" = "xyes"; then
152    CFLAGS="$CFLAGS -fvisibility=hidden"
153 fi
154 AC_MSG_RESULT($have_gcc4)
155
156 have_sunstudio8=no
157 AC_MSG_CHECKING([for -xldscope (Sun compilers)])
158 AC_COMPILE_IFELSE([
159 #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
160 #else
161 error Need Sun Studio 8 for visibility
162 #endif
163 int main () { return 0; } 
164 ], have_sunstudio8=yes)
165
166 if test "x$have_sunstudio8" = "xyes"; then
167    CFLAGS="$CFLAGS -xldscope=hidden"
168 fi
169 AC_MSG_RESULT($have_sunstudio8)
170
171 dnl ===========================================================================
172 dnl Check for MMX
173
174 if test "x$MMX_CFLAGS" = "x" ; then
175    if test "x$SUNCC" = "xyes"; then
176       # Sun Studio doesn't have an -xarch=mmx flag, so we have to use sse
177       # but if we're building 64-bit, mmx & sse support is on by default and
178       # -xarch=sse throws an error instead
179       if test "$AMD64_ABI" = "no" ; then
180          MMX_CFLAGS="-xarch=sse"
181       fi
182    else
183       MMX_CFLAGS="-mmmx -Winline"
184    fi
185 fi
186
187 have_mmx_intrinsics=no
188 AC_MSG_CHECKING(whether to use MMX intrinsics)
189 xserver_save_CFLAGS=$CFLAGS
190 CFLAGS="$MMX_CFLAGS $CFLAGS"
191 AC_COMPILE_IFELSE([
192 #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
193 error "Need GCC >= 3.4 for MMX intrinsics"
194 #endif
195 #include <mmintrin.h>
196 int main () {
197     __m64 v = _mm_cvtsi32_si64 (1);
198     return _mm_cvtsi64_si32 (v);
199 }], have_mmx_intrinsics=yes)
200 CFLAGS=$xserver_save_CFLAGS
201
202 AC_ARG_ENABLE(mmx,
203    [AC_HELP_STRING([--disable-mmx],
204                    [disable MMX fast paths])],
205    [enable_mmx=$enableval], [enable_mmx=auto])
206
207 if test $enable_mmx = no ; then
208    have_mmx_intrinsics=disabled
209 fi
210
211 if test $have_mmx_intrinsics = yes ; then
212    AC_DEFINE(USE_MMX, 1, [use MMX compiler intrinsics])
213 else
214    MMX_CFLAGS=
215 fi
216
217 AC_MSG_RESULT($have_mmx_intrinsics)
218 if test $enable_mmx = yes && test $have_mmx_intrinsics = no ; then
219    AC_MSG_ERROR([MMX intrinsics not detected])
220 fi
221
222 AM_CONDITIONAL(USE_MMX, test $have_mmx_intrinsics = yes)
223
224 dnl ===========================================================================
225 dnl Check for SSE2
226
227 if test "x$SSE2_CFLAGS" = "x" ; then
228    if test "x$SUNCC" = "xyes"; then
229       # SSE2 is enabled by default in the Sun Studio 64-bit environment
230       if test "$AMD64_ABI" = "no" ; then
231          SSE2_CFLAGS="-xarch=sse2"
232       fi
233    else
234       SSE2_CFLAGS="-mmmx -msse2 -Winline"
235    fi
236 fi
237
238 have_sse2_intrinsics=no
239 AC_MSG_CHECKING(whether to use SSE2 intrinsics)
240 xserver_save_CFLAGS=$CFLAGS
241 CFLAGS="$SSE2_CFLAGS $CFLAGS"
242
243 AC_COMPILE_IFELSE([
244 #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
245 #   if !defined(__amd64__) && !defined(__x86_64__)
246 #      error "Need GCC >= 4.2 for SSE2 intrinsics on x86"
247 #   endif
248 #endif
249 #include <mmintrin.h>
250 #include <xmmintrin.h>
251 #include <emmintrin.h>
252 int main () {
253     __m128i a, b, c;
254         c = _mm_xor_si128 (a, b);
255     return 0;
256 }], have_sse2_intrinsics=yes)
257 CFLAGS=$xserver_save_CFLAGS
258
259 AC_ARG_ENABLE(sse2,
260    [AC_HELP_STRING([--disable-sse2],
261                    [disable SSE2 fast paths])],
262    [enable_sse2=$enableval], [enable_sse2=auto])
263
264 if test $enable_sse2 = no ; then
265    have_sse2_intrinsics=disabled
266 fi
267
268 if test $have_sse2_intrinsics = yes ; then
269    AC_DEFINE(USE_SSE2, 1, [use SSE2 compiler intrinsics])
270 fi
271
272 AC_MSG_RESULT($have_sse2_intrinsics)
273 if test $enable_sse2 = yes && test $have_sse2_intrinsics = no ; then
274    AC_MSG_ERROR([SSE2 intrinsics not detected])
275 fi
276
277 AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes)
278
279 dnl ===========================================================================
280 dnl Other special flags needed when building code using MMX or SSE instructions
281 case $host_os in
282    solaris*)
283       # When building 32-bit binaries, apply a mapfile to ensure that the
284       # binaries aren't flagged as only able to run on MMX+SSE capable CPUs
285       # since they check at runtime before using those instructions.
286       # Not all linkers grok the mapfile format so we check for that first.
287       if test "$AMD64_ABI" = "no" ; then
288          use_hwcap_mapfile=no
289          AC_MSG_CHECKING(whether to use a hardware capability map file)
290          hwcap_save_LDFLAGS="$LDFLAGS"
291          HWCAP_LDFLAGS='-Wl,-M,$(srcdir)/solaris-hwcap.mapfile'
292          LDFLAGS="$LDFLAGS -Wl,-M,pixman/solaris-hwcap.mapfile"
293          AC_LINK_IFELSE([int main() { return 0; }],
294                         use_hwcap_mapfile=yes,
295                         HWCAP_LDFLAGS="")
296          LDFLAGS="$hwcap_save_LDFLAGS"
297          AC_MSG_RESULT($use_hwcap_mapfile)
298       fi
299       if test "x$MMX_LDFLAGS" = "x" ; then
300          MMX_LDFLAGS="$HWCAP_LDFLAGS"
301       fi
302       if test "x$SSE2_LDFLAGS" = "x" ; then
303          SSE2_LDFLAGS="$HWCAP_LDFLAGS"
304       fi
305       ;;
306 esac
307
308 AC_SUBST(MMX_CFLAGS)
309 AC_SUBST(MMX_LDFLAGS)
310 AC_SUBST(SSE2_CFLAGS)
311 AC_SUBST(SSE2_LDFLAGS)
312
313 dnl ===========================================================================
314 dnl Check for VMX/Altivec
315 if test -n "`$CC -v 2>&1 | grep version | grep Apple`"; then
316     VMX_CFLAGS="-faltivec"
317 else
318     VMX_CFLAGS="-maltivec -mabi=altivec"
319 fi
320
321 have_vmx_intrinsics=no
322 AC_MSG_CHECKING(whether to use VMX/Altivec intrinsics)
323 xserver_save_CFLAGS=$CFLAGS
324 CFLAGS="$VMX_CFLAGS $CFLAGS"
325 AC_COMPILE_IFELSE([
326 #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
327 error "Need GCC >= 3.4 for sane altivec support"
328 #endif
329 #include <altivec.h>
330 int main () {
331     vector unsigned int v = vec_splat_u32 (1);
332     v = vec_sub (v, v);
333     return 0;
334 }], have_vmx_intrinsics=yes)
335 CFLAGS=$xserver_save_CFLAGS
336
337 AC_ARG_ENABLE(vmx,
338    [AC_HELP_STRING([--disable-vmx],
339                    [disable VMX fast paths])],
340    [enable_vmx=$enableval], [enable_vmx=auto])
341
342 if test $enable_vmx = no ; then
343    have_vmx_intrinsics=disabled
344 fi
345
346 if test $have_vmx_intrinsics = yes ; then
347    AC_DEFINE(USE_VMX, 1, [use VMX compiler intrinsics])
348 else
349    VMX_CFLAGS=
350 fi
351
352 AC_MSG_RESULT($have_vmx_intrinsics)
353 if test $enable_vmx = yes && test $have_vmx_intrinsics = no ; then
354    AC_MSG_ERROR([VMX intrinsics not detected])
355 fi
356
357 AC_SUBST(VMX_CFLAGS)
358
359 AM_CONDITIONAL(USE_VMX, test $have_vmx_intrinsics = yes)
360
361 dnl ===========================================================================
362 dnl Check for ARM SIMD instructions
363 ARM_SIMD_CFLAGS="-mcpu=arm1136j-s"
364
365 have_arm_simd=no
366 AC_MSG_CHECKING(whether to use ARM SIMD assembler)
367 xserver_save_CFLAGS=$CFLAGS
368 CFLAGS="$ARM_SIMD_CFLAGS $CFLAGS"
369 AC_COMPILE_IFELSE([
370 int main () {
371     asm("uqadd8 r1, r1, r2");
372     return 0;
373 }], have_arm_simd=yes)
374 CFLAGS=$xserver_save_CFLAGS
375
376 AC_ARG_ENABLE(arm-simd,
377    [AC_HELP_STRING([--disable-arm-simd],
378                    [disable ARM SIMD fast paths])],
379    [enable_arm_simd=$enableval], [enable_arm_simd=auto])
380
381 if test $enable_arm_simd = no ; then
382    have_arm_simd=disabled
383 fi
384
385 if test $have_arm_simd = yes ; then
386    AC_DEFINE(USE_ARM_SIMD, 1, [use ARM SIMD compiler intrinsics])
387 else
388    ARM_SIMD_CFLAGS=
389 fi
390
391 AC_MSG_RESULT($have_arm_simd)
392 if test $enable_arm_simd = yes && test $have_arm_simd = no ; then
393    AC_MSG_ERROR([ARM SIMD intrinsics not detected])
394 fi
395
396 AC_SUBST(ARM_SIMD_CFLAGS)
397
398 AM_CONDITIONAL(USE_ARM_SIMD, test $have_arm_simd = yes)
399
400 dnl ==========================================================================
401 dnl Check for ARM NEON instructions
402 ARM_NEON_CFLAGS="-mfpu=neon -mcpu=cortex-a8"
403
404 have_arm_neon=no
405 AC_MSG_CHECKING(whether to use ARM NEON)
406 xserver_save_CFLAGS=$CFLAGS
407 CFLAGS="$ARM_NEON_CFLAGS $CFLAGS"
408 AC_COMPILE_IFELSE([
409 #include <arm_neon.h>
410 int main () {
411     uint8x8_t neon_test=vmov_n_u8(0);
412     return 0;
413 }], have_arm_neon=yes)
414 CFLAGS=$xserver_save_CFLAGS
415
416 AC_ARG_ENABLE(arm-neon,
417    [AC_HELP_STRING([--disable-arm-neon],
418                    [disable ARM NEON fast paths])],
419    [enable_arm_neon=$enableval], [enable_arm_neon=auto])
420
421 if test $enable_arm_neon = no ; then
422    have_arm_neon=disabled
423 fi
424
425 if test $have_arm_neon = yes ; then
426    AC_DEFINE(USE_ARM_NEON, 1, [use ARM NEON compiler intrinsics])
427 else
428    ARM_NEON_CFLAGS=
429 fi
430
431 AC_SUBST(ARM_NEON_CFLAGS)
432
433 AM_CONDITIONAL(USE_ARM_NEON, test $have_arm_neon = yes)
434
435 AC_MSG_RESULT($have_arm_neon)
436 if test $enable_arm_neon = yes && test $have_arm_neon = no ; then
437    AC_MSG_ERROR([ARM NEON intrinsics not detected])
438 fi
439
440 dnl =========================================================================================
441 dnl Check for GNU-style inline assembly support
442
443 have_gcc_inline_asm=no
444 AC_MSG_CHECKING(whether to use GNU-style inline assembler)
445 AC_COMPILE_IFELSE([
446 int main () {
447     /* Most modern architectures have a NOP instruction, so this is a fairly generic test. */
448         asm volatile ( "\tnop\n" : : : "cc", "memory" );
449     return 0;
450 }], have_gcc_inline_asm=yes)
451
452 AC_ARG_ENABLE(gcc-inline-asm,
453    [AC_HELP_STRING([--disable-gcc-inline-asm],
454                    [disable GNU-style inline assembler])],
455    [enable_gcc_inline_asm=$enableval], [enable_gcc_inline_asm=auto])
456
457 if test $enable_gcc_inline_asm = no ; then
458    have_gcc_inline_asm=disabled
459 fi
460
461 if test $have_gcc_inline_asm = yes ; then
462    AC_DEFINE(USE_GCC_INLINE_ASM, 1, [use GNU-style inline assembler])
463 fi
464
465 AC_MSG_RESULT($have_gcc_inline_asm)
466 if test $enable_gcc_inline_asm = yes && test $have_gcc_inline_asm = no ; then
467    AC_MSG_ERROR([GNU-style inline assembler not detected])
468 fi
469
470 AM_CONDITIONAL(USE_GCC_INLINE_ASM, test $have_gcc_inline_asm = yes)
471
472 dnl ==============================================
473 dnl Timers
474
475 AC_ARG_ENABLE(timers,
476    [AC_HELP_STRING([--enable-timers],
477                    [enable TIMER_BEGIN and TIMER_END macros [default=no]])],
478    [enable_timers=$enableval], [enable_timers=no])
479
480 if test $enable_timers = yes ; then 
481    AC_DEFINE(PIXMAN_TIMERS, 1, [enable TIMER_BEGIN/TIMER_END macros])
482 fi
483 AC_SUBST(PIXMAN_TIMERS)
484
485 dnl ===================================
486 dnl GTK+
487
488 AC_ARG_ENABLE(gtk,
489    [AC_HELP_STRING([--enable-gtk],
490                    [enable tests using GTK+ [default=auto]])],
491    [enable_gtk=$enableval], [enable_gtk=auto])
492
493 PKG_PROG_PKG_CONFIG
494 if test $enable_gtk = auto ; then
495    PKG_CHECK_EXISTS([gtk+-2.0], [enable_gtk=yes], [enable_gtk=no])
496 fi
497 if test $enable_gtk = yes ; then
498    PKG_CHECK_MODULES(GTK, [gtk+-2.0])
499 fi
500
501 AM_CONDITIONAL(HAVE_GTK, [test "x$enable_gtk" = xyes])
502
503 AC_SUBST(GTK_CFLAGS)
504 AC_SUBST(GTK_LIBS)
505 AC_SUBST(DEP_CFLAGS)
506 AC_SUBST(DEP_LIBS)
507
508 dnl =====================================
509 dnl posix_memalign 
510
511 AC_CHECK_FUNC(posix_memalign, have_posix_memalign=yes, have_posix_memalign=no)
512 if test x$have_posix_memalign = xyes; then
513    AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [Whether we have posix_memalign()])
514 fi
515
516 AC_OUTPUT([pixman-1.pc
517            pixman-1-uninstalled.pc
518            Makefile
519            pixman/Makefile
520            pixman/pixman-version.h
521            test/Makefile])