OSDN Git Service

* c-decl.c (build_enumerator): Don't modify the value's type,
[pf3gnuchains/gcc-fork.git] / libjava / acinclude.m4
1 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
2 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
3 # are probably using a cross compiler, which will not be able to fully
4 # link an executable.  This should really be fixed in autoconf
5 # itself.
6
7 AC_DEFUN(LIBGCJ_CONFIGURE,
8 [
9 dnl Default to --enable-multilib
10 AC_ARG_ENABLE(multilib,
11 [  --enable-multilib       build many library versions (default)],
12 [case "${enableval}" in
13   yes) multilib=yes ;;
14   no)  multilib=no ;;
15   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
16  esac], [multilib=yes])dnl
17
18 dnl We may get other options which we dont document:
19 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
20
21 if test "[$]{srcdir}" = "."; then
22   if test "[$]{with_target_subdir}" != "."; then
23     libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
24   else
25     libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
26   fi
27 else
28   libgcj_basedir="[$]{srcdir}/$1"
29 fi
30 AC_SUBST(libgcj_basedir)
31
32 AC_CANONICAL_HOST
33
34 dnl version is pulled out to make it a bit easier to change using sed.
35 version=0.0.7
36 dnl Still use "libjava" here to placate dejagnu.
37 AM_INIT_AUTOMAKE(libjava, $version)
38
39 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
40 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
41 # are probably using a cross compiler, which will not be able to fully
42 # link an executable.  This should really be fixed in autoconf
43 # itself.
44
45 AC_DEFUN(LIB_AC_PROG_CC,
46 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
47 dnl Fool anybody using AC_PROG_CC.
48 AC_PROVIDE([AC_PROG_CC])
49 AC_CHECK_PROG(CC, gcc, gcc)
50 if test -z "$CC"; then
51   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
52   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
53 fi
54
55 AC_PROG_CC_GNU
56
57 if test $ac_cv_prog_gcc = yes; then
58   GCC=yes
59 dnl Check whether -g works, even if CFLAGS is set, in case the package
60 dnl plays around with CFLAGS (such as to build both debugging and
61 dnl normal versions of a library), tasteless as that idea is.
62   ac_test_CFLAGS="${CFLAGS+set}"
63   ac_save_CFLAGS="$CFLAGS"
64   CFLAGS=
65   AC_PROG_CC_G
66   if test "$ac_test_CFLAGS" = set; then
67     CFLAGS="$ac_save_CFLAGS"
68   elif test $ac_cv_prog_cc_g = yes; then
69     CFLAGS="-g -O2"
70   else
71     CFLAGS="-O2"
72   fi
73 else
74   GCC=
75   test "${CFLAGS+set}" = set || CFLAGS="-g"
76 fi
77 ])
78
79 LIB_AC_PROG_CC
80
81 # Likewise for AC_PROG_CXX.
82 AC_DEFUN(LIB_AC_PROG_CXX,
83 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
84 dnl Fool anybody using AC_PROG_CXX.
85 AC_PROVIDE([AC_PROG_CXX])
86 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
87 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
88
89 AC_PROG_CXX_GNU
90
91 if test $ac_cv_prog_gxx = yes; then
92   GXX=yes
93 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
94 dnl plays around with CXXFLAGS (such as to build both debugging and
95 dnl normal versions of a library), tasteless as that idea is.
96   ac_test_CXXFLAGS="${CXXFLAGS+set}"
97   ac_save_CXXFLAGS="$CXXFLAGS"
98   CXXFLAGS=
99   AC_PROG_CXX_G
100   if test "$ac_test_CXXFLAGS" = set; then
101     CXXFLAGS="$ac_save_CXXFLAGS"
102   elif test $ac_cv_prog_cxx_g = yes; then
103     CXXFLAGS="-g -O2"
104   else
105     CXXFLAGS="-O2"
106   fi
107 else
108   GXX=
109   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
110 fi
111 ])
112
113 LIB_AC_PROG_CXX
114
115 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
116 # run it explicitly here, it will be run implicitly before
117 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
118 # be run before AC_CANONICAL_HOST.
119 AC_CANONICAL_BUILD
120
121 AC_CHECK_TOOL(AS, as)
122 AC_CHECK_TOOL(AR, ar)
123 AC_CHECK_TOOL(RANLIB, ranlib, :)
124
125 AC_PROG_INSTALL
126
127 AM_MAINTAINER_MODE
128
129 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
130 # at least currently, we never actually build a program, so we never
131 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
132 # fails, because we are probably configuring with a cross compiler
133 # which cant create executables.  So we include AC_EXEEXT to keep
134 # automake happy, but we dont execute it, since we dont care about
135 # the result.
136 if false; then
137   AC_EXEEXT
138 fi
139
140 # configure.host sets the following important variables
141 #       libgcj_cflags    - host specific C compiler flags
142 #       libgcj_cxxflags  - host specific C++ compiler flags
143 #       libgcj_javaflags - host specific Java compiler flags
144
145 libgcj_cflags=
146 libgcj_cxxflags=
147 libgcj_javaflags=
148
149 . [$]{libgcj_basedir}/configure.host
150
151 case [$]{libgcj_basedir} in
152 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
153 *) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
154 esac
155
156 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
157 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
158 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
159 AC_SUBST(LIBGCJ_CFLAGS)
160 AC_SUBST(LIBGCJ_CXXFLAGS)
161 AC_SUBST(LIBGCJ_JAVAFLAGS)
162 ])dnl