Skip to content

Commit

Permalink
Remove Erlang string module use in autoconf macros. Add field to the …
Browse files Browse the repository at this point in the history
…CloudI Service API code_status function (build_cloudi_cxx_dependencies_versions).
  • Loading branch information
okeuday committed Aug 11, 2018
1 parent ebd977e commit d6d86ca
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# -*- coding: utf-8; tab-width: 4; -*-
# ex: set fenc=utf-8 sts=4 ts=4 et nomod:

2018-08-11 Michael Truog <mjtruog at protonmail dot com>

* Remove Erlang string module use in autoconf macros
* Add field to the CloudI Service API code_status function
(build_cloudi_cxx_dependencies_versions)

2018-08-05 Michael Truog <mjtruog at protonmail dot com>

* Add field to the CloudI Service API code_status function
Expand Down
4 changes: 4 additions & 0 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ AX_BOOST_SYSTEM
AX_BOOST_CHECK_HEADER(boost/preprocessor.hpp, ,
[AC_MSG_ERROR([boost::preprocessor not found])], ,
$PATHS_NONSYSTEM_INC)
AX_BOOST_VERSION()
AC_SUBST(CXX_DEPENDENCIES_VERSIONS,
["boost_$ax_cv_cxx_boost_version"])

# C/C++ CloudI API support
if test "x$c_support" = "xtrue" -o "x$cxx_support" = "xtrue" -o \
"x$python_c_support" = "xtrue" ; then
Expand Down
3 changes: 2 additions & 1 deletion src/lib/cloudi_core/src/cloudi_environment.hrl.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ status_static() ->
{build_operating_system, "@BUILD_OPERATING_SYSTEM@"},
{build_erlang_otp_release, "@ERLANG_OTP_VER@"},
{build_cloudi_time, "@BUILD_TIME@"},
{build_cloudi_cxx_compiler_version, "@CXX_COMPILER_VENDOR_VERSION@"}].
{build_cloudi_cxx_compiler_version, "@CXX_COMPILER_VENDOR_VERSION@"},
{build_cloudi_cxx_dependencies_versions, "@CXX_DEPENDENCIES_VERSIONS@"}].

-endif.

64 changes: 64 additions & 0 deletions src/m4/ax_boost_version.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#-*-Mode:m4;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
# ex: set ft=m4 fenc=utf-8 sts=4 ts=4 sw=4 et nomod:
#
# SYNOPSIS
#
# AX_BOOST_VERSION()
#
# DESCRIPTION
#
# The boost version is returned in the cache variable
# $ax_cv_cxx_boost_version .
#
# MIT License
#
# Copyright (c) 2018 Michael Truog <mjtruog at protonmail dot com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#

AC_DEFUN([AX_BOOST_VERSION],
[
AC_CACHE_CHECK([for boost compilation version], ax_cv_cxx_boost_version, [
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
@%:@include <boost/version.hpp>
@%:@include <fstream>], [
std::ofstream output("conftest.out", std::ofstream::binary);
output << BOOST_LIB_VERSION << std::endl;
output.close();
])],
[ax_cv_cxx_boost_version=`cat conftest.out`
rm -f conftest.out],
[rm -f conftest.out
AC_MSG_FAILURE([C++ boost version info execution failed])])
AC_LANG_POP(C++)
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
])
])

15 changes: 11 additions & 4 deletions src/m4/ax_erlang_otp_version.m4
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# ERLANG_OTP_VER_PATCH (e.g., "")
# ERLANG_OTP_VER_RELEASE_CANDIDATE (e.g., "")
#
# R14A or later is required due to binary module use.
#
# WARNING: After the 17.0 Erlang/OTP release, both
# ERLANG_OTP_VER_MINOR and ERLANG_OTP_VER_RELEASE_CANDIDATE will be
# no longer correct due to the Erlang/OTP team not wanting to
Expand Down Expand Up @@ -165,8 +167,9 @@ AC_DEFUN([AX_ERLANG_REQUIRE_OTP_VER],
0;
true ->
%% Remove -1 from R16B03-1
[[MinorL | _]] = string:tokens(MinorT, "-"),
list_to_integer(MinorL)
list_to_integer(lists:takewhile(fun(C) ->
C /= $-
end, MinorT))
end,
if
T1 == \$B ->
Expand Down Expand Up @@ -196,7 +199,11 @@ AC_DEFUN([AX_ERLANG_REQUIRE_OTP_VER],
Major ++ ".0.0"
end
end,
[[_, Minor | RCString]] = string:tokens(Package, ".-"),
[[_, MinorBin |
RCStringBin]] = binary:split(list_to_binary(Package),
[[<<".">>, <<"-">>]],
[[global]]),
RCString = [[binary_to_list(B) || B <- RCStringBin]],
{Patch1, Patch2} = case RCString of
[["rc" ++ RCStr | _]] ->
{"0", RCStr};
Expand All @@ -210,7 +217,7 @@ AC_DEFUN([AX_ERLANG_REQUIRE_OTP_VER],
{"0", "0"}
end,
list_to_integer(Major) * 1000000 +
list_to_integer(Minor) * 1000 +
list_to_integer(binary_to_list(MinorBin)) * 1000 +
list_to_integer(Patch1) * 10 +
list_to_integer(Patch2)
end,
Expand Down

0 comments on commit d6d86ca

Please sign in to comment.