# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) AC_CONFIG_AUX_DIR([automake]) AC_CONFIG_MACRO_DIRS([automake]) AM_SILENT_RULES([yes]) m4_include([../automake/cfa.m4]) AM_INIT_AUTOMAKE([subdir-objects]) # don't use the default CFLAGS as they unconditonnaly add -O2 : ${CFLAGS=""} # define this to override AR_FLAGS="cr" # Allow program name tansformation # will fill program_transform_name with appropriate sed regex AC_ARG_PROGRAM AC_ARG_VAR(ARCHITECTURE, [The architecture to use when building libcfa]) AC_ARG_VAR(CONFIGURATION, [The configuration to use when building libcfa, options are: deubg, nodebug, nolib (prelude-only)]) AC_ARG_VAR(DRIVER_DIR, [The path to the cforall driver directory]) AC_ARG_VAR(CFA_VERSION, [The long version of cfa]) AC_ARG_ENABLE(distcc, [ --enable-distcc whether or not to enable distributed compilation], enable_distcc=$enableval, enable_distcc=no) AC_ARG_WITH(bwlimit, [ --with-bwlimit=RATE RATE the maximum rate at which rsync will be limited when using distributed builds], DIST_BWLIMIT=$withval, DIST_BWLIMIT=0) echo -n "checking for distributated build... " if test x$enable_distcc = xno; then CFACC=${DRIVER_DIR}cfa echo "no" else tools="$(readlink -m $ac_confdir/)/../tools/build" config=$(basename $(readlink -f .)) echo "$tools/distcc_hash $config" CFADIR_HASH=$($tools/distcc_hash $config) CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa" echo "yes (hash=${CFADIR_HASH})" fi CFACPP=${DRIVER_DIR}cfa-cpp LOCAL_CFACC=${DRIVER_DIR}cfa LOCAL_CC1=${DRIVER_DIR}cc1 AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes]) AC_SUBST(CFACC) AC_SUBST(CFACPP) AC_SUBST(LOCAL_CFACC) AC_SUBST(LOCAL_CC1) AC_SUBST(CFADIR_HASH) AC_SUBST(CFA_VERSION) AC_SUBST(DIST_BWLIMIT) #============================================================================== #Handle specific flags case $ARCHITECTURE in "x64" ) ARCH_FLAGS="-m64";; "x86" ) ARCH_FLAGS="-m32";; "arm" ) ARCH_FLAGS="";; esac AC_SUBST(ARCH_FLAGS) case $CONFIGURATION in "debug" ) CONFIG_CFLAGS="-O0 -g" CONFIG_CFAFLAGS="-debug" CONFIG_BUILDLIB="yes" ;; "nodebug" ) CONFIG_CFLAGS="-O3 -s" CONFIG_CFAFLAGS="-nodebug" CONFIG_BUILDLIB="yes" ;; "nolib" ) CONFIG_CFLAGS="-O3 -s" CONFIG_CFAFLAGS="-nolib" CONFIG_BUILDLIB="no" ;; "profile" ) CONFIG_CFLAGS="-O3 -g -fno-omit-frame-pointer" CONFIG_CFAFLAGS="-nodebug" CONFIG_BUILDLIB="yes" ;; *) AC_MSG_ERROR('Invalid value $CONFIGURATION for \$CONFIGURATION') ;; esac CONFIG_CFAFLAGS="${CONFIG_CFAFLAGS} ${CFAFLAGS}" AC_SUBST(CONFIG_CFLAGS) AC_SUBST(CONFIG_CFAFLAGS) AC_SUBST(CONFIG_BUILDLIB) AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"]) #============================================================================== #Trasforming cc1 will break compilation M4CFA_PROGRAM_NAME #============================================================================== # Installation paths M4CFA_PARSE_PREFIX # Checks for programs. LT_INIT([disable-static]) AC_PROG_CXX AC_PROG_CC AM_PROG_AS AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_MAKE_SET #io_uring 5.4 and earlier uses defines #io_uring 5.5 uses enum values #io_uring 5.6 and later uses probes define(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]) define(ioring_from_decls, [ m4_foreach([op], [ioring_ops], [ AC_CHECK_DECL(op, [AC_DEFINE([CFA_HAVE_]op)], [], [[#include ]]) ]) ]) AC_CHECK_HEADERS([linux/io_uring.h], [ AC_DEFINE(CFA_HAVE_LINUX_IO_URING_H) AC_CHECK_HEADER([liburing.h], [ AC_CHECK_LIB([uring], [io_uring_get_probe], [ m4_foreach([op], [ioring_ops], [ AC_CHECK_DECL(op, [ AC_RUN_IFELSE([ AC_LANG_PROGRAM( [[#include ]], [[int main() {]] [[ struct io_uring_probe *probe = io_uring_get_probe();]] [[ if(io_uring_opcode_supported(probe, ]]op[[))]] [[ return 0;]] [[ else]] [[ return 1;]] [[}]] ) ],[ AC_DEFINE([CFA_HAVE_]op) ],[ AC_MSG_FAILURE([Check support for] op [ with liburing failed]) ]) ], [], [[#include ]]) ]) ], [ ioring_from_decls ]) ], [ ioring_from_decls ]) ]) AC_CHECK_FUNCS([preadv2 pwritev2]) AC_CONFIG_FILES([ Makefile src/Makefile prelude/Makefile ]) AC_CONFIG_HEADERS(prelude/defines.hfa) AC_OUTPUT() # Final text AC_MSG_RESULT(Cforall library configuraton completed. Type "make -j 8 install".)