| 1 | # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved. | 
|---|
| 2 | # | 
|---|
| 3 | # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED | 
|---|
| 4 | # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK. | 
|---|
| 5 | # | 
|---|
| 6 | # Permission is hereby granted to use or copy this program | 
|---|
| 7 | # for any purpose,  provided the above notices are retained on all copies. | 
|---|
| 8 | # Permission to modify the code and to distribute modified code is granted, | 
|---|
| 9 | # provided the above notices are retained, and a notice that the code was | 
|---|
| 10 | # modified is included with the above copyright notice. | 
|---|
| 11 | # | 
|---|
| 12 | # Original author: Tom Tromey | 
|---|
| 13 |  | 
|---|
| 14 | dnl Process this file with autoconf to produce configure. | 
|---|
| 15 |  | 
|---|
| 16 | AC_INIT(gcj_mlc.c) | 
|---|
| 17 |  | 
|---|
| 18 | # This works around the fact that libtool configuration may change LD | 
|---|
| 19 | # for this particular configuration, but some shells, instead of | 
|---|
| 20 | # keeping the changes in LD private, export them just because LD is | 
|---|
| 21 | # exported. | 
|---|
| 22 | ORIGINAL_LD_FOR_MULTILIBS=$LD | 
|---|
| 23 |  | 
|---|
| 24 | dnl Can't be done in GC_CONFIGURE because that confuses automake. | 
|---|
| 25 | AC_CONFIG_AUX_DIR(.) | 
|---|
| 26 |  | 
|---|
| 27 | GC_CONFIGURE(.) | 
|---|
| 28 |  | 
|---|
| 29 | AM_PROG_LIBTOOL | 
|---|
| 30 |  | 
|---|
| 31 | dnl We use these options to decide which functions to include. | 
|---|
| 32 | AC_ARG_WITH(target-subdir, | 
|---|
| 33 | [  --with-target-subdir=SUBDIR | 
|---|
| 34 | configuring with a cross compiler]) | 
|---|
| 35 | AC_ARG_WITH(cross-host, | 
|---|
| 36 | [  --with-cross-host=HOST  configuring with a cross compiler]) | 
|---|
| 37 |  | 
|---|
| 38 | AM_MAINTAINER_MODE | 
|---|
| 39 | # automake wants to see AC_EXEEXT.  But we don't need it.  And having | 
|---|
| 40 | # it is actually a problem, because the compiler we're passed can't | 
|---|
| 41 | # necessarily do a full link.  So we fool automake here. | 
|---|
| 42 | if false; then | 
|---|
| 43 | # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands | 
|---|
| 44 | # to nothing, so nothing would remain between `then' and `fi' if it | 
|---|
| 45 | # were not for the `:' below. | 
|---|
| 46 | : | 
|---|
| 47 | AC_EXEEXT | 
|---|
| 48 | fi | 
|---|
| 49 |  | 
|---|
| 50 | AC_MSG_CHECKING([for thread model used by GCC]) | 
|---|
| 51 | THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` | 
|---|
| 52 | if test -z "$THREADS"; then | 
|---|
| 53 | THREADS=no | 
|---|
| 54 | fi | 
|---|
| 55 | AC_MSG_RESULT([$THREADS]) | 
|---|
| 56 |  | 
|---|
| 57 | AC_ARG_ENABLE(parallel-mark, | 
|---|
| 58 | [  --enable-parallel-mark       parallelize marking and free list construction], | 
|---|
| 59 | [case "$THREADS" in | 
|---|
| 60 | no | none | single) | 
|---|
| 61 | AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec]) | 
|---|
| 62 | ;; | 
|---|
| 63 | esac] | 
|---|
| 64 | ) | 
|---|
| 65 |  | 
|---|
| 66 | INCLUDES=-I${srcdir}/include | 
|---|
| 67 | THREADLIBS= | 
|---|
| 68 | case "$THREADS" in | 
|---|
| 69 | no | none | single) | 
|---|
| 70 | THREADS=none | 
|---|
| 71 | ;; | 
|---|
| 72 | posix | pthreads) | 
|---|
| 73 | THREADS=posix | 
|---|
| 74 | THREADLIBS=-lpthread | 
|---|
| 75 | case "$host" in | 
|---|
| 76 | x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) | 
|---|
| 77 | AC_DEFINE(GC_LINUX_THREADS) | 
|---|
| 78 | AC_DEFINE(_REENTRANT) | 
|---|
| 79 | if test "${enable_parallel_mark}"; then | 
|---|
| 80 | AC_DEFINE(PARALLEL_MARK) | 
|---|
| 81 | fi | 
|---|
| 82 | AC_DEFINE(THREAD_LOCAL_ALLOC) | 
|---|
| 83 | ;; | 
|---|
| 84 | *-*-linux*) | 
|---|
| 85 | AC_DEFINE(GC_LINUX_THREADS) | 
|---|
| 86 | AC_DEFINE(_REENTRANT) | 
|---|
| 87 | ;; | 
|---|
| 88 | *-*-hpux*) | 
|---|
| 89 | AC_MSG_WARN("Only HP/UX 11 threads are supported.") | 
|---|
| 90 | AC_DEFINE(GC_HPUX_THREADS) | 
|---|
| 91 | AC_DEFINE(_POSIX_C_SOURCE,199506L) | 
|---|
| 92 | if test "${enable_parallel_mark}" = yes; then | 
|---|
| 93 | AC_DEFINE(PARALLEL_MARK) | 
|---|
| 94 | fi | 
|---|
| 95 | AC_DEFINE(THREAD_LOCAL_ALLOC) | 
|---|
| 96 | THREADLIBS="-lpthread -lrt" | 
|---|
| 97 | ;; | 
|---|
| 98 | *-*-freebsd*) | 
|---|
| 99 | AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.") | 
|---|
| 100 | AC_DEFINE(GC_FREEBSD_THREADS) | 
|---|
| 101 | INCLUDES="$INCLUDES -pthread" | 
|---|
| 102 | THREADLIBS=-pthread | 
|---|
| 103 | ;; | 
|---|
| 104 | *-*-solaris*) | 
|---|
| 105 | AC_DEFINE(GC_SOLARIS_THREADS) | 
|---|
| 106 | AC_DEFINE(GC_SOLARIS_PTHREADS) | 
|---|
| 107 | ;; | 
|---|
| 108 | *-*-irix*) | 
|---|
| 109 | AC_DEFINE(GC_IRIX_THREADS) | 
|---|
| 110 | ;; | 
|---|
| 111 | *-*-cygwin*) | 
|---|
| 112 | THREADLIBS= | 
|---|
| 113 | ;; | 
|---|
| 114 | esac | 
|---|
| 115 | ;; | 
|---|
| 116 | win32) | 
|---|
| 117 | AC_DEFINE(GC_WIN32_THREADS) | 
|---|
| 118 | AC_DEFINE(NO_GETENV) | 
|---|
| 119 | if test $enable_shared = yes; then | 
|---|
| 120 | AC_DEFINE(GC_DLL) | 
|---|
| 121 | fi | 
|---|
| 122 | ;; | 
|---|
| 123 | decosf1 | irix | mach | os2 | solaris | dce | vxworks) | 
|---|
| 124 | AC_MSG_ERROR(thread package $THREADS not yet supported) | 
|---|
| 125 | ;; | 
|---|
| 126 | *) | 
|---|
| 127 | AC_MSG_ERROR($THREADS is an unknown thread package) | 
|---|
| 128 | ;; | 
|---|
| 129 | esac | 
|---|
| 130 | AC_SUBST(THREADLIBS) | 
|---|
| 131 |  | 
|---|
| 132 | AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl") | 
|---|
| 133 | AC_SUBST(EXTRA_TEST_LIBS) | 
|---|
| 134 |  | 
|---|
| 135 | target_all=libgcjgc.la | 
|---|
| 136 | AC_SUBST(target_all) | 
|---|
| 137 | AC_SUBST(target_alias) | 
|---|
| 138 |  | 
|---|
| 139 | dnl If the target is an eCos system, use the appropriate eCos | 
|---|
| 140 | dnl I/O routines. | 
|---|
| 141 | dnl FIXME: this should not be a local option but a global target | 
|---|
| 142 | dnl system; at present there is no eCos target. | 
|---|
| 143 | TARGET_ECOS="no" | 
|---|
| 144 | AC_ARG_WITH(ecos, | 
|---|
| 145 | [  --with-ecos             enable runtime eCos target support], | 
|---|
| 146 | TARGET_ECOS="$with_ecos" | 
|---|
| 147 | ) | 
|---|
| 148 |  | 
|---|
| 149 | addobjs= | 
|---|
| 150 | CXXINCLUDES= | 
|---|
| 151 | case "$TARGET_ECOS" in | 
|---|
| 152 | no) | 
|---|
| 153 | ;; | 
|---|
| 154 | *) | 
|---|
| 155 | AC_DEFINE(ECOS) | 
|---|
| 156 | CXXINCLUDES="-I${TARGET_ECOS}/include" | 
|---|
| 157 | addobjs="$addobjs ecos.lo" | 
|---|
| 158 | ;; | 
|---|
| 159 | esac | 
|---|
| 160 | AC_SUBST(CXX) | 
|---|
| 161 |  | 
|---|
| 162 | AC_SUBST(INCLUDES) | 
|---|
| 163 | AC_SUBST(CXXINCLUDES) | 
|---|
| 164 |  | 
|---|
| 165 | machdep= | 
|---|
| 166 | case "$host" in | 
|---|
| 167 | alpha*-*-openbsd*) | 
|---|
| 168 | machdep="alpha_mach_dep.lo" | 
|---|
| 169 | if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then | 
|---|
| 170 | AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled) | 
|---|
| 171 | AM_DISABLE_SHARED | 
|---|
| 172 | fi | 
|---|
| 173 | ;; | 
|---|
| 174 | alpha*-*-*) | 
|---|
| 175 | machdep="alpha_mach_dep.lo" | 
|---|
| 176 | ;; | 
|---|
| 177 | i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?) | 
|---|
| 178 | AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED) | 
|---|
| 179 | ;; | 
|---|
| 180 | mipstx39-*-elf*) | 
|---|
| 181 | machdep="mips_ultrix_mach_dep.lo" | 
|---|
| 182 | AC_DEFINE(STACKBASE, __stackbase) | 
|---|
| 183 | AC_DEFINE(DATASTART_IS_ETEXT) | 
|---|
| 184 | ;; | 
|---|
| 185 | mips-dec-ultrix*) | 
|---|
| 186 | machdep="mips_ultrix_mach-dep.lo" | 
|---|
| 187 | ;; | 
|---|
| 188 | mips*-*-linux*) | 
|---|
| 189 | ;; | 
|---|
| 190 | mips-*-*) | 
|---|
| 191 | machdep="mips_sgi_mach_dep.lo" | 
|---|
| 192 | AC_DEFINE(NO_EXECUTE_PERMISSION) | 
|---|
| 193 | ;; | 
|---|
| 194 | sparc-sun-solaris2.3) | 
|---|
| 195 | machdep="sparc_mach_dep.lo" | 
|---|
| 196 | AC_DEFINE(SUNOS53_SHARED_LIB) | 
|---|
| 197 | ;; | 
|---|
| 198 | sparc-sun-solaris2.*) | 
|---|
| 199 | machdep="sparc_mach_dep.lo" | 
|---|
| 200 | ;; | 
|---|
| 201 | ia64-*-*) | 
|---|
| 202 | machdep="mach_dep.lo ia64_save_regs_in_stack.lo" | 
|---|
| 203 | ;; | 
|---|
| 204 | esac | 
|---|
| 205 | if test x"$machdep" = x; then | 
|---|
| 206 | machdep="mach_dep.lo" | 
|---|
| 207 | fi | 
|---|
| 208 | addobjs="$addobjs $machdep" | 
|---|
| 209 | AC_SUBST(addobjs) | 
|---|
| 210 |  | 
|---|
| 211 | dnl As of 4.13a2, the collector will not properly work on Solaris when | 
|---|
| 212 | dnl built with gcc and -O.  So we remove -O in the appropriate case. | 
|---|
| 213 | case "$host" in | 
|---|
| 214 | sparc-sun-solaris2*) | 
|---|
| 215 | if test "$GCC" = yes; then | 
|---|
| 216 | new_CFLAGS= | 
|---|
| 217 | for i in $CFLAGS; do | 
|---|
| 218 | case "$i" in | 
|---|
| 219 | -O*) | 
|---|
| 220 | ;; | 
|---|
| 221 | *) | 
|---|
| 222 | new_CFLAGS="$new_CFLAGS $i" | 
|---|
| 223 | ;; | 
|---|
| 224 | esac | 
|---|
| 225 | done | 
|---|
| 226 | CFLAGS="$new_CFLAGS" | 
|---|
| 227 | fi | 
|---|
| 228 | ;; | 
|---|
| 229 | esac | 
|---|
| 230 |  | 
|---|
| 231 | dnl We need to override the top-level CFLAGS.  This is how we do it. | 
|---|
| 232 | MY_CFLAGS="$CFLAGS" | 
|---|
| 233 | AC_SUBST(MY_CFLAGS) | 
|---|
| 234 |  | 
|---|
| 235 | dnl Include defines that have become de facto standard. | 
|---|
| 236 | dnl ALL_INTERIOR_POINTERS can be overridden in startup code. | 
|---|
| 237 | AC_DEFINE(SILENT) | 
|---|
| 238 | AC_DEFINE(NO_SIGNALS) | 
|---|
| 239 | AC_DEFINE(NO_EXECUTE_PERMISSION) | 
|---|
| 240 | AC_DEFINE(ALL_INTERIOR_POINTERS) | 
|---|
| 241 |  | 
|---|
| 242 | dnl By default, make the library as general as possible. | 
|---|
| 243 | AC_DEFINE(JAVA_FINALIZATION) | 
|---|
| 244 | AC_DEFINE(GC_GCJ_SUPPORT) | 
|---|
| 245 | AC_DEFINE(ATOMIC_UNCOLLECTABLE) | 
|---|
| 246 |  | 
|---|
| 247 | dnl This is something of a hack.  When cross-compiling we turn off | 
|---|
| 248 | dnl some functionality. These is only correct when targetting an | 
|---|
| 249 | dnl embedded system.  FIXME. | 
|---|
| 250 | if test -n "${with_cross_host}"; then | 
|---|
| 251 | AC_DEFINE(NO_SIGSET) | 
|---|
| 252 | AC_DEFINE(NO_DEBUGGING) | 
|---|
| 253 | fi | 
|---|
| 254 |  | 
|---|
| 255 | AC_ARG_ENABLE(full-debug, | 
|---|
| 256 | [  --enable-full-debug  include full support for pointer backtracing etc.], | 
|---|
| 257 | [ if test "$enable_full_debug" = "yes"; then | 
|---|
| 258 | AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.") | 
|---|
| 259 | AC_DEFINE(KEEP_BACK_PTRS) | 
|---|
| 260 | AC_DEFINE(DBG_HDRS_ALL) | 
|---|
| 261 | case $host in | 
|---|
| 262 | ia64-*-linux* ) | 
|---|
| 263 | AC_DEFINE(MAKE_BACK_GRAPH) | 
|---|
| 264 | ;; | 
|---|
| 265 | x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) | 
|---|
| 266 | AC_DEFINE(MAKE_BACK_GRAPH) | 
|---|
| 267 | AC_MSG_WARN("Client must not use -fomit-frame-pointer.") | 
|---|
| 268 | AC_DEFINE(SAVE_CALL_COUNT, 8) | 
|---|
| 269 | ;; | 
|---|
| 270 | esac ] | 
|---|
| 271 | fi) | 
|---|
| 272 |  | 
|---|
| 273 | if test -n "$with_cross_host" && | 
|---|
| 274 | test x"$with_cross_host" != x"no"; then | 
|---|
| 275 | toolexecdir='$(exec_prefix)/$(target_alias)' | 
|---|
| 276 | toolexeclibdir='$(toolexecdir)/lib' | 
|---|
| 277 | else | 
|---|
| 278 | toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | 
|---|
| 279 | toolexeclibdir='$(libdir)' | 
|---|
| 280 | fi | 
|---|
| 281 | toolexeclibdir=$toolexeclibdir/`$CC -print-multi-os-directory` | 
|---|
| 282 | AC_SUBST(toolexecdir) | 
|---|
| 283 | AC_SUBST(toolexeclibdir) | 
|---|
| 284 |  | 
|---|
| 285 | if test "${multilib}" = "yes"; then | 
|---|
| 286 | multilib_arg="--enable-multilib" | 
|---|
| 287 | else | 
|---|
| 288 | multilib_arg= | 
|---|
| 289 | fi | 
|---|
| 290 |  | 
|---|
| 291 | AC_OUTPUT(Makefile include/Makefile, [ | 
|---|
| 292 | dnl Put all the -D options in a file. | 
|---|
| 293 | echo "$DEFS" > boehm-cflags | 
|---|
| 294 |  | 
|---|
| 295 | if test -n "$CONFIG_FILES"; then | 
|---|
| 296 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" | 
|---|
| 297 | ac_file=Makefile . ${gc_basedir}/../config-ml.in | 
|---|
| 298 | fi], | 
|---|
| 299 | srcdir=${srcdir} | 
|---|
| 300 | host=${host} | 
|---|
| 301 | target=${target} | 
|---|
| 302 | with_multisubdir=${with_multisubdir} | 
|---|
| 303 | ac_configure_args="${multilib_arg} ${ac_configure_args}" | 
|---|
| 304 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} | 
|---|
| 305 | gc_basedir=${gc_basedir} | 
|---|
| 306 | CC="${CC}" | 
|---|
| 307 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" | 
|---|
| 308 | DEFS="$DEFS" | 
|---|
| 309 | ) | 
|---|