libcruft-util/configure.ac
Danny Robson b814c83e21 test/json: run tests through a line wine/crlf wrapper
unit tests rely on AWKs record seperator being LF which presents issues
when running windows tests. rather than modify the tap-driver provided
by autotools (which would be extremely annoying to maintain) we run all
tests through wine-crlf.sh which will perform line ending transforms as
required.

it's a pretty braindead script, so don't do anything terrifically
extreme under it.
2016-04-27 17:13:36 +10:00

139 lines
3.6 KiB
Plaintext

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=""}
###############################################################################
## Build environment discovery
AC_CONFIG_AUX_DIR([build-aux])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_CANONICAL_HOST
AC_LANG([C++])
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])
AM_MAINTAINER_MODE([enable])
AC_CONFIG_HEADERS([config.h])
AX_CHECK_GNU_MAKE
###############################################################################
## Architecture features
AC_C_BIGENDIAN
###############################################################################
## Useful headers or platform features
###############################################################################
## Platform features
AC_DEFINE([_XOPEN_SOURCE], [700], [use POSIX 2008])
AC_DEFINE([__STDC_FORMAT_MACROS], [1], [use C format macros])
AC_FUNC_MMAP
AC_CHECK_FUNC([backtrace])
AM_CONDITIONAL([HAVE_EXECINFO], [test "x$ac_cv_func_backtrace" == "xyes"])
AC_CHECK_FUNC([RtlCaptureStackBackTrace])
AM_CONDITIONAL([HAVE_CAPTURESTACKBACKTRACE], [test "x$ac_cv_func_RtlCaptureStackBackTrace" == "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"
])
AC_SEARCH_LIBS([clock_gettime], [rt], [], [
# windows doesn't have clock_gettime
AS_IF([test "x${host_os}" != "xmingw32"], [
AC_MSG_ERROR([unable to find the clock library])
])
])
AC_SEARCH_LIBS([cos], [m], [], [AC_MSG_ERROR([unable to find the maths library])])
## Find some POSIX functions that windows doesn't support
AS_IF([test "x${host_os}" != "xmingw32"],[
AC_SEARCH_LIBS([dlopen], [dl])
AC_SEARCH_LIBS([shm_open], [rt], [], [AC_MSG_ERROR([unable to find shm library])])
])
AC_SEARCH_LIBS([htons], [ws2_32], [], [AC_MSG_ERROR([unable to find htnos library])])
###############################################################################
## Debug features
###############################################################################
## Documentation
###############################################################################
## Required packages
CHECK_RAGEL([ip.cpp])
NC_BOOST([1.53], [system filesystem thread])
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
###############################################################################
## Optional packages
AC_CHECK_TOOL([ADDR2LINE], [addr2line], [:])
AS_IF([test "x$ADDR2LINE" != "x:"], [
AC_DEFINE_UNQUOTED([ADDR2LINE], ["$ADDR2LINE"], [addr2line tool name])
])
###############################################################################
## Performance and build optimisations
###############################################################################
## Output
AC_SUBST(LIBS)
# 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([
Doxyfile
Makefile
])
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])
AC_OUTPUT