roubustness handle problems in read loop better
[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.0, andy@warmcat.com)
6 AC_CONFIG_SRCDIR([test-server/test-server.c])
7 AC_CONFIG_HEADERS([config.h])
8
9 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
10 AM_PROG_AR
11 LT_INIT(shared)
12
13 #AX_PTHREAD
14
15 # Checks for programs.
16 AM_PROG_CC_C_O
17 AC_PROG_INSTALL
18 AC_PROG_MAKE_SET
19 AC_CONFIG_MACRO_DIR([m4])
20
21 #
22 #
23 #
24 AC_ARG_ENABLE(openssl,
25  [  --enable-openssl  Enables https support and needs openssl libs],
26  [ openssl=yes
27  ])
28
29 if test "x$openssl" = "xyes" ; then
30 AC_CHECK_LIB([ssl], [SSL_library_init])
31 CFLAGS="$CFLAGS -DLWS_OPENSSL_SUPPORT"
32 fi
33
34 #
35 #
36 #
37 AC_ARG_ENABLE(libcrypto,
38  [  --enable-libcrypto  Use libcrypto MD5 and SHA1 implementations],
39  [ libcrypto=yes
40  ])
41
42 if test "x$libcrypto" = "xyes" ; then
43 CFLAGS="$CFLAGS -DLWS_LIBCRYPTO"
44 LDFLAGS="$LDFLAGS -lcrypto"
45 fi
46 AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes)
47
48
49 #
50 #
51 AC_ARG_WITH(testapps,
52  [  --without-testapps  dont build the libwebsocket-test- apps],
53  [ no_testapps=yes
54  ])
55
56 AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes)
57
58
59 #
60 #
61 AC_ARG_WITH(client,
62  [  --without-client  dont build the client part of the library ],
63  [ no_client=yes
64  ])
65
66 if test "x$no_client" = "xyes" ; then                                             
67 CFLAGS="$CFLAGS -DLWS_NO_CLIENT"                                          
68 fi
69 AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes)
70
71
72 #
73 #
74 AC_ARG_WITH(server,
75  [  --without-server  dont build the client part of the library ],
76  [ no_server=yes
77  ])
78
79 if test "x$no_server" = "xyes" ; then                                             
80 CFLAGS="$CFLAGS -DLWS_NO_SERVER"                                          
81 fi
82 AM_CONDITIONAL(NO_SERVER, test x$no_server = xyes)
83
84
85 #
86 #
87 AC_ARG_WITH(extensions,
88  [  --without-extensions  dont build any stuff related to extensions ],
89  [ no_extensions=yes
90  ])
91
92 if test "x$no_extensions" = "xyes" ; then                                             
93 CFLAGS="$CFLAGS -DLWS_NO_EXTENSIONS"                                          
94 fi
95 AM_CONDITIONAL(NO_EXTENSIONS, test x$no_extensions = xyes)
96
97
98 #
99 #
100 AC_ARG_WITH(latency,
101  [  --with-latency  Build latency measuring code into the library ],
102  [ latency=yes
103  ])
104
105 if test "x$latency" = "xyes" ; then                                             
106 CFLAGS="$CFLAGS -DLWS_LATENCY"                                          
107 fi
108 AM_CONDITIONAL(LATENCY, test x$latency = xyes)
109
110
111 #
112 #
113 AC_ARG_WITH(daemonize,
114  [  --without-daemonize  dont build the daemonization api ],
115  [ no_daemonize=yes
116  ])
117
118 if test "x$no_daemonize" = "xyes" ; then                                             
119 CFLAGS="$CFLAGS -DLWS_NO_DAEMONIZE"                                          
120 fi
121 AM_CONDITIONAL(NO_DAEMONIZE, test x$no_daemonize = xyes)
122
123 #                                                                               
124 #                                                                               
125 #                                                                               
126 AC_ARG_ENABLE(mingw,                                                          
127  [  --enable-mingw  Using mingw compilers, disables ping test build],            
128  [ mingw=yes
129    noping=yes
130  ])                                                                             
131                                                                                 
132 if test "x$mingw" = "xyes" ; then                                             
133 CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT"                                          
134 fi
135 AM_CONDITIONAL(MINGW, test x$mingw = xyes)
136
137 #
138 #
139 #
140 AC_ARG_WITH([client-cert-dir],
141 [AS_HELP_STRING([--with-client-cert-dir],[directory containing client certs, defaults to /etc/pki/tls/certs/])],
142 [clientcertdir=$withval],
143 [clientcertdir=/etc/pki/tls/certs/]
144 )
145 AC_SUBST([clientcertdir])
146
147 AC_SUBST([CFLAGS])
148
149
150 #
151 #
152 #
153 AC_ARG_ENABLE(noping,
154  [  --enable-noping  Do not build ping test app, which has some unixy stuff in sources],
155  [ noping=yes
156  ])
157
158 AM_CONDITIONAL(NOPING, test x$noping = xyes)
159
160 #
161 #
162 #
163 AC_ARG_ENABLE(debug,
164  [  --disable-debug  Stops debug-related code from even being compiled in, useful for best speed],
165  [ disable_debug=yes
166  ])
167
168 if test "x$disable_debug" != "xyes" ; then
169 CFLAGS="$CFLAGS -D_DEBUG"
170 fi
171 AM_CONDITIONAL(DISABLE_DEBUG, test x$disable_debug = xyes)
172
173
174 #
175 #
176 #
177 AC_ARG_ENABLE(builtin-getifaddrs,
178  [  --enable-builtin-getifaddrs  Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it],
179  [ builtin_getifaddrs=yes
180  ])
181 if test "x$builtin-getifaddrs" = "xyes" ; then
182 CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS"
183 fi
184 AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes)
185
186
187
188 # Checks for header files.
189 AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h])
190
191 # Checks for typedefs, structures, and compiler characteristics.
192 AC_TYPE_SIZE_T
193
194 # Checks for library functions.
195
196 AC_FUNC_MALLOC
197 AC_FUNC_REALLOC
198 AC_CHECK_FUNCS([bzero memset socket strerror])
199
200 AC_CONFIG_FILES([Makefile
201                  lib/Makefile
202                  test-server/Makefile])
203
204 AC_OUTPUT([
205 libwebsockets.pc
206 ])