]>
Commit | Line | Data |
---|---|---|
bce1b489 | 1 | # Process this file with autoconf to produce a configure script. |
9c01f395 | 2 | # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004 |
3343fdd2 | 3 | # Free Software Foundation, Inc. |
9c01f395 | 4 | # Originally contributed by Dave Love (d.love@dl.ac.uk). |
bce1b489 | 5 | # |
9c01f395 | 6 | #This file is part of GCC. |
bce1b489 | 7 | # |
9c01f395 | 8 | #GCC is free software; you can redistribute it and/or modify |
bce1b489 BE |
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) | |
11 | #any later version. | |
12 | # | |
9c01f395 | 13 | #GCC is distributed in the hope that it will be useful, |
bce1b489 BE |
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. | |
17 | # | |
18 | #You should have received a copy of the GNU General Public License | |
9c01f395 | 19 | #along with GCC; see the file COPYING. If not, write to |
bce1b489 BE |
20 | #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
21 | #02111-1307, USA. | |
22 | ||
da4b1927 | 23 | AC_PREREQ(2.13) |
789eb4f5 | 24 | AC_INIT(objc/objc.h) |
d972a4c2 | 25 | AC_CONFIG_HEADER(config.h) |
bce1b489 | 26 | |
6706f116 AO |
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 | |
30 | # exported. | |
31 | ORIGINAL_LD_FOR_MULTILIBS=$LD | |
32 | ||
9c01f395 NN |
33 | dnl Default to --enable-multilib |
34 | AC_ARG_ENABLE(multilib, | |
35 | [ --enable-multilib build hella library versions (default)], | |
36 | [case "${enableval}" in | |
37 | yes) multilib=yes ;; | |
38 | no) multilib=no ;; | |
39 | *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; | |
40 | esac], [multilib=yes])dnl | |
41 | ||
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 | |
46 | # source directory. | |
47 | if test "${srcdir}" = "."; then | |
48 | if test -z "${with_target_subdir}"; then | |
49 | toprel=".." | |
50 | else | |
51 | if test "${with_target_subdir}" != "."; then | |
52 | toprel="${with_multisrctop}../.." | |
53 | else | |
54 | toprel="${with_multisrctop}.." | |
55 | fi | |
56 | fi | |
57 | else | |
58 | toprel=".." | |
59 | fi | |
60 | AC_CONFIG_AUX_DIR(${srcdir}/$toprel) | |
61 | toplevel_srcdir=\${top_srcdir}/$toprel | |
62 | AC_SUBST(toplevel_srcdir) | |
aebb8c22 | 63 | |
b150efee | 64 | AC_CANONICAL_SYSTEM |
9c01f395 NN |
65 | _GCC_TOPLEV_NONCANONICAL_TARGET |
66 | AC_SUBST(target_noncanonical) | |
67 | ||
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}` | |
73 | case $srcdir in | |
74 | [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; | |
75 | *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
76 | esac | |
77 | AC_SUBST(glibcpp_builddir) | |
78 | AC_SUBST(glibcpp_srcdir) | |
79 | ||
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' | |
83 | AC_PROG_LN_S | |
84 | ||
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]) | |
91 | ||
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]))]) | |
98 | ||
99 | # AC_PROG_CC | |
100 | ||
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 | |
105 | # itself. | |
106 | ||
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]) | |
115 | fi | |
116 | ||
117 | AC_PROG_CC_GNU | |
118 | ||
119 | if test $ac_cv_prog_gcc = yes; then | |
120 | GCC=yes | |
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" | |
126 | CFLAGS= | |
127 | AC_PROG_CC_G | |
128 | if test "$ac_test_CFLAGS" = set; then | |
129 | CFLAGS="$ac_save_CFLAGS" | |
130 | elif test $ac_cv_prog_cc_g = yes; then | |
131 | CFLAGS="-g -O2" | |
132 | else | |
133 | CFLAGS="-O2" | |
134 | fi | |
135 | else | |
136 | GCC= | |
137 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
138 | fi | |
139 | ]) | |
140 | ||
141 | LIB_AC_PROG_CC | |
142 | ||
143 | AC_CHECK_TOOL(AS, as) | |
144 | AC_CHECK_TOOL(AR, ar) | |
145 | AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) | |
146 | AC_PROG_INSTALL | |
b150efee | 147 | |
9c01f395 NN |
148 | |
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]);; | |
157 | esac], | |
158 | [version_specific_libs=no]) | |
159 | # Option set, now we can test it. | |
160 | AC_MSG_RESULT($version_specific_libs) | |
161 | ||
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) | |
167 | ||
168 | # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir | |
169 | case ${version_specific_libs} in | |
170 | yes) | |
171 | # Need the gcc compiler version to know where to install libraries | |
172 | # and header files if --enable-version-specific-runtime-libs option | |
173 | # is selected. | |
174 | glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)' | |
175 | glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' | |
176 | ;; | |
177 | no) | |
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' | |
182 | else | |
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)' | |
186 | fi | |
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 ;; | |
191 | esac | |
192 | ;; | |
193 | esac | |
194 | AC_SUBST(glibcpp_toolexecdir) | |
195 | AC_SUBST(glibcpp_toolexeclibdir) | |
196 | ||
197 | glibcpp_prefixdir=${prefix} | |
198 | AC_SUBST(glibcpp_prefixdir) | |
bce1b489 BE |
199 | |
200 | dnl Checks for programs. | |
7c6b0e92 | 201 | |
b150efee FS |
202 | # Disable shared libs by default |
203 | AC_DISABLE_SHARED | |
9c01f395 NN |
204 | # Enable Win32 DLL on MS Windows - FIXME |
205 | AC_LIBTOOL_WIN32_DLL | |
7c6b0e92 | 206 | |
b150efee | 207 | AC_PROG_LIBTOOL |
bce1b489 | 208 | |
b150efee FS |
209 | dnl These should be inherited in the recursive make, but ensure they are |
210 | dnl defined: | |
bce1b489 BE |
211 | test "$AR" || AR=ar |
212 | AC_SUBST(AR) | |
213 | if test "$RANLIB"; then : | |
214 | AC_SUBST(RANLIB) | |
215 | else | |
216 | AC_PROG_RANLIB | |
217 | fi | |
218 | AC_PROG_INSTALL | |
b150efee | 219 | AC_PROG_MAKE_SET |
bce1b489 | 220 | |
68a1af87 MH |
221 | dnl we need the following definitions because AC_PROG_LIBTOOL relies on them |
222 | PACKAGE=libobjc | |
223 | dnl version is pulled out to make it a bit easier to change using sed. | |
224 | VERSION=1:0:0 | |
225 | AC_SUBST(VERSION) | |
226 | ||
bce1b489 BE |
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'.])]) | |
235 | ||
236 | AC_HEADER_STDC | |
237 | ||
d972a4c2 OP |
238 | AC_CHECK_HEADERS(sched.h) |
239 | ||
15794a95 | 240 | # Determine CFLAGS for gthread. |
bce1b489 | 241 | |
15794a95 | 242 | AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags, |
79014e6f | 243 | [if test -f "$r"/gcc/Makefile |
bce1b489 | 244 | then |
15794a95 | 245 | objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'` |
bce1b489 BE |
246 | else |
247 | AC_MSG_ERROR([not found]) | |
248 | fi]) | |
15794a95 L |
249 | GTHREAD_FLAGS=$objc_cv_gthread_flags |
250 | AC_SUBST(GTHREAD_FLAGS) | |
bce1b489 BE |
251 | |
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 | |
256 | OBJC_BOEHM_GC='' | |
257 | else | |
c161c99b | 258 | OBJC_BOEHM_GC=libobjc_gc.la |
bce1b489 BE |
259 | fi, |
260 | OBJC_BOEHM_GC='') | |
261 | AC_SUBST(OBJC_BOEHM_GC) | |
262 | ||
263 | ||
264 | # We need multilib support, but only if configuring for the target. | |
265 | AC_OUTPUT(Makefile, | |
b150efee | 266 | [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h |
bce1b489 BE |
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 | |
270 | ac_file=Makefile | |
6706f116 | 271 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
b150efee | 272 | . ${toplevel_srcdir}/config-ml.in |
bce1b489 BE |
273 | fi |
274 | fi], | |
275 | srcdir=${srcdir} | |
276 | host=${host} | |
277 | target=${target} | |
278 | with_target_subdir=${with_target_subdir} | |
279 | with_multisubdir=${with_multisubdir} | |
280 | ac_configure_args="--enable-multilib ${ac_configure_args}" | |
b150efee | 281 | toplevel_srcdir=${toplevel_srcdir} |
bce1b489 | 282 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
3343fdd2 | 283 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
bce1b489 | 284 | ) |