2 dnl Non-failing checks for functions, headers, libraries, etc go here
5 dnl ====================================================================
7 dnl ====================================================================
9 AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = "xyes")
12 [AS_HELP_STRING([--disable-atomic],
13 [disable use of native atomic operations])],
14 [use_atomic=$enableval], [use_atomic=yes])
15 AS_IF([test "x$use_atomic" = "xyes"], [
16 CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES
17 CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER
19 AC_CHECK_SIZEOF(void *)
22 AC_CHECK_SIZEOF(long long)
23 AC_CHECK_SIZEOF(size_t)
25 AC_MSG_CHECKING([for native Win32])
34 AC_MSG_RESULT([$cairo_os_win32])
35 AM_CONDITIONAL(OS_WIN32, test "$cairo_os_win32" = "yes")
37 AC_MSG_CHECKING([for Sun Solaris (non-POSIX ctime_r)])
40 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
41 solaris_posix_pthread=yes
44 solaris_posix_pthread=no
47 AC_MSG_RESULT([$solaris_posix_pthread])
49 dnl ====================================================================
51 dnl ====================================================================
56 AC_CHECK_LIB(rt, sched_yield, [RT_LIBS=-lrt], [RT_LIBS=])
57 CAIROPERF_LIBS=$RT_LIBS
58 AC_SUBST(CAIROPERF_LIBS)
61 AC_CHECK_LIB(rt, shm_open, [
65 AM_CONDITIONAL(HAVE_SHM, test "x$has_shm_open" = "xyes")
68 AC_CHECK_LIB(socket, connect, [SOCKET_LIBS=-lsocket], [SOCKET_LIBS=])
69 CAIROBOILERPLATE_LIBS=$SOCKET_LIBS
70 AC_SUBST(CAIROBOILERPLATE_LIBS)
72 dnl ====================================================================
73 dnl Header/function checks
74 dnl ====================================================================
76 dnl check if we have a __builtin_return_address for the cairo-trace
78 AC_MSG_CHECKING([for __builtin_return_address(0)])
79 AC_TRY_COMPILE([],[__builtin_return_address(0);],
80 [have_builtin_return_address=yes],
81 [have_builtin_return_address=no])
82 AC_MSG_RESULT($have_builtin_return_address)
83 if test "x$have_builtin_return_address" = "xyes"; then
84 AC_DEFINE(HAVE_BUILTIN_RETURN_ADDRESS, 1,
85 [Define to 1 if your compiler supports the __builtin_return_address() intrinsic.])
88 dnl Checks for precise integer types
89 AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
90 AC_CHECK_TYPES([uint64_t, uint128_t, __uint128_t])
92 dnl Check for socket support for any2ppm daemon
93 AC_CHECK_HEADERS([fcntl.h unistd.h signal.h sys/stat.h sys/socket.h sys/poll.h sys/un.h])
95 dnl Check for infinite loops
96 AC_CHECK_FUNCS([alarm])
98 dnl check for CPU affinity support
99 AC_CHECK_HEADERS([sched.h], [AC_CHECK_FUNCS([sched_getaffinity])])
101 dnl check for mmap support
102 AC_CHECK_HEADERS([sys/mman.h], [AC_CHECK_FUNCS([mmap])])
104 dnl check for clock_gettime() support
106 LIBS="$LIBS $RT_LIBS"
107 AC_CHECK_HEADERS([time.h], [AC_CHECK_FUNCS([clock_gettime])])
110 dnl check for GNU-extensions to fenv
111 AC_CHECK_HEADER(fenv.h,
112 [AC_CHECK_FUNCS(feenableexcept fedisableexcept feclearexcept)])
114 dnl check for misc headers and functions
115 AC_CHECK_HEADERS([libgen.h byteswap.h signal.h setjmp.h fenv.h])
116 AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile ffs])
118 dnl check for win32 headers (this detects mingw as well)
119 AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)
122 dnl Possible headers for mkdir
123 AC_CHECK_HEADERS([sys/stat.h io.h])
125 [AC_MSG_CHECKING([mkdir variant])
126 mkdir_variant="unknown"
127 save_CFLAGS="$CFLAGS"
130 #ifdef HAVE_SYS_STAT_H
131 #include <sys/stat.h>
137 [mkdir ("hello.world", 0777)],
138 mkdir_variant="mkdir(path, mode)",
140 #ifdef HAVE_SYS_STAT_H
141 #include <sys/stat.h>
147 [mkdir ("hello.world")],
148 mkdir_variant="mkdir(path)")])
149 AC_MSG_RESULT([$mkdir_variant])
150 CFLAGS="$save_CFLAGS"
151 if test "x$mkdir_variant" = "xmkdir(path, mode)"; then
152 AC_DEFINE(HAVE_MKDIR, 2,
153 [Define to non-zero if your system has mkdir, and to 2 if your version of mkdir requires a mode parameter])
155 AC_DEFINE(HAVE_MKDIR, 1,
156 [Define to non-zero if your system has mkdir, and to 2 if your version of mkdir requires a mode parameter])
159 dnl ===========================================================================
161 dnl Test for the tools required for building one big test binary
164 AC_CHECK_FUNCS(fork waitpid raise)