packaging: support smack manifest and cleanup
[profile/ivi/libwebsockets.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.61])
5 AC_INIT(libwebsockets, 1.2, andy@warmcat.com, libwebsockets, http://libwebsockets.org)
6 AC_CONFIG_SRCDIR([test-server/test-server.c])
7 AC_CONFIG_HEADERS([config.h])
8
9 : ${CFLAGS=""}
10 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
11 #AM_PROG_AR
12 LT_INIT(shared)
13
14 #AX_PTHREAD
15
16 # Checks for programs.
17 AM_PROG_CC_C_O
18 AC_PROG_INSTALL
19 AC_PROG_MAKE_SET
20 AC_CONFIG_MACRO_DIR([m4])
21
22 PKG_CHECK_MODULES([SD_DAEMON],
23                   [libsystemd-daemon],
24                   [AC_DEFINE([HAVE_SYSTEMD_DAEMON])],
25                   [AC_MSG_NOTICE([Systemd socket activation won't be enabled])])
26 AC_SUBST([SD_DAEMON_LIBS])
27 AC_SUBST([SD_DAEMON_CFLAGS])
28
29 applyhash='CFLAGS+= -DLWS_LIBRARY_VERSION=\"$(PACKAGE_VERSION)\" -DLWS_BUILD_HASH=\"${shell git log -n 1 --pretty=%h}\"'
30 AC_SUBST([applyhash])
31 AM_SUBST_NOTMAKE([applyhash])
32
33 # Check for existance of the inline keyword.
34 AC_C_INLINE
35
36 #
37 #
38 #
39 AC_ARG_ENABLE(openssl,
40  [  --enable-openssl  Enables https support and needs openssl libs],
41  [ openssl=yes
42  ])
43
44 if test "x$openssl" = "xyes" ; then
45 AC_CHECK_LIB([ssl], [SSL_library_init])
46 CFLAGS="$CFLAGS -DLWS_OPENSSL_SUPPORT"
47 fi
48
49 #
50 #
51 #
52 AC_ARG_ENABLE(libcrypto,
53  [  --enable-libcrypto  Use libcrypto MD5 and SHA1 implementations],
54  [ libcrypto=yes
55  ])
56
57 if test "x$libcrypto" = "xyes" ; then
58 CFLAGS="$CFLAGS -DLWS_LIBCRYPTO"
59 LDFLAGS="$LDFLAGS -lcrypto"
60 fi
61 AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes)
62
63
64 #
65 #
66 AC_ARG_WITH(testapps,
67  [  --without-testapps  dont build the libwebsocket-test- apps],
68  [ no_testapps=yes
69  ])
70
71 AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes)
72
73
74 #
75 #
76 AC_ARG_WITH(client,
77  [  --without-client  dont build the client part of the library ],
78  [ no_client=yes
79  ])
80
81 if test "x$no_client" = "xyes" ; then                                             
82 CFLAGS="$CFLAGS -DLWS_NO_CLIENT"                                          
83 fi
84 AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes)
85
86
87 #
88 #
89 AC_ARG_WITH(server,
90  [  --without-server  dont build the client part of the library ],
91  [ no_server=yes
92  ])
93
94 if test "x$no_server" = "xyes" ; then                                             
95 CFLAGS="$CFLAGS -DLWS_NO_SERVER"                                          
96 fi
97 AM_CONDITIONAL(NO_SERVER, test x$no_server = xyes)
98
99
100 #
101 #
102 AC_ARG_WITH(extensions,
103  [  --without-extensions  dont build any stuff related to extensions ],
104  [ no_extensions=yes
105  ])
106
107 if test "x$no_extensions" = "xyes" ; then                                             
108 CFLAGS="$CFLAGS -DLWS_NO_EXTENSIONS"                                          
109 fi
110 AM_CONDITIONAL(NO_EXTENSIONS, test x$no_extensions = xyes)
111
112
113 #
114 #
115 AC_ARG_WITH(latency,
116  [  --with-latency  Build latency measuring code into the library ],
117  [ latency=yes
118  ])
119
120 if test "x$latency" = "xyes" ; then                                             
121 CFLAGS="$CFLAGS -DLWS_LATENCY"                                          
122 fi
123 AM_CONDITIONAL(LATENCY, test x$latency = xyes)
124
125
126 #
127 #
128 AC_ARG_WITH(daemonize,
129  [  --without-daemonize  dont build the daemonization api ],
130  [ no_daemonize=yes
131  ])
132
133 if test "x$no_daemonize" = "xyes" ; then                                             
134 CFLAGS="$CFLAGS -DLWS_NO_DAEMONIZE"                                          
135 fi
136 AM_CONDITIONAL(NO_DAEMONIZE, test x$no_daemonize = xyes)
137
138 #                                                                               
139 #                                                                               
140 #                                                                               
141 AC_ARG_ENABLE(mingw,                                                          
142  [  --enable-mingw  Using mingw compilers, disables ping test build],            
143  [ mingw=yes
144    noping=yes
145  ])                                                                             
146                                                                                 
147 if test "x$mingw" = "xyes" ; then                                             
148 CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT"                                          
149 fi
150 AM_CONDITIONAL(MINGW, test x$mingw = xyes)
151
152 #
153 #
154 #
155 AC_ARG_WITH([client-cert-dir],
156 [AS_HELP_STRING([--with-client-cert-dir],[directory containing client certs, defaults to /etc/pki/tls/certs/])],
157 [clientcertdir=$withval],
158 [clientcertdir=/etc/pki/tls/certs/]
159 )
160 AC_SUBST([clientcertdir])
161
162 AC_SUBST([CFLAGS])
163
164
165 #
166 #
167 #
168 AC_ARG_ENABLE(noping,
169  [  --enable-noping  Do not build ping test app, which has some unixy stuff in sources],
170  [ noping=yes
171  ])
172
173 AM_CONDITIONAL(NOPING, test x$noping = xyes)
174
175 #
176 #
177 #
178 AC_ARG_ENABLE(debug,
179  [  --disable-debug  Stops debug-related code from even being compiled in, useful for best speed],
180  [ disable_debug=yes
181  ])
182
183 if test "x$disable_debug" != "xyes" ; then
184 CFLAGS="$CFLAGS -D_DEBUG"
185 fi
186 AM_CONDITIONAL(DISABLE_DEBUG, test x$disable_debug = xyes)
187
188
189 #
190 #
191 #
192 AC_ARG_ENABLE(builtin-getifaddrs,
193  [  --enable-builtin-getifaddrs  Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it],
194  [ builtin_getifaddrs=yes
195  ])
196 if test "x$builtin-getifaddrs" = "xyes" ; then
197 CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS"
198 fi
199 AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes)
200
201
202 #
203 #
204 AC_ARG_WITH(cyassl,
205  [  --with-cyassl  Use CyaSSL instead of OpenSSL ],
206  [ use_cyassl=yes
207  ])
208
209 if test "x$use_cyassl" = "xyes" ; then                                     
210 CFLAGS="$CFLAGS -DUSE_CYASSL -DLWS_OPENSSL_SUPPORT"
211 fi
212 AM_CONDITIONAL(USE_CYASSL, test x$use_cyassl = xyes)
213
214
215 # Checks for header files.
216 AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h])
217
218 # Checks for typedefs, structures, and compiler characteristics.
219 AC_TYPE_SIZE_T
220
221 # Checks for library functions.
222
223 AC_FUNC_MALLOC
224 AC_FUNC_REALLOC
225 AC_CHECK_FUNCS([bzero memset socket strerror])
226
227 AC_CONFIG_FILES([Makefile
228                  lib/Makefile
229                  test-server/Makefile])
230
231 AC_OUTPUT([
232 libwebsockets.pc
233 ])