]> granicus.if.org Git - libevent/commitdiff
build: test ac_cv_header_sys_time_h once, reformat timer* macro checks
authorfanquake <fanquake@gmail.com>
Wed, 16 Jun 2021 07:29:30 +0000 (15:29 +0800)
committerfanquake <fanquake@gmail.com>
Fri, 9 Jul 2021 04:34:11 +0000 (12:34 +0800)
configure.ac

index 077095681cc81592f0c787573e2688c0ee106ec9..a68672be98c478d84e414618243ade9e51649c04 100644 (file)
@@ -208,59 +208,47 @@ if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
        )
 fi
 
+dnl if we have sys/time.h, check for timer* macros
 if test "x$ac_cv_header_sys_time_h" = "xyes"; then
-       AC_MSG_CHECKING(for timeradd in sys/time.h)
-       AC_EGREP_CPP(yes,
-[
-#include <sys/time.h>
-#ifdef timeradd
- yes
-#endif
-],     [ AC_DEFINE(HAVE_TIMERADD, 1,
-               [Define if timeradd is defined in <sys/time.h>])
-         AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
+
+AC_MSG_CHECKING(for timeradd in sys/time.h)
+AC_EGREP_CPP(yes, [
+    #include <sys/time.h>
+    #ifdef timeradd
+     yes
+    #endif],
+    [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERADD, 1, [Define if timeradd is defined in <sys/time.h>])],
+    [AC_MSG_RESULT(no)]
 )
-fi
 
-if test "x$ac_cv_header_sys_time_h" = "xyes"; then
-       AC_MSG_CHECKING(for timercmp in sys/time.h)
-       AC_EGREP_CPP(yes,
-[
-#include <sys/time.h>
-#ifdef timercmp
- yes
-#endif
-],     [ AC_DEFINE(HAVE_TIMERCMP, 1,
-               [Define if timercmp is defined in <sys/time.h>])
-         AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
+AC_MSG_CHECKING(for timercmp in sys/time.h)
+AC_EGREP_CPP(yes, [
+    #include <sys/time.h>
+    #ifdef timercmp
+     yes
+    #endif],
+    [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERCMP, 1,[Define if timercmp is defined in <sys/time.h>])],
+    [AC_MSG_RESULT(no)]
 )
-fi
 
-if test "x$ac_cv_header_sys_time_h" = "xyes"; then
-       AC_MSG_CHECKING(for timerclear in sys/time.h)
-       AC_EGREP_CPP(yes,
-[
-#include <sys/time.h>
-#ifdef timerclear
- yes
-#endif
-],     [ AC_DEFINE(HAVE_TIMERCLEAR, 1,
-               [Define if timerclear is defined in <sys/time.h>])
-         AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
+AC_MSG_CHECKING(for timerclear in sys/time.h)
+AC_EGREP_CPP(yes, [
+    #include <sys/time.h>
+    #ifdef timerclear
+     yes
+    #endif],
+    [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERCLEAR, 1, [Define if timerclear is defined in <sys/time.h>])],
+    [AC_MSG_RESULT(no)]
 )
-fi
 
-if test "x$ac_cv_header_sys_time_h" = "xyes"; then
-       AC_MSG_CHECKING(for timerisset in sys/time.h)
-       AC_EGREP_CPP(yes,
-[
-#include <sys/time.h>
-#ifdef timerisset
- yes
-#endif
-],     [ AC_DEFINE(HAVE_TIMERISSET, 1,
-               [Define if timerisset is defined in <sys/time.h>])
-         AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
+AC_MSG_CHECKING(for timerisset in sys/time.h)
+AC_EGREP_CPP(yes, [
+    #include <sys/time.h>
+    #ifdef timerisset
+     yes
+    #endif],
+    [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERISSET, 1, [Define if timerisset is defined in <sys/time.h>])],
+    [AC_MSG_RESULT(no)]
 )
 fi