62dd11901e0bc21bfae26c6c2adc45e1ac50e050
[feed/telephony.git] / net / freeswitch / patches / 0000002-build-config-erlang_m4.patch
1 --- a/build/config/erlang.m4
2 +++ b/build/config/erlang.m4
3 @@ -1,6 +1,6 @@
4 AC_DEFUN([CHECK_ERLANG], [
5 #
6 -# Erlang checks for mod_erlang_event
7 +# Erlang check
8 #
9 AC_ARG_WITH(
10 [erlang],
11 @@ -19,22 +19,23 @@ then
12 if test ! -x "$with_erlang" ; then
13 AC_MSG_ERROR([Specified erlang does not exist or is not executable: $with_erlang])
14 fi
15 - AC_MSG_RESULT([$with_erlang])
16 - AC_SUBST([ERLANG], ["$with_erlang"])
17 + AC_MSG_RESULT(["$with_erlang/bin/erl"])
18 + AC_SUBST([ERL],["$with_erlang/bin/erl"])
19 else
20 - AC_PATH_PROG([ERLANG], ["erl"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
21 + AC_ERLANG_NEED_ERL(["$with_erlang/bin"])
22 fi
23
24 - if test "$ERLANG" != "no" ; then
25 + if test "$ERL" != "no" ; then
26 AC_MSG_CHECKING([erlang version])
27 - ERLANG_VER="`$ERLANG -version 2>&1 | cut -d' ' -f6`"
28 + ERLANG_VER="`$ERL -version 2>&1 | cut -d' ' -f6`"
29
30 if test -z "$ERLANG_VER" ; then
31 AC_MSG_ERROR([Unable to detect erlang version])
32 + else
33 + AC_MSG_RESULT([$ERLANG_VER])
34 fi
35 - AC_MSG_RESULT([$ERLANG_VER])
36
37 - ERLANG_LIBDIR=`$ERLANG -noshell -eval 'io:format("~n~s/lib~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
38 + ERLANG_LIBDIR=`$ERL -noshell -eval 'io:format("~n~s/lib~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
39 AC_MSG_CHECKING([erlang libdir])
40 if test -z "`echo $ERLANG_LIBDIR`" ; then
41 AC_MSG_ERROR([failed])
42 @@ -42,9 +43,14 @@ then
43 ERLANG_LDFLAGS="-L$ERLANG_LIBDIR $ERLANG_LDFLAGS"
44 LIBS="-L$ERLANG_LIBDIR $LIBS"
45 fi
46 +
47 + #
48 + # Don't use the above ERLANG_LDFLAGS
49 + #
50 + ERLANG_LDFLAGS="-L${STAGING_DIR}/usr/lib"
51 AC_MSG_RESULT([$ERLANG_LIBDIR])
52
53 - ERLANG_INCDIR=`$ERLANG -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
54 + ERLANG_INCDIR=`$ERL -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
55 AC_MSG_CHECKING([erlang incdir])
56 if test -z "`echo $ERLANG_INCDIR`" ; then
57 AC_MSG_ERROR([failed])
58 @@ -58,10 +64,11 @@ then
59
60 ERLANG_LIB="ei"
61
62 - # check liei
63 + # check libei
64 AC_CHECK_LIB([$ERLANG_LIB], [ei_encode_version], [has_libei="yes"], [has_libei="no"])
65 # maybe someday ei will actually expose this?
66 - AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
67 + # until then, we comment it out
68 + #AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
69
70 if test "$has_libei" = "no" ; then
71 AS_IF([test "$with_erlang" = "try"],
72 @@ -75,7 +82,7 @@ then
73 )
74 else
75 ERLANG_LDFLAGS="$ERLANG_LDFLAGS -lei"
76 - AC_MSG_NOTICE([Your erlang seems OK, do not forget to enable mod_erlang_event in modules.conf])
77 + AC_MSG_NOTICE([Your erlang seems OK. You can now use ErLang in your codes.])
78 AC_SUBST([ERLANG_CFLAGS], [$ERLANG_CFLAGS])
79 AC_SUBST([ERLANG_LDFLAGS], [$ERLANG_LDFLAGS])
80 fi
81 @@ -85,12 +92,12 @@ then
82
83 else
84 AS_IF([test "$with_erlang" = "try"],
85 - [AC_MSG_WARN([Could not find erlang, mod_erlang_event will not build, use --with-erlang to specify the location])],
86 + [AC_MSG_WARN([Could not find erlang, codes depend on erlang will not build, use --with-erlang to specify the location])],
87 [AC_MSG_ERROR([Could not find erlang, use --with-erlang to specify the location])]
88 )
89 fi
90 else
91 - AC_MSG_WARN([erlang support disabled, building mod_erlang_event will fail!])
92 + AC_MSG_WARN([erlang support disabled!])
93 fi
94
95 ])