1
0
Fork 0
arangodb/m4/configure.basics

90 lines
2.8 KiB
Plaintext

dnl -*- mode: Autoconf; -*-
dnl ----------------------------------------------------------------------------
dnl checks if the CC compiler supports an option
dnl
dnl usage: TRI_TRY_CC_OPTION(flag, action-if-ok, action-if-no-ok)
dnl ----------------------------------------------------------------------------
AC_DEFUN([TRI_TRY_CC_OPTION],
[AC_MSG_CHECKING([$1 for $CC])
AS_IF([AC_TRY_COMMAND([${CC} -Werror $1 -xc /dev/null -S -o /dev/null])],
AC_MSG_RESULT([yes])
[$2],
AC_MSG_RESULT([no])
[$3])])
dnl ----------------------------------------------------------------------------
dnl checks if the C++ compiler supports an option
dnl
dnl usage: TRI_TRY_CXX_OPTION(flag, action-if-ok, action-if-no-ok)
dnl ----------------------------------------------------------------------------
AC_DEFUN([TRI_TRY_CXX_OPTION],
[AC_MSG_CHECKING([$1] for $CXX)
AS_IF([AC_TRY_COMMAND([${CXX} -Werror $1 -xc++ /dev/null -S -o /dev/null])],
AC_MSG_RESULT([yes])
[$2],
AC_MSG_RESULT([no])
[$3])])
dnl ----------------------------------------------------------------------------
dnl generate correct include, either -I oder -isystem
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_INCLUDE],[
if test "x$1" != "x"; then
if test "x$INCPREFIX" != "x-I"; then
$1=`echo $[]$1 | sed -e "s:-I:$INCPREFIX:g"`
fi
fi
])
dnl ----------------------------------------------------------------------------
dnl find absolute path for library
dnl
dnl usage: TR_LIBRARY(library name)
dnl
dnl returns: tr_library
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_LIBRARY],[
tr_library=""
for tr_path in $LDFLAGS; do
case $tr_path in
-L*)
path=`echo $tr_path | sed -e 's:^-L::'`
if test -f "$path/lib$1.a"; then
tr_library="$path/lib$1.a"
fi
;;
esac
done
])
dnl ----------------------------------------------------------------------------
dnl check for std::unordered_map::emplace()
dnl ----------------------------------------------------------------------------
AC_DEFUN([AX_CXX_CHECK_UNORDERED_MAP_EMPLACE], [
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether C++ has support for std::unordered_map::emplace()])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE[
#include <unordered_map>
void test () {
std::unordered_map<int, int> x;
x.emplace(1, 1);
}
]],
[eval unordered_map_emplace=yes],
[eval unordered_map_emplace=no]
)
AC_MSG_RESULT([$unordered_map_emplace])
AC_LANG_POP([C++])
if test x$unordered_map_emplace = xno; then
AC_MSG_ERROR([C++ has no support for std::unordered_map::emplace()])
fi
])