xref: /netbsd-src/external/gpl3/autoconf/dist/tests/erlang.at (revision d874e91932377fc40d53f102e48fc3ee6f4fe9de)
1#							-*- Autotest -*-
2
3AT_BANNER([Erlang low level compiling and utility macros.])
4
5# Copyright (C) 2009-2012 Free Software Foundation, Inc.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21# Since the macros which compile are required by most tests, check
22# them first.  But remember that looking for a compiler is even more
23# primitive, so check those first.
24
25
26## ----------------- ##
27## Erlang Compiler.  ##
28## ----------------- ##
29
30AT_CHECK_MACRO([Erlang],
31[[AC_ERLANG_PATH_ERL([no])
32AC_ERLANG_PATH_ERLC([no])
33if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
34AC_LANG([Erlang])
35## Can't compile, but can run an Erlang module:
36AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
37		  [AC_MSG_RESULT([ok])
38		   AC_MSG_ERROR([compiling Erlang program should fail])],
39		  [AC_MSG_RESULT([failed])])
40AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
41	      [AC_MSG_RESULT([ok])],
42	      [AC_MSG_RESULT([failed])
43	       AC_MSG_ERROR([could not run test program])])
44]],
45[AT_KEYWORDS([Erlang])])
46
47
48## ---------------------- ##
49## Erlang lib detection.  ##
50## ---------------------- ##
51
52AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
53[[AC_ERLANG_PATH_ERL([no])
54AC_ERLANG_PATH_ERLC([no])
55if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
56AC_ERLANG_CHECK_LIB([stdlib],
57		    [AC_MSG_RESULT([ok])],
58		    [AC_MSG_RESULT([failed])])
59## Test that the lib path detection really detected a directory:
60if test "$ERLANG_LIB_DIR_stdlib" != "not found" \
61  && test ! -d "$ERLANG_LIB_DIR_stdlib"; then
62	AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
63fi
64]],
65[AT_KEYWORDS([Erlang])])
66
67
68## --------------------------- ##
69## Erlang root dir detection.  ##
70## --------------------------- ##
71
72AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
73[[AC_ERLANG_PATH_ERL([no])
74AC_ERLANG_PATH_ERLC([no])
75if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
76AC_ERLANG_SUBST_ROOT_DIR
77## Test that the root path detection really detected a directory:
78if test ! -d "$ERLANG_ROOT_DIR"; then
79	AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable])
80fi
81]],
82[AT_KEYWORDS([Erlang])])
83
84
85## -------------------------- ##
86## Erlang lib dir detection.  ##
87## -------------------------- ##
88
89AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
90[[AC_ERLANG_PATH_ERL([no])
91AC_ERLANG_PATH_ERLC([no])
92if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
93AC_ERLANG_SUBST_LIB_DIR
94## Test that the lib path detection really detected a directory:
95if test ! -d "$ERLANG_LIB_DIR"; then
96	AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable])
97fi
98]],
99[AT_KEYWORDS([Erlang])])
100
101
102## ----------------------------------- ##
103## Erlang install base dir detection.  ##
104## ----------------------------------- ##
105
106AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
107	       [AT_KEYWORDS([Erlang])])
108
109
110## ---------------------------------- ##
111## Erlang install lib dir detection.  ##
112## ---------------------------------- ##
113
114AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
115[[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
116## Test that the generated directory name is well-formed:
117if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` != "test_blah-1.24-b"; then
118	AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable])
119fi
120]],
121[AT_KEYWORDS([Erlang])])
122
123
124## -------------------------- ##
125## Erlang version detection.  ##
126## -------------------------- ##
127
128AT_CHECK_MACRO([AC_ERLANG_SUBST_ERTS_VER],
129[[AC_ERLANG_PATH_ERL([no])
130AC_ERLANG_PATH_ERLC([no])
131if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
132AC_ERLANG_SUBST_ERTS_VER
133]],
134[AT_KEYWORDS([Erlang])])
135