• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ(2.61)
2AC_INIT([ltp], [LTP_VERSION], [ltp@lists.linux.it])
3AC_CONFIG_AUX_DIR([.])
4AM_INIT_AUTOMAKE
5AC_CONFIG_HEADERS([include/config.h])
6AC_CONFIG_MACRO_DIR([m4])
7AC_CONFIG_FILES([ \
8    include/mk/config.mk \
9    include/mk/config-openposix.mk \
10    include/mk/features.mk \
11    lib/ltp.pc \
12    m4/Makefile \
13    execltp \
14])
15
16AM_MAINTAINER_MODE([enable])
17
18AM_CONDITIONAL(CROSS_COMPILATION, test x$cross_compiling = xyes)
19
20AC_CANONICAL_HOST
21
22AC_PROG_CC
23# <= autoconf 2.61 doesn't have AC_PROG_AR, but 2.63 has it. Not sure about
24# 2.62.
25AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
26AC_PROG_AR
27AC_PROG_LEX
28AC_PROG_RANLIB
29AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)])
30AC_PROG_STRIP
31AC_PROG_YACC
32
33AC_PREFIX_DEFAULT(/opt/ltp)
34
35AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
36AC_CHECK_DECLS([MADV_MERGEABLE],,,[#include <sys/mman.h>])
37AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ],,,[#include <sys/prctl.h>])
38
39AC_CHECK_HEADERS([ \
40    asm/ldt.h \
41    ifaddrs.h \
42    keyutils.h \
43    linux/can.h \
44    linux/cgroupstats.h \
45    linux/cryptouser.h \
46    linux/dccp.h \
47    linux/fs.h \
48    linux/genetlink.h \
49    linux/if_alg.h \
50    linux/if_ether.h \
51    linux/if_packet.h \
52    linux/keyctl.h \
53    linux/mempolicy.h \
54    linux/module.h \
55    linux/netlink.h \
56    linux/seccomp.h \
57    linux/securebits.h \
58    linux/tty.h \
59    linux/types.h \
60    linux/userfaultfd.h \
61    mm.h \
62    netinet/sctp.h \
63    pthread.h \
64    sys/epoll.h \
65    sys/fanotify.h \
66    sys/inotify.h \
67    sys/prctl.h \
68    sys/shm.h \
69    sys/timerfd.h \
70    sys/ustat.h \
71    sys/utsname.h \
72    sys/xattr.h \
73    xfs/xqm.h \
74])
75AC_CHECK_HEADERS(fts.h, [have_fts=1])
76AC_SUBST(HAVE_FTS_H, $have_fts)
77
78AC_CHECK_FUNCS([ \
79    clone3 \
80    copy_file_range \
81    epoll_pwait \
82    execveat \
83    fallocate \
84    fchownat \
85    fsconfig \
86    fsmount \
87    fsopen \
88    fspick \
89    fstatat \
90    getdents \
91    getdents64 \
92    io_pgetevents \
93    io_uring_setup \
94    io_uring_register \
95    io_uring_enter \
96    kcmp \
97    mkdirat \
98    mknodat \
99    modify_ldt \
100    move_mount \
101    name_to_handle_at \
102    open_tree \
103    openat \
104    openat2 \
105    pidfd_open \
106    pidfd_send_signal \
107    pkey_mprotect \
108    preadv \
109    preadv2 \
110    profil \
111    pwritev \
112    pwritev2 \
113    readlinkat \
114    recvmmsg \
115    renameat \
116    renameat2 \
117    sched_getcpu \
118    sendmmsg \
119    setns \
120    sigpending \
121    splice \
122    statx \
123    stime \
124    sync_file_range \
125    syncfs \
126    tee \
127    timerfd_create \
128    timerfd_gettime \
129    timerfd_settime \
130    unshare \
131    ustat \
132    vmsplice \
133])
134AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))
135
136AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
137AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
138AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
139
140AC_CHECK_MEMBERS([struct utsname.domainname],,,[
141#define _GNU_SOURCE
142#include <sys/utsname.h>
143])
144
145AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
146AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
147AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include <sys/fanotify.h>])
148AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include <sys/fanotify.h>])
149AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
150AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
151AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
152AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
153
154AC_CHECK_TYPES([struct mmsghdr],,,[
155#define _GNU_SOURCE
156#include <sys/types.h>
157#include <sys/socket.h>
158])
159
160AC_CHECK_TYPES([struct rlimit64],,,[
161#define _LARGEFILE64_SOURCE
162#include <sys/resource.h>
163])
164
165AC_CHECK_TYPES([struct statx, struct statx_timestamp],,,[
166#define _GNU_SOURCE
167#include <sys/stat.h>
168])
169
170AC_CHECK_TYPES([struct termio],,,[#include <sys/ioctl.h>])
171
172AC_CHECK_TYPES([struct tpacket_req3],,,[
173#ifdef HAVE_LINUX_IF_PACKET_H
174# include <linux/if_packet.h>
175#endif
176])
177
178AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[
179#include <asm/ldt.h>
180])
181
182AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
183#include <sys/types.h>
184#include <netinet/in.h>
185#include <net/if.h>
186#include <limits.h>
187#include <linux/netfilter_ipv4/ip_tables.h>
188])
189
190# Tools knobs
191
192# Expect
193AC_ARG_WITH([bash],
194  [AC_HELP_STRING([--with-bash],
195    [have the Bourne Again Shell interpreter])],
196  [with_bash=$withval],
197  [with_bash=no]
198)
199if test "x$with_bash" = xyes; then
200    AC_SUBST([WITH_BASH],["yes"])
201else
202    AC_SUBST([WITH_BASH],["no"])
203fi
204
205AC_ARG_WITH([expect],
206  [AC_HELP_STRING([--with-expect],
207    [have the Tcl/expect library])],
208  [with_expect=$withval],
209  [with_expect=no]
210)
211if test "x$with_expect" = xyes; then
212    AC_SUBST([WITH_EXPECT],["yes"])
213else
214    AC_SUBST([WITH_EXPECT],["no"])
215fi
216
217# Numa
218AC_ARG_WITH([numa],
219  AC_HELP_STRING([--without-numa],
220    [without numa support]),
221  [with_numa=$withval],
222  [with_numa=yes]
223)
224
225# Perl
226AC_ARG_WITH([perl],
227  [AC_HELP_STRING([--with-perl],
228    [have a perl interpreter])],
229  [with_perl=$withval],
230  [with_perl=no]
231)
232if test "x$with_perl" = xyes; then
233    AC_SUBST([WITH_PERL],["yes"])
234else
235    AC_SUBST([WITH_PERL],["no"])
236fi
237
238# Python
239AC_ARG_WITH([python],
240  [AC_HELP_STRING([--with-python],
241    [have a python interpreter])],
242  [with_python=$withval],
243  [with_python=no]
244)
245if test "x$with_python" = xyes; then
246    AC_SUBST([WITH_PYTHON],["yes"])
247else
248    AC_SUBST([WITH_PYTHON],["no"])
249fi
250
251# TI RPC
252AC_ARG_WITH([tirpc],
253  AC_HELP_STRING([--without-tirpc],
254    [without libtirpc support]),
255  [with_tirpc=$withval],
256  [with_tirpc=yes]
257)
258# END tools knobs
259
260# Testsuites knobs
261
262AC_ARG_WITH([open-posix-testsuite],
263  [AC_HELP_STRING([--with-open-posix-testsuite],
264    [compile and install the open posix testsuite])],
265  [with_open_posix_testsuite=$withval],
266  [with_open_posix_testsuite=no]
267)
268if test "x$with_open_posix_testsuite" = xyes; then
269    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["yes"])
270else
271    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["no"])
272fi
273
274# TODO: testcases/realtime requires bash and python.
275AC_ARG_WITH([realtime-testsuite],
276  [AC_HELP_STRING([--with-realtime-testsuite],
277    [compile and install the realtime testsuite])],
278  [with_realtime_testsuite=$withval],
279  [with_realtime_testsuite=no]
280)
281
282if test "x$with_realtime_testsuite" = xyes; then
283    AC_SUBST([WITH_REALTIME_TESTSUITE],["yes"])
284    # Run configure on testcases/realtime as well.
285    AC_CONFIG_SUBDIRS([testcases/realtime])
286else
287    AC_SUBST([WITH_REALTIME_TESTSUITE],["no"])
288fi
289
290AC_CONFIG_COMMANDS([syscalls.h], [cd ${ac_top_srcdir}/include/lapi/syscalls; ./regen.sh])
291
292# custom functions
293# NOTE: don't create custom functions for simple checks, put them into this file
294LTP_CHECK_ACL_SUPPORT
295LTP_CHECK_ATOMIC_MEMORY_MODEL
296LTP_CHECK_BUILTIN_CLEAR_CACHE
297LTP_CHECK_CAPABILITY_SUPPORT
298LTP_CHECK_CC_WARN_OLDSTYLE
299LTP_CHECK_CLONE_SUPPORTS_7_ARGS
300LTP_CHECK_CRYPTO
301LTP_CHECK_FORTIFY_SOURCE
302LTP_CHECK_KERNEL_DEVEL
303LTP_CHECK_KEYUTILS_SUPPORT
304LTP_CHECK_LIBMNL
305LTP_CHECK_LINUX_PTRACE
306LTP_CHECK_LINUXRANDOM
307LTP_CHECK_MREMAP_FIXED
308LTP_CHECK_NOMMU_LINUX
309LTP_CHECK_SELINUX
310LTP_CHECK_SYNC_ADD_AND_FETCH
311LTP_CHECK_SYSCALL_EVENTFD
312LTP_CHECK_SYSCALL_FCNTL
313
314if test "x$with_numa" = xyes; then
315	LTP_CHECK_SYSCALL_NUMA
316	numa_error_msg="test requires libnuma >= 2 and it's development packages"
317else
318	numa_error_msg="NUMA support was disabled during build"
319fi
320AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no NUMA support])
321
322
323LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
324LTP_CHECK_SYSCALL_SIGNALFD
325LTP_CHECK_SYSCALL_UTIMENSAT
326LTP_CHECK_TASKSTATS
327test "x$with_tirpc" = xyes && LTP_CHECK_TIRPC
328LTP_DETECT_HOST_CPU
329
330AC_OUTPUT
331