summaryrefslogtreecommitdiff
path: root/configure.in
blob: 4a9e8707c82b70c8140ec7f8841d0afbaac55f95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Filename: configure.in

AC_INIT(src/muniad.cc)

VERSION="0.0.1"
AM_INIT_AUTOMAKE( munia, $VERSION )

dnl ======================
dnl Compile with debug options
dnl ======================
AC_ARG_WITH(debug,
	[  --with-debug            build with debug support (default=no)],
	[],
	[with_debug=no])
if test x$with_debug == xyes; then
    AC_MSG_WARN([*** Building with debug support!])
    AC_DEFINE_UNQUOTED(WITH_DEBUG, , [The project is configured to use debug output])
    CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector -Wall -Werror -g -O0"
fi

dnl ======================
dnl Init pkg-config
dnl ======================
PKG_PROG_PKG_CONFIG(0.23)

AC_PROG_CXX

AM_CONFIG_HEADER(config.h)
AC_STDC_HEADERS

dnl ======================
dnl Check for getopt
dnl ======================
AC_HAVE_HEADERS(getopt.h)

dnl ======================
dnl Check for libwebsockets library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(libwebsockets.h, , AC_MSG_ERROR([*** libwebsockets header file not found!]))
AC_CHECK_LIB(websockets, libwebsocket_create_context, , AC_MSG_ERROR([*** libwebsockets library not found!]))
LIBWEBSOCKETS_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
LIBWEBSOCKETS_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(LIBWEBSOCKETS_CFLAGS)
AC_SUBST(LIBWEBSOCKETS_LIBS)

AC_OUTPUT(
	Makefile
	src/Makefile
	tools/Makefile)