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

119
aclocal.m4 vendored
View File

@ -1,11 +1,104 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Configure paths for GTK+
# Owen Taylor 97-11-3
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.
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 AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
dnl
AC_DEFUN(AM_PATH_GTK_2_0,
[dnl
[dnl
dnl Get the cflags and libraries from the gtk-config-2.0 script
dnl
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
@ -13,12 +106,12 @@ AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
, enable_gtktest=yes)
, enable_gtktest=yes)
for module in . $4
do
case "$module" in
gthread)
gthread)
gtk_config_args="$gtk_config_args gthread"
;;
esac
@ -67,7 +160,7 @@ dnl
#include <stdio.h>
#include <stdlib.h>
int
int
main ()
{
int major, minor, micro;
@ -86,7 +179,7 @@ main ()
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n");
@ -97,16 +190,16 @@ main ()
printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n");
printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
}
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
{
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
#endif /* defined (GTK_MAJOR_VERSION) ... */
else
@ -122,7 +215,7 @@ main ()
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
major, minor, micro);
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
@ -143,7 +236,7 @@ main ()
fi
if test "x$no_gtk" = x ; then
AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
ifelse([$2], , :, [$2])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GTK_CONFIG_2_0" = "no" ; then
@ -168,7 +261,7 @@ main ()
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***"
@ -192,3 +285,5 @@ main ()
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])

1602
configure vendored

File diff suppressed because it is too large Load Diff

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