OSDN Git Service

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