[FreeSWITCH]: Ref. to FS git commit bb258288801b50e8fb673a620a6c2b4855e11daf
[feed/telephony.git] / net / freeswitch / patches / musl / rel / 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 @@ -20,22 +20,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 @@ -43,9 +44,16 @@ 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_LIBDIR="${STAGING_DIR}/usr/lib"
51 + ERLANG_LDFLAGS="-L$ERLANG_LIBDIR"
52 + LIBS="-L$ERLANG_LIBDIR $LIBS"
53 AC_MSG_RESULT([$ERLANG_LIBDIR])
54
55 - ERLANG_INCDIR=`$ERLANG -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
56 + ERLANG_INCDIR=`$ERL -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
57 AC_MSG_CHECKING([erlang incdir])
58 if test -z "`echo $ERLANG_INCDIR`" ; then
59 AC_MSG_ERROR([failed])
60 @@ -59,10 +67,11 @@ then
61
62 ERLANG_LIB="ei"
63
64 - # check liei
65 + # check libei
66 AC_CHECK_LIB([$ERLANG_LIB], [ei_encode_version], [has_libei="yes"], [has_libei="no"])
67 # maybe someday ei will actually expose this?
68 - AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
69 + # until then, we comment it out
70 + #AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
71
72 if test "$has_libei" = "no" ; then
73 AS_IF([test "$with_erlang" = "try"],
74 @@ -76,7 +85,7 @@ then
75 )
76 else
77 ERLANG_LDFLAGS="$ERLANG_LDFLAGS -lei"
78 - AC_MSG_NOTICE([Your erlang seems OK, do not forget to enable mod_erlang_event in modules.conf])
79 + AC_MSG_NOTICE([Your erlang seems OK. You can now use ErLang in your codes.])
80 AC_SUBST([ERLANG_CFLAGS], [$ERLANG_CFLAGS])
81 AC_SUBST([ERLANG_LDFLAGS], [$ERLANG_LDFLAGS])
82 AM_CONDITIONAL([HAVE_ERLANG],[true])
83 @@ -87,12 +96,12 @@ then
84
85 else
86 AS_IF([test "$with_erlang" = "try"],
87 - [AC_MSG_WARN([Could not find erlang, mod_erlang_event will not build, use --with-erlang to specify the location])],
88 + [AC_MSG_WARN([Could not find erlang, codes depend on erlang will not build, use --with-erlang to specify the location])],
89 [AC_MSG_ERROR([Could not find erlang, use --with-erlang to specify the location])]
90 )
91 fi
92 else
93 - AC_MSG_WARN([erlang support disabled, building mod_erlang_event will fail!])
94 + AC_MSG_WARN([erlang support disabled!])
95 fi
96
97 ])