aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac205
1 files changed, 176 insertions, 29 deletions
diff --git a/configure.ac b/configure.ac
index 536a4d66..94ddfd5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,7 +226,7 @@ choke me now
226 AS_CASE([${enable_build_type}],[*-compact], 226 AS_CASE([${enable_build_type}],[*-compact],
227 [ 227 [
228 enable_compact_code="yes" 228 enable_compact_code="yes"
229 compact_code_MSG="enabled by build type ${enable_build_type}" 229 compact_code_MSG="enabled by --enable-build-type=${enable_build_type}"
230 AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1]) 230 AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1])
231 ] 231 ]
232 ) 232 )
@@ -3640,44 +3640,191 @@ AS_VAR_IF([use_heavy_tests], ["yes"],
3640AC_MSG_RESULT([$CPU_COUNT]) 3640AC_MSG_RESULT([$CPU_COUNT])
3641 3641
3642 3642
3643AC_MSG_CHECKING([[whether to enable debug asserts]])
3644AC_ARG_ENABLE([[asserts]], 3643AC_ARG_ENABLE([[asserts]],
3645 [AS_HELP_STRING([[--enable-asserts]], 3644 [AS_HELP_STRING([[--enable-asserts]],
3646 [enable test build with debug asserts])], 3645 [enable test build with debug asserts])],
3647 [], 3646 [],
3648 [AS_CASE([${enable_build_type}],[debug|debugger], 3647 [enable_asserts='auto']
3649 [enable_asserts='yes'],[enable_asserts='no'])] 3648)
3649AS_UNSET([use_asserts_MSG])
3650AC_CACHE_CHECK([[whether NDEBUG macro is defined]], [mhd_cv_macro_ndebug_def],
3651 [
3652 AC_LINK_IFELSE(
3653 [
3654 AC_LANG_SOURCE([[
3655#ifndef NDEBUG
3656#error NDEBUG is NOT defined
3657chome me now
3658#endif
3659
3660int main(void)
3661{
3662 return 0;
3663}
3664 ]]
3665 )
3666 ],
3667 [[mhd_cv_macro_ndebug_def='yes']],
3668 [[mhd_cv_macro_ndebug_def='no']]
3669 )
3670 ]
3671)
3672AS_VAR_IF([enable_asserts],["yes"],
3673 [
3674 AS_VAR_IF([mhd_cv_macro_ndebug_def],["yes"],
3675 [
3676 AC_MSG_FAILURE([Parameter --enable-asserts is specified, but NDEBUG macro is defined as well])
3677 ]
3678 )
3679 use_asserts_MSG="yes, enabled by configure parameter"
3680 ]
3681)
3682AC_CACHE_CHECK([[whether _DEBUG macro is defined]], [mhd_cv_macro__debug_def],
3683 [
3684 AC_LINK_IFELSE(
3685 [
3686 AC_LANG_SOURCE([[
3687#ifndef _DEBUG
3688#error _DEBUG is NOT defined
3689chome me now
3690#endif
3691
3692int main(void)
3693{
3694 return 0;
3695}
3696 ]]
3697 )
3698 ],
3699 [[mhd_cv_macro__debug_def='yes']],
3700 [[mhd_cv_macro__debug_def='no']]
3701 )
3702 ]
3703)
3704AS_VAR_IF([enable_asserts],["no"],
3705 [
3706 AS_VAR_IF([mhd_cv_macro__debug_def],["yes"],
3707 [
3708 AC_MSG_FAILURE([Parameter --disable-asserts is specified, but _DEBUG macro is defined as well])
3709 ]
3710 )
3711 use_asserts_MSG="no, set by configure parameter"
3712 ]
3713)
3714AS_IF([test "x${mhd_cv_macro_ndebug_def}" = "xyes" && test "x${mhd_cv_macro__debug_def}" = "xyes"],
3715 [AC_MSG_FAILURE([Both NDEBUG and _DEBUG macros are defined])]
3716)
3717AS_VAR_IF([enable_asserts],["auto"],
3718 [
3719 AS_VAR_IF([mhd_cv_macro_ndebug_def],["yes"],
3720 [
3721 enable_asserts="no"
3722 use_asserts_MSG="no, set by NDEBUG preprocessor macro"
3723 ]
3724 )
3725 ]
3726)
3727AS_VAR_IF([enable_asserts],["auto"],
3728 [
3729 AS_VAR_IF([mhd_cv_macro__debug_def],["yes"],
3730 [
3731 enable_asserts="yes"
3732 use_asserts_MSG="yes, enabled by _DEBUG preprocessor macro"
3733 ]
3734 )
3735 ]
3736)
3737AS_VAR_IF([enable_asserts],["auto"],
3738 [
3739 AC_CACHE_CHECK([[whether DEBUG macro is defined]], [mhd_cv_macro_debug_def],
3740 [
3741 AC_LINK_IFELSE(
3742 [
3743 AC_LANG_SOURCE([[
3744#ifndef DEBUG
3745#error DEBUG is NOT defined
3746chome me now
3747#endif
3748
3749int main(void)
3750{
3751 return 0;
3752}
3753 ]]
3754 )
3755 ],
3756 [[mhd_cv_macro_debug_def='yes']],
3757 [[mhd_cv_macro_debug_def='no']]
3758 )
3759 ]
3760 )
3761 AS_VAR_IF([mhd_cv_macro_debug_def],["yes"],
3762 [
3763 enable_asserts="yes"
3764 use_asserts_MSG="yes, enabled by DEBUG preprocessor macro"
3765 ]
3766 )
3767 ]
3768)
3769AC_MSG_CHECKING([[whether to enable debug asserts]])
3770AS_VAR_IF([enable_asserts],["auto"],
3771 [
3772 AS_CASE([${enable_build_type}],
3773 [debug|debugger],
3774 [
3775 enable_asserts="yes"
3776 use_asserts_MSG="yes, enabled by --enable-bulid-type=${enable_build_type}"
3777 ],
3778 [
3779 enable_asserts="no"
3780 use_asserts_MSG="no"
3781 ]
3782 )
3783 ]
3650) 3784)
3651AS_CASE([[$enable_asserts]], [[yes]], [[:]], [[no]], [[:]], [[enable_asserts='no']]) 3785AS_CASE([[$enable_asserts]], [[yes]], [[:]], [[no]], [[:]], [[enable_asserts='no']])
3652AC_MSG_RESULT([[$enable_asserts]]) 3786AC_MSG_RESULT([[${use_asserts_MSG=no}]])
3653 3787
3654AS_VAR_IF([[enable_asserts]], [["yes"]], 3788AS_VAR_IF([[enable_asserts]], [["yes"]],
3655 [ 3789 [
3656 MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-D_DEBUG=1]) 3790 AS_VAR_IF([[mhd_cv_macro__debug_def]], [["yes"]], [:],
3657 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}" 3791 [
3658 [mhd_assert_test_prg="#include <assert.h> 3792 MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-D_DEBUG=1])
3659 int pos_val(void) {return 5;} 3793 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
3660 int neg_val(void) {return -5;} 3794 ]
3661 int main(void) 3795 )
3662 { int pos_var = pos_val(), neg_var = neg_val(); 3796 AC_CACHE_CHECK([[whether system assert() is available]], [mhd_cv_sys_assert_avail],
3663 assert(neg_var > pos_var); /* Must trigger assert. */ 3797 [
3664 (void)pos_var; (void)neg_var; 3798 AC_LINK_IFELSE(
3665 return 0; } 3799 [
3666 "] 3800 AC_LANG_SOURCE([[
3667 AC_CACHE_CHECK([[whether system assert() is available]], [mhd_cv_sys_assert_avail], 3801#include <assert.h>
3668 [ 3802
3669 AC_LINK_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])], 3803static int pos_val(void) {return 5;}
3670 [[mhd_cv_sys_assert_avail='yes']], 3804static int neg_val(void) {return -5;}
3671 [[mhd_cv_sys_assert_avail='no']]) 3805int main(void)
3672 ] 3806{
3673 ) 3807 int pos_var = pos_val(), neg_var = neg_val();
3674 AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["no"]], [], 3808 assert(neg_var > pos_var); /* Must trigger assert. */
3675 [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() and assert.h])]) 3809 return pos_var + neg_var;
3676 AS_UNSET([mhd_assert_test_prg]) 3810}
3811 ]])
3812 ],
3813 [[mhd_cv_sys_assert_avail='yes']],
3814 [[mhd_cv_sys_assert_avail='no']]
3815 )
3816 ]
3817 )
3818 AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["no"]], [],
3819 [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() and assert.h])])
3677 ], 3820 ],
3678 [ 3821 [
3679 MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DNDEBUG=1]) 3822 AS_VAR_IF([[mhd_cv_macro_ndebug_def]], [["yes"]], [:],
3680 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}" 3823 [
3824 MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DNDEBUG=1])
3825 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
3826 ]
3827 )
3681 ] 3828 ]
3682) 3829)
3683 3830
@@ -4340,7 +4487,7 @@ AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary:
4340 HTTPS support: ${MSG_HTTPS} 4487 HTTPS support: ${MSG_HTTPS}
4341 Compact code: ${enable_compact_code} (${compact_code_MSG}) 4488 Compact code: ${enable_compact_code} (${compact_code_MSG})
4342 Use thread names: ${enable_thread_names} 4489 Use thread names: ${enable_thread_names}
4343 Use debug asserts: ${enable_asserts} 4490 Use debug asserts: ${use_asserts_MSG=no}
4344 Use sanitizers: ${enabled_sanitizers:=no} 4491 Use sanitizers: ${enabled_sanitizers:=no}
4345 Build docs: ${enable_doc} 4492 Build docs: ${enable_doc}
4346 Build examples: ${enable_examples} 4493 Build examples: ${enable_examples}