source: libcfa/configure.ac @ 7ed1d8f

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 7ed1d8f was 85f19eb, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added cfa define for io_uring attach support

  • Property mode set to 100644
File size: 11.9 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
6AC_CONFIG_AUX_DIR([automake])
7AC_CONFIG_MACRO_DIRS([automake])
8AM_SILENT_RULES([yes])
9
10m4_include([../tools/build/cfa.m4])
11
12AM_INIT_AUTOMAKE([subdir-objects])
13
14# don't use the default CFLAGS as they unconditonnaly add -O2
15: ${CFLAGS=""}
16
17# define this to override
18AR_FLAGS="cr"
19
20# Allow program name tansformation
21# will fill program_transform_name with appropriate sed regex
22AC_ARG_PROGRAM
23
24AC_ARG_VAR(ARCHITECTURE,  [The architecture  to use when building libcfa])
25AC_ARG_VAR(CONFIGURATION, [The configuration to use when building libcfa, options are: deubg, nodebug, nolib (prelude-only)])
26AC_ARG_VAR(DRIVER_DIR, [The path to the cforall driver directory])
27AC_ARG_VAR(CFA_VERSION, [The long version of cfa])
28
29AC_ARG_ENABLE(distcc,
30        [  --enable-distcc     whether or not to enable distributed compilation],
31        enable_distcc=$enableval, enable_distcc=no)
32
33AC_ARG_WITH(bwlimit,
34        [  --with-bwlimit=RATE     RATE the maximum rate at which rsync will be limited when using distributed builds],
35        DIST_BWLIMIT=$withval, DIST_BWLIMIT=0)
36
37echo -n "checking for distributated build... "
38if test x$enable_distcc = xno; then
39        CFACC=${DRIVER_DIR}cfa
40        echo "no"
41else
42        tools="$(readlink -m $ac_confdir/)/../tools/build"
43        config=$(basename $(readlink -f .))
44        echo "$tools/distcc_hash $config"
45        CFADIR_HASH=$($tools/distcc_hash $config)
46        CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
47        echo "yes (hash=${CFADIR_HASH})"
48fi
49CFACPP=${DRIVER_DIR}cfa-cpp
50LOCAL_CFACC=${DRIVER_DIR}cfa
51LOCAL_CC1=${DRIVER_DIR}cc1
52
53AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
54
55AC_SUBST(CFACC)
56AC_SUBST(CFACPP)
57AC_SUBST(LOCAL_CFACC)
58AC_SUBST(LOCAL_CC1)
59AC_SUBST(CFADIR_HASH)
60AC_SUBST(CFA_VERSION)
61AC_SUBST(DIST_BWLIMIT)
62
63#==============================================================================
64#Handle specific flags
65case $ARCHITECTURE in
66        "x64"        ) ARCH_FLAGS="-m64";;
67        "x86"        ) ARCH_FLAGS="-m32";;
68        "arm"        ) ARCH_FLAGS="";;
69esac
70
71AC_SUBST(ARCH_FLAGS)
72
73case $CONFIGURATION in
74        "debug"   )
75                CONFIG_CFLAGS="-O0 -g"
76                CONFIG_CFAFLAGS="-debug"
77                CONFIG_BUILDLIB="yes"
78        ;;
79        "nodebug" )
80                CONFIG_CFLAGS="-O3 -s"
81                CONFIG_CFAFLAGS="-nodebug"
82                CONFIG_BUILDLIB="yes"
83        ;;
84        "nolib"   )
85                CONFIG_CFLAGS="-O3 -s"
86                CONFIG_CFAFLAGS="-nolib"
87                CONFIG_BUILDLIB="no"
88        ;;
89        "profile" )
90                CONFIG_CFLAGS="-O3 -g -fno-omit-frame-pointer"
91                CONFIG_CFAFLAGS="-nodebug"
92                CONFIG_BUILDLIB="yes"
93        ;;
94        *)
95        AC_MSG_ERROR('Invalid value $CONFIGURATION for \$CONFIGURATION')
96        ;;
97esac
98
99CONFIG_CFAFLAGS="${CONFIG_CFAFLAGS} ${CFAFLAGS}"
100
101AC_SUBST(CONFIG_CFLAGS)
102AC_SUBST(CONFIG_CFAFLAGS)
103AC_SUBST(CONFIG_BUILDLIB)
104
105AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"])
106
107AM_T='$(T)'
108AC_SUBST(AM_T)
109
110#==============================================================================
111#Trasforming cc1 will break compilation
112M4CFA_PROGRAM_NAME
113
114#==============================================================================
115# Installation paths
116M4CFA_PARSE_PREFIX
117
118# Checks for programs.
119LT_INIT([disable-static])
120
121AC_PROG_CXX
122AC_PROG_CC
123AM_PROG_AS
124AC_PROG_LIBTOOL
125AC_PROG_INSTALL
126AC_PROG_MAKE_SET
127
128
129
130#io_uring 5.4 and earlier uses defines
131#io_uring 5.5 uses enum values
132#io_uring 5.6 and later uses probes
133
134AH_TEMPLATE([CFA_HAVE_LINUX_IO_URING_H],[Defined if io_uring support is present when compiling libcfathread.])
135AH_TEMPLATE([CFA_HAVE_IORING_OP_NOP],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_NOP.])
136AH_TEMPLATE([CFA_HAVE_IORING_OP_READV],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_READV.])
137AH_TEMPLATE([CFA_HAVE_IORING_OP_WRITEV],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_WRITEV.])
138AH_TEMPLATE([CFA_HAVE_IORING_OP_FSYNC],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_FSYNC.])
139AH_TEMPLATE([CFA_HAVE_IORING_OP_READ_FIXED],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_READ_FIXED.])
140AH_TEMPLATE([CFA_HAVE_IORING_OP_WRITE_FIXED],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_WRITE_FIXED.])
141AH_TEMPLATE([CFA_HAVE_IORING_OP_POLL_ADD],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_POLL_ADD.])
142AH_TEMPLATE([CFA_HAVE_IORING_OP_POLL_REMOVE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_POLL_REMOVE.])
143AH_TEMPLATE([CFA_HAVE_IORING_OP_SYNC_FILE_RANGE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_SYNC_FILE_RANGE.])
144AH_TEMPLATE([CFA_HAVE_IORING_OP_SENDMSG],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_SENDMSG.])
145AH_TEMPLATE([CFA_HAVE_IORING_OP_RECVMSG],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_RECVMSG.])
146AH_TEMPLATE([CFA_HAVE_IORING_OP_TIMEOUT],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_TIMEOUT.])
147AH_TEMPLATE([CFA_HAVE_IORING_OP_TIMEOUT_REMOVE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_TIMEOUT_REMOVE.])
148AH_TEMPLATE([CFA_HAVE_IORING_OP_ACCEPT],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_ACCEPT.])
149AH_TEMPLATE([CFA_HAVE_IORING_OP_ASYNC_CANCEL],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_ASYNC_CANCEL.])
150AH_TEMPLATE([CFA_HAVE_IORING_OP_LINK_TIMEOUT],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_LINK_TIMEOUT.])
151AH_TEMPLATE([CFA_HAVE_IORING_OP_CONNECT],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_CONNECT.])
152AH_TEMPLATE([CFA_HAVE_IORING_OP_FALLOCATE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_FALLOCATE.])
153AH_TEMPLATE([CFA_HAVE_IORING_OP_OPENAT],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_OPENAT.])
154AH_TEMPLATE([CFA_HAVE_IORING_OP_CLOSE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_CLOSE.])
155AH_TEMPLATE([CFA_HAVE_IORING_OP_FILES_UPDATE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_FILES_UPDATE.])
156AH_TEMPLATE([CFA_HAVE_IORING_OP_STATX],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_STATX.])
157AH_TEMPLATE([CFA_HAVE_IORING_OP_READ],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_READ.])
158AH_TEMPLATE([CFA_HAVE_IORING_OP_WRITE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_WRITE.])
159AH_TEMPLATE([CFA_HAVE_IORING_OP_FADVISE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_FADVISE.])
160AH_TEMPLATE([CFA_HAVE_IORING_OP_MADVISE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_MADVISE.])
161AH_TEMPLATE([CFA_HAVE_IORING_OP_SEND],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_SEND.])
162AH_TEMPLATE([CFA_HAVE_IORING_OP_RECV],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_RECV.])
163AH_TEMPLATE([CFA_HAVE_IORING_OP_OPENAT2],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_OPENAT2.])
164AH_TEMPLATE([CFA_HAVE_IORING_OP_EPOLL_CTL],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_EPOLL_CTL.])
165AH_TEMPLATE([CFA_HAVE_IORING_OP_SPLICE],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_SPLICE.])
166AH_TEMPLATE([CFA_HAVE_IORING_OP_PROVIDE_BUFFERS],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_PROVIDE_BUFFERS.])
167AH_TEMPLATE([CFA_HAVE_IORING_OP_REMOVE_BUFFER],[Defined if io_uring support is present when compiling libcfathread and supports the operation IORING_OP_REMOVE_BUFFER.])
168AH_TEMPLATE([CFA_HAVE_IOSQE_FIXED_FILE],[Defined if io_uring support is present when compiling libcfathread and supports the flag FIXED_FILE.])
169AH_TEMPLATE([CFA_HAVE_IOSQE_IO_DRAIN],[Defined if io_uring support is present when compiling libcfathread and supports the flag IO_DRAIN.])
170AH_TEMPLATE([CFA_HAVE_IOSQE_ASYNC],[Defined if io_uring support is present when compiling libcfathread and supports the flag ASYNC.])
171AH_TEMPLATE([CFA_HAVE_IOSQE_IO_LINK],[Defined if io_uring support is present when compiling libcfathread and supports the flag IO_LINK.])
172AH_TEMPLATE([CFA_HAVE_IOSQE_IO_HARDLINK],[Defined if io_uring support is present when compiling libcfathread and supports the flag IO_HARDLINK.])
173AH_TEMPLATE([CFA_HAVE_SPLICE_F_FD_IN_FIXED],[Defined if io_uring support is present when compiling libcfathread and supports the flag SPLICE_F_FD_IN_FIXED.])
174AH_TEMPLATE([CFA_HAVE_IORING_SETUP_ATTACH_WQ],[Defined if io_uring support is present when compiling libcfathread and supports the flag IORING_SETUP_ATTACH_WQ.])
175AH_TEMPLATE([HAVE_PREADV2],[Defined if preadv2 support is present when compiling libcfathread.])
176AH_TEMPLATE([HAVE_PWRITEV2],[Defined if pwritev2 support is present when compiling libcfathread.])
177AH_TEMPLATE([__CFA_NO_STATISTICS__],[Defined if libcfathread was compiled without support for statistics.])
178
179define(ioring_ops, [IORING_OP_NOP,IORING_OP_READV,IORING_OP_WRITEV,IORING_OP_FSYNC,IORING_OP_READ_FIXED,IORING_OP_WRITE_FIXED,IORING_OP_POLL_ADD,IORING_OP_POLL_REMOVE,IORING_OP_SYNC_FILE_RANGE,IORING_OP_SENDMSG,IORING_OP_RECVMSG,IORING_OP_TIMEOUT,IORING_OP_TIMEOUT_REMOVE,IORING_OP_ACCEPT,IORING_OP_ASYNC_CANCEL,IORING_OP_LINK_TIMEOUT,IORING_OP_CONNECT,IORING_OP_FALLOCATE,IORING_OP_OPENAT,IORING_OP_CLOSE,IORING_OP_FILES_UPDATE,IORING_OP_STATX,IORING_OP_READ,IORING_OP_WRITE,IORING_OP_FADVISE,IORING_OP_MADVISE,IORING_OP_SEND,IORING_OP_RECV,IORING_OP_OPENAT2,IORING_OP_EPOLL_CTL,IORING_OP_SPLICE,IORING_OP_PROVIDE_BUFFERS,IORING_OP_REMOVE_BUFFER])
180define(ioring_flags, [IOSQE_FIXED_FILE,IOSQE_IO_DRAIN,IOSQE_ASYNC,IOSQE_IO_LINK,IOSQE_IO_HARDLINK,SPLICE_F_FD_IN_FIXED,IORING_SETUP_ATTACH_WQ])
181
182define(ioring_from_decls, [
183        m4_foreach([op], [ioring_ops], [
184                AC_CHECK_DECL(op, [AC_DEFINE([CFA_HAVE_]op)], [], [[#include <linux/io_uring.h>]])
185        ])
186])
187
188AC_CHECK_HEADERS([linux/io_uring.h], [
189        AC_DEFINE(CFA_HAVE_LINUX_IO_URING_H)
190        AC_CHECK_HEADER([liburing.h], [
191                AC_CHECK_LIB([uring], [io_uring_get_probe], [
192                        m4_foreach([op], [ioring_ops], [
193                                AC_CHECK_DECL(op, [
194                                        AC_RUN_IFELSE([
195                                                AC_LANG_PROGRAM(
196                                                        [[#include <liburing.h>]],
197                                                        [[int main() {]]
198                                                        [[      struct io_uring_probe *probe = io_uring_get_probe();]]
199                                                        [[      if(io_uring_opcode_supported(probe, ]]op[[))]]
200                                                        [[              return 0;]]
201                                                        [[      else]]
202                                                        [[              return 1;]]
203                                                        [[}]]
204                                                )
205                                        ],[
206                                                AC_DEFINE([CFA_HAVE_]op)
207                                        ],[
208                                                AC_MSG_FAILURE([Check support for] op [ with liburing failed])
209                                        ])
210                                ], [], [[#include <linux/io_uring.h>]])
211                        ])
212                ], [
213                        ioring_from_decls
214                ])
215        ], [
216                ioring_from_decls
217        ])
218
219        # check support for various io_uring flags
220        m4_foreach([op], [ioring_flags], [
221                AC_CHECK_DECL(op, [AC_DEFINE([CFA_HAVE_]op)], [], [[#include <linux/io_uring.h>]])
222        ])
223])
224AC_CHECK_FUNCS([preadv2 pwritev2])
225
226AC_CONFIG_FILES([
227        Makefile
228        src/Makefile
229        prelude/Makefile
230        ])
231
232AC_CONFIG_HEADERS(prelude/defines.hfa)
233
234AC_OUTPUT()
235
236# Final text
237AC_MSG_RESULT(Cforall library configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.