commit f17b51ab9ea757c59f209a042bac818d9a0b6287
parent c5d3799c58d94343f735fa0cbd26387fef1b0fc5
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 23 Nov 2025 21:54:54 +0100
get configure.ac to work
Diffstat:
2 files changed, 63 insertions(+), 45 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -6635,8 +6635,8 @@ AS_CASE([${enable_md5}],[yes|tlslib],
],
[
AC_DEFINE([[MHD_MD5_EXTR_GNUTLS]],[[1]],
-+ [Define to 1 if libmicrohttpd is compiled with MD5 hashing by GnuTLS.])
-+ found_md5_tls="yes"
+ [Define to 1 if libmicrohttpd is compiled with MD5 hashing by GnuTLS.])
+ found_md5_tls="yes"
]
)
]
@@ -6703,7 +6703,7 @@ AS_CASE([${enable_md5}],[yes|tlslib],
CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
LDFLAGS="${LDFLAGS_ac} ${MBEDTLS_LDFLAGS} ${user_LDFLAGS}"
save_LIBS="$LIBS"
- LIBS="${MBEDTLS_LIBS} ${LIBS}"
+ LIBS="${MBEDTLS_LIBS} ${LIBS} -lmbedcrypto"
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
@@ -6806,6 +6806,8 @@ AC_ARG_ENABLE([[sha256]],
)
], [[enable_sha256="${enable_digest_auth}"]]
)
+
+# SHA-256 external vs. internal check
AS_CASE([${enable_sha256}],[yes|tlslib],
[
found_sha256_tls="no"
@@ -6937,7 +6939,7 @@ AS_CASE([${enable_sha256}],[yes|tlslib],
CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
LDFLAGS="${LDFLAGS_ac} ${MBEDTLS_LDFLAGS} ${user_LDFLAGS}"
save_LIBS="$LIBS"
- LIBS="${MBEDTLS_LIBS} ${LIBS}"
+ LIBS="${MBEDTLS_LIBS} ${LIBS} -lmbedcrypto"
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
@@ -6948,7 +6950,7 @@ AS_CASE([${enable_sha256}],[yes|tlslib],
mbedtls_sha256_context ctx;
unsigned char digest[16];
mbedtls_sha256_init(&ctx);
- mbedtls_sha256_starts(&ctx);
+ mbedtls_sha256_starts(&ctx, 0);
mbedtls_sha256_update(&ctx, (const unsigned char *)"", 1);
mbedtls_sha256_finish(&ctx, digest);
mbedtls_sha256_free(&ctx);
@@ -7022,42 +7024,26 @@ AC_MSG_RESULT([[${enable_sha256_MSG}]])
# optional: SHA-512/256 support for Digest Auth. Enabled by default.
AC_ARG_ENABLE([[sha512-256]],
- [AS_HELP_STRING([[--disable-sha512-256]],
- [disable SHA-512/256 hashing support for Digest Authentication])],
+ [AS_HELP_STRING([[--enable-sha512-256=TYPE]],
+ [enable TYPE of SHA-512/256 hashing code (yes, no, builtin, tlslib) [yes if dauth enabled]])],
[
- AS_VAR_IF([[enable_sha512_256]],[["yes"]],
- [
- AS_VAR_IF([enable_digest_auth],["yes"],[],
- [
- AC_MSG_WARN([The parameter --enable-sha512-256 is ignored as Digest Authentication is disabled])
- enable_sha512_256='no'
- ]
- )
- ],[[enable_sha512_256='no']]
- )
- ], [[enable_sha512_256="${enable_digest_auth}"]]
-)
-
-# optional: SHA-512/256 support for Digest Auth. Enabled by default.
-AC_ARG_ENABLE([[sha512-256]],
- [AS_HELP_STRING([[--disable-sha512-256]],
- [disable SHA-512/256 hashing support for Digest Authentication])],
- [
- AS_VAR_IF([[enable_sha512_256]],[["yes"]],
+ AS_VAR_IF([enable_sha512_256],["internal"],[enable_sha512_256='builtin'])
+ AS_VAR_IF([enable_sha512_256],["built-in"],[enable_sha512_256='builtin'])
+ AS_VAR_IF([enable_digest_auth],["yes"],[],
[
- AS_VAR_IF([enable_digest_auth],["yes"],[],
+ AS_VAR_IF([enable_sha512_256],["no"],[],
[
- AC_MSG_WARN([The parameter --enable-sha512-256 is ignored as Digest Authentication is disabled])
+ AC_MSG_WARN([The parameter --enable-sha512x256=${enable_sha512x256} is ignored as Digest Authentication is disabled])
enable_sha512_256='no'
]
)
- ],[[enable_sha512_256='no']]
+ ]
)
], [[enable_sha512_256="${enable_digest_auth}"]]
)
# SHA-512/256 external vs internal check
-AS_CASE([${enable_sha512_256}],[yes],
+AS_CASE([${enable_sha512_256}],[yes|tlslib],
[
found_sha512_256_tls="no"
AS_IF([test "x$enable_https" = "xyes"],
@@ -7117,7 +7103,7 @@ AS_CASE([${enable_sha512_256}],[yes],
CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
LDFLAGS="${LDFLAGS_ac} ${MBEDTLS_LDFLAGS} ${user_LDFLAGS}"
save_LIBS="$LIBS"
- LIBS="${MBEDTLS_LIBS} ${LIBS}"
+ LIBS="${MBEDTLS_LIBS} ${LIBS} -lmbedcrypto"
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
@@ -7152,14 +7138,18 @@ AS_CASE([${enable_sha512_256}],[yes],
)
]
)
- ],
- []
- )
- AS_VAR_IF([found_sha512_256_tls],["yes"],
- [
- AC_DEFINE([[MHD_SHA512_256_EXTR]],[[1]],
- [Define to 1 if libmicrohttpd is compiled with SHA-512/256 hashing by TLS library.])
]
+ ) # end AS_IF (enable_https)
+
+ AS_IF([test "x$enable_sha512_256" = "xyes"],
+ [AS_VAR_IF([found_sha512_256_tls],["yes"],
+ [enable_sha512_256="tlslib"],
+ [enable_sha512_256="builtin"]
+ )],
+ [AS_VAR_IF([found_sha512_256_tls],["yes"],
+ [enable_sha256="tlslib"],
+ [AC_MSG_ERROR([TLS library support requested for SHA512/256, but no library supports it])]
+ )]
)
]
)
@@ -7168,16 +7158,26 @@ AS_CASE([${enable_sha512_256}],[yes],
AC_MSG_CHECKING([[whether to support SHA-512/256]])
AS_UNSET([enable_sha512_256_MSG])
AS_CASE([${enable_sha512_256}],
- [yes],[enable_sha512_256_MSG='yes, built-in'],
+ [builtin],[enable_sha512_256_MSG='yes, built-in'],
+ [tlslib],[enable_sha512_256_MSG='yes, external (TLS library)'],
+ [yes],[AC_MSG_ERROR([configure internal error: unexpected variable value])],
[no],[enable_sha512_256_MSG='no'],
[AC_MSG_ERROR([Unrecognized parameter --enable-sha512-256=${enable_sha512_256}])]
)
-AS_VAR_IF([[enable_sha512_256]],[["yes"]],
+
+AS_IF([test "x${enable_sha512_256}" = "xbuiltin" || test "x${enable_sha512_256}" = "xtlslib" ],
[
AC_DEFINE([[MHD_SUPPORT_SHA512_256]],[[1]],
[Define to 1 if libmicrohttpd is compiled with SHA-512/256 hashing support.])
]
)
+
+AS_IF([test "x${enable_sha512_256}" = "xtlslib" ],
+ [
+ AC_DEFINE([[MHD_SHA512_256_EXTR]],[[1]],
+ [Define to 1 if libmicrohttpd is compiled with SHA-512/256 hashing by TLS library.])
+ ]
+)
AM_CONDITIONAL([MHD_SUPPORT_SHA512_256], [[test "x${enable_sha512_256}" = "xyes"]])
AM_CONDITIONAL([MHD_SHA512_256_EXTR], [[test "x${found_sha512_256_tls}" = "xyes"]])
AM_CONDITIONAL([MHD_SHA512_256_OPENSSL], [[test "x$mhd_cv_openssl_sha512_256" = "xyes"]])
diff --git a/src/mhd2/Makefile.am b/src/mhd2/Makefile.am
@@ -18,6 +18,8 @@ AM_TESTS_ENVIRONMENT = $(TESTS_ENVIRONMENT_ac)
lib_LTLIBRARIES = \
libmicrohttpd2.la
+crypt_LDFLAGS = $(MHD_TLS_LIB_LDFLAGS)
+
noinst_DATA =
MOSTLYCLEANFILES =
@@ -163,13 +165,19 @@ if MHD_MD5_EXTR
if MHD_SUPPORT_OPENSSL
md5_OPTSOURCES += \
md5_ext_openssl.c
+ crypt_LDFLAGS += \
+ $(OPENSSL_LDFLAGS)
else
if MHD_SUPPORT_GNUTLS
md5_OPTSOURCES += \
md5_ext_gnutls.c
+ crypt_LDFLAGS += \
+ $(GNUTLS_LDFLAGS)
else
md5_OPTSOURCES += \
md5_ext_mbedtls.c
+ crypt_LDFLAGS += \
+ -lmbedcrypto
endif
endif
else
@@ -186,13 +194,19 @@ if MHD_SHA256_EXTR
if MHD_SUPPORT_OPENSSL
sha256_OPTSOURCES += \
sha256_ext_openssl.c
+ crypt_LDFLAGS += \
+ $(OPENSSL_LDFLAGS)
else
if MHD_SUPPORT_GNUTLS
sha256_OPTSOURCES += \
sha256_ext_gnutls.c
+ crypt_LDFLAGS += \
+ $(GNUTLS_LDFLAGS)
else
sha256_OPTSOURCES += \
sha256_ext_mbedtls.c
+ crypt_LDFLAGS += \
+ -lmbedcrypto
endif
endif
@@ -208,11 +222,15 @@ if MHD_SHA512_256_EXTR
mhd_sha512_256.h
if MHD_SUPPORT_OPENSSL
- sha256_OPTSOURCES += \
- sha512_256_ext_openssl.c
+ sha256_OPTSOURCES += \
+ sha512_256_ext_openssl.c
+ crypt_LDFLAGS += \
+ $(OPENSSL_LDFLAGS)
else
- sha256_OPTSOURCES += \
- sha512_256_ext_mbedtls.c
+ sha256_OPTSOURCES += \
+ sha512_256_ext_mbedtls.c
+ crypt_LDFLAGS += \
+ -lmbedcrypto
endif
else
sha512_256_OPTSOURCES = \
@@ -311,7 +329,7 @@ libmicrohttpd2_la_CPPFLAGS = \
libmicrohttpd2_la_CFLAGS = \
$(AM_CFLAGS) $(MHD_LIB_CFLAGS)
libmicrohttpd2_la_LDFLAGS = \
- $(AM_LDFLAGS) $(MHD_LIB_LDFLAGS) $(MHD_TLS_LIB_LDFLAGS) \
+ $(AM_LDFLAGS) $(MHD_LIB_LDFLAGS) $(crypt_LDFLAGS) \
$(W32_MHD_LIB_LDFLAGS) \
-export-dynamic -no-undefined \
-version-info @LIB_VER_CURRENT@:@LIB_VER_REVISION@:@LIB_VER_AGE@