* Autodetect Erlang ERTS version and OTP library version numbers. * Make it possible to skip Erlang/OTP version check. Patch by Jakob Schlyter. * Include ERLANG_SUBST_ERTS_VER from Autoconf 2.64 in m4/erlang-erts.m4. * Add bootstrap script.
Signed-off-by: Mikael Magnusson <mi...@users.sourceforge.net> --- bootstrap | 4 +++ configure.ac | 48 +++++++++++++++++++++++++--------- m4/erlang-erts.m4 | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/erlang-extra.m4 | 64 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 13 deletions(-) diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..f005e2e --- /dev/null +++ b/bootstrap @@ -0,0 +1,4 @@ +#!/bin/sh + +aclocal -I m4 +autoconf diff --git a/configure.ac b/configure.ac index 8518419..4bc313f 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,18 @@ AC_CONFIG_AUX_DIR([scripts]) AC_PROG_CC AC_PROG_INSTALL +AC_ERLANG_NEED_ERLC +AC_ERLANG_PATH_ERL +AC_ERLANG_SUBST_INSTALL_LIB_DIR +ERLANG_SUBST_ERTS_VER +ERLANG_CHECK_HEADERS([ssl/include/OTP-PKIX.hrl ssl/include/SSL-PKIX.hrl]) +ERLANG_SUBST_LIB_VER(asn1) +ERLANG_SUBST_LIB_VER(kernel) +ERLANG_SUBST_LIB_VER(mnesia) +ERLANG_SUBST_LIB_VER(ssl) +ERLANG_SUBST_LIB_VER(stdlib) +ERLANG_SUBST_LIB_VER(yaws) + AC_CONFIG_FILES( Makefile \ src/Makefile \ @@ -46,8 +58,13 @@ if test "x$ERL" = "x" -o "x$ERLC" = "x"; then fi dnl check that the installed Erlang/OTP version is the right one for this version of YXA -AC_MSG_CHECKING([Erlang/OTP version]) -cat > conftest.erl <<EOF +AC_ARG_ENABLE(erlang-version-check, +[AC_HELP_STRING([--enable-erlang-version-check], + [Check Erlang/OTP version @<:@default=yes@:>@])]) + case "$enable_erlang_version_check" in + yes|'') + AC_MSG_CHECKING([Erlang/OTP version]) + cat > conftest.erl <<EOF -module(conftest). -export([[start/0]]). @@ -66,19 +83,24 @@ start() -> EOF -$ERLC conftest.erl || AC_MSG_ERROR(["Could not compile Erlang/OTP version check program using '$ERLC'"]) - -if ! $ERL -s conftest -noshell -o ! -f conftest.out ; then - AC_MSG_ERROR(["Could not run Erlang/OTP version check program using '$ERL'"]) -fi - -if test "x`cat conftest.out`" != "xok"; then - AC_MSG_RESULT([failed]) - X="`cat conftest.out`" - AC_MSG_FAILURE([$X]) -else - AC_MSG_RESULT([ok]) -fi + $ERLC conftest.erl || AC_MSG_ERROR(["Could not compile Erlang/OTP version check program using '$ERLC'"]) + + if ! $ERL -s conftest -noshell -o ! -f conftest.out ; then + AC_MSG_ERROR(["Could not run Erlang/OTP version check program using '$ERL'"]) + fi + + if test "x`cat conftest.out`" != "xok"; then + AC_MSG_RESULT([failed]) + X="`cat conftest.out`" + AC_MSG_FAILURE([$X]) + else + AC_MSG_RESULT([ok]) + fi + ;; + no) + AC_MSG_RESULT(Skipped Erlang/OTP version check) + ;; +esac AC_ARG_WITH(mnesiadir, diff --git a/m4/erlang-erts.m4 b/m4/erlang-erts.m4 new file mode 100644 index 0000000..b9dee19 --- /dev/null +++ b/m4/erlang-erts.m4 @@ -0,0 +1,73 @@ +# -*- Autoconf -*- +# Erlang/OTP language support. +# Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Romain Lenglet. +# Copied from automake 2.64 +# Macro name renamed by Mikael Magnusson + +# ERLANG_SUBST_ERTS_VER +# ------------------------ +# Determines the Erlang runtime system version. +AC_DEFUN([ERLANG_SUBST_ERTS_VER], +[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl +AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl +AC_CACHE_CHECK([for Erlang/OTP ERTS version], + [ac_cv_erlang_erts_ver], + [AC_LANG_PUSH([Erlang])[]dnl + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([], [dnl + Version = erlang:system_info(version), + file:write_file("conftest.out", Version), + ReturnValue = 0, + halt(ReturnValue)])], + [ac_cv_erlang_erts_ver=`cat conftest.out` + rm -f conftest.out], + [rm -f conftest.out + AC_MSG_FAILURE([test Erlang program execution failed])]) + AC_LANG_POP([Erlang])[]dnl + ]) +AC_SUBST([ERLANG_ERTS_VER], [$ac_cv_erlang_erts_ver]) +])# ERLANG_SUBST_ERTS_VER diff --git a/m4/erlang-extra.m4 b/m4/erlang-extra.m4 new file mode 100644 index 0000000..d13f50d --- /dev/null +++ b/m4/erlang-extra.m4 @@ -0,0 +1,64 @@ +dnl erlang-extra.m4 +dnl Copyright (C) 2007,2009 Mikael Magnusson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Library General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([ERLANG_SUBST_LIB_VER], +[AC_ERLANG_CHECK_LIB([$1]) +ERLANG_LIB_VER_SUBST="$ERLANG_LIB_VER_SUBST -e 's,[...@]erlang_lib_ver_$1[@],\$(ERLANG_LIB_VER_$1),g'" +AC_SUBST([ERLANG_LIB_VER_SUBST]) +]) # ERLANG_SUBST_LIB_VER + +# +# ERLANG_CHECK_HEADER(HEADER, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +AC_DEFUN([ERLANG_CHECK_HEADER], +[AC_REQUIRE([AC_ERLANG_NEED_ERLC])dnl +ac_header_name="$1" +AS_VAR_PUSHDEF([ac_hrl], [ac_cv_erl_hrl_${ac_header_name}])dnl +AC_CACHE_CHECK([for ${ac_header_name}], ac_hrl, +[AC_LANG_PUSH(Erlang)dnl +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([dnl + -include_lib("${ac_header_name}").],[ + ok + ])], + [AS_VAR_SET(ac_hrl, yes)], + [AS_VAR_SET(ac_hrl, no)]) +AC_LANG_POP(Erlang)dnl +]) +AS_IF([test AS_VAR_GET(ac_hrl) = yes], [$2], [$3])dnl +AS_VAR_POPDEF([ac_hrl])dnl +])# ERLANG_CHECK_HEADER + +# ERLANG_CHECK_HEADERS(HEADER..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------- +AC_DEFUN([ERLANG_CHECK_HEADERS], +[AC_FOREACH([AC_Hrl], [$1], + [m4_pushdef([AC_Hrl_Name],m4_bpatsubst(m4_bpatsubst(AC_Hrl, ["], []), + [(.*)], + []))dnl + AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Hrl_Name), + [Define to 1 if you have the `]AC_Hrl_Name[' header file.])dnl + m4_popdef([AC_Hrl_Name])])dnl +for ac_hrl in $1 +do +ac_hrl_name=`echo $ac_hrl|sed -e 's/^\(.*\)(.*)$/\1/'` +ERLANG_CHECK_HEADER($ac_hrl, + [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_hrl_name])]) $2], + [$3], [$4])dnl +done +])# ERLANG_CHECK_HEADERS -- tg: (13928b6..) t/fix/autoconf (depends on: upstream) _______________________________________________ Yxa-devel mailing list Yxa-devel@lists.su.se https://lists.su.se/mailman/listinfo/yxa-devel