Commit 1576d01c authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch 'improve-ci-infrastructure' into 'master'

Improve ci infrastructure

Closes #38

See merge request !20
parents c81c15fc aa6305fe
Loading
Loading
Loading
Loading
Loading
+523 −336

File changed.

Preview size limit exceeded, changes collapsed.

+13 −4
Original line number Diff line number Diff line
@@ -125,11 +125,20 @@ AX_BOOST_ASIO
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_THREAD

# only check for boost_regex if we are building tests
AS_IF([test "x$is_enabled_build_tests" = "xyes"], 
      [ AX_BOOST_REGEX 
        AC_CONFIG_FILES(tests/Makefile)
# check whether the compiler has a functional std::regex
AX_GCC_WORKING_STD_REGEX
AS_IF([test "x$gcc_has_working_std_regex" = xno],
      [
        # fallback to boost::regex
        AC_MSG_WARN([falling back to boost::regex because std::regex is not functional])
        AX_BOOST_REGEX 
      ], [])
AM_CONDITIONAL([HAVE_WORKING_STD_REGEX], 
               test x$GCC_HAS_WORKING_STD_REGEX = xyes)

# only check for std::regex/boost::regex if we are building tests
AS_IF([test "x$is_enabled_build_tests" = "xyes"], 
      [ AC_CONFIG_FILES(tests/Makefile) ], [])

# check for mercury
PKG_CHECK_MODULES([MERCURY], [mercury >= 0.26])
+67 −0
Original line number Diff line number Diff line
# SYNOPSIS
#
#   AX_GCC_WORKING_STD_REGEX
#
# DESCRIPTION
#
#   This macro checks if GCC has a working implementation of std::regex, since
#   GCC 4.7/4.8 provided only valid headers and function stubs. Further 
#   information is available:
#   <https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions>.
#
#   If the std::regex implementation is functional, the macro will set the 
#   variable 'gcc_has_working_std_regex' to 'yes' and AC_DEFINE the C preprocessor
#   variable HAVE_WORKING_STD_REGEX.
#
#   An automake conditional can be subsequently defined as
#       AM_CONDITIONAL([HAVE_WORKING_STD_REGEX], 
#                      [test x$gcc_has_working_std_regex = xyes])
#
# LICENSE
#
#   Copyright (c) 2019 Alberto Miranda <alberto.miranda@bsc.es>
#
#   Copying and distribution of this file, with or without modification, are
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved. This file is offered as-is, without any
#   warranty.

#serial 10

AC_DEFUN([AX_GCC_WORKING_STD_REGEX],
[
    gcc_has_working_std_regex=no
    AC_CACHE_CHECK(
        [whether GCC has a working std::regex implementation],
        ax_cv_gcc_working_regex,
        [
            AC_LANG_PUSH([C++])
            AC_COMPILE_IFELSE([
                AC_LANG_PROGRAM(
                        [[ @%:@include <regex> ]],
                        [[
                           @%:@if __cplusplus >= 201103L &&                          \
                               (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \
                                   (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \
                                   defined(_GLIBCXX_REGEX_STATE_LIMIT)            || \
                                       (defined(_GLIBCXX_RELEASE)                 && \
                                       _GLIBCXX_RELEASE > 4)))
                           @%:@define HAVE_WORKING_REGEX 1
                           @%:@else
                           @%:@define HAVE_WORKING_REGEX 0
                           @%:@error std::regex does not work
                           @%:@endif
                        ]]
                )],
                ax_cv_gcc_working_regex=yes,
                ax_cv_gcc_working_regex=no)
            AC_LANG_POP([C++])
        ]
    )

    if test "x$ax_cv_gcc_working_regex" = "xyes"; then
        gcc_has_working_std_regex=yes
        AC_DEFINE([HAVE_WORKING_STD_REGEX], [1],
                  [define if the std::regex implementation works as expected])
    fi
])
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@

#ifndef HG_GEN_PROC_NAME
#define HG_GEN_PROC_NAME(struct_type_name) \
    hermes::detail::hg_proc_ ## struct_type_name
    &hermes::detail::hg_proc_ ## struct_type_name
#endif

// forward declarations
+8 −2
Original line number Diff line number Diff line
@@ -100,7 +100,6 @@ api_LDFLAGS = \
	@BOOST_PROGRAM_OPTIONS_LIB@	\
	@BOOST_SYSTEM_LIB@ \
	@BOOST_THREAD_LIB@ \
	@BOOST_REGEX_LIB@ \
	@PROTOBUF_LIBS@ \
	-no-install \
	-Wl,-rpath,$(top_builddir)/lib/.libs \
@@ -109,6 +108,10 @@ api_LDFLAGS = \
	$(top_builddir)/lib/libnornsctl_debug.la \
	$(END)

if !HAVE_WORKING_STD_REGEX
api_LDFLAGS += @BOOST_REGEX_LIB@
endif

EXTRA_api_DEPENDENCIES = \
	$(top_builddir)/src/liburd_aux.la \
	$(top_builddir)/lib/libnorns_debug.la \
@@ -178,13 +181,16 @@ core_LDFLAGS = \
	@BOOST_PROGRAM_OPTIONS_LIB@	\
	@BOOST_SYSTEM_LIB@ \
	@BOOST_THREAD_LIB@ \
	@BOOST_REGEX_LIB@ \
	@PROTOBUF_LIBS@ \
	$(top_builddir)/src/liburd_aux.la \
	$(top_builddir)/lib/libnorns_debug.la \
	$(top_builddir)/lib/libnornsctl_debug.la \
	$(END)

if !HAVE_WORKING_STD_REGEX
core_LDFLAGS += @BOOST_REGEX_LIB@
endif

EXTRA_core_DEPENDENCIES = \
	$(top_builddir)/src/liburd_aux.la \
	$(top_builddir)/lib/libnorns_debug.la \
Loading