blob: 658bc8b7cba861a9027ddd72a6bbf313076cc3f9 [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])
Ben Ellistonbce1b481998-09-30 02:13:15 +000026
Nathanael Nerode252dde62004-04-09 12:40:59 +000027# We need the following definitions because AC_PROG_LIBTOOL relies on them
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000028PACKAGE=libobjc
Nathanael Nerode252dde62004-04-09 12:40:59 +000029# Version is pulled out to make it a bit easier to change using sed.
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000030VERSION=1:0:0
31AC_SUBST(VERSION)
32
Alexandre Oliva6706f112002-05-08 04:38:00 +000033# This works around the fact that libtool configuration may change LD
34# for this particular configuration, but some shells, instead of
35# keeping the changes in LD private, export them just because LD is
36# exported.
37ORIGINAL_LD_FOR_MULTILIBS=$LD
38
Nathanael Nerode252dde62004-04-09 12:40:59 +000039# -------
40# Options
41# -------
42
43# Default to --enable-multilib
Nathanael Nerode9c01f392004-04-09 11:43:02 +000044AC_ARG_ENABLE(multilib,
45 [ --enable-multilib build hella library versions (default)],
46 [case "${enableval}" in
47 yes) multilib=yes ;;
48 no) multilib=no ;;
49 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
Nathanael Nerode252dde62004-04-09 12:40:59 +000050 esac],
51 [multilib=yes])
52
53# We use these options to decide which functions to include.
54AC_ARG_WITH(target-subdir,
55[ --with-target-subdir=SUBDIR
56 configuring in a subdirectory])
57AC_ARG_WITH(cross-host,
58[ --with-cross-host=HOST configuring with a cross compiler])
59
60AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
61AC_ARG_ENABLE(version-specific-runtime-libs,
62[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
63[case "$enableval" in
64 yes) version_specific_libs=yes ;;
65 no) version_specific_libs=no ;;
66 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
67 esac],
68[version_specific_libs=no])
69AC_MSG_RESULT($version_specific_libs)
70
71AC_ARG_ENABLE(objc-gc,
72[ --enable-objc-gc enable the use of Boehm's garbage collector with
73 the GNU Objective-C runtime.],
74[case $enable_objc_gc in
75 no) OBJC_BOEHM_GC='' ;;
76 *) OBJC_BOEHM_GC=libobjc_gc.la ;;
77esac],
78[OBJC_BOEHM_GC=''])
79AC_SUBST(OBJC_BOEHM_GC)
80
81# -----------
82# Directories
83# -----------
Nathanael Nerode9c01f392004-04-09 11:43:02 +000084
85# When building with srcdir == objdir, links to the source files will
86# be created in directories within the target_subdir. We have to
87# adjust toplevel_srcdir accordingly, so that configure finds
88# install-sh and other auxiliary files that live in the top-level
89# source directory.
90if test "${srcdir}" = "."; then
91 if test -z "${with_target_subdir}"; then
92 toprel=".."
93 else
94 if test "${with_target_subdir}" != "."; then
95 toprel="${with_multisrctop}../.."
96 else
97 toprel="${with_multisrctop}.."
98 fi
99 fi
100else
101 toprel=".."
102fi
103AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
Nathanael Nerode88386052004-04-09 12:24:52 +0000104toplevel_srcdir=\${srcdir}/$toprel
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000105AC_SUBST(toplevel_srcdir)
DJ Delorieaebb8c22002-06-25 23:53:45 -0400106
Franz Sirlb150efe2002-02-11 18:10:05 +0000107AC_CANONICAL_SYSTEM
Nathanael Nerode1506eac2004-08-28 11:18:12 +0000108ACX_NONCANONICAL_TARGET
Franz Sirlb150efe2002-02-11 18:10:05 +0000109
Nathanael Nerodeaf0c82b2004-04-09 12:49:16 +0000110# Export source directory.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000111# These need to be absolute paths, yet at the same time need to
112# canonicalize only relative paths, because then amd will not unmount
113# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000114case $srcdir in
Nathanael Nerode252dde62004-04-09 12:40:59 +0000115 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
116 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000117esac
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000118AC_SUBST(glibcpp_srcdir)
119
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000120# Process the option "--enable-version-specific-runtime-libs"
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000121gcc_version_trigger=${srcdir}/../gcc/version.c
122gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
123gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
124AC_SUBST(gcc_version)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000125
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000126# Calculate toolexeclibdir
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000127# Also toolexecdir, though it's only used in toolexeclibdir
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000128case ${version_specific_libs} in
129 yes)
130 # Need the gcc compiler version to know where to install libraries
131 # and header files if --enable-version-specific-runtime-libs option
132 # is selected.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000133 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000134 toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000135 ;;
136 no)
137 if test -n "$with_cross_host" &&
138 test x"$with_cross_host" != x"no"; then
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000139 # Install a library built with a cross compiler in tooldir, not libdir.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000140 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000141 toolexeclibdir='$(toolexecdir)/lib'
142 else
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000143 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000144 toolexeclibdir='$(libdir)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000145 fi
146 multi_os_directory=`$CC -print-multi-os-directory`
147 case $multi_os_directory in
148 .) ;; # Avoid trailing /.
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000149 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000150 esac
151 ;;
152esac
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000153AC_SUBST(toolexecdir)
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000154AC_SUBST(toolexeclibdir)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000155
Andrew Pinskiff65de72004-05-25 22:39:02 +0000156# Figure out if we want to name the include directory and the
157# library name changes differently.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000158includedirname=include
Andrew Pinskiff65de72004-05-25 22:39:02 +0000159libext=
160case "${host}" in
161 *-darwin*)
162 # Darwin is the only target so far that needs a different include directory.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000163 includedirname=include-gnu-runtime
Andrew Pinskiff65de72004-05-25 22:39:02 +0000164 libext=-gnu
165 ;;
166esac
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000167AC_SUBST(includedirname)
Andrew Pinskiff65de72004-05-25 22:39:02 +0000168AC_SUBST(libext)
169
Andrew Pinski049bc402004-10-01 03:46:39 +0000170AC_CONFIG_HEADERS(config.h)
171
Nathanael Nerode252dde62004-04-09 12:40:59 +0000172# --------
173# Programs
174# --------
175
176GCC_NO_EXECUTABLES
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000177
178# We must force CC to /not/ be a precious variable; otherwise
179# the wrong, non-multilib-adjusted value will be used in multilibs.
180# As a side effect, we have to subst CFLAGS ourselves.
181m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
182m4_define([_AC_ARG_VAR_PRECIOUS],[])
Nathanael Nerode252dde62004-04-09 12:40:59 +0000183AC_PROG_CC
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000184m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
185
186AC_SUBST(CFLAGS)
Nathanael Nerode252dde62004-04-09 12:40:59 +0000187
188AC_CHECK_TOOL(AS, as)
189AC_CHECK_TOOL(AR, ar)
190AC_CHECK_TOOL(RANLIB, ranlib, :)
191AC_PROG_INSTALL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000192
Mike Stumpdd365152004-10-20 01:26:37 +0000193AM_MAINTAINER_MODE
194
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000195# Enable Win32 DLL on MS Windows - FIXME
196AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000197
Franz Sirlb150efe2002-02-11 18:10:05 +0000198AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000199
Mike Stumpdd365152004-10-20 01:26:37 +0000200AM_PROG_CC_C_O
201
Franz Sirlb150efe2002-02-11 18:10:05 +0000202AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000203
Nathanael Nerode252dde62004-04-09 12:40:59 +0000204# -------
205# Headers
206# -------
207
Ben Ellistonbce1b481998-09-30 02:13:15 +0000208# Sanity check for the cross-compilation case:
209AC_CHECK_HEADER(stdio.h,:,
210 [AC_MSG_ERROR([Can't find stdio.h.
211You must have a usable C system for the target already installed, at least
212including headers and, preferably, the library, before you can configure
213the Objective C runtime system. If necessary, install gcc now with
214\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
215
216AC_HEADER_STDC
217
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000218AC_CHECK_HEADERS(sched.h)
219
Nathanael Nerode252dde62004-04-09 12:40:59 +0000220# -----------
221# Miscellanea
222# -----------
223
H.J. Lu15794a92000-07-20 07:27:26 +0000224# Determine CFLAGS for gthread.
Nathanael Nerodeb43e7292004-04-09 11:59:27 +0000225# FIXME: the current implementation is dependent on the 'r' variable
226# passed down from the top level
H.J. Lu15794a92000-07-20 07:27:26 +0000227AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
Jeffrey A Law79014e61999-01-05 00:40:22 +0000228[if test -f "$r"/gcc/Makefile
Ben Ellistonbce1b481998-09-30 02:13:15 +0000229then
H.J. Lu15794a92000-07-20 07:27:26 +0000230 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
Ben Ellistonbce1b481998-09-30 02:13:15 +0000231else
232 AC_MSG_ERROR([not found])
233fi])
H.J. Lu15794a92000-07-20 07:27:26 +0000234GTHREAD_FLAGS=$objc_cv_gthread_flags
235AC_SUBST(GTHREAD_FLAGS)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000236
Andrew Pinski049bc402004-10-01 03:46:39 +0000237AC_MSG_CHECKING([for exception model to use])
238AC_LANG_PUSH(C)
239AC_ARG_ENABLE(sjlj-exceptions,
240 AS_HELP_STRING([--enable-sjlj-exceptions],
241 [force use of builtin_setjmp for exceptions]),
242[:],
243[dnl Botheration. Now we've got to detect the exception model.
244dnl Link tests against libgcc.a are problematic since -- at least
245dnl as of this writing -- we've not been given proper -L bits for
246dnl single-tree newlib and libgloss.
247dnl
248dnl This is what AC_TRY_COMPILE would do if it didn't delete the
249dnl conftest files before we got a change to grep them first.
250cat > conftest.$ac_ext << EOF
251[#]line __oline__ "configure"
252@interface Frob
253@end
254@implementation Frob
255@end
256int proc();
257int foo()
258{
259 @try {
260 return proc();
261 }
262 @catch (Frob* ex) {
263 return 0;
264 }
265}
266EOF
267old_CFLAGS="$CFLAGS"
268dnl work around that we don't have Objective-C support in autoconf
269CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
270if AC_TRY_EVAL(ac_compile); then
271 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
272 enable_sjlj_exceptions=yes
273 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
274 enable_sjlj_exceptions=no
275 fi
276fi
277CFLAGS="$old_CFLAGS"
278rm -f conftest*])
279if test x$enable_sjlj_exceptions = xyes; then
280 AC_DEFINE(SJLJ_EXCEPTIONS, 1,
281 [Define if the compiler is configured for setjmp/longjmp exceptions.])
282 ac_exception_model_name=sjlj
283elif test x$enable_sjlj_exceptions = xno; then
284 ac_exception_model_name="call frame"
285else
286 AC_MSG_ERROR([unable to detect exception model])
287fi
288AC_LANG_POP(C)
289AC_MSG_RESULT($ac_exception_model_name)
290
Nathanael Nerode252dde62004-04-09 12:40:59 +0000291# ------
292# Output
293# ------
Ben Ellistonbce1b481998-09-30 02:13:15 +0000294
Nathanael Nerode252dde62004-04-09 12:40:59 +0000295AC_CONFIG_FILES([Makefile])
296
297AC_CONFIG_COMMANDS([default],
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000298[[if test -n "$CONFIG_FILES"; then
Ben Ellistonbce1b481998-09-30 02:13:15 +0000299 if test -n "${with_target_subdir}"; then
300 # FIXME: We shouldn't need to set ac_file
301 ac_file=Makefile
Alexandre Oliva6706f112002-05-08 04:38:00 +0000302 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000303 . ${toplevel_srcdir}/config-ml.in
Ben Ellistonbce1b481998-09-30 02:13:15 +0000304 fi
Nathanael Nerode252dde62004-04-09 12:40:59 +0000305fi]],
306[[srcdir=${srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000307host=${host}
308target=${target}
309with_target_subdir=${with_target_subdir}
310with_multisubdir=${with_multisubdir}
311ac_configure_args="--enable-multilib ${ac_configure_args}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000312toplevel_srcdir=${toplevel_srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000313CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
Alexandre Oliva3343fdd2003-02-20 09:08:45 +0000314ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
Nathanael Nerode252dde62004-04-09 12:40:59 +0000315]])
316
317AC_OUTPUT