2001-04-13 18:00:02 +00:00
|
|
|
# Configure paths for GTK+
|
2001-04-03 18:48:46 +00:00
|
|
|
# Owen Taylor 1997-2001
|
1998-03-12 23:23:43 +00:00
|
|
|
|
2018-04-06 10:29:17 +00:00
|
|
|
# Version number used by aclocal, see `info automake Serials`.
|
|
|
|
# Increment on every change.
|
|
|
|
#serial 1
|
|
|
|
|
2010-05-11 12:25:07 +00:00
|
|
|
dnl AM_PATH_GTK_3_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
2001-04-13 18:00:02 +00:00
|
|
|
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
|
|
|
|
dnl pass to pkg-config
|
1998-03-12 23:23:43 +00:00
|
|
|
dnl
|
2010-05-11 12:25:07 +00:00
|
|
|
AC_DEFUN([AM_PATH_GTK_3_0],
|
2014-08-06 10:23:23 +00:00
|
|
|
[m4_warn([obsolete], [AM_PATH_GTK_3_0 is deprecated, use PKG_CHECK_MODULES([GTK], [gtk+-3.0]) instead])
|
2001-04-13 18:00:02 +00:00
|
|
|
dnl Get the cflags and libraries from pkg-config
|
1998-03-12 23:23:43 +00:00
|
|
|
dnl
|
2002-03-03 12:38:24 +00:00
|
|
|
AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
|
2001-04-13 18:00:02 +00:00
|
|
|
, enable_gtktest=yes)
|
2014-08-09 14:17:44 +00:00
|
|
|
min_gtk_version=ifelse([$1], [], [3.0.0], [$1])
|
1998-04-04 00:12:58 +00:00
|
|
|
|
2014-08-09 14:17:44 +00:00
|
|
|
pkg_config_args="gtk+-3.0 >= $min_gtk_version"
|
1999-02-01 23:17:39 +00:00
|
|
|
for module in . $4
|
|
|
|
do
|
|
|
|
case "$module" in
|
2010-05-11 12:25:07 +00:00
|
|
|
gthread)
|
2001-04-03 18:48:46 +00:00
|
|
|
pkg_config_args="$pkg_config_args gthread-2.0"
|
1999-02-01 23:17:39 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2001-04-13 18:00:02 +00:00
|
|
|
no_gtk=""
|
2001-04-03 18:48:46 +00:00
|
|
|
|
2018-03-26 08:31:31 +00:00
|
|
|
PKG_PROG_PKG_CONFIG([0.16])
|
2001-04-03 18:48:46 +00:00
|
|
|
|
2018-03-26 08:31:31 +00:00
|
|
|
if test -z "$PKG_CONFIG"; then
|
2001-10-29 16:51:37 +00:00
|
|
|
no_gtk=yes
|
2001-06-07 16:40:01 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
|
|
|
|
|
2018-03-26 08:31:31 +00:00
|
|
|
if test -n "$PKG_CONFIG"; then
|
2001-10-29 16:51:37 +00:00
|
|
|
## don't try to run the test against uninstalled libtool libs
|
|
|
|
if $PKG_CONFIG --uninstalled $pkg_config_args; then
|
|
|
|
echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
|
|
|
|
enable_gtktest=no
|
|
|
|
fi
|
2001-06-07 16:40:01 +00:00
|
|
|
|
2014-08-09 14:17:44 +00:00
|
|
|
if $PKG_CONFIG $pkg_config_args; then
|
2001-10-29 16:51:37 +00:00
|
|
|
:
|
|
|
|
else
|
|
|
|
no_gtk=yes
|
|
|
|
fi
|
2001-06-07 16:40:01 +00:00
|
|
|
fi
|
|
|
|
|
2001-04-13 18:00:02 +00:00
|
|
|
if test x"$no_gtk" = x ; then
|
|
|
|
GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
|
|
|
|
GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
|
2010-05-11 12:25:07 +00:00
|
|
|
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
1998-05-01 04:23:59 +00:00
|
|
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
2010-05-11 12:25:07 +00:00
|
|
|
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
1998-05-01 04:23:59 +00:00
|
|
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
2010-05-11 12:25:07 +00:00
|
|
|
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
|
1998-05-01 04:23:59 +00:00
|
|
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
2001-04-13 18:00:02 +00:00
|
|
|
if test "x$enable_gtktest" = "xyes" ; then
|
1998-05-01 04:23:59 +00:00
|
|
|
ac_save_CFLAGS="$CFLAGS"
|
|
|
|
ac_save_LIBS="$LIBS"
|
2001-04-13 18:00:02 +00:00
|
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
|
|
|
LIBS="$GTK_LIBS $LIBS"
|
1998-03-12 23:23:43 +00:00
|
|
|
dnl
|
2001-04-13 18:00:02 +00:00
|
|
|
dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
|
|
|
|
dnl checks the results of pkg-config to some extent)
|
1998-03-12 23:23:43 +00:00
|
|
|
dnl
|
2001-04-13 18:00:02 +00:00
|
|
|
rm -f conf.gtktest
|
1998-05-01 04:23:59 +00:00
|
|
|
AC_TRY_RUN([
|
2001-04-13 18:00:02 +00:00
|
|
|
#include <gtk/gtk.h>
|
1998-03-12 23:23:43 +00:00
|
|
|
#include <stdio.h>
|
1998-06-10 23:44:55 +00:00
|
|
|
#include <stdlib.h>
|
1998-03-12 23:23:43 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main ()
|
|
|
|
{
|
2015-10-27 21:08:59 +00:00
|
|
|
unsigned int major, minor, micro;
|
1998-03-12 23:23:43 +00:00
|
|
|
|
2009-11-07 01:18:05 +00:00
|
|
|
fclose (fopen ("conf.gtktest", "w"));
|
1998-05-01 04:23:59 +00:00
|
|
|
|
2015-10-27 21:08:59 +00:00
|
|
|
if (sscanf("$min_gtk_version", "%u.%u.%u", &major, &minor, µ) != 3) {
|
2001-04-13 18:00:02 +00:00
|
|
|
printf("%s, bad version string\n", "$min_gtk_version");
|
1998-03-12 23:23:43 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2001-04-13 18:00:02 +00:00
|
|
|
if ((gtk_major_version != $gtk_config_major_version) ||
|
|
|
|
(gtk_minor_version != $gtk_config_minor_version) ||
|
|
|
|
(gtk_micro_version != $gtk_config_micro_version))
|
1998-05-01 04:23:59 +00:00
|
|
|
{
|
2010-05-11 12:25:07 +00:00
|
|
|
printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
2001-04-13 18:00:02 +00:00
|
|
|
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
|
|
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
2001-04-03 18:48:46 +00:00
|
|
|
printf ("*** was found! If pkg-config was correct, then it is best\n");
|
2001-04-13 18:00:02 +00:00
|
|
|
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
1998-05-01 04:23:59 +00:00
|
|
|
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
|
|
|
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
|
|
|
printf("*** required on your system.\n");
|
2001-04-03 18:48:46 +00:00
|
|
|
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
|
|
|
|
printf("*** to point to the correct configuration files\n");
|
1998-05-01 04:23:59 +00:00
|
|
|
}
|
2001-04-13 18:00:02 +00:00
|
|
|
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
|
|
|
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
|
|
|
(gtk_micro_version != GTK_MICRO_VERSION))
|
1998-06-10 23:44:55 +00:00
|
|
|
{
|
2001-04-13 18:00:02 +00:00
|
|
|
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
|
|
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
1998-06-10 23:44:55 +00:00
|
|
|
printf("*** library (version %d.%d.%d)\n",
|
2001-04-13 18:00:02 +00:00
|
|
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
1998-06-10 23:44:55 +00:00
|
|
|
}
|
1998-05-01 04:23:59 +00:00
|
|
|
else
|
|
|
|
{
|
2001-04-13 18:00:02 +00:00
|
|
|
if ((gtk_major_version > major) ||
|
|
|
|
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
|
|
|
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
1998-05-01 04:23:59 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-10-27 21:08:59 +00:00
|
|
|
printf("\n*** An old version of GTK+ (%u.%u.%u) was found.\n",
|
2001-04-13 18:00:02 +00:00
|
|
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
2015-10-27 21:08:59 +00:00
|
|
|
printf("*** You need a version of GTK+ newer than %u.%u.%u. The latest version of\n",
|
1998-05-01 04:23:59 +00:00
|
|
|
major, minor, micro);
|
2001-04-13 18:00:02 +00:00
|
|
|
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
1998-05-01 04:23:59 +00:00
|
|
|
printf("***\n");
|
|
|
|
printf("*** If you have already installed a sufficiently new version, this error\n");
|
2001-04-03 18:48:46 +00:00
|
|
|
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
|
1998-05-01 04:23:59 +00:00
|
|
|
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
2001-04-13 18:00:02 +00:00
|
|
|
printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
|
2001-04-03 18:48:46 +00:00
|
|
|
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
|
1998-05-01 04:23:59 +00:00
|
|
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
|
|
|
printf("*** so that the correct libraries are found at run-time))\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
1998-03-12 23:23:43 +00:00
|
|
|
}
|
2001-04-13 18:00:02 +00:00
|
|
|
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
1998-05-01 04:23:59 +00:00
|
|
|
CFLAGS="$ac_save_CFLAGS"
|
|
|
|
LIBS="$ac_save_LIBS"
|
|
|
|
fi
|
1998-03-12 23:23:43 +00:00
|
|
|
fi
|
2001-04-13 18:00:02 +00:00
|
|
|
if test "x$no_gtk" = x ; then
|
|
|
|
AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
|
2010-05-11 12:25:07 +00:00
|
|
|
ifelse([$2], , :, [$2])
|
1998-03-12 23:23:43 +00:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
2018-03-26 08:31:31 +00:00
|
|
|
if test -z "$PKG_CONFIG"; then
|
2001-04-03 18:48:46 +00:00
|
|
|
echo "*** A new enough version of pkg-config was not found."
|
|
|
|
echo "*** See http://pkgconfig.sourceforge.net"
|
1998-05-01 04:23:59 +00:00
|
|
|
else
|
2001-04-13 18:00:02 +00:00
|
|
|
if test -f conf.gtktest ; then
|
1998-05-01 04:23:59 +00:00
|
|
|
:
|
|
|
|
else
|
2001-04-13 18:00:02 +00:00
|
|
|
echo "*** Could not run GTK+ test program, checking why..."
|
2002-05-06 18:01:39 +00:00
|
|
|
ac_save_CFLAGS="$CFLAGS"
|
|
|
|
ac_save_LIBS="$LIBS"
|
2001-04-13 18:00:02 +00:00
|
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
|
|
|
LIBS="$LIBS $GTK_LIBS"
|
1998-05-01 04:23:59 +00:00
|
|
|
AC_TRY_LINK([
|
2001-04-13 18:00:02 +00:00
|
|
|
#include <gtk/gtk.h>
|
1998-05-01 04:23:59 +00:00
|
|
|
#include <stdio.h>
|
2001-04-13 18:00:02 +00:00
|
|
|
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
1998-05-01 04:23:59 +00:00
|
|
|
[ echo "*** The test program compiled, but did not run. This usually means"
|
2001-04-13 18:00:02 +00:00
|
|
|
echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
|
|
|
|
echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
|
1998-05-01 04:23:59 +00:00
|
|
|
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 "*** If you have an old version installed, it is best to remove it, although"
|
2001-04-13 18:00:02 +00:00
|
|
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
1998-05-01 04:23:59 +00:00
|
|
|
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
2016-03-11 03:46:02 +00:00
|
|
|
echo "*** exact error that occurred. This usually means GTK+ is incorrectly installed."])
|
1998-05-01 04:23:59 +00:00
|
|
|
CFLAGS="$ac_save_CFLAGS"
|
|
|
|
LIBS="$ac_save_LIBS"
|
|
|
|
fi
|
|
|
|
fi
|
2001-04-13 18:00:02 +00:00
|
|
|
GTK_CFLAGS=""
|
|
|
|
GTK_LIBS=""
|
1998-03-12 23:23:43 +00:00
|
|
|
ifelse([$3], , :, [$3])
|
|
|
|
fi
|
2001-04-13 18:00:02 +00:00
|
|
|
AC_SUBST(GTK_CFLAGS)
|
|
|
|
AC_SUBST(GTK_LIBS)
|
|
|
|
rm -f conf.gtktest
|
1998-03-12 23:23:43 +00:00
|
|
|
])
|
2011-02-16 15:53:20 +00:00
|
|
|
|
2011-02-17 09:33:07 +00:00
|
|
|
dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
2011-02-16 15:53:20 +00:00
|
|
|
dnl Tests for BACKEND-NAME in the GTK targets list
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([GTK_CHECK_BACKEND],
|
2014-08-06 10:23:53 +00:00
|
|
|
[m4_warn([obsolete], [GTK_CHECK_BACKEND is deprecated, use PKG_CHECK_MODULES([GTK_X11], [gtk+-x11-3.0]) or similar instead])
|
2011-02-17 09:33:07 +00:00
|
|
|
pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
|
|
|
|
min_gtk_version=ifelse([$2],,3.0.0,$2)
|
2014-08-09 14:17:44 +00:00
|
|
|
pkg_config_args="$pkg_config_args >= $min_gtk_version"
|
2011-02-17 09:33:07 +00:00
|
|
|
|
2018-03-26 08:31:31 +00:00
|
|
|
PKG_PROG_PKG_CONFIG([0.16])
|
|
|
|
AS_IF([test -z "$PKG_CONFIG"], [AC_MSG_ERROR([No pkg-config found])])
|
2011-02-16 15:53:20 +00:00
|
|
|
|
2014-08-09 14:17:44 +00:00
|
|
|
if $PKG_CONFIG $pkg_config_args ; then
|
2011-02-17 09:33:07 +00:00
|
|
|
target_found=yes
|
2011-02-16 15:53:20 +00:00
|
|
|
else
|
2011-02-17 09:33:07 +00:00
|
|
|
target_found=no
|
2011-02-16 15:53:20 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$target_found" = "xno"; then
|
2011-02-17 09:33:07 +00:00
|
|
|
ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
|
2011-02-16 15:53:20 +00:00
|
|
|
else
|
2011-02-17 09:33:07 +00:00
|
|
|
ifelse([$3],,[:],[$3])
|
2011-02-16 15:53:20 +00:00
|
|
|
fi
|
|
|
|
])
|