OSDN Git Service

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