OSDN Git Service

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