blob: 5e56fb7b47217340be0e6e2ce71366ee59aa0ca7 [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
Alexandre Oliva3343fdd2003-02-20 09:08:45 +00003# 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
Ben Ellistonbce1b481998-09-30 02:13:15 +000020#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21#02111-1307, USA.
22
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.
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000031VERSION=1:0:0
32AC_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
76 no) OBJC_BOEHM_GC='' ;;
77 *) OBJC_BOEHM_GC=libobjc_gc.la ;;
78esac],
79[OBJC_BOEHM_GC=''])
80AC_SUBST(OBJC_BOEHM_GC)
81
82# -----------
83# Directories
84# -----------
Nathanael Nerode9c01f392004-04-09 11:43:02 +000085
86# When building with srcdir == objdir, links to the source files will
87# be created in directories within the target_subdir. We have to
88# adjust toplevel_srcdir accordingly, so that configure finds
89# install-sh and other auxiliary files that live in the top-level
90# source directory.
91if test "${srcdir}" = "."; then
92 if test -z "${with_target_subdir}"; then
93 toprel=".."
94 else
95 if test "${with_target_subdir}" != "."; then
96 toprel="${with_multisrctop}../.."
97 else
98 toprel="${with_multisrctop}.."
99 fi
100 fi
101else
102 toprel=".."
103fi
104AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
Nathanael Nerode88386052004-04-09 12:24:52 +0000105toplevel_srcdir=\${srcdir}/$toprel
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000106AC_SUBST(toplevel_srcdir)
DJ Delorieaebb8c22002-06-25 23:53:45 -0400107
Franz Sirlb150efe2002-02-11 18:10:05 +0000108AC_CANONICAL_SYSTEM
Nathanael Nerode1506eac2004-08-28 11:18:12 +0000109ACX_NONCANONICAL_TARGET
Franz Sirlb150efe2002-02-11 18:10:05 +0000110
Nathanael Nerodeaf0c82b2004-04-09 12:49:16 +0000111# Export source directory.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000112# These need to be absolute paths, yet at the same time need to
113# canonicalize only relative paths, because then amd will not unmount
114# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000115case $srcdir in
Nathanael Nerode252dde62004-04-09 12:40:59 +0000116 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
117 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000118esac
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000119AC_SUBST(glibcpp_srcdir)
120
Richard Sandifordafabd8e2004-12-02 11:05:13 +0000121TL_AC_GCC_VERSION([$srcdir/..])
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000122
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000123# Calculate toolexeclibdir
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000124# Also toolexecdir, though it's only used in toolexeclibdir
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000125case ${version_specific_libs} in
126 yes)
127 # Need the gcc compiler version to know where to install libraries
128 # and header files if --enable-version-specific-runtime-libs option
129 # is selected.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000130 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000131 toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000132 ;;
133 no)
134 if test -n "$with_cross_host" &&
135 test x"$with_cross_host" != x"no"; then
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000136 # Install a library built with a cross compiler in tooldir, not libdir.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000137 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000138 toolexeclibdir='$(toolexecdir)/lib'
139 else
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000140 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000141 toolexeclibdir='$(libdir)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000142 fi
143 multi_os_directory=`$CC -print-multi-os-directory`
144 case $multi_os_directory in
145 .) ;; # Avoid trailing /.
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000146 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000147 esac
148 ;;
149esac
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000150AC_SUBST(toolexecdir)
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000151AC_SUBST(toolexeclibdir)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000152
Andrew Pinskiff65de72004-05-25 22:39:02 +0000153# Figure out if we want to name the include directory and the
154# library name changes differently.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000155includedirname=include
Andrew Pinskiff65de72004-05-25 22:39:02 +0000156libext=
157case "${host}" in
158 *-darwin*)
159 # Darwin is the only target so far that needs a different include directory.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000160 includedirname=include-gnu-runtime
Andrew Pinskiff65de72004-05-25 22:39:02 +0000161 libext=-gnu
162 ;;
163esac
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000164AC_SUBST(includedirname)
Andrew Pinskiff65de72004-05-25 22:39:02 +0000165AC_SUBST(libext)
166
Andrew Pinski049bc402004-10-01 03:46:39 +0000167AC_CONFIG_HEADERS(config.h)
168
Nathanael Nerode252dde62004-04-09 12:40:59 +0000169# --------
170# Programs
171# --------
172
173GCC_NO_EXECUTABLES
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000174
175# We must force CC to /not/ be a precious variable; otherwise
176# the wrong, non-multilib-adjusted value will be used in multilibs.
177# As a side effect, we have to subst CFLAGS ourselves.
178m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
179m4_define([_AC_ARG_VAR_PRECIOUS],[])
Nathanael Nerode252dde62004-04-09 12:40:59 +0000180AC_PROG_CC
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000181m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
182
183AC_SUBST(CFLAGS)
Nathanael Nerode252dde62004-04-09 12:40:59 +0000184
185AC_CHECK_TOOL(AS, as)
186AC_CHECK_TOOL(AR, ar)
187AC_CHECK_TOOL(RANLIB, ranlib, :)
188AC_PROG_INSTALL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000189
Mike Stumpdd365152004-10-20 01:26:37 +0000190AM_MAINTAINER_MODE
191
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000192# Enable Win32 DLL on MS Windows - FIXME
193AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000194
Franz Sirlb150efe2002-02-11 18:10:05 +0000195AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000196
Mike Stumpdd365152004-10-20 01:26:37 +0000197AM_PROG_CC_C_O
198
Franz Sirlb150efe2002-02-11 18:10:05 +0000199AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000200
Nathanael Nerode252dde62004-04-09 12:40:59 +0000201# -------
202# Headers
203# -------
204
Ben Ellistonbce1b481998-09-30 02:13:15 +0000205# Sanity check for the cross-compilation case:
206AC_CHECK_HEADER(stdio.h,:,
207 [AC_MSG_ERROR([Can't find stdio.h.
208You must have a usable C system for the target already installed, at least
209including headers and, preferably, the library, before you can configure
210the Objective C runtime system. If necessary, install gcc now with
211\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
212
213AC_HEADER_STDC
214
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000215AC_CHECK_HEADERS(sched.h)
216
Nathanael Nerode252dde62004-04-09 12:40:59 +0000217# -----------
218# Miscellanea
219# -----------
220
H.J. Lu15794a92000-07-20 07:27:26 +0000221# Determine CFLAGS for gthread.
H.J. Lu15794a92000-07-20 07:27:26 +0000222AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
Paolo Bonzini215c3512005-02-28 13:26:36 +0000223[# we know we are compiled as a target library, so the toplevel build directory
224# is ../..
225if test -f ../../$host_subdir/gcc/Makefile
Ben Ellistonbce1b481998-09-30 02:13:15 +0000226then
Paolo Bonzini215c3512005-02-28 13:26:36 +0000227 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS ../../$host_subdir/gcc/Makefile | awk -F= '{ print $2 }'`
Ben Ellistonbce1b481998-09-30 02:13:15 +0000228else
229 AC_MSG_ERROR([not found])
230fi])
H.J. Lu15794a92000-07-20 07:27:26 +0000231GTHREAD_FLAGS=$objc_cv_gthread_flags
232AC_SUBST(GTHREAD_FLAGS)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000233
Andrew Pinski049bc402004-10-01 03:46:39 +0000234AC_MSG_CHECKING([for exception model to use])
235AC_LANG_PUSH(C)
236AC_ARG_ENABLE(sjlj-exceptions,
237 AS_HELP_STRING([--enable-sjlj-exceptions],
238 [force use of builtin_setjmp for exceptions]),
239[:],
240[dnl Botheration. Now we've got to detect the exception model.
241dnl Link tests against libgcc.a are problematic since -- at least
242dnl as of this writing -- we've not been given proper -L bits for
243dnl single-tree newlib and libgloss.
244dnl
245dnl This is what AC_TRY_COMPILE would do if it didn't delete the
246dnl conftest files before we got a change to grep them first.
247cat > conftest.$ac_ext << EOF
248[#]line __oline__ "configure"
249@interface Frob
250@end
251@implementation Frob
252@end
253int proc();
254int foo()
255{
256 @try {
257 return proc();
258 }
259 @catch (Frob* ex) {
260 return 0;
261 }
262}
263EOF
264old_CFLAGS="$CFLAGS"
265dnl work around that we don't have Objective-C support in autoconf
266CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
267if AC_TRY_EVAL(ac_compile); then
268 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
269 enable_sjlj_exceptions=yes
270 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
271 enable_sjlj_exceptions=no
272 fi
273fi
274CFLAGS="$old_CFLAGS"
275rm -f conftest*])
276if test x$enable_sjlj_exceptions = xyes; then
277 AC_DEFINE(SJLJ_EXCEPTIONS, 1,
278 [Define if the compiler is configured for setjmp/longjmp exceptions.])
279 ac_exception_model_name=sjlj
280elif test x$enable_sjlj_exceptions = xno; then
281 ac_exception_model_name="call frame"
282else
283 AC_MSG_ERROR([unable to detect exception model])
284fi
285AC_LANG_POP(C)
286AC_MSG_RESULT($ac_exception_model_name)
287
Nathanael Nerode252dde62004-04-09 12:40:59 +0000288# ------
289# Output
290# ------
Ben Ellistonbce1b481998-09-30 02:13:15 +0000291
Nathanael Nerode252dde62004-04-09 12:40:59 +0000292AC_CONFIG_FILES([Makefile])
293
294AC_CONFIG_COMMANDS([default],
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000295[[if test -n "$CONFIG_FILES"; then
Ben Ellistonbce1b481998-09-30 02:13:15 +0000296 if test -n "${with_target_subdir}"; then
297 # FIXME: We shouldn't need to set ac_file
298 ac_file=Makefile
Alexandre Oliva6706f112002-05-08 04:38:00 +0000299 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000300 . ${toplevel_srcdir}/config-ml.in
Ben Ellistonbce1b481998-09-30 02:13:15 +0000301 fi
Nathanael Nerode252dde62004-04-09 12:40:59 +0000302fi]],
303[[srcdir=${srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000304host=${host}
305target=${target}
306with_target_subdir=${with_target_subdir}
307with_multisubdir=${with_multisubdir}
308ac_configure_args="--enable-multilib ${ac_configure_args}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000309toplevel_srcdir=${toplevel_srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000310CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
Alexandre Oliva3343fdd2003-02-20 09:08:45 +0000311ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
Nathanael Nerode252dde62004-04-09 12:40:59 +0000312]])
313
314AC_OUTPUT