FSBUILD-142 (with approval from MikeJ)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12587 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Andrew Thompson 2009-03-12 19:54:20 +00:00
parent a03415c255
commit ea0316b80f
4 changed files with 101 additions and 0 deletions

View File

@ -6,6 +6,7 @@ m4_include([build/config/ac_gcc_archflag.m4])
m4_include([build/config/ac_gcc_x86_cpuid.m4])
m4_include([build/config/ax_lib_mysql.m4])
m4_include([build/config/ax_check_java.m4])
m4_include([build/config/erlang.m4])
m4_include([build/config/odbc.m4])
m4_include([libs/apr/build/apr_common.m4])
m4_include([build/config/libcurl.m4])

96
build/config/erlang.m4 Normal file
View File

@ -0,0 +1,96 @@
AC_DEFUN([CHECK_ERLANG], [
#
# Erlang checks for mod_erlang_event
#
AC_ARG_WITH(
[erlang],
[AS_HELP_STRING([--with-erlang], [Use system provided version of erlang (default: try)])],
[with_erlang="$withval"],
[with_erlang="try"]
)
if test "$with_erlang" != "no"
then
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
if test "$with_erlang" != "yes" -a "$with_erlang" != "try" ; then
AC_MSG_CHECKING([for erlang])
if test ! -x "$with_erlang" ; then
AC_MSG_ERROR([Specified erlang does not exist or is not executable: $with_erlang])
fi
AC_MSG_RESULT([$with_erlang])
AC_SUBST([ERLANG], ["$with_erlang"])
else
AC_PATH_PROG([ERLANG], ["erl"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
fi
if test "$ERLANG" != "no" ; then
AC_MSG_CHECKING([erlang version])
ERLANG_VER="`$ERLANG -version 2>&1 | cut -d' ' -f6`"
if test -z "$ERLANG_VER" ; then
AC_MSG_ERROR([Unable to detect erlang version])
fi
AC_MSG_RESULT([$ERLANG_VER])
ERLANG_LIBDIR=`$ERLANG -noshell -eval 'io:format("~s/lib~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt`
AC_MSG_CHECKING([erlang libdir])
if test -z "`echo $ERLANG_LIBDIR`" ; then
AC_MSG_ERROR([failed])
else
ERLANG_LDFLAGS="-L$ERLANG_LIBDIR $ERLANG_LDFLAGS"
LIBS="-L$ERLANG_LIBDIR $LIBS"
fi
AC_MSG_RESULT([$ERLANG_LIBDIR])
ERLANG_INCDIR=`$ERLANG -noshell -eval 'io:format("~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt`
AC_MSG_CHECKING([erlang incdir])
if test -z "`echo $ERLANG_INCDIR`" ; then
AC_MSG_ERROR([failed])
else
ERLANG_CFLAGS="-I$ERLANG_INCDIR $ERLANG_CFLAGS"
CFLAGS="-I$ERLANG_INCDIR $CFLAGS"
fi
AC_MSG_RESULT([$ERLANG_INCDIR])
AC_CHECK_HEADERS([ei.h], [has_ei_h="yes"], [has_ei_h="no"])
ERLANG_LIB="ei"
# check liei
AC_CHECK_LIB([$ERLANG_LIB], [ei_encode_version], [has_libei="yes"], [has_libei="no"])
# maybe someday ei will actually expose this?
AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
if test "$has_libei" = "no" ; then
AS_IF([test "$with_erlang" = "try"],
[AC_MSG_WARN([$ERLANG_LIB is unusable])],
[AC_MSG_ERROR([$ERLANG_LIB is unusable])]
)
elif test "$has_ei_h" = "no"; then
AS_IF([test "$with_erlang" = "try"],
[AC_MSG_WARN([ei.h is unusable - are the erlang development headers installed?])],
[AC_MSG_ERROR([ei.h is unusable - are the erlang development headers installed?])]
)
else
ERLANG_LDFLAGS="$ERLANG_LDFLAGS -lei"
AC_MSG_NOTICE([Your erlang seems OK, do not forget to enable mod_erlang_event in modules.conf])
AC_SUBST([ERLANG_CFLAGS], [$ERLANG_CFLAGS])
AC_SUBST([ERLANG_LDFLAGS], [$ERLANG_LDFLAGS])
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
else
AS_IF([test "$with_erlang" = "try"],
[AC_MSG_WARN([Could not find erlang, mod_erlang_event will not build, use --with-erlang to specify the location])],
[AC_MSG_ERROR([Could not find erlang, use --with-erlang to specify the location])]
)
fi
else
AC_MSG_WARN([erlang support disabled, building mod_erlang_event will fail!])
fi
])

View File

@ -50,6 +50,7 @@ endpoints/mod_loopback
event_handlers/mod_event_socket
event_handlers/mod_cdr_csv
#event_handlers/mod_radius_cdr
#event_handlers/mod_erlang_event
formats/mod_native_file
formats/mod_sndfile
#formats/mod_shout

View File

@ -692,6 +692,8 @@ else
AC_MSG_WARN([python support disabled, building mod_python will fail!])
fi
CHECK_ERLANG
AC_CONFIG_FILES([Makefile
src/Makefile
src/mod/Makefile
@ -699,6 +701,7 @@ AC_CONFIG_FILES([Makefile
src/mod/event_handlers/mod_radius_cdr/Makefile
src/mod/languages/mod_java/Makefile
src/mod/languages/mod_python/Makefile
src/mod/event_handlers/mod_erlang_event/Makefile
src/include/switch_am_config.h
build/getsounds.sh
build/getlib.sh