1# ngtcp2 2# 3# Copyright (c) 2016 ngtcp2 contributors 4# Copyright (c) 2012 nghttp2 contributors 5# 6# Permission is hereby granted, free of charge, to any person obtaining 7# a copy of this software and associated documentation files (the 8# "Software"), to deal in the Software without restriction, including 9# without limitation the rights to use, copy, modify, merge, publish, 10# distribute, sublicense, and/or sell copies of the Software, and to 11# permit persons to whom the Software is furnished to do so, subject to 12# the following conditions: 13# 14# The above copyright notice and this permission notice shall be 15# included in all copies or substantial portions of the Software. 16# 17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24AC_PREREQ(2.61) 25AC_INIT([ngtcp2], [0.1.0.g20211128], [t-tujikawa@users.sourceforge.net]) 26AC_CONFIG_AUX_DIR([.]) 27AC_CONFIG_MACRO_DIR([m4]) 28AC_CONFIG_HEADERS([config.h]) 29AC_USE_SYSTEM_EXTENSIONS 30 31LT_PREREQ([2.2.6]) 32LT_INIT() 33 34AC_CANONICAL_BUILD 35AC_CANONICAL_HOST 36AC_CANONICAL_TARGET 37 38AM_INIT_AUTOMAKE([subdir-objects]) 39 40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 41 42# See versioning rule: 43# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 44AC_SUBST(LT_CURRENT, 0) 45AC_SUBST(LT_REVISION, 0) 46AC_SUBST(LT_AGE, 0) 47 48AC_SUBST(CRYPTO_OPENSSL_LT_CURRENT, 0) 49AC_SUBST(CRYPTO_OPENSSL_LT_REVISION, 0) 50AC_SUBST(CRYPTO_OPENSSL_LT_AGE, 0) 51 52AC_SUBST(CRYPTO_GNUTLS_LT_CURRENT, 0) 53AC_SUBST(CRYPTO_GNUTLS_LT_REVISION, 0) 54AC_SUBST(CRYPTO_GNUTLS_LT_AGE, 0) 55 56AC_SUBST(CRYPTO_BORINGSSL_LT_CURRENT, 0) 57AC_SUBST(CRYPTO_BORINGSSL_LT_REVISION, 0) 58AC_SUBST(CRYPTO_BORINGSSL_LT_AGE, 0) 59 60# from nghttp2 61major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"` 62minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"` 63patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"` 64 65PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"` 66 67AC_SUBST(PACKAGE_VERSION_NUM) 68 69# Checks for command-line options from ngtcp2 70AC_ARG_ENABLE([werror], 71 [AS_HELP_STRING([--enable-werror], 72 [Turn on compile time warnings])], 73 [werror=$enableval], [werror=no]) 74 75AC_ARG_ENABLE([debug], 76 [AS_HELP_STRING([--enable-debug], 77 [Turn on debug output])], 78 [debug=$enableval], [debug=no]) 79 80if test "x${debug}" = "xyes"; then 81 DEBUGCFLAGS="-O0 -g3" 82 AC_SUBST([DEBUGCFLAGS]) 83 AC_DEFINE([DEBUGBUILD], [1], [Define to 1 to enable debug output.]) 84fi 85 86AC_ARG_ENABLE(asan, 87 AS_HELP_STRING([--enable-asan], 88 [Enable AddressSanitizer (ASAN)]), 89 [asan=$enableval], [asan=no]) 90 91AC_ARG_ENABLE([lib-only], 92 [AS_HELP_STRING([--enable-lib-only], 93 [Build libngtcp2 and libngtcp2_crypto only.])], 94 [lib_only=$enableval], [lib_only=no]) 95 96AC_ARG_WITH([jemalloc], 97 [AS_HELP_STRING([--with-jemalloc], 98 [Use jemalloc [default=check]])], 99 [request_jemalloc=$withval], [request_jemalloc=check]) 100 101AC_ARG_WITH([cunit], 102 [AS_HELP_STRING([--with-cunit], 103 [Use cunit [default=check]])], 104 [request_cunit=$withval], [request_cunit=check]) 105 106AC_ARG_WITH([libnghttp3], 107 [AS_HELP_STRING([--with-libnghttp3], 108 [Use libnghttp3 [default=check]])], 109 [request_libnghttp3=$withval], [request_libnghttp3=check]) 110 111AC_ARG_WITH([libev], 112 [AS_HELP_STRING([--with-libev], 113 [Use libev [default=check]])], 114 [request_libev=$withval], [request_libev=check]) 115 116AC_ARG_WITH([openssl], 117 [AS_HELP_STRING([--with-openssl], 118 [Use openssl [default=check]])], 119 [request_openssl=$withval], [request_openssl=check]) 120 121AC_ARG_WITH([gnutls], 122 [AS_HELP_STRING([--with-gnutls], 123 [Use gnutls [default=no]])], 124 [request_gnutls=$withval], [request_gnutls=no]) 125 126AC_ARG_WITH([boringssl], 127 [AS_HELP_STRING([--with-boringssl], 128 [Use boringssl [default=no]])], 129 [request_boringssl=$withval], [request_boringssl=no]) 130 131AC_ARG_VAR([BORINGSSL_CFLAGS], [C compiler flags for BORINGSSL]) 132AC_ARG_VAR([BORINGSSL_LIBS], [linker flags for BORINGSSL]) 133 134AC_ARG_VAR([LIBEV_CFLAGS], [C compiler flags for libev, skipping any checks]) 135AC_ARG_VAR([LIBEV_LIBS], [linker flags for libev, skipping any checks]) 136 137AC_ARG_VAR([JEMALLOC_CFLAGS], 138 [C compiler flags for jemalloc, skipping any checks]) 139AC_ARG_VAR([JEMALLOC_LIBS], [linker flags for jemalloc, skipping any checks]) 140 141AC_ARG_VAR([LIBTOOL_LDFLAGS], 142 [libtool specific flags (e.g., -static-libtool-libs)]) 143 144# Checks for programs 145AC_PROG_CC 146AC_PROG_CXX 147AC_PROG_CPP 148AC_PROG_INSTALL 149AC_PROG_LN_S 150AC_PROG_MAKE_SET 151AC_PROG_MKDIR_P 152 153PKG_PROG_PKG_CONFIG([0.20]) 154 155AX_CXX_COMPILE_STDCXX([17], [noext], [optional]) 156 157case "${build}" in 158 *-apple-darwin*) 159 EXTRA_DEFS="-D__APPLE_USE_RFC_3542" 160 AC_SUBST([EXTRA_DEFS]) 161 ;; 162esac 163 164# Checks for libraries. 165 166# cunit 167have_cunit=no 168if test "x${request_cunit}" != "xno"; then 169 PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no]) 170 # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We 171 # do this because Debian (Ubuntu) lacks pkg-config file for cunit. 172 if test "x${have_cunit}" = "xno"; then 173 AC_MSG_WARN([${CUNIT_PKG_ERRORS}]) 174 AC_CHECK_LIB([cunit], [CU_initialize_registry], 175 [have_cunit=yes], [have_cunit=no]) 176 if test "x${have_cunit}" = "xyes"; then 177 CUNIT_LIBS="-lcunit" 178 CUNIT_CFLAGS="" 179 AC_SUBST([CUNIT_LIBS]) 180 AC_SUBST([CUNIT_CFLAGS]) 181 fi 182 fi 183 if test "x${have_cunit}" = "xyes"; then 184 # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test 185 # program can be built without -lncurses, but it emits runtime 186 # error. 187 case "${build}" in 188 *-apple-darwin*) 189 CUNIT_LIBS="$CUNIT_LIBS -lncurses" 190 AC_SUBST([CUNIT_LIBS]) 191 ;; 192 esac 193 fi 194fi 195 196if test "x${request_cunit}" = "xyes" && 197 test "x${have_cunit}" != "xyes"; then 198 AC_MSG_ERROR([cunit was requested (--with-cunit) but not found]) 199fi 200 201AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) 202 203AM_CONDITIONAL([ENABLE_SHARED], [ test "x${enable_shared}" = "xyes" ]) 204 205# OpenSSL (required for libngtcp2_crypto_openssl and examples) 206have_openssl=no 207if test "x${request_openssl}" != "xno"; then 208 PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1], 209 [have_openssl=yes], [have_openssl=no]) 210 if test "x${have_openssl}" = "xno"; then 211 AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) 212 fi 213 # Until OpenSSL gains mainline support for QUIC, check for a patched version. 214 save_CFLAGS="$CFLAGS" 215 save_LIBS="$LIBS" 216 CFLAGS="$OPENSSL_CFLAGS $CFLAGS" 217 LIBS="$OPENSSL_LIBS $LIBS" 218 219 AC_MSG_CHECKING([for SSL_is_quic]) 220 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 221 #include <openssl/ssl.h> 222 ]], [[ 223 SSL *ssl = NULL; 224 SSL_is_quic(ssl); 225 ]])], 226 [AC_MSG_RESULT([yes]); have_openssl_quic=yes], 227 [AC_MSG_RESULT([no]); have_openssl_quic=no]) 228 229 CFLAGS="$save_CFLAGS" 230 LIBS="$save_LIBS" 231 232 if test "x${have_openssl}${have_openssl_quic}" = "xyesno"; then 233 AC_MSG_NOTICE([openssl does not have QUIC interface, disabling it]) 234 have_openssl=no 235 OPENSSL_LIBS= 236 OPENSSL_CFLAGS= 237 fi 238fi 239 240if test "x${request_openssl}" = "xyes" && 241 test "x${have_openssl}" != "xyes"; then 242 AC_MSG_ERROR([openssl was requested (--with-openssl) but not found]) 243fi 244 245AM_CONDITIONAL([HAVE_OPENSSL], [ test "x${have_openssl}" = "xyes" ]) 246 247# GnuTLS (required for libngtcp2_crypto_gnutls) 248have_gnutls=no 249if test "x${request_gnutls}" != "xno"; then 250 PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.7.2], 251 [have_gnutls=yes], [have_gnutls=no]) 252 if test "x${have_gnutls}" = "xno"; then 253 AC_MSG_NOTICE($GNUTLS_PKG_ERRORS) 254 fi 255fi 256 257if test "x${request_gnutls}" = "xyes" && 258 test "x${have_gnutls}" != "xyes"; then 259 AC_MSG_ERROR([gnutls was requested (--with-gnutls) but not found]) 260fi 261 262AM_CONDITIONAL([HAVE_GNUTLS], [ test "x${have_gnutls}" = "xyes" ]) 263 264# BoringSSL (required for libngtcp2_crypto_boringssl) 265have_boringssl=no 266if test "x${request_boringssl}" != "xno"; then 267 save_CFLAGS="$CFLAGS" 268 save_LIBS="$LIBS" 269 CFLAGS="$BORINGSSL_CFLAGS" 270 LIBS="$BORINGSSL_LIBS $LIBS" 271 272 AC_MSG_CHECKING([for SSL_set_quic_early_data_context]) 273 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 274 #include <openssl/ssl.h> 275 ]], [[ 276 SSL *ssl = NULL; 277 SSL_set_quic_early_data_context(ssl, NULL, 0); 278 ]])], 279 [AC_MSG_RESULT([yes]); have_boringssl=yes], 280 [AC_MSG_RESULT([no]); have_boringssl=no]) 281 282 CFLAGS="$save_CFLAGS" 283 LIBS="$save_LIBS" 284fi 285 286if test "x${request_boringssl}" = "xyes" && 287 test "x${have_boringssl}" != "xyes"; then 288 AC_MSG_ERROR([boringssl was requested (--with-boringssl) but not found]) 289fi 290 291AM_CONDITIONAL([HAVE_BORINGSSL], [ test "x${have_boringssl}" = "xyes" ]) 292 293have_crypto=no 294if test "x${have_openssl}" = "xyes" || 295 test "x${have_gnutls}" = "xyes" || 296 test "x${have_boringssl}" = "xyes"; then 297 have_crypto=yes 298fi 299 300AM_CONDITIONAL([HAVE_CRYPTO], [ test "x${have_crypto}" = "xyes" ]) 301 302# libnghttp3 (required for examples) 303have_libnghttp3=no 304if test "x${request_libnghttp3}" != "xno"; then 305 PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 0.0.0], 306 [have_libnghttp3=yes], [have_libnghttp3=no]) 307 if test "${have_libnghttp3}" = "xno"; then 308 AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS) 309 fi 310fi 311 312if test "x${request_libnghttp3}" = "xyes" && 313 test "x${have_libnghttp3}" != "xyes"; then 314 AC_MSG_ERROR([libnghttp3 was requested (--with-libnghttp3) but not found]) 315fi 316 317AM_CONDITIONAL([HAVE_NGHTTP3], [ test "x${have_libnghttp3}" = "xyes" ]) 318 319# libev (required for examples) 320have_libev=no 321if test "x${request_libev}" != "xno"; then 322 if test "x${LIBEV_LIBS}" = "x" && test "x${LIBEV_CFLAGS}" = "x"; then 323 # libev does not have pkg-config file. Check it in an old way. 324 save_LIBS=$LIBS 325 # android requires -lm for floor 326 AC_CHECK_LIB([ev], [ev_time], [have_libev=yes], [have_libev=no], [-lm]) 327 if test "x${have_libev}" = "xyes"; then 328 AC_CHECK_HEADER([ev.h], [have_libev=yes], [have_libev=no]) 329 if test "x${have_libev}" = "xyes"; then 330 LIBEV_LIBS=-lev 331 LIBEV_CFLAGS= 332 fi 333 fi 334 LIBS=$save_LIBS 335 else 336 have_libev=yes 337 fi 338fi 339 340if test "x${request_libev}" = "xyes" && 341 test "x${have_libev}" != "xyes"; then 342 AC_MSG_ERROR([libev was requested (--with-libev) but not found]) 343fi 344 345enable_examples=no 346if test "x${lib_only}" = "xno" && 347 test "x${have_libnghttp3}" = "xyes" && 348 test "x${have_crypto}" = "xyes" && 349 test "x${have_libev}" = "xyes"; then 350 enable_examples=yes 351 352 if test "x${have_openssl}" = "xyes"; then 353 AC_DEFINE([ENABLE_EXAMPLE_OPENSSL], [1], 354 [Define to 1 in order to build examples/{client,server}]) 355 fi 356 357 if test "x${have_gnutls}" = "xyes"; then 358 AC_DEFINE([ENABLE_EXAMPLE_GNUTLS], [1], 359 [Define to 1 in order to build examples/{gtlsclient,gtlsserver}]) 360 fi 361 362 if test "x${have_boringssl}" = "xyes"; then 363 AC_DEFINE([ENABLE_EXAMPLE_BORINGSSL], [1], 364 [Define to 1 in order to build examples/{bsslclient,bsslserver}]) 365 fi 366fi 367 368AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ]) 369AM_CONDITIONAL([ENABLE_EXAMPLE_OPENSSL], [ test "x${enable_examples}" = "xyes" && test "x${have_openssl}" = "xyes" ]) 370AM_CONDITIONAL([ENABLE_EXAMPLE_GNUTLS], [ test "x${enable_examples}" = "xyes" && test "x${have_gnutls}" = "xyes" ]) 371AM_CONDITIONAL([ENABLE_EXAMPLE_BORINGSSL], [ test "x${enable_examples}" = "xyes" && test "x${have_boringssl}" = "xyes" ]) 372 373# jemalloc 374have_jemalloc=no 375if test "x${request_jemalloc}" != "xno"; then 376 if test "x${JEMALLOC_LIBS}" = "x" && test "x${JEMALLOC_CFLAGS}" = "x"; then 377 save_LIBS=$LIBS 378 AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes], [], 379 [$PTHREAD_LDFLAGS]) 380 381 if test "x${have_jemalloc}" = "xyes"; then 382 jemalloc_libs=${ac_cv_search_malloc_stats_print} 383 else 384 # On Darwin, malloc_stats_print is je_malloc_stats_print 385 AC_SEARCH_LIBS([je_malloc_stats_print], [jemalloc], [have_jemalloc=yes], 386 [], [$PTHREAD_LDFLAGS]) 387 388 if test "x${have_jemalloc}" = "xyes"; then 389 jemalloc_libs=${ac_cv_search_je_malloc_stats_print} 390 fi 391 fi 392 393 LIBS=$save_LIBS 394 395 if test "x${have_jemalloc}" = "xyes" && 396 test "x${jemalloc_libs}" != "xnone required"; then 397 JEMALLOC_LIBS=${jemalloc_libs} 398 fi 399 else 400 have_jemalloc=yes 401 fi 402fi 403 404if test "x${request_jemalloc}" = "xyes" && 405 test "x${have_jemalloc}" != "xyes"; then 406 AC_MSG_ERROR([jemalloc was requested (--with-jemalloc) but not found]) 407fi 408 409# Checks for header files. 410AC_CHECK_HEADERS([ \ 411 arpa/inet.h \ 412 netinet/in.h \ 413 stddef.h \ 414 stdint.h \ 415 stdlib.h \ 416 string.h \ 417 unistd.h \ 418 sys/endian.h \ 419 endian.h \ 420 byteswap.h \ 421 asm/types.h \ 422 linux/netlink.h \ 423 linux/rtnetlink.h 424]) 425 426# Checks for typedefs, structures, and compiler characteristics. 427AC_TYPE_SIZE_T 428AC_TYPE_SSIZE_T 429AC_TYPE_UINT8_T 430AC_TYPE_UINT16_T 431AC_TYPE_UINT32_T 432AC_TYPE_UINT64_T 433AC_TYPE_INT8_T 434AC_TYPE_INT16_T 435AC_TYPE_INT32_T 436AC_TYPE_INT64_T 437AC_TYPE_OFF_T 438AC_TYPE_PID_T 439AC_TYPE_UID_T 440AC_CHECK_TYPES([ptrdiff_t]) 441AC_C_BIGENDIAN 442AC_C_INLINE 443AC_SYS_LARGEFILE 444 445# Checks for library functions. 446AC_CHECK_FUNCS([ \ 447 memmove \ 448 memset \ 449]) 450 451# Checks for symbols. 452AC_CHECK_DECLS([be64toh], [], [], [[ 453#ifdef HAVE_ENDIAN_H 454# include <endian.h> 455#endif 456#ifdef HAVE_SYS_ENDIAN_H 457# include <sys/endian.h> 458#endif 459]]) 460 461AC_CHECK_DECLS([bswap_64], [], [], [[ 462#include <byteswap.h> 463]]) 464 465# More compiler flags from nghttp2. 466save_CFLAGS=$CFLAGS 467save_CXXFLAGS=$CXXFLAGS 468 469CFLAGS= 470CXXFLAGS= 471 472if test "x$werror" != "xno"; then 473 # For C compiler 474 AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) 475 AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) 476 AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"]) 477 AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"]) 478 AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"]) 479 AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CFLAGS="$CFLAGS -Wmissing-declarations"]) 480 AX_CHECK_COMPILE_FLAG([-Wpointer-arith], [CFLAGS="$CFLAGS -Wpointer-arith"]) 481 AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement], [CFLAGS="$CFLAGS -Wdeclaration-after-statement"]) 482 AX_CHECK_COMPILE_FLAG([-Wformat-security], [CFLAGS="$CFLAGS -Wformat-security"]) 483 AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"]) 484 AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"]) 485 AX_CHECK_COMPILE_FLAG([-Winline], [CFLAGS="$CFLAGS -Winline"]) 486 AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"]) 487 AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"]) 488 AX_CHECK_COMPILE_FLAG([-Wundef], [CFLAGS="$CFLAGS -Wundef"]) 489 AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"]) 490 AX_CHECK_COMPILE_FLAG([-Wempty-body], [CFLAGS="$CFLAGS -Wempty-body"]) 491 AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"]) 492 AX_CHECK_COMPILE_FLAG([-Wclobbered], [CFLAGS="$CFLAGS -Wclobbered"]) 493 AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"]) 494 AX_CHECK_COMPILE_FLAG([-Wpragmas], [CFLAGS="$CFLAGS -Wpragmas"]) 495 AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [CFLAGS="$CFLAGS -Wunreachable-code"]) 496 AX_CHECK_COMPILE_FLAG([-Waddress], [CFLAGS="$CFLAGS -Waddress"]) 497 AX_CHECK_COMPILE_FLAG([-Wattributes], [CFLAGS="$CFLAGS -Wattributes"]) 498 AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"]) 499 AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [CFLAGS="$CFLAGS -Wshorten-64-to-32"]) 500 501 AX_CHECK_COMPILE_FLAG([-Wconversion], [CFLAGS="$CFLAGS -Wconversion"]) 502 AX_CHECK_COMPILE_FLAG([-Wextended-offsetof], [CFLAGS="$CFLAGS -Wextended-offsetof"]) 503 AX_CHECK_COMPILE_FLAG([-Wformat-nonliteral], [CFLAGS="$CFLAGS -Wformat-nonliteral"]) 504 AX_CHECK_COMPILE_FLAG([-Wlanguage-extension-token], [CFLAGS="$CFLAGS -Wlanguage-extension-token"]) 505 AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CFLAGS="$CFLAGS -Wmissing-field-initializers"]) 506 AX_CHECK_COMPILE_FLAG([-Wmissing-noreturn], [CFLAGS="$CFLAGS -Wmissing-noreturn"]) 507 AX_CHECK_COMPILE_FLAG([-Wmissing-variable-declarations], [CFLAGS="$CFLAGS -Wmissing-variable-declarations"]) 508 # Not used because we cannot change public structs 509 # AX_CHECK_COMPILE_FLAG([-Wpadded], [CFLAGS="$CFLAGS -Wpadded"]) 510 AX_CHECK_COMPILE_FLAG([-Wsign-conversion], [CFLAGS="$CFLAGS -Wsign-conversion"]) 511 # Not used because this basically disallows default case 512 # AX_CHECK_COMPILE_FLAG([-Wswitch-enum], [CFLAGS="$CFLAGS -Wswitch-enum"]) 513 AX_CHECK_COMPILE_FLAG([-Wunreachable-code-break], [CFLAGS="$CFLAGS -Wunreachable-code-break"]) 514 AX_CHECK_COMPILE_FLAG([-Wunused-macros], [CFLAGS="$CFLAGS -Wunused-macros"]) 515 AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [CFLAGS="$CFLAGS -Wunused-parameter"]) 516 AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"]) 517 # Only work with Clang for the moment 518 AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"]) 519 AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CFLAGS="$CFLAGS -Wsometimes-uninitialized"]) 520 521 # Only work with gcc7 for the moment 522 AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [CFLAGS="$CFLAGS -Wduplicated-branches"]) 523 524 # This is required because we pass format string as "const char*. 525 AX_CHECK_COMPILE_FLAG([-Wno-format-nonliteral], [CFLAGS="$CFLAGS -Wno-format-nonliteral"]) 526 527 # For C++ compiler 528 AC_LANG_PUSH(C++) 529 AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"]) 530 AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"]) 531 AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"]) 532 AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized"]) 533 # Disable noexcept-type warning of g++-7. This is not harmful as 534 # long as all source files are compiled with the same compiler. 535 AX_CHECK_COMPILE_FLAG([-Wno-noexcept-type], [CXXFLAGS="$CXXFLAGS -Wno-noexcept-type"]) 536 AC_LANG_POP() 537fi 538 539WARNCFLAGS=$CFLAGS 540WARNCXXFLAGS=$CXXFLAGS 541 542CFLAGS=$save_CFLAGS 543CXXFLAGS=$save_CXXFLAGS 544 545AC_SUBST([WARNCFLAGS]) 546AC_SUBST([WARNCXXFLAGS]) 547 548if test "x$asan" != "xno"; then 549 # Assume both C and C++ compiler either support ASAN or not. 550 save_LDFLAGS="$LDFLAGS" 551 LDFLAGS="$LDFLAGS -fsanitize=address" 552 AX_CHECK_COMPILE_FLAG([-fsanitize=address], 553 [CFLAGS="$CFLAGS -fsanitize=address"; CXXFLAGS="$CXXFLAGS -fsanitize=address"], 554 [LDFLAGS="$save_LDFLAGS"]) 555fi 556 557# extra flags for API function visibility 558EXTRACFLAG= 559AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"]) 560 561AC_SUBST([EXTRACFLAG]) 562 563AC_CONFIG_FILES([ 564 Makefile 565 lib/Makefile 566 lib/libngtcp2.pc 567 lib/includes/Makefile 568 lib/includes/ngtcp2/version.h 569 tests/Makefile 570 crypto/Makefile 571 crypto/openssl/Makefile 572 crypto/openssl/libngtcp2_crypto_openssl.pc 573 crypto/includes/Makefile 574 crypto/gnutls/Makefile 575 crypto/gnutls/libngtcp2_crypto_gnutls.pc 576 crypto/boringssl/Makefile 577 crypto/boringssl/libngtcp2_crypto_boringssl.pc 578 doc/Makefile 579 doc/source/conf.py 580 third-party/Makefile 581 examples/Makefile 582]) 583AC_OUTPUT 584 585AC_MSG_NOTICE([summary of build options: 586 587 Package version: ${VERSION} 588 Library version: $LT_CURRENT:$LT_REVISION:$LT_AGE 589 Install prefix: ${prefix} 590 System types: 591 Build: ${build} 592 Host: ${host} 593 Target: ${target} 594 Compiler: 595 C preprocessor: ${CPP} 596 CPPFLAGS: ${CPPFLAGS} 597 C compiler: ${CC} 598 CFLAGS: ${CFLAGS} 599 C++ compiler: ${CXX} 600 CXXFLAGS: ${CXXFLAGS} 601 LDFLAGS: ${LDFLAGS} 602 WARNCFLAGS: ${WARNCFLAGS} 603 WARNCXXFLAGS: ${WARNCXXFLAGS} 604 EXTRACFLAG: ${EXTRACFLAG} 605 LIBS: ${LIBS} 606 Library: 607 Shared: ${enable_shared} 608 Static: ${enable_static} 609 Libtool: 610 LIBTOOL_LDFLAGS: ${LIBTOOL_LDFLAGS} 611 Crypto helper libraries: 612 libngtcp2_crypto_openssl: ${have_openssl} 613 libngtcp2_crypto_gnutls: ${have_gnutls} 614 libngtcp2_crypto_boringssl: ${have_boringssl} 615 Test: 616 CUnit: ${have_cunit} (CFLAGS='${CUNIT_CFLAGS}' LIBS='${CUNIT_LIBS}') 617 Debug: 618 Debug: ${debug} (CFLAGS='${DEBUGCFLAGS}') 619 Libs: 620 OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}') 621 Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') 622 Libnghttp3: ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}') 623 Jemalloc: ${have_jemalloc} (CFLAGS='${JEMALLOC_CFLAGS}' LIBS='${JEMALLOC_LIBS}') 624 GnuTLS: ${have_gnutls} (CFLAGS='${GNUTLS_CFLAGS}' LIBS='${GNUTLS_LIBS}') 625 BoringSSL: ${have_boringssl} (CFLAGS='${BORINGSSL_CFLAGS}' LIBS='${BORINGSSL_LIBS}') 626 Examples: ${enable_examples} 627]) 628