From: Wouter Wijngaards Date: Wed, 2 Jun 2010 08:43:29 +0000 (+0000) Subject: windows thread library check X-Git-Tag: release-1.4.5rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e8551e1cef1c54ae507e97a252776f0bcfe3d22;p=thirdparty%2Funbound.git windows thread library check git-svn-id: file:///svn/unbound/trunk@2132 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/configure b/configure index ce8221d66..d96e047d1 100755 --- a/configure +++ b/configure @@ -13710,6 +13710,58 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# check windows threads (we use them, not pthreads, on windows). +if test "$on_mingw" = "yes"; then +# check windows threads + for ac_header in windows.h +do : + ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default +" +if test "x$ac_cv_header_windows_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CreateThread" >&5 +$as_echo_n "checking for CreateThread... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WINDOWS_H +#include +#endif + +int +main () +{ + + HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_WINDOWS_THREADS 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else +# not on mingw, check thread libraries. + # check for thread library. # check this first, so that the pthread lib does not get linked in via # libssl or libpython, and thus distorts the tests, and we end up using @@ -14214,54 +14266,7 @@ fi fi fi -# check windows threads -if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then - for ac_header in windows.h -do : - ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default -" -if test "x$ac_cv_header_windows_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CreateThread" >&5 -$as_echo_n "checking for CreateThread... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef HAVE_WINDOWS_H -#include -#endif - -int -main () -{ - - HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_WINDOWS_THREADS 1" >>confdefs.h - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi +fi # end of non-mingw check of thread libraries # Check for PyUnbound diff --git a/configure.ac b/configure.ac index 33768a842..b666a24ab 100644 --- a/configure.ac +++ b/configure.ac @@ -248,6 +248,27 @@ ACX_SYS_LARGEFILE ACX_CHECK_NONBLOCKING_BROKEN ACX_MKDIR_ONE_ARG +# check windows threads (we use them, not pthreads, on windows). +if test "$on_mingw" = "yes"; then +# check windows threads + AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT]) + AC_MSG_CHECKING([for CreateThread]) + AC_TRY_COMPILE([ +#ifdef HAVE_WINDOWS_H +#include +#endif +], [ + HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); +], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads]) +, + AC_MSG_RESULT(no) +) + +else +# not on mingw, check thread libraries. + # check for thread library. # check this first, so that the pthread lib does not get linked in via # libssl or libpython, and thus distorts the tests, and we end up using @@ -288,23 +309,7 @@ if test x_$withval != x_no; then fi fi -# check windows threads -if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then - AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT]) - AC_MSG_CHECKING([for CreateThread]) - AC_TRY_COMPILE([ -#ifdef HAVE_WINDOWS_H -#include -#endif -], [ - HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); -], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads]) -, - AC_MSG_RESULT(no) -) -fi +fi # end of non-mingw check of thread libraries # Check for PyUnbound AC_ARG_WITH(pyunbound,