diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 84 |
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 @@ | |||
1 | AC_INIT([mfi_agent], [1.0], [mike@crute.us]) | ||
2 | AC_PREREQ([2.60]) | ||
3 | |||
4 | AM_INIT_AUTOMAKE([foreign -Wall -Werror]) | ||
5 | AM_SILENT_RULES([yes]) | ||
6 | |||
7 | AC_PROG_CC | ||
8 | AC_LANG_WERROR | ||
9 | AC_PROG_CC_C99 | ||
10 | PKG_PROG_PKG_CONFIG | ||
11 | AC_CHECK_HEADER_STDBOOL | ||
12 | |||
13 | AC_SEARCH_LIBS( | ||
14 | [ev_run], | ||
15 | [ev], | ||
16 | [found_libev=yes], | ||
17 | [found_libev=no] | ||
18 | ) | ||
19 | AC_CHECK_HEADER( | ||
20 | [ev.h], | ||
21 | , | ||
22 | found_libev=no | ||
23 | ) | ||
24 | if test "x$found_libev" = xno; then | ||
25 | AC_MSG_ERROR("libev not found") | ||
26 | fi | ||
27 | |||
28 | PKG_CHECK_MODULES( | ||
29 | JSON_C, | ||
30 | json-c, | ||
31 | [found_json_c=yes], | ||
32 | [found_json_c=no] | ||
33 | ) | ||
34 | if test "x$found_json_c" = xno; then | ||
35 | AC_MSG_ERROR("libjson-c not found") | ||
36 | fi | ||
37 | |||
38 | PKG_CHECK_MODULES( | ||
39 | WEBSOCKETS, | ||
40 | libwebsockets, | ||
41 | [found_libwebsockets=yes], | ||
42 | [found_libwebsockets=no] | ||
43 | ) | ||
44 | if test "x$found_libwebsockets" = xno; then | ||
45 | AC_MSG_ERROR("libwebsockets not found") | ||
46 | fi | ||
47 | |||
48 | AC_ARG_ENABLE( | ||
49 | debug, | ||
50 | AC_HELP_STRING([--enable-debug], [create a debug build]) | ||
51 | ) | ||
52 | AS_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 | |||
62 | AC_ARG_ENABLE( | ||
63 | [production], | ||
64 | AC_HELP_STRING([--enable-production], [produce a production-ready build]) | ||
65 | ) | ||
66 | AS_IF([test "x$enable_production" = xyes], [ | ||
67 | AM_CFLAGS="-s -Os $AM_CFLAGS" | ||
68 | ]) | ||
69 | |||
70 | if test "x$enable_debug" = xyes && test "x$enable_production" = xyes; then | ||
71 | AC_MSG_ERROR([Production and Debug are mutually exclusive options]) | ||
72 | fi | ||
73 | |||
74 | # Always build static binaries to make it easier to deploy | ||
75 | AM_LDFLAGS="-static $AM_LDFLAGS" | ||
76 | |||
77 | AM_CFLAGS="-Wall -Werror $AM_CFLAGS" | ||
78 | |||
79 | AC_SUBST(AM_CFLAGS) | ||
80 | AC_SUBST(AM_LDFLAGS) | ||
81 | |||
82 | AC_CONFIG_FILES([Makefile]) | ||
83 | |||
84 | AC_OUTPUT | ||