OSDN Git Service

* java/awt/Window.java (Window(Window,GraphicsConfiguration)):
[pf3gnuchains/gcc-fork.git] / libjava / 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 sinclude(../config/accross.m4)
14
15 AC_DEFUN(LIBGCJ_CONFIGURE,
16 [
17 dnl Default to --enable-multilib
18 AC_ARG_ENABLE(multilib,
19 [  --enable-multilib       build many library versions (default)],
20 [case "${enableval}" in
21   yes) multilib=yes ;;
22   no)  multilib=no ;;
23   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
24  esac], [multilib=yes])dnl
25
26 dnl We may get other options which we don't document:
27 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
28
29 # When building with srcdir == objdir, links to the source files will
30 # be created in directories within the target_subdir.  We have to
31 # adjust toplevel_srcdir accordingly, so that configure finds
32 # install-sh and other auxiliary files that live in the top-level
33 # source directory.
34 if test "${srcdir}" = "."; then
35   if test -z "${with_target_subdir}"; then
36     toprel=".."
37   else
38     if test "${with_target_subdir}" != "."; then
39       toprel="${with_multisrctop}../.."
40     else
41       toprel="${with_multisrctop}.."
42     fi
43   fi
44 else
45   toprel=".."
46 fi
47
48 libgcj_basedir=$srcdir/$toprel/$1/libjava
49 AC_SUBST(libgcj_basedir)
50
51 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
52 if :; then :; else
53   # This overrides the previous occurrence for automake, but not for
54   # autoconf, which is exactly what we want.
55   AC_CONFIG_AUX_DIR(..)
56 fi
57
58 # This works around an automake problem.
59 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
60 AC_SUBST(mkinstalldirs)
61
62 AC_CANONICAL_SYSTEM
63
64 dnl This shouldn't be needed, as long as top-level dependencies are
65 dnl defined correctly and shared-library paths are set up so that
66 dnl execution tests succeed.  FIXME.
67 define([AC_PROG_CC_WORKS],[])
68 define([AC_PROG_CXX_WORKS],[])
69
70 AC_PROG_CC
71
72 # We use the libstdc++-v3 version of LIB_AC_PROG_CXX, but use
73 # glibjava_CXX instead of glibcpp_CXX.  That's because we're passed a
74 # different definition of CXX than other directories, since we don't
75 # depend on libstdc++-v3 having already been built.
76 AC_DEFUN(LIB_AC_PROG_CXX,
77 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
78 dnl Fool anybody using AC_PROG_CXX.
79 AC_PROVIDE([AC_PROG_CXX])
80 # Use glibjava_CXX so that we do not cause CXX to be cached with the
81 # flags that come in CXX while configuring libjava.  They're different
82 # from those used for all other target libraries.  If CXX is set in
83 # the environment, respect that here.
84 glibjava_CXX=$CXX
85 AC_CHECK_PROGS(glibjava_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
86 AC_SUBST(CXX)
87 CXX=$glibjava_CXX
88 test -z "$glibjava_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
89
90 AC_PROG_CXX_GNU
91
92 if test $ac_cv_prog_gxx = yes; then
93   GXX=yes
94 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
95 dnl plays around with CXXFLAGS (such as to build both debugging and
96 dnl normal versions of a library), tasteless as that idea is.
97   ac_test_CXXFLAGS="${CXXFLAGS+set}"
98   ac_save_CXXFLAGS="$CXXFLAGS"
99   CXXFLAGS=
100   AC_PROG_CXX_G
101   if test "$ac_test_CXXFLAGS" = set; then
102     CXXFLAGS="$ac_save_CXXFLAGS"
103   elif test $ac_cv_prog_cxx_g = yes; then
104     CXXFLAGS="-g -O2"
105   else
106     CXXFLAGS="-O2"
107   fi
108 else
109   GXX=
110   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
111 fi
112 ])
113
114 LIB_AC_PROG_CXX
115
116 dnl version is pulled out to make it a bit easier to change using sed.
117 version=0.0.7
118 dnl Still use "libjava" here to placate dejagnu.
119 AM_INIT_AUTOMAKE(libjava, $version)
120
121 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
122 # run it explicitly here, it will be run implicitly before
123 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
124 # be run before AC_CANONICAL_HOST.
125 AC_CANONICAL_BUILD
126
127 AC_CHECK_TOOL(AS, as)
128 AC_CHECK_TOOL(AR, ar)
129 AC_CHECK_TOOL(RANLIB, ranlib, :)
130
131 AC_PROG_INSTALL
132
133 AM_MAINTAINER_MODE
134
135 AC_EXEEXT
136
137 # configure.host sets the following important variables
138 #       libgcj_cflags    - host specific C compiler flags
139 #       libgcj_cxxflags  - host specific C++ compiler flags
140 #       libgcj_javaflags - host specific Java compiler flags
141
142 libgcj_cflags=
143 libgcj_cxxflags=
144 libgcj_javaflags=
145
146 . [$]{srcdir}/configure.host
147
148 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
149 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
150 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
151 AC_SUBST(LIBGCJ_CFLAGS)
152 AC_SUBST(LIBGCJ_CXXFLAGS)
153 AC_SUBST(LIBGCJ_JAVAFLAGS)
154 ])dnl
155
156 sinclude(../libtool.m4)
157 dnl The lines below arrange for aclocal not to bring libtool.m4
158 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
159 dnl to add a definition of LIBTOOL to Makefile.in.
160 ifelse(yes,no,[
161 AC_DEFUN([AM_PROG_LIBTOOL],)
162 AC_DEFUN([AC_LIBTOOL_DLOPEN],)
163 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
164 AC_DEFUN([LT_AC_PROG_GCJ],)
165 AC_SUBST(GCJ)
166 AC_SUBST(LIBTOOL)
167 ])
168
169 #serial AM2
170
171 dnl From Bruno Haible.
172
173 AC_DEFUN([AM_ICONV],
174 [
175   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
176   dnl those with the standalone portable GNU libiconv installed).
177
178   am_cv_lib_iconv_ldpath=
179   AC_ARG_WITH([libiconv-prefix],
180 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
181     for dir in `echo "$withval" | tr : ' '`; do
182       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
183       if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
184     done
185    ])
186
187   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
188     am_cv_func_iconv="no, consider installing GNU libiconv"
189     am_cv_lib_iconv=no
190     AC_TRY_LINK([#include <stdlib.h>
191 #include <iconv.h>],
192       [iconv_t cd = iconv_open("","");
193        iconv(cd,NULL,NULL,NULL,NULL);
194        iconv_close(cd);],
195       am_cv_func_iconv=yes)
196     if test "$am_cv_func_iconv" != yes; then
197       am_save_LIBS="$LIBS"
198       LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
199       AC_TRY_LINK([#include <stdlib.h>
200 #include <iconv.h>],
201         [iconv_t cd = iconv_open("","");
202          iconv(cd,NULL,NULL,NULL,NULL);
203          iconv_close(cd);],
204         am_cv_lib_iconv=yes
205         am_cv_func_iconv=yes)
206       LIBS="$am_save_LIBS"
207     fi
208   ])
209   if test "$am_cv_func_iconv" = yes; then
210     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
211     AC_MSG_CHECKING([for iconv declaration])
212     AC_CACHE_VAL(am_cv_proto_iconv, [
213       AC_TRY_COMPILE([
214 #include <stdlib.h>
215 #include <iconv.h>
216 extern
217 #ifdef __cplusplus
218 "C"
219 #endif
220 #if defined(__STDC__) || defined(__cplusplus)
221 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
222 #else
223 size_t iconv();
224 #endif
225 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
226       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
227     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
228     AC_MSG_RESULT([$]{ac_t:-
229          }[$]am_cv_proto_iconv)
230     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
231       [Define as const if the declaration of iconv() needs const.])
232   fi
233   LIBICONV=
234   if test "$am_cv_lib_iconv" = yes; then
235     LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
236   fi
237   AC_SUBST(LIBICONV)
238 ])
239
240 # Check whether LC_MESSAGES is available in <locale.h>.
241 # Ulrich Drepper <drepper@cygnus.com>, 1995.
242 #
243 # This file can be copied and used freely without restrictions.  It can
244 # be used in projects which are not available under the GNU General Public
245 # License or the GNU Library General Public License but which still want
246 # to provide support for the GNU gettext functionality.
247 # Please note that the actual code of the GNU gettext library is covered
248 # by the GNU Library General Public License, and the rest of the GNU
249 # gettext package package is covered by the GNU General Public License.
250 # They are *not* in the public domain.
251
252 # serial 2
253
254 AC_DEFUN([AM_LC_MESSAGES],
255   [if test $ac_cv_header_locale_h = yes; then
256     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
257       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
258        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
259     if test $am_cv_val_LC_MESSAGES = yes; then
260       AC_DEFINE(HAVE_LC_MESSAGES, 1,
261         [Define if your <locale.h> file defines LC_MESSAGES.])
262     fi
263   fi])
264
265 # Do all the work for Automake.  This macro actually does too much --
266 # some checks are only needed if your package does certain things.
267 # But this isn't really a big deal.
268
269 # serial 1
270
271 dnl Usage:
272 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
273
274 AC_DEFUN(AM_INIT_AUTOMAKE,
275 [AC_REQUIRE([AC_PROG_INSTALL])
276 PACKAGE=[$1]
277 AC_SUBST(PACKAGE)
278 VERSION=[$2]
279 AC_SUBST(VERSION)
280 dnl test to see if srcdir already configured
281 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
282   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
283 fi
284 ifelse([$3],,
285 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
286 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
287 AC_REQUIRE([AM_SANITY_CHECK])
288 AC_REQUIRE([AC_ARG_PROGRAM])
289 dnl FIXME This is truly gross.
290 missing_dir=`cd $ac_aux_dir && pwd`
291 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
292 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
293 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
294 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
295 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
296 AC_REQUIRE([AC_PROG_MAKE_SET])])
297
298 #
299 # Check to make sure that the build environment is sane.
300 #
301
302 AC_DEFUN(AM_SANITY_CHECK,
303 [AC_MSG_CHECKING([whether build environment is sane])
304 # Just in case
305 sleep 1
306 echo timestamp > conftestfile
307 # Do `set' in a subshell so we don't clobber the current shell's
308 # arguments.  Must try -L first in case configure is actually a
309 # symlink; some systems play weird games with the mod time of symlinks
310 # (eg FreeBSD returns the mod time of the symlink's containing
311 # directory).
312 if (
313    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
314    if test "[$]*" = "X"; then
315       # -L didn't work.
316       set X `ls -t $srcdir/configure conftestfile`
317    fi
318    if test "[$]*" != "X $srcdir/configure conftestfile" \
319       && test "[$]*" != "X conftestfile $srcdir/configure"; then
320
321       # If neither matched, then we have a broken ls.  This can happen
322       # if, for instance, CONFIG_SHELL is bash and it inherits a
323       # broken ls alias from the environment.  This has actually
324       # happened.  Such a system could not be considered "sane".
325       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
326 alias in your environment])
327    fi
328
329    test "[$]2" = conftestfile
330    )
331 then
332    # Ok.
333    :
334 else
335    AC_MSG_ERROR([newly created file is older than distributed files!
336 Check your system clock])
337 fi
338 rm -f conftest*
339 AC_MSG_RESULT(yes)])
340
341 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
342 dnl The program must properly implement --version.
343 AC_DEFUN(AM_MISSING_PROG,
344 [AC_MSG_CHECKING(for working $2)
345 # Run test in a subshell; some versions of sh will print an error if
346 # an executable is not found, even if stderr is redirected.
347 # Redirect stdin to placate older versions of autoconf.  Sigh.
348 if ($2 --version) < /dev/null > /dev/null 2>&1; then
349    $1=$2
350    AC_MSG_RESULT(found)
351 else
352    $1="$3/missing $2"
353    AC_MSG_RESULT(missing)
354 fi
355 AC_SUBST($1)])
356
357 # Add --enable-maintainer-mode option to configure.
358 # From Jim Meyering
359
360 # serial 1
361
362 AC_DEFUN(AM_MAINTAINER_MODE,
363 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
364   dnl maintainer-mode is disabled by default
365   AC_ARG_ENABLE(maintainer-mode,
366 [  --enable-maintainer-mode enable make rules and dependencies not useful
367                           (and sometimes confusing) to the casual installer],
368       USE_MAINTAINER_MODE=$enableval,
369       USE_MAINTAINER_MODE=no)
370   AC_MSG_RESULT($USE_MAINTAINER_MODE)
371   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
372   MAINT=$MAINTAINER_MODE_TRUE
373   AC_SUBST(MAINT)dnl
374 ]
375 )
376
377 # Define a conditional.
378
379 AC_DEFUN(AM_CONDITIONAL,
380 [AC_SUBST($1_TRUE)
381 AC_SUBST($1_FALSE)
382 if $2; then
383   $1_TRUE=
384   $1_FALSE='#'
385 else
386   $1_TRUE='#'
387   $1_FALSE=
388 fi])
389
390 # Like AC_CONFIG_HEADER, but automatically create stamp file.
391
392 AC_DEFUN(AM_CONFIG_HEADER,
393 [AC_PREREQ([2.12])
394 AC_CONFIG_HEADER([$1])
395 dnl When config.status generates a header, we must update the stamp-h file.
396 dnl This file resides in the same directory as the config header
397 dnl that is generated.  We must strip everything past the first ":",
398 dnl and everything past the last "/".
399 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
400 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
401 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
402 <<am_indx=1
403 for am_file in <<$1>>; do
404   case " <<$>>CONFIG_HEADERS " in
405   *" <<$>>am_file "*<<)>>
406     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
407     ;;
408   esac
409   am_indx=`expr "<<$>>am_indx" + 1`
410 done<<>>dnl>>)
411 changequote([,]))])
412
413 # Configure paths for GTK+
414 # Owen Taylor     97-11-3
415
416 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
417 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
418 dnl
419 AC_DEFUN(AM_PATH_GTK,
420 [dnl 
421 dnl Get the cflags and libraries from the gtk-config script
422 dnl
423 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
424             gtk_config_prefix="$withval", gtk_config_prefix="")
425 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
426             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
427 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
428                     , enable_gtktest=yes)
429
430   for module in . $4
431   do
432       case "$module" in
433          gthread) 
434              gtk_config_args="$gtk_config_args gthread"
435          ;;
436       esac
437   done
438
439   if test x$gtk_config_exec_prefix != x ; then
440      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
441      if test x${GTK_CONFIG+set} != xset ; then
442         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
443      fi
444   fi
445   if test x$gtk_config_prefix != x ; then
446      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
447      if test x${GTK_CONFIG+set} != xset ; then
448         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
449      fi
450   fi
451
452   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
453   min_gtk_version=ifelse([$1], ,0.99.7,$1)
454   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
455   no_gtk=""
456   if test "$GTK_CONFIG" = "no" ; then
457     no_gtk=yes
458   else
459     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
460     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
461     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
462            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
463     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
464            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
465     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
466            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
467     if test "x$enable_gtktest" = "xyes" ; then
468       ac_save_CFLAGS="$CFLAGS"
469       ac_save_LIBS="$LIBS"
470       CFLAGS="$CFLAGS $GTK_CFLAGS"
471       LIBS="$GTK_LIBS $LIBS"
472 dnl
473 dnl Now check if the installed GTK is sufficiently new. (Also sanity
474 dnl checks the results of gtk-config to some extent
475 dnl
476       rm -f conf.gtktest
477       AC_TRY_RUN([
478 #include <gtk/gtk.h>
479 #include <stdio.h>
480 #include <stdlib.h>
481
482 int 
483 main ()
484 {
485   int major, minor, micro;
486   char *tmp_version;
487
488   system ("touch conf.gtktest");
489
490   /* HP/UX 9 (%@#!) writes to sscanf strings */
491   tmp_version = g_strdup("$min_gtk_version");
492   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
493      printf("%s, bad version string\n", "$min_gtk_version");
494      exit(1);
495    }
496
497   if ((gtk_major_version != $gtk_config_major_version) ||
498       (gtk_minor_version != $gtk_config_minor_version) ||
499       (gtk_micro_version != $gtk_config_micro_version))
500     {
501       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
502              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
503              gtk_major_version, gtk_minor_version, gtk_micro_version);
504       printf ("*** was found! If gtk-config was correct, then it is best\n");
505       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
506       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
507       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
508       printf("*** required on your system.\n");
509       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
510       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
511       printf("*** before re-running configure\n");
512     } 
513 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
514   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
515            (gtk_minor_version != GTK_MINOR_VERSION) ||
516            (gtk_micro_version != GTK_MICRO_VERSION))
517     {
518       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
519              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
520       printf("*** library (version %d.%d.%d)\n",
521              gtk_major_version, gtk_minor_version, gtk_micro_version);
522     }
523 #endif /* defined (GTK_MAJOR_VERSION) ... */
524   else
525     {
526       if ((gtk_major_version > major) ||
527         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
528         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
529       {
530         return 0;
531        }
532      else
533       {
534         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
535                gtk_major_version, gtk_minor_version, gtk_micro_version);
536         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
537                major, minor, micro);
538         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
539         printf("***\n");
540         printf("*** If you have already installed a sufficiently new version, this error\n");
541         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
542         printf("*** being found. The easiest way to fix this is to remove the old version\n");
543         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
544         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
545         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
546         printf("*** so that the correct libraries are found at run-time))\n");
547       }
548     }
549   return 1;
550 }
551 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
552        CFLAGS="$ac_save_CFLAGS"
553        LIBS="$ac_save_LIBS"
554      fi
555   fi
556   if test "x$no_gtk" = x ; then
557      AC_MSG_RESULT(yes)
558      ifelse([$2], , :, [$2])     
559   else
560      AC_MSG_RESULT(no)
561      if test "$GTK_CONFIG" = "no" ; then
562        echo "*** The gtk-config script installed by GTK could not be found"
563        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
564        echo "*** your path, or set the GTK_CONFIG environment variable to the"
565        echo "*** full path to gtk-config."
566      else
567        if test -f conf.gtktest ; then
568         :
569        else
570           echo "*** Could not run GTK test program, checking why..."
571           CFLAGS="$CFLAGS $GTK_CFLAGS"
572           LIBS="$LIBS $GTK_LIBS"
573           AC_TRY_LINK([
574 #include <gtk/gtk.h>
575 #include <stdio.h>
576 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
577         [ echo "*** The test program compiled, but did not run. This usually means"
578           echo "*** that the run-time linker is not finding GTK or finding the wrong"
579           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
580           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
581           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
582           echo "*** is required on your system"
583           echo "***"
584           echo "*** If you have an old version installed, it is best to remove it, although"
585           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
586           echo "***"
587           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
588           echo "*** came with the system with the command"
589           echo "***"
590           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
591         [ echo "*** The test program failed to compile or link. See the file config.log for the"
592           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
593           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
594           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
595           CFLAGS="$ac_save_CFLAGS"
596           LIBS="$ac_save_LIBS"
597        fi
598      fi
599      GTK_CFLAGS=""
600      GTK_LIBS=""
601      ifelse([$3], , :, [$3])
602   fi
603   AC_SUBST(GTK_CFLAGS)
604   AC_SUBST(GTK_LIBS)
605   rm -f conf.gtktest
606 ])
607
608 # Configure paths for GLIB
609 # Owen Taylor     97-11-3
610
611 dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
612 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or 
613 dnl gthread is specified in MODULES, pass to glib-config
614 dnl
615 AC_DEFUN(AM_PATH_GLIB,
616 [dnl 
617 dnl Get the cflags and libraries from the glib-config script
618 dnl
619 AC_ARG_WITH(glib-prefix,[  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)],
620             glib_config_prefix="$withval", glib_config_prefix="")
621 AC_ARG_WITH(glib-exec-prefix,[  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
622             glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
623 AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
624                     , enable_glibtest=yes)
625
626   if test x$glib_config_exec_prefix != x ; then
627      glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
628      if test x${GLIB_CONFIG+set} != xset ; then
629         GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
630      fi
631   fi
632   if test x$glib_config_prefix != x ; then
633      glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
634      if test x${GLIB_CONFIG+set} != xset ; then
635         GLIB_CONFIG=$glib_config_prefix/bin/glib-config
636      fi
637   fi
638
639   for module in . $4
640   do
641       case "$module" in
642          gmodule) 
643              glib_config_args="$glib_config_args gmodule"
644          ;;
645          gthread) 
646              glib_config_args="$glib_config_args gthread"
647          ;;
648       esac
649   done
650
651   AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
652   min_glib_version=ifelse([$1], ,0.99.7,$1)
653   AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
654   no_glib=""
655   if test "$GLIB_CONFIG" = "no" ; then
656     no_glib=yes
657   else
658     GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
659     GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
660     glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
661            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
662     glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
663            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
664     glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
665            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
666     if test "x$enable_glibtest" = "xyes" ; then
667       ac_save_CFLAGS="$CFLAGS"
668       ac_save_LIBS="$LIBS"
669       CFLAGS="$CFLAGS $GLIB_CFLAGS"
670       LIBS="$GLIB_LIBS $LIBS"
671 dnl
672 dnl Now check if the installed GLIB is sufficiently new. (Also sanity
673 dnl checks the results of glib-config to some extent
674 dnl
675       rm -f conf.glibtest
676       AC_TRY_RUN([
677 #include <glib.h>
678 #include <stdio.h>
679 #include <stdlib.h>
680
681 int 
682 main ()
683 {
684   int major, minor, micro;
685   char *tmp_version;
686
687   system ("touch conf.glibtest");
688
689   /* HP/UX 9 (%@#!) writes to sscanf strings */
690   tmp_version = g_strdup("$min_glib_version");
691   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
692      printf("%s, bad version string\n", "$min_glib_version");
693      exit(1);
694    }
695
696   if ((glib_major_version != $glib_config_major_version) ||
697       (glib_minor_version != $glib_config_minor_version) ||
698       (glib_micro_version != $glib_config_micro_version))
699     {
700       printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
701              $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
702              glib_major_version, glib_minor_version, glib_micro_version);
703       printf ("*** was found! If glib-config was correct, then it is best\n");
704       printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
705       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
706       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
707       printf("*** required on your system.\n");
708       printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
709       printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
710       printf("*** before re-running configure\n");
711     } 
712   else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
713            (glib_minor_version != GLIB_MINOR_VERSION) ||
714            (glib_micro_version != GLIB_MICRO_VERSION))
715     {
716       printf("*** GLIB header files (version %d.%d.%d) do not match\n",
717              GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
718       printf("*** library (version %d.%d.%d)\n",
719              glib_major_version, glib_minor_version, glib_micro_version);
720     }
721   else
722     {
723       if ((glib_major_version > major) ||
724         ((glib_major_version == major) && (glib_minor_version > minor)) ||
725         ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
726       {
727         return 0;
728        }
729      else
730       {
731         printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
732                glib_major_version, glib_minor_version, glib_micro_version);
733         printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
734                major, minor, micro);
735         printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
736         printf("***\n");
737         printf("*** If you have already installed a sufficiently new version, this error\n");
738         printf("*** probably means that the wrong copy of the glib-config shell script is\n");
739         printf("*** being found. The easiest way to fix this is to remove the old version\n");
740         printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
741         printf("*** correct copy of glib-config. (In this case, you will have to\n");
742         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
743         printf("*** so that the correct libraries are found at run-time))\n");
744       }
745     }
746   return 1;
747 }
748 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
749        CFLAGS="$ac_save_CFLAGS"
750        LIBS="$ac_save_LIBS"
751      fi
752   fi
753   if test "x$no_glib" = x ; then
754      AC_MSG_RESULT(yes)
755      ifelse([$2], , :, [$2])     
756   else
757      AC_MSG_RESULT(no)
758      if test "$GLIB_CONFIG" = "no" ; then
759        echo "*** The glib-config script installed by GLIB could not be found"
760        echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
761        echo "*** your path, or set the GLIB_CONFIG environment variable to the"
762        echo "*** full path to glib-config."
763      else
764        if test -f conf.glibtest ; then
765         :
766        else
767           echo "*** Could not run GLIB test program, checking why..."
768           CFLAGS="$CFLAGS $GLIB_CFLAGS"
769           LIBS="$LIBS $GLIB_LIBS"
770           AC_TRY_LINK([
771 #include <glib.h>
772 #include <stdio.h>
773 ],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
774         [ echo "*** The test program compiled, but did not run. This usually means"
775           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
776           echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
777           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
778           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
779           echo "*** is required on your system"
780           echo "***"
781           echo "*** If you have an old version installed, it is best to remove it, although"
782           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
783           echo "***"
784           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
785           echo "*** came with the system with the command"
786           echo "***"
787           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
788         [ echo "*** The test program failed to compile or link. See the file config.log for the"
789           echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
790           echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
791           echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
792           CFLAGS="$ac_save_CFLAGS"
793           LIBS="$ac_save_LIBS"
794        fi
795      fi
796      GLIB_CFLAGS=""
797      GLIB_LIBS=""
798      ifelse([$3], , :, [$3])
799   fi
800   AC_SUBST(GLIB_CFLAGS)
801   AC_SUBST(GLIB_LIBS)
802   rm -f conf.glibtest
803 ])
804
805 # Configure paths for LIBART
806 # Raph Levien 98-11-18
807 # stolen from Manish Singh    98-9-30
808 # stolen back from Frank Belew
809 # stolen from Manish Singh
810 # Shamelessly stolen from Owen Taylor
811
812 dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
813 dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
814 dnl
815 AC_DEFUN(AM_PATH_LIBART,
816 [dnl 
817 dnl Get the cflags and libraries from the libart-config script
818 dnl
819 AC_ARG_WITH(libart-prefix,[  --with-libart-prefix=PFX   Prefix where LIBART is installed (optional)],
820             libart_prefix="$withval", libart_prefix="")
821 AC_ARG_WITH(libart-exec-prefix,[  --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
822             libart_exec_prefix="$withval", libart_exec_prefix="")
823 AC_ARG_ENABLE(libarttest, [  --disable-libarttest       Do not try to compile and run a test LIBART program],
824                     , enable_libarttest=yes)
825
826   if test x$libart_exec_prefix != x ; then
827      libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
828      if test x${LIBART_CONFIG+set} != xset ; then
829         LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
830      fi
831   fi
832   if test x$libart_prefix != x ; then
833      libart_args="$libart_args --prefix=$libart_prefix"
834      if test x${LIBART_CONFIG+set} != xset ; then
835         LIBART_CONFIG=$libart_prefix/bin/libart-config
836      fi
837   fi
838
839   AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
840   min_libart_version=ifelse([$1], ,0.2.5,$1)
841   AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
842   no_libart=""
843   if test "$LIBART_CONFIG" = "no" ; then
844     no_libart=yes
845   else
846     LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
847     LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
848
849     libart_major_version=`$LIBART_CONFIG $libart_args --version | \
850            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
851     libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
852            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
853     libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
854            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
855     if test "x$enable_libarttest" = "xyes" ; then
856       ac_save_CFLAGS="$CFLAGS"
857       ac_save_LIBS="$LIBS"
858       CFLAGS="$CFLAGS $LIBART_CFLAGS"
859       LIBS="$LIBS $LIBART_LIBS"
860 dnl
861 dnl Now check if the installed LIBART is sufficiently new. (Also sanity
862 dnl checks the results of libart-config to some extent
863 dnl
864       rm -f conf.libarttest
865       AC_TRY_RUN([
866 #include <stdio.h>
867 #include <stdlib.h>
868 #include <string.h>
869 #include <libart_lgpl/libart.h>
870
871 char*
872 my_strdup (char *str)
873 {
874   char *new_str;
875   
876   if (str)
877     {
878       new_str = malloc ((strlen (str) + 1) * sizeof(char));
879       strcpy (new_str, str);
880     }
881   else
882     new_str = NULL;
883   
884   return new_str;
885 }
886
887 int main ()
888 {
889   int major, minor, micro;
890   char *tmp_version;
891
892   system ("touch conf.libarttest");
893
894   /* HP/UX 9 (%@#!) writes to sscanf strings */
895   tmp_version = my_strdup("$min_libart_version");
896   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
897      printf("%s, bad version string\n", "$min_libart_version");
898      exit(1);
899    }
900
901    if (($libart_major_version > major) ||
902       (($libart_major_version == major) && ($libart_minor_version > minor)) ||
903       (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
904     {
905       return 0;
906     }
907   else
908     {
909       printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
910       printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
911       printf("*** best to upgrade to the required version.\n");
912       printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
913       printf("*** to point to the correct copy of libart-config, and remove the file\n");
914       printf("*** config.cache before re-running configure\n");
915       return 1;
916     }
917 }
918
919 ],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
920        CFLAGS="$ac_save_CFLAGS"
921        LIBS="$ac_save_LIBS"
922      fi
923   fi
924   if test "x$no_libart" = x ; then
925      AC_MSG_RESULT(yes)
926      ifelse([$2], , :, [$2])     
927   else
928      AC_MSG_RESULT(no)
929      if test "$LIBART_CONFIG" = "no" ; then
930        echo "*** The libart-config script installed by LIBART could not be found"
931        echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
932        echo "*** your path, or set the LIBART_CONFIG environment variable to the"
933        echo "*** full path to libart-config."
934      else
935        if test -f conf.libarttest ; then
936         :
937        else
938           echo "*** Could not run LIBART test program, checking why..."
939           CFLAGS="$CFLAGS $LIBART_CFLAGS"
940           LIBS="$LIBS $LIBART_LIBS"
941           AC_TRY_LINK([
942 #include <stdio.h>
943 #include <libart_lgpl/libart.h>
944 ],      [ return 0; ],
945         [ echo "*** The test program compiled, but did not run. This usually means"
946           echo "*** that the run-time linker is not finding LIBART or finding the wrong"
947           echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
948           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
949           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
950           echo "*** is required on your system"
951           echo "***"
952           echo "*** If you have an old version installed, it is best to remove it, although"
953           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
954         [ echo "*** The test program failed to compile or link. See the file config.log for the"
955           echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
956           echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
957           echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
958           CFLAGS="$ac_save_CFLAGS"
959           LIBS="$ac_save_LIBS"
960        fi
961      fi
962      LIBART_CFLAGS=""
963      LIBART_LIBS=""
964      ifelse([$3], , :, [$3])
965   fi
966   AC_SUBST(LIBART_CFLAGS)
967   AC_SUBST(LIBART_LIBS)
968   rm -f conf.libarttest
969 ])
970