Experiment:
[AROS-Contrib.git] / gc / acinclude.m4
blobabea23b32aecc417937fba37cadbf5a378a658e3
1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
2
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
5
6 # Permission is hereby granted to use or copy this program
7 # for any purpose,  provided the above notices are retained on all copies.
8 # Permission to modify the code and to distribute modified code is granted,
9 # provided the above notices are retained, and a notice that the code was
10 # modified is included with the above copyright notice.
12 # Original author: Tom Tromey
14 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
15 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
16 # are probably using a cross compiler, which will not be able to fully
17 # link an executable.  This should really be fixed in autoconf
18 # itself.
20 AC_DEFUN(GC_CONFIGURE,
22 dnl Default to --enable-multilib
23 AC_ARG_ENABLE(multilib,
24 [  --enable-multilib       build many library versions (default)],
25 [case "${enableval}" in
26   yes) multilib=yes ;;
27   no)  multilib=no ;;
28   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
29  esac], [multilib=yes])dnl
31 dnl We may get other options which we don't document:
32 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
34 dnl I needed to add the -n test to allow configuration in src directory - HB
35 if test "[$]{srcdir}" = "."; then
36   if test "[$]{with_target_subdir}" != "." -a -n "[$]{with_target_subdir}"; then
37     gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
38   else
39     gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
40   fi
41 else
42   gc_basedir="[$]{srcdir}/$1"
44 AC_SUBST(gc_basedir)
45 AC_CONFIG_AUX_DIR($gc_basedir)
47 AC_CANONICAL_SYSTEM
49 AM_INIT_AUTOMAKE(gc, 6.0, no-define)
51 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
52 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
53 # are probably using a cross compiler, which will not be able to fully
54 # link an executable.  This should really be fixed in autoconf
55 # itself.
57 AC_DEFUN(LIB_AC_PROG_CC,
58 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
59 dnl Fool anybody using AC_PROG_CC.
60 AC_PROVIDE([AC_PROG_CC])
61 AC_CHECK_PROG(CC, gcc, gcc)
62 if test -z "$CC"; then
63   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
64   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
67 AC_PROG_CC_GNU
69 if test $ac_cv_prog_gcc = yes; then
70   GCC=yes
71 dnl Check whether -g works, even if CFLAGS is set, in case the package
72 dnl plays around with CFLAGS (such as to build both debugging and
73 dnl normal versions of a library), tasteless as that idea is.
74   ac_test_CFLAGS="${CFLAGS+set}"
75   ac_save_CFLAGS="$CFLAGS"
76   CFLAGS=
77   AC_PROG_CC_G
78   if test "$ac_test_CFLAGS" = set; then
79     CFLAGS="$ac_save_CFLAGS"
80   elif test $ac_cv_prog_cc_g = yes; then
81     CFLAGS="-g -O2"
82   else
83     CFLAGS="-O2"
84   fi
85 else
86   GCC=
87   test "${CFLAGS+set}" = set || CFLAGS="-g"
91 LIB_AC_PROG_CC
93 # Likewise for AC_PROG_CXX.
94 AC_DEFUN(LIB_AC_PROG_CXX,
95 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
96 dnl Fool anybody using AC_PROG_CXX.
97 AC_PROVIDE([AC_PROG_CXX])
98 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
99 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
101 AC_PROG_CXX_GNU
103 if test $ac_cv_prog_gxx = yes; then
104   GXX=yes
105 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
106 dnl plays around with CXXFLAGS (such as to build both debugging and
107 dnl normal versions of a library), tasteless as that idea is.
108   ac_test_CXXFLAGS="${CXXFLAGS+set}"
109   ac_save_CXXFLAGS="$CXXFLAGS"
110   CXXFLAGS=
111   AC_PROG_CXX_G
112   if test "$ac_test_CXXFLAGS" = set; then
113     CXXFLAGS="$ac_save_CXXFLAGS"
114   elif test $ac_cv_prog_cxx_g = yes; then
115     CXXFLAGS="-g -O2"
116   else
117     CXXFLAGS="-O2"
118   fi
119 else
120   GXX=
121   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
125 LIB_AC_PROG_CXX
127 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
128 # run it explicitly here, it will be run implicitly before
129 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
130 # be run before AC_CANONICAL_HOST.
131 AC_CANONICAL_BUILD
133 AC_CHECK_TOOL(AS, as)
134 AC_CHECK_TOOL(AR, ar)
135 AC_CHECK_TOOL(RANLIB, ranlib, :)
137 AC_PROG_INSTALL
139 AM_MAINTAINER_MODE
141 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
142 # at least currently, we never actually build a program, so we never
143 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
144 # fails, because we are probably configuring with a cross compiler
145 # which can't create executables.  So we include AC_EXEEXT to keep
146 # automake happy, but we don't execute it, since we don't care about
147 # the result.
148 if false; then
149   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
150   # to nothing, so nothing would remain between `then' and `fi' if it
151   # were not for the `:' below.
152   :
153   AC_EXEEXT
156 . [$]{srcdir}/configure.host
158 case [$]{gc_basedir} in
159 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
160 *) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
161 esac
163 gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{gc_flagbasedir}/libc/include"
164 case "${host}" in
165   *-*-cygwin32*)
166     gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
167     ;;
168 esac
170 dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
172 GC_CFLAGS=${gc_cflags}
173 AC_SUBST(GC_CFLAGS)
176 ))))
178 sinclude(libtool.m4)
179 dnl The line below arranges for aclocal not to bring a definition of
180 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
181 dnl to add a definition of LIBTOOL to Makefile.in.
182 ifelse(yes,no,[AC_DEFUN([AM_PROG_LIBTOOL],[AC_SUBST(LIBTOOL)])])