]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
m4: ioloop.m4 - Modernize m4 syntax
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 25 Apr 2022 18:35:35 +0000 (21:35 +0300)
committerKarl Fleischmann <karl.fleischmann@open-xchange.com>
Mon, 4 Jul 2022 09:43:26 +0000 (11:43 +0200)
m4/ioloop.m4

index 0f7dde05e6e31e200cc7f0fc6a35aa116358f053..d8932127b7ad2d2f7d04115600eb144399eeb45a 100644 (file)
@@ -2,52 +2,53 @@ dnl * I/O loop function
 AC_DEFUN([DOVECOT_IOLOOP], [
   have_ioloop=no
   
-  if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then
+  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "epoll"], [
     AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
-      AC_TRY_RUN([
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
         #include <sys/epoll.h>
-    
-        int main()
-        {
+      ]], [[
        return epoll_create(5) < 1;
-        }
-      ], [
+      ]])],[
         i_cv_epoll_works=yes
       ], [
         i_cv_epoll_works=no
-      ])
+      ],[])
     ])
-    if test $i_cv_epoll_works = yes; then
+    AS_IF([test $i_cv_epoll_works = yes], [
       AC_DEFINE(IOLOOP_EPOLL,, [Implement I/O loop with Linux 2.6 epoll()])
       have_ioloop=yes
       ioloop=epoll
-    else
-      if test "$ioloop" = "epoll" ; then
+    ], [
+      AS_IF([test "$ioloop" = "epoll"], [
         AC_MSG_ERROR([epoll ioloop requested but epoll_create() is not available])
-      fi
-    fi
-  fi
+      ])
+    ])
+  ])
   
-  if test "$ioloop" = "best" || test "$ioloop" = "kqueue"; then
-      if test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes; then
+  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "kqueue"], [
+      AS_IF([test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes], [
         AC_DEFINE(IOLOOP_KQUEUE,, [Implement I/O loop with BSD kqueue()])
         ioloop=kqueue
         have_ioloop=yes
-      elif test "$ioloop" = "kqueue"; then
+      ], [test "$ioloop" = "kqueue"], [
         AC_MSG_ERROR([kqueue ioloop requested but kqueue() is not available])
-      fi
-  fi
+      ])
+  ])
   
-  if test "$ioloop" = "best" || test "$ioloop" = "poll"; then
+  AS_IF([test "$ioloop" = "best" || test "$ioloop" = "poll"], [
     AC_CHECK_FUNC(poll, [
       AC_DEFINE(IOLOOP_POLL,, [Implement I/O loop with poll()])
       ioloop=poll
       have_ioloop=yes
-    ])
-  fi
+    ], [
+      AS_IF([test "$ioloop" = "poll"], [
+        AC_MSG_ERROR([pool ioloop requested but poll() is not available])
+      ])
+     ])
+  ])
   
-  if test "$have_ioloop" = "no"; then
+  AS_IF([test "$have_ioloop" = "no"], [
     AC_DEFINE(IOLOOP_SELECT,, [Implement I/O loop with select()])
     ioloop="select"
-  fi
-]) 
+  ])
+])