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