libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 7ade892317e91c34de82e103e129b9cb4e54f5cf
parent 9624d2f58ee09fd6bd109bb89b6695f8447f17a4
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 11 Sep 2018 15:11:53 +0200

clean up use of GNUTLS linker options in various places, re-add SAVE_LIBS restoration to configure.ac to avoid linking indiscriminately against GnuTLS

Diffstat:
Mconfigure.ac | 9++++++++-
Msrc/microhttpd/Makefile.am | 24++++++++++++------------
Msrc/testcurl/https/Makefile.am | 24++++++++++++------------
Msrc/testcurl/test_get.c | 2++
Msrc/testcurl/test_put.c | 2++
5 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -1502,6 +1502,8 @@ AC_ARG_WITH([[gnutls]], AC_MSG_RESULT([[-I$with_gnutls/include -L$with_gnutls/lib -lgnutls]]) SAVE_LDFLAGS="$LDFLAGS" SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LIBS="$LIBS" LDFLAGS="-L$with_gnutls/lib $LDFLAGS" CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" have_gnutls_pkgcfg=no @@ -1514,6 +1516,10 @@ AC_ARG_WITH([[gnutls]], have_gnutls=yes ])], [], [AC_INCLUDES_DEFAULT]) AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])]) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" ;; esac ], @@ -1659,7 +1665,8 @@ AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"], ) ] ) -AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"], [AC_MSG_ERROR([[can't find usable libgnutls]])]) +AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"], + [AC_MSG_ERROR([[can't find usable libgnutls]])]) # # End of large unindented block # diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am @@ -194,11 +194,11 @@ test_daemon_LDADD = \ test_upgrade_SOURCES = \ test_upgrade.c test_helpers.h mhd_sockets.h test_upgrade_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) test_upgrade_CFLAGS = \ - $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS) test_upgrade_LDFLAGS = \ - $(GNUTLS_LDFLAGS) + $(MHD_TLS_LIB_LDFLAGS) test_upgrade_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) @@ -206,11 +206,11 @@ test_upgrade_LDADD = \ test_upgrade_tls_SOURCES = \ test_upgrade.c test_helpers.h mhd_sockets.h test_upgrade_tls_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) test_upgrade_tls_CFLAGS = \ - $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS) test_upgrade_tls_LDFLAGS = \ - $(GNUTLS_LDFLAGS) + $(MHD_TLS_LIB_LDFLAGS) test_upgrade_tls_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) @@ -218,27 +218,27 @@ test_upgrade_tls_LDADD = \ test_postprocessor_SOURCES = \ test_postprocessor.c test_postprocessor_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) test_postprocessor_CFLAGS = \ - $(AM_CFLAGS) $(GNUTLS_CFLAGS) + $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS) test_postprocessor_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la test_postprocessor_amp_SOURCES = \ test_postprocessor_amp.c test_postprocessor_amp_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) test_postprocessor_amp_CFLAGS = \ - $(AM_CFLAGS) $(GNUTLS_CFLAGS) + $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS) test_postprocessor_amp_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la test_postprocessor_large_SOURCES = \ test_postprocessor_large.c test_postprocessor_large_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) test_postprocessor_large_CFLAGS = \ - $(AM_CFLAGS) $(GNUTLS_CFLAGS) + $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS) test_postprocessor_large_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am @@ -20,7 +20,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/include \ -I$(top_srcdir)/src/microhttpd \ -I$(top_srcdir)/src/platform \ - $(LIBCURL_CPPFLAGS) $(GNUTLS_CPPFLAGS) + $(LIBCURL_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) check_PROGRAMS = \ test_tls_options \ @@ -58,7 +58,7 @@ test_https_time_out_SOURCES = \ test_https_time_out_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_tls_options_SOURCES = \ test_tls_options.c \ @@ -68,7 +68,7 @@ test_tls_options_SOURCES = \ test_tls_options_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_https_get_parallel_SOURCES = \ test_https_get_parallel.c \ @@ -82,7 +82,7 @@ test_https_get_parallel_CFLAGS = \ test_https_get_parallel_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(PTHREAD_LIBS) $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_empty_response_SOURCES = \ test_empty_response.c \ @@ -92,7 +92,7 @@ test_empty_response_SOURCES = \ test_empty_response_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_https_get_parallel_threads_SOURCES = \ test_https_get_parallel_threads.c \ @@ -106,7 +106,7 @@ test_https_get_parallel_threads_CFLAGS = \ test_https_get_parallel_threads_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(PTHREAD_LIBS) $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_tls_authentication_SOURCES = \ test_tls_authentication.c \ @@ -116,7 +116,7 @@ test_tls_authentication_SOURCES = \ test_tls_authentication_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_https_session_info_SOURCES = \ test_https_session_info.c \ @@ -126,7 +126,7 @@ test_https_session_info_SOURCES = \ test_https_session_info_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_https_multi_daemon_SOURCES = \ test_https_multi_daemon.c \ @@ -136,7 +136,7 @@ test_https_multi_daemon_SOURCES = \ test_https_multi_daemon_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ test_https_get_SOURCES = \ test_https_get.c \ @@ -146,7 +146,7 @@ test_https_get_SOURCES = \ test_https_get_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ if HAVE_GNUTLS_SNI test_https_sni_SOURCES = \ @@ -160,7 +160,7 @@ test_https_sni_CPPFLAGS = \ test_https_sni_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ endif test_https_get_select_SOURCES = \ @@ -171,5 +171,5 @@ test_https_get_select_SOURCES = \ test_https_get_select_LDADD = \ $(top_builddir)/src/testcurl/libcurl_version_check.a \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@ diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c @@ -420,6 +420,8 @@ testExternalGet () } tv.tv_sec = 0; tv.tv_usec = 1000; + if (maxsock > maxposixs) + maxposixs = maxsock; if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) { #ifdef MHD_POSIX_SOCKETS diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c @@ -462,6 +462,8 @@ curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); MHD_stop_daemon (d); return 4096; } + if (maxsock > maxposixs) + maxposixs = maxsock; tv.tv_sec = 0; tv.tv_usec = 1000; if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))