libcruft-util/configure.ac

136 lines
3.4 KiB
Plaintext
Raw Normal View History

2016-04-05 11:11:19 +10:00
AC_INIT([util-cruft], [0.1.0], [danny@nerdcruft.net])
## Explicitly set an empty CXXFLAGS if not present to prevent AC_PROG_CXX from
## generating a default -O2. This allows us to manually select -O0 when
## debugging is enabled.
: ${CXXFLAGS=""}
2011-05-23 17:18:52 +10:00
###############################################################################
## Build environment discovery
2011-05-23 17:18:52 +10:00
AC_CONFIG_AUX_DIR([build-aux])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
2011-05-23 17:18:52 +10:00
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_CANONICAL_HOST
2011-05-23 17:18:52 +10:00
AC_LANG([C++])
2011-05-23 17:18:52 +10:00
NC_CXX
NC_PLATFORM
NC_OPTIMISATION
NC_WARNINGS
NC_DEBUGGING
NC_SUBPACKAGE_ENABLE
LT_INIT
AM_INIT_AUTOMAKE([1.14 dist-bzip2 dist-xz foreign subdir-objects])
AM_SILENT_RULES([yes])
2016-02-26 14:57:37 +11:00
AM_MAINTAINER_MODE([enable])
AC_CONFIG_HEADERS([config.h])
2011-05-23 17:18:52 +10:00
AX_CHECK_GNU_MAKE
###############################################################################
2011-06-21 23:36:51 +10:00
## Architecture features
2011-06-21 23:36:51 +10:00
AC_C_BIGENDIAN
###############################################################################
## Useful headers or platform features
###############################################################################
## Platform features
2011-05-23 17:18:52 +10:00
2015-03-24 02:43:21 +11:00
AC_DEFINE([_XOPEN_SOURCE], [700], [use POSIX 2008])
2016-04-05 11:11:19 +10:00
AC_DEFINE([__STDC_FORMAT_MACROS], [1], [use C format macros])
2015-03-24 02:43:21 +11:00
AC_FUNC_MMAP
2016-04-05 11:11:19 +10:00
AC_CHECK_FUNC([backtrace])
AM_CONDITIONAL([HAVE_EXECINFO], [test "x$ac_cv_func_backtrace" == "xyes"])
AC_MSG_CHECKING([for SymFromAddr])
save_LIBS="$LIBS"
LIBS+=-ldbghelp
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <windows.h>
#include <dbghelp.h>
],
[SymFromAddr(nullptr,0,nullptr,nullptr); return 0;])],[
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
LIBS="$save_LIBS"
])
2013-02-26 17:50:56 +11:00
2016-02-26 12:13:46 +11:00
AC_SEARCH_LIBS([clock_gettime], [rt], [], [
2016-04-05 11:11:19 +10:00
# windows doesn't have clock_gettime
AS_IF([test "x${host_os}" != "xmingw32"], [
AC_MSG_ERROR([unable to find the clock library])
])
2016-02-26 12:13:46 +11:00
])
2016-04-05 11:11:19 +10:00
AC_SEARCH_LIBS([cos], [m], [], [AC_MSG_ERROR([unable to find the maths library])])
2016-04-05 11:11:19 +10:00
## Find some POSIX functions that windows doesn't support
2016-02-26 12:13:46 +11:00
AS_IF([test "x${host_os}" != "xmingw32"],[
AC_SEARCH_LIBS([dlopen], [dl])
2016-04-05 11:11:19 +10:00
AC_SEARCH_LIBS([shm_open], [rt], [], [AC_MSG_ERROR([unable to find shm library])])
2016-02-26 12:13:46 +11:00
])
2016-04-05 11:11:19 +10:00
AC_SEARCH_LIBS([htons], [ws2_32], [], [AC_MSG_ERROR([unable to find htnos library])])
###############################################################################
## Debug features
###############################################################################
2011-05-23 17:18:52 +10:00
## Documentation
###############################################################################
2011-05-23 17:18:52 +10:00
## Required packages
CHECK_RAGEL([ip.cpp])
2011-05-23 17:18:52 +10:00
2016-04-05 11:11:19 +10:00
NC_BOOST([1.53], [system filesystem thread])
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
###############################################################################
2011-05-23 17:18:52 +10:00
## Optional packages
AC_CHECK_TOOL([ADDR2LINE], [addr2line], [:])
2016-02-26 12:13:46 +11:00
AS_IF([test "x$ADDR2LINE" != "x:"], [
AC_DEFINE_UNQUOTED([ADDR2LINE], ["$ADDR2LINE"], [addr2line tool name])
])
###############################################################################
## Performance and build optimisations
###############################################################################
## Output
2011-05-23 17:18:52 +10:00
2016-04-05 11:11:19 +10:00
AC_SUBST(LIBS)
2013-07-30 16:17:47 +10:00
# inclusion of config.h has to go after compilation tests otherwise we risk
# failure on a clean build
AX_APPEND_FLAG([-include config.h])
NC_SUBPACKAGE_PC([libcruft-util.pc])
AC_CONFIG_FILES([
2011-05-23 17:18:52 +10:00
Doxyfile
Makefile
])
2015-04-13 16:45:56 +10:00
AC_CONFIG_FILES([test/json-parse], [chmod a+x test/json-parse])
AC_CONFIG_FILES([test/json-schema], [chmod a+x test/json-schema])
AC_OUTPUT