|
Packit |
345191 |
#
|
|
Packit |
345191 |
# Copyright (C) 2014 - 2019 Intel Corporation.
|
|
Packit |
345191 |
# All rights reserved.
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
345191 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
345191 |
# 1. Redistributions of source code must retain the above copyright notice(s),
|
|
Packit |
345191 |
# this list of conditions and the following disclaimer.
|
|
Packit |
345191 |
# 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
|
Packit |
345191 |
# this list of conditions and the following disclaimer in the documentation
|
|
Packit |
345191 |
# and/or other materials provided with the distribution.
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
|
Packit |
345191 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
Packit |
345191 |
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
Packit |
345191 |
# EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
345191 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
345191 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
Packit |
345191 |
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
Packit |
345191 |
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
Packit |
345191 |
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
Packit |
345191 |
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# -*- Autoconf -*-
|
|
Packit |
345191 |
# Process this file with autoconf to produce a configure script.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_PREREQ([2.63])
|
|
Packit |
345191 |
AC_INIT([memkind],m4_esyscmd([tr -d '\n' < VERSION]))
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_CONFIG_MACRO_DIR([m4])
|
|
Packit |
345191 |
AC_CONFIG_HEADERS([config.h])
|
|
Packit |
345191 |
AC_CONFIG_SRCDIR([memkind.spec.mk])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.11 silent-rules subdir-objects parallel-tests tar-pax])
|
|
Packit |
345191 |
AM_SILENT_RULES([yes])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# Checks for programs and libraries.
|
|
Packit |
345191 |
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
|
Packit |
345191 |
AC_PROG_CXX
|
|
Packit |
345191 |
AC_PROG_CC
|
|
Packit |
345191 |
AC_OPENMP
|
|
Packit |
345191 |
AC_CHECK_LIB(numa, numa_available, [], [AC_MSG_ERROR([libnuma is required dependency])])
|
|
Packit |
345191 |
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC"],
|
|
Packit |
345191 |
[AC_MSG_ERROR([pthreads are required dependency])])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AM_PROG_CC_C_O
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================tls===============================================
|
|
Packit |
345191 |
# Check for thread local storage support
|
|
Packit |
345191 |
AC_ARG_ENABLE([tls],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-tls], [Enable thread-local storage (__thread keyword)])],
|
|
Packit |
345191 |
[if test "x$enable_tls" = "xyes" ; then
|
|
Packit |
345191 |
enable_tls="1"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_tls="0"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_tls="0"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x${enable_tls}" = "x1" ; then
|
|
Packit |
345191 |
AC_MSG_CHECKING([for TLS support])
|
|
Packit |
345191 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
Packit |
345191 |
[[
|
|
Packit |
345191 |
__thread int x;
|
|
Packit |
345191 |
]], [[
|
|
Packit |
345191 |
x = 1234;
|
|
Packit |
345191 |
]])],
|
|
Packit |
345191 |
AC_MSG_RESULT([yes]),
|
|
Packit |
345191 |
AC_MSG_RESULT([no])
|
|
Packit |
345191 |
enable_tls="0")
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
if test "x${enable_tls}" = "x1" ; then
|
|
Packit |
345191 |
AC_DEFINE([MEMKIND_TLS], [ ], [Enables TLS usage for mapping arenas to threads])
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_SUBST([enable_tls])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================decorators========================================
|
|
Packit |
345191 |
AC_ARG_ENABLE([decorators],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-decorators], [Enable decorators])],
|
|
Packit |
345191 |
[if test "x$enable_decorators" = "xyes" ; then
|
|
Packit |
345191 |
enable_decorators="1"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_decorators="0"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_decorators="0"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x${enable_decorators}" = "x1" ; then
|
|
Packit |
345191 |
AC_DEFINE([MEMKIND_DECORATION_ENABLED], [ ], [Enables decorators])
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_SUBST([enable_decorators])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================debug=============================================
|
|
Packit |
345191 |
AC_ARG_ENABLE([debug],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-debug], [Build debugging code and compile with -O0 -g])],
|
|
Packit |
345191 |
[if test "x$enable_debug" = "xno" ; then
|
|
Packit |
345191 |
enable_debug="0"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_debug="1"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_debug="0"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x$enable_debug" = "x1" ; then
|
|
Packit |
345191 |
AC_DEFINE([MEMKIND_DEBUG], [ ], [Enables code for debugging])
|
|
Packit |
345191 |
CFLAGS="$CFLAGS -O0 -g"
|
|
Packit |
345191 |
CXXFLAGS="$CXXFLAGS -O0 -g"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_SUBST([enable_debug])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================gcov==============================================
|
|
Packit |
345191 |
AC_ARG_ENABLE([gcov],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-gcov], [Build code with gcov instructions])],
|
|
Packit |
345191 |
[if test "x$enable_gcov" = "xno" ; then
|
|
Packit |
345191 |
enable_gcov="0"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_gcov="1"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_gcov="0"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x$enable_gcov" = "x1" ; then
|
|
Packit |
345191 |
CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
|
|
Packit |
345191 |
CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_SUBST([enable_gcov])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================secure_flags======================================
|
|
Packit |
345191 |
AC_ARG_ENABLE([secure],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-secure], [Build library with security enchantments])],
|
|
Packit |
345191 |
[if test "x$enable_secure" = "xno" ; then
|
|
Packit |
345191 |
enable_secure="0"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_secure="1"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_secure="1"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x$enable_secure" = "x1" ; then
|
|
Packit |
345191 |
CFLAGS="$CFLAGS -fstack-protector"
|
|
Packit |
345191 |
LDFLAGS="$LDFLAGS -Wl,-z,relro,-z,now"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
if test "$CFLAGS" != "${CFLAGS%-O0*}" ; then # if CFLAGS contains -O0
|
|
Packit |
345191 |
echo "WARNING: Could not apply FORTIFY_SOURCE=2 due to lack of optimization (-O0)"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" #FORTITFY_SOURCE does not work with -O0 (ex. if enable_debug=1 or enable_gcov=1)
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_SUBST([enable_secure])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================tcache_max_size_class======================
|
|
Packit |
345191 |
|
|
Packit |
345191 |
tcache_max_size_class=12;
|
|
Packit |
345191 |
AC_DEFINE_UNQUOTED([JEMALLOC_TCACHE_CLASS], $tcache_max_size_class,
|
|
Packit |
345191 |
[Maximum size class (log base 2) to cache in jemalloc tcache])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_SUBST(tcache_max_size_class)
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================auto_arenas================================
|
|
Packit |
345191 |
auto_arenas=256;
|
|
Packit |
345191 |
AC_DEFINE_UNQUOTED([ARENA_LIMIT_DEFAULT_KIND], $auto_arenas,
|
|
Packit |
345191 |
[Maximum number of automatic managed arenas by jemalloc (used by MEMKIND_DEFAULT)])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_SUBST(auto_arenas)
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================arena_limit=======================================
|
|
Packit |
345191 |
arena_limit=256;
|
|
Packit |
345191 |
AC_ARG_VAR(ARENA_LIMIT,
|
|
Packit |
345191 |
[Upper bound for number of arenas per kind, if set to 0 then no limit]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "$ARENA_LIMIT" != "" ; then
|
|
Packit |
345191 |
arena_limit=$ARENA_LIMIT;
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_DEFINE_UNQUOTED([ARENA_LIMIT_PER_KIND], $arena_limit, [Upper bound for number of arenas per kind])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================memkind_prefix=======================================
|
|
Packit |
345191 |
memkind_prefix=jemk_;
|
|
Packit |
345191 |
AC_ARG_VAR(MEMKIND_PREFIX,
|
|
Packit |
345191 |
[Prefix used for all jemalloc public API under memkind, default value jemk_]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "$MEMKIND_PREFIX" != "" ; then
|
|
Packit |
345191 |
memkind_prefix=$MEMKIND_PREFIX;
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_SUBST(memkind_prefix)
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#===============================daxctl=========================================
|
|
Packit |
345191 |
AC_ARG_ENABLE([daxctl],
|
|
Packit |
345191 |
[AS_HELP_STRING([--enable-daxctl], [Build library with daxctl support])],
|
|
Packit |
345191 |
[if test "x$enable_daxctl" = "xno" ; then
|
|
Packit |
345191 |
enable_daxctl="0"
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
enable_daxctl="1"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
],
|
|
Packit |
345191 |
[enable_daxctl="1"]
|
|
Packit |
345191 |
)
|
|
Packit |
345191 |
if test "x$enable_daxctl" = "x1" ; then
|
|
Packit |
345191 |
AC_CHECK_LIB(daxctl, daxctl_dev_get_memory, [daxctl_kmem=yes], [daxctl_kmem=no])
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
if test $daxctl_kmem = "yes" ; then
|
|
Packit |
345191 |
AC_DEFINE([MEMKIND_DAXCTL_KMEM], [1], [Automatic recognition of PMEM as system memory in MEMKIND_DAX_KMEM])
|
|
Packit |
345191 |
AC_SUBST(DAXCTL_LIBS, [-ldaxctl])
|
|
Packit |
345191 |
LDFLAGS="$LDFLAGS -ldaxctl"
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_SUBST([enable_daxctl])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#============================cxx11=============================================
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AX_CXX_COMPILE_STDCXX_11([noext], [optional])
|
|
Packit |
345191 |
AM_CONDITIONAL([HAVE_CXX11], [test "x$HAVE_CXX11" = x1])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
LT_PREREQ([2.2])
|
|
Packit |
345191 |
LT_INIT
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_CONFIG_FILES([Makefile memkind.pc])
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AC_OUTPUT
|
|
Packit |
345191 |
AC_MSG_RESULT([=================================================================================])
|
|
Packit |
345191 |
AC_MSG_RESULT([
|
|
Packit |
345191 |
Memkind version $VERSION])
|
|
Packit |
345191 |
if test $daxctl_kmem = "yes" ; then
|
|
Packit |
345191 |
AC_MSG_RESULT([
|
|
Packit |
345191 |
Automatic recognition of PMEM NUMA in MEMKIND_DAX_KMEM is enabled])
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
AC_MSG_RESULT([
|
|
Packit |
345191 |
Automatic recognition of PMEM NUMA in MEMKIND_DAX_KMEM is disabled
|
|
Packit |
345191 |
To enable this feature please install libdaxctl-devel v66 or later
|
|
Packit |
345191 |
and run configure again])
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
AC_MSG_RESULT([=================================================================================])
|