From 9676633bae23d89f6d69e94382c492c226f300ca Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 22 Apr 2010 15:30:28 +0200 Subject: [PATCH] Reworked and streamlined IO loop methods setting. Refactored some options. --- configure.in | 187 +++++++++++++++++++++------------------------------ 1 file changed, 78 insertions(+), 109 deletions(-) diff --git a/configure.in b/configure.in index 1134429038..694a111838 100644 --- a/configure.in +++ b/configure.in @@ -1145,156 +1145,127 @@ fi AC_SUBST(SSLLIB) -squid_opt_enable_forw_via_db="no" AC_ARG_ENABLE(forw-via-db, AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [ SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval]) - squid_opt_enable_forw_via_db=$enableval ]) -AC_MSG_NOTICE([Forw/Via database enabled: $squid_opt_enable_forw_via_db]) -SQUID_DEFINE_UNQUOTED(FORW_VIA_DB,$squid_opt_enable_forw_via_db,[Enable Forw/Via database]) +SQUID_DEFINE_UNQUOTED(FORW_VIA_DB,${enable_forw_via_db:=no}, + [Enable Forw/Via database]) +AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db]) -squid_opt_enable_cache_digests="no" AC_ARG_ENABLE(cache-digests, AS_HELP_STRING([--enable-cache-digests], - [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]), [ - SQUID_YESNO([$enableval],[unrecognized argument to --enable-cache-digests: $enableval]) - squid_opt_enable_cache_digests=$enableval + [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]), +[ + SQUID_YESNO($enableval, + [unrecognized argument to --enable-cache-digests: $enableval]) ]) -AC_MSG_NOTICE([Cache Digests enabled: $squid_opt_enable_cache_digests]) -SQUID_DEFINE_UNQUOTED(USE_CACHE_DIGESTS,$squid_opt_enable_cache_digests, +SQUID_DEFINE_UNQUOTED(USE_CACHE_DIGESTS,${enable_cache_digests:=no}, [Use Cache Digests for locating objects in neighbor caches.]) +AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests]) dnl Size of COSS memory buffer squid_opt_coss_membuf_size=1048576 AC_ARG_WITH(coss-membuf-size, - AS_HELP_STRING([--with-coss-membuf-size=size],[COSS membuf size (default 1048576 bytes)]), [ - case $withval in - [[0-9]]*) squid_opt_coss_membuf_size=$withval ;; - *) AC_MSG_ERROR([--with-coss-membuf-size expects a numeric argument]) ;; - esac - AC_MSG_NOTICE([Setting COSS membuf size to $withval bytes]) + AS_HELP_STRING([--with-coss-membuf-size=size], + [COSS membuf size (default $squid_opt_coss_membuf_size bytes)]), [ +case $withval in + [[0-9]]*) squid_opt_coss_membuf_size=$withval ;; + *) AC_MSG_ERROR([--with-coss-membuf-size expects a numeric argument]) ;; +esac ]) +AC_MSG_NOTICE([Setting COSS membuf size to $squid_opt_coss_membuf_size bytes]) AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $squid_opt_coss_membuf_size, - [Define if you want to set the COSS membuf size]) + [Default COSS membuf size]) + +################################ +# check for netio plugin stuff # +################################ +dnl order of these options handling is relevant in case the user +dnl supplies more than one --enable option. Options handled later +dnl override those handled earlier for io loop method manual override +AC_ARG_ENABLE(select, + AS_HELP_STRING([--disable-select],[Disable select(2) support.]), +[ +SQUID_YESNO($enableval,[--disable-select takes no extra argument]) +test $enableval = "yes" && squid_opt_io_loop_engine="select" +]) +AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}]) -# check for netio plugin stuff -dnl Enable poll() -squid_opt_enable_poll=auto AC_ARG_ENABLE(poll, AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]), [ - case "$enableval" in - yes) - squid_opt_io_loop_engine="poll" - squid_opt_enable_poll=yes - ;; - no) - squid_opt_enable_poll=no - ;; - esac +SQUID_YESNO($enableval,[--disable-poll takes no extra argument]) +test $enableval = "yes" && squid_opt_io_loop_engine="poll" ]) -AC_MSG_NOTICE([enabling the use of poll() for net I/O: $squid_opt_enable_poll]) +AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}]) -dnl Enable select() -squid_opt_enable_select=auto -AC_ARG_ENABLE(select, - AS_HELP_STRING([--disable-select],[Disable select(2) support.]), -[ - case "$enableval" in - yes) - squid_opt_io_loop_engine="select" - squid_opt_enable_select=yes - ;; - no) - squid_opt_enable_select=no - ;; - esac -]) -AC_MSG_NOTICE([enabling the use of select() for net I/O: $squid_opt_enable_select]) - -dnl Enable kqueue() -dnl kqueue support is still experiemntal and unstable. Not enabled by default. -squid_opt_enable_kqueue="no" +# kqueue support is still experiemntal and unstable. Not enabled by default. AC_ARG_ENABLE(kqueue, - AS_HELP_STRING([--enable-kqueue],[Enable kqueue(2) support (experimental).]), -[ - case "$enableval" in - yes) - squid_opt_io_loop_engine="kqueue" - AC_CHECK_HEADERS([sys/event.h],[], - [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ]) - squid_opt_enable_kqueue=yes - ;; - no) - squid_opt_enable_kqueue=no - ;; - esac + AS_HELP_STRING([--enable-kqueue], + [Enable kqueue(2) support (experimental).]), [ +SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument]) ]) -AC_MSG_NOTICE([enabling the use of kqueue for net I/O: $squid_opt_enable_kqueue]) +if test ${enable_kqueue:=no} = "yes" ; then + AC_CHECK_HEADERS([sys/event.h],[], + [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ]) + squid_opt_io_loop_engine="kqueue" +fi +AC_MSG_NOTICE([enabling kqueue for net I/O: $enable_kqueue]) dnl Enable epoll() -squid_opt_enable_epoll="auto" AC_ARG_ENABLE(epoll, AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]), [ - case "$enableval" in - yes) - squid_opt_io_loop_engine="epoll" - squid_opt_enable_epoll="yes" - ;; - no) - squid_opt_enable_epoll="no" - ;; -esac +SQUID_YESNO($enableval,[--disable-epoll takes no extra argument]) +test $enableval = "yes" && squid_opt_io_loop_engine="epoll" ]) -AC_MSG_NOTICE([enabling the use of epoll for net I/O: $squid_opt_enable_epoll]) - -dnl auto-detect and verify epoll header and library present and working -if test "$squid_opt_enable_epoll" != "no" ; then - - # Check for libepoll - EPOLL_LIBS="" - 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 +AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}]) +# auto-detect and verify epoll header and library present and working +# logic mapping and loop method selection are performed later +if test "$enable_epoll" != "no" ; then - # Check for epoll_ctl, may need -lepoll + # check if libs are needed to support epoll + # note: this code block seems quite generic. Could it be extracted + # into a squid specific configure function? SQUID_STATE_SAVE(squid_epoll_state) - LIBS="$LIBS $EPOLL_LIBS" - AC_CHECK_FUNCS(epoll_ctl) - SQUID_STATE_ROLLBACK(squid_epoll_state) + AC_SEARCH_LIBS(epoll_ctl,[epoll]) + if test "$ac_cv_search_epoll_ctl" = "no" ; then + enable_epoll=no #disable. Needed code not found + elif test "$ac_cv_search_epoll_ctl" = "none required" ; then + EPOLL_LIBS="" + else + EPOLL_LIBS=$ac_cv_search_epoll_ctl + fi + AC_SUBST(EPOLL_LIBS) + SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS - dnl epoll requires sys/epoll.h + # epoll requires sys/epoll.h AC_CHECK_HEADERS([sys/epoll.h]) dnl Verify that epoll really works - if test $ac_cv_func_epoll_ctl = yes; then + if test "$ac_cv_func_epoll_ctl" = yes; then SQUID_CHECK_EPOLL fi - if test "$squid_opt_enable_epoll" = "yes" && test "$squid_cv_epoll_works" = "no" ; then + if test "$enable_epoll" = "yes" -a "$squid_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 -squid_opt_enable_http_violations="yes" + AC_ARG_ENABLE(http-violations, AS_HELP_STRING([--disable-http-violations], [This allows you to remove code which is known to violate the HTTP protocol specification.]), [ - SQUID_YESNO([$enableval],[unrecognized argument to --disable-http-violations: $enableval]) - squid_opt_enable_http_violations=$enableval + SQUID_YESNO([$enableval], + [unrecognized argument to --disable-http-violations: $enableval]) ]) -AC_MSG_NOTICE([HTTP violations support enabled: $squid_opt_kill_parent]) -SQUID_DEFINE_UNQUOTED(HTTP_VIOLATIONS, $squid_opt_enable_http_violations, +SQUID_DEFINE_UNQUOTED(HTTP_VIOLATIONS, ${enable_http_violations:=yes}, [Define to enable code which volates the HTTP standard specification]) +AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations]) # IPFW Transparent Proxy squid_opt_enable_ipfw_transparent="no" @@ -3106,21 +3077,19 @@ AC_REPLACE_FUNCS(\ tempnam \ ) -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 +# Magic which checks whether we are forcing a type of comm loop we +# are actually going to (ab)use. +# Mostly ripped from squid-commloops, thanks to adrian and benno if test -n "$squid_opt_io_loop_engine"; then AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine]) -elif test "$squid_opt_enable_epoll" != "no" && test "$ac_cv_epoll_works" = "yes" ; then +elif test "$enable_epoll" != "no" && test "$squid_cv_epoll_works" = "yes" ; then squid_opt_io_loop_engine="epoll" -elif test "$squid_opt_enable_kqueue" != "no" && test "$ac_cv_func_kqueue" = "yes" ; then +elif test "$enable_kqueue" != "no" && test "$ac_cv_func_kqueue" = "yes" ; then squid_opt_io_loop_engine="kqueue" -elif test "$squid_opt_enable_poll" != "no" && test "$ac_cv_func_poll" = "yes" ; then +elif test "$enable_poll" != "no" && test "$ac_cv_func_poll" = "yes" ; then squid_opt_io_loop_engine="poll" -elif test "$squid_opt_enable_select" != "no" && test "$ac_cv_func_select" = "yes" ; then +elif test "$enable_select" != "no" && test "$ac_cv_func_select" = "yes" ; then squid_opt_io_loop_engine="select" if test "$squid_host_os" = "mingw" ; then squid_opt_io_loop_engine="select_win32" -- 2.47.2