FreeBSD compatibility
[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(nofork,
38  [  --enable-nofork  Disables fork-related options],
39  [ nofork=yes
40  ])
41
42 if test "x$nofork" = "xyes" ; then
43 CFLAGS="$CFLAGS -DLWS_NO_FORK"
44 else
45 AC_FUNC_FORK
46 fi
47
48 #
49 #
50 #
51 AC_ARG_ENABLE(libcrypto,
52  [  --enable-libcrypto  Use libcrypto MD5 and SHA1 implementations],
53  [ libcrypto=yes
54  ])
55
56 if test "x$libcrypto" = "xyes" ; then
57 CFLAGS="$CFLAGS -DLWS_LIBCRYPTO"
58 LDFLAGS="$LDFLAGS -lcrypto"
59 fi
60 AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes)
61
62
63 #
64 #
65 AC_ARG_WITH(testapps,
66  [  --without-testapps  dont build the libwebsocket-test- apps],
67  [ no_testapps=yes
68  ])
69
70 AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes)
71
72
73 #
74 #
75 AC_ARG_WITH(client,
76  [  --without-client  dont build the client part of the library ],
77  [ no_client=yes
78  ])
79
80 if test "x$no_client" = "xyes" ; then                                             
81 CFLAGS="$CFLAGS -DLWS_NO_CLIENT"                                          
82 fi
83 AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes)
84
85
86 #
87 #
88 AC_ARG_WITH(server,
89  [  --without-server  dont build the client part of the library ],
90  [ no_server=yes
91  ])
92
93 if test "x$no_server" = "xyes" ; then                                             
94 CFLAGS="$CFLAGS -DLWS_NO_SERVER"                                          
95 fi
96 AM_CONDITIONAL(NO_SERVER, test x$no_server = xyes)
97
98
99 #
100 #
101 AC_ARG_WITH(extensions,
102  [  --without-extensions  dont build any stuff related to extensions ],
103  [ no_extensions=yes
104  ])
105
106 if test "x$no_extensions" = "xyes" ; then                                             
107 CFLAGS="$CFLAGS -DLWS_NO_EXTENSIONS"                                          
108 fi
109 AM_CONDITIONAL(NO_EXTENSIONS, test x$no_extensions = xyes)
110
111
112 #
113 #
114 AC_ARG_WITH(daemonize,
115  [  --without-daemonize  dont build the daemonization api ],
116  [ no_daemonize=yes
117  ])
118
119 if test "x$no_daemonize" = "xyes" ; then                                             
120 CFLAGS="$CFLAGS -DLWS_NO_DAEMONIZE"                                          
121 fi
122 AM_CONDITIONAL(NO_DAEMONIZE, test x$no_daemonize = xyes)
123
124 #                                                                               
125 #                                                                               
126 #                                                                               
127 AC_ARG_ENABLE(mingw,                                                          
128  [  --enable-mingw  Using mingw compilers, disables ping test build],            
129  [ mingw=yes
130    noping=yes
131  ])                                                                             
132                                                                                 
133 if test "x$mingw" = "xyes" ; then                                             
134 CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT"                                          
135 fi
136 AM_CONDITIONAL(MINGW, test x$mingw = xyes)
137
138 #
139 #
140 #
141 AC_ARG_WITH([client-cert-dir],
142 [AS_HELP_STRING([--with-client-cert-dir],[directory containing client certs, defaults to /etc/pki/tls/certs/])],
143 [clientcertdir=$withval],
144 [clientcertdir=/etc/pki/tls/certs/]
145 )
146 AC_SUBST([clientcertdir])
147
148 AC_SUBST([CFLAGS])
149
150
151 #
152 #
153 #
154 AC_ARG_ENABLE(noping,
155  [  --enable-noping  Do not build ping test app, which has some unixy stuff in sources],
156  [ noping=yes
157  ])
158
159 AM_CONDITIONAL(NOPING, test x$noping = xyes)
160
161 #
162 #
163 #
164 AC_ARG_ENABLE(debug,
165  [  --disable-debug  Stops debug-related code from even being compiled in, useful for best speed],
166  [ disable_debug=yes
167  ])
168
169 if test "x$disable_debug" != "xyes" ; then
170 CFLAGS="$CFLAGS -D_DEBUG"
171 fi
172 AM_CONDITIONAL(DISABLE_DEBUG, test x$disable_debug = xyes)
173
174
175 #
176 #
177 #
178 AC_ARG_ENABLE(builtin-getifaddrs,
179  [  --enable-builtin-getifaddrs  Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it],
180  [ builtin_getifaddrs=yes
181  ])
182 if test "x$builtin-getifaddrs" = "xyes" ; then
183 CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS"
184 fi
185 AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes)
186
187
188
189 # Checks for header files.
190 AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h])
191
192 # Checks for typedefs, structures, and compiler characteristics.
193 AC_TYPE_SIZE_T
194
195 # Checks for library functions.
196
197 AC_FUNC_MALLOC
198 AC_FUNC_REALLOC
199 AC_CHECK_FUNCS([bzero memset socket strerror])
200
201 AC_CONFIG_FILES([Makefile
202                  lib/Makefile
203                  test-server/Makefile])
204
205 AC_OUTPUT([
206 libwebsockets.pc
207 ])