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