2013-11-09 17:47:19 -05:00
|
|
|
AC_PREREQ([2.68])
|
2014-09-07 11:17:35 -04:00
|
|
|
AC_INIT([telegram-cli], [1.0])
|
2013-11-09 17:47:19 -05:00
|
|
|
AC_CONFIG_SRCDIR([config.h.in])
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
2014-01-11 19:43:29 -05:00
|
|
|
m4_include([ax_lua.m4])
|
2015-05-02 06:43:53 -04:00
|
|
|
m4_include([ax_python.m4])
|
2014-09-07 11:17:35 -04:00
|
|
|
m4_include([m4_ax_check_openssl.m4])
|
|
|
|
m4_include([m4_ax_check_zlib.m4])
|
2014-09-09 07:34:59 -04:00
|
|
|
m4_include([m4-ax_gcc_builtin.m4])
|
2014-01-11 19:43:29 -05:00
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CC
|
|
|
|
|
2014-02-26 19:06:44 -05:00
|
|
|
# BSD locations for headers and libraries from packages, Linux locations for self-compiled stuff.
|
|
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
|
|
|
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
# Checks for libraries.
|
|
|
|
AC_CHECK_LIB([m], [sqrt])
|
2014-02-03 07:25:09 -05:00
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
|
|
|
AC_SEARCH_LIBS([backtrace], [execinfo])
|
2014-09-07 11:17:35 -04:00
|
|
|
AC_CHECK_LIB([event], [event_base_new], [], [AC_MSG_ERROR([no libevent found])])
|
2014-09-07 15:12:39 -04:00
|
|
|
|
|
|
|
EVENT_VER=""
|
|
|
|
|
|
|
|
AC_CHECK_HEADER(event2/event.h, [AC_DEFINE([EVENT_V2], [1], [Use libevent v2])], [
|
|
|
|
AC_CHECK_HEADER(event.h, [AC_DEFINE([EVENT_V1], [1], [Use libevent v1])], [AC_MSG_ERROR([no libevent found])])
|
|
|
|
])
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
EXTRA_LIBS=""
|
|
|
|
|
2014-09-07 11:17:35 -04:00
|
|
|
# OPENSSL_INCLUDES to the include directives required
|
|
|
|
# OPENSSL_LIBS to the -l directives required
|
|
|
|
# OPENSSL_LDFLAGS to the -L or -R flags required
|
|
|
|
|
|
|
|
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found])])
|
|
|
|
AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])])
|
|
|
|
|
2014-09-07 15:12:39 -04:00
|
|
|
AC_CHECK_LIB([readline], [rl_save_prompt], [ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ], [AC_MSG_ERROR([no libreadline found])])
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-01-11 19:43:29 -05:00
|
|
|
AC_MSG_CHECKING([for libconfig])
|
2013-11-09 17:47:19 -05:00
|
|
|
AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
|
|
|
|
[
|
|
|
|
if test "x$enableval" = "xno" ; then
|
|
|
|
AC_MSG_RESULT([disabled])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([enabled])
|
2014-02-05 06:07:58 -05:00
|
|
|
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
|
2013-11-09 17:47:19 -05:00
|
|
|
fi
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([enabled])
|
2014-02-05 06:07:58 -05:00
|
|
|
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
|
2013-11-09 17:47:19 -05:00
|
|
|
])
|
2014-01-11 19:43:29 -05:00
|
|
|
|
2014-10-21 12:47:57 -04:00
|
|
|
AC_ARG_ENABLE(extf,[--enable-extf/--disable-extf],
|
|
|
|
[
|
|
|
|
if test "x$enableval" = "xno" ; then
|
|
|
|
AC_DEFINE([DISABLE_EXTF],[1],[disable extf queries])
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
])
|
|
|
|
|
2014-01-11 19:43:29 -05:00
|
|
|
AC_MSG_CHECKING([for liblua])
|
|
|
|
AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
|
|
|
|
[
|
|
|
|
if test "x$enableval" = "xno" ; then
|
|
|
|
AC_MSG_RESULT([disabled])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([enabled])
|
|
|
|
AX_PROG_LUA([],[],
|
|
|
|
[
|
|
|
|
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
|
|
|
|
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
|
|
|
|
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
|
2014-02-26 18:52:30 -05:00
|
|
|
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
|
2014-01-11 19:43:29 -05:00
|
|
|
AC_DEFINE(USE_LUA,1,[use lua])
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_ERROR([No lua found. Try --disable-liblua])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([enabled])
|
|
|
|
AX_PROG_LUA([],[],
|
|
|
|
[
|
|
|
|
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
|
|
|
|
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
|
|
|
|
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
|
2014-02-26 18:52:30 -05:00
|
|
|
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
|
2014-01-11 19:43:29 -05:00
|
|
|
AC_DEFINE(USE_LUA,1,[use lua])
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_ERROR([No lua found. Try --disable-liblua])
|
|
|
|
])
|
|
|
|
])
|
2014-02-06 09:12:43 -05:00
|
|
|
|
2015-05-11 07:20:34 -04:00
|
|
|
AC_MSG_CHECKING([for libjansson])
|
|
|
|
AC_ARG_ENABLE(json,[--enable-json/--disable-json],
|
|
|
|
[
|
|
|
|
if test "x$enableval" = "xno" ; then
|
|
|
|
AC_MSG_RESULT([disabled])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([enabled])
|
|
|
|
AC_CHECK_LIB([jansson],[json_array_set_new],[],AC_MSG_ERROR([No libjansson found. Try --disable-json]))
|
|
|
|
AC_DEFINE(USE_JSON,1,[use json])
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([enabled])
|
|
|
|
AC_CHECK_LIB([jansson],[json_array_set_new],[],AC_MSG_ERROR([No libjansson found. Try --disable-json]))
|
|
|
|
AC_DEFINE(USE_JSON,1,[use json])
|
|
|
|
])
|
|
|
|
|
2015-05-02 06:43:53 -04:00
|
|
|
AC_ARG_ENABLE(python,[--enable-python/--disable-python],
|
|
|
|
[
|
2015-05-02 07:48:31 -04:00
|
|
|
AX_PYTHON()
|
2015-05-02 06:43:53 -04:00
|
|
|
dnl python checks (you can change the required python version bellow)
|
|
|
|
AM_PATH_PYTHON(2.7.0)
|
|
|
|
PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
|
|
|
|
AC_SUBST([PYTHON_LIBS])
|
|
|
|
AC_SUBST([PYTHON_CFLAGS])
|
2015-05-02 07:48:31 -04:00
|
|
|
EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}"
|
|
|
|
CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}"
|
|
|
|
|
|
|
|
AC_DEFINE(USE_PYTHON,1,[use python])
|
|
|
|
])
|
2015-05-02 06:43:53 -04:00
|
|
|
|
2014-02-06 09:12:43 -05:00
|
|
|
#check for custom prog name
|
2015-05-11 07:20:34 -04:00
|
|
|
AC_MSG_CHECKING([progname])
|
2014-02-06 09:12:43 -05:00
|
|
|
AC_ARG_WITH(progname,[--with-progname=<name>],
|
|
|
|
[
|
|
|
|
if test "x$with_progname" = "xno" ; then
|
|
|
|
AC_MSG_RESULT([default])
|
|
|
|
elif test "x$with_progname" = "xyes" ; then
|
|
|
|
AC_MSG_RESULT([default])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(["$with_progname"])
|
|
|
|
AC_DEFINE_UNQUOTED([PROG_NAME], ["$with_progname"], [Use custom prog name])
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([default])
|
|
|
|
])
|
2015-04-27 06:43:31 -04:00
|
|
|
|
|
|
|
AC_ARG_ENABLE(valgrind,[--enable-valgrind/--disable-valgrind],
|
|
|
|
[
|
|
|
|
if test "x$enableval" = "xyes" ; then
|
|
|
|
AC_CHECK_HEADER(valgrind/memcheck.h, [AC_DEFINE([VALGRIND_FIXES], [1], [fixed for correct valgrind work])], [
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
])
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
|
|
|
|
# Checks for header files.
|
2014-02-03 07:25:09 -05:00
|
|
|
AC_CHECK_HEADERS([execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h])
|
2013-11-09 17:47:19 -05:00
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_TYPE_SIZE_T
|
2014-01-13 08:28:24 -05:00
|
|
|
AC_TYPE_UID_T
|
|
|
|
AC_C_INLINE
|
2013-11-09 17:47:19 -05:00
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
AC_FUNC_MALLOC
|
|
|
|
AC_FUNC_REALLOC
|
2014-01-13 08:28:24 -05:00
|
|
|
AC_CHECK_FUNCS([alarm endpwent memset memmove mkdir select socket strdup strndup uname])
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-09-09 07:34:59 -04:00
|
|
|
AX_GCC_BUILTIN(__builtin_bswap32)
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
AC_SUBST(EXTRA_LIBS)
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
|