aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-10 13:52:47 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-10 13:52:47 +0000
commita7029c10cccdf2b0d4597eb79fb58d2f11d167f1 (patch)
treed11d1941b64fd11f3e4d3b9f462facaa011af520
parentf1316455d7f9abbf68cb227d4df1124e6a979454 (diff)
downloadlibmicrohttpd-a7029c10cccdf2b0d4597eb79fb58d2f11d167f1.tar.gz
libmicrohttpd-a7029c10cccdf2b0d4597eb79fb58d2f11d167f1.zip
configure.ac: added --disable-thread-names parameter
-rw-r--r--configure.ac43
-rw-r--r--src/include/microhttpd.h10
-rw-r--r--src/microhttpd/daemon.c6
3 files changed, 56 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 53c67de6..54a516e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,7 +302,11 @@ AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"])
302AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"]) 302AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"])
303AC_MSG_RESULT([[$USE_THREADS]]) 303AC_MSG_RESULT([[$USE_THREADS]])
304 304
305if test "x$HAVE_POSIX_THREADS" = "xyes"; then 305AC_ARG_ENABLE([[thread-names]],
306 [AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD generated threads])],
307 [], [enable_thread_names='auto'])
308
309if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then
306 # Check for pthread_setname_np() 310 # Check for pthread_setname_np()
307 SAVE_LIBS="$LIBS" 311 SAVE_LIBS="$LIBS"
308 SAVE_CFLAGS="$CFLAGS" 312 SAVE_CFLAGS="$CFLAGS"
@@ -362,6 +366,42 @@ if test "x$HAVE_POSIX_THREADS" = "xyes"; then
362 CFLAGS="$SAVE_CFLAGS" 366 CFLAGS="$SAVE_CFLAGS"
363fi 367fi
364 368
369AS_IF(
370 [[test "x$enable_thread_names" != "xno"]],
371 [
372 AC_MSG_CHECKING([[whether to enable thread names]])
373 AC_COMPILE_IFELSE(
374 [AC_LANG_PROGRAM([], [[
375#ifdef MHD_NO_THREAD_NAMES
376#error Thread names are disabled.
377choke me
378#endif
379
380/* Keep in sync with mhd_threads.h */
381#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) )
382int a = 1;
383#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER)
384int b = 2;
385#else
386#error No thread name function is available.
387choke me
388#endif
389 ]])
390 ], [
391 enable_thread_names='yes'
392 ], [
393 AS_IF([[test "x$enable_thread_names" = "xyes"]],
394 [
395 AC_MSG_RESULT([[no]])
396 AC_MSG_ERROR([[thread names was explicitly requested, but thread name function is not available]])
397 ])
398 enable_thread_names='no'
399 ])
400 AC_MSG_RESULT([[$enable_thread_names]])
401 ])
402
403AS_IF([[test "x$enable_thread_names" = "xno"]],
404 [AC_DEFINE([[MHD_NO_THREAD_NAMES]], [[1]], [Define to 1 to disable setting name on generated threads])])
365 405
366AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"]) 406AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"])
367w32_shared_lib_exp=no 407w32_shared_lib_exp=no
@@ -1007,6 +1047,7 @@ AC_MSG_NOTICE([libmicrohttpd ${PACKAGE_VERSION} Configuration Summary:
1007 Cross-compiling: ${cross_compiling} 1047 Cross-compiling: ${cross_compiling}
1008 Operating System: ${host_os} 1048 Operating System: ${host_os}
1009 Threading lib: ${USE_THREADS} 1049 Threading lib: ${USE_THREADS}
1050 Use thread names: ${enable_thread_names}
1010 libcurl (testing): ${MSG_CURL} 1051 libcurl (testing): ${MSG_CURL}
1011 Target directory: ${prefix} 1052 Target directory: ${prefix}
1012 Messages: ${enable_messages} 1053 Messages: ${enable_messages}
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 878897ec..39a0703e 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -21,6 +21,7 @@
21 * @file microhttpd.h 21 * @file microhttpd.h
22 * @brief public interface to libmicrohttpd 22 * @brief public interface to libmicrohttpd
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * @author Karlson2k (Evgeny Grin)
24 * @author Chris GauthierDickey 25 * @author Chris GauthierDickey
25 * 26 *
26 * All symbols defined in this header start with MHD. MHD is a small 27 * All symbols defined in this header start with MHD. MHD is a small
@@ -130,7 +131,7 @@ typedef intptr_t ssize_t;
130 * Current version of the library. 131 * Current version of the library.
131 * 0x01093001 = 1.9.30-1. 132 * 0x01093001 = 1.9.30-1.
132 */ 133 */
133#define MHD_VERSION 0x00095002 134#define MHD_VERSION 0x00095003
134 135
135/** 136/**
136 * MHD-internal return code for "YES". 137 * MHD-internal return code for "YES".
@@ -2817,7 +2818,12 @@ enum MHD_FEATURE
2817 * offsets larger than 2 GiB. If not supported value of size+offset is 2818 * offsets larger than 2 GiB. If not supported value of size+offset is
2818 * limited to 2 GiB. 2819 * limited to 2 GiB.
2819 */ 2820 */
2820 MHD_FEATURE_LARGE_FILE = 15 2821 MHD_FEATURE_LARGE_FILE = 15,
2822
2823 /**
2824 * Get whether MHD set names on generated threads.
2825 */
2826 MHD_THREAD_NAMES = 16
2821}; 2827};
2822 2828
2823 2829
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f493d19d..4845d60a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -4905,6 +4905,12 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
4905#else 4905#else
4906 return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES; 4906 return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES;
4907#endif 4907#endif
4908 case MHD_THREAD_NAMES:
4909#if defined(MHD_USE_THREAD_NAME_)
4910 return MHD_YES;
4911#else
4912 return MHD_NO;
4913#endif
4908 } 4914 }
4909 return MHD_NO; 4915 return MHD_NO;
4910} 4916}