OSDN Git Service

* Makefile.in: Remove toolexecdir, glibcpp_toolexecdir (unused).
[pf3gnuchains/gcc-fork.git] / libobjc / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 #   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
3 #   Free Software Foundation, Inc.
4 #   Originally contributed by Dave Love (d.love@dl.ac.uk).
5 #
6 #This file is part of GCC.
7 #
8 #GCC is free software; you can redistribute it and/or modify
9 #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 #
13 #GCC is distributed in the hope that it will be useful,
14 #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
19 #along with GCC; see the file COPYING.  If not, write to
20 #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 #02111-1307, USA.
22
23 AC_PREREQ(2.59)
24 AC_INIT
25 AC_CONFIG_SRCDIR([objc/objc.h])
26
27 # We need the following definitions because AC_PROG_LIBTOOL relies on them
28 PACKAGE=libobjc
29 # Version is pulled out to make it a bit easier to change using sed.
30 VERSION=1:0:0
31 AC_SUBST(VERSION)
32
33 # 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.
37 ORIGINAL_LD_FOR_MULTILIBS=$LD
38
39 # -------
40 # Options
41 # -------
42
43 # Default to --enable-multilib
44 AC_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) ;;
50    esac],
51   [multilib=yes])
52
53 # We use these options to decide which functions to include.
54 AC_ARG_WITH(target-subdir,
55 [  --with-target-subdir=SUBDIR
56                            configuring in a subdirectory])
57 AC_ARG_WITH(cross-host,
58 [  --with-cross-host=HOST  configuring with a cross compiler])
59
60 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
61 AC_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])
69 AC_MSG_RESULT($version_specific_libs)
70
71 AC_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 ;;
77 esac],
78 [OBJC_BOEHM_GC=''])
79 AC_SUBST(OBJC_BOEHM_GC)
80
81 # -----------
82 # Directories
83 # -----------
84
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.
90 if 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
100 else
101   toprel=".."
102 fi
103 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
104 toplevel_srcdir=\${srcdir}/$toprel
105 AC_SUBST(toplevel_srcdir)
106
107 AC_CANONICAL_SYSTEM
108 _GCC_TOPLEV_NONCANONICAL_TARGET
109 AC_SUBST(target_noncanonical)
110
111 # Export source directory.
112 # 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.
115 case $srcdir in
116   [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
117   *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
118 esac
119 AC_SUBST(glibcpp_srcdir)
120
121 # Process the option "--enable-version-specific-runtime-libs"
122 gcc_version_trigger=${srcdir}/../gcc/version.c
123 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
124 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
125 AC_SUBST(gcc_version)
126
127 # Calculate toolexeclibdir
128 case ${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.
133     toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
134     ;;
135   no)
136     if test -n "$with_cross_host" &&
137        test x"$with_cross_host" != x"no"; then
138       # Install a library built with a cross compiler in tooldir, not libdir.
139       toolexeclibdir='$(toolexecdir)/lib'
140     else
141       toolexeclibdir='$(libdir)'
142     fi
143     multi_os_directory=`$CC -print-multi-os-directory`
144     case $multi_os_directory in
145       .) ;; # Avoid trailing /.
146       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
147     esac
148     ;;
149 esac
150 AC_SUBST(toolexeclibdir)
151
152 glibcpp_prefixdir=${prefix}
153 AC_SUBST(glibcpp_prefixdir)
154
155 # --------
156 # Programs
157 # --------
158
159 GCC_NO_EXECUTABLES
160 AC_PROG_CC
161
162 AC_CHECK_TOOL(AS, as)
163 AC_CHECK_TOOL(AR, ar)
164 AC_CHECK_TOOL(RANLIB, ranlib, :)
165 AC_PROG_INSTALL
166
167 # Disable shared libs by default
168 AC_DISABLE_SHARED
169 # Enable Win32 DLL on MS Windows - FIXME
170 AC_LIBTOOL_WIN32_DLL
171
172 AC_PROG_LIBTOOL
173
174 AC_PROG_MAKE_SET
175
176 # -------
177 # Headers
178 # -------
179
180 # Sanity check for the cross-compilation case:
181 AC_CHECK_HEADER(stdio.h,:,
182   [AC_MSG_ERROR([Can't find stdio.h.
183 You must have a usable C system for the target already installed, at least
184 including headers and, preferably, the library, before you can configure
185 the Objective C runtime system.  If necessary, install gcc now with 
186 \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
187
188 AC_HEADER_STDC
189
190 AC_CHECK_HEADERS(sched.h)
191
192 # -----------
193 # Miscellanea
194 # -----------
195
196 # Determine CFLAGS for gthread.
197 # FIXME: the current implementation is dependent on the 'r' variable
198 # passed down from the top level
199 AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
200 [if test -f "$r"/gcc/Makefile
201 then
202   objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
203 else
204   AC_MSG_ERROR([not found])
205 fi])
206 GTHREAD_FLAGS=$objc_cv_gthread_flags
207 AC_SUBST(GTHREAD_FLAGS)
208
209 # ------
210 # Output
211 # ------
212
213 AC_CONFIG_FILES([Makefile])
214
215 AC_CONFIG_COMMANDS([default],
216 [[if test -n "$CONFIG_FILES"; then
217   if test -n "${with_target_subdir}"; then
218     # FIXME: We shouldn't need to set ac_file
219     ac_file=Makefile
220     LD="${ORIGINAL_LD_FOR_MULTILIBS}"
221     . ${toplevel_srcdir}/config-ml.in
222   fi
223 fi]],
224 [[srcdir=${srcdir}
225 host=${host}
226 target=${target}
227 with_target_subdir=${with_target_subdir}
228 with_multisubdir=${with_multisubdir}
229 ac_configure_args="--enable-multilib ${ac_configure_args}"
230 toplevel_srcdir=${toplevel_srcdir}
231 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
232 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
233 ]])
234
235 AC_OUTPUT