• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ(2.64)
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])
14
15AC_ARG_VAR(HOSTCC, [The C compiler on the host])
16
17AM_MAINTAINER_MODE([enable])
18
19AC_CANONICAL_HOST
20
21AC_PROG_CC
22# <= autoconf 2.61 doesn't have AC_PROG_AR, but 2.63 has it. Not sure about
23# 2.62.
24AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
25AC_PROG_AR
26AC_PROG_RANLIB
27AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)])
28AC_PROG_STRIP
29AC_PROG_YACC
30
31m4_ifndef([PKG_CHECK_EXISTS],
32	[m4_fatal([must install pkg-config or pkgconfig and pkg.m4 macro (usual dependency), see INSTALL])])
33
34AC_PREFIX_DEFAULT(/opt/ltp)
35
36AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
37AC_CHECK_DECLS([MADV_MERGEABLE],,,[#include <sys/mman.h>])
38AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ],,,[#include <sys/prctl.h>])
39AC_CHECK_DECLS([SEM_STAT_ANY],,,[#include <sys/sem.h>])
40
41AC_CHECK_HEADERS_ONCE([ \
42    asm/ldt.h \
43    cpuid.h \
44    emmintrin.h \
45    ifaddrs.h \
46    keyutils.h \
47    linux/can.h \
48    linux/cgroupstats.h \
49    linux/cryptouser.h \
50    linux/close_range.h \
51    linux/dccp.h \
52    linux/fs.h \
53    linux/futex.h \
54    linux/genetlink.h \
55    linux/if_alg.h \
56    linux/if_ether.h \
57    linux/if_packet.h \
58    linux/io_uring.h \
59    linux/ioprio.h \
60    linux/keyctl.h \
61    linux/mempolicy.h \
62    linux/module.h \
63    linux/mount.h \
64    linux/netlink.h \
65    linux/seccomp.h \
66    linux/securebits.h \
67    linux/tty.h \
68    linux/types.h \
69    linux/userfaultfd.h \
70    netinet/sctp.h \
71    pthread.h \
72    sys/epoll.h \
73    sys/fanotify.h \
74    sys/inotify.h \
75    sys/pidfd.h
76    sys/prctl.h \
77    sys/shm.h \
78    sys/timerfd.h \
79    sys/ustat.h \
80    sys/utsname.h \
81    sys/xattr.h \
82    xfs/xqm.h \
83])
84AC_CHECK_HEADERS(fts.h, [have_fts=1])
85AC_SUBST(HAVE_FTS_H, $have_fts)
86AC_CHECK_HEADERS(linux/vm_sockets.h, [], [], [#include <sys/socket.h>])
87
88AC_CHECK_FUNCS_ONCE([ \
89    clone3 \
90    close_range \
91    copy_file_range \
92    epoll_pwait \
93    epoll_pwait2 \
94    execveat \
95    faccessat2 \
96    fallocate \
97    fchownat \
98    fsconfig \
99    fsmount \
100    fsopen \
101    fspick \
102    fstatat \
103    getauxval \
104    getcontext \
105    getcpu \
106    getdents \
107    getdents64 \
108    io_pgetevents \
109    io_uring_setup \
110    io_uring_register \
111    io_uring_enter \
112    kcmp \
113    mallinfo \
114    mallinfo2 \
115    mallopt \
116    mkdirat \
117    mknodat \
118    modify_ldt \
119    mount_setattr \
120    move_mount \
121    name_to_handle_at \
122    open_tree \
123    openat \
124    openat2 \
125    pidfd_getfd \
126    pidfd_open \
127    pidfd_send_signal \
128    pkey_mprotect \
129    preadv \
130    preadv2 \
131    profil \
132    pwritev \
133    pwritev2 \
134    quotactl_fd \
135    rand_r \
136    readlinkat \
137    recvmmsg \
138    renameat \
139    renameat2 \
140    sched_getcpu \
141    sendmmsg \
142    sethostid \
143    setns \
144    sigpending \
145    splice \
146    statx \
147    stime \
148    sync_file_range \
149    syncfs \
150    tee \
151    timerfd_create \
152    timerfd_gettime \
153    timerfd_settime \
154    unshare \
155    ustat \
156    vmsplice \
157])
158AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))
159
160AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
161AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
162AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
163AC_CHECK_MEMBERS([struct statx.stx_mnt_id, struct statx.stx_dio_mem_align],,,[
164#define _GNU_SOURCE
165#include <sys/stat.h>
166])
167
168AC_CHECK_MEMBERS([struct utsname.domainname],,,[
169#define _GNU_SOURCE
170#include <sys/utsname.h>
171])
172
173AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
174AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
175AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include <linux/if_alg.h>])
176AC_CHECK_TYPES([struct fanotify_event_info_fid, struct fanotify_event_info_error,
177		struct fanotify_event_info_header, struct fanotify_event_info_pidfd],,,[#include <sys/fanotify.h>])
178AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
179
180AC_CHECK_TYPES([struct file_handle],,,[
181#define _GNU_SOURCE
182#include <fcntl.h>
183])
184
185AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
186AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
187AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
188AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
189AC_CHECK_TYPES([struct loop_config],,,[#include <linux/loop.h>])
190
191AC_CHECK_TYPES([struct mmsghdr],,,[
192#define _GNU_SOURCE
193#include <sys/types.h>
194#include <sys/socket.h>
195])
196
197AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])
198
199AC_CHECK_TYPES([struct rlimit64],,,[
200#define _LARGEFILE64_SOURCE
201#include <sys/resource.h>
202])
203
204AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
205AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
206
207AC_CHECK_TYPES([struct statx, struct statx_timestamp],,,[
208#define _GNU_SOURCE
209#include <sys/stat.h>
210])
211
212AC_CHECK_TYPES([struct termio],,,[#include <sys/ioctl.h>])
213AC_CHECK_TYPES([struct tpacket_req3],,,[# include <linux/if_packet.h>])
214AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[#include <asm/ldt.h>])
215
216AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
217#include <sys/types.h>
218#include <netinet/in.h>
219#include <net/if.h>
220#include <limits.h>
221#include <linux/netfilter_ipv4/ip_tables.h>
222])
223
224AC_CHECK_TYPES([struct __kernel_old_timeval, struct __kernel_old_timespec, struct __kernel_timespec,
225                struct __kernel_old_itimerspec, struct __kernel_itimerspec],,,[#include <sys/socket.h>])
226
227AC_CHECK_TYPES([struct futex_waitv],,,[#include <linux/futex.h>])
228AC_CHECK_TYPES([struct mount_attr],,,[
229#ifdef HAVE_MOUNT_SETATTR
230# include <sys/mount.h>
231#elif HAVE_LINUX_MOUNT_H
232# include <linux/mount.h>
233#endif
234])
235
236# Tools knobs
237
238# Bash
239AC_ARG_WITH([bash],
240  [AS_HELP_STRING([--with-bash],
241    [have the Bourne Again Shell interpreter])],
242  [with_bash=$withval],
243  [with_bash=no]
244)
245if test "x$with_bash" = xyes; then
246    AC_SUBST([WITH_BASH],["yes"])
247else
248    AC_SUBST([WITH_BASH],["no"])
249fi
250
251# metadata
252AC_ARG_ENABLE([metadata],
253  [AS_HELP_STRING([--disable-metadata],
254	[Disable metadata generation (both HTML and PDF, default no)])],
255  [], [enable_metadata=yes]
256)
257AC_ARG_ENABLE([metadata_html],
258  [AS_HELP_STRING([--disable-metadata-html],
259	[Disable metadata HTML generation (default no)])],
260  [], [enable_metadata_html=yes]
261)
262
263AC_ARG_ENABLE([metadata_pdf],
264  [AS_HELP_STRING([--enable-metadata-pdf],
265	[Enable metadata PDF generation (default no)])],
266  [], [enable_metadata_pdf=no]
267)
268
269AC_ARG_WITH([metadata_generator],
270  [AS_HELP_STRING([--with-metadata-generator=asciidoc|asciidoctor],
271	[Specify metadata generator to use (default autodetect)])],
272  [with_metadata_generator=$withval],
273  [with_metadata_generator=detect]
274)
275
276LTP_DOCPARSE
277
278# Expect
279AC_ARG_WITH([expect],
280  [AS_HELP_STRING([--with-expect],
281    [have the Tcl/expect library])],
282  [with_expect=$withval],
283  [with_expect=no]
284)
285if test "x$with_expect" = xyes; then
286    AC_SUBST([WITH_EXPECT],["yes"])
287else
288    AC_SUBST([WITH_EXPECT],["no"])
289fi
290
291# Numa
292AC_ARG_WITH([numa],
293  AS_HELP_STRING([--without-numa],
294    [without numa support]),
295  [with_numa=$withval],
296  [with_numa=yes]
297)
298
299# Perl
300AC_ARG_WITH([perl],
301  [AS_HELP_STRING([--with-perl],
302    [have a perl interpreter])],
303  [with_perl=$withval],
304  [with_perl=no]
305)
306if test "x$with_perl" = xyes; then
307    AC_SUBST([WITH_PERL],["yes"])
308else
309    AC_SUBST([WITH_PERL],["no"])
310fi
311
312# Python
313AC_ARG_WITH([python],
314  [AS_HELP_STRING([--with-python],
315    [have a python interpreter])],
316  [with_python=$withval],
317  [with_python=no]
318)
319if test "x$with_python" = xyes; then
320    AC_SUBST([WITH_PYTHON],["yes"])
321else
322    AC_SUBST([WITH_PYTHON],["no"])
323fi
324
325# TI RPC
326AC_ARG_WITH([tirpc],
327  AS_HELP_STRING([--without-tirpc],
328    [without libtirpc support]),
329  [with_tirpc=$withval],
330  [with_tirpc=yes]
331)
332# END tools knobs
333
334# Testsuites knobs
335
336AC_ARG_WITH([open-posix-testsuite],
337  [AS_HELP_STRING([--with-open-posix-testsuite],
338    [compile and install the open posix testsuite])],
339  [with_open_posix_testsuite=$withval],
340  [with_open_posix_testsuite=no]
341)
342
343# Allow setting the directoy, where the open posix testsuite is installed to.
344# If nothing is defined, we have to pass our default value to submake
345AC_ARG_WITH([open-posix-testdir],
346  [AS_HELP_STRING([--with-open-posix-testdir=<dir>],
347    [set the directory, where the open posix testsuite will be installed under prefix])],
348  [],
349  [ac_configure_args="$ac_configure_args --with-open-posix-testdir=testcases/open_posix_testsuite"]
350)
351
352if test "x$with_open_posix_testsuite" = xyes; then
353    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["yes"])
354    AC_CONFIG_SUBDIRS([testcases/open_posix_testsuite])
355else
356    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["no"])
357fi
358
359# TODO: testcases/realtime requires bash and python.
360AC_ARG_WITH([realtime-testsuite],
361  [AS_HELP_STRING([--with-realtime-testsuite],
362    [compile and install the realtime testsuite])],
363  [with_realtime_testsuite=$withval],
364  [with_realtime_testsuite=no]
365)
366
367if test "x$with_realtime_testsuite" = xyes; then
368    AC_SUBST([WITH_REALTIME_TESTSUITE],["yes"])
369    # Run configure on testcases/realtime as well.
370    AC_CONFIG_SUBDIRS([testcases/realtime])
371else
372    AC_SUBST([WITH_REALTIME_TESTSUITE],["no"])
373fi
374
375AC_CONFIG_COMMANDS([syscalls.h], [cd ${ac_top_srcdir}/include/lapi/syscalls; ./regen.sh])
376
377# custom functions
378# NOTE: don't create custom functions for simple checks, put them into this file
379LTP_CHECK_ACL_SUPPORT
380LTP_CHECK_ATOMIC_MEMORY_MODEL
381LTP_CHECK_BUILTIN_CLEAR_CACHE
382LTP_CHECK_CAPABILITY_SUPPORT
383LTP_CHECK_CC_WARN_OLDSTYLE
384LTP_CHECK_CRYPTO
385LTP_CHECK_FORTIFY_SOURCE
386LTP_CHECK_KERNEL_DEVEL
387LTP_CHECK_KEYUTILS_SUPPORT
388LTP_CHECK_LIBMNL
389LTP_CHECK_LINUX_PTRACE
390LTP_CHECK_LINUXRANDOM
391LTP_CHECK_NOMMU_LINUX
392LTP_CHECK_SELINUX
393LTP_CHECK_SYNC_ADD_AND_FETCH
394LTP_CHECK_SYSCALL_EVENTFD
395LTP_CHECK_SYSCALL_FCNTL
396LTP_CHECK_FSVERITY
397
398AX_CHECK_COMPILE_FLAG([-no-pie], [LTP_CFLAGS_NOPIE=1])
399AC_SUBST([LTP_CFLAGS_NOPIE])
400
401if test "x$with_numa" = xyes; then
402	LTP_CHECK_SYSCALL_NUMA
403	numa_error_msg="test requires libnuma development packages with LIBNUMA_API_VERSION >= 2"
404else
405	numa_error_msg="NUMA support was disabled during build"
406fi
407AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no NUMA support])
408
409
410LTP_CHECK_SYSCALL_SIGNALFD
411LTP_CHECK_SYSCALL_UTIMENSAT
412LTP_CHECK_TASKSTATS
413test "x$with_tirpc" = xyes && LTP_CHECK_TIRPC
414LTP_DETECT_HOST_CPU
415
416AC_MSG_CHECKING([whether linker can handle KVM payloads])
417ltp_backup_ldflags="$LDFLAGS"
418ltp_backup_flags="$[]_AC_LANG_PREFIX[]FLAGS"
419LDFLAGS="-T ${srcdir}/testcases/kernel/kvm/linker/${HOST_CPU}.lds"
420_AC_LANG_PREFIX[]FLAGS=
421AC_LINK_IFELSE([AC_LANG_PROGRAM()],
422  [
423    AC_MSG_RESULT([yes])
424    AC_SUBST([WITH_KVM_TESTSUITE],["yes"])
425  ],
426  [
427    AC_MSG_RESULT([no])
428    AC_SUBST([WITH_KVM_TESTSUITE],["no"])
429  ])
430_AC_LANG_PREFIX[]FLAGS="$ltp_backup_flags"
431LDFLAGS="$ltp_backup_ldflags"
432
433AC_OUTPUT
434
435cat << EOF
436
437TESTSUITES
438open posix testsuite: ${with_open_posix_testsuite:-no}
439realtime testsuite: ${with_realtime_testsuite:-no}
440
441LIBRARIES
442keyutils: ${have_keyutils:-yes}
443libacl: ${have_libacl:-no}
444libaio: ${have_libaio:-no} (aio: ${have_aio:-no})
445libcap: $cap_libs (newer: ${has_newer_libcap:-no})
446libcrypto: ${have_libcrypto:-no} (sha: ${have_sha:-no})
447libmnl: ${have_libmnl:-yes}
448libnuma: ${have_libnuma:-no} (headers: ${have_numa_headers:-yes}, v2 headers: ${have_numa_headers_v2:-no})
449libtirpc: ${have_libtirpc:-no}
450glibc SUN-RPC: ${have_rpc_glibc:-no}
451
452METADATA
453metadata generator: $with_metadata_generator
454HTML metadata: $with_metadata_html
455PDF metadata: $with_metadata_pdf
456EOF
457