summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2003-01-19 21:50:03 +0000
committerJan Djärv <jan.h.d@swipnet.se>2003-01-19 21:50:03 +0000
commit488dd4c404eba70d48e4ee70141b8abcce2f863b (patch)
tree741ec2bb5abe963b292521e3a478e716a4ebb999 /configure.in
parent3c77dc44b8052a9bcb19486a605a861cf120b31e (diff)
downloademacs-488dd4c404eba70d48e4ee70141b8abcce2f863b.tar.gz
GTK version
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in109
1 files changed, 106 insertions, 3 deletions
diff --git a/configure.in b/configure.in
index 24f2b5908ad..e73ce2e3717 100644
--- a/configure.in
+++ b/configure.in
@@ -77,13 +77,15 @@ dnl This should be the last --with option, because --with-x is
dnl added later on when we find the path of X, and it's best to
dnl keep them together visually.
AC_ARG_WITH(x-toolkit,
-[ --with-x-toolkit=KIT use an X toolkit (KIT = yes/lucid/athena/motif/no)],
+[ --with-x-toolkit=KIT use an X toolkit
+ (KIT = yes/lucid/athena/motif/gtk/no)],
[ case "${withval}" in
y | ye | yes ) val=athena ;;
n | no ) val=no ;;
l | lu | luc | luci | lucid ) val=lucid ;;
a | at | ath | athe | athen | athena ) val=athena ;;
m | mo | mot | moti | motif ) val=motif ;;
+ g | gt | gtk ) val=gtk ;;
dnl These don't currently work.
dnl o | op | ope | open | open- | open-l | open-lo \
dnl | open-loo | open-look ) val=open-look ;;
@@ -91,7 +93,7 @@ dnl | open-loo | open-look ) val=open-look ;;
dnl AC_MSG_ERROR([the `--with-x-toolkit' option is supposed to have a value
dnl which is `yes', `no', `lucid', `athena', `motif' or `open-look'.])
AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid\;
-this option's value should be `yes', `no', `lucid', `athena', or `motif'.
+this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
Currently, `yes', `athena' and `lucid' are synonyms.])
;;
esac
@@ -107,6 +109,10 @@ AC_ARG_WITH(gif,
[ --with-gif use -lungif for displaying GIF images])
AC_ARG_WITH(png,
[ --with-png use -lpng for displaying PNG images])
+AC_ARG_WITH(gtk,
+[ --with-gtk use GTK (same as --with-x-toolkit=gtk)])
+AC_ARG_WITH(pkg-config-prog,
+[ --with-pkg-config-prog Path to pkg-config to use for finding GTK])
AC_ARG_WITH(toolkit-scroll-bars,
[ --without-toolkit-scroll-bars
don't use Motif or Xaw3d scroll bars])
@@ -1570,6 +1576,10 @@ case "${window_system}" in
athena | lucid ) USE_X_TOOLKIT=LUCID ;;
motif ) USE_X_TOOLKIT=MOTIF ;;
dnl open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
+ gtk ) with_gtk=yes
+dnl Dont set this for GTK. A lot of tests below assumes Xt when
+dnl USE_X_TOOLKIT is set.
+ USE_X_TOOLKIT=none ;;
no ) USE_X_TOOLKIT=none ;;
dnl If user did not say whether to use a toolkit,
dnl make this decision later: use the toolkit if we have X11R5 or newer.
@@ -1781,6 +1791,89 @@ fail;
fi
fi
+dnl This function defintion taken from Gnome 2.0
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN(PKG_CHECK_MODULES, [
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or give the full path to pkg-config with"
+ echo "*** the PKG_CONFIG environment variable or --with-pkg-config-prog."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ AC_MSG_CHECKING(for $2)
+
+ if $PKG_CONFIG --exists "$2" ; then
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+
+ AC_MSG_CHECKING($1_CFLAGS)
+ $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+ AC_MSG_RESULT($$1_CFLAGS)
+
+ AC_MSG_CHECKING($1_LIBS)
+ $1_LIBS=`$PKG_CONFIG --libs "$2"`
+ AC_MSG_RESULT($$1_LIBS)
+ else
+ $1_CFLAGS=""
+ $1_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ ifelse([$4], ,echo $$1_PKG_ERRORS,)
+ fi
+
+ AC_SUBST($1_CFLAGS)
+ AC_SUBST($1_LIBS)
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ fi
+ fi
+
+ if test $succeeded = yes; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+ fi
+])
+
+HAVE_GTK=no
+if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
+ if test "$USE_X_TOOLKIT" != "none"; then
+ AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
+ fi
+ GLIB_REQUIRED=2.0.1
+ GTK_REQUIRED=2.0.1
+ GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
+
+ dnl Check if --with-pkg-config-prog has been given.
+ if test "X${with_pkg_config_prog}" != X; then
+ PKG_CONFIG="${with_pkg_config_prog}"
+ fi
+ dnl Checks for libraries.
+ PKG_CHECK_MODULES(GTK, $GTK_MODULES)
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
+ HAVE_GTK=yes
+ AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
+ USE_X_TOOLKIT=none
+
+ dnl GTK scrollbars resembles toolkit scrollbars alot, so to avoid
+ dnl a lot if #ifdef:s, say we have toolkit scrollbars.
+ with_toolkit_scroll_bars=yes
+fi
+
dnl Do not put whitespace before the #include statements below.
dnl Older compilers (eg sunos4 cc) choke on it.
if test x"${USE_X_TOOLKIT}" = xmaybe; then
@@ -1903,7 +1996,7 @@ if test "${HAVE_X11}" = "yes"; then
fi
fi
-dnl Use toolkit scroll bars if configured for X toolkit and either
+dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
dnl using Motif or Xaw3d is available, and unless
dnl --with-toolkit-scroll-bars=no was specified.
@@ -1920,6 +2013,9 @@ if test "${with_toolkit_scroll_bars}" != "no"; then
AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
USE_TOOLKIT_SCROLL_BARS=yes
fi
+ elif test "${HAVE_GTK}" = "yes"; then
+ AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
+ USE_TOOLKIT_SCROLL_BARS=yes
fi
fi
@@ -2745,6 +2841,13 @@ End:
])dnl
#### Report on what we decided to do.
+#### Report GTK as a toolkit, even if it doesn't use Xt.
+#### It makes printing result more understandable as using GTK sets
+#### toolkit_scroll_bars to yes by default.
+if test "${HAVE_GTK}" = "yes"; then
+ USE_X_TOOLKIT=GTK
+fi
+
echo "
Configured for \`${canonical}'.