summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac84
1 files changed, 84 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..2577a04
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,84 @@
1AC_INIT([mfi_agent], [1.0], [mike@crute.us])
2AC_PREREQ([2.60])
3
4AM_INIT_AUTOMAKE([foreign -Wall -Werror])
5AM_SILENT_RULES([yes])
6
7AC_PROG_CC
8AC_LANG_WERROR
9AC_PROG_CC_C99
10PKG_PROG_PKG_CONFIG
11AC_CHECK_HEADER_STDBOOL
12
13AC_SEARCH_LIBS(
14 [ev_run],
15 [ev],
16 [found_libev=yes],
17 [found_libev=no]
18)
19AC_CHECK_HEADER(
20 [ev.h],
21 ,
22 found_libev=no
23)
24if test "x$found_libev" = xno; then
25 AC_MSG_ERROR("libev not found")
26fi
27
28PKG_CHECK_MODULES(
29 JSON_C,
30 json-c,
31 [found_json_c=yes],
32 [found_json_c=no]
33)
34if test "x$found_json_c" = xno; then
35 AC_MSG_ERROR("libjson-c not found")
36fi
37
38PKG_CHECK_MODULES(
39 WEBSOCKETS,
40 libwebsockets,
41 [found_libwebsockets=yes],
42 [found_libwebsockets=no]
43)
44if test "x$found_libwebsockets" = xno; then
45 AC_MSG_ERROR("libwebsockets not found")
46fi
47
48AC_ARG_ENABLE(
49 debug,
50 AC_HELP_STRING([--enable-debug], [create a debug build])
51)
52AS_IF([test "x$enable_debug" = xyes], [
53 AM_CFLAGS="-g -DDEBUG $AM_CFLAGS"
54 AM_CFLAGS="$AM_CFLAGS -Wno-long-long -Wall -W -Wformat=2"
55 AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
56 AM_CFLAGS="$AM_CFLAGS -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare"
57 AM_CFLAGS="$AM_CFLAGS -Wundef -Wbad-function-cast -Winline -Wcast-align"
58 AM_CFLAGS="$AM_CFLAGS -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes"
59 AM_CFLAGS="$AM_CFLAGS -Wno-unused-result"
60])
61
62AC_ARG_ENABLE(
63 [production],
64 AC_HELP_STRING([--enable-production], [produce a production-ready build])
65)
66AS_IF([test "x$enable_production" = xyes], [
67 AM_CFLAGS="-s -Os $AM_CFLAGS"
68])
69
70if test "x$enable_debug" = xyes && test "x$enable_production" = xyes; then
71 AC_MSG_ERROR([Production and Debug are mutually exclusive options])
72fi
73
74# Always build static binaries to make it easier to deploy
75AM_LDFLAGS="-static $AM_LDFLAGS"
76
77AM_CFLAGS="-Wall -Werror $AM_CFLAGS"
78
79AC_SUBST(AM_CFLAGS)
80AC_SUBST(AM_LDFLAGS)
81
82AC_CONFIG_FILES([Makefile])
83
84AC_OUTPUT