1 | dnl Added by setup-gettext. Do not remove this |
---|
2 | dnl unless you know what you are doing. |
---|
3 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) |
---|
4 | |
---|
5 | # Configure paths for GLIB |
---|
6 | # Owen Taylor 1997-2001 |
---|
7 | |
---|
8 | dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
---|
9 | dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or |
---|
10 | dnl gthread is specified in MODULES, pass to pkg-config |
---|
11 | dnl |
---|
12 | AC_DEFUN([AM_PATH_GLIB_2_0], |
---|
13 | [dnl |
---|
14 | dnl Get the cflags and libraries from pkg-config |
---|
15 | dnl |
---|
16 | AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], |
---|
17 | , enable_glibtest=yes) |
---|
18 | |
---|
19 | pkg_config_args=glib-2.0 |
---|
20 | for module in . $4 |
---|
21 | do |
---|
22 | case "$module" in |
---|
23 | gmodule) |
---|
24 | pkg_config_args="$pkg_config_args gmodule-2.0" |
---|
25 | ;; |
---|
26 | gobject) |
---|
27 | pkg_config_args="$pkg_config_args gobject-2.0" |
---|
28 | ;; |
---|
29 | gthread) |
---|
30 | pkg_config_args="$pkg_config_args gthread-2.0" |
---|
31 | ;; |
---|
32 | esac |
---|
33 | done |
---|
34 | |
---|
35 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
36 | |
---|
37 | no_glib="" |
---|
38 | |
---|
39 | if test x$PKG_CONFIG != xno ; then |
---|
40 | if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then |
---|
41 | : |
---|
42 | else |
---|
43 | echo *** pkg-config too old; version 0.7 or better required. |
---|
44 | no_glib=yes |
---|
45 | PKG_CONFIG=no |
---|
46 | fi |
---|
47 | else |
---|
48 | no_glib=yes |
---|
49 | fi |
---|
50 | |
---|
51 | min_glib_version=ifelse([$1], ,2.0.0,$1) |
---|
52 | AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) |
---|
53 | |
---|
54 | if test x$PKG_CONFIG != xno ; then |
---|
55 | ## don't try to run the test against uninstalled libtool libs |
---|
56 | if $PKG_CONFIG --uninstalled $pkg_config_args; then |
---|
57 | echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" |
---|
58 | enable_glibtest=no |
---|
59 | fi |
---|
60 | |
---|
61 | if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then |
---|
62 | : |
---|
63 | else |
---|
64 | no_glib=yes |
---|
65 | fi |
---|
66 | fi |
---|
67 | |
---|
68 | if test x"$no_glib" = x ; then |
---|
69 | GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` |
---|
70 | GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` |
---|
71 | GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` |
---|
72 | |
---|
73 | GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` |
---|
74 | GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` |
---|
75 | glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
---|
76 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
---|
77 | glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
---|
78 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
---|
79 | glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
---|
80 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
---|
81 | if test "x$enable_glibtest" = "xyes" ; then |
---|
82 | ac_save_CFLAGS="$CFLAGS" |
---|
83 | ac_save_LIBS="$LIBS" |
---|
84 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
---|
85 | LIBS="$GLIB_LIBS $LIBS" |
---|
86 | dnl |
---|
87 | dnl Now check if the installed GLIB is sufficiently new. (Also sanity |
---|
88 | dnl checks the results of pkg-config to some extent) |
---|
89 | dnl |
---|
90 | rm -f conf.glibtest |
---|
91 | AC_TRY_RUN([ |
---|
92 | #include <glib.h> |
---|
93 | #include <stdio.h> |
---|
94 | #include <stdlib.h> |
---|
95 | |
---|
96 | int |
---|
97 | main () |
---|
98 | { |
---|
99 | int major, minor, micro; |
---|
100 | char *tmp_version; |
---|
101 | |
---|
102 | system ("touch conf.glibtest"); |
---|
103 | |
---|
104 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
---|
105 | tmp_version = g_strdup("$min_glib_version"); |
---|
106 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
---|
107 | printf("%s, bad version string\n", "$min_glib_version"); |
---|
108 | exit(1); |
---|
109 | } |
---|
110 | |
---|
111 | if ((glib_major_version != $glib_config_major_version) || |
---|
112 | (glib_minor_version != $glib_config_minor_version) || |
---|
113 | (glib_micro_version != $glib_config_micro_version)) |
---|
114 | { |
---|
115 | printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", |
---|
116 | $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, |
---|
117 | glib_major_version, glib_minor_version, glib_micro_version); |
---|
118 | printf ("*** was found! If pkg-config was correct, then it is best\n"); |
---|
119 | printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); |
---|
120 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
---|
121 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
---|
122 | printf("*** required on your system.\n"); |
---|
123 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); |
---|
124 | printf("*** to point to the correct configuration files\n"); |
---|
125 | } |
---|
126 | else if ((glib_major_version != GLIB_MAJOR_VERSION) || |
---|
127 | (glib_minor_version != GLIB_MINOR_VERSION) || |
---|
128 | (glib_micro_version != GLIB_MICRO_VERSION)) |
---|
129 | { |
---|
130 | printf("*** GLIB header files (version %d.%d.%d) do not match\n", |
---|
131 | GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); |
---|
132 | printf("*** library (version %d.%d.%d)\n", |
---|
133 | glib_major_version, glib_minor_version, glib_micro_version); |
---|
134 | } |
---|
135 | else |
---|
136 | { |
---|
137 | if ((glib_major_version > major) || |
---|
138 | ((glib_major_version == major) && (glib_minor_version > minor)) || |
---|
139 | ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) |
---|
140 | { |
---|
141 | return 0; |
---|
142 | } |
---|
143 | else |
---|
144 | { |
---|
145 | printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", |
---|
146 | glib_major_version, glib_minor_version, glib_micro_version); |
---|
147 | printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", |
---|
148 | major, minor, micro); |
---|
149 | printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); |
---|
150 | printf("***\n"); |
---|
151 | printf("*** If you have already installed a sufficiently new version, this error\n"); |
---|
152 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); |
---|
153 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
---|
154 | printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); |
---|
155 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); |
---|
156 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
---|
157 | printf("*** so that the correct libraries are found at run-time))\n"); |
---|
158 | } |
---|
159 | } |
---|
160 | return 1; |
---|
161 | } |
---|
162 | ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
---|
163 | CFLAGS="$ac_save_CFLAGS" |
---|
164 | LIBS="$ac_save_LIBS" |
---|
165 | fi |
---|
166 | fi |
---|
167 | if test "x$no_glib" = x ; then |
---|
168 | AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) |
---|
169 | ifelse([$2], , :, [$2]) |
---|
170 | else |
---|
171 | AC_MSG_RESULT(no) |
---|
172 | if test "$PKG_CONFIG" = "no" ; then |
---|
173 | echo "*** A new enough version of pkg-config was not found." |
---|
174 | echo "*** See http://www.freedesktop.org/software/pkgconfig/" |
---|
175 | else |
---|
176 | if test -f conf.glibtest ; then |
---|
177 | : |
---|
178 | else |
---|
179 | echo "*** Could not run GLIB test program, checking why..." |
---|
180 | ac_save_CFLAGS="$CFLAGS" |
---|
181 | ac_save_LIBS="$LIBS" |
---|
182 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
---|
183 | LIBS="$LIBS $GLIB_LIBS" |
---|
184 | AC_TRY_LINK([ |
---|
185 | #include <glib.h> |
---|
186 | #include <stdio.h> |
---|
187 | ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], |
---|
188 | [ echo "*** The test program compiled, but did not run. This usually means" |
---|
189 | echo "*** that the run-time linker is not finding GLIB or finding the wrong" |
---|
190 | echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" |
---|
191 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
---|
192 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
---|
193 | echo "*** is required on your system" |
---|
194 | echo "***" |
---|
195 | echo "*** If you have an old version installed, it is best to remove it, although" |
---|
196 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
---|
197 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
---|
198 | echo "*** exact error that occurred. This usually means GLIB is incorrectly installed."]) |
---|
199 | CFLAGS="$ac_save_CFLAGS" |
---|
200 | LIBS="$ac_save_LIBS" |
---|
201 | fi |
---|
202 | fi |
---|
203 | GLIB_CFLAGS="" |
---|
204 | GLIB_LIBS="" |
---|
205 | GLIB_GENMARSHAL="" |
---|
206 | GOBJECT_QUERY="" |
---|
207 | GLIB_MKENUMS="" |
---|
208 | ifelse([$3], , :, [$3]) |
---|
209 | fi |
---|
210 | AC_SUBST(GLIB_CFLAGS) |
---|
211 | AC_SUBST(GLIB_LIBS) |
---|
212 | AC_SUBST(GLIB_GENMARSHAL) |
---|
213 | AC_SUBST(GOBJECT_QUERY) |
---|
214 | AC_SUBST(GLIB_MKENUMS) |
---|
215 | rm -f conf.glibtest |
---|
216 | ]) |
---|
217 | # Configure paths for GTK+ |
---|
218 | # Owen Taylor 1997-2001 |
---|
219 | |
---|
220 | dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
---|
221 | dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, |
---|
222 | dnl pass to pkg-config |
---|
223 | dnl |
---|
224 | AC_DEFUN([AM_PATH_GTK_2_0], |
---|
225 | [dnl |
---|
226 | dnl Get the cflags and libraries from pkg-config |
---|
227 | dnl |
---|
228 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], |
---|
229 | , enable_gtktest=yes) |
---|
230 | |
---|
231 | pkg_config_args=gtk+-2.0 |
---|
232 | for module in . $4 |
---|
233 | do |
---|
234 | case "$module" in |
---|
235 | gthread) |
---|
236 | pkg_config_args="$pkg_config_args gthread-2.0" |
---|
237 | ;; |
---|
238 | esac |
---|
239 | done |
---|
240 | |
---|
241 | no_gtk="" |
---|
242 | |
---|
243 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
244 | |
---|
245 | if test x$PKG_CONFIG != xno ; then |
---|
246 | if pkg-config --atleast-pkgconfig-version 0.7 ; then |
---|
247 | : |
---|
248 | else |
---|
249 | echo *** pkg-config too old; version 0.7 or better required. |
---|
250 | no_gtk=yes |
---|
251 | PKG_CONFIG=no |
---|
252 | fi |
---|
253 | else |
---|
254 | no_gtk=yes |
---|
255 | fi |
---|
256 | |
---|
257 | min_gtk_version=ifelse([$1], ,2.0.0,$1) |
---|
258 | AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) |
---|
259 | |
---|
260 | if test x$PKG_CONFIG != xno ; then |
---|
261 | ## don't try to run the test against uninstalled libtool libs |
---|
262 | if $PKG_CONFIG --uninstalled $pkg_config_args; then |
---|
263 | echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" |
---|
264 | enable_gtktest=no |
---|
265 | fi |
---|
266 | |
---|
267 | if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then |
---|
268 | : |
---|
269 | else |
---|
270 | no_gtk=yes |
---|
271 | fi |
---|
272 | fi |
---|
273 | |
---|
274 | if test x"$no_gtk" = x ; then |
---|
275 | GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` |
---|
276 | GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` |
---|
277 | gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
---|
278 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
---|
279 | gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
---|
280 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
---|
281 | gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
---|
282 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
---|
283 | if test "x$enable_gtktest" = "xyes" ; then |
---|
284 | ac_save_CFLAGS="$CFLAGS" |
---|
285 | ac_save_LIBS="$LIBS" |
---|
286 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
---|
287 | LIBS="$GTK_LIBS $LIBS" |
---|
288 | dnl |
---|
289 | dnl Now check if the installed GTK+ is sufficiently new. (Also sanity |
---|
290 | dnl checks the results of pkg-config to some extent) |
---|
291 | dnl |
---|
292 | rm -f conf.gtktest |
---|
293 | AC_TRY_RUN([ |
---|
294 | #include <gtk/gtk.h> |
---|
295 | #include <stdio.h> |
---|
296 | #include <stdlib.h> |
---|
297 | |
---|
298 | int |
---|
299 | main () |
---|
300 | { |
---|
301 | int major, minor, micro; |
---|
302 | char *tmp_version; |
---|
303 | |
---|
304 | system ("touch conf.gtktest"); |
---|
305 | |
---|
306 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
---|
307 | tmp_version = g_strdup("$min_gtk_version"); |
---|
308 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
---|
309 | printf("%s, bad version string\n", "$min_gtk_version"); |
---|
310 | exit(1); |
---|
311 | } |
---|
312 | |
---|
313 | if ((gtk_major_version != $gtk_config_major_version) || |
---|
314 | (gtk_minor_version != $gtk_config_minor_version) || |
---|
315 | (gtk_micro_version != $gtk_config_micro_version)) |
---|
316 | { |
---|
317 | printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", |
---|
318 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, |
---|
319 | gtk_major_version, gtk_minor_version, gtk_micro_version); |
---|
320 | printf ("*** was found! If pkg-config was correct, then it is best\n"); |
---|
321 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); |
---|
322 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
---|
323 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
---|
324 | printf("*** required on your system.\n"); |
---|
325 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); |
---|
326 | printf("*** to point to the correct configuration files\n"); |
---|
327 | } |
---|
328 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || |
---|
329 | (gtk_minor_version != GTK_MINOR_VERSION) || |
---|
330 | (gtk_micro_version != GTK_MICRO_VERSION)) |
---|
331 | { |
---|
332 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", |
---|
333 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); |
---|
334 | printf("*** library (version %d.%d.%d)\n", |
---|
335 | gtk_major_version, gtk_minor_version, gtk_micro_version); |
---|
336 | } |
---|
337 | else |
---|
338 | { |
---|
339 | if ((gtk_major_version > major) || |
---|
340 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || |
---|
341 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) |
---|
342 | { |
---|
343 | return 0; |
---|
344 | } |
---|
345 | else |
---|
346 | { |
---|
347 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", |
---|
348 | gtk_major_version, gtk_minor_version, gtk_micro_version); |
---|
349 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", |
---|
350 | major, minor, micro); |
---|
351 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); |
---|
352 | printf("***\n"); |
---|
353 | printf("*** If you have already installed a sufficiently new version, this error\n"); |
---|
354 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); |
---|
355 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
---|
356 | printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); |
---|
357 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); |
---|
358 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
---|
359 | printf("*** so that the correct libraries are found at run-time))\n"); |
---|
360 | } |
---|
361 | } |
---|
362 | return 1; |
---|
363 | } |
---|
364 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
---|
365 | CFLAGS="$ac_save_CFLAGS" |
---|
366 | LIBS="$ac_save_LIBS" |
---|
367 | fi |
---|
368 | fi |
---|
369 | if test "x$no_gtk" = x ; then |
---|
370 | AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) |
---|
371 | ifelse([$2], , :, [$2]) |
---|
372 | else |
---|
373 | AC_MSG_RESULT(no) |
---|
374 | if test "$PKG_CONFIG" = "no" ; then |
---|
375 | echo "*** A new enough version of pkg-config was not found." |
---|
376 | echo "*** See http://pkgconfig.sourceforge.net" |
---|
377 | else |
---|
378 | if test -f conf.gtktest ; then |
---|
379 | : |
---|
380 | else |
---|
381 | echo "*** Could not run GTK+ test program, checking why..." |
---|
382 | ac_save_CFLAGS="$CFLAGS" |
---|
383 | ac_save_LIBS="$LIBS" |
---|
384 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
---|
385 | LIBS="$LIBS $GTK_LIBS" |
---|
386 | AC_TRY_LINK([ |
---|
387 | #include <gtk/gtk.h> |
---|
388 | #include <stdio.h> |
---|
389 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], |
---|
390 | [ echo "*** The test program compiled, but did not run. This usually means" |
---|
391 | echo "*** that the run-time linker is not finding GTK+ or finding the wrong" |
---|
392 | echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" |
---|
393 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
---|
394 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
---|
395 | echo "*** is required on your system" |
---|
396 | echo "***" |
---|
397 | echo "*** If you have an old version installed, it is best to remove it, although" |
---|
398 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
---|
399 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
---|
400 | echo "*** exact error that occurred. This usually means GTK+ is incorrectly installed."]) |
---|
401 | CFLAGS="$ac_save_CFLAGS" |
---|
402 | LIBS="$ac_save_LIBS" |
---|
403 | fi |
---|
404 | fi |
---|
405 | GTK_CFLAGS="" |
---|
406 | GTK_LIBS="" |
---|
407 | ifelse([$3], , :, [$3]) |
---|
408 | fi |
---|
409 | AC_SUBST(GTK_CFLAGS) |
---|
410 | AC_SUBST(GTK_LIBS) |
---|
411 | rm -f conf.gtktest |
---|
412 | ]) |
---|
413 | |
---|
414 | dnl This is XIPH_PATH_AO renamed to GAIM_PATH_AO to prevent conflicts. |
---|
415 | dnl It's a long story. --elb |
---|
416 | |
---|
417 | # ao.m4 |
---|
418 | # Configure paths for libao |
---|
419 | # Jack Moffitt <jack@icecast.org> 10-21-2000 |
---|
420 | # Shamelessly stolen from Owen Taylor and Manish Singh |
---|
421 | |
---|
422 | dnl GAIM_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
---|
423 | dnl Test for libao, and define AO_CFLAGS and AO_LIBS |
---|
424 | dnl |
---|
425 | AC_DEFUN([GAIM_PATH_AO], |
---|
426 | [dnl |
---|
427 | dnl Get the cflags and libraries |
---|
428 | dnl |
---|
429 | AC_ARG_WITH(ao,[ --with-ao=PFX Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="") |
---|
430 | AC_ARG_WITH(ao-libraries,[ --with-ao-libraries=DIR Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="") |
---|
431 | AC_ARG_WITH(ao-includes,[ --with-ao-includes=DIR Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="") |
---|
432 | AC_ARG_ENABLE(aotest, [ --disable-aotest Do not try to compile and run a test ao program],, enable_aotest=yes) |
---|
433 | |
---|
434 | |
---|
435 | if test "x$ao_libraries" != "x" ; then |
---|
436 | AO_LIBS="-L$ao_libraries" |
---|
437 | elif test "x$ao_prefix" != "x"; then |
---|
438 | AO_LIBS="-L$ao_prefix/lib" |
---|
439 | elif test "x$prefix" != "xNONE"; then |
---|
440 | AO_LIBS="-L$prefix/lib" |
---|
441 | fi |
---|
442 | |
---|
443 | if test "x$ao_includes" != "x" ; then |
---|
444 | AO_CFLAGS="-I$ao_includes" |
---|
445 | elif test "x$ao_prefix" != "x"; then |
---|
446 | AO_CFLAGS="-I$ao_prefix/include" |
---|
447 | elif test "x$prefix" != "xNONE"; then |
---|
448 | AO_CFLAGS="-I$prefix/include" |
---|
449 | fi |
---|
450 | |
---|
451 | # see where dl* and friends live |
---|
452 | AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [ |
---|
453 | AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [ |
---|
454 | AC_MSG_WARN([could not find dlopen() needed by libao sound drivers |
---|
455 | your system may not be supported.]) |
---|
456 | ]) |
---|
457 | ]) |
---|
458 | |
---|
459 | AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS" |
---|
460 | |
---|
461 | AC_MSG_CHECKING(for ao) |
---|
462 | no_ao="" |
---|
463 | |
---|
464 | |
---|
465 | if test "x$enable_aotest" = "xyes" ; then |
---|
466 | ac_save_CFLAGS="$CFLAGS" |
---|
467 | ac_save_LIBS="$LIBS" |
---|
468 | CFLAGS="$CFLAGS $AO_CFLAGS" |
---|
469 | LIBS="$LIBS $AO_LIBS" |
---|
470 | dnl |
---|
471 | dnl Now check if the installed ao is sufficiently new. |
---|
472 | dnl |
---|
473 | rm -f conf.aotest |
---|
474 | AC_TRY_RUN([ |
---|
475 | #include <stdio.h> |
---|
476 | #include <stdlib.h> |
---|
477 | #include <string.h> |
---|
478 | #include <ao/ao.h> |
---|
479 | |
---|
480 | int main () |
---|
481 | { |
---|
482 | system("touch conf.aotest"); |
---|
483 | return 0; |
---|
484 | } |
---|
485 | |
---|
486 | ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
---|
487 | CFLAGS="$ac_save_CFLAGS" |
---|
488 | LIBS="$ac_save_LIBS" |
---|
489 | fi |
---|
490 | |
---|
491 | if test "x$no_ao" = "x" ; then |
---|
492 | AC_MSG_RESULT(yes) |
---|
493 | ifelse([$1], , :, [$1]) |
---|
494 | else |
---|
495 | AC_MSG_RESULT(no) |
---|
496 | if test -f conf.aotest ; then |
---|
497 | : |
---|
498 | else |
---|
499 | echo "*** Could not run ao test program, checking why..." |
---|
500 | CFLAGS="$CFLAGS $AO_CFLAGS" |
---|
501 | LIBS="$LIBS $AO_LIBS" |
---|
502 | AC_TRY_LINK([ |
---|
503 | #include <stdio.h> |
---|
504 | #include <ao/ao.h> |
---|
505 | ], [ return 0; ], |
---|
506 | [ echo "*** The test program compiled, but did not run. This usually means" |
---|
507 | echo "*** that the run-time linker is not finding ao or finding the wrong" |
---|
508 | echo "*** version of ao. If it is not finding ao, you'll need to set your" |
---|
509 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
---|
510 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
---|
511 | echo "*** is required on your system" |
---|
512 | echo "***" |
---|
513 | echo "*** If you have an old version installed, it is best to remove it, although" |
---|
514 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], |
---|
515 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
---|
516 | echo "*** exact error that occurred. This usually means ao was incorrectly installed" |
---|
517 | echo "*** or that you have moved ao since it was installed." ]) |
---|
518 | CFLAGS="$ac_save_CFLAGS" |
---|
519 | LIBS="$ac_save_LIBS" |
---|
520 | fi |
---|
521 | AO_CFLAGS="" |
---|
522 | AO_LIBS="" |
---|
523 | ifelse([$2], , :, [$2]) |
---|
524 | fi |
---|
525 | AC_SUBST(AO_CFLAGS) |
---|
526 | AC_SUBST(AO_LIBS) |
---|
527 | rm -f conf.aotest |
---|
528 | ]) |
---|
529 | |
---|
530 | dnl audiofile.m4, included here for those people who don't have audiofile |
---|
531 | dnl installed but would like to build CVS. |
---|
532 | |
---|
533 | # Configure paths for the Audio File Library |
---|
534 | # Bertrand Guiheneuf 98-10-21 |
---|
535 | # stolen from esd.m4 in esound : |
---|
536 | # Manish Singh 98-9-30 |
---|
537 | # stolen back from Frank Belew |
---|
538 | # stolen from Manish Singh |
---|
539 | # Shamelessly stolen from Owen Taylor |
---|
540 | |
---|
541 | dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
---|
542 | dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS. |
---|
543 | dnl |
---|
544 | AC_DEFUN([AM_PATH_AUDIOFILE], |
---|
545 | [dnl |
---|
546 | dnl Get compiler flags and libraries from the audiofile-config script. |
---|
547 | dnl |
---|
548 | AC_ARG_WITH(audiofile-prefix,[ --with-audiofile-prefix=PFX Prefix where Audio File Library is installed (optional)], |
---|
549 | audiofile_prefix="$withval", audiofile_prefix="") |
---|
550 | AC_ARG_WITH(audiofile-exec-prefix,[ --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)], |
---|
551 | audiofile_exec_prefix="$withval", audiofile_exec_prefix="") |
---|
552 | AC_ARG_ENABLE(audiofiletest, [ --disable-audiofiletest Do not try to compile and run a test Audio File Library program], , enable_audiofiletest=yes) |
---|
553 | |
---|
554 | if test x$audiofile_exec_prefix != x ; then |
---|
555 | audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix" |
---|
556 | if test x${AUDIOFILE_CONFIG+set} != xset ; then |
---|
557 | AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config |
---|
558 | fi |
---|
559 | fi |
---|
560 | if test x$audiofile_prefix != x ; then |
---|
561 | audiofile_args="$audiofile_args --prefix=$audiofile_prefix" |
---|
562 | if test x${AUDIOFILE_CONFIG+set} != xset ; then |
---|
563 | AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config |
---|
564 | fi |
---|
565 | fi |
---|
566 | |
---|
567 | AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no) |
---|
568 | min_audiofile_version=ifelse([$1], ,0.2.5,$1) |
---|
569 | AC_MSG_CHECKING(for Audio File Library - version >= $min_audiofile_version) |
---|
570 | no_audiofile="" |
---|
571 | if test "$AUDIOFILE_CONFIG" = "no" ; then |
---|
572 | no_audiofile=yes |
---|
573 | else |
---|
574 | AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs` |
---|
575 | AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags` |
---|
576 | audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ |
---|
577 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
---|
578 | audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ |
---|
579 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
---|
580 | audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \ |
---|
581 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
---|
582 | if test "x$enable_audiofiletest" = "xyes" ; then |
---|
583 | AC_LANG_SAVE |
---|
584 | AC_LANG_C |
---|
585 | ac_save_CFLAGS="$CFLAGS" |
---|
586 | ac_save_LIBS="$LIBS" |
---|
587 | CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" |
---|
588 | LIBS="$LIBS $AUDIOFILE_LIBS" |
---|
589 | dnl |
---|
590 | dnl Now check if the installed Audio File Library is sufficiently new. |
---|
591 | dnl (Also checks the sanity of the results of audiofile-config to some extent.) |
---|
592 | dnl |
---|
593 | rm -f conf.audiofiletest |
---|
594 | AC_TRY_RUN([ |
---|
595 | #include <stdio.h> |
---|
596 | #include <stdlib.h> |
---|
597 | #include <string.h> |
---|
598 | #include <audiofile.h> |
---|
599 | |
---|
600 | char* |
---|
601 | my_strdup (char *str) |
---|
602 | { |
---|
603 | char *new_str; |
---|
604 | |
---|
605 | if (str) |
---|
606 | { |
---|
607 | new_str = malloc ((strlen (str) + 1) * sizeof(char)); |
---|
608 | strcpy (new_str, str); |
---|
609 | } |
---|
610 | else |
---|
611 | new_str = NULL; |
---|
612 | |
---|
613 | return new_str; |
---|
614 | } |
---|
615 | |
---|
616 | int main () |
---|
617 | { |
---|
618 | int major, minor, micro; |
---|
619 | char *tmp_version; |
---|
620 | |
---|
621 | system ("touch conf.audiofiletest"); |
---|
622 | |
---|
623 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
---|
624 | tmp_version = my_strdup("$min_audiofile_version"); |
---|
625 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
---|
626 | printf("%s, bad version string\n", "$min_audiofile_version"); |
---|
627 | exit(1); |
---|
628 | } |
---|
629 | |
---|
630 | if (($audiofile_major_version > major) || |
---|
631 | (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) || |
---|
632 | (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro))) |
---|
633 | { |
---|
634 | return 0; |
---|
635 | } |
---|
636 | else |
---|
637 | { |
---|
638 | printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version); |
---|
639 | printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro); |
---|
640 | printf("*** best to upgrade to the required version.\n"); |
---|
641 | printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n"); |
---|
642 | printf("*** to point to the correct copy of audiofile-config, and remove the file\n"); |
---|
643 | printf("*** config.cache before re-running configure\n"); |
---|
644 | return 1; |
---|
645 | } |
---|
646 | } |
---|
647 | |
---|
648 | ],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
---|
649 | CFLAGS="$ac_save_CFLAGS" |
---|
650 | LIBS="$ac_save_LIBS" |
---|
651 | AC_LANG_RESTORE |
---|
652 | fi |
---|
653 | fi |
---|
654 | if test "x$no_audiofile" = x ; then |
---|
655 | AC_MSG_RESULT(yes) |
---|
656 | ifelse([$2], , :, [$2]) |
---|
657 | else |
---|
658 | AC_MSG_RESULT(no) |
---|
659 | if test "$AUDIOFILE_CONFIG" = "no" ; then |
---|
660 | cat <<END |
---|
661 | *** The audiofile-config script installed by the Audio File Library could |
---|
662 | *** not be found. If the Audio File Library was installed in PREFIX, make |
---|
663 | *** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG |
---|
664 | *** environment variable to the full path to audiofile-config. |
---|
665 | END |
---|
666 | else |
---|
667 | if test -f conf.audiofiletest ; then |
---|
668 | : |
---|
669 | else |
---|
670 | echo "*** Could not run Audio File Library test program; checking why..." |
---|
671 | AC_LANG_SAVE |
---|
672 | AC_LANG_C |
---|
673 | CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" |
---|
674 | LIBS="$LIBS $AUDIOFILE_LIBS" |
---|
675 | AC_TRY_LINK([ |
---|
676 | #include <stdio.h> |
---|
677 | #include <audiofile.h> |
---|
678 | ], [ return 0; ], |
---|
679 | [ cat <<END |
---|
680 | *** The test program compiled, but did not run. This usually means that |
---|
681 | *** the run-time linker is not finding Audio File Library or finding the |
---|
682 | *** wrong version of Audio File Library. |
---|
683 | *** |
---|
684 | *** If it is not finding Audio File Library, you'll need to set your |
---|
685 | *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point |
---|
686 | *** to the installed location. Also, make sure you have run ldconfig if |
---|
687 | *** that is required on your system. |
---|
688 | *** |
---|
689 | *** If you have an old version installed, it is best to remove it, although |
---|
690 | *** you may also be able to get things to work by modifying |
---|
691 | *** LD_LIBRARY_PATH. |
---|
692 | END |
---|
693 | ], |
---|
694 | [ echo "*** The test program failed to compile or link. See the file config.log" |
---|
695 | echo "*** for the exact error that occurred. This usually means the Audio File" |
---|
696 | echo "*** Library was incorrectly installed or that you have moved the Audio" |
---|
697 | echo "*** File Library since it was installed. In the latter case, you may want" |
---|
698 | echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG" ]) |
---|
699 | CFLAGS="$ac_save_CFLAGS" |
---|
700 | LIBS="$ac_save_LIBS" |
---|
701 | AC_LANG_RESTORE |
---|
702 | fi |
---|
703 | fi |
---|
704 | AUDIOFILE_CFLAGS="" |
---|
705 | AUDIOFILE_LIBS="" |
---|
706 | ifelse([$3], , :, [$3]) |
---|
707 | fi |
---|
708 | AC_SUBST(AUDIOFILE_CFLAGS) |
---|
709 | AC_SUBST(AUDIOFILE_LIBS) |
---|
710 | rm -f conf.audiofiletest |
---|
711 | ]) |
---|
712 | |
---|
713 | dnl ac_var_timeszone_externals.m4 |
---|
714 | |
---|
715 | # Define 'timezone', 'altzone' and 'daylight' |
---|
716 | # http://www.gnu.org/software/ac-archive/Miscellaneous/ac_var_timezone_externals.html |
---|
717 | # Use instead of 'AC_STRUCT_TIMEZONE' to determine whether the |
---|
718 | # the external timezone variables 'timezone', 'altzone' and 'daylight' exist, |
---|
719 | # defining 'HAVE_TIMEZONE', 'HAVE_ALTZONE' and 'HAVE_DAYLIGHT' respectively |
---|
720 | # (as well as gaining the macros defined by 'AC_STRUCT_TIMEZONE'). |
---|
721 | # Mark R.Bannister <markb@freedomware.co.uk> |
---|
722 | AC_DEFUN([AC_VAR_TIMEZONE_EXTERNALS], |
---|
723 | [ AC_REQUIRE([AC_STRUCT_TIMEZONE])dnl |
---|
724 | AC_CACHE_CHECK(for timezone external, mb_cv_var_timezone, |
---|
725 | [ AC_TRY_LINK([#include <time.h>], [return (int)timezone;], |
---|
726 | mb_cv_var_timezone=yes, |
---|
727 | mb_cv_var_timezone=no) |
---|
728 | ]) |
---|
729 | AC_CACHE_CHECK(for altzone external, mb_cv_var_altzone, |
---|
730 | [ AC_TRY_LINK([#include <time.h>], [return (int)altzone;], |
---|
731 | mb_cv_var_altzone=yes, |
---|
732 | mb_cv_var_altzone=no) |
---|
733 | ]) |
---|
734 | AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight, |
---|
735 | [ AC_TRY_LINK([#include <time.h>], [return (int)daylight;], |
---|
736 | mb_cv_var_daylight=yes, |
---|
737 | mb_cv_var_daylight=no) |
---|
738 | ]) |
---|
739 | if test $mb_cv_var_timezone = yes; then |
---|
740 | AC_DEFINE([HAVE_TIMEZONE], 1, |
---|
741 | [Define if you have the external 'timezone' variable.]) |
---|
742 | fi |
---|
743 | if test $mb_cv_var_altzone = yes; then |
---|
744 | AC_DEFINE([HAVE_ALTZONE], 1, |
---|
745 | [Define if you have the external 'altzone' variable.]) |
---|
746 | fi |
---|
747 | if test $mb_cv_var_daylight = yes; then |
---|
748 | AC_DEFINE([HAVE_DAYLIGHT], 1, |
---|
749 | [Define if you have the external 'daylight' variable.]) |
---|
750 | fi |
---|
751 | ]) |
---|
752 | |
---|
753 | dnl Available from the GNU Autoconf Macro Archive at: |
---|
754 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_perl_modules.html |
---|
755 | dnl |
---|
756 | AC_DEFUN([AC_PROG_PERL_MODULES],[dnl |
---|
757 | ac_perl_modules="$1" |
---|
758 | # Make sure we have perl |
---|
759 | if test -z "$PERL"; then |
---|
760 | AC_CHECK_PROG(PERL,perl,perl) |
---|
761 | fi |
---|
762 | |
---|
763 | if test "x$PERL" != x; then |
---|
764 | ac_perl_modules_failed=0 |
---|
765 | for ac_perl_module in $ac_perl_modules; do |
---|
766 | AC_MSG_CHECKING(for perl module $ac_perl_module) |
---|
767 | |
---|
768 | # Would be nice to log result here, but can't rely on autoconf internals |
---|
769 | $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1 |
---|
770 | if test $? -ne 0; then |
---|
771 | AC_MSG_RESULT(no); |
---|
772 | ac_perl_modules_failed=1 |
---|
773 | else |
---|
774 | AC_MSG_RESULT(ok); |
---|
775 | fi |
---|
776 | done |
---|
777 | |
---|
778 | # Run optional shell commands |
---|
779 | if test "$ac_perl_modules_failed" = 0; then |
---|
780 | : |
---|
781 | $2 |
---|
782 | else |
---|
783 | : |
---|
784 | $3 |
---|
785 | fi |
---|
786 | else |
---|
787 | AC_MSG_WARN(could not find perl) |
---|
788 | fi])dnl |
---|
789 | |
---|
790 | |
---|
791 | dnl This file scares me... |
---|
792 | # Check for binary relocation support |
---|
793 | # Hongli Lai |
---|
794 | # http://autopackage.org/ |
---|
795 | |
---|
796 | AC_DEFUN([AM_BINRELOC], |
---|
797 | [ |
---|
798 | AC_ARG_ENABLE(binreloc, |
---|
799 | [ --enable-binreloc compile with binary relocation support |
---|
800 | (default=enable when available)], |
---|
801 | enable_binreloc=$enableval,enable_binreloc=auto) |
---|
802 | |
---|
803 | BINRELOC_CFLAGS= |
---|
804 | BINRELOC_LIBS= |
---|
805 | if test "x$enable_binreloc" = "xauto"; then |
---|
806 | AC_CACHE_CHECK([whether everything is installed to the same prefix], |
---|
807 | [br_cv_valid_prefixes], [ |
---|
808 | if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \ |
---|
809 | "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \ |
---|
810 | "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc' |
---|
811 | then |
---|
812 | br_cv_valid_prefixes=yes |
---|
813 | else |
---|
814 | br_cv_valid_prefixes=no |
---|
815 | fi |
---|
816 | ]) |
---|
817 | fi |
---|
818 | AC_CACHE_CHECK([whether binary relocation support should be enabled], |
---|
819 | [br_cv_binreloc], |
---|
820 | [if test "x$enable_binreloc" = "xyes"; then |
---|
821 | br_cv_binreloc=yes |
---|
822 | elif test "x$enable_binreloc" = "xauto"; then |
---|
823 | if test "x$br_cv_valid_prefixes" = "xyes"; then |
---|
824 | br_cv_binreloc=yes |
---|
825 | else |
---|
826 | br_cv_binreloc=no |
---|
827 | fi |
---|
828 | else |
---|
829 | br_cv_binreloc=no |
---|
830 | fi]) |
---|
831 | |
---|
832 | if test "x$br_cv_binreloc" = "xyes"; then |
---|
833 | BINRELOC_CFLAGS="-DENABLE_BINRELOC" |
---|
834 | AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?]) |
---|
835 | fi |
---|
836 | AC_SUBST(BINRELOC_CFLAGS) |
---|
837 | AC_SUBST(BINRELOC_LIBS) |
---|
838 | ]) |
---|