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 | |
Nathanael Nerode | 8838605 | 2004-04-09 12:24:52 +0000 | [diff] [blame] | 23 | AC_PREREQ(2.59) |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 24 | AC_INIT |
| 25 | AC_CONFIG_SRCDIR([objc/objc.h]) |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 26 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 27 | # We need the following definitions because AC_PROG_LIBTOOL relies on them |
Nathanael Nerode | 1fcfac9 | 2004-04-09 11:50:51 +0000 | [diff] [blame] | 28 | PACKAGE=libobjc |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 29 | # Version is pulled out to make it a bit easier to change using sed. |
Nathanael Nerode | 1fcfac9 | 2004-04-09 11:50:51 +0000 | [diff] [blame] | 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 | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 39 | # ------- |
| 40 | # Options |
| 41 | # ------- |
| 42 | |
| 43 | # Default to --enable-multilib |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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) ;; |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 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 | # ----------- |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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) |
Nathanael Nerode | 8838605 | 2004-04-09 12:24:52 +0000 | [diff] [blame] | 104 | toplevel_srcdir=\${srcdir}/$toprel |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 105 | AC_SUBST(toplevel_srcdir) |
DJ Delorie | aebb8c2 | 2002-06-25 23:53:45 -0400 | [diff] [blame] | 106 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 107 | AC_CANONICAL_SYSTEM |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 108 | _GCC_TOPLEV_NONCANONICAL_TARGET |
| 109 | AC_SUBST(target_noncanonical) |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 110 | |
Nathanael Nerode | af0c82b | 2004-04-09 12:49:16 +0000 | [diff] [blame] | 111 | # Export source directory. |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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. |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 115 | case $srcdir in |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 116 | [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; |
| 117 | *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 118 | esac |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 119 | AC_SUBST(glibcpp_srcdir) |
| 120 | |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 121 | # Process the option "--enable-version-specific-runtime-libs" |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 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) |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 126 | |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 127 | # Calculate toolexeclibdir |
Nathanael Nerode | a42a57c | 2004-04-14 20:08:02 +0000 | [diff] [blame] | 128 | # Also toolexecdir, though it's only used in toolexeclibdir |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 129 | case ${version_specific_libs} in |
| 130 | yes) |
| 131 | # Need the gcc compiler version to know where to install libraries |
| 132 | # and header files if --enable-version-specific-runtime-libs option |
| 133 | # is selected. |
Nathanael Nerode | a42a57c | 2004-04-14 20:08:02 +0000 | [diff] [blame] | 134 | toolexecdir='$(libdir)/gcc/$(target_noncanonical)' |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 135 | toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 136 | ;; |
| 137 | no) |
| 138 | if test -n "$with_cross_host" && |
| 139 | test x"$with_cross_host" != x"no"; then |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 140 | # Install a library built with a cross compiler in tooldir, not libdir. |
Nathanael Nerode | a42a57c | 2004-04-14 20:08:02 +0000 | [diff] [blame] | 141 | toolexecdir='$(exec_prefix)/$(target_noncanonical)' |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 142 | toolexeclibdir='$(toolexecdir)/lib' |
| 143 | else |
Nathanael Nerode | a42a57c | 2004-04-14 20:08:02 +0000 | [diff] [blame] | 144 | toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 145 | toolexeclibdir='$(libdir)' |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 146 | fi |
| 147 | multi_os_directory=`$CC -print-multi-os-directory` |
| 148 | case $multi_os_directory in |
| 149 | .) ;; # Avoid trailing /. |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 150 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 151 | esac |
| 152 | ;; |
| 153 | esac |
Nathanael Nerode | a42a57c | 2004-04-14 20:08:02 +0000 | [diff] [blame] | 154 | AC_SUBST(toolexecdir) |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 155 | AC_SUBST(toolexeclibdir) |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 156 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 157 | # -------- |
| 158 | # Programs |
| 159 | # -------- |
| 160 | |
| 161 | GCC_NO_EXECUTABLES |
Nathanael Nerode | db7f3c6 | 2004-04-15 17:05:36 +0000 | [diff] [blame^] | 162 | |
| 163 | # We must force CC to /not/ be a precious variable; otherwise |
| 164 | # the wrong, non-multilib-adjusted value will be used in multilibs. |
| 165 | # As a side effect, we have to subst CFLAGS ourselves. |
| 166 | m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) |
| 167 | m4_define([_AC_ARG_VAR_PRECIOUS],[]) |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 168 | AC_PROG_CC |
Nathanael Nerode | db7f3c6 | 2004-04-15 17:05:36 +0000 | [diff] [blame^] | 169 | m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
| 170 | |
| 171 | AC_SUBST(CFLAGS) |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 172 | |
| 173 | AC_CHECK_TOOL(AS, as) |
| 174 | AC_CHECK_TOOL(AR, ar) |
| 175 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 176 | AC_PROG_INSTALL |
Geoffrey Keating | 7c6b0e9 | 2001-02-09 07:14:35 +0000 | [diff] [blame] | 177 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 178 | # Disable shared libs by default |
| 179 | AC_DISABLE_SHARED |
Nathanael Nerode | 9c01f39 | 2004-04-09 11:43:02 +0000 | [diff] [blame] | 180 | # Enable Win32 DLL on MS Windows - FIXME |
| 181 | AC_LIBTOOL_WIN32_DLL |
Geoffrey Keating | 7c6b0e9 | 2001-02-09 07:14:35 +0000 | [diff] [blame] | 182 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 183 | AC_PROG_LIBTOOL |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 184 | |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 185 | AC_PROG_MAKE_SET |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 186 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 187 | # ------- |
| 188 | # Headers |
| 189 | # ------- |
| 190 | |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 191 | # Sanity check for the cross-compilation case: |
| 192 | AC_CHECK_HEADER(stdio.h,:, |
| 193 | [AC_MSG_ERROR([Can't find stdio.h. |
| 194 | You must have a usable C system for the target already installed, at least |
| 195 | including headers and, preferably, the library, before you can configure |
| 196 | the Objective C runtime system. If necessary, install gcc now with |
| 197 | \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) |
| 198 | |
| 199 | AC_HEADER_STDC |
| 200 | |
Ovidiu Predescu | d972a4c | 2000-08-15 07:38:04 +0000 | [diff] [blame] | 201 | AC_CHECK_HEADERS(sched.h) |
| 202 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 203 | # ----------- |
| 204 | # Miscellanea |
| 205 | # ----------- |
| 206 | |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 207 | # Determine CFLAGS for gthread. |
Nathanael Nerode | b43e729 | 2004-04-09 11:59:27 +0000 | [diff] [blame] | 208 | # FIXME: the current implementation is dependent on the 'r' variable |
| 209 | # passed down from the top level |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 210 | AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags, |
Jeffrey A Law | 79014e6 | 1999-01-05 00:40:22 +0000 | [diff] [blame] | 211 | [if test -f "$r"/gcc/Makefile |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 212 | then |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 213 | 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] | 214 | else |
| 215 | AC_MSG_ERROR([not found]) |
| 216 | fi]) |
H.J. Lu | 15794a9 | 2000-07-20 07:27:26 +0000 | [diff] [blame] | 217 | GTHREAD_FLAGS=$objc_cv_gthread_flags |
| 218 | AC_SUBST(GTHREAD_FLAGS) |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 219 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 220 | # ------ |
| 221 | # Output |
| 222 | # ------ |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 223 | |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 224 | AC_CONFIG_FILES([Makefile]) |
| 225 | |
| 226 | AC_CONFIG_COMMANDS([default], |
Nathanael Nerode | 608e1e0 | 2004-04-09 13:08:31 +0000 | [diff] [blame] | 227 | [[if test -n "$CONFIG_FILES"; then |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 228 | if test -n "${with_target_subdir}"; then |
| 229 | # FIXME: We shouldn't need to set ac_file |
| 230 | ac_file=Makefile |
Alexandre Oliva | 6706f11 | 2002-05-08 04:38:00 +0000 | [diff] [blame] | 231 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 232 | . ${toplevel_srcdir}/config-ml.in |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 233 | fi |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 234 | fi]], |
| 235 | [[srcdir=${srcdir} |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 236 | host=${host} |
| 237 | target=${target} |
| 238 | with_target_subdir=${with_target_subdir} |
| 239 | with_multisubdir=${with_multisubdir} |
| 240 | ac_configure_args="--enable-multilib ${ac_configure_args}" |
Franz Sirl | b150efe | 2002-02-11 18:10:05 +0000 | [diff] [blame] | 241 | toplevel_srcdir=${toplevel_srcdir} |
Ben Elliston | bce1b48 | 1998-09-30 02:13:15 +0000 | [diff] [blame] | 242 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
Alexandre Oliva | 3343fdd | 2003-02-20 09:08:45 +0000 | [diff] [blame] | 243 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
Nathanael Nerode | 252dde6 | 2004-04-09 12:40:59 +0000 | [diff] [blame] | 244 | ]]) |
| 245 | |
| 246 | AC_OUTPUT |