OSDN Git Service

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