]> git.ipfire.org Git - thirdparty/gcc.git/blob - libjava/acinclude.m4
fe0ab002212cf891403345f95fe01bd848275858
[thirdparty/gcc.git] / libjava / acinclude.m4
1 sinclude(../config/accross.m4)
2 sinclude(../config/acx.m4)
3 sinclude(../config/no-executables.m4)
4
5 sinclude(../libtool.m4)
6 dnl The lines below arrange for aclocal not to bring libtool.m4
7 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
8 dnl to add a definition of LIBTOOL to Makefile.in.
9 ifelse(yes,no,[
10 AC_DEFUN([AM_PROG_LIBTOOL],)
11 AC_DEFUN([AC_LIBTOOL_DLOPEN],)
12 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
13 AC_DEFUN([LT_AC_PROG_GCJ],)
14 AC_SUBST(GCJ)
15 AC_SUBST(LIBTOOL)
16 ])
17
18 #serial AM2
19
20 dnl From Bruno Haible.
21
22 AC_DEFUN([AM_ICONV],
23 [
24 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
25 dnl those with the standalone portable GNU libiconv installed).
26
27 am_cv_lib_iconv_ldpath=
28 AC_ARG_WITH([libiconv-prefix],
29 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
30 for dir in `echo "$withval" | tr : ' '`; do
31 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
32 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
33 done
34 ])
35
36 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
37 am_cv_func_iconv="no, consider installing GNU libiconv"
38 am_cv_lib_iconv=no
39 AC_TRY_LINK([#include <stdlib.h>
40 #include <iconv.h>],
41 [iconv_t cd = iconv_open("","");
42 iconv(cd,NULL,NULL,NULL,NULL);
43 iconv_close(cd);],
44 am_cv_func_iconv=yes)
45 if test "$am_cv_func_iconv" != yes; then
46 am_save_LIBS="$LIBS"
47 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
48 AC_TRY_LINK([#include <stdlib.h>
49 #include <iconv.h>],
50 [iconv_t cd = iconv_open("","");
51 iconv(cd,NULL,NULL,NULL,NULL);
52 iconv_close(cd);],
53 am_cv_lib_iconv=yes
54 am_cv_func_iconv=yes)
55 LIBS="$am_save_LIBS"
56 fi
57 ])
58 if test "$am_cv_func_iconv" = yes; then
59 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
60 AC_MSG_CHECKING([for iconv declaration])
61 AC_CACHE_VAL(am_cv_proto_iconv, [
62 AC_TRY_COMPILE([
63 #include <stdlib.h>
64 #include <iconv.h>
65 extern
66 #ifdef __cplusplus
67 "C"
68 #endif
69 #if defined(__STDC__) || defined(__cplusplus)
70 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
71 #else
72 size_t iconv();
73 #endif
74 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
75 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);"])
76 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
77 AC_MSG_RESULT([$]{ac_t:-
78 }[$]am_cv_proto_iconv)
79 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
80 [Define as const if the declaration of iconv() needs const.])
81 fi
82 LIBICONV=
83 if test "$am_cv_lib_iconv" = yes; then
84 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
85 fi
86 AC_SUBST(LIBICONV)
87 ])
88
89 # Check whether LC_MESSAGES is available in <locale.h>.
90 # Ulrich Drepper <drepper@cygnus.com>, 1995.
91 #
92 # This file can be copied and used freely without restrictions. It can
93 # be used in projects which are not available under the GNU General Public
94 # License or the GNU Library General Public License but which still want
95 # to provide support for the GNU gettext functionality.
96 # Please note that the actual code of the GNU gettext library is covered
97 # by the GNU Library General Public License, and the rest of the GNU
98 # gettext package package is covered by the GNU General Public License.
99 # They are *not* in the public domain.
100
101 # serial 2
102
103 AC_DEFUN([AM_LC_MESSAGES],
104 [AC_CHECK_HEADERS(locale.h)
105 if test $ac_cv_header_locale_h = yes; then
106 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
107 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
108 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
109 if test $am_cv_val_LC_MESSAGES = yes; then
110 AC_DEFINE(HAVE_LC_MESSAGES, 1,
111 [Define if your <locale.h> file defines LC_MESSAGES.])
112 fi
113 fi])
114
115 AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
116 [
117 AC_MSG_CHECKING(whether 'ld' is at least 2.13)
118 LD_PROG=`$CC --print-prog-name=ld`
119 LD_VERSION=`$LD_PROG --version`
120 LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
121 LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
122 if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
123 LD_OK="ok"
124 else
125 if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
126 LD_OK="ok"
127 fi
128 fi
129 if test "x$LD_OK" != x; then
130 AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
131 else
132 AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
133 AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
134 AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
135 [Indicate that linker is not able to 8-byte align static data])
136 fi[]dnl
137 ])# CHECK_FOR_BROKEN_MINGW_LD
138
139 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
140 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
141 dnl also defines GSTUFF_PKG_ERRORS on error
142 AC_DEFUN([PKG_CHECK_MODULES], [
143 succeeded=no
144
145 if test -z "$PKG_CONFIG"; then
146 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
147 fi
148
149 if test "$PKG_CONFIG" = "no" ; then
150 echo "*** The pkg-config script could not be found. Make sure it is"
151 echo "*** in your path, or set the PKG_CONFIG environment variable"
152 echo "*** to the full path to pkg-config."
153 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
154 else
155 PKG_CONFIG_MIN_VERSION=0.9.0
156 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
157 AC_MSG_CHECKING(for $2)
158
159 if $PKG_CONFIG --exists "$2" ; then
160 AC_MSG_RESULT(yes)
161 succeeded=yes
162
163 AC_MSG_CHECKING($1_CFLAGS)
164 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
165 AC_MSG_RESULT($$1_CFLAGS)
166
167 AC_MSG_CHECKING($1_LIBS)
168 $1_LIBS=`$PKG_CONFIG --libs "$2"`
169 AC_MSG_RESULT($$1_LIBS)
170 else
171 $1_CFLAGS=""
172 $1_LIBS=""
173 ## If we have a custom action on failure, don't print errors, but
174 ## do set a variable so people can do so.
175 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
176 ifelse([$4], ,echo $$1_PKG_ERRORS,)
177 fi
178
179 AC_SUBST($1_CFLAGS)
180 AC_SUBST($1_LIBS)
181 else
182 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
183 echo "*** See http://www.freedesktop.org/software/pkgconfig"
184 fi
185 fi
186
187 if test $succeeded = yes; then
188 ifelse([$3], , :, [$3])
189 else
190 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])
191 fi
192 ])
193
194