OSDN Git Service

* gnu/gcj/util/path/SearchPath.java: Comment out verbose output.
[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 AC_CHECK_PROG(CC, gcc, gcc)
48 if test -z "$CC"; then
49   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
50   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
51 fi
52
53 AC_PROG_CC_GNU
54
55 if test $ac_cv_prog_gcc = yes; then
56   GCC=yes
57 dnl Check whether -g works, even if CFLAGS is set, in case the package
58 dnl plays around with CFLAGS (such as to build both debugging and
59 dnl normal versions of a library), tasteless as that idea is.
60   ac_test_CFLAGS="${CFLAGS+set}"
61   ac_save_CFLAGS="$CFLAGS"
62   CFLAGS=
63   AC_PROG_CC_G
64   if test "$ac_test_CFLAGS" = set; then
65     CFLAGS="$ac_save_CFLAGS"
66   elif test $ac_cv_prog_cc_g = yes; then
67     CFLAGS="-g -O2"
68   else
69     CFLAGS="-O2"
70   fi
71 else
72   GCC=
73   test "${CFLAGS+set}" = set || CFLAGS="-g"
74 fi
75 ])
76
77 LIB_AC_PROG_CC
78
79 # Likewise for AC_PROG_CXX.
80 AC_DEFUN(LIB_AC_PROG_CXX,
81 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
82 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
83 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
84
85 AC_PROG_CXX_GNU
86
87 if test $ac_cv_prog_gxx = yes; then
88   GXX=yes
89 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
90 dnl plays around with CXXFLAGS (such as to build both debugging and
91 dnl normal versions of a library), tasteless as that idea is.
92   ac_test_CXXFLAGS="${CXXFLAGS+set}"
93   ac_save_CXXFLAGS="$CXXFLAGS"
94   CXXFLAGS=
95   AC_PROG_CXX_G
96   if test "$ac_test_CXXFLAGS" = set; then
97     CXXFLAGS="$ac_save_CXXFLAGS"
98   elif test $ac_cv_prog_cxx_g = yes; then
99     CXXFLAGS="-g -O2"
100   else
101     CXXFLAGS="-O2"
102   fi
103 else
104   GXX=
105   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
106 fi
107 ])
108
109 LIB_AC_PROG_CXX
110
111 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
112 # run it explicitly here, it will be run implicitly before
113 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
114 # be run before AC_CANONICAL_HOST.
115 AC_CANONICAL_BUILD
116
117 AC_CHECK_TOOL(AS, as)
118 AC_CHECK_TOOL(AR, ar)
119 AC_CHECK_TOOL(RANLIB, ranlib, :)
120
121 AC_PROG_INSTALL
122
123 AM_MAINTAINER_MODE
124
125 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
126 # at least currently, we never actually build a program, so we never
127 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
128 # fails, because we are probably configuring with a cross compiler
129 # which cant create executables.  So we include AC_EXEEXT to keep
130 # automake happy, but we dont execute it, since we dont care about
131 # the result.
132 if false; then
133   AC_EXEEXT
134 fi
135
136 # configure.host sets the following important variables
137 #       libgcj_cflags    - host specific C compiler flags
138 #       libgcj_cxxflags  - host specific C++ compiler flags
139 #       libgcj_javaflags - host specific Java compiler flags
140
141 libgcj_cflags=
142 libgcj_cxxflags=
143 libgcj_javaflags=
144
145 . [$]{libgcj_basedir}/configure.host
146
147 case [$]{libgcj_basedir} in
148 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
149 *) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
150 esac
151
152 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
153 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
154 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
155 AC_SUBST(LIBGCJ_CFLAGS)
156 AC_SUBST(LIBGCJ_CXXFLAGS)
157 AC_SUBST(LIBGCJ_JAVAFLAGS)
158 ])dnl