]>
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 |
8c3e5222 | 3 | # 2005, 2006 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 |
f9d09c43 KC |
20 | #the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA |
21 | #02110-1301, USA. | |
bce1b489 | 22 | |
88386050 | 23 | AC_PREREQ(2.59) |
684c64bf | 24 | AC_INIT(package-unused, version-unused,, libobjc) |
252dde64 | 25 | AC_CONFIG_SRCDIR([objc/objc.h]) |
215c351a | 26 | GCC_TOPLEV_SUBDIRS |
bce1b489 | 27 | |
252dde64 | 28 | # We need the following definitions because AC_PROG_LIBTOOL relies on them |
1fcfac98 | 29 | PACKAGE=libobjc |
252dde64 | 30 | # Version is pulled out to make it a bit easier to change using sed. |
84700346 | 31 | VERSION=2:0:0 |
1fcfac98 NN |
32 | AC_SUBST(VERSION) |
33 | ||
6706f116 AO |
34 | # This works around the fact that libtool configuration may change LD |
35 | # for this particular configuration, but some shells, instead of | |
36 | # keeping the changes in LD private, export them just because LD is | |
37 | # exported. | |
38 | ORIGINAL_LD_FOR_MULTILIBS=$LD | |
39 | ||
252dde64 NN |
40 | # ------- |
41 | # Options | |
42 | # ------- | |
43 | ||
44 | # Default to --enable-multilib | |
9c01f395 NN |
45 | AC_ARG_ENABLE(multilib, |
46 | [ --enable-multilib build hella library versions (default)], | |
47 | [case "${enableval}" in | |
48 | yes) multilib=yes ;; | |
49 | no) multilib=no ;; | |
50 | *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; | |
252dde64 NN |
51 | esac], |
52 | [multilib=yes]) | |
53 | ||
54 | # We use these options to decide which functions to include. | |
55 | AC_ARG_WITH(target-subdir, | |
56 | [ --with-target-subdir=SUBDIR | |
57 | configuring in a subdirectory]) | |
58 | AC_ARG_WITH(cross-host, | |
59 | [ --with-cross-host=HOST configuring with a cross compiler]) | |
60 | ||
61 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
62 | AC_ARG_ENABLE(version-specific-runtime-libs, | |
63 | [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], | |
64 | [case "$enableval" in | |
65 | yes) version_specific_libs=yes ;; | |
66 | no) version_specific_libs=no ;; | |
67 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
68 | esac], | |
69 | [version_specific_libs=no]) | |
70 | AC_MSG_RESULT($version_specific_libs) | |
71 | ||
72 | AC_ARG_ENABLE(objc-gc, | |
73 | [ --enable-objc-gc enable the use of Boehm's garbage collector with | |
74 | the GNU Objective-C runtime.], | |
75 | [case $enable_objc_gc in | |
8c3e5222 DA |
76 | no) |
77 | OBJC_BOEHM_GC='' | |
78 | OBJC_BOEHM_GC_INCLUDES='' | |
79 | ;; | |
80 | *) | |
81 | OBJC_BOEHM_GC=libobjc_gc.la | |
82 | OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include' | |
83 | ;; | |
252dde64 | 84 | esac], |
8c3e5222 | 85 | [OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES='']) |
252dde64 | 86 | AC_SUBST(OBJC_BOEHM_GC) |
8c3e5222 | 87 | AC_SUBST(OBJC_BOEHM_GC_INCLUDES) |
252dde64 NN |
88 | |
89 | # ----------- | |
90 | # Directories | |
91 | # ----------- | |
9c01f395 NN |
92 | |
93 | # When building with srcdir == objdir, links to the source files will | |
94 | # be created in directories within the target_subdir. We have to | |
95 | # adjust toplevel_srcdir accordingly, so that configure finds | |
96 | # install-sh and other auxiliary files that live in the top-level | |
97 | # source directory. | |
98 | if test "${srcdir}" = "."; then | |
99 | if test -z "${with_target_subdir}"; then | |
100 | toprel=".." | |
101 | else | |
102 | if test "${with_target_subdir}" != "."; then | |
103 | toprel="${with_multisrctop}../.." | |
104 | else | |
105 | toprel="${with_multisrctop}.." | |
106 | fi | |
107 | fi | |
108 | else | |
109 | toprel=".." | |
110 | fi | |
111 | AC_CONFIG_AUX_DIR(${srcdir}/$toprel) | |
88386050 | 112 | toplevel_srcdir=\${srcdir}/$toprel |
9c01f395 | 113 | AC_SUBST(toplevel_srcdir) |
aebb8c22 | 114 | |
b150efee | 115 | AC_CANONICAL_SYSTEM |
1506eac1 | 116 | ACX_NONCANONICAL_TARGET |
9c01f395 | 117 | |
af0c82b3 | 118 | # Export source directory. |
9c01f395 NN |
119 | # These need to be absolute paths, yet at the same time need to |
120 | # canonicalize only relative paths, because then amd will not unmount | |
121 | # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. | |
9c01f395 | 122 | case $srcdir in |
252dde64 NN |
123 | [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; |
124 | *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
9c01f395 | 125 | esac |
9c01f395 NN |
126 | AC_SUBST(glibcpp_srcdir) |
127 | ||
608e1e0c | 128 | # Calculate toolexeclibdir |
a42a57cb | 129 | # Also toolexecdir, though it's only used in toolexeclibdir |
9c01f395 NN |
130 | case ${version_specific_libs} in |
131 | yes) | |
132 | # Need the gcc compiler version to know where to install libraries | |
133 | # and header files if --enable-version-specific-runtime-libs option | |
134 | # is selected. | |
a42a57cb | 135 | toolexecdir='$(libdir)/gcc/$(target_noncanonical)' |
2b37e3d5 | 136 | toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' |
9c01f395 NN |
137 | ;; |
138 | no) | |
139 | if test -n "$with_cross_host" && | |
140 | test x"$with_cross_host" != x"no"; then | |
9c01f395 | 141 | # Install a library built with a cross compiler in tooldir, not libdir. |
a42a57cb | 142 | toolexecdir='$(exec_prefix)/$(target_noncanonical)' |
608e1e0c NN |
143 | toolexeclibdir='$(toolexecdir)/lib' |
144 | else | |
a42a57cb | 145 | toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' |
608e1e0c | 146 | toolexeclibdir='$(libdir)' |
9c01f395 NN |
147 | fi |
148 | multi_os_directory=`$CC -print-multi-os-directory` | |
149 | case $multi_os_directory in | |
150 | .) ;; # Avoid trailing /. | |
608e1e0c | 151 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; |
9c01f395 NN |
152 | esac |
153 | ;; | |
154 | esac | |
a42a57cb | 155 | AC_SUBST(toolexecdir) |
608e1e0c | 156 | AC_SUBST(toolexeclibdir) |
9c01f395 | 157 | |
ff65de76 AP |
158 | # Figure out if we want to name the include directory and the |
159 | # library name changes differently. | |
7d34a5a9 | 160 | includedirname=include |
ff65de76 AP |
161 | libext= |
162 | case "${host}" in | |
163 | *-darwin*) | |
164 | # Darwin is the only target so far that needs a different include directory. | |
7d34a5a9 | 165 | includedirname=include-gnu-runtime |
ff65de76 AP |
166 | libext=-gnu |
167 | ;; | |
168 | esac | |
7d34a5a9 | 169 | AC_SUBST(includedirname) |
ff65de76 AP |
170 | AC_SUBST(libext) |
171 | ||
049bc404 AP |
172 | AC_CONFIG_HEADERS(config.h) |
173 | ||
252dde64 NN |
174 | # -------- |
175 | # Programs | |
176 | # -------- | |
177 | ||
178 | GCC_NO_EXECUTABLES | |
db7f3c69 NN |
179 | |
180 | # We must force CC to /not/ be a precious variable; otherwise | |
181 | # the wrong, non-multilib-adjusted value will be used in multilibs. | |
182 | # As a side effect, we have to subst CFLAGS ourselves. | |
183 | m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) | |
184 | m4_define([_AC_ARG_VAR_PRECIOUS],[]) | |
252dde64 | 185 | AC_PROG_CC |
db7f3c69 NN |
186 | m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
187 | ||
a5a813f8 AP |
188 | # extra LD Flags which are required for targets |
189 | case "${host}" in | |
190 | *-darwin*) | |
191 | # Darwin needs -single_module when linking libobjc | |
192 | extra_ldflags_libobjc=-Wl,-single_module | |
193 | ;; | |
194 | esac | |
195 | AC_SUBST(extra_ldflags_libobjc) | |
196 | ||
db7f3c69 | 197 | AC_SUBST(CFLAGS) |
252dde64 NN |
198 | |
199 | AC_CHECK_TOOL(AS, as) | |
200 | AC_CHECK_TOOL(AR, ar) | |
201 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
202 | AC_PROG_INSTALL | |
7c6b0e92 | 203 | |
dd365157 MS |
204 | AM_MAINTAINER_MODE |
205 | ||
9c01f395 NN |
206 | # Enable Win32 DLL on MS Windows - FIXME |
207 | AC_LIBTOOL_WIN32_DLL | |
7c6b0e92 | 208 | |
b150efee | 209 | AC_PROG_LIBTOOL |
bce1b489 | 210 | |
dd365157 MS |
211 | AM_PROG_CC_C_O |
212 | ||
b150efee | 213 | AC_PROG_MAKE_SET |
bce1b489 | 214 | |
252dde64 NN |
215 | # ------- |
216 | # Headers | |
217 | # ------- | |
218 | ||
bce1b489 BE |
219 | # Sanity check for the cross-compilation case: |
220 | AC_CHECK_HEADER(stdio.h,:, | |
221 | [AC_MSG_ERROR([Can't find stdio.h. | |
222 | You must have a usable C system for the target already installed, at least | |
223 | including headers and, preferably, the library, before you can configure | |
224 | the Objective C runtime system. If necessary, install gcc now with | |
225 | \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) | |
226 | ||
227 | AC_HEADER_STDC | |
228 | ||
d972a4c2 OP |
229 | AC_CHECK_HEADERS(sched.h) |
230 | ||
252dde64 NN |
231 | # ----------- |
232 | # Miscellanea | |
233 | # ----------- | |
234 | ||
6886e18e AP |
235 | AC_MSG_CHECKING([for thread model used by GCC]) |
236 | target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` | |
237 | AC_MSG_RESULT([$target_thread_file]) | |
238 | ||
239 | if test $target_thread_file != single; then | |
240 | AC_DEFINE(HAVE_GTHR_DEFAULT, 1, | |
241 | [Define if the compiler has a thread header that is non single.]) | |
242 | fi | |
243 | ||
bce1b489 | 244 | |
049bc404 AP |
245 | AC_MSG_CHECKING([for exception model to use]) |
246 | AC_LANG_PUSH(C) | |
247 | AC_ARG_ENABLE(sjlj-exceptions, | |
248 | AS_HELP_STRING([--enable-sjlj-exceptions], | |
249 | [force use of builtin_setjmp for exceptions]), | |
250 | [:], | |
251 | [dnl Botheration. Now we've got to detect the exception model. | |
252 | dnl Link tests against libgcc.a are problematic since -- at least | |
253 | dnl as of this writing -- we've not been given proper -L bits for | |
254 | dnl single-tree newlib and libgloss. | |
255 | dnl | |
256 | dnl This is what AC_TRY_COMPILE would do if it didn't delete the | |
257 | dnl conftest files before we got a change to grep them first. | |
258 | cat > conftest.$ac_ext << EOF | |
259 | [#]line __oline__ "configure" | |
260 | @interface Frob | |
261 | @end | |
262 | @implementation Frob | |
263 | @end | |
264 | int proc(); | |
265 | int foo() | |
266 | { | |
267 | @try { | |
268 | return proc(); | |
269 | } | |
270 | @catch (Frob* ex) { | |
271 | return 0; | |
272 | } | |
273 | } | |
274 | EOF | |
275 | old_CFLAGS="$CFLAGS" | |
276 | dnl work around that we don't have Objective-C support in autoconf | |
277 | CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S" | |
278 | if AC_TRY_EVAL(ac_compile); then | |
279 | if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then | |
280 | enable_sjlj_exceptions=yes | |
281 | elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then | |
282 | enable_sjlj_exceptions=no | |
283 | fi | |
284 | fi | |
285 | CFLAGS="$old_CFLAGS" | |
286 | rm -f conftest*]) | |
287 | if test x$enable_sjlj_exceptions = xyes; then | |
288 | AC_DEFINE(SJLJ_EXCEPTIONS, 1, | |
289 | [Define if the compiler is configured for setjmp/longjmp exceptions.]) | |
290 | ac_exception_model_name=sjlj | |
291 | elif test x$enable_sjlj_exceptions = xno; then | |
292 | ac_exception_model_name="call frame" | |
293 | else | |
294 | AC_MSG_ERROR([unable to detect exception model]) | |
295 | fi | |
296 | AC_LANG_POP(C) | |
297 | AC_MSG_RESULT($ac_exception_model_name) | |
298 | ||
252dde64 NN |
299 | # ------ |
300 | # Output | |
301 | # ------ | |
bce1b489 | 302 | |
252dde64 NN |
303 | AC_CONFIG_FILES([Makefile]) |
304 | ||
305 | AC_CONFIG_COMMANDS([default], | |
608e1e0c | 306 | [[if test -n "$CONFIG_FILES"; then |
bce1b489 BE |
307 | if test -n "${with_target_subdir}"; then |
308 | # FIXME: We shouldn't need to set ac_file | |
309 | ac_file=Makefile | |
6706f116 | 310 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
b150efee | 311 | . ${toplevel_srcdir}/config-ml.in |
bce1b489 | 312 | fi |
252dde64 NN |
313 | fi]], |
314 | [[srcdir=${srcdir} | |
bce1b489 BE |
315 | host=${host} |
316 | target=${target} | |
317 | with_target_subdir=${with_target_subdir} | |
318 | with_multisubdir=${with_multisubdir} | |
319 | ac_configure_args="--enable-multilib ${ac_configure_args}" | |
b150efee | 320 | toplevel_srcdir=${toplevel_srcdir} |
bce1b489 | 321 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
3343fdd2 | 322 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
252dde64 NN |
323 | ]]) |
324 | ||
325 | AC_OUTPUT |