]> git.ipfire.org Git - thirdparty/gcc.git/blame - libobjc/configure.in
configure.in: Clean up handling of --enable-version-specific-runtime-libs and related...
[thirdparty/gcc.git] / libobjc / configure.in
CommitLineData
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
da4b1927 23AC_PREREQ(2.13)
789eb4f5 24AC_INIT(objc/objc.h)
d972a4c2 25AC_CONFIG_HEADER(config.h)
bce1b489 26
6706f116
AO
27# This works around the fact that libtool configuration may change LD
28# for this particular configuration, but some shells, instead of
29# keeping the changes in LD private, export them just because LD is
30# exported.
31ORIGINAL_LD_FOR_MULTILIBS=$LD
32
9c01f395
NN
33dnl Default to --enable-multilib
34AC_ARG_ENABLE(multilib,
35 [ --enable-multilib build hella library versions (default)],
36 [case "${enableval}" in
37 yes) multilib=yes ;;
38 no) multilib=no ;;
39 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
40 esac], [multilib=yes])dnl
41
42# When building with srcdir == objdir, links to the source files will
43# be created in directories within the target_subdir. We have to
44# adjust toplevel_srcdir accordingly, so that configure finds
45# install-sh and other auxiliary files that live in the top-level
46# source directory.
47if test "${srcdir}" = "."; then
48 if test -z "${with_target_subdir}"; then
49 toprel=".."
50 else
51 if test "${with_target_subdir}" != "."; then
52 toprel="${with_multisrctop}../.."
53 else
54 toprel="${with_multisrctop}.."
55 fi
56 fi
57else
58 toprel=".."
59fi
60AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
61toplevel_srcdir=\${top_srcdir}/$toprel
62AC_SUBST(toplevel_srcdir)
aebb8c22 63
b150efee 64AC_CANONICAL_SYSTEM
9c01f395
NN
65_GCC_TOPLEV_NONCANONICAL_TARGET
66AC_SUBST(target_noncanonical)
67
68# Export build and source directories.
69# These need to be absolute paths, yet at the same time need to
70# canonicalize only relative paths, because then amd will not unmount
71# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
72glibcpp_builddir=`${PWDCMD-pwd}`
73case $srcdir in
74[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
75*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
76esac
77AC_SUBST(glibcpp_builddir)
78AC_SUBST(glibcpp_srcdir)
79
80# Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
81# be 'cp -p' if linking isn't available.
82#ac_cv_prog_LN_S='cp -p'
83AC_PROG_LN_S
84
85# We use these options to decide which functions to include.
86AC_ARG_WITH(target-subdir,
87[ --with-target-subdir=SUBDIR
88 configuring in a subdirectory])
89AC_ARG_WITH(cross-host,
90[ --with-cross-host=HOST configuring with a cross compiler])
91
92 # Never versions of autoconf add an underscore to these functions.
93 # Prevent future problems ...
94 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
95 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
96 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
97 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
98
99# AC_PROG_CC
100
101# FIXME: We temporarily define our own version of AC_PROG_CC. This is
102# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
103# are probably using a cross compiler, which will not be able to fully
104# link an executable. This should really be fixed in autoconf
105# itself.
106
107AC_DEFUN(LIB_AC_PROG_CC,
108[AC_BEFORE([$0], [AC_PROG_CPP])dnl
109dnl Fool anybody using AC_PROG_CC.
110AC_PROVIDE([AC_PROG_CC])
111AC_CHECK_PROG(CC, gcc, gcc)
112if test -z "$CC"; then
113 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
114 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
115fi
116
117AC_PROG_CC_GNU
118
119if test $ac_cv_prog_gcc = yes; then
120 GCC=yes
121dnl Check whether -g works, even if CFLAGS is set, in case the package
122dnl plays around with CFLAGS (such as to build both debugging and
123dnl normal versions of a library), tasteless as that idea is.
124 ac_test_CFLAGS="${CFLAGS+set}"
125 ac_save_CFLAGS="$CFLAGS"
126 CFLAGS=
127 AC_PROG_CC_G
128 if test "$ac_test_CFLAGS" = set; then
129 CFLAGS="$ac_save_CFLAGS"
130 elif test $ac_cv_prog_cc_g = yes; then
131 CFLAGS="-g -O2"
132 else
133 CFLAGS="-O2"
134 fi
135else
136 GCC=
137 test "${CFLAGS+set}" = set || CFLAGS="-g"
138fi
139])
140
141LIB_AC_PROG_CC
142
143AC_CHECK_TOOL(AS, as)
144AC_CHECK_TOOL(AR, ar)
145AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
146AC_PROG_INSTALL
b150efee 147
9c01f395
NN
148
149# Process the option "--enable-version-specific-runtime-libs"
150AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
151AC_ARG_ENABLE(version-specific-runtime-libs,
152[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
153[case "$enableval" in
154 yes) version_specific_libs=yes ;;
155 no) version_specific_libs=no ;;
156 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
157 esac],
158[version_specific_libs=no])
159# Option set, now we can test it.
160AC_MSG_RESULT($version_specific_libs)
161
162gcc_version_trigger=${srcdir}/../gcc/version.c
163gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
164gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
165AC_SUBST(gcc_version)
166AC_SUBST(gcc_version_trigger)
167
168# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
169case ${version_specific_libs} in
170 yes)
171 # Need the gcc compiler version to know where to install libraries
172 # and header files if --enable-version-specific-runtime-libs option
173 # is selected.
174 glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
175 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
176 ;;
177 no)
178 if test -n "$with_cross_host" &&
179 test x"$with_cross_host" != x"no"; then
180 glibcpp_toolexecdir='$(exec_prefix)/$(target_noncanonical)'
181 glibcpp_toolexeclibdir='$(toolexecdir)/lib'
182 else
183 # Install a library built with a cross compiler in tooldir, not libdir.
184 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
185 glibcpp_toolexeclibdir='$(libdir)'
186 fi
187 multi_os_directory=`$CC -print-multi-os-directory`
188 case $multi_os_directory in
189 .) ;; # Avoid trailing /.
190 *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
191 esac
192 ;;
193esac
194AC_SUBST(glibcpp_toolexecdir)
195AC_SUBST(glibcpp_toolexeclibdir)
196
197glibcpp_prefixdir=${prefix}
198AC_SUBST(glibcpp_prefixdir)
bce1b489
BE
199
200dnl Checks for programs.
7c6b0e92 201
b150efee
FS
202# Disable shared libs by default
203AC_DISABLE_SHARED
9c01f395
NN
204# Enable Win32 DLL on MS Windows - FIXME
205AC_LIBTOOL_WIN32_DLL
7c6b0e92 206
b150efee 207AC_PROG_LIBTOOL
bce1b489 208
b150efee
FS
209dnl These should be inherited in the recursive make, but ensure they are
210dnl defined:
bce1b489
BE
211test "$AR" || AR=ar
212AC_SUBST(AR)
213if test "$RANLIB"; then :
214 AC_SUBST(RANLIB)
215else
216 AC_PROG_RANLIB
217fi
218AC_PROG_INSTALL
b150efee 219AC_PROG_MAKE_SET
bce1b489 220
68a1af87
MH
221dnl we need the following definitions because AC_PROG_LIBTOOL relies on them
222PACKAGE=libobjc
223dnl version is pulled out to make it a bit easier to change using sed.
224VERSION=1:0:0
225AC_SUBST(VERSION)
226
bce1b489
BE
227dnl Checks for header files.
228# Sanity check for the cross-compilation case:
229AC_CHECK_HEADER(stdio.h,:,
230 [AC_MSG_ERROR([Can't find stdio.h.
231You must have a usable C system for the target already installed, at least
232including headers and, preferably, the library, before you can configure
233the Objective C runtime system. If necessary, install gcc now with
234\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
235
236AC_HEADER_STDC
237
d972a4c2
OP
238AC_CHECK_HEADERS(sched.h)
239
15794a95 240# Determine CFLAGS for gthread.
bce1b489 241
15794a95 242AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags,
79014e6f 243[if test -f "$r"/gcc/Makefile
bce1b489 244then
15794a95 245 objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'`
bce1b489
BE
246else
247 AC_MSG_ERROR([not found])
248fi])
15794a95
L
249GTHREAD_FLAGS=$objc_cv_gthread_flags
250AC_SUBST(GTHREAD_FLAGS)
bce1b489
BE
251
252AC_ARG_ENABLE(objc-gc,
253[ --enable-objc-gc enable the use of Boehm's garbage collector with
254 the GNU Objective-C runtime.],
255if [[[ x$enable_objc_gc = xno ]]]; then
256 OBJC_BOEHM_GC=''
257else
c161c99b 258 OBJC_BOEHM_GC=libobjc_gc.la
bce1b489
BE
259fi,
260OBJC_BOEHM_GC='')
261AC_SUBST(OBJC_BOEHM_GC)
262
263
264# We need multilib support, but only if configuring for the target.
265AC_OUTPUT(Makefile,
b150efee 266 [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
bce1b489
BE
267if test -n "$CONFIG_FILES"; then
268 if test -n "${with_target_subdir}"; then
269 # FIXME: We shouldn't need to set ac_file
270 ac_file=Makefile
6706f116 271 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
b150efee 272 . ${toplevel_srcdir}/config-ml.in
bce1b489
BE
273 fi
274fi],
275srcdir=${srcdir}
276host=${host}
277target=${target}
278with_target_subdir=${with_target_subdir}
279with_multisubdir=${with_multisubdir}
280ac_configure_args="--enable-multilib ${ac_configure_args}"
b150efee 281toplevel_srcdir=${toplevel_srcdir}
bce1b489 282CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
3343fdd2 283ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
bce1b489 284)