OSDN Git Service

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