Define __WXGTK220__ in configure and improve checks for GTK+ version.

Use AC_CACHE_CHECK() to avoid recompiling the test program(s) every time
configure runs and also simplify the checks. This required renaming
ac_wxgtkXXX to wx_cv_gtkXXX (cached variables must have "cv" in them).

Also make the checks more logical, by simply setting wx_cv_gtkXXX if
wx_cv_gtkYYY is set with XXX < YYY.

Finally, and the real reason for these changes, add test for __WXGTK220__
which will be used by the upcoming commits to check whether GtkSpinner is
available.
This commit is contained in:
Vadim Zeitlin 2015-03-06 13:54:14 +01:00
parent 90920ca83c
commit a4f536547b
4 changed files with 160 additions and 85 deletions

151
configure vendored
View File

@ -24315,6 +24315,8 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
esac
if test "$WXGTK3" = 1; then
$as_echo "#define __WXGTK220__ 1" >>confdefs.h
$as_echo "#define __WXGTK218__ 1" >>confdefs.h
$as_echo "#define __WXGTK210__ 1" >>confdefs.h
@ -24325,47 +24327,13 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
CFLAGS="$wx_cv_cflags_gtk $CFLAGS"
LIBS="$LIBS $wx_cv_libs_gtk"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GTK+ is version >= 2.18" >&5
$as_echo_n "checking if GTK+ is version >= 2.18... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <gtk/gtk.h>
int
main ()
{
#if !GTK_CHECK_VERSION(2,18,0)
Not GTK+ 2.18
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define __WXGTK218__ 1" >>confdefs.h
$as_echo "#define __WXGTK210__ 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ac_wxgtk218=1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GTK+ is version >= 2.20" >&5
$as_echo_n "checking if GTK+ is version >= 2.20... " >&6; }
if ${wx_cv_gtk220+:} false; then :
$as_echo_n "(cached) " >&6
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_wxgtk218=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$ac_wxgtk218" = 0; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GTK+ is version >= 2.10" >&5
$as_echo_n "checking if GTK+ is version >= 2.10... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@ -24375,8 +24343,8 @@ int
main ()
{
#if !GTK_CHECK_VERSION(2,10,0)
Not GTK+ 2.10
#if !GTK_CHECK_VERSION(2,20,0)
Not GTK+ 2.20
#endif
;
@ -24384,21 +24352,102 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define __WXGTK210__ 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ac_wxgtk210=1
wx_cv_gtk220=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_wxgtk210=0
wx_cv_gtk220=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_gtk220" >&5
$as_echo "$wx_cv_gtk220" >&6; }
if test "$wx_cv_gtk220" = "yes"; then
$as_echo "#define __WXGTK220__ 1" >>confdefs.h
wx_cv_gtk218=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GTK+ is version >= 2.18" >&5
$as_echo_n "checking if GTK+ is version >= 2.18... " >&6; }
if ${wx_cv_gtk218+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <gtk/gtk.h>
int
main ()
{
#if !GTK_CHECK_VERSION(2,18,0)
Not GTK+ 2.18
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
wx_cv_gtk218=yes
else
wx_cv_gtk218=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_gtk218" >&5
$as_echo "$wx_cv_gtk218" >&6; }
fi
if test "$wx_cv_gtk218" = "yes"; then
$as_echo "#define __WXGTK218__ 1" >>confdefs.h
wx_cv_gtk210=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GTK+ is version >= 2.10" >&5
$as_echo_n "checking if GTK+ is version >= 2.10... " >&6; }
if ${wx_cv_gtk210+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <gtk/gtk.h>
int
main ()
{
#if !GTK_CHECK_VERSION(2,10,0)
Not GTK+ 2.10
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
wx_cv_gtk210=yes
else
wx_cv_gtk210=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_gtk210" >&5
$as_echo "$wx_cv_gtk210" >&6; }
fi
if test "$wx_cv_gtk210" = "yes"; then
$as_echo "#define __WXGTK210__ 1" >>confdefs.h
fi
CFLAGS="$save_CFLAGS"

View File

@ -2785,6 +2785,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
esac
if test "$WXGTK3" = 1; then
AC_DEFINE(__WXGTK220__)
AC_DEFINE(__WXGTK218__)
AC_DEFINE(__WXGTK210__)
elif test "$WXGTK2" = 1; then
@ -2793,47 +2794,66 @@ 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_MSG_RESULT([yes])
ac_wxgtk218=1
],
[
AC_MSG_RESULT([no])
ac_wxgtk218=0
])
dnl We need to define __WXGTK2xx__ symbols for a few specific
dnl versions in order to be able to test for them (and hence for
dnl the availability of the controls which appeared only in these
dnl versions) from our public headers, without having to include
dnl gtk/gtk.h from them.
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_CACHE_CHECK([if GTK+ is version >= 2.20], wx_cv_gtk220, [
AC_TRY_COMPILE([
#include <gtk/gtk.h>
],
[
#if !GTK_CHECK_VERSION(2,10,0)
Not GTK+ 2.10
#if !GTK_CHECK_VERSION(2,20,0)
Not GTK+ 2.20
#endif
],
[
AC_DEFINE(__WXGTK210__)
AC_MSG_RESULT([yes])
ac_wxgtk210=1
],
[
AC_MSG_RESULT([no])
ac_wxgtk210=0
])
wx_cv_gtk220=yes,
wx_cv_gtk220=no
)
])
if test "$wx_cv_gtk220" = "yes"; then
AC_DEFINE(__WXGTK220__)
wx_cv_gtk218=yes
else
AC_CACHE_CHECK([if GTK+ is version >= 2.18], wx_cv_gtk218, [
AC_TRY_COMPILE([
#include <gtk/gtk.h>
],
[
#if !GTK_CHECK_VERSION(2,18,0)
Not GTK+ 2.18
#endif
],
wx_cv_gtk218=yes,
wx_cv_gtk218=no
)
])
fi
if test "$wx_cv_gtk218" = "yes"; then
AC_DEFINE(__WXGTK218__)
wx_cv_gtk210=yes
else
AC_CACHE_CHECK([if GTK+ is version >= 2.10], wx_cv_gtk210, [
AC_TRY_COMPILE([
#include <gtk/gtk.h>
],
[
#if !GTK_CHECK_VERSION(2,10,0)
Not GTK+ 2.10
#endif
],
wx_cv_gtk210=yes,
wx_cv_gtk210=no
)
])
fi
if test "$wx_cv_gtk210" = "yes"; then
AC_DEFINE(__WXGTK210__)
fi
CFLAGS="$save_CFLAGS"

View File

@ -65,6 +65,9 @@
/* Define this if your version of GTK+ is greater than 2.18 */
#undef __WXGTK218__
/* Define this if your version of GTK+ is greater than 2.20 */
#undef __WXGTK220__
/* Define this if your version of GTK+ is >= 3.0 */
#undef __WXGTK3__

View File

@ -101,6 +101,9 @@
/* Define this if your version of GTK+ is greater than 2.18 */
#undef __WXGTK218__
/* Define this if your version of GTK+ is greater than 2.20 */
#undef __WXGTK220__
#include <types.h>
typedef pid_t GPid;