]> git.saurik.com Git - wxWidgets.git/blob - aclocal.m4
test for wxLog interaction with wxYield better
[wxWidgets.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Configure paths for GTK+
14 # Owen Taylor 97-11-3
15
16 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
17 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS. Uses variables
18 dnl gtk_config_prefix and/or gtk_config_exec_prefix if defined.
19 AC_DEFUN(AM_PATH_GTK,
20 [
21 if test x$gtk_config_exec_prefix != x ; then
22 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
23 if test x${GTK_CONFIG+set} != xset ; then
24 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
25 fi
26 fi
27 if test x$gtk_config_prefix != x ; then
28 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
29 if test x${GTK_CONFIG+set} != xset ; then
30 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
31 fi
32 fi
33
34 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
35 min_gtk_version=ifelse([$1], ,0.99.7,$1)
36 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
37 no_gtk=""
38 if test "$GTK_CONFIG" != "no" ; then
39 GTK_CFLAGS=`$GTK_CONFIG --cflags`
40 GTK_LIBS=`$GTK_CONFIG --libs gthread`
41 ac_save_CFLAGS="$CFLAGS"
42 ac_save_LIBS="$LIBS"
43 CFLAGS="$CFLAGS $GTK_CFLAGS"
44 LIBS="$LIBS $GTK_LIBS"
45 dnl
46 dnl Now check if the installed GTK is sufficiently new. (Also sanity
47 dnl checks the results of gtk-config to some extent)
48 dnl
49 AC_TRY_RUN([
50 #include <gtk/gtk.h>
51 #include <gtk/gtkfeatures.h>
52 #include <stdio.h>
53 #include <stdlib.h>
54
55 int
56 main ()
57 {
58 int major, minor, micro;
59
60 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
61 printf("%s, bad version string\n", "$min_gtk_version");
62 exit(1);
63 }
64
65 if ((GTK_MAJOR_VERSION != gtk_major_version) ||
66 (GTK_MINOR_VERSION != gtk_minor_version) ||
67 (GTK_MICRO_VERSION != gtk_micro_version)) {
68 printf("Headers vs. library version mismatch!\n");
69 exit(1);
70 }
71
72 if (gtk_minor_version == 1) return FALSE;
73
74 return !((gtk_major_version > major) ||
75 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
76 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
77 }
78 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
79 CFLAGS="$ac_save_CFLAGS"
80 LIBS="$ac_save_LIBS"
81 else
82 no_gtk=yes
83 fi
84 if test "x$no_gtk" = x ; then
85 AC_MSG_RESULT(yes)
86 ifelse([$2], , :, [$2])
87 else
88 AC_MSG_RESULT(no)
89 GTK_CFLAGS=""
90 GTK_LIBS=""
91 ifelse([$3], , :, [$3])
92 fi
93 AC_SUBST(GTK_CFLAGS)
94 AC_SUBST(GTK_LIBS)
95 ])
96
97 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
98 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
99 dnl
100 AC_DEFUN(AM_PATH_GTK_2_0,
101 [dnl
102 dnl Get the cflags and libraries from the gtk-config-2.0 script
103 dnl
104 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
105 gtk_config_prefix="$withval", gtk_config_prefix="")
106 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
107 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
108 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
109 , enable_gtktest=yes)
110
111 for module in . $4
112 do
113 case "$module" in
114 gthread)
115 gtk_config_args="$gtk_config_args gthread"
116 ;;
117 esac
118 done
119
120 if test x$gtk_config_exec_prefix != x ; then
121 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
122 if test x${GTK_CONFIG_2_0+set} != xset ; then
123 GTK_CONFIG_2_0=$gtk_config_exec_prefix/bin/gtk-config-2.0
124 fi
125 fi
126 if test x$gtk_config_prefix != x ; then
127 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
128 if test x${GTK_CONFIG_2_0+set} != xset ; then
129 GTK_CONFIG_2_0=$gtk_config_prefix/bin/gtk-config-2.0
130 fi
131 fi
132
133 AC_PATH_PROG(GTK_CONFIG_2_0, gtk-config-2.0, no)
134 min_gtk_version=ifelse([$1], ,1.3.1,$1)
135 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
136 no_gtk=""
137 if test "$GTK_CONFIG_2_0" = "no" ; then
138 no_gtk=yes
139 else
140 GTK_CFLAGS=`$GTK_CONFIG_2_0 $gtk_config_args --cflags`
141 GTK_LIBS=`$GTK_CONFIG_2_0 $gtk_config_args --libs`
142 gtk_config_major_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
143 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
144 gtk_config_minor_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
145 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
146 gtk_config_micro_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
147 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
148 if test "x$enable_gtktest" = "xyes" ; then
149 ac_save_CFLAGS="$CFLAGS"
150 ac_save_LIBS="$LIBS"
151 CFLAGS="$CFLAGS $GTK_CFLAGS"
152 LIBS="$GTK_LIBS $LIBS"
153 dnl
154 dnl Now check if the installed GTK is sufficiently new. (Also sanity
155 dnl checks the results of gtk-config-2.0 to some extent
156 dnl
157 rm -f conf.gtktest
158 AC_TRY_RUN([
159 #include <gtk/gtk.h>
160 #include <stdio.h>
161 #include <stdlib.h>
162
163 int
164 main ()
165 {
166 int major, minor, micro;
167 char *tmp_version;
168
169 system ("touch conf.gtktest");
170
171 /* HP/UX 9 (%@#!) writes to sscanf strings */
172 tmp_version = g_strdup("$min_gtk_version");
173 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
174 printf("%s, bad version string\n", "$min_gtk_version");
175 exit(1);
176 }
177
178 if ((gtk_major_version != $gtk_config_major_version) ||
179 (gtk_minor_version != $gtk_config_minor_version) ||
180 (gtk_micro_version != $gtk_config_micro_version))
181 {
182 printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
183 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
184 gtk_major_version, gtk_minor_version, gtk_micro_version);
185 printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n");
186 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
187 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
188 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
189 printf("*** required on your system.\n");
190 printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n");
191 printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n");
192 printf("*** before re-running configure\n");
193 }
194 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
195 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
196 (gtk_minor_version != GTK_MINOR_VERSION) ||
197 (gtk_micro_version != GTK_MICRO_VERSION))
198 {
199 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
200 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
201 printf("*** library (version %d.%d.%d)\n",
202 gtk_major_version, gtk_minor_version, gtk_micro_version);
203 }
204 #endif /* defined (GTK_MAJOR_VERSION) ... */
205 else
206 {
207 if ((gtk_major_version > major) ||
208 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
209 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
210 {
211 return 0;
212 }
213 else
214 {
215 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
216 gtk_major_version, gtk_minor_version, gtk_micro_version);
217 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
218 major, minor, micro);
219 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
220 printf("***\n");
221 printf("*** If you have already installed a sufficiently new version, this error\n");
222 printf("*** probably means that the wrong copy of the gtk-config-2.0 shell script is\n");
223 printf("*** being found. The easiest way to fix this is to remove the old version\n");
224 printf("*** of GTK+, but you can also set the GTK_CONFIG_2_0 environment to point to the\n");
225 printf("*** correct copy of gtk-config-2.0. (In this case, you will have to\n");
226 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
227 printf("*** so that the correct libraries are found at run-time))\n");
228 }
229 }
230 return 1;
231 }
232 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
233 CFLAGS="$ac_save_CFLAGS"
234 LIBS="$ac_save_LIBS"
235 fi
236 fi
237 if test "x$no_gtk" = x ; then
238 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
239 ifelse([$2], , :, [$2])
240 else
241 AC_MSG_RESULT(no)
242 if test "$GTK_CONFIG_2_0" = "no" ; then
243 echo "*** The gtk-config-2.0 script installed by GTK could not be found"
244 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
245 echo "*** your path, or set the GTK_CONFIG_2_0 environment variable to the"
246 echo "*** full path to gtk-config-2.0."
247 else
248 if test -f conf.gtktest ; then
249 :
250 else
251 echo "*** Could not run GTK test program, checking why..."
252 CFLAGS="$CFLAGS $GTK_CFLAGS"
253 LIBS="$LIBS $GTK_LIBS"
254 AC_TRY_LINK([
255 #include <gtk/gtk.h>
256 #include <stdio.h>
257 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
258 [ echo "*** The test program compiled, but did not run. This usually means"
259 echo "*** that the run-time linker is not finding GTK or finding the wrong"
260 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
261 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
262 echo "*** to the installed location Also, make sure you have run ldconfig if that"
263 echo "*** is required on your system"
264 echo "***"
265 echo "*** If you have an old version installed, it is best to remove it, although"
266 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
267 echo "***"
268 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
269 echo "*** came with the system with the command"
270 echo "***"
271 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
272 [ echo "*** The test program failed to compile or link. See the file config.log for the"
273 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
274 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
275 echo "*** may want to edit the gtk-config-2.0 script: $GTK_CONFIG_2_0" ])
276 CFLAGS="$ac_save_CFLAGS"
277 LIBS="$ac_save_LIBS"
278 fi
279 fi
280 GTK_CFLAGS=""
281 GTK_LIBS=""
282 ifelse([$3], , :, [$3])
283 fi
284 AC_SUBST(GTK_CFLAGS)
285 AC_SUBST(GTK_LIBS)
286 rm -f conf.gtktest
287 ])
288
289