blob: bc3eb2da070c79e4d0bef6859d797e0b72b664f5 [file] [log] [blame]
Ben Ellistonbce1b481998-09-30 02:13:15 +00001# Process this file with autoconf to produce a configure script.
Nathanael Nerode9c01f392004-04-09 11:43:02 +00002# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
David Ayers8c3e5222006-01-24 22:57:22 +01003# 2005, 2006 Free Software Foundation, Inc.
Nathanael Nerode9c01f392004-04-09 11:43:02 +00004# Originally contributed by Dave Love (d.love@dl.ac.uk).
Ben Ellistonbce1b481998-09-30 02:13:15 +00005#
Nathanael Nerode9c01f392004-04-09 11:43:02 +00006#This file is part of GCC.
Ben Ellistonbce1b481998-09-30 02:13:15 +00007#
Nathanael Nerode9c01f392004-04-09 11:43:02 +00008#GCC is free software; you can redistribute it and/or modify
Ben Ellistonbce1b481998-09-30 02:13:15 +00009#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#
Nathanael Nerode9c01f392004-04-09 11:43:02 +000013#GCC is distributed in the hope that it will be useful,
Ben Ellistonbce1b481998-09-30 02:13:15 +000014#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
Nathanael Nerode9c01f392004-04-09 11:43:02 +000019#along with GCC; see the file COPYING. If not, write to
Kelley Cookf9d09c42005-08-17 03:21:42 +000020#the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21#02110-1301, USA.
Ben Ellistonbce1b481998-09-30 02:13:15 +000022
Nathanael Nerode88386052004-04-09 12:24:52 +000023AC_PREREQ(2.59)
Andrew Pinski684c64b2004-06-11 20:11:12 +000024AC_INIT(package-unused, version-unused,, libobjc)
Nathanael Nerode252dde62004-04-09 12:40:59 +000025AC_CONFIG_SRCDIR([objc/objc.h])
Paolo Bonzini215c3512005-02-28 13:26:36 +000026GCC_TOPLEV_SUBDIRS
Ben Ellistonbce1b481998-09-30 02:13:15 +000027
Nathanael Nerode252dde62004-04-09 12:40:59 +000028# We need the following definitions because AC_PROG_LIBTOOL relies on them
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000029PACKAGE=libobjc
Nathanael Nerode252dde62004-04-09 12:40:59 +000030# Version is pulled out to make it a bit easier to change using sed.
David Ayers84700342005-11-20 13:49:41 +010031VERSION=2:0:0
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000032AC_SUBST(VERSION)
33
Alexandre Oliva6706f112002-05-08 04:38:00 +000034# 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.
38ORIGINAL_LD_FOR_MULTILIBS=$LD
39
Nathanael Nerode252dde62004-04-09 12:40:59 +000040# -------
41# Options
42# -------
43
44# Default to --enable-multilib
Nathanael Nerode9c01f392004-04-09 11:43:02 +000045AC_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) ;;
Nathanael Nerode252dde62004-04-09 12:40:59 +000051 esac],
52 [multilib=yes])
53
54# We use these options to decide which functions to include.
55AC_ARG_WITH(target-subdir,
56[ --with-target-subdir=SUBDIR
57 configuring in a subdirectory])
58AC_ARG_WITH(cross-host,
59[ --with-cross-host=HOST configuring with a cross compiler])
60
61AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
62AC_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])
70AC_MSG_RESULT($version_specific_libs)
71
72AC_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
David Ayers8c3e5222006-01-24 22:57:22 +010076 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 ;;
Nathanael Nerode252dde62004-04-09 12:40:59 +000084esac],
David Ayers8c3e5222006-01-24 22:57:22 +010085[OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
Nathanael Nerode252dde62004-04-09 12:40:59 +000086AC_SUBST(OBJC_BOEHM_GC)
David Ayers8c3e5222006-01-24 22:57:22 +010087AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
Nathanael Nerode252dde62004-04-09 12:40:59 +000088
89# -----------
90# Directories
91# -----------
Nathanael Nerode9c01f392004-04-09 11:43:02 +000092
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.
98if 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
108else
109 toprel=".."
110fi
111AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
Nathanael Nerode88386052004-04-09 12:24:52 +0000112toplevel_srcdir=\${srcdir}/$toprel
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000113AC_SUBST(toplevel_srcdir)
DJ Delorieaebb8c22002-06-25 23:53:45 -0400114
Franz Sirlb150efe2002-02-11 18:10:05 +0000115AC_CANONICAL_SYSTEM
Nathanael Nerode1506eac2004-08-28 11:18:12 +0000116ACX_NONCANONICAL_TARGET
Franz Sirlb150efe2002-02-11 18:10:05 +0000117
Nathanael Nerodeaf0c82b2004-04-09 12:49:16 +0000118# Export source directory.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000119# 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.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000122case $srcdir in
Nathanael Nerode252dde62004-04-09 12:40:59 +0000123 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
124 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000125esac
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000126AC_SUBST(glibcpp_srcdir)
127
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000128# Calculate toolexeclibdir
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000129# Also toolexecdir, though it's only used in toolexeclibdir
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000130case ${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.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000135 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
Zack Weinberg2b37e3d2005-03-21 17:42:26 +0000136 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000137 ;;
138 no)
139 if test -n "$with_cross_host" &&
140 test x"$with_cross_host" != x"no"; then
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000141 # Install a library built with a cross compiler in tooldir, not libdir.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000142 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000143 toolexeclibdir='$(toolexecdir)/lib'
144 else
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000145 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000146 toolexeclibdir='$(libdir)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000147 fi
148 multi_os_directory=`$CC -print-multi-os-directory`
149 case $multi_os_directory in
150 .) ;; # Avoid trailing /.
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000151 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000152 esac
153 ;;
154esac
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000155AC_SUBST(toolexecdir)
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000156AC_SUBST(toolexeclibdir)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000157
Andrew Pinskiff65de72004-05-25 22:39:02 +0000158# Figure out if we want to name the include directory and the
159# library name changes differently.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000160includedirname=include
Andrew Pinskiff65de72004-05-25 22:39:02 +0000161libext=
162case "${host}" in
163 *-darwin*)
164 # Darwin is the only target so far that needs a different include directory.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000165 includedirname=include-gnu-runtime
Andrew Pinskiff65de72004-05-25 22:39:02 +0000166 libext=-gnu
167 ;;
168esac
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000169AC_SUBST(includedirname)
Andrew Pinskiff65de72004-05-25 22:39:02 +0000170AC_SUBST(libext)
171
Andrew Pinski049bc402004-10-01 03:46:39 +0000172AC_CONFIG_HEADERS(config.h)
173
Nathanael Nerode252dde62004-04-09 12:40:59 +0000174# --------
175# Programs
176# --------
177
178GCC_NO_EXECUTABLES
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000179
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.
183m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
184m4_define([_AC_ARG_VAR_PRECIOUS],[])
Nathanael Nerode252dde62004-04-09 12:40:59 +0000185AC_PROG_CC
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000186m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
187
Andrew Pinskia5a813f2005-08-13 23:44:14 +0000188# extra LD Flags which are required for targets
189case "${host}" in
190 *-darwin*)
191 # Darwin needs -single_module when linking libobjc
192 extra_ldflags_libobjc=-Wl,-single_module
193 ;;
194esac
195AC_SUBST(extra_ldflags_libobjc)
196
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000197AC_SUBST(CFLAGS)
Nathanael Nerode252dde62004-04-09 12:40:59 +0000198
199AC_CHECK_TOOL(AS, as)
200AC_CHECK_TOOL(AR, ar)
201AC_CHECK_TOOL(RANLIB, ranlib, :)
202AC_PROG_INSTALL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000203
Mike Stumpdd365152004-10-20 01:26:37 +0000204AM_MAINTAINER_MODE
205
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000206# Enable Win32 DLL on MS Windows - FIXME
207AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000208
Franz Sirlb150efe2002-02-11 18:10:05 +0000209AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000210
Mike Stumpdd365152004-10-20 01:26:37 +0000211AM_PROG_CC_C_O
212
Franz Sirlb150efe2002-02-11 18:10:05 +0000213AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000214
Nathanael Nerode252dde62004-04-09 12:40:59 +0000215# -------
216# Headers
217# -------
218
Ben Ellistonbce1b481998-09-30 02:13:15 +0000219# Sanity check for the cross-compilation case:
220AC_CHECK_HEADER(stdio.h,:,
221 [AC_MSG_ERROR([Can't find stdio.h.
222You must have a usable C system for the target already installed, at least
223including headers and, preferably, the library, before you can configure
224the Objective C runtime system. If necessary, install gcc now with
225\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
226
227AC_HEADER_STDC
228
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000229AC_CHECK_HEADERS(sched.h)
230
Nathanael Nerode252dde62004-04-09 12:40:59 +0000231# -----------
232# Miscellanea
233# -----------
234
Andrew Pinski6886e182005-02-28 20:04:41 +0000235AC_MSG_CHECKING([for thread model used by GCC])
236target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
237AC_MSG_RESULT([$target_thread_file])
238
239if 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.])
242fi
243
Ben Ellistonbce1b481998-09-30 02:13:15 +0000244
Andrew Pinski049bc402004-10-01 03:46:39 +0000245AC_MSG_CHECKING([for exception model to use])
246AC_LANG_PUSH(C)
247AC_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.
252dnl Link tests against libgcc.a are problematic since -- at least
253dnl as of this writing -- we've not been given proper -L bits for
254dnl single-tree newlib and libgloss.
255dnl
256dnl This is what AC_TRY_COMPILE would do if it didn't delete the
257dnl conftest files before we got a change to grep them first.
258cat > conftest.$ac_ext << EOF
259[#]line __oline__ "configure"
260@interface Frob
261@end
262@implementation Frob
263@end
264int proc();
265int foo()
266{
267 @try {
268 return proc();
269 }
270 @catch (Frob* ex) {
271 return 0;
272 }
273}
274EOF
275old_CFLAGS="$CFLAGS"
276dnl work around that we don't have Objective-C support in autoconf
277CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
278if 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
284fi
285CFLAGS="$old_CFLAGS"
286rm -f conftest*])
287if 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
291elif test x$enable_sjlj_exceptions = xno; then
292 ac_exception_model_name="call frame"
293else
294 AC_MSG_ERROR([unable to detect exception model])
295fi
296AC_LANG_POP(C)
297AC_MSG_RESULT($ac_exception_model_name)
298
Nathanael Nerode252dde62004-04-09 12:40:59 +0000299# ------
300# Output
301# ------
Ben Ellistonbce1b481998-09-30 02:13:15 +0000302
Nathanael Nerode252dde62004-04-09 12:40:59 +0000303AC_CONFIG_FILES([Makefile])
304
305AC_CONFIG_COMMANDS([default],
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000306[[if test -n "$CONFIG_FILES"; then
Ben Ellistonbce1b481998-09-30 02:13:15 +0000307 if test -n "${with_target_subdir}"; then
308 # FIXME: We shouldn't need to set ac_file
309 ac_file=Makefile
Alexandre Oliva6706f112002-05-08 04:38:00 +0000310 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000311 . ${toplevel_srcdir}/config-ml.in
Ben Ellistonbce1b481998-09-30 02:13:15 +0000312 fi
Nathanael Nerode252dde62004-04-09 12:40:59 +0000313fi]],
314[[srcdir=${srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000315host=${host}
316target=${target}
317with_target_subdir=${with_target_subdir}
318with_multisubdir=${with_multisubdir}
319ac_configure_args="--enable-multilib ${ac_configure_args}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000320toplevel_srcdir=${toplevel_srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000321CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
Alexandre Oliva3343fdd2003-02-20 09:08:45 +0000322ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
Nathanael Nerode252dde62004-04-09 12:40:59 +0000323]])
324
325AC_OUTPUT