OSDN Git Service

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