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(AS, as) |
---|
110 | AC_CHECK_TOOL(AR, ar) |
---|
111 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
---|
112 | |
---|
113 | AC_PROG_INSTALL |
---|
114 | |
---|
115 | AM_MAINTAINER_MODE |
---|
116 | |
---|
117 | AC_EXEEXT |
---|
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 | [AC_CHECK_HEADERS(locale.h) |
---|
238 | if test $ac_cv_header_locale_h = yes; then |
---|
239 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, |
---|
240 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], |
---|
241 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) |
---|
242 | if test $am_cv_val_LC_MESSAGES = yes; then |
---|
243 | AC_DEFINE(HAVE_LC_MESSAGES, 1, |
---|
244 | [Define if your <locale.h> file defines LC_MESSAGES.]) |
---|
245 | fi |
---|
246 | fi]) |
---|
247 | |
---|
248 | AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD], |
---|
249 | [ |
---|
250 | AC_MSG_CHECKING(whether 'ld' is at least 2.13) |
---|
251 | LD_PROG=`$CC --print-prog-name=ld` |
---|
252 | LD_VERSION=`$LD_PROG --version` |
---|
253 | LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4` |
---|
254 | LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2` |
---|
255 | if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then |
---|
256 | LD_OK="ok" |
---|
257 | else |
---|
258 | if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then |
---|
259 | LD_OK="ok" |
---|
260 | fi |
---|
261 | fi |
---|
262 | if test "x$LD_OK" != x; then |
---|
263 | AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR]) |
---|
264 | else |
---|
265 | AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR]) |
---|
266 | AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...]) |
---|
267 | AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1, |
---|
268 | [Indicate that linker is not able to 8-byte align static data]) |
---|
269 | fi[]dnl |
---|
270 | ])# CHECK_FOR_BROKEN_MINGW_LD |
---|
271 | |
---|
272 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) |
---|
273 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page |
---|
274 | dnl also defines GSTUFF_PKG_ERRORS on error |
---|
275 | AC_DEFUN(PKG_CHECK_MODULES, [ |
---|
276 | succeeded=no |
---|
277 | |
---|
278 | if test -z "$PKG_CONFIG"; then |
---|
279 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
280 | fi |
---|
281 | |
---|
282 | if test "$PKG_CONFIG" = "no" ; then |
---|
283 | echo "*** The pkg-config script could not be found. Make sure it is" |
---|
284 | echo "*** in your path, or set the PKG_CONFIG environment variable" |
---|
285 | echo "*** to the full path to pkg-config." |
---|
286 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." |
---|
287 | else |
---|
288 | PKG_CONFIG_MIN_VERSION=0.9.0 |
---|
289 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then |
---|
290 | AC_MSG_CHECKING(for $2) |
---|
291 | |
---|
292 | if $PKG_CONFIG --exists "$2" ; then |
---|
293 | AC_MSG_RESULT(yes) |
---|
294 | succeeded=yes |
---|
295 | |
---|
296 | AC_MSG_CHECKING($1_CFLAGS) |
---|
297 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` |
---|
298 | AC_MSG_RESULT($$1_CFLAGS) |
---|
299 | |
---|
300 | AC_MSG_CHECKING($1_LIBS) |
---|
301 | $1_LIBS=`$PKG_CONFIG --libs "$2"` |
---|
302 | AC_MSG_RESULT($$1_LIBS) |
---|
303 | else |
---|
304 | $1_CFLAGS="" |
---|
305 | $1_LIBS="" |
---|
306 | ## If we have a custom action on failure, don't print errors, but |
---|
307 | ## do set a variable so people can do so. |
---|
308 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` |
---|
309 | ifelse([$4], ,echo $$1_PKG_ERRORS,) |
---|
310 | fi |
---|
311 | |
---|
312 | AC_SUBST($1_CFLAGS) |
---|
313 | AC_SUBST($1_LIBS) |
---|
314 | else |
---|
315 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." |
---|
316 | echo "*** See http://www.freedesktop.org/software/pkgconfig" |
---|
317 | fi |
---|
318 | fi |
---|
319 | |
---|
320 | if test $succeeded = yes; then |
---|
321 | ifelse([$3], , :, [$3]) |
---|
322 | else |
---|
323 | 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]) |
---|
324 | fi |
---|
325 | ]) |
---|
326 | |
---|
327 | |
---|