3 # Macros tested in acerlang.at:
6 # AC_ERLANG_SUBST_ERTS_VER
9 AT_BANNER([Erlang low level compiling and utility macros.])
11 # Copyright (C) 2009-2017, 2020-2024 Free Software Foundation, Inc.
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <https://www.gnu.org/licenses/>.
27 # Since the macros which compile are required by most tests, check
28 # them first. But remember that looking for a compiler is even more
29 # primitive, so check those first.
32 ## ----------------- ##
33 ## Erlang Compiler. ##
34 ## ----------------- ##
36 AT_CHECK_MACRO([Erlang basic compilation],
39 AC_CACHE_CHECK([whether erlc works], [ac_cv_erlang_erlc_works],
40 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
41 [ac_cv_erlang_erlc_works=yes],
42 [ac_cv_erlang_erlc_works=no])])
44 if test $ac_cv_erlang_erlc_works = no; then
45 AC_MSG_ERROR([could not compile a test Erlang module])
48 # To keep AT_CHECK_MACRO happy, we lie and say that erl does work
49 # when cross compiling.
50 AC_CACHE_CHECK([whether erl works], [ac_cv_erlang_erl_works],
51 [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
52 [ac_cv_erlang_erl_works=yes],
53 [ac_cv_erlang_erl_works=no],
54 [ac_cv_erlang_erl_works=yes])])
56 if test $ac_cv_erlang_erl_works = no; then
57 AC_MSG_ERROR([could not run a test Erlang module])
62 ## ---------------------- ##
63 ## Erlang lib detection. ##
64 ## ---------------------- ##
66 AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
67 [[AC_ERLANG_CHECK_LIB([stdlib])
68 if test "$ERLANG_LIB_DIR_stdlib" = "not found"; then
69 AC_MSG_ERROR([failed to find the Erlang stdlib])
71 ## Test that the lib path detection really detected a directory:
72 if test ! -d "$ERLANG_LIB_DIR_stdlib"; then
73 AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
78 ## --------------------------- ##
79 ## Erlang root dir detection. ##
80 ## --------------------------- ##
82 AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
83 [[AC_ERLANG_SUBST_ROOT_DIR
84 ## Test that the root path detection really detected a directory:
85 if test ! -d "$ERLANG_ROOT_DIR"; then
86 AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable])
91 ## -------------------------- ##
92 ## Erlang lib dir detection. ##
93 ## -------------------------- ##
95 AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
96 [[AC_ERLANG_SUBST_LIB_DIR
97 ## Test that the lib path detection really detected a directory:
98 if test ! -d "$ERLANG_LIB_DIR"; then
99 AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable])
102 [AT_KEYWORDS([Erlang])])
105 ## ---------------------------------- ##
106 ## Erlang install lib dir detection. ##
107 ## ---------------------------------- ##
109 AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
110 [[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
111 ## Test that the generated directory name is well-formed:
112 if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` \
113 != "test_blah-1.24-b"; then
114 AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable])
117 [AT_KEYWORDS([Erlang])])