source: trunk/third/gcc/libjava/acinclude.m4 @ 20089

Revision 20089, 9.5 KB checked in by zacheiss, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20088, which included commits to RCS files with non-trunk default branches.
Line 
1AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
2[changequote(<<, >>)dnl
3dnl The name to #define.
4define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
5dnl The cache variable name.
6define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
7changequote([, ])dnl
8AC_MSG_CHECKING(size of $1)
9AC_CACHE_VAL(AC_CV_NAME,
10[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
11  AC_TRY_COMPILE([#include "confdefs.h"
12#include <sys/types.h>
13$2
14], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
15  if test x$AC_CV_NAME != x ; then break; fi
16done
17])
18if test x$AC_CV_NAME = x ; then
19  AC_MSG_ERROR([cannot determine a size for $1])
20fi
21AC_MSG_RESULT($AC_CV_NAME)
22AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
23undefine([AC_TYPE_NAME])dnl
24undefine([AC_CV_NAME])dnl
25])
26
27AC_DEFUN(LIBGCJ_CONFIGURE,
28[
29dnl Default to --enable-multilib
30AC_ARG_ENABLE(multilib,
31[  --enable-multilib       build many library versions (default)],
32[case "${enableval}" in
33  yes) multilib=yes ;;
34  no)  multilib=no ;;
35  *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
36 esac], [multilib=yes])dnl
37
38dnl We may get other options which we don't document:
39dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
40
41# When building with srcdir == objdir, links to the source files will
42# be created in directories within the target_subdir.  We have to
43# adjust toplevel_srcdir accordingly, so that configure finds
44# install-sh and other auxiliary files that live in the top-level
45# source directory.
46if test "${srcdir}" = "."; then
47  if test -z "${with_target_subdir}"; then
48    toprel=".."
49  else
50    if test "${with_target_subdir}" != "."; then
51      toprel="${with_multisrctop}../.."
52    else
53      toprel="${with_multisrctop}.."
54    fi
55  fi
56else
57  toprel=".."
58fi
59
60libgcj_basedir=$srcdir/$toprel/$1/libjava
61AC_SUBST(libgcj_basedir)
62
63AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
64if :; then :; else
65  # This overrides the previous occurrence for automake, but not for
66  # autoconf, which is exactly what we want.
67  AC_CONFIG_AUX_DIR(..)
68fi
69
70# This works around an automake problem.
71mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
72AC_SUBST(mkinstalldirs)
73
74AC_CANONICAL_SYSTEM
75
76dnl This shouldn't be needed, as long as top-level dependencies are
77dnl defined correctly and shared-library paths are set up so that
78dnl execution tests succeed.  FIXME.
79define([AC_PROG_CC_WORKS],[])
80define([AC_PROG_CXX_WORKS],[])
81
82AC_PROG_CC
83
84# We use the libstdc++-v3 version of LIB_AC_PROG_CXX, but use
85# glibjava_CXX instead of glibcpp_CXX.  That's because we're passed a
86# different definition of CXX than other directories, since we don't
87# depend on libstdc++-v3 having already been built.
88AC_DEFUN(LIB_AC_PROG_CXX,
89[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
90dnl Fool anybody using AC_PROG_CXX.
91AC_PROVIDE([AC_PROG_CXX])
92# Use glibjava_CXX so that we do not cause CXX to be cached with the
93# flags that come in CXX while configuring libjava.  They're different
94# from those used for all other target libraries.  If CXX is set in
95# the environment, respect that here.
96glibjava_CXX=$CXX
97AC_CHECK_PROGS(glibjava_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
98AC_SUBST(CXX)
99CXX=$glibjava_CXX
100test -z "$glibjava_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
101
102AC_PROG_CXX_GNU
103
104if test $ac_cv_prog_gxx = yes; then
105  GXX=yes
106dnl Check whether -g works, even if CXXFLAGS is set, in case the package
107dnl plays around with CXXFLAGS (such as to build both debugging and
108dnl normal versions of a library), tasteless as that idea is.
109  ac_test_CXXFLAGS="${CXXFLAGS+set}"
110  ac_save_CXXFLAGS="$CXXFLAGS"
111  CXXFLAGS=
112  AC_PROG_CXX_G
113  if test "$ac_test_CXXFLAGS" = set; then
114    CXXFLAGS="$ac_save_CXXFLAGS"
115  elif test $ac_cv_prog_cxx_g = yes; then
116    CXXFLAGS="-g -O2"
117  else
118    CXXFLAGS="-O2"
119  fi
120else
121  GXX=
122  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
123fi
124])
125
126LIB_AC_PROG_CXX
127
128dnl version is pulled out to make it a bit easier to change using sed.
129version=0.0.7
130dnl Still use "libjava" here to placate dejagnu.
131AM_INIT_AUTOMAKE(libjava, $version)
132
133# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
134# run it explicitly here, it will be run implicitly before
135# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
136# be run before AC_CANONICAL_HOST.
137AC_CANONICAL_BUILD
138
139AC_CHECK_TOOL(AS, as)
140AC_CHECK_TOOL(AR, ar)
141AC_CHECK_TOOL(RANLIB, ranlib, :)
142
143AC_PROG_INSTALL
144
145AM_MAINTAINER_MODE
146
147AC_EXEEXT
148
149# configure.host sets the following important variables
150#       libgcj_cflags    - host specific C compiler flags
151#       libgcj_cxxflags  - host specific C++ compiler flags
152#       libgcj_javaflags - host specific Java compiler flags
153
154libgcj_cflags=
155libgcj_cxxflags=
156libgcj_javaflags=
157
158. [$]{srcdir}/configure.host
159
160LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
161LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
162LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
163AC_SUBST(LIBGCJ_CFLAGS)
164AC_SUBST(LIBGCJ_CXXFLAGS)
165AC_SUBST(LIBGCJ_JAVAFLAGS)
166])dnl
167
168sinclude(../libtool.m4)
169dnl The lines below arrange for aclocal not to bring libtool.m4
170dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
171dnl to add a definition of LIBTOOL to Makefile.in.
172ifelse(yes,no,[
173AC_DEFUN([AM_PROG_LIBTOOL],)
174AC_DEFUN([AC_LIBTOOL_DLOPEN],)
175AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
176AC_DEFUN([LT_AC_PROG_GCJ],)
177AC_SUBST(GCJ)
178AC_SUBST(LIBTOOL)
179])
180
181#serial AM2
182
183dnl From Bruno Haible.
184
185AC_DEFUN([AM_ICONV],
186[
187  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
188  dnl those with the standalone portable GNU libiconv installed).
189
190  am_cv_lib_iconv_ldpath=
191  AC_ARG_WITH([libiconv-prefix],
192[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
193    for dir in `echo "$withval" | tr : ' '`; do
194      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
195      if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
196    done
197   ])
198
199  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
200    am_cv_func_iconv="no, consider installing GNU libiconv"
201    am_cv_lib_iconv=no
202    AC_TRY_LINK([#include <stdlib.h>
203#include <iconv.h>],
204      [iconv_t cd = iconv_open("","");
205       iconv(cd,NULL,NULL,NULL,NULL);
206       iconv_close(cd);],
207      am_cv_func_iconv=yes)
208    if test "$am_cv_func_iconv" != yes; then
209      am_save_LIBS="$LIBS"
210      LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
211      AC_TRY_LINK([#include <stdlib.h>
212#include <iconv.h>],
213        [iconv_t cd = iconv_open("","");
214         iconv(cd,NULL,NULL,NULL,NULL);
215         iconv_close(cd);],
216        am_cv_lib_iconv=yes
217        am_cv_func_iconv=yes)
218      LIBS="$am_save_LIBS"
219    fi
220  ])
221  if test "$am_cv_func_iconv" = yes; then
222    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
223    AC_MSG_CHECKING([for iconv declaration])
224    AC_CACHE_VAL(am_cv_proto_iconv, [
225      AC_TRY_COMPILE([
226#include <stdlib.h>
227#include <iconv.h>
228extern
229#ifdef __cplusplus
230"C"
231#endif
232#if defined(__STDC__) || defined(__cplusplus)
233size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
234#else
235size_t iconv();
236#endif
237], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
238      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);"])
239    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
240    AC_MSG_RESULT([$]{ac_t:-
241         }[$]am_cv_proto_iconv)
242    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
243      [Define as const if the declaration of iconv() needs const.])
244  fi
245  LIBICONV=
246  if test "$am_cv_lib_iconv" = yes; then
247    LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
248  fi
249  AC_SUBST(LIBICONV)
250])
251
252# Check whether LC_MESSAGES is available in <locale.h>.
253# Ulrich Drepper <drepper@cygnus.com>, 1995.
254#
255# This file can be copied and used freely without restrictions.  It can
256# be used in projects which are not available under the GNU General Public
257# License or the GNU Library General Public License but which still want
258# to provide support for the GNU gettext functionality.
259# Please note that the actual code of the GNU gettext library is covered
260# by the GNU Library General Public License, and the rest of the GNU
261# gettext package package is covered by the GNU General Public License.
262# They are *not* in the public domain.
263
264# serial 2
265
266AC_DEFUN([AM_LC_MESSAGES],
267  [if test $ac_cv_header_locale_h = yes; then
268    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
269      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
270       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
271    if test $am_cv_val_LC_MESSAGES = yes; then
272      AC_DEFINE(HAVE_LC_MESSAGES, 1,
273        [Define if your <locale.h> file defines LC_MESSAGES.])
274    fi
275  fi])
276
277AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
278[
279AC_MSG_CHECKING(whether 'ld' is at least 2.13)
280LD_PROG=`$CC --print-prog-name=ld`
281LD_VERSION=`$LD_PROG --version`
282LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
283LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
284if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
285  LD_OK="ok"
286else
287  if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
288    LD_OK="ok"
289  fi
290fi
291if test "x$LD_OK" != x; then
292  AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
293else
294  AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
295  AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
296  AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
297            [Indicate that linker is not able to 8-byte align static data])
298fi[]dnl
299])# CHECK_FOR_BROKEN_MINGW_LD
Note: See TracBrowser for help on using the repository browser.