OSDN Git Service

Fix for PR libgcj/3059:
[pf3gnuchains/gcc-fork.git] / boehm-gc / 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(BOEHM_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 don't document:
19 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
20
21 if test "[$]{srcdir}" = "."; then
22   if test "[$]{with_target_subdir}" != "."; then
23     boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
24   else
25     boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
26   fi
27 else
28   boehm_gc_basedir="[$]{srcdir}/$1"
29 fi
30 AC_SUBST(boehm_gc_basedir)
31 AC_CONFIG_AUX_DIR($boehm_gc_basedir/..)
32 if :; then :; else
33   # This overrides the previous occurrence for automake, but not for
34   # autoconf, which is exactly what we want.
35   AC_CONFIG_AUX_DIR(..)
36 fi
37
38 AC_CANONICAL_SYSTEM
39
40 AM_INIT_AUTOMAKE(boehm-gc, 5.1, no-define)
41
42 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
43 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
44 # are probably using a cross compiler, which will not be able to fully
45 # link an executable.  This should really be fixed in autoconf
46 # itself.
47
48 AC_DEFUN(LIB_AC_PROG_CC,
49 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
50 dnl Fool anybody using AC_PROG_CC.
51 AC_PROVIDE([AC_PROG_CC])
52 AC_CHECK_PROG(CC, gcc, gcc)
53 if test -z "$CC"; then
54   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
55   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
56 fi
57
58 AC_PROG_CC_GNU
59
60 if test $ac_cv_prog_gcc = yes; then
61   GCC=yes
62 dnl Check whether -g works, even if CFLAGS is set, in case the package
63 dnl plays around with CFLAGS (such as to build both debugging and
64 dnl normal versions of a library), tasteless as that idea is.
65   ac_test_CFLAGS="${CFLAGS+set}"
66   ac_save_CFLAGS="$CFLAGS"
67   CFLAGS=
68   AC_PROG_CC_G
69   if test "$ac_test_CFLAGS" = set; then
70     CFLAGS="$ac_save_CFLAGS"
71   elif test $ac_cv_prog_cc_g = yes; then
72     CFLAGS="-g -O2"
73   else
74     CFLAGS="-O2"
75   fi
76 else
77   GCC=
78   test "${CFLAGS+set}" = set || CFLAGS="-g"
79 fi
80 ])
81
82 LIB_AC_PROG_CC
83
84 # Likewise for AC_PROG_CXX.
85 AC_DEFUN(LIB_AC_PROG_CXX,
86 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
87 dnl Fool anybody using AC_PROG_CXX.
88 AC_PROVIDE([AC_PROG_CXX])
89 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
90 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
91
92 AC_PROG_CXX_GNU
93
94 if test $ac_cv_prog_gxx = yes; then
95   GXX=yes
96 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
97 dnl plays around with CXXFLAGS (such as to build both debugging and
98 dnl normal versions of a library), tasteless as that idea is.
99   ac_test_CXXFLAGS="${CXXFLAGS+set}"
100   ac_save_CXXFLAGS="$CXXFLAGS"
101   CXXFLAGS=
102   AC_PROG_CXX_G
103   if test "$ac_test_CXXFLAGS" = set; then
104     CXXFLAGS="$ac_save_CXXFLAGS"
105   elif test $ac_cv_prog_cxx_g = yes; then
106     CXXFLAGS="-g -O2"
107   else
108     CXXFLAGS="-O2"
109   fi
110 else
111   GXX=
112   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
113 fi
114 ])
115
116 LIB_AC_PROG_CXX
117
118 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
119 # run it explicitly here, it will be run implicitly before
120 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
121 # be run before AC_CANONICAL_HOST.
122 AC_CANONICAL_BUILD
123
124 AC_CHECK_TOOL(AS, as)
125 AC_CHECK_TOOL(AR, ar)
126 AC_CHECK_TOOL(RANLIB, ranlib, :)
127
128 AC_PROG_INSTALL
129
130 AM_MAINTAINER_MODE
131
132 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
133 # at least currently, we never actually build a program, so we never
134 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
135 # fails, because we are probably configuring with a cross compiler
136 # which can't create executables.  So we include AC_EXEEXT to keep
137 # automake happy, but we don't execute it, since we don't care about
138 # the result.
139 if false; then
140   AC_EXEEXT
141 fi
142
143 . [$]{boehm_gc_basedir}/configure.host
144
145 case [$]{boehm_gc_basedir} in
146 /* | [A-Za-z]:[/\\]*) boehm_gc_flagbasedir=[$]{boehm_gc_basedir} ;;
147 *) boehm_gc_flagbasedir='[$](top_builddir)/'[$]{boehm_gc_basedir} ;;
148 esac
149
150 boehm_gc_cflags="[$]{boehm_gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{boehm_gc_flagbasedir}/libc/include"
151 case "${host}" in
152   *-*-cygwin32*)
153     boehm_gc_cflags="[$]{boehm_gc_cflags} -I[$]{boehm_gc_flagbasedir}/../winsup/include"
154     ;;
155 esac
156
157 boehm_gc_cflags="[$]{boehm_gc_cflags} -fno-builtin"
158
159 BOEHM_GC_CFLAGS=${boehm_gc_cflags}
160 AC_SUBST(BOEHM_GC_CFLAGS)
161 ]))
162
163 ))))
164
165 sinclude(../libtool.m4)
166 dnl The line below arranges for aclocal not to bring a definition of
167 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
168 dnl to add a definition of LIBTOOL to Makefile.in.
169 ifelse(yes,no,[AC_DEFUN([AM_PROG_LIBTOOL],[AC_SUBST(LIBTOOL)])])