]>
Commit | Line | Data |
---|---|---|
bce1b489 | 1 | # Process this file with autoconf to produce a configure script. |
9c01f395 | 2 | # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004 |
3343fdd2 | 3 | # Free Software Foundation, Inc. |
9c01f395 | 4 | # Originally contributed by Dave Love (d.love@dl.ac.uk). |
bce1b489 | 5 | # |
9c01f395 | 6 | #This file is part of GCC. |
bce1b489 | 7 | # |
9c01f395 | 8 | #GCC is free software; you can redistribute it and/or modify |
bce1b489 BE |
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 | # | |
9c01f395 | 13 | #GCC is distributed in the hope that it will be useful, |
bce1b489 BE |
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 | |
9c01f395 | 19 | #along with GCC; see the file COPYING. If not, write to |
bce1b489 BE |
20 | #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
21 | #02111-1307, USA. | |
22 | ||
88386050 | 23 | AC_PREREQ(2.59) |
789eb4f5 | 24 | AC_INIT(objc/objc.h) |
d972a4c2 | 25 | AC_CONFIG_HEADER(config.h) |
bce1b489 | 26 | |
1fcfac98 NN |
27 | dnl We need the following definitions because AC_PROG_LIBTOOL relies on them |
28 | PACKAGE=libobjc | |
29 | dnl Version is pulled out to make it a bit easier to change using sed. | |
30 | VERSION=1:0:0 | |
31 | AC_SUBST(VERSION) | |
32 | ||
6706f116 AO |
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 | ||
9c01f395 NN |
39 | dnl Default to --enable-multilib |
40 | AC_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. | |
53 | if 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 | |
63 | else | |
64 | toprel=".." | |
65 | fi | |
66 | AC_CONFIG_AUX_DIR(${srcdir}/$toprel) | |
88386050 | 67 | toplevel_srcdir=\${srcdir}/$toprel |
9c01f395 | 68 | AC_SUBST(toplevel_srcdir) |
aebb8c22 | 69 | |
b150efee | 70 | AC_CANONICAL_SYSTEM |
9c01f395 NN |
71 | _GCC_TOPLEV_NONCANONICAL_TARGET |
72 | AC_SUBST(target_noncanonical) | |
73 | ||
74 | # 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. | |
78 | glibcpp_builddir=`${PWDCMD-pwd}` | |
79 | case $srcdir in | |
80 | [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; | |
81 | *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
82 | esac | |
83 | AC_SUBST(glibcpp_builddir) | |
84 | AC_SUBST(glibcpp_srcdir) | |
85 | ||
9c01f395 NN |
86 | # We use these options to decide which functions to include. |
87 | AC_ARG_WITH(target-subdir, | |
88 | [ --with-target-subdir=SUBDIR | |
89 | configuring in a subdirectory]) | |
90 | AC_ARG_WITH(cross-host, | |
91 | [ --with-cross-host=HOST configuring with a cross compiler]) | |
92 | ||
88386050 NN |
93 | GCC_NO_EXECUTABLES |
94 | AC_PROG_CC | |
9c01f395 NN |
95 | |
96 | AC_CHECK_TOOL(AS, as) | |
97 | AC_CHECK_TOOL(AR, ar) | |
1fcfac98 | 98 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
9c01f395 | 99 | AC_PROG_INSTALL |
b150efee | 100 | |
9c01f395 NN |
101 | # Process the option "--enable-version-specific-runtime-libs" |
102 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
103 | AC_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. | |
112 | AC_MSG_RESULT($version_specific_libs) | |
113 | ||
114 | gcc_version_trigger=${srcdir}/../gcc/version.c | |
115 | gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'` | |
116 | gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` | |
117 | AC_SUBST(gcc_version) | |
118 | AC_SUBST(gcc_version_trigger) | |
119 | ||
120 | # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir | |
121 | case ${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 | ;; | |
145 | esac | |
146 | AC_SUBST(glibcpp_toolexecdir) | |
147 | AC_SUBST(glibcpp_toolexeclibdir) | |
148 | ||
149 | glibcpp_prefixdir=${prefix} | |
150 | AC_SUBST(glibcpp_prefixdir) | |
bce1b489 BE |
151 | |
152 | dnl Checks for programs. | |
7c6b0e92 | 153 | |
b150efee FS |
154 | # Disable shared libs by default |
155 | AC_DISABLE_SHARED | |
9c01f395 NN |
156 | # Enable Win32 DLL on MS Windows - FIXME |
157 | AC_LIBTOOL_WIN32_DLL | |
7c6b0e92 | 158 | |
b150efee | 159 | AC_PROG_LIBTOOL |
bce1b489 | 160 | |
b150efee | 161 | AC_PROG_MAKE_SET |
bce1b489 BE |
162 | |
163 | dnl Checks for header files. | |
164 | # Sanity check for the cross-compilation case: | |
165 | AC_CHECK_HEADER(stdio.h,:, | |
166 | [AC_MSG_ERROR([Can't find stdio.h. | |
167 | You must have a usable C system for the target already installed, at least | |
168 | including headers and, preferably, the library, before you can configure | |
169 | the Objective C runtime system. If necessary, install gcc now with | |
170 | \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) | |
171 | ||
172 | AC_HEADER_STDC | |
173 | ||
d972a4c2 OP |
174 | AC_CHECK_HEADERS(sched.h) |
175 | ||
15794a95 | 176 | # Determine CFLAGS for gthread. |
b43e7294 NN |
177 | # FIXME: the current implementation is dependent on the 'r' variable |
178 | # passed down from the top level | |
15794a95 | 179 | AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags, |
79014e6f | 180 | [if test -f "$r"/gcc/Makefile |
bce1b489 | 181 | then |
15794a95 | 182 | objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'` |
bce1b489 BE |
183 | else |
184 | AC_MSG_ERROR([not found]) | |
185 | fi]) | |
15794a95 L |
186 | GTHREAD_FLAGS=$objc_cv_gthread_flags |
187 | AC_SUBST(GTHREAD_FLAGS) | |
bce1b489 BE |
188 | |
189 | AC_ARG_ENABLE(objc-gc, | |
190 | [ --enable-objc-gc enable the use of Boehm's garbage collector with | |
191 | the GNU Objective-C runtime.], | |
b43e7294 NN |
192 | [case $enable_objc_gc in |
193 | no) OBJC_BOEHM_GC='' ;; | |
194 | *) OBJC_BOEHM_GC=libobjc_gc.la ;; | |
195 | esac], | |
196 | [OBJC_BOEHM_GC='']) | |
bce1b489 BE |
197 | AC_SUBST(OBJC_BOEHM_GC) |
198 | ||
bce1b489 BE |
199 | # We need multilib support, but only if configuring for the target. |
200 | AC_OUTPUT(Makefile, | |
b150efee | 201 | [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h |
bce1b489 BE |
202 | if 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 | |
6706f116 | 206 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
b150efee | 207 | . ${toplevel_srcdir}/config-ml.in |
bce1b489 BE |
208 | fi |
209 | fi], | |
210 | srcdir=${srcdir} | |
211 | host=${host} | |
212 | target=${target} | |
213 | with_target_subdir=${with_target_subdir} | |
214 | with_multisubdir=${with_multisubdir} | |
215 | ac_configure_args="--enable-multilib ${ac_configure_args}" | |
b150efee | 216 | toplevel_srcdir=${toplevel_srcdir} |
bce1b489 | 217 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
3343fdd2 | 218 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
bce1b489 | 219 | ) |