gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] 02/02: polish configure.ac, use AS_IF where


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/02: polish configure.ac, use AS_IF where appropriate
Date: Sat, 18 Aug 2018 11:22:15 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libmicrohttpd.

commit dca675afab5776e17f9a37b891a70cd0d97d76f1
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Aug 18 11:22:08 2018 +0200

    polish configure.ac, use AS_IF where appropriate
---
 configure.ac            | 108 ++++++++++++++++++++----------------------------
 src/microhttpd/daemon.c |  11 +++--
 2 files changed, 50 insertions(+), 69 deletions(-)

diff --git a/configure.ac b/configure.ac
index e503a5da..09da0ad4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,28 +35,22 @@ AC_SUBST(LIB_VERSION_REVISION)
 AC_SUBST(LIB_VERSION_AGE)
 
 AC_MSG_CHECKING([[whether z/OS special settings are required]])
-if test `uname -s` = "OS/390"
-then
+AS_IF([test `uname -s` = "OS/390"],
+[
 # configure binaries for z/OS
-  if test -z "$CC"
-  then
-    CC=`pwd`"/contrib/xcc"
-    chmod +x $CC || true
-  fi
-  if test -z "$CPP"
-  then
-    CPP="c89 -E"
-  fi
-  if test -z "$CXXCPP"
-  then
-    CXXCPP="c++ -E -+"
-  fi
+  AS_IF([test -z "$CC"],
+        [CC=`pwd`"/contrib/xcc"
+         chmod +x $CC || true])
+  AS_IF([test -z "$CPP"],
+        CPP="c89 -E")
+  AS_IF([test -z "$CXXCPP"],
+        CXXCPP="c++ -E -+")
   AC_MSG_RESULT([[yes]])
 #  _CCC_CCMODE=1
 #  _C89_CCMODE=1
-else
+],
   AC_MSG_RESULT([[no]])
-fi
+)
 
 # Checks for programs.
 AC_PROG_AWK
@@ -427,15 +421,14 @@ AS_IF([[test "x$with_threads" = "xposix"]],
         )
     ]
   )
-if test "x$USE_THREADS" = "xposix"; then
-  CC="$PTHREAD_CC"
+AS_IF([test "x$USE_THREADS" = "xposix"],
+  [CC="$PTHREAD_CC"
   AC_DEFINE([MHD_USE_POSIX_THREADS],[1],[define to use pthreads])
   MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS"
   MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS"
   MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG"
 elif test "x$USE_THREADS" = "xw32"; then
-  AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads])
-fi
+  AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads])])
 AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"])
 AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"])
 AC_MSG_RESULT([[$USE_THREADS]])
@@ -444,7 +437,7 @@ AC_ARG_ENABLE([[thread-names]],
    [AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD 
generated threads])],
    [], [enable_thread_names='auto'])
 
-if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; 
then
+AS_IF([test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = 
"xposix"],[
   # Check for thread name function
   HAVE_THREAD_NAME_FUNC="no"
   SAVE_LIBS="$LIBS"
@@ -600,10 +593,9 @@ AC_INCLUDES_DEFAULT
 
   LIBS="$SAVE_LIBS"
   CFLAGS="$SAVE_CFLAGS"
-fi
+])
 
