Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
Artem Baguinski | c451a4f | 2013-01-09 15:16:52 +0800 | [diff] [blame] | 4 | AC_PREREQ([2.61]) |
Andy Green | 4825881 | 2013-02-12 10:36:39 +0800 | [diff] [blame] | 5 | AC_INIT(libwebsockets, 1.2, andy@warmcat.com, libwebsockets, http://libwebsockets.org) |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 6 | AC_CONFIG_SRCDIR([test-server/test-server.c]) |
| 7 | AC_CONFIG_HEADERS([config.h]) |
| 8 | |
Andy Green | a3957ef | 2013-02-11 09:31:43 +0800 | [diff] [blame] | 9 | : ${CFLAGS=""} |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 10 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
Andy Green | a63c24b | 2013-01-10 12:36:59 +0800 | [diff] [blame] | 11 | AM_PROG_AR |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 12 | LT_INIT(shared) |
| 13 | |
Andy Green | b45993c | 2010-12-18 15:13:50 +0000 | [diff] [blame] | 14 | #AX_PTHREAD |
| 15 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 16 | # Checks for programs. |
Andy Green | 94c62c6 | 2012-10-06 15:17:01 +0800 | [diff] [blame] | 17 | AM_PROG_CC_C_O |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 18 | AC_PROG_INSTALL |
| 19 | AC_PROG_MAKE_SET |
| 20 | AC_CONFIG_MACRO_DIR([m4]) |
Andy Green | 90c7cbc | 2011-01-27 06:26:52 +0000 | [diff] [blame] | 21 | |
Andy Green | 7b40545 | 2013-02-01 10:50:15 +0800 | [diff] [blame] | 22 | applyhash='CFLAGS+= -DLWS_LIBRARY_VERSION=\"$(PACKAGE_VERSION)\" -DLWS_BUILD_HASH=\"${shell git log -n 1 --pretty=%h}\"' |
| 23 | AC_SUBST([applyhash]) |
| 24 | AM_SUBST_NOTMAKE([applyhash]) |
| 25 | |
Joakim Soderberg | 4f4a38b | 2013-02-06 15:28:07 +0900 | [diff] [blame] | 26 | # Check for existance of the inline keyword. |
| 27 | AC_C_INLINE |
| 28 | |
Andy Green | 7619c47 | 2011-01-23 17:47:08 +0000 | [diff] [blame] | 29 | # |
| 30 | # |
| 31 | # |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 32 | AC_ARG_ENABLE(openssl, |
| 33 | [ --enable-openssl Enables https support and needs openssl libs], |
| 34 | [ openssl=yes |
| 35 | ]) |
| 36 | |
| 37 | if test "x$openssl" = "xyes" ; then |
| 38 | AC_CHECK_LIB([ssl], [SSL_library_init]) |
| 39 | CFLAGS="$CFLAGS -DLWS_OPENSSL_SUPPORT" |
| 40 | fi |
| 41 | |
Andy Green | 7619c47 | 2011-01-23 17:47:08 +0000 | [diff] [blame] | 42 | # |
| 43 | # |
| 44 | # |
Andy Green | 7619c47 | 2011-01-23 17:47:08 +0000 | [diff] [blame] | 45 | AC_ARG_ENABLE(libcrypto, |
Andy Green | 90c7cbc | 2011-01-27 06:26:52 +0000 | [diff] [blame] | 46 | [ --enable-libcrypto Use libcrypto MD5 and SHA1 implementations], |
Andy Green | 7619c47 | 2011-01-23 17:47:08 +0000 | [diff] [blame] | 47 | [ libcrypto=yes |
| 48 | ]) |
| 49 | |
| 50 | if test "x$libcrypto" = "xyes" ; then |
| 51 | CFLAGS="$CFLAGS -DLWS_LIBCRYPTO" |
| 52 | LDFLAGS="$LDFLAGS -lcrypto" |
| 53 | fi |
| 54 | AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes) |
| 55 | |
Andy Green | 29da6d9 | 2013-01-15 19:57:06 +0800 | [diff] [blame] | 56 | # |
| 57 | # |
| 58 | # |
| 59 | AC_ARG_WITH(testapps, |
| 60 | [ --without-testapps dont build the libwebsocket-test- apps], |
| 61 | [ no_testapps=yes |
| 62 | ]) |
| 63 | |
| 64 | AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes) |
| 65 | |
Andy Green | 03674a6 | 2013-01-16 11:47:40 +0800 | [diff] [blame] | 66 | # |
| 67 | # |
| 68 | # |
| 69 | AC_ARG_WITH(client, |
| 70 | [ --without-client dont build the client part of the library ], |
| 71 | [ no_client=yes |
| 72 | ]) |
| 73 | |
| 74 | if test "x$no_client" = "xyes" ; then |
| 75 | CFLAGS="$CFLAGS -DLWS_NO_CLIENT" |
| 76 | fi |
| 77 | AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes) |
Andy Green | 29da6d9 | 2013-01-15 19:57:06 +0800 | [diff] [blame] | 78 | |
Andy Green | 279a303 | 2013-01-17 10:05:39 +0800 | [diff] [blame] | 79 | # |
| 80 | # |
| 81 | # |
Andy Green | a1ce6be | 2013-01-18 11:43:21 +0800 | [diff] [blame] | 82 | AC_ARG_WITH(server, |
| 83 | [ --without-server dont build the client part of the library ], |
| 84 | [ no_server=yes |
| 85 | ]) |
| 86 | |
| 87 | if test "x$no_server" = "xyes" ; then |
| 88 | CFLAGS="$CFLAGS -DLWS_NO_SERVER" |
| 89 | fi |
| 90 | AM_CONDITIONAL(NO_SERVER, test x$no_server = xyes) |
| 91 | |
Andy Green | 3182ece | 2013-01-20 17:08:31 +0800 | [diff] [blame] | 92 | # |
| 93 | # |
| 94 | # |
| 95 | AC_ARG_WITH(extensions, |
| 96 | [ --without-extensions dont build any stuff related to extensions ], |
| 97 | [ no_extensions=yes |
| 98 | ]) |
Andy Green | a1ce6be | 2013-01-18 11:43:21 +0800 | [diff] [blame] | 99 | |
Andy Green | 3182ece | 2013-01-20 17:08:31 +0800 | [diff] [blame] | 100 | if test "x$no_extensions" = "xyes" ; then |
| 101 | CFLAGS="$CFLAGS -DLWS_NO_EXTENSIONS" |
| 102 | fi |
| 103 | AM_CONDITIONAL(NO_EXTENSIONS, test x$no_extensions = xyes) |
Andy Green | a1ce6be | 2013-01-18 11:43:21 +0800 | [diff] [blame] | 104 | |
| 105 | # |
| 106 | # |
| 107 | # |
Andy Green | d636e35 | 2013-01-29 12:36:17 +0800 | [diff] [blame] | 108 | AC_ARG_WITH(latency, |
| 109 | [ --with-latency Build latency measuring code into the library ], |
| 110 | [ latency=yes |
| 111 | ]) |
| 112 | |
| 113 | if test "x$latency" = "xyes" ; then |
| 114 | CFLAGS="$CFLAGS -DLWS_LATENCY" |
| 115 | fi |
| 116 | AM_CONDITIONAL(LATENCY, test x$latency = xyes) |
| 117 | |
| 118 | # |
| 119 | # |
| 120 | # |
Andy Green | 279a303 | 2013-01-17 10:05:39 +0800 | [diff] [blame] | 121 | AC_ARG_WITH(daemonize, |
| 122 | [ --without-daemonize dont build the daemonization api ], |
| 123 | [ no_daemonize=yes |
| 124 | ]) |
| 125 | |
Andy Green | fd6764a | 2013-01-19 11:11:42 +0800 | [diff] [blame] | 126 | if test "x$no_daemonize" = "xyes" ; then |
| 127 | CFLAGS="$CFLAGS -DLWS_NO_DAEMONIZE" |
| 128 | fi |
Andy Green | 279a303 | 2013-01-17 10:05:39 +0800 | [diff] [blame] | 129 | AM_CONDITIONAL(NO_DAEMONIZE, test x$no_daemonize = xyes) |
| 130 | |
Andy Green | 0dbef49 | 2012-04-12 10:11:29 +0800 | [diff] [blame] | 131 | # |
| 132 | # |
Andy Green | 4a673a3 | 2013-01-17 19:53:16 +0800 | [diff] [blame] | 133 | # |
Andy Green | 0dbef49 | 2012-04-12 10:11:29 +0800 | [diff] [blame] | 134 | AC_ARG_ENABLE(mingw, |
| 135 | [ --enable-mingw Using mingw compilers, disables ping test build], |
| 136 | [ mingw=yes |
| 137 | noping=yes |
| 138 | ]) |
| 139 | |
| 140 | if test "x$mingw" = "xyes" ; then |
| 141 | CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT" |
| 142 | fi |
| 143 | AM_CONDITIONAL(MINGW, test x$mingw = xyes) |
Andy Green | a41314f | 2011-05-23 10:00:03 +0100 | [diff] [blame] | 144 | |
| 145 | # |
| 146 | # |
| 147 | # |
Andy Green | 90c7cbc | 2011-01-27 06:26:52 +0000 | [diff] [blame] | 148 | AC_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 | ) |
| 153 | AC_SUBST([clientcertdir]) |
| 154 | |
| 155 | AC_SUBST([CFLAGS]) |
| 156 | |
| 157 | |
Andy Green | a6cbece | 2011-01-27 20:06:03 +0000 | [diff] [blame] | 158 | # |
| 159 | # |
| 160 | # |
| 161 | AC_ARG_ENABLE(noping, |
| 162 | [ --enable-noping Do not build ping test app, which has some unixy stuff in sources], |
| 163 | [ noping=yes |
| 164 | ]) |
| 165 | |
| 166 | AM_CONDITIONAL(NOPING, test x$noping = xyes) |
| 167 | |
Andy Green | 43db045 | 2013-01-10 19:50:35 +0800 | [diff] [blame] | 168 | # |
| 169 | # |
| 170 | # |
| 171 | AC_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 | |
| 176 | if test "x$disable_debug" != "xyes" ; then |
| 177 | CFLAGS="$CFLAGS -D_DEBUG" |
| 178 | fi |
| 179 | AM_CONDITIONAL(DISABLE_DEBUG, test x$disable_debug = xyes) |
Andy Green | a6cbece | 2011-01-27 20:06:03 +0000 | [diff] [blame] | 180 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 181 | |
David | c4ef7b1 | 2013-01-12 20:39:47 +0800 | [diff] [blame] | 182 | # |
| 183 | # |
| 184 | # |
| 185 | AC_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 Green | 3c82019 | 2013-01-12 23:31:39 +0800 | [diff] [blame] | 189 | if test "x$builtin-getifaddrs" = "xyes" ; then |
David | c4ef7b1 | 2013-01-12 20:39:47 +0800 | [diff] [blame] | 190 | CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS" |
| 191 | fi |
| 192 | AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes) |
| 193 | |
Andy Green | 23c5f2e | 2013-02-06 15:43:00 +0900 | [diff] [blame] | 194 | # |
| 195 | # |
| 196 | # |
| 197 | AC_ARG_WITH(cyassl, |
| 198 | [ --with-cyassl Use CyaSSL instead of OpenSSL ], |
| 199 | [ use_cyassl=yes |
| 200 | ]) |
| 201 | |
| 202 | if test "x$use_cyassl" = "xyes" ; then |
| 203 | CFLAGS="$CFLAGS -DUSE_CYASSL -DLWS_OPENSSL_SUPPORT" |
| 204 | fi |
| 205 | AM_CONDITIONAL(USE_CYASSL, test x$use_cyassl = xyes) |
David | c4ef7b1 | 2013-01-12 20:39:47 +0800 | [diff] [blame] | 206 | |
| 207 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 208 | # Checks for header files. |
Artem Baguinski | 9153166 | 2011-12-14 22:14:03 +0100 | [diff] [blame] | 209 | AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h]) |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 210 | |
| 211 | # Checks for typedefs, structures, and compiler characteristics. |
| 212 | AC_TYPE_SIZE_T |
| 213 | |
| 214 | # Checks for library functions. |
Andy Green | ed11a02 | 2011-01-20 10:23:50 +0000 | [diff] [blame] | 215 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame] | 216 | AC_FUNC_MALLOC |
| 217 | AC_FUNC_REALLOC |
| 218 | AC_CHECK_FUNCS([bzero memset socket strerror]) |
| 219 | |
| 220 | AC_CONFIG_FILES([Makefile |
| 221 | lib/Makefile |
| 222 | test-server/Makefile]) |
| 223 | |
Alon Levy | 3147b02 | 2012-10-19 11:21:54 +0200 | [diff] [blame] | 224 | AC_OUTPUT([ |
| 225 | libwebsockets.pc |
| 226 | ]) |