r2382 - trunk/varnish-cache

des at projects.linpro.no des at projects.linpro.no
Wed Jan 23 21:23:20 CET 2008


Author: des
Date: 2008-01-23 21:23:20 +0100 (Wed, 23 Jan 2008)
New Revision: 2382

Modified:
   trunk/varnish-cache/configure.ac
Log:
Improve readability, such as it is.

Allow the user to disable specific acceptor mechanisms (e.g. do not
use epoll even though it is available).

Don't look for kqueue on systems where we know it doesn't work.

Bail if no acceptor mechanism was found.

Bail if no curses or ncurses was found.

Warn the user if SO_{RCV,SND}TIMEO are non-functional.


Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2008-01-23 16:27:02 UTC (rev 2381)
+++ trunk/varnish-cache/configure.ac	2008-01-23 20:23:20 UTC (rev 2382)
@@ -43,6 +43,11 @@
 LIBS="${save_LIBS}"
 AC_SUBST(CURSES_LIBS)
 
+# people tend to forget about curses until the build breaks
+if test "$ac_cv_search_initscr" = no; then
+	AC_MSG_ERROR([curses or ncurses is required])
+fi
+
 save_LIBS="${LIBS}"
 LIBS=""
 AC_SEARCH_LIBS(pthread_create, [thr pthread c_r])
@@ -125,12 +130,71 @@
 AC_CHECK_FUNCS([clock_gettime])
 LIBS="${save_LIBS}"
 
-# Check which mechanism to use for the acceptor
-AC_CHECK_FUNCS([kqueue])
-AC_CHECK_FUNCS([epoll_ctl])
-AC_CHECK_FUNCS([poll])
+# Check which mechanism to use for the acceptor.  We look for kqueue
+# only on platforms on which we know that it works, because there are
+# platforms where a simple AC_CHECK_FUNCS([kqueue]) would succeed but
+# the build would fail.  We also allow the user to disable mechanisms
+# he doesn't want to use.
 
-# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them
+# --enable-kqueue
+AC_ARG_ENABLE(kqueue,
+    AS_HELP_STRING([--enable-kqueue],
+	[use kqueue if available (default is YES)]),
+    ,
+    [enable_kqueue=yes])
+
+if test "$enable_kqueue" = yes; then
+	case $host in
+	*-*-freebsd*)
+		AC_CHECK_FUNCS([kqueue])
+		;;
+	*-*-bsd*)
+		# No other BSD has a sufficiently recent implementation
+		AC_MSG_WARN([won't look for kqueue() on $host])
+		ac_cv_func_kqueue=no
+		;;
+	esac
+else
+	ac_cv_func_kqueue=no
+fi
+
+# --enable-epoll
+AC_ARG_ENABLE(epoll,
+    AS_HELP_STRING([--enable-epoll],
+	[use epoll if available (default is YES)]),
+    ,
+    [enable_epoll=yes])
+
+if test "$enable_epoll" = yes; then
+	AC_CHECK_FUNCS([epoll_ctl])
+else
+	ac_cv_func_epoll_ctl=no
+fi
+
+# --enable-poll
+AC_ARG_ENABLE(poll,
+    AS_HELP_STRING([--enable-poll],
+	[use poll if available (default is YES)]),
+    ,
+    [enable_poll=yes])
+
+if test "$enable_poll" = yes; then
+	AC_CHECK_FUNCS([poll])
+else
+	ac_cv_func_poll=no
+fi
+
+if test "$ac_cv_func_kqueue" != yes &&
+   test "$ac_cv_func_epoll_ctl" != yes &&
+   test "$ac_cv_func_poll" != yes; then
+	AC_MSG_ERROR([no usable acceptor mechanism])
+fi
+
+# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them.
+# Varnish will build and run without these, but connections will not
+# time out, which may leave Varnish vulnerable to denail-of-service
+# attacks which would not be possible on other platforms.
+
 AC_CACHE_CHECK([whether SO_RCVTIMEO works],
   [ac_cv_so_rcvtimeo_works],
   [AC_RUN_IFELSE(
@@ -169,6 +233,11 @@
    AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works])
 fi
 
+if test "$ac_cv_so_rcvtimeo_works" = no ||
+   test "$ac_cv_so_sndtimeo_works" = no; then
+	AC_MSG_WARN([connection timeouts will not work])
+fi
+
 # Run-time directory
 VARNISH_STATE_DIR='${localstatedir}/varnish'
 AC_SUBST(VARNISH_STATE_DIR)
@@ -182,21 +251,32 @@
 # Additional flags for GCC 4
 EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare"
 
+# --enable-developer-warnings
 AC_ARG_ENABLE(developer-warnings,
 	AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]),
 	CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}")
+
+# --enable-debugging-symbols
 AC_ARG_ENABLE(debugging-symbols,
 	AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]),
 	CFLAGS="${CFLAGS} -O0 -g -fno-inline")
+
+# --enable-diagnostics
 AC_ARG_ENABLE(diagnostics,
 	AS_HELP_STRING([--enable-diagnostics],[enable run-time diagnostics (default is NO)]),
 	CFLAGS="${CFLAGS} -DDIAGNOSTICS")
+
+# --enable-extra-developer-warnings
 AC_ARG_ENABLE(extra-developer-warnings,
 	AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]),
 	CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}")
+
+# --enable-stack-protector
 AC_ARG_ENABLE(stack-protector,
 	AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]),
 	CFLAGS="${CFLAGS} -fstack-protector-all")
+
+# --enable-werror
 AC_ARG_ENABLE(werror,
 	AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]),
 	CFLAGS="${CFLAGS} -Werror")




More information about the varnish-commit mailing list