-AS_IF(
-  [[test "x$enable_thread_names" != "xno"]],
+AS_IF([[test "x$enable_thread_names" != "xno"]],
   [
     AC_MSG_CHECKING([[whether to enable thread names]])
     AC_COMPILE_IFELSE(
@@ -690,31 +682,25 @@ AC_ARG_ENABLE([[poll]],
     [enable_poll='auto']
   )
 
-if test "$enable_poll" != "no"; then
-  if test "$os_is_native_w32" != "yes"; then
-    AC_CHECK_HEADERS([poll.h],
-      [
-        AC_CHECK_FUNCS([poll], [have_poll='yes'], [have_poll='no'])
-      ], [], [AC_INCLUDES_DEFAULT])
-  else
-    AC_MSG_CHECKING([for WSAPoll()])
-    AC_LINK_IFELSE([
-      AC_LANG_PROGRAM([[
+AS_IF([test "$enable_poll" != "no"],
+       [AS_IF([test "$os_is_native_w32" != "yes"],
+             AC_CHECK_HEADERS([poll.h],
+                [AC_CHECK_FUNCS([poll], [have_poll='yes'], [have_poll='no'])],
+               [],
+               [AC_INCLUDES_DEFAULT]),
+             [AC_MSG_CHECKING([for WSAPoll()])
+              AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <winsock2.h>
-       ]], [[
+              ]],[[
 WSAPOLLFD fda[2];
 WSAPoll(fda, 2, 0);]])],
-        [
-          have_poll='yes'
-          AC_DEFINE([HAVE_POLL],[1])
-        ], [have_poll='no'])
-    AC_MSG_RESULT([$have_poll])
-  fi
-  if test "$enable_poll" = "yes" && test "$have_poll" != "yes"; then
-    AC_MSG_ERROR([[Support for poll was explicitly requested but cannot be 
enabled on this platform.]])
-  fi
-  enable_poll="$have_poll"
-fi
+              [have_poll='yes'
+              AC_DEFINE([HAVE_POLL],[1])
+              ],[have_poll='no'])
+              AC_MSG_RESULT([$have_poll])])
+       AS_IF([test "$enable_poll" = "yes" && test "$have_poll" != "yes"],
+             AC_MSG_ERROR([[Support for poll was explicitly requested but 
cannot be enabled on this platform.]]))
+       enable_poll="$have_poll"])
 
 AC_ARG_ENABLE([[epoll]],
   [AS_HELP_STRING([[--enable-epoll[=ARG]]], [enable epoll support (yes, no, 
auto) [auto]])],
@@ -722,23 +708,20 @@ AC_ARG_ENABLE([[epoll]],
     [enable_epoll='auto']
   )
 
-if test "$enable_epoll" != "no"; then
-  AX_HAVE_EPOLL
-  if test "${ax_cv_have_epoll}" = "yes"; then
-    AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll support])
-    enable_epoll='yes'
-  else
-    if test "$enable_epoll" = "yes"; then
-      AC_MSG_ERROR([[Support for epoll was explicitly requested but cannot be 
enabled on this platform.]])
-    fi
-    enable_epoll='no'
-  fi
-fi
+AS_IF([test "$enable_epoll" != "no"],
+      [AX_HAVE_EPOLL
+       AS_IF([test "${ax_cv_have_epoll}" = "yes"],
+          [AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll 
support])
+           enable_epoll='yes'],
+       [AS_IF([test "$enable_epoll" = "yes"],
+              AC_MSG_ERROR([[Support for epoll was explicitly requested but 
cannot be enabled on this platform.]]))
+        enable_epoll='no'])])
 
 AM_CONDITIONAL([MHD_HAVE_EPOLL], [[test "x$enable_epoll" = xyes]])
 
-if test "x$enable_epoll" = "xyes"; then
-  AC_CACHE_CHECK([for epoll_create1()], [mhd_cv_have_epoll_create1], [
+AS_IF([test "x$enable_epoll" = "xyes"],
+  AC_CACHE_CHECK([for epoll_create1()],
+                 [mhd_cv_have_epoll_create1], [
     AC_LINK_IFELSE([
       AC_LANG_PROGRAM([[
 #include <sys/epoll.h>
@@ -748,8 +731,7 @@ fd = epoll_create1(EPOLL_CLOEXEC);]])],
       [mhd_cv_have_epoll_create1=yes],
       [mhd_cv_have_epoll_create1=no])])
   AS_IF([test "x$mhd_cv_have_epoll_create1" = "xyes"],[
-    AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 
function.])])
-fi
+    AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 
function.])]))
 
 # Check for headers that are ALWAYS required
 AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h 
sys/types.h], [], [AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX 
headers files])], [AC_INCLUDES_DEFAULT])
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 721763dd..c70a405a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3923,6 +3923,8 @@ MHD_poll (struct MHD_Daemon *daemon,
   return MHD_poll_listen_socket (daemon,
                                  may_block);
 #else
+  (void) daemon;
+  (void) may_block;
   return MHD_NO;
 #endif
 }
@@ -3960,30 +3962,25 @@ is_urh_ready(struct MHD_UpgradeResponseHandle * const 
urh)
        (0 == urh->in_buffer_used) &&
        (0 == urh->out_buffer_used) )
     return false;
-
   if (connection->daemon->shutdown)
     return true;
-
   if ( ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->app.celi)) ||
          (connection->tls_read_ready) ) &&
        (urh->in_buffer_used < urh->in_buffer_size) )
     return true;
-
   if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) &&
        (urh->out_buffer_used < urh->out_buffer_size) )
     return true;
-
   if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->app.celi)) &&
        (urh->out_buffer_used > 0) )
     return true;
-
   if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->mhd.celi)) &&
          (urh->in_buffer_used > 0) )
     return true;
-
   return false;
 }
 
+
 /**
  * Do epoll()-based processing for TLS connections that have been
  * upgraded.  This requires a separate epoll() invocation as we
@@ -4093,11 +4090,13 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
 }
 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
 
+
 /**
  * Pointer-marker to distinguish ITC slot in epoll sets.
  */
 static const char * const epoll_itc_marker = "itc_marker";
 
+
 /**
  * Do epoll()-based processing (this function is allowed to
  * block if @a may_block is set to #MHD_YES).

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]