]> granicus.if.org Git - strace/blob - configure.ac
build: introduce git-version-gen
[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 AM_CONFIG_HEADER([config.h])
9 AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip silent-rules])
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         if test $host_cpu = powerpc64; then
58                 AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
59         fi
60         ;;
61 arm*)
62         arch=arm
63         AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
64         ;;
65 aarch64*)
66         arch=aarch64
67         AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
68         ;;
69 avr32*)
70         arch=avr32
71         AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
72         ;;
73 s390)
74         arch=s390
75         AC_DEFINE([S390], 1, [Define for the S390 architecture.])
76         ;;
77 s390x)
78         arch=s390x
79         AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
80         ;;
81 hppa*|parisc*)
82         arch=hppa
83         AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
84         ;;
85 sh64*)
86         arch=sh64
87         AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
88         ;;
89 sh*)
90         arch=sh
91         AC_DEFINE([SH], 1, [Define for the SH architecture.])
92         ;;
93 x86?64*)
94         AC_TRY_COMPILE(
95 [#ifndef __ILP32__
96 # error not x32
97 #endif], [], arch=x32, arch=x86_64)
98         if test "$arch" = "x86_64"; then
99                 AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
100         else
101                 AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
102         fi
103         ;;
104 cris|crisv10)
105         arch=crisv10
106         AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
107         ;;
108 crisv32)
109         arch=crisv32
110         AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
111         ;;
112 tile*)
113         arch=tile
114         AC_DEFINE([TILE], 1, [Define for the Tile architecture])
115         ;;
116 microblaze*)
117         arch=microblaze
118         AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
119         ;;
120 or1k*)
121         arch=or1k
122         AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
123         ;;
124
125 xtensa*)
126         arch=xtensa
127         AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
128         ;;
129
130 *)
131         AC_MSG_RESULT([NO!])
132         AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
133         ;;
134 esac
135 AC_MSG_RESULT($arch)
136
137 AC_SUBST(arch)
138
139 AM_CONDITIONAL([I386], [test x$arch = xi386])
140 AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
141 AM_CONDITIONAL([X32], [test x$arch = xx32])
142
143 AC_INCLUDEDIR
144
145 gl_WARN_ADD([-Wall])
146 gl_WARN_ADD([-Wwrite-strings])
147 AC_ARG_ENABLE([gcc-Werror],
148   [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
149   [case $enableval in
150      yes) gl_WARN_ADD([-Werror]) ;;
151      no)  ;;
152      *)   AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
153    esac]
154 )
155 AC_SUBST([WARN_CFLAGS])
156
157 AC_PROG_CPP
158 AC_PROG_INSTALL
159 AC_C_CONST
160 AC_C_BIGENDIAN
161 AC_HEADER_STDC
162 AC_HEADER_STDBOOL
163 AC_HEADER_DIRENT
164 AC_HEADER_STAT
165 AC_CHECK_MEMBERS(m4_normalize([
166         struct stat.st_aclcnt,
167         struct stat.st_blksize,
168         struct stat.st_blocks,
169         struct stat.st_flags,
170         struct stat.st_fstype,
171         struct stat.st_gen,
172         struct stat.st_level,
173         struct stat.st_rdev
174 ]))
175 AC_STAT64
176 AC_STATFS64
177
178 AC_TYPE_SIGNAL
179 AC_TYPE_UID_T
180 AC_TYPE_MODE_T
181 AC_TYPE_GETGROUPS
182 AC_HEADER_MAJOR
183 AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
184 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
185 [#include <sys/types.h>
186 #include <sys/socket.h>
187 #include <netinet/in.h>])
188 AC_CHECK_TYPES([long long])
189 AC_LITTLE_ENDIAN_LONG_LONG
190 AC_OFF_T_IS_LONG_LONG
191 AC_CHECK_TYPES([struct opthdr],,, [#include <sys/socket.h>])
192 AC_CHECK_TYPES([struct t_opthdr],,, [#include <sys/tiuser.h>])
193
194 AC_CHECK_FUNCS(m4_normalize([
195         fork
196         if_indextoname
197         inet_ntop
198         prctl
199         process_vm_readv
200         sendmsg
201         sigaction
202         stpcpy
203         strerror
204         strsignal
205         _sys_siglist
206         sys_siglist
207 ]))
208 AC_CHECK_HEADERS(m4_normalize([
209         asm/cachectl.h
210         asm/sysmips.h
211         elf.h
212         inttypes.h
213         ioctls.h
214         linux/capability.h
215         linux/perf_event.h
216         linux/ptrace.h
217         linux/utsname.h
218         mqueue.h
219         netinet/sctp.h
220         poll.h
221         stropts.h
222         sys/acl.h
223         sys/asynch.h
224         sys/conf.h
225         sys/epoll.h
226         sys/filio.h
227         sys/ioctl.h
228         sys/poll.h
229         sys/ptrace.h
230         sys/reg.h
231         sys/uio.h
232         sys/vfs.h
233 ]))
234 AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
235                  [], [], [#include <stddef.h>
236 #include <sys/socket.h>
237 #include <asm/types.h>])
238 AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
239 AC_CHECK_TYPES([struct sigcontext_struct,
240                 struct sigcontext],,, [#include <signal.h>])
241 AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
242
243 AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
244
245 AC_CHECK_MEMBERS([struct T_conn_res.QUEUE_ptr,
246                   struct T_conn_res.ACCEPTOR_id],,,
247 [#include <sys/stream.h>
248 #include <sys/tihdr.h>])
249
250 AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
251
252 AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg],,,
253                [#include <sys/ptrace.h>])
254
255 AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
256
257 AC_CHECK_MEMBERS([struct dqblk.dqb_curblocks],,, [#include <sys/quota.h>])
258
259 AC_CHECK_MEMBERS([struct sigcontext.sc_hi2],,, [#include <signal.h>
260 #ifdef HAVE_ASM_SIGCONTEXT_H
261 # include <asm/sigcontext.h>
262 #endif])
263
264 AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
265
266 AC_CHECK_DECLS([sys_errlist])
267 AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
268 AC_CHECK_DECLS(m4_normalize([
269         PTRACE_EVENT_CLONE,
270         PTRACE_EVENT_EXEC,
271         PTRACE_EVENT_EXIT,
272         PTRACE_EVENT_FORK,
273         PTRACE_EVENT_VFORK,
274         PTRACE_EVENT_VFORK_DONE,
275         PTRACE_GETEVENTMSG,
276         PTRACE_GETSIGINFO,
277         PTRACE_O_TRACECLONE,
278         PTRACE_O_TRACEEXEC,
279         PTRACE_O_TRACEEXIT,
280         PTRACE_O_TRACEFORK,
281         PTRACE_O_TRACESYSGOOD,
282         PTRACE_O_TRACEVFORK,
283         PTRACE_SETOPTIONS
284 ]),,, [#include <sys/ptrace.h>])
285
286 AC_CHECK_DECLS(m4_normalize([
287         LO_FLAGS_AUTOCLEAR,
288         LO_FLAGS_PARTSCAN
289 ]),,, [#include <linux/loop.h>])
290
291 AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
292         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
293 #include <stdlib.h>
294 #include <linux/fs.h>], [return !BLKGETSIZE64;])],
295                            [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
296         if test $ac_cv_have_blkgetsize64 = yes; then
297                 AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
298         fi)
299
300 AC_CHECK_SIZEOF([long])
301 AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
302
303 AC_CHECK_HEADERS([libaio.h], [
304         AC_CHECK_MEMBERS([struct iocb.u.c.flags],,, [#include <libaio.h>])
305         AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
306 ])
307
308 AC_PATH_PROG([PERL], [perl])
309
310 AC_CONFIG_FILES([Makefile tests/Makefile])
311 AC_OUTPUT