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