]> git.saurik.com Git - wxWidgets.git/blame - aclocal.m4
added include needed for ProjectBuilder
[wxWidgets.git] / aclocal.m4
CommitLineData
8168de4c
VZ
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
b040e242
VS
13dnl ---------------------------------------------------------------------------
14dnl
15dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker,
16dnl Vadim Zeitlin and Ron Lee
17dnl
18dnl This script is under the wxWindows licence.
19dnl
20dnl Version: $Id$
21dnl ---------------------------------------------------------------------------
22
23dnl ===========================================================================
24dnl macros to find the a file in the list of include/lib paths
25dnl ===========================================================================
26
27dnl ---------------------------------------------------------------------------
28dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
29dnl to the full name of the file that was found or leaves it empty if not found
30dnl ---------------------------------------------------------------------------
31AC_DEFUN([WX_PATH_FIND_INCLUDES],
32[
33ac_find_includes=
34for ac_dir in $1;
35 do
36 if test -f "$ac_dir/$2"; then
37 ac_find_includes=$ac_dir
38 break
39 fi
40 done
41])
42
43dnl ---------------------------------------------------------------------------
44dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
45dnl to the full name of the file that was found or leaves it empty if not found
46dnl ---------------------------------------------------------------------------
47AC_DEFUN([WX_PATH_FIND_LIBRARIES],
48[
49ac_find_libraries=
50for ac_dir in $1;
51 do
52 for ac_extension in a so sl dylib; do
53 if test -f "$ac_dir/lib$2.$ac_extension"; then
54 ac_find_libraries=$ac_dir
55 break 2
56 fi
57 done
58 done
59])
60
61dnl ---------------------------------------------------------------------------
62dnl Path to include, already defined
63dnl ---------------------------------------------------------------------------
64AC_DEFUN([WX_INCLUDE_PATH_EXIST],
65[
66 ac_path_to_include=$1
67 echo "$2" | grep "\-I$1" > /dev/null
68 result=$?
69 if test $result = 0; then
70 ac_path_to_include=""
71 else
72 ac_path_to_include=" -I$1"
73 fi
74])
75
76dnl ---------------------------------------------------------------------------
77dnl Path to link, already defined
78dnl ---------------------------------------------------------------------------
79AC_DEFUN([WX_LINK_PATH_EXIST],
80[
81 echo "$2" | grep "\-L$1" > /dev/null
82 result=$?
83 if test $result = 0; then
84 ac_path_to_link=""
85 else
86 ac_path_to_link=" -L$1"
87 fi
88])
89
90dnl ===========================================================================
91dnl C++ features test
92dnl ===========================================================================
93
94dnl ---------------------------------------------------------------------------
95dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
96dnl or only the old <iostream.h> one - it may be generally assumed that if
97dnl <iostream> exists, the other "new" headers (without .h) exist too.
98dnl
99dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
100dnl ---------------------------------------------------------------------------
101
102AC_DEFUN([WX_CPP_NEW_HEADERS],
103[
104 if test "$cross_compiling" = "yes"; then
105 ifelse([$2], , :, [$2])
106 else
107 AC_LANG_SAVE
108 AC_LANG_CPLUSPLUS
109
110 AC_CHECK_HEADERS(iostream)
111
112 if test "$ac_cv_header_iostream" = "yes" ; then
113 ifelse([$1], , :, [$1])
114 else
115 ifelse([$2], , :, [$2])
116 fi
117
118 AC_LANG_RESTORE
119 fi
120])
121
122dnl ---------------------------------------------------------------------------
123dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
124dnl
125dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
126dnl ---------------------------------------------------------------------------
127
128AC_DEFUN([WX_CPP_BOOL],
129[
130 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
131 [
132 AC_LANG_SAVE
133 AC_LANG_CPLUSPLUS
134
135 AC_TRY_COMPILE(
136 [
137 ],
138 [
139 bool b = true;
140
141 return 0;
142 ],
143 [
144 wx_cv_cpp_bool=yes
145 ],
146 [
147 wx_cv_cpp_bool=no
148 ]
149 )
150
151 AC_LANG_RESTORE
152 ])
153
154 if test "$wx_cv_cpp_bool" = "yes"; then
155 AC_DEFINE(HAVE_BOOL)
156 fi
157])
158
159dnl ---------------------------------------------------------------------------
160dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
161dnl ---------------------------------------------------------------------------
162
163AC_DEFUN([WX_C_BIGENDIAN],
164[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
165[ac_cv_c_bigendian=unknown
166# See if sys/param.h defines the BYTE_ORDER macro.
167AC_TRY_COMPILE([#include <sys/types.h>
168#include <sys/param.h>], [
169#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
170 bogus endian macros
171#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
172AC_TRY_COMPILE([#include <sys/types.h>
173#include <sys/param.h>], [
174#if BYTE_ORDER != BIG_ENDIAN
175 not big endian
176#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
177if test $ac_cv_c_bigendian = unknown; then
178AC_TRY_RUN([main () {
179 /* Are we little or big endian? From Harbison&Steele. */
180 union
181 {
182 long l;
183 char c[sizeof (long)];
184 } u;
185 u.l = 1;
186 exit (u.c[sizeof (long) - 1] == 1);
187}], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
188fi])
189if test $ac_cv_c_bigendian = unknown; then
190 AC_MSG_WARN([Assuming little-endian target machine - this may be overriden by adding the line "ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}" to config.cache file])
191fi
192if test $ac_cv_c_bigendian = yes; then
193 AC_DEFINE(WORDS_BIGENDIAN)
194fi
195])
196
197dnl ---------------------------------------------------------------------------
198dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
199dnl ---------------------------------------------------------------------------
200
201AC_DEFUN([WX_ARG_CACHE_INIT],
202 [
203 wx_arg_cache_file="configarg.cache"
204 echo "loading argument cache $wx_arg_cache_file"
205 rm -f ${wx_arg_cache_file}.tmp
206 touch ${wx_arg_cache_file}.tmp
207 touch ${wx_arg_cache_file}
208 ])
209
210AC_DEFUN([WX_ARG_CACHE_FLUSH],
211 [
212 echo "saving argument cache $wx_arg_cache_file"
213 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
214 ])
215
216dnl this macro checks for a three-valued command line --with argument:
217dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
218dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
219AC_DEFUN([WX_ARG_SYS_WITH],
220 [
221 AC_MSG_CHECKING([for --with-$1])
222 no_cache=0
223 AC_ARG_WITH($1, [$2],
224 [
225 if test "$withval" = yes; then
226 ac_cv_use_$1='$3=yes'
227 elif test "$withval" = no; then
228 ac_cv_use_$1='$3=no'
229 elif test "$withval" = sys; then
230 ac_cv_use_$1='$3=sys'
231 elif test "$withval" = builtin; then
232 ac_cv_use_$1='$3=builtin'
233 else
234 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
235 fi
236 ],
237 [
238 LINE=`grep "$3" ${wx_arg_cache_file}`
239 if test "x$LINE" != x ; then
240 eval "DEFAULT_$LINE"
241 else
242 no_cache=1
243 fi
244
245 ac_cv_use_$1='$3='$DEFAULT_$3
246 ])
247
248 eval "$ac_cv_use_$1"
249 if test "$no_cache" != 1; then
250 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
251 fi
252
253 if test "$$3" = yes; then
254 AC_MSG_RESULT(yes)
255 elif test "$$3" = no; then
256 AC_MSG_RESULT(no)
257 elif test "$$3" = sys; then
258 AC_MSG_RESULT([system version])
259 elif test "$$3" = builtin; then
260 AC_MSG_RESULT([builtin version])
261 else
262 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
263 fi
264 ])
265
266dnl this macro checks for a command line argument and caches the result
267dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
268AC_DEFUN([WX_ARG_WITH],
269 [
270 AC_MSG_CHECKING([for --with-$1])
271 no_cache=0
272 AC_ARG_WITH($1, [$2],
273 [
274 if test "$withval" = yes; then
275 ac_cv_use_$1='$3=yes'
276 else
277 ac_cv_use_$1='$3=no'
278 fi
279 ],
280 [
281 LINE=`grep "$3" ${wx_arg_cache_file}`
282 if test "x$LINE" != x ; then
283 eval "DEFAULT_$LINE"
284 else
285 no_cache=1
286 fi
287
288 ac_cv_use_$1='$3='$DEFAULT_$3
289 ])
290
291 eval "$ac_cv_use_$1"
292 if test "$no_cache" != 1; then
293 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
294 fi
295
296 if test "$$3" = yes; then
297 AC_MSG_RESULT(yes)
298 else
299 AC_MSG_RESULT(no)
300 fi
301 ])
302
303dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
304dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
305AC_DEFUN([WX_ARG_ENABLE],
306 [
307 AC_MSG_CHECKING([for --enable-$1])
308 no_cache=0
309 AC_ARG_ENABLE($1, [$2],
310 [
311 if test "$enableval" = yes; then
312 ac_cv_use_$1='$3=yes'
313 else
314 ac_cv_use_$1='$3=no'
315 fi
316 ],
317 [
318 LINE=`grep "$3" ${wx_arg_cache_file}`
319 if test "x$LINE" != x ; then
320 eval "DEFAULT_$LINE"
321 else
322 no_cache=1
323 fi
324
325 ac_cv_use_$1='$3='$DEFAULT_$3
326 ])
327
328 eval "$ac_cv_use_$1"
329 if test "$no_cache" != 1; then
330 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
331 fi
332
333 if test "$$3" = yes; then
334 AC_MSG_RESULT(yes)
335 else
336 AC_MSG_RESULT(no)
337 fi
338 ])
339
340
341
342dnl ===========================================================================
343dnl "3rd party" macros included here because they are not widely available
344dnl ===========================================================================
345
346
347dnl ---------------------------------------------------------------------------
348dnl test for availability of iconv()
349dnl ---------------------------------------------------------------------------
350
b040e242
VS
351dnl From Bruno Haible.
352
353AC_DEFUN([AM_ICONV],
354[
355 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
356 dnl those with the standalone portable GNU libiconv installed).
357
358 AC_ARG_WITH([libiconv-prefix],
359[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
360 for dir in `echo "$withval" | tr : ' '`; do
361 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
362 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
363 done
364 ])
365
366 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
367 am_cv_func_iconv="no, consider installing GNU libiconv"
368 am_cv_lib_iconv=no
369 AC_TRY_LINK([#include <stdlib.h>
370#include <iconv.h>],
371 [iconv_t cd = iconv_open("","");
372 iconv(cd,NULL,NULL,NULL,NULL);
373 iconv_close(cd);],
374 am_cv_func_iconv=yes)
375 if test "$am_cv_func_iconv" != yes; then
376 am_save_LIBS="$LIBS"
377 LIBS="$LIBS -liconv"
378 AC_TRY_LINK([#include <stdlib.h>
379#include <iconv.h>],
380 [iconv_t cd = iconv_open("","");
381 iconv(cd,NULL,NULL,NULL,NULL);
382 iconv_close(cd);],
383 am_cv_lib_iconv=yes
384 am_cv_func_iconv=yes)
385 LIBS="$am_save_LIBS"
386 fi
387 ])
388 if test "$am_cv_func_iconv" = yes; then
389 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
b7043674 390 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
b040e242
VS
391 AC_TRY_COMPILE([
392#include <stdlib.h>
393#include <iconv.h>
394extern
395#ifdef __cplusplus
396"C"
397#endif
398#if defined(__STDC__) || defined(__cplusplus)
399size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
400#else
401size_t iconv();
402#endif
b7043674
VZ
403 ],
404 [],
405 wx_cv_func_iconv_const="no",
406 wx_cv_func_iconv_const="yes"
407 )
408 )
409
410 iconv_const=
1c405bb5 411 if test "x$wx_cv_func_iconv_const" = "xyes"; then
b7043674
VZ
412 iconv_const="const"
413 fi
414
415 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
b040e242
VS
416 [Define as const if the declaration of iconv() needs const.])
417 fi
418 LIBICONV=
419 if test "$am_cv_lib_iconv" = yes; then
420 LIBICONV="-liconv"
421 fi
422 AC_SUBST(LIBICONV)
423])
424
425
426dnl ---------------------------------------------------------------------------
427dnl test for GTK+ 2.0
428dnl ---------------------------------------------------------------------------
429
430dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
3f345b47
VZ
431dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
432dnl
b040e242
VS
433AC_DEFUN(AM_PATH_GTK_2_0,
434[dnl
435dnl Get the cflags and libraries from the gtk-config-2.0 script
3f345b47
VZ
436dnl
437AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
438 gtk_config_prefix="$withval", gtk_config_prefix="")
439AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
440 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
441AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
b040e242 442 , enable_gtktest=yes)
3f345b47
VZ
443
444 for module in . $4
445 do
446 case "$module" in
b040e242 447 gthread)
3f345b47
VZ
448 gtk_config_args="$gtk_config_args gthread"
449 ;;
450 esac
451 done
452
8168de4c
VZ
453 if test x$gtk_config_exec_prefix != x ; then
454 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
b040e242
VS
455 if test x${GTK_CONFIG_2_0+set} != xset ; then
456 GTK_CONFIG_2_0=$gtk_config_exec_prefix/bin/gtk-config-2.0
8168de4c
VZ
457 fi
458 fi
459 if test x$gtk_config_prefix != x ; then
460 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
b040e242
VS
461 if test x${GTK_CONFIG_2_0+set} != xset ; then
462 GTK_CONFIG_2_0=$gtk_config_prefix/bin/gtk-config-2.0
8168de4c
VZ
463 fi
464 fi
465
b040e242
VS
466 AC_PATH_PROG(GTK_CONFIG_2_0, gtk-config-2.0, no)
467 min_gtk_version=ifelse([$1], ,1.3.1,$1)
8168de4c
VZ
468 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
469 no_gtk=""
b040e242 470 if test "$GTK_CONFIG_2_0" = "no" ; then
3f345b47
VZ
471 no_gtk=yes
472 else
b040e242
VS
473 GTK_CFLAGS=`$GTK_CONFIG_2_0 $gtk_config_args --cflags`
474 GTK_LIBS=`$GTK_CONFIG_2_0 $gtk_config_args --libs`
475 gtk_config_major_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
3f345b47 476 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
b040e242 477 gtk_config_minor_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
3f345b47 478 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
b040e242 479 gtk_config_micro_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
3f345b47
VZ
480 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
481 if test "x$enable_gtktest" = "xyes" ; then
482 ac_save_CFLAGS="$CFLAGS"
483 ac_save_LIBS="$LIBS"
484 CFLAGS="$CFLAGS $GTK_CFLAGS"
485 LIBS="$GTK_LIBS $LIBS"
8168de4c
VZ
486dnl
487dnl Now check if the installed GTK is sufficiently new. (Also sanity
b040e242 488dnl checks the results of gtk-config-2.0 to some extent
8168de4c 489dnl
3f345b47
VZ
490 rm -f conf.gtktest
491 AC_TRY_RUN([
8168de4c 492#include <gtk/gtk.h>
8168de4c
VZ
493#include <stdio.h>
494#include <stdlib.h>
495
b040e242 496int
8168de4c
VZ
497main ()
498{
499 int major, minor, micro;
3f345b47 500 char *tmp_version;
8168de4c 501
3f345b47 502 system ("touch conf.gtktest");
8168de4c 503
3f345b47
VZ
504 /* HP/UX 9 (%@#!) writes to sscanf strings */
505 tmp_version = g_strdup("$min_gtk_version");
506 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
507 printf("%s, bad version string\n", "$min_gtk_version");
8168de4c
VZ
508 exit(1);
509 }
510
3f345b47
VZ
511 if ((gtk_major_version != $gtk_config_major_version) ||
512 (gtk_minor_version != $gtk_config_minor_version) ||
513 (gtk_micro_version != $gtk_config_micro_version))
514 {
b040e242 515 printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
3f345b47
VZ
516 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
517 gtk_major_version, gtk_minor_version, gtk_micro_version);
b040e242 518 printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n");
3f345b47
VZ
519 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
520 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
521 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
522 printf("*** required on your system.\n");
b040e242
VS
523 printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n");
524 printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n");
3f345b47 525 printf("*** before re-running configure\n");
b040e242 526 }
3f345b47
VZ
527#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
528 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
b040e242 529 (gtk_minor_version != GTK_MINOR_VERSION) ||
3f345b47
VZ
530 (gtk_micro_version != GTK_MICRO_VERSION))
531 {
532 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
b040e242 533 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
3f345b47 534 printf("*** library (version %d.%d.%d)\n",
b040e242 535 gtk_major_version, gtk_minor_version, gtk_micro_version);
3f345b47
VZ
536 }
537#endif /* defined (GTK_MAJOR_VERSION) ... */
538 else
539 {
540 if ((gtk_major_version > major) ||
541 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
542 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
543 {
544 return 0;
545 }
546 else
547 {
548 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
549 gtk_major_version, gtk_minor_version, gtk_micro_version);
550 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
b040e242 551 major, minor, micro);
3f345b47
VZ
552 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
553 printf("***\n");
554 printf("*** If you have already installed a sufficiently new version, this error\n");
b040e242 555 printf("*** probably means that the wrong copy of the gtk-config-2.0 shell script is\n");
3f345b47 556 printf("*** being found. The easiest way to fix this is to remove the old version\n");
b040e242
VS
557 printf("*** of GTK+, but you can also set the GTK_CONFIG_2_0 environment to point to the\n");
558 printf("*** correct copy of gtk-config-2.0. (In this case, you will have to\n");
3f345b47
VZ
559 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
560 printf("*** so that the correct libraries are found at run-time))\n");
561 }
562 }
563 return 1;
8168de4c
VZ
564}
565],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
3f345b47
VZ
566 CFLAGS="$ac_save_CFLAGS"
567 LIBS="$ac_save_LIBS"
568 fi
8168de4c
VZ
569 fi
570 if test "x$no_gtk" = x ; then
b040e242
VS
571 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
572 ifelse([$2], , :, [$2])
8168de4c
VZ
573 else
574 AC_MSG_RESULT(no)
b040e242
VS
575 if test "$GTK_CONFIG_2_0" = "no" ; then
576 echo "*** The gtk-config-2.0 script installed by GTK could not be found"
3f345b47 577 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
b040e242
VS
578 echo "*** your path, or set the GTK_CONFIG_2_0 environment variable to the"
579 echo "*** full path to gtk-config-2.0."
3f345b47
VZ
580 else
581 if test -f conf.gtktest ; then
582 :
583 else
584 echo "*** Could not run GTK test program, checking why..."
585 CFLAGS="$CFLAGS $GTK_CFLAGS"
586 LIBS="$LIBS $GTK_LIBS"
587 AC_TRY_LINK([
588#include <gtk/gtk.h>
589#include <stdio.h>
590], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
591 [ echo "*** The test program compiled, but did not run. This usually means"
592 echo "*** that the run-time linker is not finding GTK or finding the wrong"
593 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
594 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
595 echo "*** to the installed location Also, make sure you have run ldconfig if that"
596 echo "*** is required on your system"
b040e242 597 echo "***"
3f345b47
VZ
598 echo "*** If you have an old version installed, it is best to remove it, although"
599 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
600 echo "***"
601 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
602 echo "*** came with the system with the command"
603 echo "***"
604 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
605 [ echo "*** The test program failed to compile or link. See the file config.log for the"
606 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
607 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
b040e242 608 echo "*** may want to edit the gtk-config-2.0 script: $GTK_CONFIG_2_0" ])
3f345b47
VZ
609 CFLAGS="$ac_save_CFLAGS"
610 LIBS="$ac_save_LIBS"
611 fi
612 fi
8168de4c
VZ
613 GTK_CFLAGS=""
614 GTK_LIBS=""
615 ifelse([$3], , :, [$3])
616 fi
617 AC_SUBST(GTK_CFLAGS)
618 AC_SUBST(GTK_LIBS)
3f345b47 619 rm -f conf.gtktest
8168de4c
VZ
620])
621
b040e242
VS
622# Configure paths for GTK+
623# Owen Taylor 97-11-3
624
625dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
ecc7ceee
OK
626dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
627dnl
b040e242
VS
628AC_DEFUN(AM_PATH_GTK,
629[dnl
630dnl Get the cflags and libraries from the gtk-config script
ecc7ceee
OK
631dnl
632AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
633 gtk_config_prefix="$withval", gtk_config_prefix="")
634AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
635 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
636AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
b040e242 637 , enable_gtktest=yes)
ecc7ceee
OK
638
639 for module in . $4
640 do
641 case "$module" in
b040e242 642 gthread)
ecc7ceee
OK
643 gtk_config_args="$gtk_config_args gthread"
644 ;;
645 esac
646 done
647
648 if test x$gtk_config_exec_prefix != x ; then
649 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
b040e242
VS
650 if test x${GTK_CONFIG+set} != xset ; then
651 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
ecc7ceee
OK
652 fi
653 fi
654 if test x$gtk_config_prefix != x ; then
655 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
b040e242
VS
656 if test x${GTK_CONFIG+set} != xset ; then
657 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
ecc7ceee
OK
658 fi
659 fi
660
b040e242
VS
661 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
662 min_gtk_version=ifelse([$1], ,0.99.7,$1)
ecc7ceee
OK
663 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
664 no_gtk=""
b040e242 665 if test "$GTK_CONFIG" = "no" ; then
ecc7ceee
OK
666 no_gtk=yes
667 else
b040e242
VS
668 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
669 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
670 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 671 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
b040e242 672 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 673 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
b040e242 674 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee
OK
675 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
676 if test "x$enable_gtktest" = "xyes" ; then
677 ac_save_CFLAGS="$CFLAGS"
678 ac_save_LIBS="$LIBS"
679 CFLAGS="$CFLAGS $GTK_CFLAGS"
680 LIBS="$GTK_LIBS $LIBS"
681dnl
682dnl Now check if the installed GTK is sufficiently new. (Also sanity
b040e242 683dnl checks the results of gtk-config to some extent
ecc7ceee
OK
684dnl
685 rm -f conf.gtktest
686 AC_TRY_RUN([
687#include <gtk/gtk.h>
688#include <stdio.h>
689#include <stdlib.h>
690
b040e242 691int
ecc7ceee
OK
692main ()
693{
694 int major, minor, micro;
695 char *tmp_version;
696
697 system ("touch conf.gtktest");
698
699 /* HP/UX 9 (%@#!) writes to sscanf strings */
700 tmp_version = g_strdup("$min_gtk_version");
701 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
702 printf("%s, bad version string\n", "$min_gtk_version");
703 exit(1);
704 }
705
706 if ((gtk_major_version != $gtk_config_major_version) ||
707 (gtk_minor_version != $gtk_config_minor_version) ||
708 (gtk_micro_version != $gtk_config_micro_version))
709 {
b040e242 710 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
ecc7ceee
OK
711 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
712 gtk_major_version, gtk_minor_version, gtk_micro_version);
b040e242 713 printf ("*** was found! If gtk-config was correct, then it is best\n");
ecc7ceee
OK
714 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
715 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
716 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
717 printf("*** required on your system.\n");
b040e242
VS
718 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
719 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
ecc7ceee 720 printf("*** before re-running configure\n");
b040e242 721 }
ecc7ceee
OK
722#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
723 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
b040e242 724 (gtk_minor_version != GTK_MINOR_VERSION) ||
ecc7ceee
OK
725 (gtk_micro_version != GTK_MICRO_VERSION))
726 {
727 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
b040e242 728 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
ecc7ceee 729 printf("*** library (version %d.%d.%d)\n",
b040e242 730 gtk_major_version, gtk_minor_version, gtk_micro_version);
ecc7ceee
OK
731 }
732#endif /* defined (GTK_MAJOR_VERSION) ... */
733 else
734 {
735 if ((gtk_major_version > major) ||
736 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
737 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
738 {
739 return 0;
740 }
741 else
742 {
743 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
744 gtk_major_version, gtk_minor_version, gtk_micro_version);
745 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
b040e242 746 major, minor, micro);
ecc7ceee
OK
747 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
748 printf("***\n");
749 printf("*** If you have already installed a sufficiently new version, this error\n");
b040e242 750 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
ecc7ceee 751 printf("*** being found. The easiest way to fix this is to remove the old version\n");
b040e242
VS
752 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
753 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
ecc7ceee
OK
754 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
755 printf("*** so that the correct libraries are found at run-time))\n");
756 }
757 }
758 return 1;
759}
760],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
761 CFLAGS="$ac_save_CFLAGS"
762 LIBS="$ac_save_LIBS"
763 fi
764 fi
765 if test "x$no_gtk" = x ; then
b040e242
VS
766 AC_MSG_RESULT(yes)
767 ifelse([$2], , :, [$2])
ecc7ceee
OK
768 else
769 AC_MSG_RESULT(no)
b040e242
VS
770 if test "$GTK_CONFIG" = "no" ; then
771 echo "*** The gtk-config script installed by GTK could not be found"
ecc7ceee 772 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
b040e242
VS
773 echo "*** your path, or set the GTK_CONFIG environment variable to the"
774 echo "*** full path to gtk-config."
ecc7ceee
OK
775 else
776 if test -f conf.gtktest ; then
777 :
778 else
779 echo "*** Could not run GTK test program, checking why..."
780 CFLAGS="$CFLAGS $GTK_CFLAGS"
781 LIBS="$LIBS $GTK_LIBS"
782 AC_TRY_LINK([
783#include <gtk/gtk.h>
784#include <stdio.h>
785], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
786 [ echo "*** The test program compiled, but did not run. This usually means"
787 echo "*** that the run-time linker is not finding GTK or finding the wrong"
788 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
789 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
790 echo "*** to the installed location Also, make sure you have run ldconfig if that"
791 echo "*** is required on your system"
b040e242 792 echo "***"
ecc7ceee
OK
793 echo "*** If you have an old version installed, it is best to remove it, although"
794 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
795 echo "***"
796 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
797 echo "*** came with the system with the command"
798 echo "***"
799 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
800 [ echo "*** The test program failed to compile or link. See the file config.log for the"
801 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
802 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
b040e242 803 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
ecc7ceee
OK
804 CFLAGS="$ac_save_CFLAGS"
805 LIBS="$ac_save_LIBS"
806 fi
807 fi
808 GTK_CFLAGS=""
809 GTK_LIBS=""
810 ifelse([$3], , :, [$3])
811 fi
812 AC_SUBST(GTK_CFLAGS)
813 AC_SUBST(GTK_LIBS)
814 rm -f conf.gtktest
815])
8168de4c 816