Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 2 | # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004 |
Alexandre Oliva | 3343fdd | 2003-02-20 09:08:45 +0000 | [diff] [blame] | 3 | # Free Software Foundation, Inc. |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 4 | # Originally contributed by Dave Love (d.love@dl.ac.uk). |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 5 | # |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 6 | #This file is part of GCC. |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 7 | # |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 8 | #GCC is free software; you can redistribute it and/or modify |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 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 | # |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 13 | #GCC is distributed in the hope that it will be useful, |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 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 |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 19 | #along with GCC; see the file COPYING. If not, write to |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 20 | #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
| 21 | #02111-1307, USA. |
| 22 | |
Mumit Khan | da4b192 | 1999-03-24 14:46:41 -0700 | [diff] [blame] | 23 | AC_PREREQ(2.13) |
Jeffrey A Law | 789eb4f | 1998-09-30 08:17:56 +0000 | [diff] [blame] | 24 | AC_INIT(objc/objc.h) |
Ovidiu Predescu | d972a4c | 2000-08-15 07:38:04 +0000 | [diff] [blame] | 25 | AC_CONFIG_HEADER(config.h) |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 26 | |
Nathanael Nerode | 1fcfac9 | 2004-04-09 11:50:51 +0000 | [diff] [blame^] | 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 | |
Alexandre Oliva | 6706f11 | 2002-05-08 04:38:00 +0000 | [diff] [blame] | 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 | |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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) |
| 67 | toplevel_srcdir=\${top_srcdir}/$toprel |
| 68 | AC_SUBST(toplevel_srcdir) |
DJ Delorie | aebb8c2 | 2002-06-25 23:53:45 -0400 | [diff] [blame] | 69 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 70 | AC_CANONICAL_SYSTEM |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 71 | _GCC_TOPLEV_NONCANONICAL_TARGET |
| 72 | AC_SUBST(target_noncanonical) |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 73 | |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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 | |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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 | |
| 93 | # Never versions of autoconf add an underscore to these functions. |
| 94 | # Prevent future problems ... |
| 95 | ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))]) |
| 96 | ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))]) |
| 97 | ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))]) |
| 98 | ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))]) |
| 99 | |
| 100 | # AC_PROG_CC |
| 101 | |
| 102 | # FIXME: We temporarily define our own version of AC_PROG_CC. This is |
| 103 | # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We |
| 104 | # are probably using a cross compiler, which will not be able to fully |
| 105 | # link an executable. This should really be fixed in autoconf |
| 106 | # itself. |
| 107 | |
| 108 | AC_DEFUN(LIB_AC_PROG_CC, |
| 109 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl |
| 110 | dnl Fool anybody using AC_PROG_CC. |
| 111 | AC_PROVIDE([AC_PROG_CC]) |
| 112 | AC_CHECK_PROG(CC, gcc, gcc) |
| 113 | if test -z "$CC"; then |
| 114 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) |
| 115 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) |
| 116 | fi |
| 117 | |
| 118 | AC_PROG_CC_GNU |
| 119 | |
| 120 | if test $ac_cv_prog_gcc = yes; then |
| 121 | GCC=yes |
| 122 | dnl Check whether -g works, even if CFLAGS is set, in case the package |
| 123 | dnl plays around with CFLAGS (such as to build both debugging and |
| 124 | dnl normal versions of a library), tasteless as that idea is. |
| 125 | ac_test_CFLAGS="${CFLAGS+set}" |
| 126 | ac_save_CFLAGS="$CFLAGS" |
| 127 | CFLAGS= |
| 128 | AC_PROG_CC_G |
| 129 | if test "$ac_test_CFLAGS" = set; then |
| 130 | CFLAGS="$ac_save_CFLAGS" |
| 131 | elif test $ac_cv_prog_cc_g = yes; then |
| 132 | CFLAGS="-g -O2" |
| 133 | else |
| 134 | CFLAGS="-O2" |
| 135 | fi |
| 136 | else |
| 137 | GCC= |
| 138 | test "${CFLAGS+set}" = set || CFLAGS="-g" |
| 139 | fi |
| 140 | ]) |
| 141 | |
| 142 | LIB_AC_PROG_CC |
| 143 | |
| 144 | AC_CHECK_TOOL(AS, as) |
| 145 | AC_CHECK_TOOL(AR, ar) |
Nathanael Nerode | 1fcfac9 | 2004-04-09 11:50:51 +0000 | [diff] [blame^] | 146 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 147 | AC_PROG_INSTALL |
| 148 | |
| 149 | |
| 150 | # Process the option "--enable-version-specific-runtime-libs" |
| 151 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) |
| 152 | AC_ARG_ENABLE(version-specific-runtime-libs, |
| 153 | [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], |
| 154 | [case "$enableval" in |
| 155 | yes) version_specific_libs=yes ;; |
| 156 | no) version_specific_libs=no ;; |
| 157 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; |
| 158 | esac], |
| 159 | [version_specific_libs=no]) |
| 160 | # Option set, now we can test it. |
| 161 | AC_MSG_RESULT($version_specific_libs) |
| 162 | |
| 163 | gcc_version_trigger=${srcdir}/../gcc/version.c |
| 164 | gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'` |
| 165 | gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` |
| 166 | AC_SUBST(gcc_version) |
| 167 | AC_SUBST(gcc_version_trigger) |
| 168 | |
| 169 | # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir |
| 170 | case ${version_specific_libs} in |
| 171 | yes) |
| 172 | # Need the gcc compiler version to know where to install libraries |
| 173 | # and header files if --enable-version-specific-runtime-libs option |
| 174 | # is selected. |
| 175 | glibcpp_toolexecdir='$(libdir)/gcc/$(target_noncanonical)' |
| 176 | glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' |
| 177 | ;; |
| 178 | no) |
| 179 | if test -n "$with_cross_host" && |
| 180 | test x"$with_cross_host" != x"no"; then |
| 181 | glibcpp_toolexecdir='$(exec_prefix)/$(target_noncanonical)' |
| 182 | glibcpp_toolexeclibdir='$(toolexecdir)/lib' |
| 183 | else |
| 184 | # Install a library built with a cross compiler in tooldir, not libdir. |
| 185 | glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' |
| 186 | glibcpp_toolexeclibdir='$(libdir)' |
| 187 | fi |
| 188 | multi_os_directory=`$CC -print-multi-os-directory` |
| 189 | case $multi_os_directory in |
| 190 | .) ;; # Avoid trailing /. |
| 191 | *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;; |
| 192 | esac |
| 193 | ;; |
| 194 | esac |
| 195 | AC_SUBST(glibcpp_toolexecdir) |
| 196 | AC_SUBST(glibcpp_toolexeclibdir) |
| 197 | |
| 198 | glibcpp_prefixdir=${prefix} |
| 199 | AC_SUBST(glibcpp_prefixdir) |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 200 | |
| 201 | dnl Checks for programs. |
Geoffrey Keating | 7c6b0e9 | 2001-02-09 07:14:35 +0000 | [diff] [blame] | 202 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 203 | # Disable shared libs by default |
| 204 | AC_DISABLE_SHARED |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 205 | # Enable Win32 DLL on MS Windows - FIXME |
| 206 | AC_LIBTOOL_WIN32_DLL |
Geoffrey Keating | 7c6b0e9 | 2001-02-09 07:14:35 +0000 | [diff] [blame] | 207 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 208 | AC_PROG_LIBTOOL |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 209 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 210 | AC_PROG_MAKE_SET |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 211 | |
| 212 | dnl Checks for header files. |
| 213 | # Sanity check for the cross-compilation case: |
| 214 | AC_CHECK_HEADER(stdio.h,:, |
| 215 | [AC_MSG_ERROR([Can't find stdio.h. |
| 216 | You must have a usable C system for the target already installed, at least |
| 217 | including headers and, preferably, the library, before you can configure |
| 218 | the Objective C runtime system. If necessary, install gcc now with |
| 219 | \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) |
| 220 | |
| 221 | AC_HEADER_STDC |
| 222 | |
Ovidiu Predescu | d972a4c | 2000-08-15 07:38:04 +0000 | [diff] [blame] | 223 | AC_CHECK_HEADERS(sched.h) |
| 224 | |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 225 | # Determine CFLAGS for gthread. |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 226 | |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 227 | AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags, |
Jeffrey A Law | 79014e6 | 1999-01-05 00:40:22 +0000 | [diff] [blame] | 228 | [if test -f "$r"/gcc/Makefile |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 229 | then |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 230 | objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'` |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 231 | else |
| 232 | AC_MSG_ERROR([not found]) |
| 233 | fi]) |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 234 | GTHREAD_FLAGS=$objc_cv_gthread_flags |
| 235 | AC_SUBST(GTHREAD_FLAGS) |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 236 | |
| 237 | AC_ARG_ENABLE(objc-gc, |
| 238 | [ --enable-objc-gc enable the use of Boehm's garbage collector with |
| 239 | the GNU Objective-C runtime.], |
| 240 | if [[[ x$enable_objc_gc = xno ]]]; then |
| 241 | OBJC_BOEHM_GC='' |
| 242 | else |
Nicola Pero | c161c99 | 2000-07-29 19:19:43 +0000 | [diff] [blame] | 243 | OBJC_BOEHM_GC=libobjc_gc.la |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 244 | fi, |
| 245 | OBJC_BOEHM_GC='') |
| 246 | AC_SUBST(OBJC_BOEHM_GC) |
| 247 | |
| 248 | |
| 249 | # We need multilib support, but only if configuring for the target. |
| 250 | AC_OUTPUT(Makefile, |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 251 | [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 252 | if test -n "$CONFIG_FILES"; then |
| 253 | if test -n "${with_target_subdir}"; then |
| 254 | # FIXME: We shouldn't need to set ac_file |
| 255 | ac_file=Makefile |
Alexandre Oliva | 6706f11 | 2002-05-08 04:38:00 +0000 | [diff] [blame] | 256 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 257 | . ${toplevel_srcdir}/config-ml.in |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 258 | fi |
| 259 | fi], |
| 260 | srcdir=${srcdir} |
| 261 | host=${host} |
| 262 | target=${target} |
| 263 | with_target_subdir=${with_target_subdir} |
| 264 | with_multisubdir=${with_multisubdir} |
| 265 | ac_configure_args="--enable-multilib ${ac_configure_args}" |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 266 | toplevel_srcdir=${toplevel_srcdir} |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 267 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
Alexandre Oliva | 3343fdd | 2003-02-20 09:08:45 +0000 | [diff] [blame] | 268 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 269 | ) |