From 903b682c6b5e9f0e8f51a670fbc3943b06ffaf7d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Mar 1999 14:12:38 +0000 Subject: [PATCH] thread compilation fixed for FreeBSD 3.1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 53 ++++++++++++++++++++++++++-------------------------- configure.in | 26 ++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/configure b/configure index 523da68838..02a8905ed0 100755 --- a/configure +++ b/configure @@ -7549,21 +7549,22 @@ fi if test "$wxUSE_THREADS" = "1"; then + for ac_hdr in sched.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7557: checking for $ac_hdr" >&5 +echo "configure:7558: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -7591,7 +7592,7 @@ done echo $ac_n "checking for sched_yield in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7595: checking for sched_yield in -l$THREADS_LINK" >&5 +echo "configure:7596: checking for sched_yield in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7599,7 +7600,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7632,7 +7633,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -l"posix4"""... $ac_c" 1>&6 -echo "configure:7636: checking for sched_yield in -l"posix4"" >&5 +echo "configure:7637: checking for sched_yield in -l"posix4"" >&5 ac_lib_var=`echo "posix4"'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7640,7 +7641,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7680,27 +7681,27 @@ fi fi - echo $ac_n "checking for sched_get_priority_min in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7685: checking for sched_get_priority_min in -l$THREADS_LINK" >&5 -ac_lib_var=`echo $THREADS_LINK'_'sched_get_priority_min | sed 'y%./+-%__p_%'` + echo $ac_n "checking for pthread_attr_getschedpolicy in -l$THREADS_LINK""... $ac_c" 1>&6 +echo "configure:7686: checking for pthread_attr_getschedpolicy in -l$THREADS_LINK" >&5 +ac_lib_var=`echo $THREADS_LINK'_'pthread_attr_getschedpolicy | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7721,27 +7722,27 @@ EOF else echo "$ac_t""no" 1>&6 -echo $ac_n "checking for sched_get_priority_min in -l"posix4"""... $ac_c" 1>&6 -echo "configure:7726: checking for sched_get_priority_min in -l"posix4"" >&5 -ac_lib_var=`echo "posix4"'_'sched_get_priority_min | sed 'y%./+-%__p_%'` +echo $ac_n "checking for pthread_attr_getschedpolicy in -l"posix4"""... $ac_c" 1>&6 +echo "configure:7727: checking for pthread_attr_getschedpolicy in -l"posix4"" >&5 +ac_lib_var=`echo "posix4"'_'pthread_attr_getschedpolicy | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7771,7 +7772,7 @@ fi echo $ac_n "checking for pthread_cancel in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7775: checking for pthread_cancel in -l$THREADS_LINK" >&5 +echo "configure:7776: checking for pthread_cancel in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'pthread_cancel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7779,7 +7780,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index a2e1b2cf57..76e9cef27c 100644 --- a/configure.in +++ b/configure.in @@ -1439,6 +1439,21 @@ fi dnl do other tests only if we are using threads if test "$wxUSE_THREADS" = "1"; then + dnl define autoconf macro to check for given function in both pthread and + dnl posix4 libraries + dnl usage: AC_FUNC_THREAD(FUNCTION_NAME) + dnl VZ: TODO + dnl AC_DEFUN(AC_FUNC_THREAD, + dnl [ + dnl AC_CHECK_LIB($THREADS_LINK, $1, + dnl AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'), + dnl [AC_CHECK_LIB("posix4", $1, + dnl [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z')) + dnl POSIX4_LINK="-lposix4" + dnl ]) + dnl ]) + dnl ]) + AC_CHECK_HEADERS(sched.h) AC_CHECK_LIB($THREADS_LINK, sched_yield, @@ -1449,9 +1464,16 @@ if test "$wxUSE_THREADS" = "1"; then )] ) - AC_CHECK_LIB($THREADS_LINK, sched_get_priority_min, + dnl VZ: we should be checking for all of the following functions instead: + dnl 1. pthread_attr_getschedpolicy + dnl 2. sched_get_priority_min and sched_get_priority_max + dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam + dnl but it seems that if the first one is there, the other ones are too (of + dnl course the proper solution would be to implement AC_FUNC_THREAD above + dnl and do test for them all - anyone?) + AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy, AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS), - [AC_CHECK_LIB("posix4", sched_get_priority_min, + [AC_CHECK_LIB("posix4", pthread_attr_getschedpolicy, [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) POSIX4_LINK="-lposix4"], AC_MSG_WARN(Setting thread priority will not work) )] -- 2.45.2