From d85aece19960f1c09051d2bd5f54281272fde8ff Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 14 Oct 2009 22:49:38 +0000 Subject: [PATCH] Test whether GTK+ is 2.18 or newer in configure. We need to define __WXGTK218__ symbol in configure instead of simply checking if we are compiled with 2.18 in wx/infobar.h because GTK_CHECK_VERSION() can't be used when compiling user code which can't even include gtk/gtkversion.h defining it because it doesn't necessarily use `pkg-config --cflags gtk+-2.0` at all in its CFLAGS. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 98 ++++++++++++++++++++++++++++++++++++++------ configure.in | 64 ++++++++++++++++++++--------- include/wx/infobar.h | 9 ++-- setup.h.in | 3 ++ setup.h_vms | 3 ++ 5 files changed, 138 insertions(+), 39 deletions(-) diff --git a/configure b/configure index 568bfc4aba..3178dd9c23 100755 --- a/configure +++ b/configure @@ -29532,8 +29532,8 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config CFLAGS="$wx_cv_cflags_gtk $CFLAGS" LIBS="$LIBS $wx_cv_libs_gtk" - { echo "$as_me:$LINENO: checking if GTK+ is version >= 2.10" >&5 -echo $ECHO_N "checking if GTK+ is version >= 2.10... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: checking if GTK+ is version >= 2.18" >&5 +echo $ECHO_N "checking if GTK+ is version >= 2.18... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -29547,8 +29547,8 @@ int main () { - #if !GTK_CHECK_VERSION(2,10,0) - Not GTK+ 2.10 + #if !GTK_CHECK_VERSION(2,18,0) + Not GTK+ 2.18 #endif ; @@ -29573,6 +29573,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest.$ac_objext; then + cat >>confdefs.h <<\_ACEOF +#define __WXGTK218__ 1 +_ACEOF + cat >>confdefs.h <<\_ACEOF #define __WXGTK210__ 1 _ACEOF @@ -29583,7 +29587,7 @@ _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } - ac_wxgtk210=1 + ac_wxgtk218=1 else echo "$as_me: failed program was:" >&5 @@ -29592,15 +29596,15 @@ sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } - ac_wxgtk210=0 + ac_wxgtk218=0 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$ac_wxgtk210" = 0; then - { echo "$as_me:$LINENO: checking if GTK+ is version >= 2.6" >&5 -echo $ECHO_N "checking if GTK+ is version >= 2.6... $ECHO_C" >&6; } + if test "$ac_wxgtk218" = 0; then + { echo "$as_me:$LINENO: checking if GTK+ is version >= 2.10" >&5 +echo $ECHO_N "checking if GTK+ is version >= 2.10... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -29614,8 +29618,8 @@ int main () { - #if !GTK_CHECK_VERSION(2,6,0) - Not GTK+ 2.6 + #if !GTK_CHECK_VERSION(2,10,0) + Not GTK+ 2.10 #endif ; @@ -29640,13 +29644,17 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest.$ac_objext; then + cat >>confdefs.h <<\_ACEOF +#define __WXGTK210__ 1 +_ACEOF + cat >>confdefs.h <<\_ACEOF #define __WXGTK26__ 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } - ac_wxgtk26=1 + ac_wxgtk210=1 else echo "$as_me: failed program was:" >&5 @@ -29655,11 +29663,75 @@ sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } - ac_wxgtk26=0 + ac_wxgtk210=0 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "$ac_wxgtk210" = 0; then + { echo "$as_me:$LINENO: checking if GTK+ is version >= 2.6" >&5 +echo $ECHO_N "checking if GTK+ is version >= 2.6... $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 () +{ + + #if !GTK_CHECK_VERSION(2,6,0) + Not GTK+ 2.6 + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +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_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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + cat >>confdefs.h <<\_ACEOF +#define __WXGTK26__ 1 +_ACEOF + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + ac_wxgtk26=1 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ac_wxgtk26=0 + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi fi CFLAGS="$save_CFLAGS" diff --git a/configure.in b/configure.in index 51b2465987..5ce3ee7c74 100644 --- a/configure.in +++ b/configure.in @@ -2903,47 +2903,71 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config CFLAGS="$wx_cv_cflags_gtk $CFLAGS" LIBS="$LIBS $wx_cv_libs_gtk" - dnl test if we have at least GTK+ 2.10: - AC_MSG_CHECKING([if GTK+ is version >= 2.10]) + dnl test if we have at least GTK+ 2.18: + AC_MSG_CHECKING([if GTK+ is version >= 2.18]) AC_TRY_COMPILE([ #include ], [ - #if !GTK_CHECK_VERSION(2,10,0) - Not GTK+ 2.10 + #if !GTK_CHECK_VERSION(2,18,0) + Not GTK+ 2.18 #endif ], [ + AC_DEFINE(__WXGTK218__) AC_DEFINE(__WXGTK210__) AC_DEFINE(__WXGTK26__) AC_MSG_RESULT([yes]) - ac_wxgtk210=1 + ac_wxgtk218=1 ], [ AC_MSG_RESULT([no]) - ac_wxgtk210=0 + ac_wxgtk218=0 ]) - if test "$ac_wxgtk210" = 0; then - dnl test if we have at least GTK+ 2.6: - AC_MSG_CHECKING([if GTK+ is version >= 2.6]) + if test "$ac_wxgtk218" = 0; then + dnl test if we have at least GTK+ 2.10: + AC_MSG_CHECKING([if GTK+ is version >= 2.10]) AC_TRY_COMPILE([ #include - ], - [ - #if !GTK_CHECK_VERSION(2,6,0) - Not GTK+ 2.6 + ], + [ + #if !GTK_CHECK_VERSION(2,10,0) + Not GTK+ 2.10 #endif - ], - [ + ], + [ + AC_DEFINE(__WXGTK210__) AC_DEFINE(__WXGTK26__) AC_MSG_RESULT([yes]) - ac_wxgtk26=1 - ], - [ + ac_wxgtk210=1 + ], + [ AC_MSG_RESULT([no]) - ac_wxgtk26=0 - ]) + ac_wxgtk210=0 + ]) + + if test "$ac_wxgtk210" = 0; then + dnl test if we have at least GTK+ 2.6: + AC_MSG_CHECKING([if GTK+ is version >= 2.6]) + AC_TRY_COMPILE([ + #include + ], + [ + #if !GTK_CHECK_VERSION(2,6,0) + Not GTK+ 2.6 + #endif + ], + [ + AC_DEFINE(__WXGTK26__) + AC_MSG_RESULT([yes]) + ac_wxgtk26=1 + ], + [ + AC_MSG_RESULT([no]) + ac_wxgtk26=0 + ]) + fi fi CFLAGS="$save_CFLAGS" diff --git a/include/wx/infobar.h b/include/wx/infobar.h index 3176711a7d..5480b798e6 100644 --- a/include/wx/infobar.h +++ b/include/wx/infobar.h @@ -52,12 +52,9 @@ private: }; // currently only GTK+ has a native implementation -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include - #if GTK_CHECK_VERSION(2, 18, 0) - #include "wx/gtk/infobar.h" - #define wxHAS_NATIVE_INFOBAR - #endif +#if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/infobar.h" + #define wxHAS_NATIVE_INFOBAR #endif // wxGTK2 // if the generic version is the only one we have, use it diff --git a/setup.h.in b/setup.h.in index 75f4246ece..84a3c6086a 100644 --- a/setup.h.in +++ b/setup.h.in @@ -68,6 +68,9 @@ /* Define this if your version of GTK+ is greater than 2.10 */ #undef __WXGTK210__ +/* Define this if your version of GTK+ is greater than 2.18 */ +#undef __WXGTK218__ + /* Define this if you want to use GPE features */ #undef __WXGPE__ diff --git a/setup.h_vms b/setup.h_vms index f97172fdec..29d61b09e9 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -88,6 +88,9 @@ /* Define this if your version of GTK+ is greater than 2.10 */ #define __WXGTK210__ 1 +/* Define this if your version of GTK+ is greater than 2.18 */ +#undef __WXGTK218__ + #include typedef pid_t GPid; -- 2.45.2