blob: 685906c218b5a1954ac6ed0953f54ce477dff66d [file] [log] [blame]
Andy Green3c974692010-11-08 17:04:09 +00001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
Artem Baguinskic451a4f2013-01-09 15:16:52 +08004AC_PREREQ([2.61])
Andy Green48258812013-02-12 10:36:39 +08005AC_INIT(libwebsockets, 1.2, andy@warmcat.com, libwebsockets, http://libwebsockets.org)
Andy Green3c974692010-11-08 17:04:09 +00006AC_CONFIG_SRCDIR([test-server/test-server.c])
7AC_CONFIG_HEADERS([config.h])
8
Andy Greena3957ef2013-02-11 09:31:43 +08009: ${CFLAGS=""}
Andy Green3c974692010-11-08 17:04:09 +000010AM_INIT_AUTOMAKE([-Wall -Werror foreign])
Andy Greena63c24b2013-01-10 12:36:59 +080011AM_PROG_AR
Andy Green3c974692010-11-08 17:04:09 +000012LT_INIT(shared)
13
Andy Greenb45993c2010-12-18 15:13:50 +000014#AX_PTHREAD
15
Andy Green3c974692010-11-08 17:04:09 +000016# Checks for programs.
Andy Green94c62c62012-10-06 15:17:01 +080017AM_PROG_CC_C_O
Andy Green3c974692010-11-08 17:04:09 +000018AC_PROG_INSTALL
19AC_PROG_MAKE_SET
20AC_CONFIG_MACRO_DIR([m4])
Andy Green90c7cbc2011-01-27 06:26:52 +000021
Andy Green7b405452013-02-01 10:50:15 +080022applyhash='CFLAGS+= -DLWS_LIBRARY_VERSION=\"$(PACKAGE_VERSION)\" -DLWS_BUILD_HASH=\"${shell git log -n 1 --pretty=%h}\"'
23AC_SUBST([applyhash])
24AM_SUBST_NOTMAKE([applyhash])
25
Joakim Soderberg4f4a38b2013-02-06 15:28:07 +090026# Check for existance of the inline keyword.
27AC_C_INLINE
28
Andy Green7619c472011-01-23 17:47:08 +000029#
30#
31#
Andy Green3c974692010-11-08 17:04:09 +000032AC_ARG_ENABLE(openssl,
33 [ --enable-openssl Enables https support and needs openssl libs],
34 [ openssl=yes
35 ])
36
37if test "x$openssl" = "xyes" ; then
38AC_CHECK_LIB([ssl], [SSL_library_init])
39CFLAGS="$CFLAGS -DLWS_OPENSSL_SUPPORT"
40fi
41
Andy Green7619c472011-01-23 17:47:08 +000042#
43#
44#
Andy Green7619c472011-01-23 17:47:08 +000045AC_ARG_ENABLE(libcrypto,
Andy Green90c7cbc2011-01-27 06:26:52 +000046 [ --enable-libcrypto Use libcrypto MD5 and SHA1 implementations],
Andy Green7619c472011-01-23 17:47:08 +000047 [ libcrypto=yes
48 ])
49
50if test "x$libcrypto" = "xyes" ; then
51CFLAGS="$CFLAGS -DLWS_LIBCRYPTO"
52LDFLAGS="$LDFLAGS -lcrypto"
53fi
54AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes)
55
Andy Green29da6d92013-01-15 19:57:06 +080056#
57#
58#
59AC_ARG_WITH(testapps,
60 [ --without-testapps dont build the libwebsocket-test- apps],
61 [ no_testapps=yes
62 ])
63
64AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes)
65
Andy Green03674a62013-01-16 11:47:40 +080066#
67#
68#
69AC_ARG_WITH(client,
70 [ --without-client dont build the client part of the library ],
71 [ no_client=yes
72 ])
73
74if test "x$no_client" = "xyes" ; then
75CFLAGS="$CFLAGS -DLWS_NO_CLIENT"
76fi
77AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes)
Andy Green29da6d92013-01-15 19:57:06 +080078
Andy Green279a3032013-01-17 10:05:39 +080079#
80#
81#
Andy Greena1ce6be2013-01-18 11:43:21 +080082AC_ARG_WITH(server,
83 [ --without-server dont build the client part of the library ],
84 [ no_server=yes
85 ])
86
87if test "x$no_server" = "xyes" ; then
88CFLAGS="$CFLAGS -DLWS_NO_SERVER"
89fi
90AM_CONDITIONAL(NO_SERVER, test x$no_server = xyes)
91
Andy Green3182ece2013-01-20 17:08:31 +080092#
93#
94#
95AC_ARG_WITH(extensions,
96 [ --without-extensions dont build any stuff related to extensions ],
97 [ no_extensions=yes
98 ])
Andy Greena1ce6be2013-01-18 11:43:21 +080099
Andy Green3182ece2013-01-20 17:08:31 +0800100if test "x$no_extensions" = "xyes" ; then
101CFLAGS="$CFLAGS -DLWS_NO_EXTENSIONS"
102fi
103AM_CONDITIONAL(NO_EXTENSIONS, test x$no_extensions = xyes)
Andy Greena1ce6be2013-01-18 11:43:21 +0800104
105#
106#
107#
Andy Greend636e352013-01-29 12:36:17 +0800108AC_ARG_WITH(latency,
109 [ --with-latency Build latency measuring code into the library ],
110 [ latency=yes
111 ])
112
113if test "x$latency" = "xyes" ; then
114CFLAGS="$CFLAGS -DLWS_LATENCY"
115fi
116AM_CONDITIONAL(LATENCY, test x$latency = xyes)
117
118#
119#
120#
Andy Green279a3032013-01-17 10:05:39 +0800121AC_ARG_WITH(daemonize,
122 [ --without-daemonize dont build the daemonization api ],
123 [ no_daemonize=yes
124 ])
125
Andy Greenfd6764a2013-01-19 11:11:42 +0800126if test "x$no_daemonize" = "xyes" ; then
127CFLAGS="$CFLAGS -DLWS_NO_DAEMONIZE"
128fi
Andy Green279a3032013-01-17 10:05:39 +0800129AM_CONDITIONAL(NO_DAEMONIZE, test x$no_daemonize = xyes)
130
Andy Green0dbef492012-04-12 10:11:29 +0800131#
132#
Andy Green4a673a32013-01-17 19:53:16 +0800133#
Andy Green0dbef492012-04-12 10:11:29 +0800134AC_ARG_ENABLE(mingw,
135 [ --enable-mingw Using mingw compilers, disables ping test build],
136 [ mingw=yes
137 noping=yes
138 ])
139
140if test "x$mingw" = "xyes" ; then
141CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT"
142fi
143AM_CONDITIONAL(MINGW, test x$mingw = xyes)
Andy Greena41314f2011-05-23 10:00:03 +0100144
145#
146#
147#
Andy Green90c7cbc2011-01-27 06:26:52 +0000148AC_ARG_WITH([client-cert-dir],
149[AS_HELP_STRING([--with-client-cert-dir],[directory containing client certs, defaults to /etc/pki/tls/certs/])],
150[clientcertdir=$withval],
151[clientcertdir=/etc/pki/tls/certs/]
152)
153AC_SUBST([clientcertdir])
154
155AC_SUBST([CFLAGS])
156
157
Andy Greena6cbece2011-01-27 20:06:03 +0000158#
159#
160#
161AC_ARG_ENABLE(noping,
162 [ --enable-noping Do not build ping test app, which has some unixy stuff in sources],
163 [ noping=yes
164 ])
165
166AM_CONDITIONAL(NOPING, test x$noping = xyes)
167
Andy Green43db0452013-01-10 19:50:35 +0800168#
169#
170#
171AC_ARG_ENABLE(debug,
172 [ --disable-debug Stops debug-related code from even being compiled in, useful for best speed],
173 [ disable_debug=yes
174 ])
175
176if test "x$disable_debug" != "xyes" ; then
177CFLAGS="$CFLAGS -D_DEBUG"
178fi
179AM_CONDITIONAL(DISABLE_DEBUG, test x$disable_debug = xyes)
Andy Greena6cbece2011-01-27 20:06:03 +0000180
Andy Green3c974692010-11-08 17:04:09 +0000181
Davidc4ef7b12013-01-12 20:39:47 +0800182#
183#
184#
185AC_ARG_ENABLE(builtin-getifaddrs,
186 [ --enable-builtin-getifaddrs Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it],
187 [ builtin_getifaddrs=yes
188 ])
Andy Green3c820192013-01-12 23:31:39 +0800189if test "x$builtin-getifaddrs" = "xyes" ; then
Davidc4ef7b12013-01-12 20:39:47 +0800190CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS"
191fi
192AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes)
193
Andy Green23c5f2e2013-02-06 15:43:00 +0900194#
195#
196#
197AC_ARG_WITH(cyassl,
198 [ --with-cyassl Use CyaSSL instead of OpenSSL ],
199 [ use_cyassl=yes
200 ])
201
202if test "x$use_cyassl" = "xyes" ; then
203CFLAGS="$CFLAGS -DUSE_CYASSL -DLWS_OPENSSL_SUPPORT"
204fi
205AM_CONDITIONAL(USE_CYASSL, test x$use_cyassl = xyes)
Davidc4ef7b12013-01-12 20:39:47 +0800206
207
Andy Green3c974692010-11-08 17:04:09 +0000208# Checks for header files.
Artem Baguinski91531662011-12-14 22:14:03 +0100209AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h])
Andy Green3c974692010-11-08 17:04:09 +0000210
211# Checks for typedefs, structures, and compiler characteristics.
212AC_TYPE_SIZE_T
213
214# Checks for library functions.
Andy Greened11a022011-01-20 10:23:50 +0000215
Andy Green3c974692010-11-08 17:04:09 +0000216AC_FUNC_MALLOC
217AC_FUNC_REALLOC
218AC_CHECK_FUNCS([bzero memset socket strerror])
219
220AC_CONFIG_FILES([Makefile
221 lib/Makefile
222 test-server/Makefile])
223
Alon Levy3147b022012-10-19 11:21:54 +0200224AC_OUTPUT([
225libwebsockets.pc
226])