1# 2# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED. 3# Copyright (c) UT-Battelle, LLC. 2014-2015. ALL RIGHTS RESERVED. 4# Copyright (C) The University of Tennessee and The University 5# of Tennessee Research Foundation. 2016. ALL RIGHTS RESERVED. 6# Copyright (C) ARM Ltd. 2016-2019. ALL RIGHTS RESERVED. 7# See file LICENSE for terms. 8# 9AC_PREREQ([2.63]) 10 11define([ucx_ver_major], 1) 12define([ucx_ver_minor], 9) 13define([ucx_ver_patch], 0) 14define([ts], esyscmd([sh -c "date +%Y%m%d%H%M%S"])) 15 16# This is the API version (see libtool library versioning) 17# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 18# current:rev:age 19define([libucx_so_version], 0:0:0) 20 21AC_INIT([ucx], [ucx_ver_major.ucx_ver_minor]) 22: ${CPPFLAGS=""} 23: ${CFLAGS=""} 24: ${CXXFLAGS=""} 25config_flags="$*" 26valgrind_libpath="" 27 28AC_USE_SYSTEM_EXTENSIONS 29AC_GNU_SOURCE 30AC_CONFIG_HEADERS([config.h]) 31 32AC_CHECK_PROG(GITBIN, git, yes) 33AS_IF([test x"${GITBIN}" = x"yes"], 34 [# remove preceding "refs/heads/" (11 characters) for symbolic ref 35 AC_SUBST(SCM_BRANCH, esyscmd([sh -c 'git symbolic-ref --quiet HEAD | sed "s/^.\{11\}//"'])) 36 AC_SUBST(SCM_VERSION, esyscmd([sh -c 'git rev-parse --short=7 HEAD']))], 37 [AC_SUBST(SCM_BRANCH, "<unknown>") 38 AC_SUBST(SCM_VERSION, "0000000")]) 39 40AH_TOP([ 41#ifndef UCX_CONFIG_H 42#define UCX_CONFIG_H 43]) 44 45AH_BOTTOM([ 46#endif /* UCX_CONFIG_H */ 47]) 48 49AM_INIT_AUTOMAKE([1.10 foreign tar-ustar subdir-objects]) 50m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 51AM_MAINTAINER_MODE 52AC_CONFIG_MACRO_DIR([config/m4]) 53 54define([ucx_prefix], [/usr]) 55AC_PREFIX_DEFAULT([ucx_prefix]) 56 57top_top_srcdir=$srcdir 58AC_SUBST(top_top_srcdir) 59 60MAJOR_VERSION=ucx_ver_major 61MINOR_VERSION=ucx_ver_minor 62PATCH_VERSION=ucx_ver_patch 63VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION 64SOVERSION=libucx_so_version 65AC_SUBST(MAJOR_VERSION) 66AC_SUBST(MINOR_VERSION) 67AC_SUBST(PATCH_VERSION) 68AC_SUBST(SCM_VERSION) 69AC_SUBST(SOVERSION) 70 71AC_PROG_CC 72AC_PROG_CXX 73AC_OPENMP 74AM_PROG_AS 75AC_PROG_LN_S 76AC_PROG_MKDIR_P 77AC_PROG_SED 78AC_PROG_INSTALL 79AC_PROG_LIBTOOL 80AC_HEADER_STDC 81LT_LIB_M 82AC_C_RESTRICT 83AC_FUNC_STRERROR_R 84 85AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [pkg-config]) 86 87AC_ARG_ENABLE([embedded], 88 [AS_HELP_STRING([--enable-embedded], 89 [Enable embedded mode @<:@default=no@:>@]) 90 ]) 91AM_CONDITIONAL([EMBEDDED], [test x"$enable_embedded" = x"yes"]) 92 93# 94# Force link_all_deplibs=yes for libtool, otherwise it will not 95# link against dependency libs 96# 97link_all_deplibs=yes 98 99 100# 101# Check if 'ln' supports creating relative links 102# 103AC_MSG_CHECKING([if ${LN_S} supports --relative]) 104AS_IF([${LN_S} --relative symlinktest 2>/dev/null], 105 [AC_MSG_RESULT([yes]) 106 AC_SUBST([LN_RS], ["${LN_S} --relative"]) 107 rm symlinktest], 108 [AC_MSG_RESULT([no]) 109 AC_SUBST([LN_RS], [${LN_S}])]) 110 111 112# 113# Save config flags for version dump tool 114# 115AC_DEFINE_UNQUOTED([UCX_CONFIGURE_FLAGS], ["$config_flags"], [UCX configure flags]) 116 117 118# 119# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. 120# 121m4_ifdef([AS_VAR_APPEND], 122[m4_copy([AS_VAR_APPEND], [ucx_AS_VAR_APPEND])], 123[m4_define([ucx_AS_VAR_APPEND], 124[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) 125 126 127# 128# Paths for loadable modules 129# 130AC_SUBST([modulesubdir], [${PACKAGE_NAME}]) # module directory names 131AC_SUBST([moduledir], [${libdir}/${modulesubdir}]) # module installation directory 132AC_SUBST([localmoduledir], ['$(abs_top_builddir)/modules']) # local directory for module symlinks 133AC_SUBST([objdir], [${objdir}]) # libtool objects dir, usually .libs 134AC_SUBST([shrext], [${shrext_cmds}]) # libtool shared library extension 135AC_DEFINE_UNQUOTED([UCX_MODULE_SUBDIR], ["${modulesubdir}"], [UCX module sub-directory]) 136 137 138# 139# Additional m4 files 140# 141m4_include([config/m4/ax_prog_doxygen.m4]) 142m4_include([config/m4/graphviz.m4]) 143m4_include([config/m4/ucg.m4]) 144 145AC_ARG_WITH([docs_only], 146 AS_HELP_STRING([--with-docs-only], 147 [Compile only the docs and not the rest of UCX. [default=NO]]), 148 ,[:],[with_docs_only=no]) 149 150AC_DEFUN([UCX_DX_ENABLE_CHECK], 151 [AS_IF([DX_TEST_FEATURE($1)], 152 [], 153 [AS_IF([test "x$enable_doxygen_$1" == xyes], 154 [AC_MSG_ERROR([--enable-doxygen-$1 was specified, but $1 tools were not found])], 155 [])])]) 156 157# 158# Doxygen options 159# 160DX_PS_FEATURE(OFF) 161DX_HTML_FEATURE(ON) 162DX_MAN_FEATURE(ON) 163DX_PDF_FEATURE(ON) 164DX_INIT_DOXYGEN([UCX],[docs/doxygen/ucxdox],[docs/doxygen-doc]) 165 166AS_IF([test "x$with_docs_only" = xyes], 167 [AS_MESSAGE([Documents only requested]) 168 AS_IF([DX_TEST_FEATURE(doc)], 169 [], 170 [AC_MSG_ERROR([--with-only-docs was specified, but doxygen was not found])]) 171 UCX_DX_ENABLE_CHECK([html]) 172 UCX_DX_ENABLE_CHECK([man]) 173 UCX_DX_ENABLE_CHECK([pdf]) 174 AM_CONDITIONAL([DOCS_ONLY], [true]) 175 AM_CONDITIONAL([HAVE_GTEST], [false]) 176 AM_CONDITIONAL([HAVE_STATS], [false]) 177 AM_CONDITIONAL([HAVE_TUNING], [false]) 178 AM_CONDITIONAL([HAVE_MEMTRACK], [false]) 179 AM_CONDITIONAL([HAVE_IB], [false]) 180 AM_CONDITIONAL([HAVE_MLX5_HW], [false]) 181 AM_CONDITIONAL([HAVE_MLX5_HW_UD], [false]) 182 AM_CONDITIONAL([HAVE_MLX5_DV], [false]) 183 AM_CONDITIONAL([HAVE_DEVX], [false]) 184 AM_CONDITIONAL([HAVE_EXP], [false]) 185 AM_CONDITIONAL([HAVE_TL_RC], [false]) 186 AM_CONDITIONAL([HAVE_TL_DC], [false]) 187 AM_CONDITIONAL([HAVE_DC_DV], [false]) 188 AM_CONDITIONAL([HAVE_DC_EXP], [false]) 189 AM_CONDITIONAL([HAVE_TL_UD], [false]) 190 AM_CONDITIONAL([HAVE_TL_CM], [false]) 191 AM_CONDITIONAL([HAVE_CRAY_UGNI], [false]) 192 AM_CONDITIONAL([HAVE_CUDA], [false]) 193 AM_CONDITIONAL([HAVE_GDR_COPY], [false]) 194 AM_CONDITIONAL([HAVE_ROCM], [false]) 195 AM_CONDITIONAL([HAVE_HIP], [false]) 196 AM_CONDITIONAL([HAVE_XPMEM], [false]) 197 AM_CONDITIONAL([HAVE_CMA], [false]) 198 AM_CONDITIONAL([HAVE_KNEM], [false]) 199 AM_CONDITIONAL([HAVE_RDMACM], [false]) 200 AM_CONDITIONAL([HAVE_RDMACM_QP_LESS], [false]) 201 AM_CONDITIONAL([HAVE_MPI], [false]) 202 AM_CONDITIONAL([HAVE_MPIRUN], [false]) 203 AM_CONDITIONAL([HAVE_MPICC], [false]) 204 AM_CONDITIONAL([HAVE_PROFILING], [false]) 205 AM_CONDITIONAL([HAVE_UCM_PTMALLOC286], [false]) 206 AM_CONDITIONAL([HAVE_JAVA], [false]) 207 AM_CONDITIONAL([HAVE_CXX11], [false]) 208 AM_CONDITIONAL([HAVE_GNUXX11], [false]) 209 AM_CONDITIONAL([HAVE_GLIBCXX_NOTHROW], [false]) 210 AM_CONDITIONAL([HAVE_TCMALLOC], [false]) 211 AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API], [false]) 212 AM_CONDITIONAL([INSTALL_DEVEL_HEADERS], [false]) 213 AM_CONDITIONAL([HAVE_EXAMPLES], [false]) 214 AM_CONDITIONAL([HAVE_AARCH64_THUNDERX2], [false]) 215 AM_CONDITIONAL([HAVE_AARCH64_THUNDERX1], [false]) 216 AM_CONDITIONAL([HAVE_AARCH64_HI1620], [false]) 217 ], 218 [ 219 AM_CONDITIONAL([DOCS_ONLY], [false]) 220 m4_include([config/m4/compiler.m4]) 221 m4_include([config/m4/sysdep.m4]) 222 m4_include([config/m4/ucs.m4]) 223 m4_include([config/m4/ucm.m4]) 224 m4_include([config/m4/mpi.m4]) 225 m4_include([config/m4/rte.m4]) 226 m4_include([config/m4/java.m4]) 227 m4_include([config/m4/cuda.m4]) 228 m4_include([config/m4/rocm.m4]) 229 m4_include([config/m4/gdrcopy.m4]) 230 m4_include([src/ucm/configure.m4]) 231 m4_include([src/uct/configure.m4]) 232 m4_include([src/tools/perf/configure.m4]) 233 m4_include([test/gtest/configure.m4]) 234 235 236 # 237 # Enable fault injection code 238 # 239 AC_ARG_ENABLE([fault-injection], 240 AS_HELP_STRING([--enable-fault-injection], 241 [Enable fault injection code, default: NO]), 242 [], 243 [enable_fault_injection=no]) 244 AS_IF([test "x$enable_fault_injection" = xyes], 245 [AS_MESSAGE([enabling with fault injection code]) 246 AC_DEFINE([ENABLE_FAULT_INJECTION], [1], [Enable fault injection code])], 247 [:]) 248 249 250 # 251 # Disable checking user parameters 252 # 253 AC_ARG_ENABLE([params-check], 254 AS_HELP_STRING([--disable-params-check], 255 [Disable checking user parameters passed to API, default: NO]), 256 [], 257 [enable_params_check=yes]) 258 AS_IF([test "x$enable_params_check" = xyes], 259 [AC_DEFINE([ENABLE_PARAMS_CHECK], [1], [Enable checking user parameters])], 260 [AC_DEFINE([ENABLE_PARAMS_CHECK], [0])]) 261 262 # 263 # Enable collecting data to ease debugging 264 # 265 AC_ARG_ENABLE([debug-data], 266 AS_HELP_STRING([--enable-debug-data], 267 [Enable collecting data to ease debugging, default: NO]), 268 [], 269 [enable_debug_data=no]) 270 AS_IF([test "x$enable_debug_data" = xyes], 271 [AC_DEFINE([ENABLE_DEBUG_DATA], [1], [Enable collecting data]) 272 AC_DEFINE([UCT_UD_EP_DEBUG_HOOKS], [1], 273 [Enable packet header inspection/rewriting in UCT/UD])], 274 [AC_DEFINE([ENABLE_DEBUG_DATA], [0]) 275 AC_DEFINE([UCT_UD_EP_DEBUG_HOOKS], [0])]) 276 277 278 # 279 # Enable multithreading support 280 # 281 AC_ARG_ENABLE([mt], 282 AS_HELP_STRING([--enable-mt], 283 [Enable thread support in UCP and UCT, default: NO]), 284 [], 285 [enable_mt=no]) 286 AS_IF([test "x$enable_mt" = xyes], 287 [AC_DEFINE([ENABLE_MT], [1], [Enable thread support in UCP and UCT]) 288 mt_enable=enabled], 289 [AC_DEFINE([ENABLE_MT], [0]) 290 mt_enable=disabled]) 291 292 293 # 294 # Enable experimental header 295 # 296 AC_ARG_ENABLE([experimental-api], 297 AS_HELP_STRING([--enable-experimental-api], 298 [Enable installing experimental APIs, default: NO]), 299 [], 300 [enable_experimental_api=no]) 301 AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API], [test "x$enable_experimental_api" = "xyes"]) 302 303 304 # 305 # Install development headers 306 # 307 AC_ARG_ENABLE([devel-headers], 308 AS_HELP_STRING([--enable-devel-headers], 309 [Enable installing development headers, default: NO]), 310 [], 311 [enable_devel_headers=no]) 312 AM_CONDITIONAL([INSTALL_DEVEL_HEADERS], [test "x$enable_devel_headers" = "xyes"]) 313 314 315 # 316 # Path for valgrind-enabled libraries 317 # 318 AC_SUBST([VALGRIND_LIBPATH], [${valgrind_libpath}]) 319 320 321 # 322 # Enable examples build 323 # 324 AC_ARG_ENABLE([examples], 325 AS_HELP_STRING([--enable-examples], 326 [Enable examples build, default: NO]), 327 [], 328 [enable_examples=no]) 329 AM_CONDITIONAL([HAVE_EXAMPLES], [test "x$enable_examples" = "xyes"]) 330 ]) # Docs only 331 332# 333# Print which transports are built 334# 335build_modules="${uct_modules}" 336build_modules="${build_modules}${uct_ib_modules}" 337build_modules="${build_modules}${uct_cuda_modules}" 338build_modules="${build_modules}${ucm_modules}" 339build_modules="${build_modules}${ucx_perftest_modules}" 340build_modules="${build_modules}${uct_rocm_modules}" 341build_modules="${build_modules}${ucg_modules}" 342AC_SUBST([build_modules], [${build_modules}]) 343AC_SUBST([build_bindings], [${build_bindings}]) 344 345# 346# Final output 347# 348AC_CONFIG_FILES([Makefile 349 docs/doxygen/header.tex 350 src/uct/api/version.h 351 ]) 352AS_IF([test "x$with_docs_only" = xyes], [], [ 353AC_CONFIG_LINKS([ 354 debian/compat:debian/compat 355 debian/copyright:debian/copyright 356 debian/ucx.prerm:debian/ucx.prerm 357 ]) 358AC_CONFIG_FILES([ 359 ucx.spec 360 ucx.pc 361 contrib/rpmdef.sh 362 debian/rules 363 debian/control 364 debian/changelog 365 src/ucs/Makefile 366 src/ucp/Makefile 367 src/ucp/api/ucp_version.h 368 src/ucp/core/ucp_version.c 369 src/tools/info/Makefile 370 src/tools/profile/Makefile 371 test/apps/Makefile 372 test/apps/iodemo/Makefile 373 test/apps/sockaddr/Makefile 374 test/apps/profiling/Makefile 375 test/mpi/Makefile 376 bindings/java/Makefile 377 bindings/java/pom.xml 378 bindings/java/src/main/native/Makefile 379 examples/Makefile 380 ]) 381 382AC_CONFIG_FILES([test/mpi/run_mpi.sh], [chmod a+x test/mpi/run_mpi.sh]) 383]) 384 385 386AC_OUTPUT 387 388 389# 390# Print build condiguration 391# 392AC_MSG_NOTICE([=========================================================]) 393AS_IF([test "x$with_docs_only" = xyes], 394[ 395AC_MSG_NOTICE([Building documents only]) 396], 397[ 398AC_MSG_NOTICE([UCX build configuration:]) 399AC_MSG_NOTICE([ Build prefix: ${prefix}]) 400AC_MSG_NOTICE([Preprocessor flags: ${BASE_CPPFLAGS}]) 401AC_MSG_NOTICE([ C compiler: ${CC} ${BASE_CFLAGS}]) 402AC_MSG_NOTICE([ C++ compiler: ${CXX} ${BASE_CXXFLAGS}]) 403AC_MSG_NOTICE([ Multi-thread: ${mt_enable}]) 404AC_MSG_NOTICE([ MPI tests: ${mpi_enable}]) 405AC_MSG_NOTICE([ Devel headers: ${enable_devel_headers}]) 406AC_MSG_NOTICE([ Bindings: <$(echo ${build_bindings}|tr ':' ' ') >]) 407AC_MSG_NOTICE([ UCT modules: <$(echo ${uct_modules}|tr ':' ' ') >]) 408AC_MSG_NOTICE([ CUDA modules: <$(echo ${uct_cuda_modules}|tr ':' ' ') >]) 409AC_MSG_NOTICE([ ROCM modules: <$(echo ${uct_rocm_modules}|tr ':' ' ') >]) 410AC_MSG_NOTICE([ IB modules: <$(echo ${uct_ib_modules}|tr ':' ' ') >]) 411AC_MSG_NOTICE([ UCM modules: <$(echo ${ucm_modules}|tr ':' ' ') >]) 412AC_MSG_NOTICE([ Perf modules: <$(echo ${ucx_perftest_modules}|tr ':' ' ') >]) 413AS_IF([test "x$enable_ucg" != "xno"], [ 414 AC_MSG_NOTICE([ UCG modules: <$(echo ${ucg_modules}|tr ':' ' ') >])]) 415]) 416AC_MSG_NOTICE([=========================================================]) 417