From 3dfa202e4fea6b985bcf8761e2d11c176baa40d1 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 22 Aug 2008 13:17:56 +0000 Subject: [PATCH] 2424. [port] configure now probes for a working epoll implementation. Allow the use of kqueue, epoll and /dev/poll to be selected at compile time. [RT #18277] --- CHANGES | 5 ++ configure | 212 +++++++++++++++++++++++++++------------------------ configure.in | 61 +++++++++++---- 3 files changed, 165 insertions(+), 113 deletions(-) diff --git a/CHANGES b/CHANGES index dbdc79457e..6041858e68 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +2424. [port] configure now probes for a working epoll + implementation. Allow the use of kqueue, + epoll and /dev/poll to be selected at compile + time. [RT #18277] + 2423. [security] Randomize server selection on queries, so as to make forgery a little more difficult. Instead of always preferring the server with the lowest RTT, diff --git a/configure b/configure index da6b6385e2..4091dbe51a 100755 --- a/configure +++ b/configure @@ -14,7 +14,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # -# $Id: configure,v 1.432 2008/08/05 07:05:47 marka Exp $ +# $Id: configure,v 1.433 2008/08/22 13:17:56 marka Exp $ # # Portions Copyright (C) 1996-2001 Nominum, Inc. # @@ -29,7 +29,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# From configure.in Revision: 1.446 . +# From configure.in Revision: 1.447 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # @@ -1625,6 +1625,9 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-kqueue use BSD kqueue when available [default=yes] + --enable-epoll use Linux epoll when available [default=yes] + --enable-devpoll use /dev/poll when available [default=yes] --enable-openssl-version-check Check OpenSSL Version [default=yes] --enable-threads enable multithreading @@ -5290,7 +5293,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # # check if we have kqueue # -{ echo "$as_me:$LINENO: checking for kqueue" >&5 +# Check whether --enable-kqueue was given. +if test "${enable_kqueue+set}" = set; then + enableval=$enable_kqueue; want_kqueue="$enableval" +else + want_kqueue="yes" +fi + +case $want_kqueue in +yes) + { echo "$as_me:$LINENO: checking for kqueue" >&5 echo $ECHO_N "checking for kqueue... $ECHO_C" >&6; } if test "${ac_cv_func_kqueue+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5377,9 +5389,14 @@ else ac_cv_have_kqueue=no fi -case $ac_cv_have_kqueue in -yes) - ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1" + case $ac_cv_have_kqueue in + yes) + ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1" + ;; + *) + ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" + ;; + esac ;; *) ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" @@ -5388,12 +5405,26 @@ esac # -# check if we have epoll +# check if we have epoll. Linux kernel 2.4 has epoll_create() which fails, +# so we need to try running the code, not just test its existence. # -{ echo "$as_me:$LINENO: checking for epoll_create" >&5 -echo $ECHO_N "checking for epoll_create... $ECHO_C" >&6; } -if test "${ac_cv_func_epoll_create+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# Check whether --enable-epoll was given. +if test "${enable_epoll+set}" = set; then + enableval=$enable_epoll; want_epoll="$enableval" +else + want_epoll="yes" +fi + +case $want_epoll in +yes) + { echo "$as_me:$LINENO: checking epoll support" >&5 +echo $ECHO_N "checking epoll support... $ECHO_C" >&6; } + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5401,85 +5432,52 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define epoll_create to an innocuous variant, in case declares epoll_create. - For example, HP-UX 11i declares gettimeofday. */ -#define epoll_create innocuous_epoll_create -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char epoll_create (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef epoll_create - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char epoll_create (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_epoll_create || defined __stub___epoll_create -choke me -#endif - -int -main () -{ -return epoll_create (); - ; - return 0; +#include +int main() { + if (epoll_create(1) < 0) + return (1); + return (0); } + _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_epoll_create=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1" else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_epoll_create=no +( exit $ac_status ) +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_epoll_create" >&5 -echo "${ECHO_T}$ac_cv_func_epoll_create" >&6; } -if test $ac_cv_func_epoll_create = yes; then - ac_cv_have_epoll=yes -else - ac_cv_have_epoll=no -fi -case $ac_cv_have_epoll in -yes) - ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1" ;; *) ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" @@ -5490,6 +5488,15 @@ esac # # check if we support /dev/poll # +# Check whether --enable-devpoll was given. +if test "${enable_devpoll+set}" = set; then + enableval=$enable_devpoll; want_devpoll="$enableval" +else + want_devpoll="yes" +fi + +case $want_devpoll in +yes) for ac_header in sys/devpoll.h do @@ -5634,6 +5641,11 @@ fi done + ;; +*) + ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" + ;; +esac # @@ -9975,7 +9987,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 9978 "configure"' > conftest.$ac_ext + echo '#line 9990 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -12097,11 +12109,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12100: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12112: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12104: \$? = $ac_status" >&5 + echo "$as_me:12116: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12340,11 +12352,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12343: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12355: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12347: \$? = $ac_status" >&5 + echo "$as_me:12359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12400,11 +12412,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12403: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12415: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12407: \$? = $ac_status" >&5 + echo "$as_me:12419: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14548,7 +14560,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16854: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16846: \$? = $ac_status" >&5 + echo "$as_me:16858: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16899,11 +16911,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16902: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16914: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16906: \$? = $ac_status" >&5 + echo "$as_me:16918: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18227,7 +18239,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19177: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19169: \$? = $ac_status" >&5 + echo "$as_me:19181: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -19222,11 +19234,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19225: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19237: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19229: \$? = $ac_status" >&5 + echo "$as_me:19241: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21256,11 +21268,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21259: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21271: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21263: \$? = $ac_status" >&5 + echo "$as_me:21275: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21499,11 +21511,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21502: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21514: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21506: \$? = $ac_status" >&5 + echo "$as_me:21518: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21559,11 +21571,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21562: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21574: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21566: \$? = $ac_status" >&5 + echo "$as_me:21578: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23707,7 +23719,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < +int main() { + if (epoll_create(1) < 0) + return (1); + return (0); +} +], + [AC_MSG_RESULT(yes) + ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"], + [AC_MSG_RESULT(no) + ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"]) ;; *) ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" @@ -348,11 +373,21 @@ AC_SUBST(ISC_PLATFORM_HAVEEPOLL) # # check if we support /dev/poll # -AC_CHECK_HEADERS(sys/devpoll.h, -ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1" -, -ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" -) +AC_ARG_ENABLE(devpoll, + [ --enable-devpoll use /dev/poll when available [[default=yes]]], + want_devpoll="$enableval", want_devpoll="yes") +case $want_devpoll in +yes) + AC_CHECK_HEADERS(sys/devpoll.h, + ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1" + , + ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" + ) + ;; +*) + ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" + ;; +esac AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL) #