forked from nniclausse/manderlbot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
84 lines (64 loc) · 2.07 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
DNA define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT([manderlbot], m4_normalize(m4_include([vsn.mk])),[[email protected]])
AC_CONFIG_SRCDIR(src/manderlbot.erl)
dnl AM_INIT_AUTOMAKE()
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],[vsn.mk])
AC_SUBST([CONFIGURE_DEPENDENCIES],[vsn.mk])
dnl work out who the cpu, vendor and OS are
dnl AC_CANONICAL_SYSTEM
dnl AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target")
AC_PATH_PROG(SED, sed)
AC_ARG_WITH(erlang, [ --with-erlang=PREFIX path to erlc and erl ])
AC_PATH_TOOL(ERLC, erlc, , $with_erlang:$with_erlang/bin:$PATH)
AC_PATH_TOOL(ERL, erl, , $with_erlang:$with_erlang/bin:$PATH)
if test "z$ERLC" == "z" || test "z$ERL" == "z"; then
AC_MSG_ERROR([erlang not found])
fi
ERLDIR=`echo "${ERL}" | sed 's/\/bin\/*erl.*//'`
AC_PREFIX_PROGRAM(erl)
dnl check for xmerl include path
AC_MSG_CHECKING(xmerl.hrl)
cat >>conftest.erl <<_EOF
-module(conftest).
-author('[email protected]').
-export([[start/0]]).
start() ->
case code:lib_dir("xmerl") of
{error,bad_name} ->
file:write_file("conftest.out", "notfound\n");
XMerlDirS ->
file:write_file("conftest.out", XMerlDirS)
end,
halt().
_EOF
if ! $ERLC conftest.erl; then
AC_MSG_ERROR([could not compile sample program])
fi
if ! $ERL -s conftest -noshell ; then
AC_MSG_ERROR([could not run sample program])
fi
if ! test -f conftest.out; then
AC_MSG_ERROR([erlang program was not properly executed, (conftest.out was
not produced)])
fi
ERLANG_XMERL_DIR=`head -1 < conftest.out`
if test -f "$ERLANG_XMERL_DIR/inc/xmerl.hrl"; then
ERLANG_XMERL_DIR="$ERLANG_XMERL_DIR/inc/"
AC_MSG_RESULT($ERLANG_XMERL_DIR)
elif test -f "$ERLANG_XMERL_DIR/include/xmerl.hrl"; then
ERLANG_XMERL_DIR="$ERLANG_XMERL_DIR/include/"
AC_MSG_RESULT($ERLANG_XMERL_DIR)
else
AC_MSG_ERROR([xmerl not found])
fi
AC_SUBST(ERLANG_XMERL_DIR)
AC_SUBST(SED)
AC_SUBST(ERL)
AC_SUBST(ERLC)
AC_SUBST(ERLDIR)
AC_SUBST(DTD,[manderlbot.dtd])
AC_PROG_MAKE_SET
# AC_PROG_INSTALL
AC_CONFIG_FILES([Makefile manderlbot.sh])
AC_OUTPUT