1 # Process this file with autoconf to produce a configure script.
2 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
3 # Free Software Foundation, Inc.
4 # Originally contributed by Dave Love (d.love@dl.ac.uk).
6 #This file is part of GCC.
8 #GCC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 2, or (at your option)
13 #GCC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU General Public License for more details.
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING. If not, write to
20 #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 AC_CONFIG_HEADER(config.h)
27 # This works around the fact that libtool configuration may change LD
28 # for this particular configuration, but some shells, instead of
29 # keeping the changes in LD private, export them just because LD is
31 ORIGINAL_LD_FOR_MULTILIBS=$LD
33 dnl Default to --enable-multilib
34 AC_ARG_ENABLE(multilib,
35 [ --enable-multilib build hella library versions (default)],
36 [case "${enableval}" in
39 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
40 esac], [multilib=yes])dnl
42 # When building with srcdir == objdir, links to the source files will
43 # be created in directories within the target_subdir. We have to
44 # adjust toplevel_srcdir accordingly, so that configure finds
45 # install-sh and other auxiliary files that live in the top-level
47 if test "${srcdir}" = "."; then
48 if test -z "${with_target_subdir}"; then
51 if test "${with_target_subdir}" != "."; then
52 toprel="${with_multisrctop}../.."
54 toprel="${with_multisrctop}.."
60 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
61 toplevel_srcdir=\${top_srcdir}/$toprel
62 AC_SUBST(toplevel_srcdir)
65 _GCC_TOPLEV_NONCANONICAL_TARGET
66 AC_SUBST(target_noncanonical)
68 # Export build and source directories.
69 # These need to be absolute paths, yet at the same time need to
70 # canonicalize only relative paths, because then amd will not unmount
71 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
72 glibcpp_builddir=`${PWDCMD-pwd}`
74 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
75 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
77 AC_SUBST(glibcpp_builddir)
78 AC_SUBST(glibcpp_srcdir)
80 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
81 # be 'cp -p' if linking isn't available.
82 #ac_cv_prog_LN_S='cp -p'
85 # We use these options to decide which functions to include.
86 AC_ARG_WITH(target-subdir,
87 [ --with-target-subdir=SUBDIR
88 configuring in a subdirectory])
89 AC_ARG_WITH(cross-host,
90 [ --with-cross-host=HOST configuring with a cross compiler])
92 # Never versions of autoconf add an underscore to these functions.
93 # Prevent future problems ...
94 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
95 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
96 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
97 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
101 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
102 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
103 # are probably using a cross compiler, which will not be able to fully
104 # link an executable. This should really be fixed in autoconf
107 AC_DEFUN(LIB_AC_PROG_CC,
108 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
109 dnl Fool anybody using AC_PROG_CC.
110 AC_PROVIDE([AC_PROG_CC])
111 AC_CHECK_PROG(CC, gcc, gcc)
112 if test -z "$CC"; then
113 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
114 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
119 if test $ac_cv_prog_gcc = yes; then
121 dnl Check whether -g works, even if CFLAGS is set, in case the package
122 dnl plays around with CFLAGS (such as to build both debugging and
123 dnl normal versions of a library), tasteless as that idea is.
124 ac_test_CFLAGS="${CFLAGS+set}"
125 ac_save_CFLAGS="$CFLAGS"
128 if test "$ac_test_CFLAGS" = set; then
129 CFLAGS="$ac_save_CFLAGS"
130 elif test $ac_cv_prog_cc_g = yes; then
137 test "${CFLAGS+set}" = set || CFLAGS="-g"
143 AC_CHECK_TOOL(AS, as)
144 AC_CHECK_TOOL(AR, ar)
145 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
149 # Process the option "--enable-version-specific-runtime-libs"
150 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
151 AC_ARG_ENABLE(version-specific-runtime-libs,
152 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
153 [case "$enableval" in
154 yes) version_specific_libs=yes ;;
155 no) version_specific_libs=no ;;
156 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
158 [version_specific_libs=no])
159 # Option set, now we can test it.
160 AC_MSG_RESULT($version_specific_libs)
162 gcc_version_trigger=${srcdir}/../gcc/version.c
163 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
164 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
165 AC_SUBST(gcc_version)
166 AC_SUBST(gcc_version_trigger)
168 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
169 case ${version_specific_libs} in
171 # Need the gcc compiler version to know where to install libraries
172 # and header files if --enable-version-specific-runtime-libs option
174 glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
175 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
178 if test -n "$with_cross_host" &&
179 test x"$with_cross_host" != x"no"; then
180 glibcpp_toolexecdir='$(exec_prefix)/$(target_noncanonical)'
181 glibcpp_toolexeclibdir='$(toolexecdir)/lib'
183 # Install a library built with a cross compiler in tooldir, not libdir.
184 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
185 glibcpp_toolexeclibdir='$(libdir)'
187 multi_os_directory=`$CC -print-multi-os-directory`
188 case $multi_os_directory in
189 .) ;; # Avoid trailing /.
190 *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
194 AC_SUBST(glibcpp_toolexecdir)
195 AC_SUBST(glibcpp_toolexeclibdir)
197 glibcpp_prefixdir=${prefix}
198 AC_SUBST(glibcpp_prefixdir)
200 dnl Checks for programs.
202 # Disable shared libs by default
204 # Enable Win32 DLL on MS Windows - FIXME
209 dnl These should be inherited in the recursive make, but ensure they are
213 if test "$RANLIB"; then :
221 dnl we need the following definitions because AC_PROG_LIBTOOL relies on them
223 dnl version is pulled out to make it a bit easier to change using sed.
227 dnl Checks for header files.
228 # Sanity check for the cross-compilation case:
229 AC_CHECK_HEADER(stdio.h,:,
230 [AC_MSG_ERROR([Can't find stdio.h.
231 You must have a usable C system for the target already installed, at least
232 including headers and, preferably, the library, before you can configure
233 the Objective C runtime system. If necessary, install gcc now with
234 \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
238 AC_CHECK_HEADERS(sched.h)
240 # Determine CFLAGS for gthread.
242 AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
243 [if test -f "$r"/gcc/Makefile
245 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
247 AC_MSG_ERROR([not found])
249 GTHREAD_FLAGS=$objc_cv_gthread_flags
250 AC_SUBST(GTHREAD_FLAGS)
252 AC_ARG_ENABLE(objc-gc,
253 [ --enable-objc-gc enable the use of Boehm's garbage collector with
254 the GNU Objective-C runtime.],
255 if [[[ x$enable_objc_gc = xno ]]]; then
258 OBJC_BOEHM_GC=libobjc_gc.la
261 AC_SUBST(OBJC_BOEHM_GC)
264 # We need multilib support, but only if configuring for the target.
266 [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
267 if test -n "$CONFIG_FILES"; then
268 if test -n "${with_target_subdir}"; then
269 # FIXME: We shouldn't need to set ac_file
271 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
272 . ${toplevel_srcdir}/config-ml.in
278 with_target_subdir=${with_target_subdir}
279 with_multisubdir=${with_multisubdir}
280 ac_configure_args="--enable-multilib ${ac_configure_args}"
281 toplevel_srcdir=${toplevel_srcdir}
282 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
283 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"