OSDN Git Service

embedded updates
[pf3gnuchains/gcc-fork.git] / libjava / acinclude.m4
1 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
2 [changequote(<<, >>)dnl
3 dnl The name to #define.
4 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
5 dnl The cache variable name.
6 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
7 changequote([, ])dnl
8 AC_MSG_CHECKING(size of $1)
9 AC_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
16 done
17 ])
18 if test x$AC_CV_NAME = x ; then
19   AC_MSG_ERROR([cannot determine a size for $1])
20 fi
21 AC_MSG_RESULT($AC_CV_NAME)
22 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
23 undefine([AC_TYPE_NAME])dnl
24 undefine([AC_CV_NAME])dnl
25 ])
26
27 AC_DEFUN(LIBGCJ_CONFIGURE,
28 [
29 dnl Default to --enable-multilib
30 AC_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
38 dnl We may get other options which we don't document:
39 dnl --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.
46 if 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
56 else
57   toprel=".."
58 fi
59
60 libgcj_basedir=$srcdir/$toprel/$1/libjava
61 AC_SUBST(libgcj_basedir)
62
63 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
64 if :; 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(..)
68 fi
69
70 # This works around an automake problem.
71 mkinstalldirs="`cd $ac_aux_dir && pwd`/mkinstalldirs"
72 AC_SUBST(mkinstalldirs)
73
74 AC_CANONICAL_SYSTEM
75
76 dnl This shouldn't be needed, as long as top-level dependencies are
77 dnl defined correctly and shared-library paths are set up so that
78 dnl execution tests succeed.  FIXME.
79 define([AC_PROG_CC_WORKS],[])
80 define([AC_PROG_CXX_WORKS],[])
81
82 AC_PROG_CC
83 AC_PROG_CXX
84
85 dnl version is pulled out to make it a bit easier to change using sed.
86 version=0.0.7
87 dnl Still use "libjava" here to placate dejagnu.
88 AM_INIT_AUTOMAKE(libjava, $version)
89
90 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
91 # run it explicitly here, it will be run implicitly before
92 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
93 # be run before AC_CANONICAL_HOST.
94 AC_CANONICAL_BUILD
95
96 AC_CHECK_TOOL(AS, as)
97 AC_CHECK_TOOL(AR, ar)
98 AC_CHECK_TOOL(RANLIB, ranlib, :)
99
100 AC_PROG_INSTALL
101
102 AM_MAINTAINER_MODE
103
104 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
105 # at least currently, we never actually build a program, so we never
106 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
107 # fails, because we are probably configuring with a cross compiler
108 # which cant create executables.  So we include AC_EXEEXT to keep
109 # automake happy, but we don't execute it, since we don't care about
110 # the result.
111 if false; then
112   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
113   # to nothing, so nothing would remain between `then' and `fi' if it
114   # were not for the `:' below.
115   :
116   AC_EXEEXT
117 fi
118
119 # configure.host sets the following important variables
120 #       libgcj_cflags    - host specific C compiler flags
121 #       libgcj_cxxflags  - host specific C++ compiler flags
122 #       libgcj_javaflags - host specific Java compiler flags
123
124 libgcj_cflags=
125 libgcj_cxxflags=
126 libgcj_javaflags=
127
128 . [$]{srcdir}/configure.host
129
130 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
131 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
132 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
133 AC_SUBST(LIBGCJ_CFLAGS)
134 AC_SUBST(LIBGCJ_CXXFLAGS)
135 AC_SUBST(LIBGCJ_JAVAFLAGS)
136 ])dnl
137
138 sinclude(../libtool.m4)
139 dnl The lines below arrange for aclocal not to bring libtool.m4
140 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
141 dnl to add a definition of LIBTOOL to Makefile.in.
142 ifelse(yes,no,[
143 AC_DEFUN([AM_PROG_LIBTOOL],)
144 AC_DEFUN([AC_LIBTOOL_DLOPEN],)
145 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
146 AC_DEFUN([LT_AC_PROG_GCJ],)
147 AC_SUBST(GCJ)
148 AC_SUBST(LIBTOOL)
149 ])
150
151 #serial AM2
152
153 dnl From Bruno Haible.
154
155 AC_DEFUN([AM_ICONV],
156 [
157   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
158   dnl those with the standalone portable GNU libiconv installed).
159
160   am_cv_lib_iconv_ldpath=
161   AC_ARG_WITH([libiconv-prefix],
162 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
163     for dir in `echo "$withval" | tr : ' '`; do
164       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
165       if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
166     done
167    ])
168
169   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
170     am_cv_func_iconv="no, consider installing GNU libiconv"
171     am_cv_lib_iconv=no
172     AC_TRY_LINK([#include <stdlib.h>
173 #include <iconv.h>],
174       [iconv_t cd = iconv_open("","");
175        iconv(cd,NULL,NULL,NULL,NULL);
176        iconv_close(cd);],
177       am_cv_func_iconv=yes)
178     if test "$am_cv_func_iconv" != yes; then
179       am_save_LIBS="$LIBS"
180       LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
181       AC_TRY_LINK([#include <stdlib.h>
182 #include <iconv.h>],
183         [iconv_t cd = iconv_open("","");
184          iconv(cd,NULL,NULL,NULL,NULL);
185          iconv_close(cd);],
186         am_cv_lib_iconv=yes
187         am_cv_func_iconv=yes)
188       LIBS="$am_save_LIBS"
189     fi
190   ])
191   if test "$am_cv_func_iconv" = yes; then
192     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
193     AC_MSG_CHECKING([for iconv declaration])
194     AC_CACHE_VAL(am_cv_proto_iconv, [
195       AC_TRY_COMPILE([
196 #include <stdlib.h>
197 #include <iconv.h>
198 extern
199 #ifdef __cplusplus
200 "C"
201 #endif
202 #if defined(__STDC__) || defined(__cplusplus)
203 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
204 #else
205 size_t iconv();
206 #endif
207 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
208       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);"])
209     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
210     AC_MSG_RESULT([$]{ac_t:-
211          }[$]am_cv_proto_iconv)
212     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
213       [Define as const if the declaration of iconv() needs const.])
214   fi
215   LIBICONV=
216   if test "$am_cv_lib_iconv" = yes; then
217     LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
218   fi
219   AC_SUBST(LIBICONV)
220 ])
221
222 # Check whether LC_MESSAGES is available in <locale.h>.
223 # Ulrich Drepper <drepper@cygnus.com>, 1995.
224 #
225 # This file can be copied and used freely without restrictions.  It can
226 # be used in projects which are not available under the GNU General Public
227 # License or the GNU Library General Public License but which still want
228 # to provide support for the GNU gettext functionality.
229 # Please note that the actual code of the GNU gettext library is covered
230 # by the GNU Library General Public License, and the rest of the GNU
231 # gettext package package is covered by the GNU General Public License.
232 # They are *not* in the public domain.
233
234 # serial 2
235
236 AC_DEFUN([AM_LC_MESSAGES],
237   [if test $ac_cv_header_locale_h = yes; then
238     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
239       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
240        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
241     if test $am_cv_val_LC_MESSAGES = yes; then
242       AC_DEFINE(HAVE_LC_MESSAGES, 1,
243         [Define if your <locale.h> file defines LC_MESSAGES.])
244     fi
245   fi])