OSDN Git Service

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