tizen 2.4 release
[external/nghttp2.git] / configure.ac
1 dnl nghttp2 - HTTP/2 C Library
2
3 dnl Copyright (c) 2012, 2013, 2014, 2015 Tatsuhiro Tsujikawa
4
5 dnl Permission is hereby granted, free of charge, to any person obtaining
6 dnl a copy of this software and associated documentation files (the
7 dnl "Software"), to deal in the Software without restriction, including
8 dnl without limitation the rights to use, copy, modify, merge, publish,
9 dnl distribute, sublicense, and/or sell copies of the Software, and to
10 dnl permit persons to whom the Software is furnished to do so, subject to
11 dnl the following conditions:
12
13 dnl The above copyright notice and this permission notice shall be
14 dnl included in all copies or substantial portions of the Software.
15
16 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 dnl Do not change user variables!
25 dnl http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
26
27 AC_PREREQ(2.61)
28 AC_INIT([nghttp2], [0.7.4-DEV], [t-tujikawa@users.sourceforge.net])
29 LT_PREREQ([2.2.6])
30 LT_INIT()
31 dnl See versioning rule:
32 dnl  http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
33 AC_SUBST(LT_CURRENT, 9)
34 AC_SUBST(LT_REVISION, 0)
35 AC_SUBST(LT_AGE, 4)
36
37 major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
38 minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"`
39 patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
40
41 PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"`
42
43 AC_SUBST(PACKAGE_VERSION_NUM)
44
45 AC_CANONICAL_BUILD
46 AC_CANONICAL_HOST
47 AC_CANONICAL_TARGET
48
49 AC_CONFIG_MACRO_DIR([m4])
50
51 AM_INIT_AUTOMAKE([subdir-objects])
52 # comment out for now since this requires automake 1.13 or higher and
53 # travis has older one.
54 # AM_EXTRA_RECURSIVE_TARGETS([it])
55
56 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
57
58 AC_CONFIG_HEADERS([config.h])
59
60 dnl Checks for command-line options
61 AC_ARG_ENABLE([werror],
62     [AS_HELP_STRING([--enable-werror],
63                     [Turn on compile time warnings])],
64     [werror=$enableval], [werror=no])
65
66 AC_ARG_ENABLE([debug],
67     [AS_HELP_STRING([--enable-debug],
68                     [Turn on debug output])],
69     [debug=$enableval], [debug=no])
70
71 AC_ARG_ENABLE([threads],
72     [AS_HELP_STRING([--disable-threads],
73                     [Turn off threading in apps])],
74     [threads=$enableval], [threads=yes])
75
76 AC_ARG_ENABLE([app],
77     [AS_HELP_STRING([--enable-app],
78                     [Build applications (nghttp, nghttpd and nghttpx) [default=check]])],
79     [request_app=$enableval], [request_app=check])
80
81 AC_ARG_ENABLE([hpack-tools],
82     [AS_HELP_STRING([--enable-hpack-tools],
83                     [Build HPACK tools [default=check]])],
84     [request_hpack_tools=$enableval], [request_hpack_tools=check])
85
86 AC_ARG_ENABLE([asio-lib],
87     [AS_HELP_STRING([--enable-asio-lib],
88                     [Build C++ libnghttp2_asio library [default=no]])],
89     [request_asio_lib=$enableval], [request_asio_lib=no])
90
91 AC_ARG_ENABLE([examples],
92     [AS_HELP_STRING([--enable-examples],
93                     [Build examples [default=check]])],
94     [request_examples=$enableval], [request_examples=check])
95
96 AC_ARG_ENABLE([python-bindings],
97     [AS_HELP_STRING([--enable-python-bindings],
98                     [Build Python bindings [default=check]])],
99     [request_python_bindings=$enableval], [request_python_bindings=check])
100
101 AC_ARG_ENABLE([failmalloc],
102     [AS_HELP_STRING([--disable-failmalloc],
103                     [Do not build failmalloc test program])],
104     [request_failmalloc=$enableval], [request_failmalloc=yes])
105
106 AC_ARG_WITH([libxml2],
107     [AS_HELP_STRING([--with-libxml2],
108                     [Use libxml2 [default=check]])],
109     [request_libxml2=$withval], [request_libxml2=check])
110
111 AC_ARG_WITH([jemalloc],
112     [AS_HELP_STRING([--with-jemalloc],
113                     [Use jemalloc [default=check]])],
114     [request_jemalloc=$withval], [request_jemalloc=check])
115
116 AC_ARG_WITH([spdylay],
117     [AS_HELP_STRING([--with-spdylay],
118                     [Use spdylay [default=check]])],
119     [request_spdylay=$withval], [request_spdylay=check])
120
121 AC_ARG_WITH([cython],
122     [AS_HELP_STRING([--with-cython=PATH],
123                     [Use cython in given PATH])],
124     [cython_path=$withval], [])
125
126 dnl Define variables
127 AC_ARG_VAR([CYTHON], [the Cython executable])
128
129 dnl Checks for programs
130 AC_PROG_CC
131 AC_PROG_CXX
132 AC_PROG_INSTALL
133 AC_PROG_LN_S
134 AC_PROG_MAKE_SET
135 AM_PROG_CC_C_O
136 PKG_PROG_PKG_CONFIG([0.20])
137
138 if [test "x$request_python_bindings" != "xno"]; then
139   AM_PATH_PYTHON([2.7],, [:])
140   AX_PYTHON_DEVEL([>= '2.7'])
141 fi
142
143 if test "x${cython_path}" = "x"; then
144   AC_CHECK_PROGS([CYTHON], [cython.py cython])
145 else
146   CYTHON=${cython_path}
147   AC_SUBST([CYTHON])
148 fi
149
150 #
151 # If we're running GCC or clang define _U_ to be "__attribute__((unused))"
152 # so we can use _U_ to flag unused function parameters and not get warnings
153 # about them. Otherwise, define _U_ to be an empty string so that _U_ used
154 # to flag an unused function parameters will compile with other compilers.
155 #
156 # XXX - similar hints for other compilers?
157 #
158 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
159   AC_DEFINE([_U_], [__attribute__((unused))], [Hint to the compiler that a function parameters is not used])
160 else
161   AC_DEFINE([_U_], , [Hint to the compiler that a function parameters is not used])
162 fi
163
164 AX_CXX_COMPILE_STDCXX_11([noext], [optional])
165
166 AC_LANG_PUSH(C++)
167
168 # Check that std::chrono::steady_clock is available. In particular,
169 # gcc 4.6 does not have one, but has monotonic_clock which is the old
170 # name existed in the pre-standard draft. If steady_clock is not
171 # available, don't define HAVE_STEADY_CLOCK and replace steady_clock
172 # with monotonic_clock.
173 AC_MSG_CHECKING([whether std::chrono::steady_clock is available])
174 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
175 [[
176 #include <chrono>
177 ]],
178 [[
179 auto tp = std::chrono::steady_clock::now();
180 ]])],
181     [AC_DEFINE([HAVE_STEADY_CLOCK], [1],
182                [Define to 1 if you have the `std::chrono::steady_clock`.])
183      AC_MSG_RESULT([yes])],
184     [AC_MSG_RESULT([no])])
185
186 # Check that std::future is available.
187 AC_MSG_CHECKING([whether std::future is available])
188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
189 [[
190 #include <vector>
191 #include <future>
192 ]],
193 [[
194 std::vector<std::future<int>> v;
195 ]])],
196     [AC_DEFINE([HAVE_STD_FUTURE], [1],
197                [Define to 1 if you have the `std::future`.])
198      have_std_future=yes
199      AC_MSG_RESULT([yes])],
200     [have_std_future=no
201      AC_MSG_RESULT([no])])
202
203 # Check that thread_local is available.
204 AC_MSG_CHECKING([whether thread_local is available])
205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
206 [[
207 ]],
208 [[
209 thread_local int n;
210 ]])],
211     [AC_DEFINE([HAVE_THREAD_LOCAL], [1],
212                [Define to 1 if you have the `thread_local`.])
213      have_thread_local=yes
214      AC_MSG_RESULT([yes])],
215     [have_thread_local=no
216      AC_MSG_RESULT([no])])
217
218 # Check that std::map::emplace is available for g++-4.7.
219 AC_MSG_CHECKING([whether std::map::emplace is available])
220 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
221 [[
222 #include <map>
223 ]],
224 [[
225 std::map<int, int>().emplace(1, 2);
226 ]])],
227     [AC_DEFINE([HAVE_STD_MAP_EMPLACE], [1],
228                [Define to 1 if you have the `std::map::emplace`.])
229      have_std_map_emplace=yes
230      AC_MSG_RESULT([yes])],
231     [have_std_map_emplace=no
232      AC_MSG_RESULT([no])])
233
234 AC_LANG_POP()
235
236 # Checks for libraries.
237
238 # Additional libraries required for tests.
239 TESTLDADD=
240
241 # Additional libraries required for programs under src directory.
242 APPLDFLAGS=
243
244 LIBS_OLD=$LIBS
245 # Search for dlsym function, which is used in tests. Linux needs -ldl,
246 # but netbsd does not need it.
247 AC_SEARCH_LIBS([dlsym], [dl])
248 TESTLDADD="$LIBS $TESTLDADD"
249 LIBS=$LIBS_OLD
250
251 LIBS_OLD=$LIBS
252 AC_SEARCH_LIBS([clock_gettime], [rt],
253                [AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
254                           [Define to 1 if you have the `clock_gettime`.])])
255 APPLDFLAGS="$LIBS $APPLDFLAGS"
256 LIBS=$LIBS_OLD
257
258 case "$host" in
259   *android*)
260     android_build=yes
261     # android does not need -pthread, but needs followng 3 libs for C++
262     APPLDFLAGS="$APPLDFLAGS -lstdc++ -latomic -lsupc++"
263     ;;
264   *)
265     PTHREAD_LDFLAGS="-pthread"
266     APPLDFLAGS="$APPLDFLAGS $PTHREAD_LDFLAGS"
267     ;;
268 esac
269
270 # zlib
271 if test "x$android_build" = "xyes"; then
272   # Use zlib provided by NDK
273   APPLDFLAGS="-lz $APPLDFLAGS"
274   have_zlib=yes
275 else
276   PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
277
278   if test "x${have_zlib}" = "xno"; then
279     AC_MSG_NOTICE($ZLIB_PKG_ERRORS)
280   fi
281 fi
282
283 # cunit
284 PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no])
285 # If pkg-config does not find cunit, check it using AC_CHECK_LIB.  We
286 # do this because Debian (Ubuntu) lacks pkg-config file for cunit.
287 if test "x${have_cunit}" = "xno"; then
288   AC_MSG_WARN([${CUNIT_PKG_ERRORS}])
289   AC_CHECK_LIB([cunit], [CU_initialize_registry],
290                [have_cunit=yes], [have_cunit=no])
291   if test "x${have_cunit}" = "xyes"; then
292     CUNIT_LIBS="-lcunit"
293     CUNIT_CFLAGS=""
294     AC_SUBST([CUNIT_LIBS])
295     AC_SUBST([CUNIT_CFLAGS])
296   fi
297 fi
298 if test "x${have_cunit}" = "xyes"; then
299   # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test
300   # program can be built without -lncurses, but it emits runtime
301   # error.
302   case "${build}" in
303     *-apple-darwin*)
304       CUNIT_LIBS="$CUNIT_LIBS -lncurses"
305       AC_SUBST([CUNIT_LIBS])
306       ;;
307   esac
308 fi
309
310 AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
311
312 # libev (for src)
313 # libev does not have pkg-config file.  Check it in an old way.
314 LIBS_OLD=$LIBS
315 # android requires -lm for floor
316 AC_CHECK_LIB([ev], [ev_time], [have_libev=yes], [have_libev=no], [-lm])
317 if test "x${have_libev}" = "xyes"; then
318   AC_CHECK_HEADER([ev.h], [have_libev=yes], [have_libev=no])
319   if test "x${have_libev}" = "xyes"; then
320     LIBEV_LIBS=-lev
321     LIBEV_CFLAGS=
322     AC_SUBST([LIBEV_LIBS])
323     AC_SUBST([LIBEV_CFLAGS])
324   fi
325 fi
326 LIBS=$LIBS_OLD
327
328 # openssl (for src)
329 PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1],
330                   [have_openssl=yes], [have_openssl=no])
331 if test "x${have_openssl}" = "xno"; then
332   AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
333 fi
334
335 # libevent_openssl (for examples)
336 # 2.0.8 is required because we use evconnlistener_set_error_cb()
337 PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8],
338                   [have_libevent_openssl=yes], [have_libevent_openssl=no])
339 if test "x${have_libevent_openssl}" = "xno"; then
340   AC_MSG_NOTICE($LIBEVENT_OPENSSL_PKG_ERRORS)
341 fi
342
343 # jansson (for src/nghttp, src/deflatehd and src/inflatehd)
344 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.5],
345                   [have_jansson=yes], [have_jansson=no])
346 if test "x${have_jansson}" == "xyes"; then
347   AC_DEFINE([HAVE_JANSSON], [1],
348             [Define to 1 if you have `libjansson` library.])
349 else
350   AC_MSG_NOTICE($JANSSON_PKG_ERRORS)
351 fi
352
353 # libxml2 (for src/nghttp)
354 have_libxml2=no
355 if test "x${request_libxml2}" != "xno"; then
356   AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no])
357   if test "x${have_libxml2}" = "xyes"; then
358     AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
359   fi
360 fi
361
362 if test "x${request_libxml2}" = "xyes" &&
363    test "x${have_libxml2}" != "xyes"; then
364   AC_MSG_ERROR([libxml2 was requested (--with-libxml2) but not found])
365 fi
366
367 AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
368
369 # jemalloc
370 have_jemalloc=no
371 if test "x${request_jemalloc}" != "xno"; then
372   LIBS_OLD=$LIBS
373   AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes], [],
374                  [$PTHREAD_LDFLAGS])
375   LIBS=$LIBS_OLD
376   if test "x${have_jemalloc}" = "xyes" &&
377      test "x${ac_cv_search_malloc_stats_print}" != "xnone required"; then
378     JEMALLOC_LIBS=${ac_cv_search_malloc_stats_print}
379     AC_SUBST([JEMALLOC_LIBS])
380   fi
381 fi
382
383 if test "x${request_jemalloc}" = "xyes" &&
384    test "x${have_jemalloc}" != "xyes"; then
385   AC_MSG_ERROR([jemalloc was requested (--with-jemalloc) but not found])
386 fi
387
388 # spdylay (for src/nghttpx and src/h2load)
389 have_spdylay=no
390 if test "x${request_spdylay}" != "xno"; then
391   PKG_CHECK_MODULES([LIBSPDYLAY], [libspdylay >= 1.3.0],
392                     [have_spdylay=yes], [have_spdylay=no])
393   if test "x${have_spdylay}" = "xyes"; then
394     AC_DEFINE([HAVE_SPDYLAY], [1], [Define to 1 if you have `spdylay` library.])
395   else
396     AC_MSG_NOTICE($LIBSPDYLAY_PKG_ERRORS)
397     AC_MSG_NOTICE([The SPDY support in nghttpx and h2load will be disabled.])
398   fi
399 fi
400
401 if test "x${request_spdylay}" = "xyes" &&
402    test "x${have_spdylay}" != "xyes"; then
403   AC_MSG_ERROR([spdylay was requested (--with-spdylay) but not found])
404 fi
405
406 AM_CONDITIONAL([HAVE_SPDYLAY], [ test "x${have_spdylay}" = "xyes" ])
407
408 # Check Boost Asio library
409 have_asio_lib=no
410
411 if test "x${request_asio_lib}" = "xyes"; then
412   AX_BOOST_BASE([1.54.0], [have_boost_base=yes], [have_boost_base=no])
413
414   if test "x${have_boost_base}" = "xyes"; then
415     AX_BOOST_ASIO()
416     AX_BOOST_SYSTEM()
417     AX_BOOST_THREAD()
418
419     if test "x${ax_cv_boost_asio}" = "xyes" &&
420        test "x${ax_cv_boost_system}" = "xyes" &&
421        test "x${ax_cv_boost_thread}" = "xyes"; then
422       have_asio_lib=yes
423     fi
424   fi
425 fi
426
427 # The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL
428 # and libev
429 enable_app=no
430 if test "x${request_app}" != "xno" &&
431    test "x${have_zlib}" = "xyes" &&
432    test "x${have_openssl}" = "xyes" &&
433    test "x${have_libev}" = "xyes"; then
434   enable_app=yes
435 fi
436
437 if test "x${request_app}" = "xyes" &&
438    test "x${enable_app}" != "xyes"; then
439   AC_MSG_ERROR([applications were requested (--enable-app) but dependencies are not met.])
440 fi
441
442 AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ])
443
444 enable_hpack_tools=no
445 # HPACK tools requires jansson
446 if test "x${request_hpack_tools}" != "xno" &&
447    test "x${have_jansson}" = "xyes"; then
448   enable_hpack_tools=yes
449 fi
450
451 if test "x${request_hpack_tools}" = "xyes" &&
452    test "x${enable_hpack_tools}" != "xyes"; then
453   AC_MSG_ERROR([HPACK tools were requested (--enable-hpack-tools) but dependencies are not met.])
454 fi
455
456 AM_CONDITIONAL([ENABLE_HPACK_TOOLS], [ test "x${enable_hpack_tools}" = "xyes" ])
457
458 # C++ library libnghttp2_asio
459
460 enable_asio_lib=no
461 if test "x${request_asio_lib}" != "xno" &&
462    test "x${have_asio_lib}" = "xyes"; then
463   enable_asio_lib=yes
464 fi
465
466 AM_CONDITIONAL([ENABLE_ASIO_LIB], [ test "x${enable_asio_lib}" = "xyes" ])
467
468 # The example programs depend on OpenSSL and libevent_openssl
469 enable_examples=no
470 if test "x${request_examples}" != "xno" &&
471    test "x${have_openssl}" = "xyes" &&
472    test "x${have_libevent_openssl}" = "xyes"; then
473   enable_examples=yes
474 fi
475
476 if test "x${request_examples}" = "xyes" &&
477    test "x${enable_examples}" != "xyes"; then
478   AC_MSG_ERROR([examples were requested (--enable-examples) but dependencies are not met.])
479 fi
480
481 AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ])
482
483 # Python bindings
484 enable_python_bindings=no
485 if test "x${request_python_bindings}" != "xno" &&
486    test "x${CYTHON}" != "x" &&
487    test "x${PYTHON}" != "x:" &&
488    test "x${have_python_dev}" = "xyes"; then
489   enable_python_bindings=yes
490 fi
491
492 if test "x${request_python_bindings}" = "xyes" &&
493    test "x${enable_python_bindings}" != "xyes"; then
494   AC_MSG_ERROR([python bindings were requested (--enable-python-bindings) but dependencies are not met.])
495 fi
496
497 AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS],
498                [test "x${enable_python_bindings}" = "xyes"])
499
500 # Produce cython conditional, so that we can distribute generated C
501 # source
502 AM_CONDITIONAL([HAVE_CYTHON], [test "x${CYTHON}" != "x"])
503
504 # failmalloc tests
505 enable_failmalloc=no
506 if test "x${request_failmalloc}" = "xyes"; then
507   enable_failmalloc=yes
508 fi
509
510 AM_CONDITIONAL([ENABLE_FAILMALLOC], [ test "x${enable_failmalloc}" = "xyes" ])
511
512 # Checks for header files.
513 AC_HEADER_ASSERT
514 AC_CHECK_HEADERS([ \
515   arpa/inet.h \
516   netinet/in.h \
517   pwd.h \
518   stddef.h \
519   stdint.h \
520   stdlib.h \
521   string.h \
522   time.h \
523   unistd.h \
524 ])
525
526 case "${host}" in
527   *mingw*)
528     # For ntohl, ntohs in Windows
529     AC_CHECK_HEADERS([winsock2.h])
530     ;;
531 esac
532
533 # Checks for typedefs, structures, and compiler characteristics.
534 AC_TYPE_SIZE_T
535 AC_TYPE_SSIZE_T
536 AC_TYPE_UINT8_T
537 AC_TYPE_UINT16_T
538 AC_TYPE_UINT32_T
539 AC_TYPE_UINT64_T
540 AC_CHECK_TYPES([ptrdiff_t])
541 AC_C_BIGENDIAN
542 AC_SYS_LARGEFILE
543
544 AC_CHECK_MEMBER([struct tm.tm_gmtoff], [have_struct_tm_tm_gmtoff=yes],
545                 [have_struct_tm_tm_gmtoff=no], [[#include <time.h>]])
546
547 if test "x$have_struct_tm_tm_gmtoff" = "xyes"; then
548   AC_DEFINE([HAVE_STRUCT_TM_TM_GMTOFF], [1],
549             [Define to 1 if you have `struct tm.tm_gmtoff` member.])
550 fi
551
552 # Checks for library functions.
553 if test "x$cross_compiling" != "xyes"; then
554   AC_FUNC_MALLOC
555 fi
556 AC_CHECK_FUNCS([ \
557   _Exit \
558   accept4 \
559   getpwnam \
560   memmove \
561   memset \
562   timegm \
563 ])
564
565 # timerfd_create was added in linux kernel 2.6.25
566
567 AC_CHECK_FUNC([timerfd_create],
568               [have_timerfd_create=yes], [have_timerfd_create=no])
569
570
571 # Checks for epoll availability, primarily for examples/tiny-nghttpd
572 AX_HAVE_EPOLL([have_epoll=yes], [have_epoll=no])
573
574 AM_CONDITIONAL([ENABLE_TINY_NGHTTPD],
575                [ test "x${have_epoll}" = "xyes" &&
576                  test "x${have_timerfd_create}" = "xyes"])
577
578 dnl Windows library for winsock2
579 case "${host}" in
580   *mingw*)
581     LIBS="$LIBS -lws2_32"
582     ;;
583 esac
584
585 ac_save_CFLAGS=$CFLAGS
586 CFLAGS=
587
588 if test "x$werror" != "xno"; then
589     AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
590     AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
591     AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
592     AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"])
593     AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"])
594     AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CFLAGS="$CFLAGS -Wmissing-declarations"])
595     AX_CHECK_COMPILE_FLAG([-Wpointer-arith], [CFLAGS="$CFLAGS -Wpointer-arith"])
596     AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement], [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
597     AX_CHECK_COMPILE_FLAG([-Wformat-security], [CFLAGS="$CFLAGS -Wformat-security"])
598     AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"])
599     AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"])
600     AX_CHECK_COMPILE_FLAG([-Winline], [CFLAGS="$CFLAGS -Winline"])
601     AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"])
602     AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"])
603     AX_CHECK_COMPILE_FLAG([-Wundef], [CFLAGS="$CFLAGS -Wundef"])
604     AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"])
605     AX_CHECK_COMPILE_FLAG([-Wempty-body], [CFLAGS="$CFLAGS -Wempty-body"])
606     AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"])
607     AX_CHECK_COMPILE_FLAG([-Wclobbered], [CFLAGS="$CFLAGS -Wclobbered"])
608     AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"])
609     AX_CHECK_COMPILE_FLAG([-Wpragmas], [CFLAGS="$CFLAGS -Wpragmas"])
610     AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [CFLAGS="$CFLAGS -Wunreachable-code"])
611     AX_CHECK_COMPILE_FLAG([-Waddress], [CFLAGS="$CFLAGS -Waddress"])
612     AX_CHECK_COMPILE_FLAG([-Wattributes], [CFLAGS="$CFLAGS -Wattributes"])
613     AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"])
614     AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [CFLAGS="$CFLAGS -Wshorten-64-to-32"])
615
616     # Only work with Clang for the moment
617     AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
618 fi
619
620 WARNCFLAGS=$CFLAGS
621 CFLAGS=$ac_save_CFLAGS
622
623 AC_SUBST([WARNCFLAGS])
624
625 if test "x$debug" != "xno"; then
626     AC_DEFINE([DEBUGBUILD], [1], [Define to 1 to enable debug output.])
627 fi
628
629 enable_threads=yes
630 # Some platform does not have working std::future or thread_local.  We
631 # disable threading for those platforms.
632 if test "x$threads" != "xyes" ||
633    test "x$have_std_future" != "xyes" ||
634    test "x$have_thread_local" != "xyes"; then
635     enable_threads=no
636     AC_DEFINE([NOTHREADS], [1], [Define to 1 if you want to disable threads.])
637 fi
638
639 AC_SUBST([TESTLDADD])
640 AC_SUBST([APPLDFLAGS])
641
642 AC_CONFIG_FILES([
643   Makefile
644   lib/Makefile
645   lib/libnghttp2.pc
646   lib/includes/Makefile
647   lib/includes/nghttp2/nghttp2ver.h
648   tests/Makefile
649   tests/testdata/Makefile
650   third-party/Makefile
651   src/Makefile
652   src/includes/Makefile
653   src/libnghttp2_asio.pc
654   examples/Makefile
655   python/Makefile
656   python/setup.py
657   integration-tests/Makefile
658   integration-tests/config.go
659   integration-tests/setenv
660   doc/Makefile
661   doc/conf.py
662   doc/index.rst
663   doc/package_README.rst
664   doc/tutorial-client.rst
665   doc/tutorial-server.rst
666   doc/tutorial-hpack.rst
667   doc/nghttpx-howto.rst
668   doc/h2load-howto.rst
669   doc/libnghttp2_asio.rst
670   doc/python-apiref.rst
671   doc/building-android-binary.rst
672   doc/nghttp2.h.rst
673   doc/nghttp2ver.h.rst
674   doc/asio_http2.h.rst
675   doc/contribute.rst
676   contrib/Makefile
677 ])
678 AC_OUTPUT
679
680 AC_MSG_NOTICE([summary of build options:
681
682     Version:        ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
683     Host type:      ${host}
684     Install prefix: ${prefix}
685     C compiler:     ${CC}
686     CFLAGS:         ${CFLAGS}
687     WARNCFLAGS:     ${WARNCFLAGS}
688     LDFLAGS:        ${LDFLAGS}
689     LIBS:           ${LIBS}
690     CPPFLAGS:       ${CPPFLAGS}
691     C preprocessor: ${CPP}
692     C++ compiler:   ${CXX}
693     CXXFLAGS:       ${CXXFLAGS}
694     CXXCPP:         ${CXXCPP}
695     Library types:  Shared=${enable_shared}, Static=${enable_static}
696     Python:
697       Python:         ${PYTHON}
698       PYTHON_VERSION: ${PYTHON_VERSION}
699       pyexecdir:      ${pyexecdir}
700       Python-dev:     ${have_python_dev}
701       PYTHON_CPPFLAGS:${PYTHON_CPPFLAGS}
702       PYTHON_LDFLAGS: ${PYTHON_LDFLAGS}
703       Cython:         ${CYTHON}
704     Test:
705       CUnit:          ${have_cunit}
706       Failmalloc:     ${enable_failmalloc}
707     Libs:
708       OpenSSL:        ${have_openssl}
709       Libxml2:        ${have_libxml2}
710       Libev:          ${have_libev}
711       Libevent(SSL):  ${have_libevent_openssl}
712       Spdylay:        ${have_spdylay}
713       Jansson:        ${have_jansson}
714       Jemalloc:       ${have_jemalloc}
715       Boost CPPFLAGS: ${BOOST_CPPFLAGS}
716       Boost LDFLAGS:  ${BOOST_LDFLAGS}
717       Boost::ASIO:    ${BOOST_ASIO_LIB}
718       Boost::System:  ${BOOST_SYSTEM_LIB}
719       Boost::Thread:  ${BOOST_THREAD_LIB}
720     Features:
721       Applications:   ${enable_app}
722       HPACK tools:    ${enable_hpack_tools}
723       Libnghttp2_asio:${enable_asio_lib}
724       Examples:       ${enable_examples}
725       Python bindings:${enable_python_bindings}
726       Threading:      ${enable_threads}
727 ])