2013-11-09 17:47:19 -05:00
|
|
|
AC_PREREQ([2.68])
|
|
|
|
AC_INIT([telegram], [0.1])
|
|
|
|
AC_CONFIG_SRCDIR([config.h.in])
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
2014-01-11 19:43:29 -05:00
|
|
|
m4_include([ax_lua.m4])
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CC
|
|
|
|
|
|
|
|
# Checks for libraries.
|
|
|
|
AC_CHECK_LIB([m], [sqrt])
|
|
|
|
AC_CHECK_LIB([crypto], [AES_set_encrypt_key])
|
|
|
|
|
|
|
|
EXTRA_LIBS=""
|
|
|
|
|
2013-12-20 09:25:22 -05:00
|
|
|
BT=
|
|
|
|
AC_CHECK_FUNC([backtrace],
|
|
|
|
[
|
|
|
|
BT=1
|
|
|
|
],
|
|
|
|
[
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
if test "x$BT" = "x" ; then
|
2014-01-30 06:01:16 -05:00
|
|
|
AC_CHECK_LIB([execinfo], [backtrace],
|
|
|
|
[ EXTRA_LIBS="${EXTRA_LIBS} -lexecinfo" ; ],
|
|
|
|
[ CFLAGS="${CFLAGS} -DNO_BACKTRACE" ; ])
|
2013-12-20 09:25:22 -05:00
|
|
|
fi
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
AC_CHECK_LIB([readline], [rl_save_prompt],
|
|
|
|
[
|
|
|
|
AC_DEFINE([READLINE_GNU], [1], [Use gnu libreadline])
|
2013-12-20 15:13:53 -05:00
|
|
|
[ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ]
|
2013-11-09 17:47:19 -05:00
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_CHECK_LIB([edit], [rl_set_prompt])
|
|
|
|
AC_DEFINE([READLINE_EDIT], [1], [Use libedit])
|
2013-12-20 15:13:53 -05:00
|
|
|
[ EXTRA_LIBS="${EXTRA_LIBS} -ledit" ; ]
|
2013-11-09 17:47:19 -05:00
|
|
|
]
|
|
|
|
)
|
|
|
|
|
2013-11-11 06:34:45 -05:00
|
|
|
AC_CHECK_LIB([rt], [clock_gettime],
|
|
|
|
[
|
2013-12-20 15:13:53 -05:00
|
|
|
[ EXTRA_LIBS="${EXTRA_LIBS} -lrt" ; ]
|
2013-11-11 06:34:45 -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])
|
|
|
|
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
|
2013-12-20 15:13:53 -05:00
|
|
|
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
|
2013-11-09 17:47:19 -05:00
|
|
|
fi
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([enabled])
|
|
|
|
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
|
2013-12-20 15:13:53 -05:00
|
|
|
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
|
2013-11-09 17:47:19 -05:00
|
|
|
])
|
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}" ; ]
|
|
|
|
[CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ; ]
|
|
|
|
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}" ; ]
|
|
|
|
[CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ; ]
|
|
|
|
AC_DEFINE(USE_LUA,1,[use lua])
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_ERROR([No lua found. Try --disable-liblua])
|
|
|
|
])
|
|
|
|
])
|
2013-11-09 17:47:19 -05:00
|
|
|
|
|
|
|
# Checks for header files.
|
2014-01-13 08:28:24 -05:00
|
|
|
AC_CHECK_HEADERS([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
|
|
|
|
|
|
|
AC_SUBST(EXTRA_LIBS)
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
|