1
# Configure paths for GtkGLExt
4
# Shamelessly stolen from gtk-2.0.m4
5
# Configure paths for GTK+
6
# Owen Taylor 1997-2001
8
dnl AM_PATH_GTKGLEXT_1_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9
dnl Test for GtkGLExt, and define GTKGLEXT_CFLAGS and GTKGLEXT_LIBS.
11
AC_DEFUN([AM_PATH_GTKGLEXT_1_0],
16
# GtkGLExt pkg-config module
17
gtkglext_module=gtkglext-1.0
19
# minimum GtkGLExt version
20
gtkglext_min_version=ifelse([$1], ,1.0.0,$1)
22
# minimum pkg-config version
23
pkgconfig_min_version=0.7
25
AC_ARG_ENABLE(gtkglext-test,
26
[ --disable-gtkglext-test do not try to compile and run a test GtkGLExt program],
27
, enable_gtkglext_test=yes)
30
dnl Get the cflags and libraries from pkg-config
32
pkg_config_modules=$gtkglext_module
34
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
36
if test x$PKG_CONFIG != xno ; then
37
if pkg-config --atleast-pkgconfig-version $pkgconfig_min_version ; then
41
echo "*** pkg-config too old; version $pkgconfig_min_version or better required."
49
AC_MSG_CHECKING(for GtkGLExt - version >= $gtkglext_min_version)
51
if test x$PKG_CONFIG != xno ; then
52
## don't try to run the test against uninstalled libtool libs
53
if $PKG_CONFIG --uninstalled $pkg_config_modules; then
55
echo "Will use uninstalled version of GtkGLExt found in PKG_CONFIG_PATH"
56
enable_gtkglext_test=no
59
if $PKG_CONFIG --atleast-version $gtkglext_min_version $pkg_config_modules; then
63
echo "*** pkg-config cannot find $gtkglext_module >= $gtkglext_min_version"
64
echo "*** Set the environment variable PKG_CONFIG_PATH to point to the correct"
65
echo "*** configuration files."
67
enable_gtkglext_test=no
71
if test x"$no_gtkglext" = x ; then
72
GTKGLEXT_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_modules`
73
GTKGLEXT_LIBS=`$PKG_CONFIG --libs $pkg_config_modules`
74
gtkglext_config_major_version=`$PKG_CONFIG --modversion $gtkglext_module | \
75
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
76
gtkglext_config_minor_version=`$PKG_CONFIG --modversion $gtkglext_module | \
77
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
78
gtkglext_config_micro_version=`$PKG_CONFIG --modversion $gtkglext_module | \
79
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
80
if test "x$enable_gtkglext_test" = "xyes" ; then
81
ac_save_CFLAGS="$CFLAGS"
83
CFLAGS="$CFLAGS $GTKGLEXT_CFLAGS"
84
LIBS="$GTKGLEXT_LIBS $LIBS"
86
dnl Now check if the installed GtkGLExt is sufficiently new. (Also sanity
87
dnl checks the results of pkg-config to some extent)
92
#include <gtk/gtkgl.h>
99
int major, minor, micro;
102
system ("touch conf.gtkgltest");
104
/* HP/UX 9 (%@#!) writes to sscanf strings */
105
tmp_version = g_strdup ("$gtkglext_min_version");
106
if (sscanf (tmp_version, "%d.%d.%d", &major, &minor, µ) != 3)
108
printf ("%s, bad version string\n", "$gtkglext_min_version");
112
if ((gtkglext_major_version != $gtkglext_config_major_version) ||
113
(gtkglext_minor_version != $gtkglext_config_minor_version) ||
114
(gtkglext_micro_version != $gtkglext_config_micro_version))
116
printf ("\n*** 'pkg-config --modversion $gtkglext_module' returned %d.%d.%d, but GtkGLExt\n",
117
$gtkglext_config_major_version, $gtkglext_config_minor_version, $gtkglext_config_micro_version);
118
printf ("*** library %d.%d.%d was found!\n",
119
gtkglext_major_version, gtkglext_minor_version, gtkglext_micro_version);
121
printf ("*** If pkg-config was correct, then it is best to remove the old version\n");
122
printf ("*** of GtkGLExt. You may also be able to fix the error by modifying your\n");
123
printf ("*** LD_LIBRARY_PATH enviroment variable, or by editing /etc/ld.so.conf.\n");
124
printf ("*** Make sure you have run ldconfig if that is required on your system.\n");
126
printf ("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
127
printf ("*** to point to the correct configuration files.\n");
129
else if ((gtkglext_major_version != GTKGLEXT_MAJOR_VERSION) ||
130
(gtkglext_minor_version != GTKGLEXT_MINOR_VERSION) ||
131
(gtkglext_micro_version != GTKGLEXT_MICRO_VERSION))
133
printf ("\n*** GtkGLExt header files (version %d.%d.%d) do not match library (version %d.%d.%d).\n",
134
GTKGLEXT_MAJOR_VERSION, GTKGLEXT_MINOR_VERSION, GTKGLEXT_MICRO_VERSION,
135
gtkglext_major_version, gtkglext_minor_version, gtkglext_micro_version);
139
if ((gtkglext_major_version > major) ||
140
((gtkglext_major_version == major) && (gtkglext_minor_version > minor)) ||
141
((gtkglext_major_version == major) && (gtkglext_minor_version == minor) && (gtkglext_micro_version >= micro)))
147
printf ("\n*** An old version of GtkGLExt library (%d.%d.%d) was found.\n",
148
gtkglext_major_version, gtkglext_minor_version, gtkglext_micro_version);
149
printf ("*** You need a version of GtkGLExt newer than %d.%d.%d. The latest version of\n",
150
major, minor, micro);
151
printf ("*** GtkGLExt is always available from http://gtkglext.sourceforge.net/.\n");
153
printf ("*** If you have already installed a sufficiently new version, this error\n");
154
printf ("*** probably means that the wrong copy of the pkg-config shell script is\n");
155
printf ("*** being found. The easiest way to fix this is to remove the old version\n");
156
printf ("*** of GtkGLExt, but you can also set the PKG_CONFIG environment to point\n");
157
printf ("*** to the correct copy of pkg-config. (In this case, you will have to\n");
158
printf ("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
159
printf ("*** so that the correct libraries are found at run-time)\n");
164
],, no_gtkglext=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
165
CFLAGS="$ac_save_CFLAGS"
169
if test "x$no_gtkglext" = x ; then
170
AC_MSG_RESULT(yes (version $gtkglext_config_major_version.$gtkglext_config_minor_version.$gtkglext_config_micro_version))
171
ifelse([$2], , :, [$2])
174
if test "$PKG_CONFIG" = "no" ; then
175
echo "*** A new enough version of pkg-config was not found."
176
echo "*** See http://www.freedesktop.org/software/pkgconfig/."
177
elif test "x$enable_gtkglext_test" = "xyes" ; then
178
if test -f conf.gtkgltest ; then
181
echo "*** Could not run GtkGLExt test program, checking why..."
182
ac_save_CFLAGS="$CFLAGS"
184
CFLAGS="$CFLAGS $GTKGLEXT_CFLAGS"
185
LIBS="$LIBS $GTKGLEXT_LIBS"
188
#include <gtk/gtkgl.h>
190
], [ return ((gtkglext_major_version) || (gtkglext_minor_version) || (gtkglext_micro_version)); ],
191
[ echo "*** The test program compiled, but did not run. This usually means"
192
echo "*** that the run-time linker is not finding GtkGLExt or finding the wrong"
193
echo "*** version of GtkGLExt. If it is not finding GtkGLExt, you'll need to set your"
194
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
195
echo "*** to the installed location Also, make sure you have run ldconfig if that"
196
echo "*** is required on your system"
198
echo "*** If you have an old version installed, it is best to remove it, although"
199
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
200
[ echo "*** The test program failed to compile or link. See the file config.log for the"
201
echo "*** exact error that occured. This usually means GtkGLExt is incorrectly installed."])
202
CFLAGS="$ac_save_CFLAGS"
208
ifelse([$3], , :, [$3])
210
AC_SUBST(GTKGLEXT_CFLAGS)
211
AC_SUBST(GTKGLEXT_LIBS)
215
dnl AC_GTKGLEXT_SUPPORTS_MULTIHEAD([ACTION-IF-SUPPORTED [, ACTION-IF-NOT-SUPPORTED]])
216
dnl Checks whether GtkGLExt supports multihead.
218
AC_DEFUN([AC_GTKGLEXT_SUPPORTS_MULTIHEAD],
219
[ AC_CACHE_CHECK([whether GtkGLExt supports multihead],
220
[ac_cv_gtkglext_supports_multihead],
221
[AC_TRY_LINK([#include <gdk/gdkglquery.h>],
222
[gdk_gl_query_extension_for_display(gdk_display_get_default());],
223
[ac_cv_gtkglext_supports_multihead=yes],
224
[ac_cv_gtkglext_supports_multihead=no])])
225
if test "x$ac_cv_gtkglext_supports_multihead" = "xyes" ; then
226
ifelse([$1], , :, [$1])
228
ifelse([$2], , :, [$2])