summaryrefslogtreecommitdiff
path: root/build/configure.ac.system
blob: 5194fe072a0de713ee1e484debdb88f23b3ab565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
dnl
dnl Non-failing checks for functions, headers, libraries, etc go here
dnl

dnl ====================================================================
dnl Feature checks
dnl ====================================================================

AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = "xyes")
CAIRO_BIGENDIAN
AC_ARG_ENABLE(atomic,
	      [AS_HELP_STRING([--disable-atomic],
			      [disable use of native atomic operations])],
	      [use_atomic=$enableval], [use_atomic=yes])
AS_IF([test "x$use_atomic" = "xyes"], [
  CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES
  CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER
])
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(size_t)

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    cairo_os_win32=yes
    ;;
  *)
    cairo_os_win32=no
    ;;
esac
AC_MSG_RESULT([$cairo_os_win32])
AM_CONDITIONAL(OS_WIN32, test "$cairo_os_win32" = "yes")

AC_MSG_CHECKING([for Sun Solaris (non-POSIX ctime_r)])
case "$host" in
    *-*-solaris*)
	CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
	solaris_posix_pthread=yes
	;;
    *)
	solaris_posix_pthread=no
	;;
esac
AC_MSG_RESULT([$solaris_posix_pthread])

dnl ====================================================================
dnl Library checks
dnl ====================================================================

AC_CHECK_LIBM
LIBS="$LIBS $LIBM"

AC_CHECK_LIB(rt, sched_yield, [RT_LIBS=-lrt], [RT_LIBS=])
CAIROPERF_LIBS=$RT_LIBS
AC_SUBST(CAIROPERF_LIBS)

has_shm_open=
AC_CHECK_LIB(rt, shm_open, [
	     SHM_LIBS=-lrt
	     has_shm_open=yes
	     ], [SHM_LIBS=])
AM_CONDITIONAL(HAVE_SHM, test "x$has_shm_open" = "xyes")
AC_SUBST(SHM_LIBS)

AC_CHECK_LIB(socket, connect, [SOCKET_LIBS=-lsocket], [SOCKET_LIBS=])
CAIROBOILERPLATE_LIBS=$SOCKET_LIBS
AC_SUBST(CAIROBOILERPLATE_LIBS)

dnl ====================================================================
dnl Header/function checks
dnl ====================================================================

dnl check if we have a __builtin_return_address for the cairo-trace
dnl utility.
AC_MSG_CHECKING([for __builtin_return_address(0)])
AC_TRY_COMPILE([],[__builtin_return_address(0);],
		[have_builtin_return_address=yes],
		[have_builtin_return_address=no])
AC_MSG_RESULT($have_builtin_return_address)
if test "x$have_builtin_return_address" = "xyes"; then
    AC_DEFINE(HAVE_BUILTIN_RETURN_ADDRESS, 1,
	[Define to 1 if your compiler supports the __builtin_return_address() intrinsic.])
fi

dnl Checks for precise integer types
AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
AC_CHECK_TYPES([uint64_t, uint128_t, __uint128_t])

dnl Check for socket support for any2ppm daemon
AC_CHECK_HEADERS([fcntl.h unistd.h signal.h sys/stat.h sys/socket.h sys/poll.h sys/un.h])

dnl Check for infinite loops
AC_CHECK_FUNCS([alarm])

dnl check for CPU affinity support
AC_CHECK_HEADERS([sched.h], [AC_CHECK_FUNCS([sched_getaffinity])])

dnl check for mmap support
AC_CHECK_HEADERS([sys/mman.h], [AC_CHECK_FUNCS([mmap])])

dnl check for clock_gettime() support
save_LIBS="$LIBS"
LIBS="$LIBS $RT_LIBS"
AC_CHECK_HEADERS([time.h], [AC_CHECK_FUNCS([clock_gettime])])
LIBS="$save_LIBS"

dnl check for GNU-extensions to fenv
AC_CHECK_HEADER(fenv.h,
	[AC_CHECK_FUNCS(feenableexcept fedisableexcept feclearexcept)])

dnl check for misc headers and functions
AC_CHECK_HEADERS([libgen.h byteswap.h signal.h setjmp.h fenv.h])
AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile ffs])

dnl check for win32 headers (this detects mingw as well)
AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)


dnl Possible headers for mkdir
AC_CHECK_HEADERS([sys/stat.h io.h])
AC_CHECK_FUNC(mkdir,
	      [AC_MSG_CHECKING([mkdir variant])
	      mkdir_variant="unknown"
	      save_CFLAGS="$CFLAGS"
	      CFLAGS=$WARN_CFLAGS
	      AC_TRY_COMPILE([
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
		      ],
		      [mkdir ("hello.world", 0777)],
		      mkdir_variant="mkdir(path, mode)",
		      [AC_TRY_COMPILE([
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
			      ],
			      [mkdir ("hello.world")],
			      mkdir_variant="mkdir(path)")])
	      AC_MSG_RESULT([$mkdir_variant])
	      CFLAGS="$save_CFLAGS"
	      if test "x$mkdir_variant" = "xmkdir(path, mode)"; then
		  AC_DEFINE(HAVE_MKDIR, 2,
			    [Define to non-zero if your system has mkdir, and to 2 if your version of mkdir requires a mode parameter])
	      else
		  AC_DEFINE(HAVE_MKDIR, 1,
			    [Define to non-zero if your system has mkdir, and to 2 if your version of mkdir requires a mode parameter])
	      fi])

dnl ===========================================================================
dnl
dnl Test for the tools required for building one big test binary
dnl

AC_CHECK_FUNCS(fork waitpid raise)

dnl ===========================================================================

have_real_pthread=no
real_pthread_REQUIRES="pthread"
PKG_CHECK_MODULES(real_pthread, $real_pthread_REQUIRES,
		  [have_real_pthread=yes],
		  [AC_CHECK_HEADERS([pthread.h],
				    [CAIRO_CC_TRY_FLAG("-pthread",, real_pthread_CFLAGS="-pthread", real_pthread_CFLAGS="")
				     real_pthread_LIBS="-lpthread"],
				     [have_real_pthread="no (requires $real_pthread_REQUIRES)"])])
AM_CONDITIONAL(HAVE_REAL_PTHREAD, test "x$have_real_pthread" = "xyes")