]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/gtk-3.0.m4
Don't redraw borders for cells that are hidden - fixes drawing glitch in sample
[wxWidgets.git] / build / aclocal / gtk-3.0.m4
1 # Configure paths for GTK+
2 # Owen Taylor 1997-2001
3
4 dnl AM_PATH_GTK_3_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
5 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
6 dnl pass to pkg-config
7 dnl
8 AC_DEFUN([AM_PATH_GTK_3_0],
9 [dnl
10 dnl Get the cflags and libraries from pkg-config
11 dnl
12 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
13 , enable_gtktest=yes)
14
15 pkg_gtk_version=gtk+-3.0
16 pkg_config_args=$pkg_gtk_version
17 for module in . $4
18 do
19 case "$module" in
20 gthread)
21 pkg_gthread_version=gthread-2.0
22 pkg_config_args="$pkg_config_args $pkg_gthread_version"
23 ;;
24 esac
25 done
26
27 no_gtk=""
28
29 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
30
31 if test x$PKG_CONFIG != xno ; then
32 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
33 :
34 else
35 echo "*** pkg-config too old; version 0.7 or better required."
36 no_gtk=yes
37 PKG_CONFIG=no
38 fi
39 else
40 no_gtk=yes
41 fi
42
43 min_gtk_version=ifelse([$1], ,3.0.0,$1)
44 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
45
46 if test x$PKG_CONFIG != xno ; then
47 ## don't try to run the test against uninstalled libtool libs
48 if $PKG_CONFIG --uninstalled $pkg_config_args; then
49 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
50 enable_gtktest=no
51 fi
52 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_gtk_version ; then
53 :
54 else
55 no_gtk=yes
56 fi
57 fi
58
59 if test x"$no_gtk" = x ; then
60 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
61 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
62 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
63 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
64 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
65 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
66 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
67 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
68 if test "x$enable_gtktest" = "xyes" ; then
69 ac_save_CFLAGS="$CFLAGS"
70 ac_save_LIBS="$LIBS"
71 CFLAGS="$CFLAGS $GTK_CFLAGS"
72 LIBS="$GTK_LIBS $LIBS"
73 dnl
74 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
75 dnl checks the results of pkg-config to some extent)
76 dnl
77 rm -f conf.gtktest
78 AC_TRY_RUN([
79 #include <gtk/gtk.h>
80 #include <stdio.h>
81 #include <stdlib.h>
82
83 int
84 main ()
85 {
86 int major, minor, micro;
87 char *tmp_version;
88
89 fclose (fopen ("conf.gtktest", "w"));
90
91 /* HP/UX 9 (%@#!) writes to sscanf strings */
92 tmp_version = g_strdup("$min_gtk_version");
93 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
94 printf("%s, bad version string\n", "$min_gtk_version");
95 exit(1);
96 }
97
98 if ((gtk_major_version != $gtk_config_major_version) ||
99 (gtk_minor_version != $gtk_config_minor_version) ||
100 (gtk_micro_version != $gtk_config_micro_version))
101 {
102 printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
103 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
104 gtk_major_version, gtk_minor_version, gtk_micro_version);
105 printf ("*** was found! If pkg-config was correct, then it is best\n");
106 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
107 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
108 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
109 printf("*** required on your system.\n");
110 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
111 printf("*** to point to the correct configuration files\n");
112 }
113 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
114 (gtk_minor_version != GTK_MINOR_VERSION) ||
115 (gtk_micro_version != GTK_MICRO_VERSION))
116 {
117 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
118 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
119 printf("*** library (version %d.%d.%d)\n",
120 gtk_major_version, gtk_minor_version, gtk_micro_version);
121 }
122 else
123 {
124 if ((gtk_major_version > major) ||
125 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
126 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
127 {
128 return 0;
129 }
130 else
131 {
132 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
133 gtk_major_version, gtk_minor_version, gtk_micro_version);
134 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
135 major, minor, micro);
136 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
137 printf("***\n");
138 printf("*** If you have already installed a sufficiently new version, this error\n");
139 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
140 printf("*** being found. The easiest way to fix this is to remove the old version\n");
141 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
142 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
143 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
144 printf("*** so that the correct libraries are found at run-time))\n");
145 }
146 }
147 return 1;
148 }
149 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
150 CFLAGS="$ac_save_CFLAGS"
151 LIBS="$ac_save_LIBS"
152 fi
153 fi
154 if test "x$no_gtk" = x ; then
155 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
156 ifelse([$2], , :, [$2])
157 else
158 AC_MSG_RESULT(no)
159 if test "$PKG_CONFIG" = "no" ; then
160 echo "*** A new enough version of pkg-config was not found."
161 echo "*** See http://pkgconfig.sourceforge.net"
162 else
163 if test -f conf.gtktest ; then
164 :
165 else
166 echo "*** Could not run GTK+ test program, checking why..."
167 ac_save_CFLAGS="$CFLAGS"
168 ac_save_LIBS="$LIBS"
169 CFLAGS="$CFLAGS $GTK_CFLAGS"
170 LIBS="$LIBS $GTK_LIBS"
171 AC_TRY_LINK([
172 #include <gtk/gtk.h>
173 #include <stdio.h>
174 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
175 [ echo "*** The test program compiled, but did not run. This usually means"
176 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
177 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
178 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
179 echo "*** to the installed location Also, make sure you have run ldconfig if that"
180 echo "*** is required on your system"
181 echo "***"
182 echo "*** If you have an old version installed, it is best to remove it, although"
183 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
184 [ echo "*** The test program failed to compile or link. See the file config.log for the"
185 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
186 CFLAGS="$ac_save_CFLAGS"
187 LIBS="$ac_save_LIBS"
188 fi
189 fi
190 GTK_CFLAGS=""
191 GTK_LIBS=""
192 ifelse([$3], , :, [$3])
193 fi
194 AC_SUBST(GTK_CFLAGS)
195 AC_SUBST(GTK_LIBS)
196 rm -f conf.gtktest
197 ])
198
199 dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
200 dnl Tests for BACKEND-NAME in the GTK targets list
201 dnl
202 AC_DEFUN([GTK_CHECK_BACKEND],
203 [
204 pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
205 min_gtk_version=ifelse([$2],,3.0.0,$2)
206
207 AC_PATH_PROG(PKG_CONFIG, [pkg-config], [AC_MSG_ERROR([No pkg-config found])])
208
209 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_gtk_version ; then
210 target_found=yes
211 else
212 target_found=no
213 fi
214
215 if test "x$target_found" = "xno"; then
216 ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
217 else
218 ifelse([$3],,[:],[$3])
219 fi
220 ])