]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2650: configure requires epoll_ctl in libepoll when --enable-epoll used
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 29 Apr 2009 14:12:05 +0000 (02:12 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 29 Apr 2009 14:12:05 +0000 (02:12 +1200)
configure.in

index e291df894f2a27c2b3c6e80be115de5a3085326f..a983effc4dd9e909394b2457062024e4b7989c25 100644 (file)
@@ -1213,6 +1213,7 @@ esac
 
 dnl Enable epoll()
 disable_epoll=
+force_epoll="no"
 AC_ARG_ENABLE(epoll,
   AC_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
 [
@@ -1220,11 +1221,7 @@ AC_ARG_ENABLE(epoll,
   yes)
     AC_MSG_WARN([Forcing epoll() to be enabled])
     SELECT_TYPE="epoll"
-    dnl epoll requires header file and library to be installed
-    AC_CHECK_HEADERS([sys/epoll.h],[],
-      [ AC_MSG_ERROR([required sys/epoll.h header file is missing.]) ])
-    AC_CHECK_LIB(epoll, epoll_ctl, [],
-      [ AC_MSG_ERROR([required libepoll library is missing.]) ])
+    force_epoll="yes"
     ;;
   no)
     AC_MSG_WARN([Forcing epoll() to be disabled])
@@ -1232,20 +1229,28 @@ AC_ARG_ENABLE(epoll,
   ;;
 esac
 ])
-dnl epoll requires sys/epoll.h and libepoll
+dnl auto-detect and verify epoll header and library present and working
 if test -z "$disable_epoll"; then
+
   # Check for libepoll
   EPOLL_LIB=
   AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
   AC_SUBST(EPOLL_LIBS)
 
+  dnl on some systems it is provided by libc
+  dnl not to worry, the working test below will catch them
+  dnl and we don't want to force additional libraries
+
+
   # Check for epoll_ctl, may need -lepoll
   SAVED_LIBS="$LIBS"
-  LIBS="$LIBS $LIB_EPOLL"
+  LIBS="$LIBS $EPOLL_LIBS"
   AC_CHECK_FUNCS(epoll_ctl)
   LIBS="$SAVED_LIBS"
 
-  AC_CHECK_HEADERS([sys/epoll.h])
+  dnl epoll requires sys/epoll.h
+  AC_CHECK_HEADERS([sys/epoll.h],[],
+      [ AC_MSG_ERROR([required sys/epoll.h header file is missing.]) ])
 
   dnl Verify that epoll really works
   if test $ac_cv_func_epoll_ctl = yes; then
@@ -1265,6 +1270,10 @@ int main(int argc, char **argv)
 }
       ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
   fi
+
+  if test "$force_epoll" = "yes" && test "$ac_cv_epoll_works" = "no" ; then
+    AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
+  fi
 fi
 
 dnl Disable HTTP violations