blob: d56f6b25de676d09f8b5bffd401dc1b95c626351 [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)
Nathanael Nerode252dde62004-04-09 12:40:59 +000024AC_INIT
25AC_CONFIG_SRCDIR([objc/objc.h])
Ovidiu Predescud972a4c2000-08-15 07:38:04 +000026AC_CONFIG_HEADER(config.h)
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 Nerode9c01f392004-04-09 11:43:02 +0000109_GCC_TOPLEV_NONCANONICAL_TARGET
110AC_SUBST(target_noncanonical)
Franz Sirlb150efe2002-02-11 18:10:05 +0000111
Nathanael Nerodeaf0c82b2004-04-09 12:49:16 +0000112# Export source directory.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000113# These need to be absolute paths, yet at the same time need to
114# canonicalize only relative paths, because then amd will not unmount
115# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000116case $srcdir in
Nathanael Nerode252dde62004-04-09 12:40:59 +0000117 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
118 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000119esac
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000120AC_SUBST(glibcpp_srcdir)
121
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000122# Process the option "--enable-version-specific-runtime-libs"
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000123gcc_version_trigger=${srcdir}/../gcc/version.c
124gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
125gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
126AC_SUBST(gcc_version)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000127
128# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
129case ${version_specific_libs} in
130 yes)
131 # Need the gcc compiler version to know where to install libraries
132 # and header files if --enable-version-specific-runtime-libs option
133 # is selected.
134 glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
135 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
136 ;;
137 no)
138 if test -n "$with_cross_host" &&
139 test x"$with_cross_host" != x"no"; then
140 glibcpp_toolexecdir='$(exec_prefix)/$(target_noncanonical)'
141 glibcpp_toolexeclibdir='$(toolexecdir)/lib'
142 else
143 # Install a library built with a cross compiler in tooldir, not libdir.
144 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
145 glibcpp_toolexeclibdir='$(libdir)'
146 fi
147 multi_os_directory=`$CC -print-multi-os-directory`
148 case $multi_os_directory in
149 .) ;; # Avoid trailing /.
150 *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
151 esac
152 ;;
153esac
154AC_SUBST(glibcpp_toolexecdir)
155AC_SUBST(glibcpp_toolexeclibdir)
156
157glibcpp_prefixdir=${prefix}
158AC_SUBST(glibcpp_prefixdir)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000159
Nathanael Nerode252dde62004-04-09 12:40:59 +0000160# --------
161# Programs
162# --------
163
164GCC_NO_EXECUTABLES
165AC_PROG_CC
166
167AC_CHECK_TOOL(AS, as)
168AC_CHECK_TOOL(AR, ar)
169AC_CHECK_TOOL(RANLIB, ranlib, :)
170AC_PROG_INSTALL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000171
Franz Sirlb150efe2002-02-11 18:10:05 +0000172# Disable shared libs by default
173AC_DISABLE_SHARED
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000174# Enable Win32 DLL on MS Windows - FIXME
175AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000176
Franz Sirlb150efe2002-02-11 18:10:05 +0000177AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000178
Franz Sirlb150efe2002-02-11 18:10:05 +0000179AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000180
Nathanael Nerode252dde62004-04-09 12:40:59 +0000181# -------
182# Headers
183# -------
184
Ben Ellistonbce1b481998-09-30 02:13:15 +0000185# Sanity check for the cross-compilation case:
186AC_CHECK_HEADER(stdio.h,:,
187 [AC_MSG_ERROR([Can't find stdio.h.
188You must have a usable C system for the target already installed, at least
189including headers and, preferably, the library, before you can configure
190the Objective C runtime system. If necessary, install gcc now with
191\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
192
193AC_HEADER_STDC
194
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000195AC_CHECK_HEADERS(sched.h)
196
Nathanael Nerode252dde62004-04-09 12:40:59 +0000197# -----------
198# Miscellanea
199# -----------
200
H.J. Lu15794a92000-07-20 07:27:26 +0000201# Determine CFLAGS for gthread.
Nathanael Nerodeb43e7292004-04-09 11:59:27 +0000202# FIXME: the current implementation is dependent on the 'r' variable
203# passed down from the top level
H.J. Lu15794a92000-07-20 07:27:26 +0000204AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
Jeffrey A Law79014e61999-01-05 00:40:22 +0000205[if test -f "$r"/gcc/Makefile
Ben Ellistonbce1b481998-09-30 02:13:15 +0000206then
H.J. Lu15794a92000-07-20 07:27:26 +0000207 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
Ben Ellistonbce1b481998-09-30 02:13:15 +0000208else
209 AC_MSG_ERROR([not found])
210fi])
H.J. Lu15794a92000-07-20 07:27:26 +0000211GTHREAD_FLAGS=$objc_cv_gthread_flags
212AC_SUBST(GTHREAD_FLAGS)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000213
Nathanael Nerode252dde62004-04-09 12:40:59 +0000214# ------
215# Output
216# ------
Ben Ellistonbce1b481998-09-30 02:13:15 +0000217
Nathanael Nerode252dde62004-04-09 12:40:59 +0000218AC_CONFIG_FILES([Makefile])
219
220AC_CONFIG_COMMANDS([default],
221[[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
Ben Ellistonbce1b481998-09-30 02:13:15 +0000222if test -n "$CONFIG_FILES"; then
223 if test -n "${with_target_subdir}"; then
224 # FIXME: We shouldn't need to set ac_file
225 ac_file=Makefile
Alexandre Oliva6706f112002-05-08 04:38:00 +0000226 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000227 . ${toplevel_srcdir}/config-ml.in
Ben Ellistonbce1b481998-09-30 02:13:15 +0000228 fi
Nathanael Nerode252dde62004-04-09 12:40:59 +0000229fi]],
230[[srcdir=${srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000231host=${host}
232target=${target}
233with_target_subdir=${with_target_subdir}
234with_multisubdir=${with_multisubdir}
235ac_configure_args="--enable-multilib ${ac_configure_args}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000236toplevel_srcdir=${toplevel_srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000237CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
Alexandre Oliva3343fdd2003-02-20 09:08:45 +0000238ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
Nathanael Nerode252dde62004-04-09 12:40:59 +0000239]])
240
241AC_OUTPUT