2016-04-05 11:11:19 +10:00
|
|
|
AC_INIT([util-cruft], [0.1.0], [danny@nerdcruft.net])
|
2012-04-27 17:54:26 +10:00
|
|
|
## 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
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
|
|
|
## Build environment discovery
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2013-02-27 15:11:51 +11:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2014-05-20 15:21:29 +10:00
|
|
|
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
2011-05-23 17:18:52 +10:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2016-06-20 13:30:32 +10:00
|
|
|
AC_CONFIG_MACRO_DIR([m4/nc])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
AC_CANONICAL_HOST
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
AC_LANG([C++])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2015-02-04 15:59:22 +11:00
|
|
|
NC_CXX
|
|
|
|
NC_PLATFORM
|
|
|
|
NC_OPTIMISATION
|
|
|
|
NC_WARNINGS
|
2016-08-13 17:22:23 +10:00
|
|
|
# NC_DEBUGGING is called further down, see notes at the call site.
|
2015-02-04 15:59:22 +11:00
|
|
|
|
|
|
|
LT_INIT
|
2015-01-10 20:06:34 +11:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
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])
|
2012-05-26 17:58:36 +10:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-02-24 11:55:08 +11:00
|
|
|
AX_CHECK_GNU_MAKE
|
2013-07-30 01:44:28 +10:00
|
|
|
|
|
|
|
###############################################################################
|
2011-06-21 23:36:51 +10:00
|
|
|
## Architecture features
|
2013-07-30 01:44:28 +10:00
|
|
|
|
2011-06-21 23:36:51 +10:00
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
2011-07-04 16:17:50 +10:00
|
|
|
## Useful headers or platform features
|
2013-07-30 01:44:28 +10:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
## Platform features
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-05-12 17:52:37 +10:00
|
|
|
## Find some POSIX functions that windows doesn't support
|
|
|
|
AS_IF([test "x${host_os}" != "xmingw32"],[
|
|
|
|
AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([unable to find dl library])])
|
|
|
|
AC_SEARCH_LIBS([shm_open], [rt], [], [AC_MSG_ERROR([unable to find shm library])])
|
|
|
|
])
|
|
|
|
|
2011-07-04 16:17:12 +10:00
|
|
|
AC_FUNC_MMAP
|
2011-06-25 12:40:57 +10:00
|
|
|
|
2016-05-12 18:15:57 +10:00
|
|
|
AC_SEARCH_LIBS([backtrace], [execinfo])
|
2016-04-05 11:11:19 +10:00
|
|
|
AC_CHECK_FUNC([backtrace])
|
2016-04-19 16:08:25 +10:00
|
|
|
AM_CONDITIONAL([HAVE_EXECINFO], [test "x$ac_cv_func_backtrace" == "xyes"])
|
|
|
|
|
2016-04-19 16:08:56 +10:00
|
|
|
AC_CHECK_FUNC([RtlCaptureStackBackTrace])
|
|
|
|
AM_CONDITIONAL([HAVE_CAPTURESTACKBACKTRACE], [test "x$ac_cv_func_RtlCaptureStackBackTrace" == "xyes"])
|
|
|
|
|
2016-04-19 16:08:25 +10:00
|
|
|
AC_MSG_CHECKING([for SymFromAddr])
|
|
|
|
save_LIBS="$LIBS"
|
2016-05-12 18:16:18 +10:00
|
|
|
LIBS="${LIBS} -ldbghelp"
|
2016-04-19 16:08:25 +10:00
|
|
|
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-05-12 18:16:54 +10:00
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt c], [], [
|
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
|
|
|
])
|
2011-06-25 12:40:57 +10:00
|
|
|
|
2016-04-05 11:11:19 +10:00
|
|
|
AC_SEARCH_LIBS([cos], [m], [], [AC_MSG_ERROR([unable to find the maths library])])
|
2011-07-04 16:17:12 +10:00
|
|
|
|
2016-02-24 11:55:08 +11:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
2011-06-30 21:45:02 +10:00
|
|
|
## Debug features
|
2013-07-30 01:44:28 +10:00
|
|
|
|
2016-05-12 17:51:10 +10:00
|
|
|
dnl debugging might enable sanitizers, which might alter the available
|
|
|
|
dnl libraries, so this needs to be called after we've completed our tests.
|
|
|
|
dnl specifically: -ldl is implied by some of the sanitizers.
|
|
|
|
NC_DEBUGGING
|
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
2011-05-23 17:18:52 +10:00
|
|
|
## Documentation
|
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
2011-05-23 17:18:52 +10:00
|
|
|
## Required packages
|
2011-06-30 20:33:55 +10:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
CHECK_RAGEL([ip.cpp])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
2011-05-23 17:18:52 +10:00
|
|
|
## Optional packages
|
2013-07-30 01:44:28 +10:00
|
|
|
|
2015-10-29 17:52:48 +11:00
|
|
|
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])
|
|
|
|
])
|
2015-10-29 17:52:48 +11:00
|
|
|
|
2013-07-30 01:44:28 +10:00
|
|
|
###############################################################################
|
|
|
|
## 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])
|
|
|
|
|
2016-07-31 14:31:32 +10:00
|
|
|
NC_SUBPACKAGE([cruft-util])
|
2016-04-05 11:11:59 +10:00
|
|
|
|
2012-04-24 12:59:13 +10:00
|
|
|
AC_CONFIG_FILES([
|
2011-05-23 17:18:52 +10:00
|
|
|
Doxyfile
|
|
|
|
Makefile
|
|
|
|
])
|
2016-02-26 12:12:47 +11:00
|
|
|
|
2016-04-27 17:13:36 +10:00
|
|
|
AC_CONFIG_FILES([test/json-parse.sh], [chmod a+x test/json-parse.sh])
|
|
|
|
AC_CONFIG_FILES([test/json-schema.py], [chmod a+x test/json-schema.py])
|
2016-02-26 12:12:47 +11:00
|
|
|
|
2012-04-24 12:59:13 +10:00
|
|
|
AC_OUTPUT
|