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
This commit is contained in:
Vadim Zeitlin
2009-10-14 22:49:38 +00:00
parent b43914a8be
commit d85aece199
5 changed files with 138 additions and 39 deletions

72
configure vendored
View File

@@ -29532,6 +29532,77 @@ 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.18" >&5
echo $ECHO_N "checking if GTK+ is version >= 2.18... $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 <gtk/gtk.h>
int
main ()
{
#if !GTK_CHECK_VERSION(2,18,0)
Not GTK+ 2.18
#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 __WXGTK218__ 1
_ACEOF
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_wxgtk218=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_wxgtk218=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
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
@@ -29661,6 +29732,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
fi
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"

View File

@@ -2903,6 +2903,29 @@ 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.18:
AC_MSG_CHECKING([if GTK+ is version >= 2.18])
AC_TRY_COMPILE([
#include <gtk/gtk.h>
],
[
#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_wxgtk218=1
],
[
AC_MSG_RESULT([no])
ac_wxgtk218=0
])
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([
@@ -2945,6 +2968,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
ac_wxgtk26=0
])
fi
fi
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"

View File

@@ -52,12 +52,9 @@ private:
};
// currently only GTK+ has a native implementation
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include <gtk/gtkversion.h>
#if GTK_CHECK_VERSION(2, 18, 0)
#if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/infobar.h"
#define wxHAS_NATIVE_INFOBAR
#endif
#endif // wxGTK2
// if the generic version is the only one we have, use it

View File

@@ -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__

View File

@@ -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 <types.h>
typedef pid_t GPid;