1. added --enable-gtk2 option, check for GTK+ 2.0 disabled by default

2. added caching of gtk-config checks


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-02 09:10:37 +00:00
parent 5704d2504b
commit 8168de4c79
3 changed files with 952 additions and 969 deletions

View File

@@ -11,90 +11,6 @@ dnl
dnl Version: $Id$
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS. Uses variables
dnl gtk_config_prefix and/or gtk_config_exec_prefix if defined.
dnl ---------------------------------------------------------------------------
dnl
AC_DEFUN(AM_PATH_GTK,
[
if test x$gtk_config_exec_prefix != x ; then
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
fi
fi
if test x$gtk_config_prefix != x ; then
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
fi
fi
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
min_gtk_version=ifelse([$1], ,0.99.7,$1)
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
no_gtk=""
if test "$GTK_CONFIG" != "no" ; then
GTK_CFLAGS=`$GTK_CONFIG --cflags`
GTK_LIBS=`$GTK_CONFIG --libs gthread`
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
dnl
dnl Now check if the installed GTK is sufficiently new. (Also sanity
dnl checks the results of gtk-config to some extent)
dnl
AC_TRY_RUN([
#include <gtk/gtk.h>
#include <gtk/gtkfeatures.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
if ((GTK_MAJOR_VERSION != gtk_major_version) ||
(GTK_MINOR_VERSION != gtk_minor_version) ||
(GTK_MICRO_VERSION != gtk_micro_version)) {
printf("Headers vs. library version mismatch!\n");
exit(1);
}
if (gtk_minor_version == 1) return FALSE;
return !((gtk_major_version > major) ||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
}
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
else
no_gtk=yes
fi
if test "x$no_gtk" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
GTK_CFLAGS=""
GTK_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
])
dnl ===========================================================================
dnl macros to find the a file in the list of include/lib paths
dnl ===========================================================================
@@ -295,7 +211,7 @@ AC_DEFUN(WX_ARG_SYS_WITH,
[
AC_MSG_CHECKING([for --with-$1])
no_cache=0
AC_ARG_WITH($1, $2,
AC_ARG_WITH($1, [$2],
[
if test "$withval" = yes; then
ac_cv_use_$1='$3=yes'
@@ -340,7 +256,7 @@ AC_DEFUN(WX_ARG_WITH,
[
AC_MSG_CHECKING([for --with-$1])
no_cache=0
AC_ARG_WITH($1, $2,
AC_ARG_WITH($1, [$2],
[
if test "$withval" = yes; then
ac_cv_use_$1='$3=yes'
@@ -377,7 +293,7 @@ AC_DEFUN(WX_ARG_ENABLE,
[
AC_MSG_CHECKING([for --enable-$1])
no_cache=0
AC_ARG_ENABLE($1, $2,
AC_ARG_ENABLE($1, [$2],
[
if test "$enableval" = yes; then
ac_cv_use_$1='$3=yes'
@@ -408,32 +324,6 @@ AC_DEFUN(WX_ARG_ENABLE,
fi
])
dnl -
dnl - GNU libc extension (added by GL)
dnl -
AC_DEFUN(WX_GNU_EXTENSIONS,
[
AC_MSG_CHECKING([if you need GNU extensions])
AC_CACHE_VAL(wx_cv_gnu_extensions,[
AC_TRY_COMPILE([#include <features.h>],[
#ifndef __GNU_LIBRARY__
Compile error wanted
#endif
],
[wx_cv_gnu_extensions=yes],
[wx_cv_gnu_extensions=no])
])
AC_MSG_RESULT($wx_cv_gnu_extensions)
if test "$wx_cv_gnu_extensions" = "yes"; then
AC_DEFINE_UNQUOTED(_GNU_SOURCE)
fi
])
dnl ---------------------------------------------------------------------------
dnl initialization
dnl ---------------------------------------------------------------------------
@@ -1054,10 +944,7 @@ AC_ARG_WITH(mingw, [ --with-mingw use GCC Minimal MS-Windows
AC_ARG_WITH(pm, [ --with-pm use OS/2 Presentation Manager], [wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(mgl, [ --with-mgl use MGL], [wxUSE_MGL="$withval" CACHE_MGL=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(gtk-prefix, [ --with-gtk-prefix=PFX Prefix where GTK is installed],
gtk_config_prefix="$withval", gtk_config_prefix="")
AC_ARG_WITH(gtk-exec-prefix, [ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed],
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
AC_ARG_ENABLE(gtk2, [ --enable-gtk2 use GTK+ 2.0 if available (EXPERIMENTAL)],wxUSE_GTK2=1,wxUSE_GTK2=0)
WX_ARG_SYS_WITH(libpng, [ --with-libpng use libpng (PNG image format)], wxUSE_LIBPNG)
WX_ARG_SYS_WITH(libjpeg, [ --with-libjpeg use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
@@ -1715,38 +1602,61 @@ if test "$wxUSE_GUI" = "yes"; then
fi
if test "$wxUSE_GTK" = 1; then
dnl avoid calling AM_PATH_GTK twice, so check first for the newer version
dnl and only then, if it wasn't found, for an older one
AM_PATH_GTK_2_0(1.3.1, WXGTK20=1,[
AM_PATH_GTK(1.2.7, WXGTK127=1)
AM_PATH_GTK(1.2.3, WXGTK12=1)
], gthread)
AC_MSG_CHECKING([for GTK+ version])
if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
AC_MSG_ERROR([
Please check that gtk-config is in path, the directory
where GTK+ libraries are installed (returned by
'gtk-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable and GTK+ is version 1.2.3 or above.
])
gtk_version_cached=1
AC_CACHE_VAL(wx_cv_lib_gtk,
[
dnl stupid GTK+ AM macros produce their own messages, so we
dnl have to pass to the next line
gtk_version_cached=0
AC_MSG_RESULT("")
wx_cv_lib_gtk=
if test "x$wxUSE_GTK2" = "xyes"; then
AM_PATH_GTK_2_0(1.3.1, wx_cv_lib_gtk=2.0, gthread)
fi
if test -z "$wx_cv_lib_gtk"; then
AM_PATH_GTK(1.2.7, wx_cv_lib_gtk=1.2.7)
fi
if test -z "$wx_cv_lib_gtk"; then
AM_PATH_GTK(1.2.3, wx_cv_lib_gtk=1.2.3)
fi
if test -z "$wx_cv_lib_gtk"; then
dnl looks better in AC_MSG_RESULT
wx_cv_lib_gtk=none
fi
]
)
dnl if it wasn't cached, the messages from AM_PATH_GTK() above are
dnl enough
if test "$gtk_version_cached" = 1; then
AC_MSG_RESULT($wx_cv_lib_gtk)
fi
case "$wx_cv_lib_gtk" in
2.0) WXGTK20=1
;;
1.2.7) WXGTK127=1
;;
1.2.3) WXGTK12=1
;;
*) AC_MSG_ERROR([
Please check that gtk-config is in path, the directory
where GTK+ libraries are installed (returned by
'gtk-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable and GTK+ is version 1.2.3 or above.
])
;;
esac
TOOLKIT_INCLUDE="$GTK_CFLAGS"
dnl Appending gthreads as it was done here is not portable, instead
dnl we now call "gtk-config --libs gthread" which sets the right library
dnl name for us. The following hacks are no longer required.
GUI_TK_LIBRARY="$GTK_LIBS"
dnl dnl On FreeBSD, the libs are called gtk12 etc, so we must append gthread12
dnl echo $GTK_LIBS | fgrep -q "glib12"
dnl if test $? = 0 ; then
dnl GUI_TK_LIBRARY="$GTK_LIBS -gthread12"
dnl else
dnl GUI_TK_LIBRARY="$GTK_LIBS -lgthread"
dnl fi
AFMINSTALL=afminstall
TOOLKIT=GTK
GUIDIST=GTK_DIST
@@ -2593,7 +2503,6 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
dnl for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
WX_C_BIGENDIAN
@@ -2603,9 +2512,6 @@ WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
dnl check whether C++ compiler supports bool built-in type
WX_CPP_BOOL
dnl check whether we should define _GNU_SOURCE
WX_GNU_EXTENSIONS
dnl ---------------------------------------------------------------------------
dnl Check for functions
dnl ---------------------------------------------------------------------------