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