dnl Configuration input file for Squid
dnl
-dnl $Id: configure.in,v 1.456 2007/06/02 23:46:00 hno Exp $
+dnl $Id: configure.in,v 1.457 2007/06/10 12:07:28 hno Exp $
dnl
dnl
dnl
AC_CONFIG_AUX_DIR(cfgaux)
AC_CONFIG_SRCDIR([src/main.cc])
AM_INIT_AUTOMAKE([tar-ustar])
-AC_REVISION($Revision: 1.456 $)dnl
+AC_REVISION($Revision: 1.457 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AM_MAINTAINER_MODE
yes)
echo "Forcing poll() to be enabled"
ac_cv_func_poll='yes'
+ SELECT_TYPE="poll"
;;
no)
echo "Forcing poll() to be disabled"
yes)
echo "Forcing select() to be enabled"
ac_cv_func_select='yes'
+ SELECT_TYPE="select"
;;
no)
echo "Forcing select() to be disabled"
yes)
echo "Forcing kqueue() to be enabled"
ac_cv_func_kqueue='yes'
+ SELECT_TYPE="kqueue"
;;
no)
echo "Forcing kqueue() to be disabled"
case "$enableval" in
yes)
echo "Forcing epoll() to be enabled"
- ac_cv_func_epoll='yes'
+ ac_cv_func_epoll_ctl='yes'
+ SELECT_TYPE="epoll"
;;
no)
echo "Forcing epoll() to be disabled"
- ac_cv_func_epoll='no'
+ ac_cv_func_epoll_ctl='no'
;;
esac
])
gettimeofday \
htobe16 \
htole16 \
+ kqueue\
lrand48 \
mallinfo \
mallocblksize \
vsnprintf \
)
+# Check for libepoll
+EPOLL_LIB=
+AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
+AC_SUBST(EPOLL_LIBS)
+
+# Check for epoll_ctl, may need -lepoll
+SAVED_LIBS="$LIBS"
+LIBS="$LIBS $LIB_EPOLL"
+AC_CHECK_FUNCS(epoll_ctl)
+LIBS="$SAVED_LIBS"
+
+dnl Verify that epoll really works
+if test $ac_cv_func_epoll_ctl = yes; then
+ AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
+ AC_TRY_RUN([
+#include <sys/epoll.h>
+#include <stdlib.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ int fd = epoll_create(256);
+ if (fd < 0) {
+ perror("epoll_create:");
+ exit(1);
+ }
+ exit(0);
+}
+ ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
+ if test ac_cv_epoll_works = no && test ac_force_epoll = yes; then
+ echo "Error - no epoll found";
+ echo "Try running 'sh ./scripts/get_epoll-lib.sh'";
+ echo "then run configure again";
+ exit -1
+ fi
+fi
+
dnl Magic which checks whether we are forcing a type of comm loop we
dnl are actually going to (ab)use
dnl Actually do the define magic now
dnl mostly ripped from squid-commloops, thanks to adrian and benno
-if test "$ac_cv_func_kqueue" = "yes" ; then
- SELECT_TYPE="kqueue"
- AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
-elif test "$ac_cv_func_epoll" = "yes" ; then
+if test -n "$SELECT_TYPE"; then
+ : # Already decided above. Nothing to do here
+elif test "$ac_cv_epoll_works" = "yes" ; then
SELECT_TYPE="epoll"
- AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
- AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
- AC_SUBST(EPOLL_LIBS)
+#comm_kqueue a bit broken. Don't enable automatically
+#elif test "$ac_cv_func_kqueue" = "yes" ; then
+# SELECT_TYPE="kqueue"
elif test "$ac_cv_func_poll" = "yes" ; then
SELECT_TYPE="poll"
- AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
elif test "$ac_cv_func_select" = "yes" ; then
case "$host_os" in
mingw|mingw32)
SELECT_TYPE="select_win32"
- AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
;;
*)
SELECT_TYPE="select"
- AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
;;
esac
else
SELECT_TYPE="select"
AC_DEFINE(USE_SELECT,1)
fi
-echo "Using ${SELECT_TYPE} for select loop."
+
+echo "Using ${SELECT_TYPE} for the IO loop."
+
+AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
+AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
+AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
+AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
+AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
+AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
+AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
+
+case $SELECT_TYPE in
+epoll)
+ AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
+ ;;
+poll)
+ AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
+ ;;
+kqueue)
+ AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
+ ;;
+select_win32)
+ AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
+ ;;
+select)
+ AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
+ ;;
+esac
dnl Yay! Another Linux brokenness. Its not good enough