]> granicus.if.org Git - strace/blob - configure.ac
Rewrite signal mask decoding without sigset_t
[strace] / configure.ac
1 dnl Process this file with autoconf to create configure.  Use autoreconf.
2 AC_PREREQ(2.57)
3 AC_INIT([strace],
4         m4_esyscmd([./git-version-gen .tarball-version]),
5         [strace-devel@lists.sourceforge.net])
6 AC_CONFIG_SRCDIR([strace.c])
7 AC_CONFIG_AUX_DIR([.])
8 AC_CONFIG_HEADERS([config.h])
9 AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip silent-rules parallel-tests])
10 AM_MAINTAINER_MODE
11 AC_CANONICAL_HOST
12
13 AC_PROG_CC
14 AC_USE_SYSTEM_EXTENSIONS
15
16 AC_MSG_CHECKING([for supported architecture])
17 case "$host_cpu" in
18 bfin)
19         arch=bfin
20         AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
21         ;;
22 i[[3456]]86|pentium)
23         arch=i386
24         AC_DEFINE([I386], 1, [Define for the i386 architecture.])
25         ;;
26 ia64)
27         arch=ia64
28         AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
29         ;;
30 m68k)
31         arch=m68k
32         AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
33         ;;
34 sparc64*)
35         arch=sparc64
36         AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
37         ;;
38 sparc*)
39         arch=sparc
40         AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
41         ;;
42 metag*)
43         arch=metag
44         AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
45         ;;
46 mips*)
47         arch=mips
48         AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
49         ;;
50 alpha*)
51         arch=alpha
52         AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
53         ;;
54 powerpc*)
55         arch=powerpc
56         AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
57         AC_TRY_COMPILE(
58 [#ifndef __LP64__
59 # error 32 bit
60 #endif], [], ppc_bits=64, ppc_bits=32)
61         if test "$ppc_bits" = "64"; then
62                 AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
63         fi
64         ;;
65 arm*)
66         arch=arm
67         AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
68         ;;
69 aarch64*)
70         arch=aarch64
71         AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
72         ;;
73 avr32*)
74         arch=avr32
75         AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
76         ;;
77 arc*)
78         arch=arc
79         AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
80         ;;
81 s390)
82         arch=s390
83         AC_DEFINE([S390], 1, [Define for the S390 architecture.])
84         ;;
85 s390x)
86         arch=s390x
87         AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
88         ;;
89 hppa*|parisc*)
90         arch=hppa
91         AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
92         ;;
93 sh64*)
94         arch=sh64
95         AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
96         ;;
97 sh*)
98         arch=sh
99         AC_DEFINE([SH], 1, [Define for the SH architecture.])
100         ;;
101 x86?64*)
102         AC_TRY_COMPILE(
103 [#ifndef __ILP32__
104 # error not x32
105 #endif], [], arch=x32, arch=x86_64)
106         if test "$arch" = "x86_64"; then
107                 AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
108         else
109                 AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
110         fi
111         ;;
112 cris|crisv10)
113         arch=crisv10
114         AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
115         ;;
116 crisv32)
117         arch=crisv32
118         AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
119         ;;
120 tile*)
121         arch=tile
122         AC_DEFINE([TILE], 1, [Define for the Tile architecture])
123         ;;
124 microblaze*)
125         arch=microblaze
126         AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
127         ;;
128 or1k*)
129         arch=or1k
130         AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
131         ;;
132
133 xtensa*)
134         arch=xtensa
135         AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
136         ;;
137
138 *)
139         AC_MSG_RESULT([NO!])
140         AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
141         ;;
142 esac
143 AC_MSG_RESULT($arch)
144
145 AC_SUBST(arch)
146
147 AM_CONDITIONAL([I386], [test x$arch = xi386])
148 AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
149 AM_CONDITIONAL([X32], [test x$arch = xx32])
150
151 AC_INCLUDEDIR
152
153 gl_WARN_ADD([-Wall])
154 gl_WARN_ADD([-Wwrite-strings])
155 AC_ARG_ENABLE([gcc-Werror],
156   [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
157   [case $enableval in
158      yes) gl_WARN_ADD([-Werror]) ;;
159      no)  ;;
160      *)   AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
161    esac]
162 )
163 AC_SUBST([WARN_CFLAGS])
164
165 AC_PROG_CPP
166 AC_PROG_INSTALL
167 AC_C_CONST
168 AC_C_BIGENDIAN
169 AC_HEADER_STDC
170 AC_HEADER_STDBOOL
171 AC_HEADER_DIRENT
172 AC_HEADER_STAT
173 AC_CHECK_MEMBERS(m4_normalize([
174         struct stat.st_aclcnt,
175         struct stat.st_blksize,
176         struct stat.st_blocks,
177         struct stat.st_flags,
178         struct stat.st_fstype,
179         struct stat.st_gen,
180         struct stat.st_level,
181         struct stat.st_rdev
182 ]))
183 AC_STAT64
184 AC_STATFS64
185
186 AC_TYPE_SIGNAL
187 AC_TYPE_UID_T
188 AC_TYPE_MODE_T
189 AC_TYPE_GETGROUPS
190 AC_HEADER_MAJOR
191 AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
192 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
193 [#include <sys/types.h>
194 #include <sys/socket.h>
195 #include <netinet/in.h>])
196 AC_LITTLE_ENDIAN_LONG_LONG
197
198 AC_CHECK_FUNCS(m4_normalize([
199         fopen64
200         fork
201         fputs_unlocked
202         if_indextoname
203         inet_ntop
204         prctl
205         process_vm_readv
206         sendmsg
207         sigaction
208         stpcpy
209         strerror
210         strsignal
211 ]))
212 AC_CHECK_HEADERS(m4_normalize([
213         asm/cachectl.h
214         asm/sysmips.h
215         elf.h
216         inttypes.h
217         ioctls.h
218         linux/capability.h
219         linux/perf_event.h
220         linux/ptrace.h
221         linux/utsname.h
222         mqueue.h
223         netinet/sctp.h
224         poll.h
225         scsi/sg.h
226         stropts.h
227         sys/acl.h
228         sys/asynch.h
229         sys/conf.h
230         sys/epoll.h
231         sys/filio.h
232         sys/ioctl.h
233         sys/poll.h
234         sys/ptrace.h
235         sys/reg.h
236         sys/uio.h
237         sys/vfs.h
238 ]))
239 AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
240                  [], [], [#include <stddef.h>
241 #include <sys/socket.h>
242 #include <asm/types.h>])
243 AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
244 AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
245 AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
246
247 AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
248
249 AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
250
251 AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
252                [#include <sys/ptrace.h>])
253
254 AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
255
256 AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
257
258 AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
259                   struct sigevent.__pad],,, [#include <signal.h>])
260
261 AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
262
263 AC_CHECK_DECLS([sys_errlist])
264 AC_CHECK_DECLS(m4_normalize([
265         PTRACE_EVENT_CLONE,
266         PTRACE_EVENT_EXEC,
267         PTRACE_EVENT_EXIT,
268         PTRACE_EVENT_FORK,
269         PTRACE_EVENT_VFORK,
270         PTRACE_EVENT_VFORK_DONE,
271         PTRACE_GETEVENTMSG,
272         PTRACE_GETSIGINFO,
273         PTRACE_O_TRACECLONE,
274         PTRACE_O_TRACEEXEC,
275         PTRACE_O_TRACEEXIT,
276         PTRACE_O_TRACEFORK,
277         PTRACE_O_TRACESYSGOOD,
278         PTRACE_O_TRACEVFORK,
279         PTRACE_PEEKUSER,
280         PTRACE_POKEUSER,
281         PTRACE_SETOPTIONS
282 ]),,, [#include <sys/ptrace.h>])
283
284 AC_CHECK_DECLS(m4_normalize([
285         LO_FLAGS_AUTOCLEAR,
286         LO_FLAGS_PARTSCAN
287 ]),,, [#include <linux/loop.h>])
288
289 AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
290         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
291 #include <stdlib.h>
292 #include <linux/fs.h>], [return !BLKGETSIZE64;])],
293                            [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
294         if test $ac_cv_have_blkgetsize64 = yes; then
295                 AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
296         fi)
297
298 AC_CHECK_SIZEOF([long])
299 AC_CHECK_SIZEOF([long long])
300 AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
301
302 AC_CACHE_CHECK([for SA_RESTORER], [st_cv_sa_restorer],
303                [st_cv_sa_restorer="$(echo SA_RESTORER |
304                         $CPP $CPPFLAGS -P -imacros asm/signal.h - |
305                         grep ^0x)"
306                 test -n "$st_cv_sa_restorer" || st_cv_sa_restorer=no])
307 if test "x$st_cv_sa_restorer" != xno; then
308         AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_sa_restorer],
309                            [SA_RESTORER defined in <asm/signal.h>])
310 fi
311
312 AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
313                [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
314                                [st_cv_have___builtin_popcount=yes],
315                                [st_cv_have___builtin_popcount=no])])
316 if test "x$st_cv_have___builtin_popcount" = xyes; then
317         AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
318                   [Define to 1 if the system provides __builtin_popcount function])
319 fi
320
321 AC_PATH_PROG([PERL], [perl])
322
323 AC_CONFIG_FILES([Makefile tests/Makefile])
324 AC_OUTPUT