blob: 2d88519f6447032d2202f1c9f898529de8359d9a [file] [log] [blame]
Ben Ellistonbce1b481998-09-30 02:13:15 +00001# Process this file with autoconf to produce a configure script.
Jakub Jelinek5624e562015-01-05 13:33:28 +01002# Copyright (C) 1994-2015 Free Software Foundation, Inc.
Nathanael Nerode9c01f392004-04-09 11:43:02 +00003# Originally contributed by Dave Love (d.love@dl.ac.uk).
Ben Ellistonbce1b481998-09-30 02:13:15 +00004#
Nathanael Nerode9c01f392004-04-09 11:43:02 +00005#This file is part of GCC.
Ben Ellistonbce1b481998-09-30 02:13:15 +00006#
Nathanael Nerode9c01f392004-04-09 11:43:02 +00007#GCC is free software; you can redistribute it and/or modify
Ben Ellistonbce1b481998-09-30 02:13:15 +00008#it under the terms of the GNU General Public License as published by
Jakub Jelinek748086b2009-04-09 17:00:19 +02009#the Free Software Foundation; either version 3, or (at your option)
Ben Ellistonbce1b481998-09-30 02:13:15 +000010#any later version.
11#
Nathanael Nerode9c01f392004-04-09 11:43:02 +000012#GCC is distributed in the hope that it will be useful,
Ben Ellistonbce1b481998-09-30 02:13:15 +000013#but WITHOUT ANY WARRANTY; without even the implied warranty of
14#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#GNU General Public License for more details.
16#
17#You should have received a copy of the GNU General Public License
Jakub Jelinek748086b2009-04-09 17:00:19 +020018#along with GCC; see the file COPYING3. If not see
19#<http://www.gnu.org/licenses/>.
Ben Ellistonbce1b481998-09-30 02:13:15 +000020
Ralf Wildenhuesdf58e642009-08-24 19:08:51 +000021AC_PREREQ(2.64)
Andrew Pinski684c64b2004-06-11 20:11:12 +000022AC_INIT(package-unused, version-unused,, libobjc)
Nathanael Nerode252dde62004-04-09 12:40:59 +000023AC_CONFIG_SRCDIR([objc/objc.h])
Paolo Bonzini215c3512005-02-28 13:26:36 +000024GCC_TOPLEV_SUBDIRS
Ben Ellistonbce1b481998-09-30 02:13:15 +000025
Nathanael Nerode252dde62004-04-09 12:40:59 +000026# We need the following definitions because AC_PROG_LIBTOOL relies on them
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000027PACKAGE=libobjc
Nathanael Nerode252dde62004-04-09 12:40:59 +000028# Version is pulled out to make it a bit easier to change using sed.
Nicola Peroc7907a52011-06-08 08:24:15 +000029VERSION=4:0:0
Nathanael Nerode1fcfac92004-04-09 11:50:51 +000030AC_SUBST(VERSION)
31
Alexandre Oliva6706f112002-05-08 04:38:00 +000032# This works around the fact that libtool configuration may change LD
33# for this particular configuration, but some shells, instead of
34# keeping the changes in LD private, export them just because LD is
35# exported.
36ORIGINAL_LD_FOR_MULTILIBS=$LD
37
Nathanael Nerode252dde62004-04-09 12:40:59 +000038# -------
39# Options
40# -------
41
Nathanael Nerode252dde62004-04-09 12:40:59 +000042# We use these options to decide which functions to include.
43AC_ARG_WITH(target-subdir,
44[ --with-target-subdir=SUBDIR
45 configuring in a subdirectory])
46AC_ARG_WITH(cross-host,
47[ --with-cross-host=HOST configuring with a cross compiler])
48
49AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
50AC_ARG_ENABLE(version-specific-runtime-libs,
51[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
52[case "$enableval" in
53 yes) version_specific_libs=yes ;;
54 no) version_specific_libs=no ;;
55 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
56 esac],
57[version_specific_libs=no])
58AC_MSG_RESULT($version_specific_libs)
59
60AC_ARG_ENABLE(objc-gc,
61[ --enable-objc-gc enable the use of Boehm's garbage collector with
62 the GNU Objective-C runtime.],
63[case $enable_objc_gc in
David Ayers8c3e5222006-01-24 22:57:22 +010064 no)
Rainer Orthb98b9522011-04-15 09:26:05 +000065 OBJC_GCFLAGS=''
David Ayers8c3e5222006-01-24 22:57:22 +010066 OBJC_BOEHM_GC=''
67 OBJC_BOEHM_GC_INCLUDES=''
68 ;;
69 *)
Rainer Orthb98b9522011-04-15 09:26:05 +000070 OBJC_GCFLAGS='-DOBJC_WITH_GC=1'
71 OBJC_BOEHM_GC='libobjc_gc$(libsuffix).la'
David Ayers8c3e5222006-01-24 22:57:22 +010072 OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
73 ;;
Nathanael Nerode252dde62004-04-09 12:40:59 +000074esac],
Rainer Orthb98b9522011-04-15 09:26:05 +000075[OBJC_GCFLAGS=''; OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
76AC_SUBST(OBJC_GCFLAGS)
Nathanael Nerode252dde62004-04-09 12:40:59 +000077AC_SUBST(OBJC_BOEHM_GC)
David Ayers8c3e5222006-01-24 22:57:22 +010078AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
Nathanael Nerode252dde62004-04-09 12:40:59 +000079
80# -----------
81# Directories
82# -----------
Nathanael Nerode9c01f392004-04-09 11:43:02 +000083
Geoffrey Keating5b043f02006-10-15 07:42:57 +000084# Find the rest of the source tree framework.
85AM_ENABLE_MULTILIB(, ..)
DJ Delorieaebb8c22002-06-25 23:53:45 -040086
Franz Sirlb150efe2002-02-11 18:10:05 +000087AC_CANONICAL_SYSTEM
Nathanael Nerode1506eac2004-08-28 11:18:12 +000088ACX_NONCANONICAL_TARGET
Franz Sirlb150efe2002-02-11 18:10:05 +000089
Nathanael Nerodeaf0c82b2004-04-09 12:49:16 +000090# Export source directory.
Nathanael Nerode9c01f392004-04-09 11:43:02 +000091# These need to be absolute paths, yet at the same time need to
92# canonicalize only relative paths, because then amd will not unmount
93# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
Nathanael Nerode9c01f392004-04-09 11:43:02 +000094case $srcdir in
Nathanael Nerode252dde62004-04-09 12:40:59 +000095 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
96 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +000097esac
Nathanael Nerode9c01f392004-04-09 11:43:02 +000098AC_SUBST(glibcpp_srcdir)
99
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000100# Calculate toolexeclibdir
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000101# Also toolexecdir, though it's only used in toolexeclibdir
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000102case ${version_specific_libs} in
103 yes)
104 # Need the gcc compiler version to know where to install libraries
105 # and header files if --enable-version-specific-runtime-libs option
106 # is selected.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000107 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
Zack Weinberg2b37e3d2005-03-21 17:42:26 +0000108 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000109 ;;
110 no)
111 if test -n "$with_cross_host" &&
112 test x"$with_cross_host" != x"no"; then
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000113 # Install a library built with a cross compiler in tooldir, not libdir.
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000114 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000115 toolexeclibdir='$(toolexecdir)/lib'
116 else
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000117 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000118 toolexeclibdir='$(libdir)'
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000119 fi
120 multi_os_directory=`$CC -print-multi-os-directory`
121 case $multi_os_directory in
122 .) ;; # Avoid trailing /.
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000123 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000124 esac
125 ;;
126esac
Nathanael Nerodea42a57c2004-04-14 20:08:02 +0000127AC_SUBST(toolexecdir)
Nathanael Nerode608e1e02004-04-09 13:08:31 +0000128AC_SUBST(toolexeclibdir)
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000129
Andrew Pinskiff65de72004-05-25 22:39:02 +0000130# Figure out if we want to name the include directory and the
131# library name changes differently.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000132includedirname=include
Andrew Pinski45d5f862007-06-02 01:35:59 +0000133libsuffix=
Andrew Pinskiff65de72004-05-25 22:39:02 +0000134case "${host}" in
135 *-darwin*)
136 # Darwin is the only target so far that needs a different include directory.
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000137 includedirname=include-gnu-runtime
Andrew Pinskiaf333b92007-06-03 20:38:37 +0000138 libsuffix=-gnu
Andrew Pinskiff65de72004-05-25 22:39:02 +0000139 ;;
140esac
Andrew Pinski7d34a5a2004-05-26 01:21:46 +0000141AC_SUBST(includedirname)
H.J. Lu4620d812007-06-02 16:15:04 +0000142AC_SUBST(libsuffix)
Andrew Pinskiff65de72004-05-25 22:39:02 +0000143
Andrew Pinski049bc402004-10-01 03:46:39 +0000144AC_CONFIG_HEADERS(config.h)
145
Nathanael Nerode252dde62004-04-09 12:40:59 +0000146# --------
147# Programs
148# --------
149
150GCC_NO_EXECUTABLES
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000151
152# We must force CC to /not/ be a precious variable; otherwise
153# the wrong, non-multilib-adjusted value will be used in multilibs.
154# As a side effect, we have to subst CFLAGS ourselves.
155m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
156m4_define([_AC_ARG_VAR_PRECIOUS],[])
Nathanael Nerode252dde62004-04-09 12:40:59 +0000157AC_PROG_CC
Ralf Wildenhues1b3b24c2009-07-30 19:41:13 +0000158m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000159
Andrew Pinskia5a813f2005-08-13 23:44:14 +0000160# extra LD Flags which are required for targets
Dave Korn7de6ba72010-12-06 00:50:04 +0000161ACX_LT_HOST_FLAGS
Andrew Pinskia5a813f2005-08-13 23:44:14 +0000162case "${host}" in
163 *-darwin*)
164 # Darwin needs -single_module when linking libobjc
Dave Korn7de6ba72010-12-06 00:50:04 +0000165 extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module'
Andrew Pinskia5a813f2005-08-13 23:44:14 +0000166 ;;
Dave Korn19222952010-03-23 05:05:35 +0000167 *-cygwin*|*-mingw*)
168 # Tell libtool to build DLLs on Windows
Dave Korn7de6ba72010-12-06 00:50:04 +0000169 extra_ldflags_libobjc='$(lt_host_flags)'
Dave Korn19222952010-03-23 05:05:35 +0000170 ;;
Andrew Pinskia5a813f2005-08-13 23:44:14 +0000171esac
172AC_SUBST(extra_ldflags_libobjc)
173
Nathanael Nerodedb7f3c62004-04-15 17:05:36 +0000174AC_SUBST(CFLAGS)
Nathanael Nerode252dde62004-04-09 12:40:59 +0000175
176AC_CHECK_TOOL(AS, as)
177AC_CHECK_TOOL(AR, ar)
178AC_CHECK_TOOL(RANLIB, ranlib, :)
179AC_PROG_INSTALL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000180
Mike Stumpdd365152004-10-20 01:26:37 +0000181AM_MAINTAINER_MODE
182
Nathanael Nerode9c01f392004-04-09 11:43:02 +0000183# Enable Win32 DLL on MS Windows - FIXME
184AC_LIBTOOL_WIN32_DLL
Geoffrey Keating7c6b0e92001-02-09 07:14:35 +0000185
Franz Sirlb150efe2002-02-11 18:10:05 +0000186AC_PROG_LIBTOOL
Ben Ellistonbce1b481998-09-30 02:13:15 +0000187
Mike Stumpdd365152004-10-20 01:26:37 +0000188AM_PROG_CC_C_O
189
Franz Sirlb150efe2002-02-11 18:10:05 +0000190AC_PROG_MAKE_SET
Ben Ellistonbce1b481998-09-30 02:13:15 +0000191
Nathanael Nerode252dde62004-04-09 12:40:59 +0000192# -------
193# Headers
194# -------
195
Ben Ellistonbce1b481998-09-30 02:13:15 +0000196# Sanity check for the cross-compilation case:
197AC_CHECK_HEADER(stdio.h,:,
198 [AC_MSG_ERROR([Can't find stdio.h.
199You must have a usable C system for the target already installed, at least
200including headers and, preferably, the library, before you can configure
201the Objective C runtime system. If necessary, install gcc now with
202\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
203
204AC_HEADER_STDC
205
Ovidiu Predescud972a4c2000-08-15 07:38:04 +0000206AC_CHECK_HEADERS(sched.h)
207
Nathanael Nerode252dde62004-04-09 12:40:59 +0000208# -----------
209# Miscellanea
210# -----------
211
Nicola Perofd312532010-09-14 10:23:37 +0000212# Check if we have thread-local storage
213GCC_CHECK_TLS
Ben Ellistonbce1b481998-09-30 02:13:15 +0000214
Andrew Pinski049bc402004-10-01 03:46:39 +0000215AC_MSG_CHECKING([for exception model to use])
216AC_LANG_PUSH(C)
217AC_ARG_ENABLE(sjlj-exceptions,
218 AS_HELP_STRING([--enable-sjlj-exceptions],
219 [force use of builtin_setjmp for exceptions]),
220[:],
221[dnl Botheration. Now we've got to detect the exception model.
222dnl Link tests against libgcc.a are problematic since -- at least
223dnl as of this writing -- we've not been given proper -L bits for
224dnl single-tree newlib and libgloss.
225dnl
226dnl This is what AC_TRY_COMPILE would do if it didn't delete the
227dnl conftest files before we got a change to grep them first.
228cat > conftest.$ac_ext << EOF
229[#]line __oline__ "configure"
230@interface Frob
231@end
232@implementation Frob
233@end
234int proc();
235int foo()
236{
237 @try {
238 return proc();
239 }
240 @catch (Frob* ex) {
241 return 0;
242 }
243}
244EOF
245old_CFLAGS="$CFLAGS"
246dnl work around that we don't have Objective-C support in autoconf
247CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
248if AC_TRY_EVAL(ac_compile); then
249 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
250 enable_sjlj_exceptions=yes
251 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
252 enable_sjlj_exceptions=no
253 fi
254fi
255CFLAGS="$old_CFLAGS"
256rm -f conftest*])
257if test x$enable_sjlj_exceptions = xyes; then
258 AC_DEFINE(SJLJ_EXCEPTIONS, 1,
259 [Define if the compiler is configured for setjmp/longjmp exceptions.])
260 ac_exception_model_name=sjlj
261elif test x$enable_sjlj_exceptions = xno; then
262 ac_exception_model_name="call frame"
263else
264 AC_MSG_ERROR([unable to detect exception model])
265fi
266AC_LANG_POP(C)
267AC_MSG_RESULT($ac_exception_model_name)
268
Trevor Saunders539280a2015-05-02 04:11:07 +0000269gt_BITFIELD_TYPE_MATTERS
270
Nathanael Nerode252dde62004-04-09 12:40:59 +0000271# ------
272# Output
273# ------
Ben Ellistonbce1b481998-09-30 02:13:15 +0000274
H.J. Lu2c888482007-10-14 18:17:14 +0000275if test ${multilib} = yes; then
276 multilib_arg="--enable-multilib"
277else
278 multilib_arg=
279fi
280
Nathanael Nerode252dde62004-04-09 12:40:59 +0000281AC_CONFIG_FILES([Makefile])
Nathanael Nerode252dde62004-04-09 12:40:59 +0000282AC_OUTPUT