• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl nghttp2 - HTTP/2 C Library
2
3dnl Copyright (c) 2012, 2013, 2014, 2015 Tatsuhiro Tsujikawa
4
5dnl Permission is hereby granted, free of charge, to any person obtaining
6dnl a copy of this software and associated documentation files (the
7dnl "Software"), to deal in the Software without restriction, including
8dnl without limitation the rights to use, copy, modify, merge, publish,
9dnl distribute, sublicense, and/or sell copies of the Software, and to
10dnl permit persons to whom the Software is furnished to do so, subject to
11dnl the following conditions:
12
13dnl The above copyright notice and this permission notice shall be
14dnl included in all copies or substantial portions of the Software.
15
16dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24dnl Do not change user variables!
25dnl https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
26
27AC_PREREQ(2.61)
28AC_INIT([nghttp2], [1.62.1], [t-tujikawa@users.sourceforge.net])
29AC_CONFIG_AUX_DIR([.])
30AC_CONFIG_MACRO_DIR([m4])
31AC_CONFIG_HEADERS([config.h])
32AC_USE_SYSTEM_EXTENSIONS
33
34LT_PREREQ([2.2.6])
35LT_INIT()
36
37AC_CANONICAL_BUILD
38AC_CANONICAL_HOST
39AC_CANONICAL_TARGET
40
41AM_INIT_AUTOMAKE([subdir-objects tar-pax])
42
43m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
44
45dnl See versioning rule:
46dnl  https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
47AC_SUBST(LT_CURRENT, 42)
48AC_SUBST(LT_REVISION, 1)
49AC_SUBST(LT_AGE, 28)
50
51major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
52minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"`
53patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
54
55PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"`
56
57AC_SUBST(PACKAGE_VERSION_NUM)
58
59dnl Checks for command-line options
60AC_ARG_ENABLE([werror],
61    [AS_HELP_STRING([--enable-werror],
62                    [Turn on compile time warnings])],
63    [werror=$enableval], [werror=no])
64
65AC_ARG_ENABLE([debug],
66    [AS_HELP_STRING([--enable-debug],
67                    [Turn on debug output])],
68    [debug=$enableval], [debug=no])
69
70AC_ARG_ENABLE([threads],
71    [AS_HELP_STRING([--disable-threads],
72                    [Turn off threading in apps])],
73    [threads=$enableval], [threads=yes])
74
75AC_ARG_ENABLE([app],
76    [AS_HELP_STRING([--enable-app],
77                    [Build applications (nghttp, nghttpd, nghttpx and h2load) [default=check]])],
78    [request_app=$enableval], [request_app=check])
79
80AC_ARG_ENABLE([hpack-tools],
81    [AS_HELP_STRING([--enable-hpack-tools],
82                    [Build HPACK tools [default=check]])],
83    [request_hpack_tools=$enableval], [request_hpack_tools=check])
84
85AC_ARG_ENABLE([examples],
86    [AS_HELP_STRING([--enable-examples],
87                    [Build examples [default=check]])],
88    [request_examples=$enableval], [request_examples=check])
89
90AC_ARG_ENABLE([failmalloc],
91    [AS_HELP_STRING([--disable-failmalloc],
92                    [Do not build failmalloc test program])],
93    [request_failmalloc=$enableval], [request_failmalloc=yes])
94
95AC_ARG_ENABLE([lib-only],
96    [AS_HELP_STRING([--enable-lib-only],
97                    [Build libnghttp2 only.  This is a short hand for --disable-app --disable-examples --disable-hpack-tools])],
98    [request_lib_only=$enableval], [request_lib_only=no])
99
100AC_ARG_ENABLE([http3],
101    [AS_HELP_STRING([--enable-http3],
102                    [(EXPERIMENTAL) Enable HTTP/3.  This requires ngtcp2, nghttp3, and a custom OpenSSL.])],
103    [request_http3=$enableval], [request_http3=no])
104
105AC_ARG_WITH([libxml2],
106    [AS_HELP_STRING([--with-libxml2],
107                    [Use libxml2 [default=check]])],
108    [request_libxml2=$withval], [request_libxml2=check])
109
110AC_ARG_WITH([jansson],
111    [AS_HELP_STRING([--with-jansson],
112                    [Use jansson [default=check]])],
113    [request_jansson=$withval], [request_jansson=check])
114
115AC_ARG_WITH([zlib],
116    [AS_HELP_STRING([--with-zlib],
117                    [Use zlib [default=check]])],
118    [request_zlib=$withval], [request_zlib=check])
119
120AC_ARG_WITH([libevent-openssl],
121    [AS_HELP_STRING([--with-libevent-openssl],
122                    [Use libevent_openssl [default=check]])],
123    [request_libevent_openssl=$withval], [request_libevent_openssl=check])
124
125AC_ARG_WITH([libcares],
126    [AS_HELP_STRING([--with-libcares],
127                    [Use libc-ares [default=check]])],
128    [request_libcares=$withval], [request_libcares=check])
129
130AC_ARG_WITH([openssl],
131    [AS_HELP_STRING([--with-openssl],
132                    [Use openssl [default=check]])],
133    [request_openssl=$withval], [request_openssl=check])
134
135AC_ARG_WITH([libev],
136    [AS_HELP_STRING([--with-libev],
137                    [Use libev [default=check]])],
138    [request_libev=$withval], [request_libev=check])
139
140AC_ARG_WITH([jemalloc],
141    [AS_HELP_STRING([--with-jemalloc],
142                    [Use jemalloc [default=check]])],
143    [request_jemalloc=$withval], [request_jemalloc=check])
144
145AC_ARG_WITH([systemd],
146    [AS_HELP_STRING([--with-systemd],
147                    [Enable systemd support in nghttpx [default=check]])],
148    [request_systemd=$withval], [request_systemd=check])
149
150AC_ARG_WITH([mruby],
151    [AS_HELP_STRING([--with-mruby],
152                    [Use mruby [default=no]])],
153    [request_mruby=$withval], [request_mruby=no])
154
155AC_ARG_WITH([neverbleed],
156    [AS_HELP_STRING([--with-neverbleed],
157                    [Use neverbleed [default=no]])],
158    [request_neverbleed=$withval], [request_neverbleed=no])
159
160AC_ARG_WITH([libngtcp2],
161    [AS_HELP_STRING([--with-libngtcp2],
162                    [Use libngtcp2 [default=check]])],
163    [request_libngtcp2=$withval], [request_libngtcp2=check])
164
165AC_ARG_WITH([libnghttp3],
166    [AS_HELP_STRING([--with-libnghttp3],
167                    [Use libnghttp3 [default=check]])],
168    [request_libnghttp3=$withval], [request_libnghttp3=check])
169
170AC_ARG_WITH([libbpf],
171    [AS_HELP_STRING([--with-libbpf],
172                    [Use libbpf [default=no]])],
173    [request_libbpf=$withval], [request_libbpf=no])
174
175AC_ARG_WITH([libbrotlienc],
176    [AS_HELP_STRING([--with-libbrotlienc],
177                    [Use libbrotlienc [default=no]])],
178    [request_libbrotlienc=$withval], [request_libbrotlienc=no])
179
180AC_ARG_WITH([libbrotlidec],
181    [AS_HELP_STRING([--with-libbrotlidec],
182                    [Use libbrotlidec [default=no]])],
183    [request_libbrotlidec=$withval], [request_libbrotlidec=no])
184
185dnl Define variables
186AC_ARG_VAR([LIBEV_CFLAGS], [C compiler flags for libev, skipping any checks])
187AC_ARG_VAR([LIBEV_LIBS], [linker flags for libev, skipping any checks])
188
189AC_ARG_VAR([JEMALLOC_CFLAGS],
190           [C compiler flags for jemalloc, skipping any checks])
191AC_ARG_VAR([JEMALLOC_LIBS], [linker flags for jemalloc, skipping any checks])
192
193AC_ARG_VAR([LIBTOOL_LDFLAGS],
194           [libtool specific flags (e.g., -static-libtool-libs)])
195
196AC_ARG_VAR([BPFCFLAGS], [C compiler flags for bpf program])
197
198dnl Checks for programs
199AC_PROG_CC
200AC_PROG_CXX
201AC_PROG_CPP
202AC_PROG_INSTALL
203AC_PROG_LN_S
204AC_PROG_MAKE_SET
205AC_PROG_MKDIR_P
206
207PKG_PROG_PKG_CONFIG([0.20])
208
209AM_PATH_PYTHON([3.8],, [:])
210
211if [test "x$request_lib_only" = "xyes"]; then
212  request_app=no
213  request_hpack_tools=no
214  request_examples=no
215  request_http3=no
216  request_libxml2=no
217  request_jansson=no
218  request_zlib=no
219  request_libevent_openssl=no
220  request_libcares=no
221  request_openssl=no
222  request_libev=no
223  request_jemalloc=no
224  request_systemd=no
225  request_mruby=no
226  request_neverbleed=no
227  request_libngtcp2=no
228  request_libnghttp3=no
229  request_libbpf=no
230fi
231
232if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
233  AC_DEFINE([NGHTTP2_NORETURN], [__attribute__((noreturn))], [Hint to the compiler that a function never return])
234else
235  AC_DEFINE([NGHTTP2_NORETURN], , [Hint to the compiler that a function never return])
236fi
237
238save_CXXFLAGS="$CXXFLAGS"
239CXXFLAGS=
240
241AX_CXX_COMPILE_STDCXX([20], [], [optional])
242
243CXX1XCXXFLAGS="$CXXFLAGS"
244CXXFLAGS="$save_CXXFLAGS"
245AC_SUBST([CXX1XCXXFLAGS])
246
247AC_LANG_PUSH(C++)
248
249save_CXXFLAGS="$CXXFLAGS"
250CXXFLAGS="$CXXFLAGS $CXX1XCXXFLAGS"
251
252# Check that std::future is available.
253AC_MSG_CHECKING([whether std::future is available])
254AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
255[[
256#include <vector>
257#include <future>
258]],
259[[
260std::vector<std::future<int>> v;
261(void)v;
262]])],
263    [AC_DEFINE([HAVE_STD_FUTURE], [1],
264               [Define to 1 if you have the `std::future`.])
265     have_std_future=yes
266     AC_MSG_RESULT([yes])],
267    [have_std_future=no
268     AC_MSG_RESULT([no])])
269
270# Check that std::map::emplace is available for g++-4.7.
271AC_MSG_CHECKING([whether std::map::emplace is available])
272AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
273[[
274#include <map>
275]],
276[[
277std::map<int, int>().emplace(1, 2);
278]])],
279    [AC_DEFINE([HAVE_STD_MAP_EMPLACE], [1],
280               [Define to 1 if you have the `std::map::emplace`.])
281     have_std_map_emplace=yes
282     AC_MSG_RESULT([yes])],
283    [have_std_map_emplace=no
284     AC_MSG_RESULT([no])])
285
286# Check that std::atomic<std::shared_ptr<T>> is supported.
287AC_MSG_CHECKING([whether std::atomic<std::shared_ptr<T>> is supported])
288AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
289[[
290#include <memory>
291]],
292[[
293auto a = std::atomic<std::shared_ptr<int>>(std::make_shared<int>(1000000007));
294auto p = a.load();
295++*p;
296a.store(p);
297]])],
298    [AC_DEFINE([HAVE_ATOMIC_STD_SHARED_PTR], [1],
299               [Define to 1 if you have the std::atomic<std::shared_ptr<T>> is supported.])
300     have_atomic_std_shared_ptr=yes
301     AC_MSG_RESULT([yes])],
302    [have_atomic_std_shared_ptr=no
303     AC_MSG_RESULT([no])])
304
305# Check that thread_local storage specifier is available
306AC_MSG_CHECKING([whether thread_local storage class specifier is available.])
307AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
308,
309[[
310thread_local int a = 0;
311(void)a;
312]])],
313    [AC_DEFINE([HAVE_THREAD_LOCAL], [1],
314               [Define to 1 if you have thread_local storage specifier.])
315     have_thread_local=yes
316     AC_MSG_RESULT([yes])],
317    [have_Thread_local=no
318     AC_MSG_RESULT([no])])
319
320CXXFLAGS=$save_CXXFLAGS
321
322AC_LANG_POP()
323
324# Checks for libraries.
325
326# Additional libraries required for tests.
327TESTLDADD=
328
329# Additional libraries required for programs under src directory.
330APPLDFLAGS=
331
332case "$host_os" in
333  *android*)
334    android_build=yes
335    # android does not need -pthread, but needs following 2 libs for C++
336    APPLDFLAGS="$APPLDFLAGS -lstdc++ -latomic"
337    ;;
338  *)
339    PTHREAD_LDFLAGS="-pthread"
340    APPLDFLAGS="$APPLDFLAGS $PTHREAD_LDFLAGS"
341    ;;
342esac
343
344case "$host_os" in
345  *solaris*)
346    APPLDFLAGS="$APPLDFLAGS -lsocket -lnsl"
347    ;;
348esac
349
350case "${build}" in
351  *-apple-darwin*)
352    EXTRA_DEFS="-D__APPLE_USE_RFC_3542"
353    AC_SUBST([EXTRA_DEFS])
354    ;;
355esac
356
357# zlib
358have_zlib=no
359if test "x${request_zlib}" != "xno"; then
360  PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
361
362  if test "x${have_zlib}" = "xno"; then
363    AC_MSG_NOTICE($ZLIB_PKG_ERRORS)
364  fi
365fi
366
367if test "x${request_zlib}" = "xyes" &&
368   test "x${have_zlib}" != "xyes"; then
369  AC_MSG_ERROR([zlib was requested (--with-zlib) but not found])
370fi
371
372# dl: openssl requires libdl when it is statically linked.
373case "${host_os}" in
374  *bsd*)
375    # dlopen is in libc on *BSD
376    ;;
377  *)
378    save_LIBS=$LIBS
379    AC_SEARCH_LIBS([dlopen], [dl], [APPLDFLAGS="-ldl $APPLDFLAGS"], [], [])
380    LIBS=$save_LIBS
381    ;;
382esac
383
384# libev (for src)
385have_libev=no
386if test "x${request_libev}" != "xno"; then
387  if test "x${LIBEV_LIBS}" = "x" && test "x${LIBEV_CFLAGS}" = "x"; then
388    # libev does not have pkg-config file.  Check it in an old way.
389    save_LIBS=$LIBS
390    # android requires -lm for floor
391   AC_CHECK_LIB([ev], [ev_time], [have_libev=yes], [have_libev=no], [-lm])
392   if test "x${have_libev}" = "xyes"; then
393      AC_CHECK_HEADER([ev.h], [have_libev=yes], [have_libev=no])
394      if test "x${have_libev}" = "xyes"; then
395        LIBEV_LIBS=-lev
396        LIBEV_CFLAGS=
397      fi
398    fi
399    LIBS=$save_LIBS
400  else
401    have_libev=yes
402  fi
403
404  if test "x${have_libev}" = "xyes"; then
405    AC_DEFINE([HAVE_LIBEV], [1], [Define to 1 if you have `libev` library.])
406  fi
407fi
408
409if test "x${request_libev}" = "xyes" &&
410   test "x${have_libev}" != "xyes"; then
411  AC_MSG_ERROR([libev was requested (--with-libev) but not found])
412fi
413
414# openssl (for src)
415have_openssl=no
416if test "x${request_openssl}" != "xno"; then
417  PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1],
418                    [have_openssl=yes], [have_openssl=no])
419  if test "x${have_openssl}" = "xno"; then
420    AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
421  else
422    # Use C++ compiler because boringssl needs C++ runtime.
423    AC_LANG_PUSH(C++)
424
425    save_CXXFLAGS="$CXXFLAGS"
426    save_LIBS="$LIBS"
427    CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"
428    LIBS="$OPENSSL_LIBS $LIBS"
429
430    # quictls/openssl has SSL_provide_quic_data.  boringssl also has
431    # it.  We will deal with it later.
432    have_ssl_provide_quic_data=no
433    AC_MSG_CHECKING([for SSL_provide_quic_data])
434    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
435      #include <openssl/ssl.h>
436    ]], [[
437      SSL_provide_quic_data(NULL, (ssl_encryption_level_t)0, NULL, 0);
438    ]])],
439    [AC_MSG_RESULT([yes]); have_ssl_provide_quic_data=yes],
440    [AC_MSG_RESULT([no]); have_ssl_provide_quic_data=no])
441
442    # boringssl has SSL_set_quic_early_data_context.
443    AC_MSG_CHECKING([for SSL_set_quic_early_data_context])
444    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
445      #include <openssl/ssl.h>
446    ]], [[
447      SSL *ssl = NULL;
448      SSL_set_quic_early_data_context(ssl, NULL, 0);
449    ]])],
450    [AC_MSG_RESULT([yes]); have_boringssl_quic=yes],
451    [AC_MSG_RESULT([no]); have_boringssl_quic=no])
452
453    CXXFLAGS="$save_CXXFLAGS"
454    LIBS="$save_LIBS"
455
456    AC_LANG_POP()
457  fi
458fi
459
460if test "x${request_openssl}" = "xyes" &&
461   test "x${have_openssl}" != "xyes"; then
462  AC_MSG_ERROR([openssl was requested (--with-openssl) but not found])
463fi
464
465# c-ares (for src)
466have_libcares=no
467if test "x${request_libcares}" != "xno"; then
468  PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.16.0], [have_libcares=yes],
469                    [have_libcares=no])
470  if test "x${have_libcares}" = "xno"; then
471    AC_MSG_NOTICE($LIBCARES_PKG_ERRORS)
472  fi
473fi
474
475if test "x${request_libcares}" = "xyes" &&
476   test "x${have_libcares}" != "xyes"; then
477  AC_MSG_ERROR([libcares was requested (--with-libcares) but not found])
478fi
479
480# ngtcp2 (for src)
481have_libngtcp2=no
482if test "x${request_libngtcp2}" != "xno"; then
483  PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 1.4.0], [have_libngtcp2=yes],
484                    [have_libngtcp2=no])
485  if test "x${have_libngtcp2}" = "xno"; then
486    AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS)
487  fi
488fi
489
490if test "x${request_libngtcp2}" = "xyes" &&
491   test "x${have_libngtcp2}" != "xyes"; then
492  AC_MSG_ERROR([libngtcp2 was requested (--with-libngtcp2) but not found])
493fi
494
495# ngtcp2_crypto_quictls (for src)
496have_libngtcp2_crypto_quictls=no
497if test "x${have_ssl_provide_quic_data}" = "xyes" &&
498   test "x${have_boringssl_quic}" != "xyes" &&
499   test "x${request_libngtcp2}" != "xno"; then
500  PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_QUICTLS],
501                    [libngtcp2_crypto_quictls >= 1.0.0],
502                    [have_libngtcp2_crypto_quictls=yes],
503                    [have_libngtcp2_crypto_quictls=no])
504  if test "x${have_libngtcp2_crypto_quictls}" = "xno"; then
505    AC_MSG_NOTICE($LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS)
506  else
507    AC_DEFINE([HAVE_LIBNGTCP2_CRYPTO_QUICTLS], [1],
508              [Define to 1 if you have `libngtcp2_crypto_quictls` library.])
509  fi
510fi
511
512if test "x${have_ssl_provide_quic_data}" = "xyes" &&
513   test "x${have_boringssl_quic}" != "xyes" &&
514   test "x${request_libngtcp2}" = "xyes" &&
515   test "x${have_libngtcp2_crypto_quictls}" != "xyes"; then
516  AC_MSG_ERROR([libngtcp2_crypto_quictls was requested (--with-libngtcp2) but not found])
517fi
518
519# ngtcp2_crypto_boringssl (for src)
520have_libngtcp2_crypto_boringssl=no
521if test "x${have_boringssl_quic}" = "xyes" &&
522   test "x${request_libngtcp2}" != "xno"; then
523  PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_BORINGSSL],
524                    [libngtcp2_crypto_boringssl >= 0.0.0],
525                    [have_libngtcp2_crypto_boringssl=yes],
526                    [have_libngtcp2_crypto_boringssl=no])
527  if test "x${have_libngtcp2_crypto_boringssl}" = "xno"; then
528    AC_MSG_NOTICE($LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS)
529  else
530    AC_DEFINE([HAVE_LIBNGTCP2_CRYPTO_BORINGSSL], [1],
531              [Define to 1 if you have `libngtcp2_crypto_boringssl` library.])
532  fi
533fi
534
535if test "x${have_boringssl_quic}" = "xyes" &&
536   test "x${request_libngtcp2}" = "xyes" &&
537   test "x${have_libngtcp2_crypto_boringssl}" != "xyes"; then
538  AC_MSG_ERROR([libngtcp2_crypto_boringssl was requested (--with-libngtcp2) but not found])
539fi
540
541# nghttp3 (for src)
542have_libnghttp3=no
543if test "x${request_libnghttp3}" != "xno"; then
544  PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 1.1.0], [have_libnghttp3=yes],
545                    [have_libnghttp3=no])
546  if test "x${have_libnghttp3}" = "xno"; then
547    AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS)
548  fi
549fi
550
551if test "x${request_libnghttp3}" = "xyes" &&
552   test "x${have_libnghttp3}" != "xyes"; then
553  AC_MSG_ERROR([libnghttp3 was requested (--with-libnghttp3) but not found])
554fi
555
556# libbpf (for src)
557have_libbpf=no
558if test "x${request_libbpf}" != "xno"; then
559  PKG_CHECK_MODULES([LIBBPF], [libbpf >= 0.7.0], [have_libbpf=yes],
560                    [have_libbpf=no])
561  if test "x${have_libbpf}" = "xyes"; then
562    AC_DEFINE([HAVE_LIBBPF], [1], [Define to 1 if you have `libbpf` library.])
563    if test "x${BPFCFLAGS}" = "x"; then
564      BPFCFLAGS="-Wall -O2 -g"
565    fi
566    # Add the include path for Debian
567    EXTRABPFCFLAGS="-I/usr/include/$host_cpu-$host_os"
568    AC_SUBST([EXTRABPFCFLAGS])
569
570    AC_MSG_CHECKING([whether enum bpf_stats_type is defined in linux/bpf.h])
571    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
572    [[
573    #include <linux/bpf.h>
574    ]],
575    [[
576    enum bpf_stats_type foo;
577    (void)foo;
578    ]])],
579    [have_bpf_stats_type=yes],
580    [have_bpf_stats_type=no])
581
582    if test "x${have_bpf_stats_type}" = "xyes"; then
583      AC_MSG_RESULT([yes])
584      AC_DEFINE([HAVE_BPF_STATS_TYPE], [1],
585                [Define to 1 if you have enum bpf_stats_type in linux/bpf.h.])
586    else
587      AC_MSG_RESULT([no])
588    fi
589  else
590    AC_MSG_NOTICE($LIBBPF_PKG_ERRORS)
591  fi
592fi
593
594if test "x${request_libbpf}" = "xyes" &&
595   test "x${have_libbpf}" != "xyes"; then
596  AC_MSG_ERROR([libbpf was requested (--with-libbpf) but not found])
597fi
598
599AM_CONDITIONAL([HAVE_LIBBPF], [ test "x${have_libbpf}" = "xyes" ])
600
601# libbrotlienc (for src)
602have_libbrotlienc=no
603if test "x${request_libbrotlienc}" != "xno"; then
604  PKG_CHECK_MODULES([LIBBROTLIENC], [libbrotlienc >= 1.0.9],
605                    [have_libbrotlienc=yes],
606                    [have_libbrotlienc=no])
607  if test "x${have_libbrotlienc}" = "xno"; then
608    AC_MSG_NOTICE($LIBBROTLIENC_PKG_ERRORS)
609  fi
610fi
611
612if test "x${request_libbrotlienc}" = "xyes" &&
613   test "x${have_libbrotlienc}" != "xyes"; then
614  AC_MSG_ERROR([libbrotlienc was requested (--with-libbrotlienc) but not found])
615fi
616
617# libbrotlidec (for src)
618have_libbrotlidec=no
619if test "x${request_libbrotlidec}" != "xno"; then
620  PKG_CHECK_MODULES([LIBBROTLIDEC], [libbrotlidec >= 1.0.9],
621                    [have_libbrotlidec=yes],
622                    [have_libbrotlidec=no])
623  if test "x${have_libbrotlidec}" = "xno"; then
624    AC_MSG_NOTICE($LIBBROTLIDEC_PKG_ERRORS)
625  fi
626fi
627
628if test "x${request_libbrotlidec}" = "xyes" &&
629   test "x${have_libbrotlidec}" != "xyes"; then
630  AC_MSG_ERROR([libbrotlidec was requested (--with-libbrotlidec) but not found])
631fi
632
633have_libbrotli=no
634if test "x${have_libbrotlienc}" = "xyes" &&
635   test "x${have_libbrotlidec}" = "xyes"; then
636  have_libbrotli=yes
637
638  AC_DEFINE([HAVE_LIBBROTLI], [1],
639            [Define to 1 if you have `libbrotlienc` and `libbrotlidec` libraries.])
640fi
641
642# libevent_openssl (for examples)
643# 2.0.8 is required because we use evconnlistener_set_error_cb()
644have_libevent_openssl=no
645if test "x${request_libevent_openssl}" != "xno"; then
646  PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8],
647                    [have_libevent_openssl=yes], [have_libevent_openssl=no])
648  if test "x${have_libevent_openssl}" = "xno"; then
649    AC_MSG_NOTICE($LIBEVENT_OPENSSL_PKG_ERRORS)
650  fi
651fi
652
653if test "x${request_libevent_openssl}" = "xyes" &&
654   test "x${have_libevent_openssl}" != "xyes"; then
655  AC_MSG_ERROR([libevent_openssl was requested (--with-libevent) but not found])
656fi
657
658# jansson (for src/nghttp, src/deflatehd and src/inflatehd)
659have_jansson=no
660if test "x${request_jansson}" != "xno"; then
661  PKG_CHECK_MODULES([JANSSON], [jansson >= 2.5],
662                    [have_jansson=yes], [have_jansson=no])
663  if test "x${have_jansson}" = "xyes"; then
664    AC_DEFINE([HAVE_JANSSON], [1],
665              [Define to 1 if you have `libjansson` library.])
666  else
667    AC_MSG_NOTICE($JANSSON_PKG_ERRORS)
668  fi
669fi
670
671if test "x${request_jansson}" = "xyes" &&
672   test "x${have_jansson}" != "xyes"; then
673  AC_MSG_ERROR([jansson was requested (--with-jansson) but not found])
674fi
675
676#  libsystemd (for src/nghttpx)
677have_libsystemd=no
678if test "x${request_systemd}" != "xno"; then
679  PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209], [have_libsystemd=yes],
680                    [have_libsystemd=no])
681  if test "x${have_libsystemd}" = "xyes"; then
682    AC_DEFINE([HAVE_LIBSYSTEMD], [1],
683              [Define to 1 if you have `libsystemd` library.])
684  else
685    AC_MSG_NOTICE($SYSTEMD_PKG_ERRORS)
686  fi
687fi
688
689if test "x${request_systemd}" = "xyes" &&
690   test "x${have_libsystemd}" != "xyes"; then
691  AC_MSG_ERROR([systemd was requested (--with-systemd) but not found])
692fi
693
694# libxml2 (for src/nghttp)
695have_libxml2=no
696if test "x${request_libxml2}" != "xno"; then
697  PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.26],
698                    [have_libxml2=yes], [have_libxml2=no])
699  if test "x${have_libxml2}" = "xyes"; then
700    AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
701  else
702    AC_MSG_NOTICE($LIBXML2_PKG_ERRORS)
703  fi
704fi
705
706if test "x${request_libxml2}" = "xyes" &&
707   test "x${have_libxml2}" != "xyes"; then
708  AC_MSG_ERROR([libxml2 was requested (--with-libxml2) but not found])
709fi
710
711AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
712
713# jemalloc
714have_jemalloc=no
715if test "x${request_jemalloc}" != "xno"; then
716  if test "x${JEMALLOC_LIBS}" = "x" && test "x${JEMALLOC_CFLAGS}" = "x"; then
717    save_LIBS=$LIBS
718    AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes], [],
719                   [$PTHREAD_LDFLAGS])
720
721    if test "x${have_jemalloc}" = "xyes"; then
722      jemalloc_libs=${ac_cv_search_malloc_stats_print}
723    else
724      # On Darwin, malloc_stats_print is je_malloc_stats_print
725      AC_SEARCH_LIBS([je_malloc_stats_print], [jemalloc], [have_jemalloc=yes], [],
726                     [$PTHREAD_LDFLAGS])
727
728      if test "x${have_jemalloc}" = "xyes"; then
729        jemalloc_libs=${ac_cv_search_je_malloc_stats_print}
730      fi
731    fi
732
733    LIBS=$save_LIBS
734
735    if test "x${have_jemalloc}" = "xyes" &&
736       test "x${jemalloc_libs}" != "xnone required"; then
737      JEMALLOC_LIBS=${jemalloc_libs}
738    fi
739  else
740    have_jemalloc=yes
741  fi
742fi
743
744if test "x${request_jemalloc}" = "xyes" &&
745   test "x${have_jemalloc}" != "xyes"; then
746  AC_MSG_ERROR([jemalloc was requested (--with-jemalloc) but not found])
747fi
748
749# The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL,
750# libev, and libc-ares.
751enable_app=no
752if test "x${request_app}" != "xno" &&
753   test "x${have_zlib}" = "xyes" &&
754   test "x${have_openssl}" = "xyes" &&
755   test "x${have_libev}" = "xyes" &&
756   test "x${have_libcares}" = "xyes"; then
757  enable_app=yes
758fi
759
760if test "x${request_app}" = "xyes" &&
761   test "x${enable_app}" != "xyes"; then
762  AC_MSG_ERROR([applications were requested (--enable-app) but dependencies are not met.])
763fi
764
765AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ])
766
767# Check HTTP/3 support
768enable_http3=no
769if test "x${request_http3}" != "xno" &&
770   test "x${have_libngtcp2}" = "xyes" &&
771   (test "x${have_libngtcp2_crypto_quictls}" = "xyes" ||
772    test "x${have_libngtcp2_crypto_boringssl}" = "xyes") &&
773   test "x${have_libnghttp3}" = "xyes"; then
774  enable_http3=yes
775  AC_DEFINE([ENABLE_HTTP3], [1], [Define to 1 if HTTP/3 is enabled.])
776fi
777
778if test "x${request_http3}" = "xyes" &&
779   test "x${enable_http3}" != "xyes"; then
780  AC_MSG_ERROR([HTTP/3 was requested (--enable-http3) but dependencies are not met.])
781fi
782
783AM_CONDITIONAL([ENABLE_HTTP3], [ test "x${enable_http3}" = "xyes" ])
784
785enable_hpack_tools=no
786# HPACK tools requires jansson
787if test "x${request_hpack_tools}" != "xno" &&
788   test "x${have_jansson}" = "xyes"; then
789  enable_hpack_tools=yes
790fi
791
792if test "x${request_hpack_tools}" = "xyes" &&
793   test "x${enable_hpack_tools}" != "xyes"; then
794  AC_MSG_ERROR([HPACK tools were requested (--enable-hpack-tools) but dependencies are not met.])
795fi
796
797AM_CONDITIONAL([ENABLE_HPACK_TOOLS], [ test "x${enable_hpack_tools}" = "xyes" ])
798
799# The example programs depend on OpenSSL and libevent_openssl
800enable_examples=no
801if test "x${request_examples}" != "xno" &&
802   test "x${have_openssl}" = "xyes" &&
803   test "x${have_libevent_openssl}" = "xyes"; then
804  enable_examples=yes
805fi
806
807if test "x${request_examples}" = "xyes" &&
808   test "x${enable_examples}" != "xyes"; then
809  AC_MSG_ERROR([examples were requested (--enable-examples) but dependencies are not met.])
810fi
811
812AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ])
813
814# third-party only be built when needed
815
816enable_third_party=no
817have_mruby=no
818have_neverbleed=no
819if test "x${enable_examples}" = "xyes" ||
820   test "x${enable_app}" = "xyes" ||
821   test "x${enable_hpack_tools}" = "xyes"; then
822  enable_third_party=yes
823
824  # mruby (for src/nghttpx)
825  if test "x${request_mruby}" = "xyes"; then
826    # We are going to build mruby
827    have_mruby=yes
828    AC_DEFINE([HAVE_MRUBY], [1], [Define to 1 if you have `mruby` library.])
829    LIBMRUBY_LIBS="-lmruby -lm"
830    LIBMRUBY_CFLAGS=
831    AC_SUBST([LIBMRUBY_LIBS])
832    AC_SUBST([LIBMRUBY_CFLAGS])
833  fi
834
835  # neverbleed (for src/nghttpx)
836  if test "x${request_neverbleed}" = "xyes"; then
837    have_neverbleed=yes
838    AC_DEFINE([HAVE_NEVERBLEED], [1], [Define to 1 if you have `neverbleed` library.])
839  fi
840fi
841
842AM_CONDITIONAL([ENABLE_THIRD_PARTY], [ test "x${enable_third_party}" = "xyes" ])
843AM_CONDITIONAL([HAVE_MRUBY], [test "x${have_mruby}" = "xyes"])
844AM_CONDITIONAL([HAVE_NEVERBLEED], [test "x${have_neverbleed}" = "xyes"])
845
846# failmalloc tests
847enable_failmalloc=no
848if test "x${request_failmalloc}" = "xyes"; then
849  enable_failmalloc=yes
850fi
851
852AM_CONDITIONAL([ENABLE_FAILMALLOC], [ test "x${enable_failmalloc}" = "xyes" ])
853
854# Checks for header files.
855AC_HEADER_ASSERT
856AC_CHECK_HEADERS([ \
857  arpa/inet.h \
858  fcntl.h \
859  inttypes.h \
860  limits.h \
861  netdb.h \
862  netinet/in.h \
863  netinet/ip.h \
864  pwd.h \
865  stddef.h \
866  stdint.h \
867  stdlib.h \
868  string.h \
869  sys/socket.h \
870  sys/time.h \
871  syslog.h \
872  unistd.h \
873  windows.h \
874])
875
876# Checks for typedefs, structures, and compiler characteristics.
877AC_TYPE_SIZE_T
878AC_TYPE_SSIZE_T
879AC_TYPE_UINT8_T
880AC_TYPE_UINT16_T
881AC_TYPE_UINT32_T
882AC_TYPE_UINT64_T
883AC_TYPE_INT8_T
884AC_TYPE_INT16_T
885AC_TYPE_INT32_T
886AC_TYPE_INT64_T
887AC_TYPE_OFF_T
888AC_TYPE_PID_T
889AC_TYPE_UID_T
890AC_CHECK_TYPES([ptrdiff_t])
891AC_C_BIGENDIAN
892AC_C_INLINE
893AC_SYS_LARGEFILE
894
895AC_CHECK_MEMBER([struct tm.tm_gmtoff], [have_struct_tm_tm_gmtoff=yes],
896                [have_struct_tm_tm_gmtoff=no], [[#include <time.h>]])
897
898AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
899                [AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN],[1],
900                  [Define to 1 if struct sockaddr_in has sin_len member.])],
901                [],
902                [[
903#include <sys/types.h>
904#include <sys/socket.h>
905#include <netinet/in.h>
906]])
907
908AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
909                [AC_DEFINE([HAVE_SOCKADDR_IN6_SIN6_LEN],[1],
910                  [Define to 1 if struct sockaddr_in6 has sin6_len member.])],
911                [],
912                [[
913#include <sys/types.h>
914#include <sys/socket.h>
915#include <netinet/in.h>
916]])
917
918if test "x$have_struct_tm_tm_gmtoff" = "xyes"; then
919  AC_DEFINE([HAVE_STRUCT_TM_TM_GMTOFF], [1],
920            [Define to 1 if you have `struct tm.tm_gmtoff` member.])
921fi
922
923# Checks for library functions.
924
925# Don't check malloc, since it does not play nicely with C++ stdlib
926# AC_FUNC_MALLOC
927
928AC_FUNC_CHOWN
929AC_FUNC_ERROR_AT_LINE
930AC_FUNC_FORK
931# Don't check realloc, since LeakSanitizer detects memory leak during check
932# AC_FUNC_REALLOC
933AC_FUNC_STRERROR_R
934AC_FUNC_STRNLEN
935
936AC_CHECK_FUNCS([ \
937  _Exit \
938  accept4 \
939  clock_gettime \
940  dup2 \
941  getcwd \
942  getpwnam \
943  localtime_r \
944  memchr \
945  memmove \
946  memset \
947  mkostemp \
948  socket \
949  sqrt \
950  strchr \
951  strdup \
952  strerror \
953  strndup \
954  strstr \
955  strtol \
956  strtoul \
957  timegm \
958])
959
960# timerfd_create was added in linux kernel 2.6.25
961
962AC_CHECK_FUNC([timerfd_create],
963              [have_timerfd_create=yes], [have_timerfd_create=no])
964
965AC_MSG_CHECKING([checking for GetTickCount64])
966AC_LINK_IFELSE([AC_LANG_PROGRAM(
967[[
968#include <windows.h>
969]],
970[[
971GetTickCount64();
972]])],
973[have_gettickcount64=yes],
974[have_gettickcount64=no])
975
976if test "x${have_gettickcount64}" = "xyes"; then
977  AC_MSG_RESULT([yes])
978  AC_DEFINE([HAVE_GETTICKCOUNT64], [1],
979            [Define to 1 if you have `GetTickCount64` function.])
980else
981  AC_MSG_RESULT([no])
982fi
983
984# For cygwin: we can link initgroups, so AC_CHECK_FUNCS succeeds, but
985# cygwin disables initgroups due to feature test macro magic with our
986# configuration.  FreeBSD declares initgroups() in unistd.h.
987AC_CHECK_DECLS([initgroups], [], [], [[
988  #ifdef HAVE_UNISTD_H
989  # include <unistd.h>
990  #endif
991  #include <grp.h>
992]])
993
994AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[
995#include <time.h>
996]])
997
998save_CFLAGS=$CFLAGS
999save_CXXFLAGS=$CXXFLAGS
1000
1001CFLAGS=
1002CXXFLAGS=
1003
1004if test "x$werror" != "xno"; then
1005    # For C compiler
1006    AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
1007    AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
1008    AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
1009    AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"])
1010    AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"])
1011    AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CFLAGS="$CFLAGS -Wmissing-declarations"])
1012    AX_CHECK_COMPILE_FLAG([-Wpointer-arith], [CFLAGS="$CFLAGS -Wpointer-arith"])
1013    AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement], [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
1014    AX_CHECK_COMPILE_FLAG([-Wformat-security], [CFLAGS="$CFLAGS -Wformat-security"])
1015    AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"])
1016    AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"])
1017    AX_CHECK_COMPILE_FLAG([-Winline], [CFLAGS="$CFLAGS -Winline"])
1018    AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"])
1019    AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"])
1020    AX_CHECK_COMPILE_FLAG([-Wundef], [CFLAGS="$CFLAGS -Wundef"])
1021    AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"])
1022    AX_CHECK_COMPILE_FLAG([-Wempty-body], [CFLAGS="$CFLAGS -Wempty-body"])
1023    AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"])
1024    AX_CHECK_COMPILE_FLAG([-Wclobbered], [CFLAGS="$CFLAGS -Wclobbered"])
1025    AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"])
1026    AX_CHECK_COMPILE_FLAG([-Wpragmas], [CFLAGS="$CFLAGS -Wpragmas"])
1027    AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [CFLAGS="$CFLAGS -Wunreachable-code"])
1028    AX_CHECK_COMPILE_FLAG([-Waddress], [CFLAGS="$CFLAGS -Waddress"])
1029    AX_CHECK_COMPILE_FLAG([-Wattributes], [CFLAGS="$CFLAGS -Wattributes"])
1030    AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"])
1031    AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [CFLAGS="$CFLAGS -Wshorten-64-to-32"])
1032
1033    AX_CHECK_COMPILE_FLAG([-Wconversion], [CFLAGS="$CFLAGS -Wconversion"])
1034    AX_CHECK_COMPILE_FLAG([-Wextended-offsetof], [CFLAGS="$CFLAGS -Wextended-offsetof"])
1035    AX_CHECK_COMPILE_FLAG([-Wformat-nonliteral], [CFLAGS="$CFLAGS -Wformat-nonliteral"])
1036    AX_CHECK_COMPILE_FLAG([-Wlanguage-extension-token], [CFLAGS="$CFLAGS -Wlanguage-extension-token"])
1037    AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CFLAGS="$CFLAGS -Wmissing-field-initializers"])
1038    AX_CHECK_COMPILE_FLAG([-Wmissing-noreturn], [CFLAGS="$CFLAGS -Wmissing-noreturn"])
1039    AX_CHECK_COMPILE_FLAG([-Wmissing-variable-declarations], [CFLAGS="$CFLAGS -Wmissing-variable-declarations"])
1040    # Not used because we cannot change public structs
1041    # AX_CHECK_COMPILE_FLAG([-Wpadded], [CFLAGS="$CFLAGS -Wpadded"])
1042    AX_CHECK_COMPILE_FLAG([-Wsign-conversion], [CFLAGS="$CFLAGS -Wsign-conversion"])
1043    # Not used because this basically disallows default case
1044    # AX_CHECK_COMPILE_FLAG([-Wswitch-enum], [CFLAGS="$CFLAGS -Wswitch-enum"])
1045    AX_CHECK_COMPILE_FLAG([-Wunreachable-code-break], [CFLAGS="$CFLAGS -Wunreachable-code-break"])
1046    AX_CHECK_COMPILE_FLAG([-Wunused-macros], [CFLAGS="$CFLAGS -Wunused-macros"])
1047    AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [CFLAGS="$CFLAGS -Wunused-parameter"])
1048    AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"])
1049    # Only work with Clang for the moment
1050    AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
1051    AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CFLAGS="$CFLAGS -Wsometimes-uninitialized"])
1052
1053    # This is required because we pass format string as "const char*.
1054    AX_CHECK_COMPILE_FLAG([-Wno-format-nonliteral], [CFLAGS="$CFLAGS -Wno-format-nonliteral"])
1055
1056    # For C++ compiler
1057    AC_LANG_PUSH(C++)
1058    AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
1059    AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"])
1060    AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"])
1061    AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized"])
1062    # Disable noexcept-type warning of g++-7.  This is not harmful as
1063    # long as all source files are compiled with the same compiler.
1064    AX_CHECK_COMPILE_FLAG([-Wno-noexcept-type], [CXXFLAGS="$CXXFLAGS -Wno-noexcept-type"])
1065    AC_LANG_POP()
1066fi
1067
1068WARNCFLAGS=$CFLAGS
1069WARNCXXFLAGS=$CXXFLAGS
1070
1071CFLAGS=$save_CFLAGS
1072CXXFLAGS=$save_CXXFLAGS
1073
1074AC_SUBST([WARNCFLAGS])
1075AC_SUBST([WARNCXXFLAGS])
1076
1077EXTRACFLAG=
1078AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"])
1079
1080AC_SUBST([EXTRACFLAG])
1081
1082if test "x$debug" != "xno"; then
1083    AC_DEFINE([DEBUGBUILD], [1], [Define to 1 to enable debug output.])
1084fi
1085
1086enable_threads=yes
1087# Some platform does not have working std::future.  We disable
1088# threading for those platforms.
1089if test "x$threads" != "xyes" ||
1090   test "x$have_std_future" != "xyes"; then
1091    enable_threads=no
1092    AC_DEFINE([NOTHREADS], [1], [Define to 1 if you want to disable threads.])
1093fi
1094
1095# propagate $enable_static to tests/Makefile.am
1096AM_CONDITIONAL([ENABLE_STATIC], [test "x$enable_static" = "xyes"])
1097
1098AC_SUBST([TESTLDADD])
1099AC_SUBST([APPLDFLAGS])
1100
1101AC_CONFIG_FILES([
1102  Makefile
1103  lib/Makefile
1104  lib/libnghttp2.pc
1105  lib/includes/Makefile
1106  lib/includes/nghttp2/nghttp2ver.h
1107  tests/Makefile
1108  tests/testdata/Makefile
1109  third-party/Makefile
1110  src/Makefile
1111  src/testdata/Makefile
1112  bpf/Makefile
1113  examples/Makefile
1114  integration-tests/Makefile
1115  integration-tests/config.go
1116  integration-tests/setenv
1117  doc/Makefile
1118  doc/conf.py
1119  doc/index.rst
1120  doc/package_README.rst
1121  doc/tutorial-client.rst
1122  doc/tutorial-server.rst
1123  doc/tutorial-hpack.rst
1124  doc/nghttpx-howto.rst
1125  doc/h2load-howto.rst
1126  doc/building-android-binary.rst
1127  doc/nghttp2.h.rst
1128  doc/nghttp2ver.h.rst
1129  doc/contribute.rst
1130  contrib/Makefile
1131  script/Makefile
1132])
1133AC_OUTPUT
1134
1135AC_MSG_NOTICE([summary of build options:
1136
1137    Package version: ${VERSION}
1138    Library version: $LT_CURRENT:$LT_REVISION:$LT_AGE
1139    Install prefix:  ${prefix}
1140    System types:
1141      Build:         ${build}
1142      Host:          ${host}
1143      Target:        ${target}
1144    Compiler:
1145      C compiler:     ${CC}
1146      CFLAGS:         ${CFLAGS}
1147      LDFLAGS:        ${LDFLAGS}
1148      C++ compiler:   ${CXX}
1149      CXXFLAGS:       ${CXXFLAGS}
1150      CXXCPP:         ${CXXCPP}
1151      C preprocessor: ${CPP}
1152      CPPFLAGS:       ${CPPFLAGS}
1153      WARNCFLAGS:     ${WARNCFLAGS}
1154      WARNCXXFLAGS:   ${WARNCXXFLAGS}
1155      CXX1XCXXFLAGS:  ${CXX1XCXXFLAGS}
1156      EXTRACFLAG:     ${EXTRACFLAG}
1157      BPFCFLAGS:      ${BPFCFLAGS}
1158      EXTRABPFCFLAGS: ${EXTRABPFCFLAGS}
1159      LIBS:           ${LIBS}
1160      DEFS:           ${DEFS}
1161      EXTRA_DEFS:     ${EXTRA_DEFS}
1162    Library:
1163      Shared:         ${enable_shared}
1164      Static:         ${enable_static}
1165    Libtool:
1166      LIBTOOL_LDFLAGS: ${LIBTOOL_LDFLAGS}
1167    Python:
1168      Python:         ${PYTHON}
1169      PYTHON_VERSION: ${PYTHON_VERSION}
1170    Test:
1171      Failmalloc:     ${enable_failmalloc}
1172    Libs:
1173      OpenSSL:        ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}')
1174      Libxml2:        ${have_libxml2} (CFLAGS='${LIBXML2_CFLAGS}' LIBS='${LIBXML2_LIBS}')
1175      Libev:          ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}')
1176      Libc-ares:      ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}')
1177      libngtcp2:      ${have_libngtcp2} (CFLAGS='${LIBNGTCP2_CFLAGS}' LIBS='${LIBNGTCP2_LIBS}')
1178      libngtcp2_crypto_quictls: ${have_libngtcp2_crypto_quictls} (CFLAGS='${LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBS}')
1179      libngtcp2_crypto_boringssl: ${have_libngtcp2_crypto_boringssl} (CFLAGS='${LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_BORINGSSL_LIBS}')
1180      libnghttp3:     ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}')
1181      libbpf:         ${have_libbpf} (CFLAGS='${LIBBPF_CFLAGS}' LIBS='${LIBBPF_LIBS}')
1182      Libevent(SSL):  ${have_libevent_openssl} (CFLAGS='${LIBEVENT_OPENSSL_CFLAGS}' LIBS='${LIBEVENT_OPENSSL_LIBS}')
1183      Jansson:        ${have_jansson} (CFLAGS='${JANSSON_CFLAGS}' LIBS='${JANSSON_LIBS}')
1184      Jemalloc:       ${have_jemalloc} (CFLAGS='${JEMALLOC_CFLAGS}' LIBS='${JEMALLOC_LIBS}')
1185      Zlib:           ${have_zlib} (CFLAGS='${ZLIB_CFLAGS}' LIBS='${ZLIB_LIBS}')
1186      Systemd:        ${have_libsystemd} (CFLAGS='${SYSTEMD_CFLAGS}' LIBS='${SYSTEMD_LIBS}')
1187      Libbrotlienc:   ${have_libbrotlienc} (CFLAGS="${LIBBROTLIENC_CFLAGS}' LIBS='${LIBBROTLIENC_LIBS}')
1188      Libbrotlidec:   ${have_libbrotlidec} (CFLAGS="${LIBBROTLIDEC_CFLAGS}' LIBS='${LIBBROTLIDEC_LIBS}')
1189    Third-party:
1190      http-parser:    ${enable_third_party}
1191      MRuby:          ${have_mruby} (CFLAGS='${LIBMRUBY_CFLAGS}' LIBS='${LIBMRUBY_LIBS}')
1192      Neverbleed:     ${have_neverbleed}
1193    Features:
1194      Applications:   ${enable_app}
1195      HPACK tools:    ${enable_hpack_tools}
1196      Examples:       ${enable_examples}
1197      Threading:      ${enable_threads}
1198      HTTP/3 (EXPERIMENTAL): ${enable_http3}
1199])
1200