From d9b9876f6eceab934d81ff2ca48702493150f5b9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Apr 2001 13:25:04 +0000 Subject: [PATCH] fixed recursive mutexs compilation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 307 +++++++++++++++++++++++++++-------------- configure.in | 56 +++++++- setup.h.in | 6 + src/unix/threadpsx.cpp | 13 ++ 4 files changed, 275 insertions(+), 107 deletions(-) diff --git a/configure b/configure index 5ccd05cada..55972272c2 100755 --- a/configure +++ b/configure @@ -12606,10 +12606,6 @@ if { (eval echo configure:12606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; rm -rf conftest* wx_cv_func_pthread_cleanup_push=yes - cat >> confdefs.h <<\EOF -#define HAVE_THREAD_CLEANUP_FUNCTIONS 1 -EOF - else echo "configure: failed program was:" >&5 @@ -12625,6 +12621,105 @@ fi echo "$ac_t""$wx_cv_func_pthread_cleanup_push" 1>&6 + if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_THREAD_CLEANUP_FUNCTIONS 1 +EOF + + fi + + +#ifdef HAVE_PTHREAD_MUTEXATTR_T +#elif defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + + echo $ac_n "checking for pthread_mutexattr_t""... $ac_c" 1>&6 +echo "configure:12637: checking for pthread_mutexattr_t" >&5 +if eval "test \"`echo '$''{'wx_cv_type_pthread_mutexattr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + + pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + +; return 0; } +EOF +if { (eval echo configure:12653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + wx_cv_type_pthread_mutexattr_t=yes + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + wx_cv_type_pthread_mutexattr_t=no + + +fi +rm -f conftest* + +fi + +echo "$ac_t""$wx_cv_type_pthread_mutexattr_t" 1>&6 + + if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_PTHREAD_MUTEXATTR_T 1 +EOF + + else + echo $ac_n "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER""... $ac_c" 1>&6 +echo "configure:12680: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5 +if eval "test \"`echo '$''{'wx_cv_type_pthread_rec_mutex_init'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + + pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + +; return 0; } +EOF +if { (eval echo configure:12695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + wx_cv_type_pthread_rec_mutex_init=yes + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + wx_cv_type_pthread_rec_mutex_init=no + + +fi +rm -f conftest* + +fi + +echo "$ac_t""$wx_cv_type_pthread_rec_mutex_init" 1>&6 + if test "$wx_cv_type_pthread_rec_mutex_init"="yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER 1 +EOF + + else + echo "configure: warning: wxMutex won't be recursive on this platform" 1>&2 + fi + fi + THREADS_LINK="-l$THREADS_LINK" if test "$USE_SOLARIS" = "yes" -a "$GCC" != "yes"; then @@ -12651,7 +12746,7 @@ EOF else if test "$ac_cv_func_strtok_r" = "yes"; then echo $ac_n "checking if -D_REENTRANT is needed""... $ac_c" 1>&6 -echo "configure:12655: checking if -D_REENTRANT is needed" >&5 +echo "configure:12750: checking if -D_REENTRANT is needed" >&5 if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then CFLAGS="${CFLAGS} -D_REENTRANT" CXXFLAGS="${CXXFLAGS} -D_REENTRANT" @@ -12795,17 +12890,17 @@ EOF ZLIB_LINK= ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 -echo "configure:12799: checking for zlib.h" >&5 +echo "configure:12894: checking for zlib.h" >&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:12809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12822,7 +12917,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:12826: checking for deflate in -lz" >&5 +echo "configure:12921: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12830,7 +12925,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12888,17 +12983,17 @@ EOF PNG_LINK= ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:12892: checking for png.h" >&5 +echo "configure:12987: checking for png.h" >&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:12902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12915,7 +13010,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for png_check_sig in -lpng""... $ac_c" 1>&6 -echo "configure:12919: checking for png_check_sig in -lpng" >&5 +echo "configure:13014: checking for png_check_sig in -lpng" >&5 ac_lib_var=`echo png'_'png_check_sig | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12923,7 +13018,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng -lz -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12979,17 +13074,17 @@ EOF JPEG_LINK= ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:12983: checking for jpeglib.h" >&5 +echo "configure:13078: checking for jpeglib.h" >&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:12993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13006,7 +13101,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6 -echo "configure:13010: checking for jpeg_read_header in -ljpeg" >&5 +echo "configure:13105: checking for jpeg_read_header in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_read_header | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13014,7 +13109,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13067,17 +13162,17 @@ EOF TIFF_LINK= ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:13071: checking for tiffio.h" >&5 +echo "configure:13166: checking for tiffio.h" >&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:13081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13094,7 +13189,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for TIFFError in -ltiff""... $ac_c" 1>&6 -echo "configure:13098: checking for TIFFError in -ltiff" >&5 +echo "configure:13193: checking for TIFFError in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFError | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13102,7 +13197,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltiff -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13155,17 +13250,17 @@ EOF FREETYPE_LINK= ac_safe=`echo "freetype.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for freetype.h""... $ac_c" 1>&6 -echo "configure:13159: checking for freetype.h" >&5 +echo "configure:13254: checking for freetype.h" >&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:13169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13264: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13182,7 +13277,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for FT_Render_Glyph in -lfreetype""... $ac_c" 1>&6 -echo "configure:13186: checking for FT_Render_Glyph in -lfreetype" >&5 +echo "configure:13281: checking for FT_Render_Glyph in -lfreetype" >&5 ac_lib_var=`echo freetype'_'FT_Render_Glyph | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13190,7 +13285,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lfreetype -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13235,17 +13330,17 @@ fi if test "$wxUSE_OPENGL" = "yes"; then ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:13239: checking for GL/gl.h" >&5 +echo "configure:13334: checking for GL/gl.h" >&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:13249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13271,7 +13366,7 @@ EOF EOF echo $ac_n "checking for glFlush in -lGL""... $ac_c" 1>&6 -echo "configure:13275: checking for glFlush in -lGL" >&5 +echo "configure:13370: checking for glFlush in -lGL" >&5 ac_lib_var=`echo GL'_'glFlush | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13279,7 +13374,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lGL $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13312,7 +13407,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for glFlush in -lMesaGL""... $ac_c" 1>&6 -echo "configure:13316: checking for glFlush in -lMesaGL" >&5 +echo "configure:13411: checking for glFlush in -lMesaGL" >&5 ac_lib_var=`echo MesaGL'_'glFlush | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13320,7 +13415,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lMesaGL $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13534,12 +13629,12 @@ if test "$wxUSE_TIMEDATE" = "yes"; then for ac_func in strptime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:13538: checking for $ac_func" >&5 +echo "configure:13633: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -13588,13 +13683,13 @@ done echo $ac_n "checking for timezone variable in ""... $ac_c" 1>&6 -echo "configure:13592: checking for timezone variable in " >&5 +echo "configure:13687: checking for timezone variable in " >&5 if eval "test \"`echo '$''{'wx_cv_var_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -13606,7 +13701,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=__timezone @@ -13617,7 +13712,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -13629,7 +13724,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=_timezone @@ -13640,7 +13735,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -13652,7 +13747,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=timezone @@ -13687,12 +13782,12 @@ EOF for ac_func in localtime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:13691: checking for $ac_func" >&5 +echo "configure:13786: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -13742,13 +13837,13 @@ done if test "$ac_cv_func_localtime" = "yes"; then echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:13746: checking for tm_gmtoff in struct tm" >&5 +echo "configure:13841: checking for tm_gmtoff in struct tm" >&5 if eval "test \"`echo '$''{'wx_cv_struct_tm_has_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -13760,7 +13855,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_struct_tm_has_gmtoff=yes @@ -13786,12 +13881,12 @@ echo "$ac_t""$wx_cv_struct_tm_has_gmtoff" 1>&6 for ac_func in gettimeofday ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:13790: checking for $ac_func" >&5 +echo "configure:13885: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -13841,7 +13936,7 @@ done if test "$ac_cv_func_gettimeofday" = "yes"; then echo $ac_n "checking whether gettimeofday takes two arguments""... $ac_c" 1>&6 -echo "configure:13845: checking whether gettimeofday takes two arguments" >&5 +echo "configure:13940: checking whether gettimeofday takes two arguments" >&5 if eval "test \"`echo '$''{'wx_cv_func_gettimeofday_has_2_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -13856,7 +13951,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < @@ -13870,7 +13965,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=yes else @@ -13878,7 +13973,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -13891,7 +13986,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=no else @@ -13937,12 +14032,12 @@ if test "$TOOLKIT" != "MSW"; then if test "$wxUSE_SOCKETS" = "yes"; then echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:13941: checking for socket" >&5 +echo "configure:14036: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -13983,7 +14078,7 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:13987: checking for socket in -lsocket" >&5 +echo "configure:14082: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13991,7 +14086,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14035,7 +14130,7 @@ fi if test "$wxUSE_SOCKETS" = "yes" ; then echo $ac_n "checking what is the type of the third argument of getsockname""... $ac_c" 1>&6 -echo "configure:14039: checking what is the type of the third argument of getsockname" >&5 +echo "configure:14134: checking what is the type of the third argument of getsockname" >&5 if eval "test \"`echo '$''{'wx_cv_type_getsockname3'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -14050,7 +14145,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < @@ -14063,7 +14158,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=socklen_t else @@ -14071,7 +14166,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -14084,7 +14179,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=size_t else @@ -14092,7 +14187,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -14105,7 +14200,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=int else @@ -14167,17 +14262,17 @@ if test "$wxUSE_JOYSTICK" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:14171: checking for $ac_hdr" >&5 +echo "configure:14266: 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:14181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:14276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -14233,12 +14328,12 @@ if test "$wxUSE_DYNLIB_CLASS" = "yes"; then for ac_func in dlopen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:14237: checking for $ac_func" >&5 +echo "configure:14332: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -14289,7 +14384,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:14293: checking for dlopen in -ldl" >&5 +echo "configure:14388: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14297,7 +14392,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14337,12 +14432,12 @@ else for ac_func in shl_load do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:14341: checking for $ac_func" >&5 +echo "configure:14436: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -14393,7 +14488,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld in -lshl_load""... $ac_c" 1>&6 -echo "configure:14397: checking for dld in -lshl_load" >&5 +echo "configure:14492: checking for dld in -lshl_load" >&5 ac_lib_var=`echo shl_load'_'dld | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14401,7 +14496,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lshl_load $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14451,12 +14546,12 @@ done for ac_func in dlerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:14455: checking for $ac_func" >&5 +echo "configure:14550: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -14504,7 +14599,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6 -echo "configure:14508: checking for dlerror in -ldl" >&5 +echo "configure:14603: checking for dlerror in -ldl" >&5 ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14512,7 +14607,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14752,17 +14847,17 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:14756: checking for $ac_hdr" >&5 +echo "configure:14851: 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:14766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:14861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -15342,7 +15437,7 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:15346: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:15441: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 diff --git a/configure.in b/configure.in index b8be78505c..3910159caf 100644 --- a/configure.in +++ b/configure.in @@ -2698,12 +2698,66 @@ if test "$wxUSE_THREADS" = "yes" ; then pthread_cleanup_pop(0); ], [ wx_cv_func_pthread_cleanup_push=yes - AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS) ], [ wx_cv_func_pthread_cleanup_push=no ]) ]) + if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then + AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS) + fi + + dnl mutexattr_t initialization is done in quite different ways on different + dnl platforms, so check for a few things: + dnl + dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes + dnl HAVE_MUTEXATTR_SETTYPE means that we do it using + dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not + dnl defined, we do it by directly assigned + dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr + +#ifdef HAVE_PTHREAD_MUTEXATTR_T +#elif defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + + AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t, + [ + AC_TRY_COMPILE([#include ], + [ + pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + ], [ + wx_cv_type_pthread_mutexattr_t=yes + ], [ + wx_cv_type_pthread_mutexattr_t=no + ] + ) + ]) + + if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then + AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T) + else + dnl don't despair, there may be another way to do it + AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER], + wx_cv_type_pthread_rec_mutex_init, + [ + AC_TRY_COMPILE([#include ], + [ + pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + ], [ + wx_cv_type_pthread_rec_mutex_init=yes + ], [ + wx_cv_type_pthread_rec_mutex_init=no + ] + ) + ]) + if test "$wx_cv_type_pthread_rec_mutex_init"="yes"; then + AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + else + dnl this may break code working elsewhere, so at least warn about it + AC_MSG_WARN([wxMutex won't be recursive on this platform]) + fi + fi + THREADS_LINK="-l$THREADS_LINK" dnl building MT programs under Solaris with the native compiler requires -mt diff --git a/setup.h.in b/setup.h.in index 6fb515424e..7b33cca04b 100644 --- a/setup.h.in +++ b/setup.h.in @@ -676,6 +676,12 @@ /* Define if you have sched_yield */ #undef HAVE_SCHED_YIELD +/* Define if you have pthread_mutexattr_t and functions to work with it */ +#undef HAVE_PTHREAD_MUTEXATTR_T + +/* Define if you have PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */ +#undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER + /* Define if you have pthread_cancel */ #undef HAVE_PTHREAD_CANCEL diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index a56b6f751c..8207ca3576 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -166,10 +166,23 @@ wxMutex::wxMutex() // support recursive locks like Win32, i.e. a thread can lock a mutex which // it had itself already locked + // + // but initialization of recursive mutexes is non portable , so try + // several methods +#ifdef HAVE_PTHREAD_MUTEXATTR_T pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&(m_internal->m_mutex), &attr); +#elif defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + // we can use this only as initializer so we have to assign it first to a + // temp var - assigning directly to m_mutex wouldn't even compile + pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + m_internal->m_mutex = mutex; +#else // no recursive mutexes + pthread_mutex_init(&(m_internal->m_mutex), NULL); +#endif // HAVE_PTHREAD_MUTEXATTR_T/... m_locked = 0; }