From abc736fd0eb6be85b0c091b078cebe96f5e4393f Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Fri, 10 Jun 2005 12:04:15 +0000 Subject: [PATCH] Declare gtk_icon_size_lookup if it is missing from the GTK+ headers (Bug 1177079) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 167 +++++++++++++++++++++++++++++++++++++- configure.in | 19 +++++ include/wx/gtk/private.h | 9 ++ include/wx/gtk1/private.h | 9 ++ setup.h.in | 3 + src/common/artprov.cpp | 2 +- src/gtk/artgtk.cpp | 21 +---- src/gtk1/artgtk.cpp | 21 +---- 8 files changed, 210 insertions(+), 41 deletions(-) diff --git a/configure b/configure index 99bc2767cf..1b3409e752 100755 --- a/configure +++ b/configure @@ -25789,7 +25789,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" CFLAGS="$CFLAGS $wx_cv_cflags_gtk" - LIBS="$LIBS $wx_cv_lib_gtk" + LIBS="$LIBS $wx_cv_libs_gtk" for ac_func in pango_font_family_is_monospace @@ -25894,6 +25894,68 @@ fi done + echo "$as_me:$LINENO: checking if gtk_icon_size_lookup is missing" >&5 +echo $ECHO_N "checking if gtk_icon_size_lookup is missing... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + +int +main () +{ + + void *f = gtk_icon_size_lookup; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + cat >>confdefs.h <<\_ACEOF +#define NEED_GTK_ICON_SIZE_LOOKUP 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking if GTK+ is version >= 2.4" >&5 echo $ECHO_N "checking if GTK+ is version >= 2.4... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF @@ -30145,7 +30207,11 @@ if test "$cross_compiling" = "yes"; then fi WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}" -WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}" +if test "${TOOLKIT_DIR}" = "os2"; then + WX_LIBRARY_BASENAME_GUI="wx_pm${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}" +else + WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}" +fi @@ -35615,6 +35681,103 @@ echo "$as_me: WARNING: wxThread::Kill() will not work properly" >&2;} fi + echo "$as_me:$LINENO: checking for pthread_attr_setstacksize" >&5 +echo $ECHO_N "checking for pthread_attr_setstacksize... $ECHO_C" >&6 +if test "${ac_cv_func_pthread_attr_setstacksize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define pthread_attr_setstacksize to an innocuous variant, in case declares pthread_attr_setstacksize. + For example, HP-UX 11i declares gettimeofday. */ +#define pthread_attr_setstacksize innocuous_pthread_attr_setstacksize + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char pthread_attr_setstacksize (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef pthread_attr_setstacksize + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_attr_setstacksize (); +/* 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_pthread_attr_setstacksize) || defined (__stub___pthread_attr_setstacksize) +choke me +#else +char (*f) () = pthread_attr_setstacksize; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != pthread_attr_setstacksize; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_pthread_attr_setstacksize=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_pthread_attr_setstacksize=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_pthread_attr_setstacksize" >&5 +echo "${ECHO_T}$ac_cv_func_pthread_attr_setstacksize" >&6 +if test $ac_cv_func_pthread_attr_setstacksize = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for pthread_mutexattr_t" >&5 diff --git a/configure.in b/configure.in index 56d6d431b8..1ed4c4bcd8 100644 --- a/configure.in +++ b/configure.in @@ -2724,6 +2724,25 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config LIBS="$LIBS $wx_cv_libs_gtk" AC_CHECK_FUNCS([pango_font_family_is_monospace]) + + dnl gtk_icon_size_lookup is not available in the GTK+ headers + dnl that have shipped with some versions of Sun's JDS. Not using + dnl AC_CHECK_FUNCS here since it only checks the function exists + dnl in the lib (not the header). + AC_MSG_CHECKING([if gtk_icon_size_lookup is missing]) + AC_TRY_COMPILE([ + #include + ], + [ + void *f = gtk_icon_size_lookup; + ], + [ + AC_MSG_RESULT([no]) + ], + [ + AC_DEFINE(NEED_GTK_ICON_SIZE_LOOKUP) + AC_MSG_RESULT([yes]) + ]) dnl test if we have at least GTK+ 2.4: AC_MSG_CHECKING([if GTK+ is version >= 2.4]) diff --git a/include/wx/gtk/private.h b/include/wx/gtk/private.h index 9f4cd54c02..c943f3ad2d 100644 --- a/include/wx/gtk/private.h +++ b/include/wx/gtk/private.h @@ -136,5 +136,14 @@ inline wxEventType GtkScrollWinTypeToWx(guint scrollType) wxString wxEscapeStringForPangoMarkup(const wxString& str); #endif +// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in +// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS +// for Solaris 9 x86. +#if NEED_GTK_ICON_SIZE_LOOKUP +extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size, + gint *width, + gint *height); +#endif + #endif // _WX_GTK_PRIVATE_H_ diff --git a/include/wx/gtk1/private.h b/include/wx/gtk1/private.h index 9f4cd54c02..c943f3ad2d 100644 --- a/include/wx/gtk1/private.h +++ b/include/wx/gtk1/private.h @@ -136,5 +136,14 @@ inline wxEventType GtkScrollWinTypeToWx(guint scrollType) wxString wxEscapeStringForPangoMarkup(const wxString& str); #endif +// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in +// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS +// for Solaris 9 x86. +#if NEED_GTK_ICON_SIZE_LOOKUP +extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size, + gint *width, + gint *height); +#endif + #endif // _WX_GTK_PRIVATE_H_ diff --git a/setup.h.in b/setup.h.in index 381af0754b..9c9f72c60d 100644 --- a/setup.h.in +++ b/setup.h.in @@ -967,6 +967,9 @@ /* Define if you have pango_font_family_is_monospace() (Pango >= 1.3.3) */ #undef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE +/* Define if gtk_icon_size_lookup is missing from the GTK+ headers */ +#undef NEED_GTK_ICON_SIZE_LOOKUP + /* Define if you have Pango xft support */ #undef HAVE_PANGO_XFT diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index 4657066f99..c0c91304cb 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -204,7 +204,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; } #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include + #include "wx/gtk/private.h" extern GtkIconSize wxArtClientToIconSize(const wxArtClient& client); #endif // defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp index 6b401aee09..0956482251 100644 --- a/src/gtk/artgtk.cpp +++ b/src/gtk/artgtk.cpp @@ -24,6 +24,7 @@ #include "wx/artprov.h" #include "wx/module.h" +#include "wx/gtk/private.h" #include @@ -160,26 +161,8 @@ static GtkIconSize FindClosestIconSize(const wxSize& size) s_sizes[5].icon = GTK_ICON_SIZE_DIALOG; for (size_t i = 0; i < NUM_SIZES; i++) { -#if !defined(GDK_MULTITHREAD_SAFE) - gtk_icon_size_lookup( - s_sizes[i].icon, - &s_sizes[i].x, &s_sizes[i].y); -#else -#if GTK_VERSION_CHECK(2,2,0) - if (!gtk_verson_check(2,2,0)) - gtk_icon_size_lookup_for_settings( - gtk_settings_get_for_screen(gdk_screen_get_default()), - s_sizes[i].icon, - &s_sizes[i].x, &s_sizes[i].y); - else -#else // pre-GTK 2.2 - { - // FIXME - gtk_icon_size_lookup(s_sizes[i].icon, + gtk_icon_size_lookup(s_sizes[i].icon, &s_sizes[i].x, &s_sizes[i].y); - } -#endif -#endif } s_sizesInitialized = true; } diff --git a/src/gtk1/artgtk.cpp b/src/gtk1/artgtk.cpp index 6b401aee09..0956482251 100644 --- a/src/gtk1/artgtk.cpp +++ b/src/gtk1/artgtk.cpp @@ -24,6 +24,7 @@ #include "wx/artprov.h" #include "wx/module.h" +#include "wx/gtk/private.h" #include @@ -160,26 +161,8 @@ static GtkIconSize FindClosestIconSize(const wxSize& size) s_sizes[5].icon = GTK_ICON_SIZE_DIALOG; for (size_t i = 0; i < NUM_SIZES; i++) { -#if !defined(GDK_MULTITHREAD_SAFE) - gtk_icon_size_lookup( - s_sizes[i].icon, - &s_sizes[i].x, &s_sizes[i].y); -#else -#if GTK_VERSION_CHECK(2,2,0) - if (!gtk_verson_check(2,2,0)) - gtk_icon_size_lookup_for_settings( - gtk_settings_get_for_screen(gdk_screen_get_default()), - s_sizes[i].icon, - &s_sizes[i].x, &s_sizes[i].y); - else -#else // pre-GTK 2.2 - { - // FIXME - gtk_icon_size_lookup(s_sizes[i].icon, + gtk_icon_size_lookup(s_sizes[i].icon, &s_sizes[i].x, &s_sizes[i].y); - } -#endif -#endif } s_sizesInitialized = true; } -- 2.45.2