1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5AC_INIT([libsmf],[1.3],[trasz@FreeBSD.org])
6AM_INIT_AUTOMAKE([-Wall foreign])
7AC_CONFIG_SRCDIR([src/smf.c])
8AC_CONFIG_HEADER([config.h])
9
10# Checks for programs.
11AC_PROG_CC
12AC_PROG_INSTALL
13AC_PROG_LIBTOOL
14AC_PROG_LN_S
15AC_PROG_MAKE_SET
16AC_PROG_RANLIB
17
18# Checks for libraries.
19AC_CHECK_LIB([m], [pow])
20AC_ARG_WITH([readline],
21	    [AS_HELP_STRING([--with-readline],
22	    [support fancy command line editing @<:@default=check@:>@])],
23	    [],
24	    [with_readline=check])
25
26AS_IF([test "x$with_readline" != xno],
27      [AC_CHECK_LIB([readline], [main],
28		    [AC_SUBST([READLINE_LIBS], ["-lreadline -lncurses"])
29		    AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])],
30		    [if test "x$with_readline" != xcheck; then
31		     AC_MSG_FAILURE(
32				    [--with-readline was given, but test for readline failed])
33		     fi
34		     ], -lncurses)])
35
36
37# Checks for header files.
38AC_HEADER_STDC
39AC_CHECK_HEADERS([arpa/inet.h stdint.h stdlib.h string.h])
40
41# Checks for typedefs, structures, and compiler characteristics.
42AC_C_CONST
43AC_TYPE_INT8_T
44AC_TYPE_UINT16_T
45AC_TYPE_UINT32_T
46
47# Checks for library functions.
48AC_FUNC_MALLOC
49AC_FUNC_MEMCMP
50AC_FUNC_REALLOC
51AC_FUNC_STRTOD
52AC_CHECK_FUNCS([memset pow strdup strerror strtol strchr])
53
54PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2)
55AC_SUBST(GLIB_CFLAGS)
56AC_SUBST(GLIB_LIBS)
57
58AC_CONFIG_FILES([Makefile smf.pc src/Makefile man/Makefile])
59AC_OUTPUT
60