aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-06 13:50:16 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-06 19:05:41 +0300
commitcbd62cc2d39557728a1c49b67cdd13951217fd3b (patch)
tree281a493b3f436df9983565517b21265604b755d4
parent895542a1ce315e58e33e0567ccec34f0792a98fd (diff)
downloadlibmicrohttpd-cbd62cc2d39557728a1c49b67cdd13951217fd3b.tar.gz
libmicrohttpd-cbd62cc2d39557728a1c49b67cdd13951217fd3b.zip
Autotools refactoring: better follow GNU coding standards
Never override CFLAGS, CPPFLAGS, and LDFLAGS in 'configure'. Let user override compile setting as make-time almost in the same way like at configure-time. Removed some redundant compile settings.
-rw-r--r--configure.ac200
-rw-r--r--doc/examples/Makefile.am7
-rw-r--r--src/examples/Makefile.am5
-rw-r--r--src/microhttpd/Makefile.am6
-rw-r--r--src/testcurl/Makefile.am19
-rw-r--r--src/testcurl/https/Makefile.am21
-rw-r--r--src/testzzuf/Makefile.am56
7 files changed, 150 insertions, 164 deletions
diff --git a/configure.ac b/configure.ac
index a52a08d1..c779667e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,17 @@ AC_PROG_CC
76AC_PROG_CC_STDC 76AC_PROG_CC_STDC
77 ] 77 ]
78) 78)
79MHD_SYS_EXT 79
80user_CFLAGS="$CFLAGS"
81user_LDFLAGS="$LDFLAGS"
82user_CPPFLAGS="$CPPFLAGS"
83
84CFLAGS_ac=""
85LDFLAGS_ac=""
86CPPFLAGS_ac=""
87
88MHD_SYS_EXT([CPPFLAGS_ac])
89CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
80LT_INIT([win32-dll]) 90LT_INIT([win32-dll])
81LT_LANG([Windows Resource]) 91LT_LANG([Windows Resource])
82 92
@@ -183,10 +193,12 @@ AM_CONDITIONAL([HAVE_PO], [ test "$have_po" = yes ])
183AC_ARG_ENABLE([gcc-hardening], 193AC_ARG_ENABLE([gcc-hardening],
184 [AS_HELP_STRING([--enable-gcc-hardening], [enable compiler security checks])], 194 [AS_HELP_STRING([--enable-gcc-hardening], [enable compiler security checks])],
185[AS_IF([test x$enableval = xyes],[ 195[AS_IF([test x$enableval = xyes],[
186 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" 196 CFLAGS_ac="${CFLAGS_ac} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
187 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 197 CFLAGS_ac="${CFLAGS_ac} -fwrapv -fPIE -Wstack-protector"
188 CFLAGS="$CFLAGS --param ssp-buffer-size=1" 198 CFLAGS_ac="${CFLAGS_ac} --param ssp-buffer-size=1"
189 LDFLAGS="$LDFLAGS -pie" 199 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
200 LDFLAGS_ac="${LDFLAGS_ac} -pie"
201 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
190 ])]) 202 ])])
191 203
192# Linker hardening options 204# Linker hardening options
@@ -194,7 +206,8 @@ AC_ARG_ENABLE([gcc-hardening],
194AC_ARG_ENABLE([linker-hardening], 206AC_ARG_ENABLE([linker-hardening],
195 [AS_HELP_STRING([--enable-linker-hardening], [enable linker security fixups])], 207 [AS_HELP_STRING([--enable-linker-hardening], [enable linker security fixups])],
196[AS_IF([test x$enableval = xyes], 208[AS_IF([test x$enableval = xyes],
197 [LDFLAGS="$LDFLAGS -z relro -z now"])]) 209 [LDFLAGS_ac="${LDFLAGS_ac} -z relro -z now"])])
210LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
198 211
199 212
200# Workaround for libgcrypt 213# Workaround for libgcrypt
@@ -316,9 +329,8 @@ AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]],
316 329
317AX_CHECK_COMPILE_FLAG([[-Werror=attributes]], 330AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
318 [ 331 [
319 save_CFLAGS="$CFLAGS"
320 CFLAGS="$CFLAGS -Werror=attributes"
321 AC_MSG_CHECKING([[whether -Werror=attributes actually works]]) 332 AC_MSG_CHECKING([[whether -Werror=attributes actually works]])
333 CFLAGS="${CFLAGS_ac} ${user_CFLAGS} -Werror=attributes"
322 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 334 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
323 [[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])], 335 [[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])],
324 [ 336 [
@@ -328,12 +340,11 @@ AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
328 AC_MSG_RESULT([[yes]]) 340 AC_MSG_RESULT([[yes]])
329 errattr_CFLAGS="-Werror=attributes" 341 errattr_CFLAGS="-Werror=attributes"
330 ]) 342 ])
331 CFLAGS="$save_CFLAGS" 343 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
332 ], 344 ],
333 [[errattr_CFLAGS=""]], [], []) 345 [[errattr_CFLAGS=""]], [], [])
334AC_MSG_CHECKING([[for function inline keywords supported by $CC]]) 346AC_MSG_CHECKING([[for function inline keywords supported by $CC]])
335save_CFLAGS="$CFLAGS" 347CFLAGS="${CFLAGS_ac} ${user_CFLAGS} $errattr_CFLAGS"
336CFLAGS="$CFLAGS $errattr_CFLAGS"
337inln_prfx="none" 348inln_prfx="none"
338# Prefer always inline functions 349# Prefer always inline functions
339for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline 350for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline
@@ -382,7 +393,7 @@ AS_IF([[test "x$inln_prfx" != "xnone"]],
382 AC_DEFINE([_MHD_static_inline],[static],[Define to prefix which will be used with MHD static inline functions.]) 393 AC_DEFINE([_MHD_static_inline],[static],[Define to prefix which will be used with MHD static inline functions.])
383 ]) 394 ])
384AC_MSG_RESULT([[$inln_prfx]]) 395AC_MSG_RESULT([[$inln_prfx]])
385CFLAGS="$save_CFLAGS" 396CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
386 397
387AC_CHECK_HEADERS([stdalign.h], [], [], [AC_INCLUDES_DEFAULT]) 398AC_CHECK_HEADERS([stdalign.h], [], [], [AC_INCLUDES_DEFAULT])
388AC_CACHE_CHECK([[for C11 'alignof()' support]], [[mhd_cv_c_alignof]], 399AC_CACHE_CHECK([[for C11 'alignof()' support]], [[mhd_cv_c_alignof]],
@@ -433,7 +444,7 @@ AC_MSG_CHECKING([[for target host OS]])
433AS_CASE(["$host_os"], 444AS_CASE(["$host_os"],
434 [*darwin* | *rhapsody* | *macosx*], 445 [*darwin* | *rhapsody* | *macosx*],
435 [AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system]) 446 [AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
436 CFLAGS="-no-cpp-precomp -fno-common $CFLAGS" 447 CFLAGS_ac="-no-cpp-precomp -fno-common $CFLAGS_ac"
437 mhd_host_os='Darwin' 448 mhd_host_os='Darwin'
438 AC_MSG_RESULT([[$mhd_host_os]])], 449 AC_MSG_RESULT([[$mhd_host_os]])],
439 [freebsd*], 450 [freebsd*],
@@ -456,13 +467,13 @@ AS_CASE(["$host_os"],
456 AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno does not work]) 467 AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno does not work])
457 mhd_host_os='Solaris' 468 mhd_host_os='Solaris'
458 AC_MSG_RESULT([[$mhd_host_os]]) 469 AC_MSG_RESULT([[$mhd_host_os]])
459 AC_SEARCH_LIBS(gethostbyname, nsl) 470 AC_SEARCH_LIBS([gethostbyname], [nsl])
460 AC_SEARCH_LIBS(socket, socket)], 471 AC_SEARCH_LIBS([socket], [socket])],
461 [*arm-linux*], 472 [*arm-linux*],
462 [AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) 473 [AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
463 mhd_host_os='ARM Linux' 474 mhd_host_os='ARM Linux'
464 AC_MSG_RESULT([[$mhd_host_os]]) 475 AC_MSG_RESULT([[$mhd_host_os]])
465 CFLAGS="-fPIC -pipe $CFLAGS"], 476 CFLAGS_ac="-fPIC -pipe $CFLAGS_ac"],
466 [*linux*], 477 [*linux*],
467 [AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) 478 [AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
468 mhd_host_os='Linux' 479 mhd_host_os='Linux'
@@ -478,7 +489,7 @@ AS_CASE(["$host_os"],
478 AC_DEFINE([WINDOWS],[1],[This is a Windows system]) 489 AC_DEFINE([WINDOWS],[1],[This is a Windows system])
479 mhd_host_os='Windows/MinGW' 490 mhd_host_os='Windows/MinGW'
480 AC_MSG_RESULT([[$mhd_host_os]]) 491 AC_MSG_RESULT([[$mhd_host_os]])
481 LIBS="$LIBS -lws2_32" 492 LIBS="-lws2_32 ${LIBS}"
482 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT]) 493 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT])
483 AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool], 494 AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool],
484 [mslibcheck=`lib 2>&1` 495 [mslibcheck=`lib 2>&1`
@@ -654,7 +665,8 @@ choke me now;
654 ], [ 665 ], [
655 mhd_w32_ver="Vista" 666 mhd_w32_ver="Vista"
656 mhd_w32_ver_msg="Vista (default, override by CPPFLAGS=-D_WIN32_WINNT=0xNNNN)" 667 mhd_w32_ver_msg="Vista (default, override by CPPFLAGS=-D_WIN32_WINNT=0xNNNN)"
657 CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" 668 CPPFLAGS_ac="${CPPFLAGS_ac} -D_WIN32_WINNT=0x0600"
669 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
658 AC_MSG_CHECKING([[whether headers accept _WIN32_WINNT=0x0600]]) 670 AC_MSG_CHECKING([[whether headers accept _WIN32_WINNT=0x0600]])
659 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 671 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
660#ifdef HAVE_SDKDDKVER_H 672#ifdef HAVE_SDKDDKVER_H
@@ -711,13 +723,14 @@ int main(void)
711 mhd_host_os="${mhd_host_os}-${mhd_cv_wctr_type}" 723 mhd_host_os="${mhd_host_os}-${mhd_cv_wctr_type}"
712 AS_VAR_IF([mhd_cv_wctr_type], ["msvcrt"], 724 AS_VAR_IF([mhd_cv_wctr_type], ["msvcrt"],
713 [ 725 [
714 AX_APPEND_COMPILE_FLAGS([-U__USE_MINGW_ANSI_STDIO -D__USE_MINGW_ANSI_STDIO=0], [CPPFLAGS]) 726 # Use CFLAGS here to override user-supplied wrong CPPFLAGS. Durty trick, but choice is limited.
727 AX_APPEND_COMPILE_FLAGS([-U__USE_MINGW_ANSI_STDIO -D__USE_MINGW_ANSI_STDIO=0], [CFLAGS_ac])
715 AC_SUBST([W32CRT], [MSVCRT]) 728 AC_SUBST([W32CRT], [MSVCRT])
716 ], [AC_SUBST([W32CRT], [UCRT])] 729 ], [AC_SUBST([W32CRT], [UCRT])]
717 ) 730 )
718 ] 731 ]
719) 732)
720 733CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
721 734
722 735
723AC_ARG_WITH([threads], 736AC_ARG_WITH([threads],
@@ -743,9 +756,8 @@ AX_PTHREAD(
743 AC_CACHE_CHECK([[whether pthread_sigmask(3) is available]], 756 AC_CACHE_CHECK([[whether pthread_sigmask(3) is available]],
744 [[mhd_cv_func_pthread_sigmask]], [dnl 757 [[mhd_cv_func_pthread_sigmask]], [dnl
745 save_LIBS="$LIBS" 758 save_LIBS="$LIBS"
746 save_CFLAGS="$CFLAGS"
747 LIBS="$PTHREAD_LIBS $LIBS" 759 LIBS="$PTHREAD_LIBS $LIBS"
748 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 760 CFLAGS="${CFLAGS_ac} ${PTHREAD_CFLAGS} ${user_CFLAGS}"
749 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], 761 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
750 [[ 762 [[
751 sigset_t nset, oset; 763 sigset_t nset, oset;
@@ -755,7 +767,7 @@ AX_PTHREAD(
755 ]])], 767 ]])],
756 [[mhd_cv_func_pthread_sigmask="yes"]],[[mhd_cv_func_pthread_sigmask="no"]]) 768 [[mhd_cv_func_pthread_sigmask="yes"]],[[mhd_cv_func_pthread_sigmask="no"]])
757 LIBS="${save_LIBS}" 769 LIBS="${save_LIBS}"
758 CFLAGS="${save_CFLAGS}" 770 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
759 ]) 771 ])
760 AS_VAR_IF([mhd_cv_func_pthread_sigmask],["yes"], 772 AS_VAR_IF([mhd_cv_func_pthread_sigmask],["yes"],
761 [AC_DEFINE([[HAVE_PTHREAD_SIGMASK]],[[1]],[Define to 1 if you have the pthread_sigmask(3) function.])]) 773 [AC_DEFINE([[HAVE_PTHREAD_SIGMASK]],[[1]],[Define to 1 if you have the pthread_sigmask(3) function.])])
@@ -827,9 +839,8 @@ AS_IF([test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"]
827 # Check for thread name function 839 # Check for thread name function
828 HAVE_THREAD_NAME_FUNC="no" 840 HAVE_THREAD_NAME_FUNC="no"
829 SAVE_LIBS="$LIBS" 841 SAVE_LIBS="$LIBS"
830 SAVE_CFLAGS="$CFLAGS"
831 LIBS="$PTHREAD_LIBS $LIBS" 842 LIBS="$PTHREAD_LIBS $LIBS"
832 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 843 CFLAGS="${CFLAGS_ac} $PTHREAD_CFLAGS ${user_CFLAGS}"
833 AC_CHECK_HEADERS([pthread_np.h],[],[], 844 AC_CHECK_HEADERS([pthread_np.h],[],[],
834 [ 845 [
835AC_INCLUDES_DEFAULT 846AC_INCLUDES_DEFAULT
@@ -978,7 +989,7 @@ AC_INCLUDES_DEFAULT
978 ]) 989 ])
979 990
980 LIBS="$SAVE_LIBS" 991 LIBS="$SAVE_LIBS"
981 CFLAGS="$SAVE_CFLAGS" 992 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
982]) 993])
983 994
984AS_IF([[test "x$enable_thread_names" != "xno"]], 995AS_IF([[test "x$enable_thread_names" != "xno"]],
@@ -1066,7 +1077,8 @@ AC_CHECK_FUNCS([writev])
1066# use '-fno-strict-aliasing', but only if the compiler 1077# use '-fno-strict-aliasing', but only if the compiler
1067# and linker can take it 1078# and linker can take it
1068AX_CHECK_LINK_FLAG([-fno-strict-aliasing], 1079AX_CHECK_LINK_FLAG([-fno-strict-aliasing],
1069 [AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])]) 1080 [AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [CFLAGS_ac])])
1081CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
1070 1082
1071AC_C_BIGENDIAN 1083AC_C_BIGENDIAN
1072AC_C_VARARRAYS 1084AC_C_VARARRAYS
@@ -1207,8 +1219,7 @@ fd = epoll_create1(EPOLL_CLOEXEC);]])],
1207AC_CACHE_CHECK([for suported 'noreturn' keyword], [mhd_cv_decl_noreturn], 1219AC_CACHE_CHECK([for suported 'noreturn' keyword], [mhd_cv_decl_noreturn],
1208 [ 1220 [
1209 mhd_cv_decl_noreturn="none" 1221 mhd_cv_decl_noreturn="none"
1210 save_CFLAGS="${CFLAGS}" 1222 CFLAGS="${CFLAGS_ac} ${user_CFLAGS} ${errattr_CFLAGS}"
1211 CFLAGS="${CFLAGS} ${errattr_CFLAGS}"
1212 for decl_noret in '_Noreturn' '__attribute__((__noreturn__))' '__declspec(noreturn)' 1223 for decl_noret in '_Noreturn' '__attribute__((__noreturn__))' '__declspec(noreturn)'
1213 do 1224 do
1214 AC_LINK_IFELSE([AC_LANG_SOURCE( 1225 AC_LINK_IFELSE([AC_LANG_SOURCE(
@@ -1238,7 +1249,7 @@ int main (int argc, char *const *argv)
1238 ) 1249 )
1239 AS_IF([test "x${mhd_cv_decl_noreturn}" != "xnone"], [break]) 1250 AS_IF([test "x${mhd_cv_decl_noreturn}" != "xnone"], [break])
1240 done 1251 done
1241 CFLAGS="${save_CFLAGS}" 1252 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
1242 ] 1253 ]
1243) 1254)
1244AS_VAR_IF([mhd_cv_decl_noreturn], ["none"], 1255AS_VAR_IF([mhd_cv_decl_noreturn], ["none"],
@@ -1975,7 +1986,7 @@ AS_CASE(["$host"],
1975 [defines how to decorate public symbols while building]) 1986 [defines how to decorate public symbols while building])
1976 HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])]) 1987 HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])])
1977 ]) 1988 ])
1978AC_SUBST(HIDDEN_VISIBILITY_CFLAGS) 1989AC_SUBST([HIDDEN_VISIBILITY_CFLAGS])
1979 1990
1980# libcurl (required for testing) 1991# libcurl (required for testing)
1981AC_ARG_ENABLE([curl], 1992AC_ARG_ENABLE([curl],
@@ -2002,7 +2013,7 @@ AM_CONDITIONAL([HAVE_CURL], [test "x$enable_curl" = "xyes"])
2002 2013
2003mhd_have_libmagic="no" 2014mhd_have_libmagic="no"
2004SAVE_LIBS="$LIBS" 2015SAVE_LIBS="$LIBS"
2005LIBS="$LIBS -lmagic" 2016LIBS="-lmagic $LIBS"
2006AC_MSG_CHECKING([[for suitable libmagic]]) 2017AC_MSG_CHECKING([[for suitable libmagic]])
2007AC_LINK_IFELSE( 2018AC_LINK_IFELSE(
2008 [AC_LANG_PROGRAM( 2019 [AC_LANG_PROGRAM(
@@ -2172,7 +2183,7 @@ AS_VAR_IF([[found_sendfile]], [["no"]],
2172 [ 2183 [
2173 AC_MSG_CHECKING([[for Solaris-style sendfile(3)]]) 2184 AC_MSG_CHECKING([[for Solaris-style sendfile(3)]])
2174 SAVE_LIBS="$LIBS" 2185 SAVE_LIBS="$LIBS"
2175 LIBS="$LIBS -lsendfile" 2186 LIBS="-lsendfile $LIBS"
2176 AC_LINK_IFELSE( 2187 AC_LINK_IFELSE(
2177 [AC_LANG_PROGRAM( 2188 [AC_LANG_PROGRAM(
2178 [[ 2189 [[
@@ -2286,12 +2297,9 @@ AC_ARG_WITH([[gnutls]],
2286 ], 2297 ],
2287 [ 2298 [
2288 AC_MSG_RESULT([[-I$with_gnutls/include -L$with_gnutls/lib -lgnutls]]) 2299 AC_MSG_RESULT([[-I$with_gnutls/include -L$with_gnutls/lib -lgnutls]])
2289 SAVE_LDFLAGS="$LDFLAGS"
2290 SAVE_CPPFLAGS="$CPPFLAGS"
2291 SAVE_CFLAGS="$CFLAGS"
2292 SAVE_LIBS="$LIBS" 2300 SAVE_LIBS="$LIBS"
2293 LDFLAGS="-L$with_gnutls/lib $LDFLAGS" 2301 LDFLAGS="${LDFLAGS_ac} -L$with_gnutls/lib ${user_LDFLAGS}"
2294 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" 2302 CPPFLAGS="${CPPFLAGS_ac} -I$with_gnutls/include ${user_CPPFLAGS}"
2295 have_gnutls_pkgcfg=no 2303 have_gnutls_pkgcfg=no
2296 AC_CHECK_HEADERS([gnutls/gnutls.h], 2304 AC_CHECK_HEADERS([gnutls/gnutls.h],
2297 [AC_CHECK_LIB([gnutls], [gnutls_priority_set], 2305 [AC_CHECK_LIB([gnutls], [gnutls_priority_set],
@@ -2302,9 +2310,9 @@ AC_ARG_WITH([[gnutls]],
2302 have_gnutls=yes 2310 have_gnutls=yes
2303 ])], [], [AC_INCLUDES_DEFAULT]) 2311 ])], [], [AC_INCLUDES_DEFAULT])
2304 AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])]) 2312 AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])])
2305 CPPFLAGS="$SAVE_CPPFLAGS" 2313 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
2306 CFLAGS="$SAVE_CFLAGS" 2314 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
2307 LDFLAGS="$SAVE_LDFLAGS" 2315 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
2308 LIBS="$SAVE_LIBS" 2316 LIBS="$SAVE_LIBS"
2309 ]) 2317 ])
2310 ], 2318 ],
@@ -2357,12 +2365,9 @@ choke me now
2357 PKG_CHECK_MODULES(GNUTLS, [[gnutls]], 2365 PKG_CHECK_MODULES(GNUTLS, [[gnutls]],
2358 [ 2366 [
2359 have_gnutls_pkgcfg='yes' 2367 have_gnutls_pkgcfg='yes'
2360 SAVE_CPPFLAGS="$CPPFLAGS"
2361 SAVE_CFLAGS="$CFLAGS"
2362 SAVE_LDFLAGS="$LDFLAGS"
2363 SAVE_LIBS="$LIBS" 2368 SAVE_LIBS="$LIBS"
2364 CFLAGS="$GNUTLS_CFLAGS $CFLAGS" 2369 CFLAGS="${CFLAGS_ac} $GNUTLS_CFLAGS ${user_CFLAGS}"
2365 LIBS="$LIBS $GNUTLS_LIBS" 2370 LIBS="$GNUTLS_LIBS $LIBS"
2366 AC_MSG_CHECKING([[whether GnuTLS is usable]]) 2371 AC_MSG_CHECKING([[whether GnuTLS is usable]])
2367 AC_LINK_IFELSE([ 2372 AC_LINK_IFELSE([
2368 AC_LANG_PROGRAM([[ 2373 AC_LANG_PROGRAM([[
@@ -2380,7 +2385,7 @@ choke me now
2380 have_gnutls=yes 2385 have_gnutls=yes
2381 # GNUTLS_CFLAGS is actually CPPFLAGS 2386 # GNUTLS_CFLAGS is actually CPPFLAGS
2382 GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS" 2387 GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS"
2383 # GNUTLS_CFLAGS is combination of LDFLAGS and LIBS 2388 # GNUTLS_LDFLAGS is a combination of LDFLAGS and LIBS
2384 GNUTLS_LDFLAGS="$GNUTLS_LIBS" 2389 GNUTLS_LDFLAGS="$GNUTLS_LIBS"
2385 ], 2390 ],
2386 [ 2391 [
@@ -2397,9 +2402,9 @@ choke me now
2397 AS_UNSET([GNUTLS_LIBS]) 2402 AS_UNSET([GNUTLS_LIBS])
2398 ] 2403 ]
2399 ) 2404 )
2400 CPPFLAGS="$SAVE_CPPFLAGS" 2405 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
2401 CFLAGS="$SAVE_CFLAGS" 2406 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
2402 LDFLAGS="$SAVE_LDFLAGS" 2407 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
2403 LIBS="$SAVE_LIBS" 2408 LIBS="$SAVE_LIBS"
2404 ], 2409 ],
2405 [ 2410 [
@@ -2420,16 +2425,13 @@ AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"],
2420 AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) 2425 AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no])
2421 AS_IF([[test "x$have_gcrypt" = "xyes"]], 2426 AS_IF([[test "x$have_gcrypt" = "xyes"]],
2422 [ 2427 [
2423 SAVE_CPPFLAGS="$CPPFLAGS"
2424 SAVE_CFLAGS="$CFLAGS"
2425 SAVE_LIBS="$LIBS" 2428 SAVE_LIBS="$LIBS"
2426 SAVE_LDFLAGS="$LDFLAGS" 2429 CFLAGS="${CFLAGS_ac} $LIBGCRYPT_CFLAGS ${user_CFLAGS}"
2427 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
2428 # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both 2430 # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both
2429 CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" 2431 CPPFLAGS="${CPPFLAGS_ac} $LIBGCRYPT_CFLAGS ${user_CPPFLAGS}"
2430 AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT]) 2432 AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT])
2431 # Check for GnuTLS with gcrypt flags 2433 # Check for GnuTLS with gcrypt flags
2432 LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" 2434 LDFLAGS="${LDFLAGS_ac} ${LIBGCRYPT_LIBS} ${user_LDFLAGS}"
2433 # A bit of hack: unset cache variable to force recheck 2435 # A bit of hack: unset cache variable to force recheck
2434 AS_UNSET([ac_cv_header_gnutls_gnutls_h]) 2436 AS_UNSET([ac_cv_header_gnutls_gnutls_h])
2435 AC_CHECK_HEADERS([gnutls/gnutls.h], 2437 AC_CHECK_HEADERS([gnutls/gnutls.h],
@@ -2442,9 +2444,9 @@ AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"],
2442 GNUTLS_LIBS="-lgnutls" 2444 GNUTLS_LIBS="-lgnutls"
2443 have_gnutls=yes 2445 have_gnutls=yes
2444 ])], [], [AC_INCLUDES_DEFAULT]) 2446 ])], [], [AC_INCLUDES_DEFAULT])
2445 CPPFLAGS="$SAVE_CPPFLAGS" 2447 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
2446 CFLAGS="$SAVE_CFLAGS" 2448 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
2447 LDFLAGS="$SAVE_LDFLAGS" 2449 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
2448 LIBS="$SAVE_LIBS" 2450 LIBS="$SAVE_LIBS"
2449 ] 2451 ]
2450 ) 2452 )
@@ -2455,14 +2457,11 @@ AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"],
2455 2457
2456 AS_IF([test "x$have_gnutls" = "xyes"], 2458 AS_IF([test "x$have_gnutls" = "xyes"],
2457 [ 2459 [
2458 SAVE_CPPFLAGS="$CPPFLAGS"
2459 SAVE_CFLAGS="$CFLAGS"
2460 SAVE_LDFLAGS="$LDFLAGS"
2461 SAVE_LIBS="$LIBS" 2460 SAVE_LIBS="$LIBS"
2462 CPPFLAGS="$GNUTLS_CPPFLAGS $CPPFLAGS" 2461 CPPFLAGS="${CPPFLAGS_ac} ${GNUTLS_CPPFLAGS} ${user_CPPFLAGS}"
2463 CFLAGS="$GNUTLS_CFLAGS $CFLAGS" 2462 CFLAGS="${CFLAGS_ac} ${GNUTLS_CFLAGS} ${user_CFLAGS}"
2464 LDFLAGS="$GNUTLS_LDFLAGS $LDFLAGS" 2463 LDFLAGS="${LDFLAGS_ac} ${GNUTLS_LDFLAGS} ${user_LDFLAGS}"
2465 LIBS="$LIBS $GNUTLS_LIBS" 2464 LIBS="$GNUTLS_LIBS $LIBS"
2466 AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]]) 2465 AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]])
2467 AC_LINK_IFELSE([ 2466 AC_LINK_IFELSE([
2468 AC_LANG_PROGRAM([[ 2467 AC_LANG_PROGRAM([[
@@ -2502,9 +2501,9 @@ choke me now
2502 ) 2501 )
2503 ] 2502 ]
2504 ) 2503 )
2505 CPPFLAGS="$SAVE_CPPFLAGS" 2504 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
2506 CFLAGS="$SAVE_CFLAGS" 2505 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
2507 LDFLAGS="$SAVE_LDFLAGS" 2506 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
2508 LIBS="$SAVE_LIBS" 2507 LIBS="$SAVE_LIBS"
2509 ], 2508 ],
2510 [ 2509 [
@@ -2518,14 +2517,12 @@ choke me now
2518 AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) 2517 AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no])
2519 AS_IF([[test "x$have_gcrypt" = "xyes"]], 2518 AS_IF([[test "x$have_gcrypt" = "xyes"]],
2520 [ 2519 [
2521 SAVE_CPPFLAGS="$CPPFLAGS" 2520 CFLAGS="${CFLAGS_ac} ${LIBGCRYPT_CFLAGS} ${user_CFLAGS}"
2522 SAVE_CFLAGS="$CFLAGS"
2523 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
2524 # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both 2521 # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both
2525 CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" 2522 CPPFLAGS="${CPPFLAGS_ac} ${LIBGCRYPT_CFLAGS} ${user_CPPFLAGS}"
2526 AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT]) 2523 AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT])
2527 CPPFLAGS="$SAVE_CPPFLAGS" 2524 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
2528 CFLAGS="$SAVE_CFLAGS" 2525 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
2529 ] 2526 ]
2530 ) 2527 )
2531 ] 2528 ]
@@ -2975,11 +2972,10 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
2975 [ 2972 [
2976 AS_UNSET([san_FLAGS]) # the sanitizer flags to be added to both CFLAGS and LDFLAGS 2973 AS_UNSET([san_FLAGS]) # the sanitizer flags to be added to both CFLAGS and LDFLAGS
2977 AS_UNSET([san_CFLAGS]) # the sanitizer flags to be added to CFLAGS 2974 AS_UNSET([san_CFLAGS]) # the sanitizer flags to be added to CFLAGS
2978 saved_CFLAGS="$CFLAGS"
2979 AC_CACHE_CHECK([whether '-fsanitize=' works for $CC], 2975 AC_CACHE_CHECK([whether '-fsanitize=' works for $CC],
2980 [mhd_cv_cc_sanitizer_works], 2976 [mhd_cv_cc_sanitizer_works],
2981 [ 2977 [
2982 CFLAGS="${saved_CFLAGS} -fsanitize=wrongFeatureName" 2978 CFLAGS="${CFLAGS_ac} -fsanitize=wrongFeatureName ${user_CFLAGS}"
2983 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], 2979 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2984 [mhd_cv_cc_sanitizer_works=no], [mhd_cv_cc_sanitizer_works=yes]) 2980 [mhd_cv_cc_sanitizer_works=no], [mhd_cv_cc_sanitizer_works=yes])
2985 ] 2981 ]
@@ -2990,7 +2986,7 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
2990 [ 2986 [
2991 AC_CACHE_CHECK([for address sanitizer], [mhd_cv_cc_sanitizer_address], 2987 AC_CACHE_CHECK([for address sanitizer], [mhd_cv_cc_sanitizer_address],
2992 [ 2988 [
2993 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS} -fsanitize=address" 2989 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} -fsanitize=address ${user_CFLAGS}"
2994 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], 2990 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
2995 [mhd_cv_cc_sanitizer_address=yes], [mhd_cv_cc_sanitizer_address=no]) 2991 [mhd_cv_cc_sanitizer_address=yes], [mhd_cv_cc_sanitizer_address=no])
2996 ] 2992 ]
@@ -3004,7 +3000,7 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
3004 [ 3000 [
3005 AC_CACHE_CHECK([whether leak detect is not rejected by address sanitizer], [mhd_cv_cc_sanitizer_address_leak], 3001 AC_CACHE_CHECK([whether leak detect is not rejected by address sanitizer], [mhd_cv_cc_sanitizer_address_leak],
3006 [ 3002 [
3007 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS}" 3003 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} ${user_CFLAGS}"
3008 ASAN_OPTIONS="exitcode=88:detect_leaks=1:halt_on_error=1" 3004 ASAN_OPTIONS="exitcode=88:detect_leaks=1:halt_on_error=1"
3009 export ASAN_OPTIONS 3005 export ASAN_OPTIONS
3010 AC_RUN_IFELSE([AC_LANG_PROGRAM([],[])], 3006 AC_RUN_IFELSE([AC_LANG_PROGRAM([],[])],
@@ -3021,7 +3017,7 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
3021 ) 3017 )
3022 AC_CACHE_CHECK([for pointer compare sanitizer], [mhd_cv_cc_sanitizer_pointer_compare], 3018 AC_CACHE_CHECK([for pointer compare sanitizer], [mhd_cv_cc_sanitizer_pointer_compare],
3023 [ 3019 [
3024 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS} -fsanitize=pointer-compare" 3020 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} -fsanitize=pointer-compare ${user_CFLAGS}"
3025 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], 3021 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
3026 [mhd_cv_cc_sanitizer_pointer_compare=yes], [mhd_cv_cc_sanitizer_pointer_compare=no]) 3022 [mhd_cv_cc_sanitizer_pointer_compare=yes], [mhd_cv_cc_sanitizer_pointer_compare=no])
3027 ] 3023 ]
@@ -3034,7 +3030,7 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
3034 ) 3030 )
3035 AC_CACHE_CHECK([for pointer subtract sanitizer], [mhd_cv_cc_sanitizer_pointer_subtract], 3031 AC_CACHE_CHECK([for pointer subtract sanitizer], [mhd_cv_cc_sanitizer_pointer_subtract],
3036 [ 3032 [
3037 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS} -fsanitize=pointer-subtract" 3033 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} -fsanitize=pointer-subtract ${user_CFLAGS}"
3038 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], 3034 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
3039 [mhd_cv_cc_sanitizer_pointer_subtract=yes], [mhd_cv_cc_sanitizer_pointer_subtract=no]) 3035 [mhd_cv_cc_sanitizer_pointer_subtract=yes], [mhd_cv_cc_sanitizer_pointer_subtract=no])
3040 ] 3036 ]
@@ -3054,7 +3050,7 @@ AS_VAR_IF([enable_sanitizers], ["no"], [:],
3054 [ 3050 [
3055 ASAN_OPTIONS="exitcode=88:detect_invalid_pointer_pairs=3:halt_on_error=1" 3051 ASAN_OPTIONS="exitcode=88:detect_invalid_pointer_pairs=3:halt_on_error=1"
3056 export ASAN_OPTIONS 3052 export ASAN_OPTIONS
3057 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS} ${errattr_CFLAGS}" 3053 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} ${errattr_CFLAGS} ${user_CFLAGS}"
3058 AC_RUN_IFELSE( 3054 AC_RUN_IFELSE(
3059 [ 3055 [
3060 AC_LANG_PROGRAM( 3056 AC_LANG_PROGRAM(
@@ -3100,7 +3096,7 @@ int ptr_process(void *ptr1, void *ptr2)
3100 [ 3096 [
3101 ASAN_OPTIONS="exitcode=88:detect_invalid_pointer_pairs=3:halt_on_error=1" 3097 ASAN_OPTIONS="exitcode=88:detect_invalid_pointer_pairs=3:halt_on_error=1"
3102 export ASAN_OPTIONS 3098 export ASAN_OPTIONS
3103 CFLAGS="${saved_CFLAGS} ${san_CFLAGS} ${san_FLAGS} ${errattr_CFLAGS}" 3099 CFLAGS="${CFLAGS_ac} ${san_CFLAGS} ${san_FLAGS} ${errattr_CFLAGS} ${user_CFLAGS}"
3104 AC_RUN_IFELSE( 3100 AC_RUN_IFELSE(
3105 [ 3101 [
3106 AC_LANG_PROGRAM( 3102 AC_LANG_PROGRAM(
@@ -3194,7 +3190,7 @@ int main(void)
3194 ] 3190 ]
3195 AC_CACHE_CHECK([for undefined behavior sanitizer], [mhd_cv_cc_sanitizer_undefined], 3191 AC_CACHE_CHECK([for undefined behavior sanitizer], [mhd_cv_cc_sanitizer_undefined],
3196 [ 3192 [
3197 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined" 3193 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined ${user_CFLAGS}"
3198 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])], 3194 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])],
3199 [mhd_cv_cc_sanitizer_undefined=yes], [mhd_cv_cc_sanitizer_undefined=no]) 3195 [mhd_cv_cc_sanitizer_undefined=yes], [mhd_cv_cc_sanitizer_undefined=no])
3200 ] 3196 ]
@@ -3207,7 +3203,7 @@ int main(void)
3207 [ 3203 [
3208 AC_CACHE_CHECK([for undefined behavior sanitizer with '-fsanitize-undefined-trap-on-error'], [mhd_cv_cc_sanitizer_undefined_trap], 3204 AC_CACHE_CHECK([for undefined behavior sanitizer with '-fsanitize-undefined-trap-on-error'], [mhd_cv_cc_sanitizer_undefined_trap],
3209 [ 3205 [
3210 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-undefined-trap-on-error" 3206 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-undefined-trap-on-error ${user_CFLAGS}"
3211 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])], 3207 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])],
3212 [mhd_cv_cc_sanitizer_undefined_trap=yes], [mhd_cv_cc_sanitizer_undefined_trap=no]) 3208 [mhd_cv_cc_sanitizer_undefined_trap=yes], [mhd_cv_cc_sanitizer_undefined_trap=no])
3213 ] 3209 ]
@@ -3225,7 +3221,7 @@ int main(void)
3225 # Last resort 3221 # Last resort
3226 AC_CACHE_CHECK([for undefined behavior sanitizer with '-fsanitize-trap=all'], [mhd_cv_cc_sanitizer_undefined_trap_all], 3222 AC_CACHE_CHECK([for undefined behavior sanitizer with '-fsanitize-trap=all'], [mhd_cv_cc_sanitizer_undefined_trap_all],
3227 [ 3223 [
3228 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-trap=all" 3224 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-trap=all ${user_CFLAGS}"
3229 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])], 3225 AC_LINK_IFELSE([AC_LANG_SOURCE([${test_undf_prog}])],
3230 [mhd_cv_cc_sanitizer_undefined_trap_all=yes], [mhd_cv_cc_sanitizer_undefined_trap_all=no]) 3226 [mhd_cv_cc_sanitizer_undefined_trap_all=yes], [mhd_cv_cc_sanitizer_undefined_trap_all=no])
3231 ] 3227 ]
@@ -3234,7 +3230,7 @@ int main(void)
3234 [ 3230 [
3235 AX_APPEND_FLAG([-fsanitize=undefined], [san_FLAGS]) 3231 AX_APPEND_FLAG([-fsanitize=undefined], [san_FLAGS])
3236 AX_APPEND_FLAG([-fsanitize-trap=all], [san_FLAGS]) 3232 AX_APPEND_FLAG([-fsanitize-trap=all], [san_FLAGS])
3237 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-trap=all" 3233 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} -fsanitize=undefined -fsanitize-trap=all ${user_CFLAGS}"
3238 enabled_sanitizers="${enabled_sanitizers}${enabled_sanitizers:+, }undefined" 3234 enabled_sanitizers="${enabled_sanitizers}${enabled_sanitizers:+, }undefined"
3239 AC_MSG_WARN([Enabled sanitizer without run-time library, error reporting will be limited]) 3235 AC_MSG_WARN([Enabled sanitizer without run-time library, error reporting will be limited])
3240 ] 3236 ]
@@ -3251,12 +3247,12 @@ int main(void)
3251 [ 3247 [
3252 # A workaround for broken clang which is trying to use UBSan lib 3248 # A workaround for broken clang which is trying to use UBSan lib
3253 # even when instructed to not use it 3249 # even when instructed to not use it
3254 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS}" 3250 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} ${user_CFLAGS}"
3255 AX_APPEND_LINK_FLAGS([-fsanitize-trap=implicit-conversion], 3251 AX_APPEND_LINK_FLAGS([-fsanitize-trap=implicit-conversion],
3256 [san_FLAGS], [], [AC_LANG_SOURCE([${test_undf_prog}])]) 3252 [san_FLAGS], [], [AC_LANG_SOURCE([${test_undf_prog}])])
3257 ] 3253 ]
3258 ) 3254 )
3259 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS}" 3255 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} ${user_CFLAGS}"
3260 AX_APPEND_LINK_FLAGS([-fsanitize=bounds-strict -fsanitize=local-bounds -fsanitize=implicit-conversion -fsanitize=nullability-arg], 3256 AX_APPEND_LINK_FLAGS([-fsanitize=bounds-strict -fsanitize=local-bounds -fsanitize=implicit-conversion -fsanitize=nullability-arg],
3261 [san_CFLAGS], [], [AC_LANG_SOURCE([${test_undf_prog}])]) 3257 [san_CFLAGS], [], [AC_LANG_SOURCE([${test_undf_prog}])])
3262 ] 3258 ]
@@ -3275,7 +3271,7 @@ int main(void)
3275 [ 3271 [
3276 AC_CACHE_CHECK([for leak sanitizer], [mhd_cv_cc_sanitizer_leak], 3272 AC_CACHE_CHECK([for leak sanitizer], [mhd_cv_cc_sanitizer_leak],
3277 [ 3273 [
3278 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS} -fsanitize=leak" 3274 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} -fsanitize=leak ${user_CFLAGS}"
3279 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], 3275 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
3280 [mhd_cv_cc_sanitizer_leak=yes], [mhd_cv_cc_sanitizer_leak=no]) 3276 [mhd_cv_cc_sanitizer_leak=yes], [mhd_cv_cc_sanitizer_leak=no])
3281 ] 3277 ]
@@ -3320,14 +3316,14 @@ int main(void)
3320 AS_VAR_IF([mhd_cv_cc_sanitizer_address],["yes"], 3316 AS_VAR_IF([mhd_cv_cc_sanitizer_address],["yes"],
3321 [ 3317 [
3322 AX_APPEND_FLAG([-D_FORTIFY_SOURCE=0], [san_CFLAGS]) 3318 AX_APPEND_FLAG([-D_FORTIFY_SOURCE=0], [san_CFLAGS])
3323 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS}" 3319 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} ${user_CFLAGS}"
3324 AX_APPEND_COMPILE_FLAGS([-Wp,-U_FORTIFY_SOURCE], [san_CFLAGS]) 3320 AX_APPEND_COMPILE_FLAGS([-Wp,-U_FORTIFY_SOURCE], [san_CFLAGS])
3325 ], 3321 ],
3326 [AC_MSG_WARN([$CC does not support address sanitizer])] 3322 [AC_MSG_WARN([$CC does not support address sanitizer])]
3327 ) 3323 )
3328 ] 3324 ]
3329 ) 3325 )
3330 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS}" 3326 CFLAGS="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS} ${user_CFLAGS}"
3331 # Always stop on sanitizer error 3327 # Always stop on sanitizer error
3332 AX_APPEND_COMPILE_FLAGS([-fno-sanitize-recover=all], [san_CFLAGS]) 3328 AX_APPEND_COMPILE_FLAGS([-fno-sanitize-recover=all], [san_CFLAGS])
3333 # Get a better output for sanitizers error reporting 3329 # Get a better output for sanitizers error reporting
@@ -3358,8 +3354,8 @@ UBSAN_OPTIONS="$(AM_UBSAN_OPTIONS)" ; export UBSAN_OPTIONS ; \
3358LSAN_OPTIONS="$(AM_LSAN_OPTIONS)" ; export LSAN_OPTIONS ;' 3354LSAN_OPTIONS="$(AM_LSAN_OPTIONS)" ; export LSAN_OPTIONS ;'
3359 ] 3355 ]
3360 ) 3356 )
3361 CFLAGS="${saved_CFLAGS} ${san_FLAGS} ${san_CFLAGS}" 3357 CFLAGS_ac="${CFLAGS_ac} ${san_FLAGS} ${san_CFLAGS}"
3362 AS_UNSET([saved_CFLAGS]) 3358 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
3363 ] 3359 ]
3364) 3360)
3365AM_CONDITIONAL([USE_SANITIZERS], 3361AM_CONDITIONAL([USE_SANITIZERS],
@@ -3387,9 +3383,19 @@ AC_SUBST(MHD_TLS_LIBDEPS)
3387AC_SUBST([MHD_REQ_PRIVATE]) 3383AC_SUBST([MHD_REQ_PRIVATE])
3388AC_SUBST([MHD_LIBDEPS_PKGCFG]) 3384AC_SUBST([MHD_LIBDEPS_PKGCFG])
3389 3385
3390AC_SUBST(CPPFLAGS) 3386# Restore flags as set by the user
3391AC_SUBST(LIBS) 3387CFLAGS="${user_CFLAGS}"
3392AC_SUBST(LDFLAGS) 3388LDFLAGS="${user_LDFLAGS}"
3389CPPFLAGS="${user_CPPFLAGS}"
3390AC_SUBST([CFLAGS])
3391AC_SUBST([LDFLAGS])
3392AC_SUBST([CPPFLAGS])
3393AC_SUBST([LIBS])
3394
3395# Configure-defined flags
3396AC_SUBST([CFLAGS_ac])
3397AC_SUBST([LDFLAGS_ac])
3398AC_SUBST([CPPFLAGS_ac])
3393 3399
3394# Used for 'po' directory staff 3400# Used for 'po' directory staff
3395AC_SUBST([ac_configure_args]) 3401AC_SUBST([ac_configure_args])
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index ee4c3ce6..1dc1b1d1 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -2,9 +2,12 @@
2SUBDIRS = . 2SUBDIRS = .
3 3
4AM_CPPFLAGS = \ 4AM_CPPFLAGS = \
5 -I$(top_srcdir)/src/include 5 -I$(top_srcdir)/src/include \
6 $(CPPFLAGS_ac)
6 7
7AM_CFLAGS = @LIBGCRYPT_CFLAGS@ 8AM_CFLAGS = $(CFLAGS_ac) @LIBGCRYPT_CFLAGS@
9
10AM_LDFLAGS = $(LDFLAGS_ac)
8 11
9if USE_COVERAGE 12if USE_COVERAGE
10 AM_CFLAGS += --coverage 13 AM_CFLAGS += --coverage
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 5098a1ce..c222b5db 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -3,9 +3,12 @@ SUBDIRS = .
3 3
4AM_CPPFLAGS = \ 4AM_CPPFLAGS = \
5 -I$(top_srcdir)/src/include \ 5 -I$(top_srcdir)/src/include \
6 $(CPPFLAGS_ac) \
6 -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" 7 -DDATA_DIR=\"$(top_srcdir)/src/datadir/\"
7 8
8AM_CFLAGS = @LIBGCRYPT_CFLAGS@ 9AM_CFLAGS = $(CFLAGS_ac) @LIBGCRYPT_CFLAGS@
10
11AM_LDFLAGS = $(LDFLAGS_ac)
9 12
10MHD_CPU_COUNT_DEF = -DMHD_CPU_COUNT=$(CPU_COUNT) 13MHD_CPU_COUNT_DEF = -DMHD_CPU_COUNT=$(CPU_COUNT)
11 14
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 18691572..ba52b740 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -2,9 +2,11 @@
2 2
3AM_CPPFLAGS = \ 3AM_CPPFLAGS = \
4 -I$(top_srcdir)/src/include \ 4 -I$(top_srcdir)/src/include \
5 -I$(top_srcdir)/src/microhttpd 5 $(CPPFLAGS_ac)
6 6
7AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) 7AM_CFLAGS = $(CFLAGS_ac) $(HIDDEN_VISIBILITY_CFLAGS)
8
9AM_LDFLAGS = $(LDFLAGS_ac)
8 10
9lib_LTLIBRARIES = \ 11lib_LTLIBRARIES = \
10 libmicrohttpd.la 12 libmicrohttpd.la
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am
index 40a9fb13..5d7839f1 100644
--- a/src/testcurl/Makefile.am
+++ b/src/testcurl/Makefile.am
@@ -5,21 +5,24 @@ EMPTY_ITEM =
5 5
6SUBDIRS = . 6SUBDIRS = .
7 7
8AM_CPPFLAGS = \
9 -I$(top_srcdir)/src/include \
10 -I$(top_srcdir)/src/microhttpd \
11 -DMHD_CPU_COUNT=$(CPU_COUNT) \
12 $(CPPFLAGS_ac) $(LIBCURL_CPPFLAGS)
13
14AM_CFLAGS = $(CFLAGS_ac) @LIBGCRYPT_CFLAGS@
15
16AM_LDFLAGS = $(LDFLAGS_ac)
17
8if USE_COVERAGE 18if USE_COVERAGE
9 AM_CFLAGS = -fprofile-arcs -ftest-coverage 19 AM_CFLAGS += -fprofile-arcs -ftest-coverage
10endif 20endif
11 21
12if ENABLE_HTTPS 22if ENABLE_HTTPS
13 SUBDIRS += https 23 SUBDIRS += https
14endif 24endif
15 25
16AM_CPPFLAGS = \
17-DMHD_CPU_COUNT=$(CPU_COUNT) \
18-I$(top_srcdir) \
19-I$(top_srcdir)/src/microhttpd \
20-I$(top_srcdir)/src/include \
21$(LIBCURL_CPPFLAGS)
22
23LDADD = \ 26LDADD = \
24 $(top_builddir)/src/microhttpd/libmicrohttpd.la \ 27 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
25 @LIBCURL@ 28 @LIBCURL@
diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am
index 6c2134dc..203cddac 100644
--- a/src/testcurl/https/Makefile.am
+++ b/src/testcurl/https/Makefile.am
@@ -3,18 +3,21 @@ EMPTY_ITEM =
3 3
4SUBDIRS = . 4SUBDIRS = .
5 5
6if USE_COVERAGE
7 AM_CFLAGS = --coverage
8endif
9
10.NOTPARALLEL: 6.NOTPARALLEL:
11 7
12MHD_CPU_COUNT_DEF = -DMHD_CPU_COUNT=$(CPU_COUNT)
13
14AM_CPPFLAGS = \ 8AM_CPPFLAGS = \
15 -I$(top_srcdir)/src/include \ 9 -I$(top_srcdir)/src/include \
16 -I$(top_srcdir)/src/microhttpd \ 10 -I$(top_srcdir)/src/microhttpd \
17 $(LIBCURL_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) 11 -DMHD_CPU_COUNT=$(CPU_COUNT) \
12 $(CPPFLAGS_ac) $(LIBCURL_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
13
14AM_CFLAGS = $(CFLAGS_ac) @LIBGCRYPT_CFLAGS@
15
16AM_LDFLAGS = $(LDFLAGS_ac)
17
18if USE_COVERAGE
19 AM_CFLAGS += --coverage
20endif
18 21
19LDADD = \ 22LDADD = \
20 $(top_builddir)/src/microhttpd/libmicrohttpd.la \ 23 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
@@ -83,8 +86,6 @@ test_https_get_parallel_SOURCES = \
83 tls_test_keys.h \ 86 tls_test_keys.h \
84 tls_test_common.h \ 87 tls_test_common.h \
85 tls_test_common.c 88 tls_test_common.c
86test_https_get_parallel_CPPFLAGS = \
87 $(AM_CPPFLAGS) $(MHD_CPU_COUNT_DEF)
88test_https_get_parallel_CFLAGS = \ 89test_https_get_parallel_CFLAGS = \
89 $(PTHREAD_CFLAGS) $(AM_CFLAGS) 90 $(PTHREAD_CFLAGS) $(AM_CFLAGS)
90test_https_get_parallel_LDADD = \ 91test_https_get_parallel_LDADD = \
@@ -101,8 +102,6 @@ test_https_get_parallel_threads_SOURCES = \
101 tls_test_keys.h \ 102 tls_test_keys.h \
102 tls_test_common.h \ 103 tls_test_common.h \
103 tls_test_common.c 104 tls_test_common.c
104test_https_get_parallel_threads_CPPFLAGS = \
105 $(AM_CPPFLAGS) $(MHD_CPU_COUNT_DEF)
106test_https_get_parallel_threads_CFLAGS = \ 105test_https_get_parallel_threads_CFLAGS = \
107 $(PTHREAD_CFLAGS) $(AM_CFLAGS) 106 $(PTHREAD_CFLAGS) $(AM_CFLAGS)
108test_https_get_parallel_threads_LDADD = \ 107test_https_get_parallel_threads_LDADD = \
diff --git a/src/testzzuf/Makefile.am b/src/testzzuf/Makefile.am
index c657f34e..db85c679 100644
--- a/src/testzzuf/Makefile.am
+++ b/src/testzzuf/Makefile.am
@@ -1,13 +1,22 @@
1# This Makefile.am is in the public domain 1# This Makefile.am is in the public domain
2SUBDIRS = . 2SUBDIRS = .
3 3
4AM_CPPFLAGS = \
5 -I$(top_srcdir)/src/include \
6 -DMHD_CPU_COUNT=$(CPU_COUNT) \
7 $(LIBCURL_CPPFLAGS)
8
9AM_CFLAGS = $(CFLAGS_ac) @LIBGCRYPT_CFLAGS@
10
11AM_LDFLAGS = $(LDFLAGS_ac)
12
4if USE_COVERAGE 13if USE_COVERAGE
5 AM_CFLAGS = -fprofile-arcs -ftest-coverage 14 AM_CFLAGS += -fprofile-arcs -ftest-coverage
6endif 15endif
7 16
8 17LDADD = \
9AM_CPPFLAGS = -I$(top_srcdir)/src/include \ 18 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
10 $(LIBCURL_CPPFLAGS) 19 @LIBCURL@
11 20
12EXTRA_DIST = README socat.c 21EXTRA_DIST = README socat.c
13 22
@@ -45,80 +54,41 @@ TESTS = $(check_PROGRAMS)
45 54
46test_get_SOURCES = \ 55test_get_SOURCES = \
47 test_get.c 56 test_get.c
48test_get_LDADD = \
49 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
50 @LIBCURL@
51 57
52test_get_chunked_SOURCES = \ 58test_get_chunked_SOURCES = \
53 test_get_chunked.c 59 test_get_chunked.c
54test_get_chunked_LDADD = \
55 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
56 @LIBCURL@
57 60
58test_post_SOURCES = \ 61test_post_SOURCES = \
59 test_post.c 62 test_post.c
60test_post_LDADD = \
61 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
62 @LIBCURL@
63 63
64test_post_form_SOURCES = \ 64test_post_form_SOURCES = \
65 test_post_form.c 65 test_post_form.c
66test_post_form_LDADD = \
67 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
68 @LIBCURL@
69 66
70test_put_SOURCES = \ 67test_put_SOURCES = \
71 test_put.c 68 test_put.c
72test_put_LDADD = \
73 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
74 @LIBCURL@
75 69
76test_put_chunked_SOURCES = \ 70test_put_chunked_SOURCES = \
77 test_put_chunked.c 71 test_put_chunked.c
78test_put_chunked_LDADD = \
79 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
80 @LIBCURL@
81 72
82test_put_large_SOURCES = \ 73test_put_large_SOURCES = \
83 test_put_large.c 74 test_put_large.c
84test_put_large_LDADD = \
85 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
86 @LIBCURL@
87 75
88 76
89 77
90test_get11_SOURCES = \ 78test_get11_SOURCES = \
91 test_get.c 79 test_get.c
92test_get11_LDADD = \
93 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
94 @LIBCURL@
95 80
96test_post11_SOURCES = \ 81test_post11_SOURCES = \
97 test_post.c 82 test_post.c
98test_post11_LDADD = \
99 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
100 @LIBCURL@
101 83
102test_post_form11_SOURCES = \ 84test_post_form11_SOURCES = \
103 test_post_form.c 85 test_post_form.c
104test_post_form11_LDADD = \
105 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
106 @LIBCURL@
107 86
108test_put11_SOURCES = \ 87test_put11_SOURCES = \
109 test_put.c 88 test_put.c
110test_put11_LDADD = \
111 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
112 @LIBCURL@
113 89
114test_put_large11_SOURCES = \ 90test_put_large11_SOURCES = \
115 test_put_large.c 91 test_put_large.c
116test_put_large11_LDADD = \
117 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
118 @LIBCURL@
119 92
120test_long_header_SOURCES = \ 93test_long_header_SOURCES = \
121 test_long_header.c 94 test_long_header.c
122test_long_header_LDADD = \
123 $(top_builddir)/src/microhttpd/libmicrohttpd.la \
124 @LIBCURL@