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 14dnl Process this file with autoconf to produce configure. 15 16AC_PREREQ(2.13) 17AC_INIT(gcj_mlc.c) 18 19# This works around the fact that libtool configuration may change LD 20# for this particular configuration, but some shells, instead of 21# keeping the changes in LD private, export them just because LD is 22# exported. 23ORIGINAL_LD_FOR_MULTILIBS=$LD 24 25dnl Can't be done in GC_CONFIGURE because that confuses automake. 26AC_CONFIG_AUX_DIR(.) 27 28GC_CONFIGURE(.) 29 30AM_PROG_LIBTOOL 31 32dnl We use these options to decide which functions to include. 33AC_ARG_WITH(target-subdir, 34[ --with-target-subdir=SUBDIR 35 configuring with a cross compiler]) 36AC_ARG_WITH(cross-host, 37[ --with-cross-host=HOST configuring with a cross compiler]) 38 39AM_MAINTAINER_MODE 40# automake wants to see AC_EXEEXT. But we don't need it. And having 41# it is actually a problem, because the compiler we're passed can't 42# necessarily do a full link. So we fool automake here. 43if false; then 44 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands 45 # to nothing, so nothing would remain between `then' and `fi' if it 46 # were not for the `:' below. 47 : 48 AC_EXEEXT 49fi 50 51AC_MSG_CHECKING([for thread model used by GCC]) 52THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` 53if test -z "$THREADS"; then 54 THREADS=no 55fi 56AC_MSG_RESULT([$THREADS]) 57 58AC_ARG_ENABLE(parallel-mark, 59[ --enable-parallel-mark parallelize marking and free list construction], 60 [case "$THREADS" in 61 no | none | single) 62 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec]) 63 ;; 64 esac] 65) 66 67INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include" 68THREADLIBS= 69case "$THREADS" in 70 no | none | single) 71 THREADS=none 72 ;; 73 posix | pthreads) 74 THREADS=posix 75 THREADLIBS=-lpthread 76 case "$host" in 77 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*) 78 AC_DEFINE(GC_LINUX_THREADS) 79 AC_DEFINE(_REENTRANT) 80 if test "${enable_parallel_mark}" = yes; then 81 AC_DEFINE(PARALLEL_MARK) 82 fi 83 AC_DEFINE(THREAD_LOCAL_ALLOC) 84 ;; 85 *-*-linux*) 86 AC_DEFINE(GC_LINUX_THREADS) 87 AC_DEFINE(_REENTRANT) 88 ;; 89 *-*-aix*) 90 AC_DEFINE(GC_AIX_THREADS) 91 AC_DEFINE(_REENTRANT) 92 ;; 93 *-*-hpux*) 94 AC_MSG_WARN("Only HP/UX 11 threads are supported.") 95 AC_DEFINE(GC_HPUX_THREADS) 96 AC_DEFINE(_POSIX_C_SOURCE,199506L) 97 if test "${enable_parallel_mark}" = yes; then 98 AC_DEFINE(PARALLEL_MARK) 99 fi 100 AC_DEFINE(THREAD_LOCAL_ALLOC) 101 THREADLIBS="-lpthread -lrt" 102 ;; 103 *-*-freebsd*) 104 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.") 105 AC_DEFINE(GC_FREEBSD_THREADS) 106 INCLUDES="$INCLUDES -pthread" 107 THREADLIBS=-pthread 108 ;; 109 *-*-solaris*) 110 AC_DEFINE(GC_SOLARIS_THREADS) 111 AC_DEFINE(GC_SOLARIS_PTHREADS) 112 ;; 113 *-*-irix*) 114 AC_DEFINE(GC_IRIX_THREADS) 115 ;; 116 *-*-cygwin*) 117 AC_DEFINE(GC_WIN32_THREADS) 118 ;; 119 *-*-darwin*) 120 AC_DEFINE(GC_DARWIN_THREADS) 121 AC_DEFINE(THREAD_LOCAL_ALLOC) 122 if test "${enable_parallel_mark}" = yes; then 123 AC_DEFINE(PARALLEL_MARK) 124 fi 125 ;; 126 *-*-osf*) 127 AC_DEFINE(GC_OSF1_THREADS) 128 if test "${enable_parallel_mark}" = yes; then 129 AC_DEFINE(PARALLEL_MARK) 130 AC_DEFINE(THREAD_LOCAL_ALLOC) 131 # May want to enable it in other cases, too. 132 # Measurements havent yet been done. 133 fi 134 INCLUDES="$INCLUDES -pthread" 135 THREADLIBS="-lpthread -lrt" 136 ;; 137 esac 138 ;; 139 win32) 140 AC_DEFINE(GC_WIN32_THREADS) 141 dnl Old wine getenv may not return NULL for missing entry. 142 dnl Define EMPTY_GETENV_RESULTS here to work around the bug. 143 ;; 144 dgux386) 145 THREADS=dgux386 146AC_MSG_RESULT($THREADLIBS) 147 # Use pthread GCC switch 148 THREADLIBS=-pthread 149 if test "${enable_parallel_mark}" = yes; then 150 AC_DEFINE(PARALLEL_MARK) 151 fi 152 AC_DEFINE(THREAD_LOCAL_ALLOC) 153 AC_DEFINE(GC_DGUX386_THREADS) 154 AC_DEFINE(DGUX_THREADS) 155 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread 156 INCLUDES="-pthread $INCLUDES" 157 ;; 158 aix) 159 THREADS=posix 160 THREADLIBS=-lpthread 161 AC_DEFINE(GC_AIX_THREADS) 162 AC_DEFINE(_REENTRANT) 163 ;; 164 decosf1 | irix | mach | os2 | solaris | dce | vxworks) 165 AC_MSG_ERROR(thread package $THREADS not yet supported) 166 ;; 167 *) 168 AC_MSG_ERROR($THREADS is an unknown thread package) 169 ;; 170esac 171AC_SUBST(THREADLIBS) 172 173case "$host" in 174 powerpc-*-darwin*) 175 powerpc_darwin=true 176 ;; 177esac 178AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue) 179 180# We never want libdl on darwin. It is a fake libdl that just ends up making 181# dyld calls anyway 182case "$host" in 183 *-*-darwin*) ;; 184 *) 185 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl") 186 ;; 187esac 188 189AC_SUBST(EXTRA_TEST_LIBS) 190 191target_all=libgcjgc.la 192AC_SUBST(target_all) 193AC_SUBST(target_alias) 194 195dnl If the target is an eCos system, use the appropriate eCos 196dnl I/O routines. 197dnl FIXME: this should not be a local option but a global target 198dnl system; at present there is no eCos target. 199TARGET_ECOS="no" 200AC_ARG_WITH(ecos, 201[ --with-ecos enable runtime eCos target support], 202TARGET_ECOS="$with_ecos" 203) 204 205addobjs= 206addlibs= 207addincludes= 208addtests= 209CXXINCLUDES= 210case "$TARGET_ECOS" in 211 no) 212 ;; 213 *) 214 AC_DEFINE(ECOS) 215 CXXINCLUDES="-I${TARGET_ECOS}/include" 216 addobjs="$addobjs ecos.lo" 217 ;; 218esac 219 220if test "${enable_cplusplus}" = yes; then 221 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h" 222 addtests="$addtests test_cpp" 223fi 224 225AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes) 226 227AC_SUBST(CXX) 228 229AC_SUBST(INCLUDES) 230AC_SUBST(CXXINCLUDES) 231 232# Configuration of shared libraries 233# 234AC_MSG_CHECKING(whether to build shared libraries) 235AC_ENABLE_SHARED 236 237case "$host" in 238 alpha-*-openbsd*) 239 enable_shared=no 240 AC_MSG_RESULT(no) 241 ;; 242 *) 243 AC_MSG_RESULT(yes) 244 ;; 245esac 246 247# Configuration of machine-dependent code 248# 249# We don't set NO_EXECUTE_PERMISSION by default because gcj (and 250# anything else that creates trampolines in gc-allocated memory) 251# always needs exec permission. The exceptions to this are IA-64 and 252# some variations of Power PC, where trampolines don't contain 253# executable code. 254# 255AC_MSG_CHECKING(which machine-dependent code should be used) 256machdep= 257case "$host" in 258 alpha*-*-openbsd*) 259 machdep="alpha_mach_dep.lo" 260 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then 261 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled) 262 fi 263 ;; 264 alpha*-*-linux*) 265 machdep="alpha_mach_dep.lo" 266 ;; 267 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?) 268 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED) 269 ;; 270 mipstx39-*-elf*) 271 machdep="mips_ultrix_mach_dep.lo" 272 AC_DEFINE(STACKBASE, __stackbase) 273 AC_DEFINE(DATASTART_IS_ETEXT) 274 ;; 275 mips-dec-ultrix*) 276 machdep="mips_ultrix_mach-dep.lo" 277 ;; 278 mips-nec-sysv*|mips-unknown-sysv*) 279 ;; 280 mips*-*-linux*) 281 ;; 282 mips-*-*) 283 machdep="mips_sgi_mach_dep.lo" 284 ;; 285 sparc-*-netbsd*) 286 machdep="sparc_netbsd_mach_dep.lo" 287 ;; 288 sparc-sun-solaris2.3) 289 machdep="sparc_mach_dep.lo" 290 AC_DEFINE(SUNOS53_SHARED_LIB) 291 ;; 292 sparc-sun-solaris2.*) 293 machdep="sparc_mach_dep.lo" 294 ;; 295 ia64-*-*) 296 AC_DEFINE(NO_EXECUTE_PERMISSION) 297 machdep="mach_dep.lo ia64_save_regs_in_stack.lo" 298 ;; 299esac 300if test x"$machdep" = x; then 301AC_MSG_RESULT($machdep) 302 machdep="mach_dep.lo" 303fi 304addobjs="$addobjs $machdep" 305AC_SUBST(addobjs) 306AC_SUBST(addincludes) 307AC_SUBST(addlibs) 308AC_SUBST(addtests) 309 310AC_PROG_LIBTOOL 311 312# 313# Check for AViiON Machines running DGUX 314# 315AC_MSG_CHECKING(if host is AViiON running DGUX) 316ac_is_dgux=no 317AC_CHECK_HEADER(sys/dg_sys_info.h, 318[ac_is_dgux=yes;]) 319 320AC_MSG_RESULT($ac_is_dgux) 321 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h 322if test $ac_is_dgux = yes; then 323 if test "$enable_full_debug" = "yes"; then 324 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" 325 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" 326 else 327 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" 328 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" 329 fi 330 AC_SUBST(CFLAGS) 331 AC_SUBST(CXXFLAGS) 332fi 333 334dnl We use these options to decide which functions to include. 335AC_ARG_WITH(target-subdir, 336[ --with-target-subdir=SUBDIR 337 configuring with a cross compiler]) 338AC_ARG_WITH(cross-host, 339[ --with-cross-host=HOST configuring with a cross compiler]) 340 341# automake wants to see AC_EXEEXT. But we don't need it. And having 342# it is actually a problem, because the compiler we're passed can't 343# necessarily do a full link. So we fool automake here. 344if false; then 345 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands 346 # to nothing, so nothing would remain between `then' and `fi' if it 347 # were not for the `:' below. 348 : 349 AC_EXEEXT 350fi 351 352dnl As of 4.13a2, the collector will not properly work on Solaris when 353dnl built with gcc and -O. So we remove -O in the appropriate case. 354dnl 355AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary) 356case "$host" in 357 sparc-sun-solaris2*|*aix*) 358 if test "$GCC" = yes; then 359 AC_MSG_RESULT(yes) 360 new_CFLAGS= 361 for i in $CFLAGS; do 362 case "$i" in 363 -O*) 364 ;; 365 *) 366 new_CFLAGS="$new_CFLAGS $i" 367 ;; 368 esac 369 done 370 CFLAGS="$new_CFLAGS" 371 else 372 AC_MSG_RESULT(no) 373 fi 374 ;; 375 *) AC_MSG_RESULT(no) ;; 376esac 377 378dnl We need to override the top-level CFLAGS. This is how we do it. 379MY_CFLAGS="$CFLAGS" 380AC_SUBST(MY_CFLAGS) 381 382dnl Include defines that have become de facto standard. 383dnl ALL_INTERIOR_POINTERS can be overridden in startup code. 384AC_DEFINE(SILENT) 385AC_DEFINE(NO_SIGNALS) 386AC_DEFINE(ALL_INTERIOR_POINTERS) 387 388dnl By default, make the library as general as possible. 389AC_DEFINE(JAVA_FINALIZATION) 390AC_DEFINE(GC_GCJ_SUPPORT) 391AC_DEFINE(ATOMIC_UNCOLLECTABLE) 392 393dnl This is something of a hack. When cross-compiling we turn off 394dnl some functionality. These is only correct when targetting an 395dnl embedded system. FIXME. 396if test -n "${with_cross_host}"; then 397 AC_DEFINE(NO_SIGSET) 398 AC_DEFINE(NO_DEBUGGING) 399fi 400 401AC_ARG_ENABLE(full-debug, 402[ --enable-full-debug include full support for pointer backtracing etc.], 403[ if test "$enable_full_debug" = "yes"; then 404 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.") 405 AC_DEFINE(KEEP_BACK_PTRS) 406 AC_DEFINE(DBG_HDRS_ALL) 407 case $host in 408 ia64-*-linux* ) 409 AC_DEFINE(MAKE_BACK_GRAPH) 410 ;; 411 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) 412 AC_DEFINE(MAKE_BACK_GRAPH) 413 AC_MSG_WARN("Client must not use -fomit-frame-pointer.") 414 AC_DEFINE(SAVE_CALL_COUNT, 8) 415 ;; 416 i[3456]86-*-dgux*) 417 AC_DEFINE(MAKE_BACK_GRAPH) 418 ;; 419 esac ] 420 fi) 421 422if test -n "$with_cross_host" && 423 test x"$with_cross_host" != x"no"; then 424 toolexecdir='$(exec_prefix)/$(target_alias)' 425 toolexeclibdir='$(toolexecdir)/lib' 426else 427 toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 428 toolexeclibdir='$(libdir)' 429fi 430multi_os_directory=`$CC -print-multi-os-directory` 431case $multi_os_directory in 432 .) ;; # Avoid trailing /. 433 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; 434esac 435AC_SUBST(toolexecdir) 436AC_SUBST(toolexeclibdir) 437 438if test "${multilib}" = "yes"; then 439 multilib_arg="--enable-multilib" 440else 441 multilib_arg= 442fi 443 444AC_OUTPUT(Makefile include/Makefile, [ 445dnl Put all the -I and -D options in a file. 446echo "$INCLUDES $DEFS" > boehm-cflags 447 448if test -n "$CONFIG_FILES"; then 449 LD="${ORIGINAL_LD_FOR_MULTILIBS}" 450 ac_file=Makefile . ${gc_basedir}/../config-ml.in 451fi], 452srcdir=${srcdir} 453host=${host} 454target=${target} 455with_multisubdir=${with_multisubdir} 456ac_configure_args="${multilib_arg} ${ac_configure_args}" 457CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} 458gc_basedir=${gc_basedir} 459CC="${CC}" 460ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" 461DEFS="$DEFS" 462INCLUDES="$INCLUDES" 463) 464