1f3d3ce99ea082f565a48947513e13186fb0771e
[gcc.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(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 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
285 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
286 dnl also defines GSTUFF_PKG_ERRORS on error
287 AC_DEFUN(PKG_CHECK_MODULES, [
288 succeeded=no
289
290 if test -z "$PKG_CONFIG"; then
291 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
292 fi
293
294 if test "$PKG_CONFIG" = "no" ; then
295 echo "*** The pkg-config script could not be found. Make sure it is"
296 echo "*** in your path, or set the PKG_CONFIG environment variable"
297 echo "*** to the full path to pkg-config."
298 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
299 else
300 PKG_CONFIG_MIN_VERSION=0.9.0
301 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
302 AC_MSG_CHECKING(for $2)
303
304 if $PKG_CONFIG --exists "$2" ; then
305 AC_MSG_RESULT(yes)
306 succeeded=yes
307
308 AC_MSG_CHECKING($1_CFLAGS)
309 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
310 AC_MSG_RESULT($$1_CFLAGS)
311
312 AC_MSG_CHECKING($1_LIBS)
313 $1_LIBS=`$PKG_CONFIG --libs "$2"`
314 AC_MSG_RESULT($$1_LIBS)
315 else
316 $1_CFLAGS=""
317 $1_LIBS=""
318 ## If we have a custom action on failure, don't print errors, but
319 ## do set a variable so people can do so.
320 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
321 ifelse([$4], ,echo $$1_PKG_ERRORS,)
322 fi
323
324 AC_SUBST($1_CFLAGS)
325 AC_SUBST($1_LIBS)
326 else
327 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
328 echo "*** See http://www.freedesktop.org/software/pkgconfig"
329 fi
330 fi
331
332 if test $succeeded = yes; then
333 ifelse([$3], , :, [$3])
334 else
335 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
336 fi
337 ])
338
339
340
341 # Do all the work for Automake. This macro actually does too much --
342 # some checks are only needed if your package does certain things.
343 # But this isn't really a big deal.
344
345 # serial 1
346
347 dnl Usage:
348 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
349
350 AC_DEFUN(AM_INIT_AUTOMAKE,
351 [AC_REQUIRE([AC_PROG_INSTALL])
352 PACKAGE=[$1]
353 AC_SUBST(PACKAGE)
354 VERSION=[$2]
355 AC_SUBST(VERSION)
356 dnl test to see if srcdir already configured
357 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
358 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
359 fi
360 ifelse([$3],,
361 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
362 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
363 AC_REQUIRE([AM_SANITY_CHECK])
364 AC_REQUIRE([AC_ARG_PROGRAM])
365 dnl FIXME This is truly gross.
366 missing_dir=`cd $ac_aux_dir && pwd`
367 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
368 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
369 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
370 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
371 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
372 AC_REQUIRE([AC_PROG_MAKE_SET])])
373
374 #
375 # Check to make sure that the build environment is sane.
376 #
377
378 AC_DEFUN(AM_SANITY_CHECK,
379 [AC_MSG_CHECKING([whether build environment is sane])
380 # Just in case
381 sleep 1
382 echo timestamp > conftestfile
383 # Do `set' in a subshell so we don't clobber the current shell's
384 # arguments. Must try -L first in case configure is actually a
385 # symlink; some systems play weird games with the mod time of symlinks
386 # (eg FreeBSD returns the mod time of the symlink's containing
387 # directory).
388 if (
389 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
390 if test "[$]*" = "X"; then
391 # -L didn't work.
392 set X `ls -t $srcdir/configure conftestfile`
393 fi
394 if test "[$]*" != "X $srcdir/configure conftestfile" \
395 && test "[$]*" != "X conftestfile $srcdir/configure"; then
396
397 # If neither matched, then we have a broken ls. This can happen
398 # if, for instance, CONFIG_SHELL is bash and it inherits a
399 # broken ls alias from the environment. This has actually
400 # happened. Such a system could not be considered "sane".
401 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
402 alias in your environment])
403 fi
404
405 test "[$]2" = conftestfile
406 )
407 then
408 # Ok.
409 :
410 else
411 AC_MSG_ERROR([newly created file is older than distributed files!
412 Check your system clock])
413 fi
414 rm -f conftest*
415 AC_MSG_RESULT(yes)])
416
417 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
418 dnl The program must properly implement --version.
419 AC_DEFUN(AM_MISSING_PROG,
420 [AC_MSG_CHECKING(for working $2)
421 # Run test in a subshell; some versions of sh will print an error if
422 # an executable is not found, even if stderr is redirected.
423 # Redirect stdin to placate older versions of autoconf. Sigh.
424 if ($2 --version) < /dev/null > /dev/null 2>&1; then
425 $1=$2
426 AC_MSG_RESULT(found)
427 else
428 $1="$3/missing $2"
429 AC_MSG_RESULT(missing)
430 fi
431 AC_SUBST($1)])
432
433 # Add --enable-maintainer-mode option to configure.
434 # From Jim Meyering
435
436 # serial 1
437
438 AC_DEFUN(AM_MAINTAINER_MODE,
439 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
440 dnl maintainer-mode is disabled by default
441 AC_ARG_ENABLE(maintainer-mode,
442 [ --enable-maintainer-mode enable make rules and dependencies not useful
443 (and sometimes confusing) to the casual installer],
444 USE_MAINTAINER_MODE=$enableval,
445 USE_MAINTAINER_MODE=no)
446 AC_MSG_RESULT($USE_MAINTAINER_MODE)
447 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
448 MAINT=$MAINTAINER_MODE_TRUE
449 AC_SUBST(MAINT)dnl
450 ]
451 )
452
453 # Define a conditional.
454
455 AC_DEFUN(AM_CONDITIONAL,
456 [AC_SUBST($1_TRUE)
457 AC_SUBST($1_FALSE)
458 if $2; then
459 $1_TRUE=
460 $1_FALSE='#'
461 else
462 $1_TRUE='#'
463 $1_FALSE=
464 fi])
465
466 # Like AC_CONFIG_HEADER, but automatically create stamp file.
467
468 AC_DEFUN(AM_CONFIG_HEADER,
469 [AC_PREREQ([2.12])
470 AC_CONFIG_HEADER([$1])
471 dnl When config.status generates a header, we must update the stamp-h file.
472 dnl This file resides in the same directory as the config header
473 dnl that is generated. We must strip everything past the first ":",
474 dnl and everything past the last "/".
475 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
476 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
477 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
478 <<am_indx=1
479 for am_file in <<$1>>; do
480 case " <<$>>CONFIG_HEADERS " in
481 *" <<$>>am_file "*<<)>>
482 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
483 ;;
484 esac
485 am_indx=`expr "<<$>>am_indx" + 1`
486 done<<>>dnl>>)
487 changequote([,]))])
488