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_HEADERS([ \
36    ifaddrs.h \
37    keyutils.h \
38    linux/can.h \
39    linux/dccp.h \
40    linux/cryptouser.h \
41    linux/genetlink.h \
42    linux/keyctl.h \
43    linux/if_packet.h \
44    linux/if_ether.h \
45    linux/mempolicy.h \
46    linux/module.h \
47    linux/netlink.h \
48    mm.h \
49    netinet/sctp.h \
50    pthread.h \
51    sys/epoll.h \
52    sys/fanotify.h \
53    sys/inotify.h \
54    sys/prctl.h \
55    sys/shm.h \
56    sys/ustat.h \
57    sys/xattr.h \
58])
59
60AC_CHECK_FUNCS([ \
61    profil \
62    ustat \
63])
64
65# Tools knobs
66
67# Expect
68AC_ARG_WITH([bash],
69  [AC_HELP_STRING([--with-bash],
70    [have the Bourne Again SHell interpreter (default=no)])],
71  [with_bash=yes],
72)
73if test "x$with_bash" = xyes; then
74    AC_SUBST([WITH_BASH],["yes"])
75else
76    AC_SUBST([WITH_BASH],["no"])
77fi
78
79AC_ARG_WITH([expect],
80  [AC_HELP_STRING([--with-expect],
81    [have the Tcl/expect library (default=yes)])],
82  [with_expect=yes],
83  [with_expect=no]
84)
85if test "x$with_expect" = xyes; then
86    AC_SUBST([WITH_EXPECT],["yes"])
87else
88    AC_SUBST([WITH_EXPECT],["no"])
89fi
90
91# Numa
92AC_ARG_WITH([numa],
93  AC_HELP_STRING([--without-numa],
94    [without numa support (default=no)]),
95  [with_numa=no],
96  [with_numa=yes]
97)
98
99# Perl
100AC_ARG_WITH([perl],
101  [AC_HELP_STRING([--with-perl],
102    [have a perl interpreter (default=yes)])],
103  [with_perl=yes],
104  [with_perl=no]
105)
106if test "x$with_perl" = xyes; then
107    AC_SUBST([WITH_PERL],["yes"])
108else
109    AC_SUBST([WITH_PERL],["no"])
110fi
111
112# Python
113AC_ARG_WITH([python],
114  [AC_HELP_STRING([--with-python],
115    [have a python interpreter (default=yes)])],
116  [with_python=yes],
117  [with_python=no]
118)
119if test "x$with_python" = xyes; then
120    AC_SUBST([WITH_PYTHON],["yes"])
121else
122    AC_SUBST([WITH_PYTHON],["no"])
123fi
124
125# TI RPC
126AC_ARG_WITH([tirpc],
127  AC_HELP_STRING([--without-tirpc],
128    [without libtirpc support (default=no)]),
129  [with_tirpc=no],
130  [with_tirpc=yes]
131)
132# END tools knobs
133
134# Testsuites knobs
135
136AC_ARG_WITH([open-posix-testsuite],
137  [AC_HELP_STRING([--with-open-posix-testsuite],
138    [compile and install the open posix testsuite (default=no)])],
139  [with_open_posix_testsuite=$withval]
140)
141if test "x$with_open_posix_testsuite" = xyes; then
142    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["yes"])
143else
144    AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["no"])
145fi
146
147# testcases/realtime requires bash and python.
148if test "x$with_bash" = xyes && test "x$with_python" = xyes; then
149    AC_ARG_WITH([realtime-testsuite],
150      [AC_HELP_STRING([--with-realtime-testsuite],
151        [compile and install the realtime testsuite (default=no)])],
152      [with_realtime_testsuite=yes]
153    )
154fi
155if test "x$with_realtime_testsuite" = xyes; then
156    AC_SUBST([WITH_REALTIME_TESTSUITE],["yes"])
157    # Run configure on testcases/realtime as well.
158    AC_CONFIG_SUBDIRS([testcases/realtime])
159else
160    AC_SUBST([WITH_REALTIME_TESTSUITE],["no"])
161fi
162
163AC_CONFIG_SUBDIRS([utils/ffsb-6.0-rc2])
164
165AC_CONFIG_COMMANDS([syscalls.h], [cd ${ac_top_srcdir}/include/lapi/syscalls; ./regen.sh])
166
167# END testsuites knobs
168LTP_CHECK_FORTIFY_SOURCE
169LTP_CHECK_CC_WARN_OLDSTYLE
170LTP_CHECK_MKDTEMP
171LTP_CHECK_CAPABILITY_SUPPORT
172LTP_CHECK_CRYPTO
173LTP_CHECK_LINUX_PTRACE
174LTP_CHECK_NOMMU_LINUX
175LTP_CHECK_PRCTL_SUPPORT
176LTP_CHECK_SECUREBITS
177LTP_CHECK_SELINUX
178LTP_CHECK_SIGNAL
179LTP_CHECK_SYSCALL_EVENTFD
180LTP_CHECK_SYSCALL_MODIFY_LDT
181LTP_CHECK_SYSCALL_QUOTACTL
182LTP_CHECK_SYSCALL_SIGNALFD
183LTP_CHECK_SYSCALL_UNSHARE
184LTP_CHECK_SYSCALL_UTIMENSAT
185LTP_CHECK_TASKSTATS
186LTP_CHECK_TIME
187LTP_CHECK_MADVISE
188LTP_CHECK_ACL_SUPPORT
189LTP_CHECK_FS_IOC_FLAGS
190LTP_CHECK_MREMAP_FIXED
191LTP_CHECK_KERNEL_DEVEL
192LTP_CHECK_XFS_QUOTACTL
193LTP_CHECK_CLONE_SUPPORTS_7_ARGS
194LTP_CHECK_MKDIRAT
195LTP_CHECK_FCHOWNAT
196LTP_CHECK_FSTATAT
197LTP_CHECK_MKNODAT
198LTP_CHECK_READLINKAT
199LTP_CHECK_OPENAT
200LTP_CHECK_EXECVEAT
201LTP_CHECK_RENAMEAT
202LTP_CHECK_RENAMEAT2
203LTP_CHECK_STATX
204LTP_CHECK_FALLOCATE
205LTP_CHECK_SYSCALL_FCNTL
206LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
207if test "x$with_tirpc" = xyes; then
208LTP_CHECK_TIRPC
209fi
210LTP_CHECK_TEE
211LTP_CHECK_SPLICE
212LTP_CHECK_VMSPLICE
213LTP_CHECK_TIMERFD
214LTP_CHECK_IOVEC
215LTP_CHECK_LINUXRANDOM
216LTP_CHECK_IF_LINK
217LTP_CHECK_KCMP
218LTP_CHECK_KCMP_TYPE
219LTP_CHECK_PREADV
220LTP_CHECK_PWRITEV
221LTP_CHECK_PREADV2
222LTP_CHECK_PWRITEV2
223LTP_CHECK_EPOLL_PWAIT
224LTP_CHECK_KEYUTILS_SUPPORT
225LTP_CHECK_SYNC_ADD_AND_FETCH
226LTP_CHECK_BUILTIN_CLEAR_CACHE
227LTP_CHECK_MMSGHDR
228LTP_CHECK_UNAME_DOMAINNAME
229LTP_CHECK_X_TABLES
230LTP_CHECK_ATOMIC_MEMORY_MODEL
231LTP_CHECK_TPACKET_V3
232LTP_CHECK_RLIMIT64
233LTP_DETECT_HOST_CPU
234LTP_CHECK_PERF_EVENT
235LTP_CHECK_SYNCFS
236
237if test "x$with_numa" = xyes; then
238	LTP_CHECK_SYSCALL_NUMA
239	numa_error_msg="test requires libnuma >= 2 and it's development packages"
240else
241	numa_error_msg="NUMA support was disabled during build"
242fi
243AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no NUMA support])
244
245AC_OUTPUT
246