blob: beb02293d9c419e7289e2651a5555e5fa0632910 [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)
Jeffrey A Law789eb4f1998-09-30 08:17:56 +000024AC_INIT(objc/objc.h)
Ovidiu Predescud972a4c2000-08-15 07:38:04 +000025AC_CONFIG_HEADER(config.h)
Ben Ellistonbce1b481998-09-30 02:13:15 +000026
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000027dnl We need the following definitions because AC_PROG_LIBTOOL relies on them
28PACKAGE=libobjc
29dnl Version is pulled out to make it a bit easier to change using sed.
30VERSION=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 Nerode9c01f392004-04-09 11:43:02 +000039dnl Default to --enable-multilib
40AC_ARG_ENABLE(multilib,
41 [ --enable-multilib build hella library versions (default)],
42 [case "${enableval}" in
43 yes) multilib=yes ;;
44 no) multilib=no ;;
45 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
46 esac], [multilib=yes])dnl
47
48# When building with srcdir == objdir, links to the source files will
49# be created in directories within the target_subdir. We have to
50# adjust toplevel_srcdir accordingly, so that configure finds
51# install-sh and other auxiliary files that live in the top-level
52# source directory.
53if test "${srcdir}" = "."; then
54 if test -z "${with_target_subdir}"; then
55 toprel=".."
56 else
57 if test "${with_target_subdir}" != "."; then
58 toprel="${with_multisrctop}../.."
59 else
60 toprel="${with_multisrctop}.."
61 fi
62 fi
63else
64 toprel=".."
65fi
66AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
Nathanael Nerode88386052004-04-09 12:24:52 +000067toplevel_srcdir=\${srcdir}/$toprel
Nathanael Nerode9c01f392004-04-09 11:43:02 +000068AC_SUBST(toplevel_srcdir)
DJ Delorieaebb8c22002-06-25 23:53:45 -040069
Franz Sirlb150efe2002-02-11 18:10:05 +000070AC_CANONICAL_SYSTEM
Nathanael Nerode9c01f392004-04-09 11:43:02 +000071_GCC_TOPLEV_NONCANONICAL_TARGET
72AC_SUBST(target_noncanonical)
Franz Sirlb150efe2002-02-11 18:10:05 +000073
Nathanael Nerode9c01f392004-04-09 11:43:02 +000074# Export build and source directories.
75# These need to be absolute paths, yet at the same time need to
76# canonicalize only relative paths, because then amd will not unmount
77# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
78glibcpp_builddir=`${PWDCMD-pwd}`
79case $srcdir in
80[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
81*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
82esac
83AC_SUBST(glibcpp_builddir)
84AC_SUBST(glibcpp_srcdir)
85
Nathanael Nerode9c01f392004-04-09 11:43:02 +000086# We use these options to decide which functions to include.
87AC_ARG_WITH(target-subdir,
88[ --with-target-subdir=SUBDIR
89 configuring in a subdirectory])
90AC_ARG_WITH(cross-host,
91[ --with-cross-host=HOST configuring with a cross compiler])
92
Nathanael Nerode88386052004-04-09 12:24:52 +000093GCC_NO_EXECUTABLES
94AC_PROG_CC
Nathanael Nerode9c01f392004-04-09 11:43:02 +000095
96AC_CHECK_TOOL(AS, as)
97AC_CHECK_TOOL(AR, ar)
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000098AC_CHECK_TOOL(RANLIB, ranlib, :)
Nathanael Nerode9c01f392004-04-09 11:43:02 +000099AC_PROG_INSTALL
100
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000101# Process the option "--enable-version-specific-runtime-libs"
102AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
103AC_ARG_ENABLE(version-specific-runtime-libs,
104[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
105[case "$enableval" in
106 yes) version_specific_libs=yes ;;
107 no) version_specific_libs=no ;;
108 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
109 esac],
110[version_specific_libs=no])
111# Option set, now we can test it.
112AC_MSG_RESULT($version_specific_libs)
113
114gcc_version_trigger=${srcdir}/../gcc/version.c
115gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
116gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
117AC_SUBST(gcc_version)
118AC_SUBST(gcc_version_trigger)
119
120# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
121case ${version_specific_libs} in
122 yes)
123 # Need the gcc compiler version to know where to install libraries
124 # and header files if --enable-version-specific-runtime-libs option
125 # is selected.
126 glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
127 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
128 ;;
129 no)
130 if test -n "$with_cross_host" &&
131 test x"$with_cross_host" != x"no"; then
132 glibcpp_toolexecdir='$(exec_prefix)/$(target_noncanonical)'
133 glibcpp_toolexeclibdir='$(toolexecdir)/lib'
134 else
135 # Install a library built with a cross compiler in tooldir, not libdir.
136 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
137 glibcpp_toolexeclibdir='$(libdir)'
138 fi
139 multi_os_directory=`$CC -print-multi-os-directory`
140 case $multi_os_directory in
141 .) ;; # Avoid trailing /.
142 *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
143 esac
144 ;;
145esac
146AC_SUBST(glibcpp_toolexecdir)
147AC_SUBST(glibcpp_toolexeclibdir)
148
149glibcpp_prefixdir=${prefix}
150AC_SUBST(glibcpp_prefixdir)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000151
152dnl Checks for programs.
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000153
Franz Sirlb150efe2002-02-11 18:10:05 +0000154# Disable shared libs by default
155AC_DISABLE_SHARED
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000156# Enable Win32 DLL on MS Windows - FIXME
157AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000158
Franz Sirlb150efe2002-02-11 18:10:05 +0000159AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000160
Franz Sirlb150efe2002-02-11 18:10:05 +0000161AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000162
163dnl Checks for header files.
164# Sanity check for the cross-compilation case:
165AC_CHECK_HEADER(stdio.h,:,
166 [AC_MSG_ERROR([Can't find stdio.h.
167You must have a usable C system for the target already installed, at least
168including headers and, preferably, the library, before you can configure
169the Objective C runtime system. If necessary, install gcc now with
170\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
171
172AC_HEADER_STDC
173
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000174AC_CHECK_HEADERS(sched.h)
175
H.J. Lu15794a92000-07-20 07:27:26 +0000176# Determine CFLAGS for gthread.
Nathanael Nerodeb43e7292004-04-09 11:59:27 +0000177# FIXME: the current implementation is dependent on the 'r' variable
178# passed down from the top level
H.J. Lu15794a92000-07-20 07:27:26 +0000179AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
Jeffrey A Law79014e61999-01-05 00:40:22 +0000180[if test -f "$r"/gcc/Makefile
Ben Ellistonbce1b481998-09-30 02:13:15 +0000181then
H.J. Lu15794a92000-07-20 07:27:26 +0000182 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
Ben Ellistonbce1b481998-09-30 02:13:15 +0000183else
184 AC_MSG_ERROR([not found])
185fi])
H.J. Lu15794a92000-07-20 07:27:26 +0000186GTHREAD_FLAGS=$objc_cv_gthread_flags
187AC_SUBST(GTHREAD_FLAGS)
Ben Ellistonbce1b481998-09-30 02:13:15 +0000188
189AC_ARG_ENABLE(objc-gc,
190[ --enable-objc-gc enable the use of Boehm's garbage collector with
191 the GNU Objective-C runtime.],
Nathanael Nerodeb43e7292004-04-09 11:59:27 +0000192[case $enable_objc_gc in
193 no) OBJC_BOEHM_GC='' ;;
194 *) OBJC_BOEHM_GC=libobjc_gc.la ;;
195esac],
196[OBJC_BOEHM_GC=''])
Ben Ellistonbce1b481998-09-30 02:13:15 +0000197AC_SUBST(OBJC_BOEHM_GC)
198
Ben Ellistonbce1b481998-09-30 02:13:15 +0000199# We need multilib support, but only if configuring for the target.
200AC_OUTPUT(Makefile,
Franz Sirlb150efe2002-02-11 18:10:05 +0000201 [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
Ben Ellistonbce1b481998-09-30 02:13:15 +0000202if test -n "$CONFIG_FILES"; then
203 if test -n "${with_target_subdir}"; then
204 # FIXME: We shouldn't need to set ac_file
205 ac_file=Makefile
Alexandre Oliva6706f112002-05-08 04:38:00 +0000206 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000207 . ${toplevel_srcdir}/config-ml.in
Ben Ellistonbce1b481998-09-30 02:13:15 +0000208 fi
209fi],
210srcdir=${srcdir}
211host=${host}
212target=${target}
213with_target_subdir=${with_target_subdir}
214with_multisubdir=${with_multisubdir}
215ac_configure_args="--enable-multilib ${ac_configure_args}"
Franz Sirlb150efe2002-02-11 18:10:05 +0000216toplevel_srcdir=${toplevel_srcdir}
Ben Ellistonbce1b481998-09-30 02:13:15 +0000217CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
Alexandre Oliva3343fdd2003-02-20 09:08:45 +0000218ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
Ben Ellistonbce1b481998-09-30 02:13:15 +0000219)