1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(subproj.lst)
#
# pick up release variables
# RSCHEME_RELEASE, RSCHEME_VERSION, and RSCHEME_BUILD
#
. ./release.cfg
echo "configuring: RScheme ($RSCHEME_BUILD)"
AC_SUBST(RSCHEME_BUILD)
AC_SUBST_FILE(PREAMBLE)
AC_SUBST_FILE(POSTAMBLE)
PREAMBLE=preamble.mak
POSTAMBLE=postambl.mak
test "$prefix" = NONE && prefix=/usr/local/lib/rs/$RSCHEME_VERSION
test "$exec_prefix" = NONE && exec_prefix=$prefix/bin
#
# use C++ if using the RTGC
#
AC_PROG_CC
AC_PROG_CPP
if test "$with_gc" = "rtgc"
then AC_LANG_CPLUSPLUS
AC_PROG_CXX
AC_PROG_CXXCPP
gnu_c="$GXX"
COMPILE="$CXX"
else gnu_c="$GCC"
COMPILE="$CC"
fi
uselinks=false
#
# configuration parameters...
#
USE_INLINES=false
OPTIMIZE=true
ASSERTIONS=false
PERMIT_APPLY_BACKTRACE=false
USE_STACK_CACHE=true
FAKE_TIME_THREADS=false
if test "$enable_debug" = "yes"
then ASSERTIONS=true
fi
GC=""
LDX_FLAGS="-lm"
AC_CANONICAL_HOST
AC_C_BIGENDIAN
LD=ld
case "${host}" in
m68k-*-*) AC_DEFINE(PLATFORM_ARCH_M68K,1) ;;
powerpc-*-*) AC_DEFINE(PLATFORM_ARCH_PPC,1) ;;
i?86-*-*) AC_DEFINE(PLATFORM_ARCH_I386,1) ;;
mips-*-*) AC_DEFINE(PLATFORM_ARCH_MIPS,1) ;;
sparc-*-*) AC_DEFINE(PLATFORM_ARCH_SPARC,1) ;;
*-*-*) AC_DEFINE(PLATFORM_ARCH_UNKNOWN,1) ;;
esac
case "${host}" in
m68k-*-nextstep*) PLATFORM=next ; PLATCAP=NEXT ;;
*-*-rhapsody*) LDX_FLAGS="" ; PLATFORM=rhapsody ; PLATCAP=RHAPSODY ;;
*-*-aix*) PLATFORM=aix ; PLATCAP=AIX ;;
*-*-linux*) PLATFORM=linux ; PLATCAP=LINUX ;;
*-*-sunos* | *-*-solaris*) PLATFORM=sunos ; PLATCAP=SUNOS ;;
*-*-irix6*) PLATFORM=irix ; PLATCAP=IRIX ; LD="ld -old_ld" ;;
*-*-irix*) PLATFORM=irix ; PLATCAP=IRIX ;;
*-*-*) PLATFORM=com ; PLATCAP=ANSI ;;
esac
USE_STACK_CACHE=true
FAKE_TIME_THREADS=false
OPTIMIZE=true
if test "$PLATFORM" = "linux"
then LDX_FLAGS="$LDX_FLAGS -ldl"
fi
if test "$PLATFORM" = "aix"
then LDX_FLAGS="$LDX_FLAGS -lcur -lbsd"
fi
if test "${gnu_c}" = "yes" ; then
GNU_C=true
LD=${LD:-gcc}
PERMIT_APPLY_BACKTRACE=true
USE_INLINES=true
STYLE=gcc
else
GNU_C=false
LD=${LD:-ld}
PERMIT_APPLY_BACKTRACE=false
USE_INLINES=false
STYLE=ansi
fi
if test "$enable_debug" = "yes"
then USE_INLINES=false
OPTIMIZE=false
AC_DEFINE(DEBUG_BCI, 1)
else AC_DEFINE(DEBUG_BCI, 0)
fi
#
# handle specification of --with-gc={irc,freelist,rtgc}
#
GC=${with_gc:-irc}
#
# remove files we're going to install new versions of
#
rm -f install/include/rscheme/platform.h \
heapi/mapf.c \
runtime/osglue.c \
runtime/dynlink.c
#
# fill in the remaining values
#
INSTALL_DIR=${prefix}
#
# if using readline library, add appropriate LDX flags
# should this a --with option? Better defaults?
case "$enable_readline" in
gnu | yes )
rdln_dir=""
for i in /lib /usr/lib /usr/local/lib $HOME/lib
do if test -r $i/libreadline.a
then rdln_dir=$i
fi
done
if test -z "$rdln_dir"
then echo "WARNING: could not find GNU readline library" >&2
echo " may need to patch rshell/Makefile" >&2
LDX_FLAGS="-lreadline $LDX_FLAGS"
else LDX_FLAGS="-L$rdln_dir -lreadline $LDX_FLAGS"
fi
if test -r /usr/lib/libcur.a
then LDX_FLAGS="$LDX_FLAGS -lcur"
else if test -r /usr/lib/libtermcap.a
then LDX_FLAGS="$LDX_FLAGS -ltermcap"
fi
fi
RDLN="gnu" ;;
"std" | "no" | "" )
RDLN="std" ;;
*)
RDLN="$enable_readline" ;;
esac
case "$enable_dynamic_linking" in
yes )
AC_CHECK_LIB(dl,dlopen)
LDX_FLAGS="-rdynamic $LDX_FLAGS"
;;
esac
#
#............. configure our files ................
#
AC_CONFIG_HEADER(config.h)
AC_HEADER_DIRENT
AC_CHECK_HEADERS(unistd.h)
AC_PATH_PROG(RANLIB, ranlib, :)
AC_CHECK_FUNCS(getcwd getenv gettimeofday getwd \
memcpy memmove ntohl ntohs setitimer strerror \
stat mkdir wait flock lockf getrusage usleep symlink \
fgetln)
dnl Check if the compiler supports computed gotos
AC_CACHE_CHECK(if computed goto works, rs_cv_computed_goto_works,
if test "$with_gc" = "rtgc"
then rs_cv_computed_goto_works=no
else AC_TRY_COMPILE([],[void *target = &&destination;
destination: goto *target;],
rs_cv_computed_goto_works=yes,
rs_cv_computed_goto_works=no)
fi
)
AC_CACHE_CHECK(if ntoh protos are ok, rs_cv_ntoh_proto_ok,
AC_TRY_COMPILE([#include <sys/types.h>],
[extern unsigned long int ntohl( unsigned long int );
extern unsigned short int ntohs( unsigned short int );],
rs_cv_ntoh_proto_ok=yes,
rs_cv_ntoh_proto_ok=no))
AC_CACHE_CHECK(if <netinet/in.h> has ntoh protos, rs_cv_netinet_has_ntoh,
AC_TRY_COMPILE([#include <netinet/in.h>],
[return ntohl(2);],
rs_cv_netinet_has_ntoh=yes,
rs_cv_netinet_has_ntoh=no))
if test "$rs_cv_ntoh_proto_ok" = no; then
AC_DEFINE(NTOH_PROTO_OK, 0)
fi
if test "$rs_cv_netinet_has_ntoh" = yes; then
AC_DEFINE(USE_NETINET_FOR_NTOH_PROTO, 1)
fi
if test $rs_cv_computed_goto_works = yes; then
AC_DEFINE(USE_COMPUTED_GOTO, 1)
fi
dnl Check the return type of sprintf. Kind of ugly ...
AC_CACHE_CHECK(sprintf returns int, rs_cv_sprintf_returns_int,
AC_TRY_COMPILE([#include <stdio.h>
changequote(,)
changequote([,])dnl
],[changequote(<,>)dnl
char buf[20];
changequote([,])dnl
return (buf + sprintf(buf, "%d", 34))-buf;],
rs_cv_sprintf_returns_int=yes,
rs_cv_sprintf_returns_int=no))
if test $rs_cv_sprintf_returns_int = no; then
AC_DEFINE(SPRINTF_RETURNS_INT, 0)
fi
dnl Check to see if sigset_t is available (POSIX signals)
AC_CACHE_CHECK(for POSIX signals, rs_cv_posix_signals,
AC_TRY_COMPILE([#include <signal.h>
changequote(,)
changequote([,])dnl
],[sigset_t new_sig, old_sig;
sigfillset( &new_sig );
sigemptyset( &old_sig );
sigprocmask( SIG_BLOCK, &new_sig, &old_sig )],
rs_cv_posix_signals=yes,
rs_cv_posix_signals=no))
if test $rs_cv_posix_signals = no; then
AC_DEFINE(USE_POSIX_SIGNALS, 0)
fi
if test "$enable_trace_signal_latency" = "yes"
then AC_DEFINE(TRACE_SIGNAL_LATENCY, 1)
else AC_DEFINE(TRACE_SIGNAL_LATENCY, 0)
fi
if test "$enable_profiling_hooks" = "yes"
then AC_DEFINE(PROFILING_HOOKS, 1)
else AC_DEFINE(PROFILING_HOOKS, 0)
fi
if test "$enable_read_barrier" = "yes"
then AC_DEFINE(INCLUDE_READ_BARRIER, 1)
echo "*** WARNING: read barrier support is still under development"
else AC_DEFINE(INCLUDE_READ_BARRIER, 0)
fi
#
# NOTE: full-numeric-tower support is not fully implemented yet!
# (fixnums roll over to longints, but not to MPs. Also,
# the implementation is still sketchy.)
#
if test "$enable_full_numeric_tower" = "yes"
then AC_DEFINE(FULL_NUMERIC_TOWER, 1)
LDX_FLAGS="$LDX_FLAGS -lgmp"
echo "*** WARNING: full numeric tower support is sketchy at best."
echo " this option is still under development"
else AC_DEFINE(FULL_NUMERIC_TOWER, 0)
fi
if test "$enable_utf_process_code" = "no"
then AC_DEFINE(UTF_PROCESS_CODE, 0)
else AC_DEFINE(UTF_PROCESS_CODE, 1)
fi
AC_OUTPUT(Makefile hasht/Makefile)
#
# interpolate the INSTALL_DIR into the release config file
#
sed 's&@@{installdir}&'$INSTALL_DIR'&' \
< ./install/include/rscheme/rlseconf.cfg \
> ./install/include/rscheme/rlseconf.h \
#
# a file to put build style flags
#
# Perhaps buildsty.h should be merged with platform.h.
# Note that (for now) CONFIG_H is *not* config.h!
CONFIG_H=./install/include/rscheme/buildsty.h
rm -f $CONFIG_H
echo "/* build style parameters */">$CONFIG_H
choose() {
set=$1
choice=$2
rm -rf $set
if test ! -d cfg/$set/$choice
then echo "invalid choice for $set: $choice"
exit 1
fi
mkdir $set
dnl #Should use AC_LINK_FILES, but does not work in a loop or function.
if $uselinks
then for i in cfg/$set/$choice/*
do ln -s ../$i $set/`basename $i`
done
else for i in cfg/$set/$choice/*
do if test -f $i
then cp $i $set
fi
done
fi
}
choose gc $GC
choose gcadapt $GC
choose rdln $RDLN
cat > preamble.mak <<EOF
IFLAGS=-I. -I- -I../install/include
CFLAGS=\$(CFLAGS1) \$(IFLAGS)
LD=$LD
LD_FLAGS=-r
LDX=$LDX_FLAGS
EOF
_mkdir() {
if test ! -d $1
then mkdir $1
fi
}
_mkdir install
_mkdir install/lib
_mkdir install/resource
_mkdir install/resource/buildenv
cat > install/resource/buildenv/preamble.mak <<EOF
# INSTALL_DIR=$INSTALL_DIR
IFLAGS=-I. -I- -I\$(INSTALL_DIR)/include
SUBPROJ_LD=$LD
SUBPROJ_LD_FLAGS=-r
LDX_FLAGS=-L\$(INSTALL_DIR)/lib -lrs $LDX_FLAGS
EOF
cat > install/resource/buildenv/module.mak <<EOF
OFILES=\$(CFILES:.c=.o)
# INSTALL_DIR=$INSTALL_DIR
include \$(INSTALL_DIR)/resource/buildenv/preamble.mak
LD=$LD
LD_FLAGS=-r
\$(PRODUCT): \$(OFILES)
\$(LD) \$(LD_FLAGS) \$(OFILES) -o \$(PRODUCT)
clean::
rm -f \$(PRODUCT) \$(OFILES)
install:: \$(PRODUCT)
cp \$(PRODUCT) \$(INSTALL_DIR)/lib
cp \$(INCFILES) \$(INSTALL_DIR)/include
cp \$(MIFBASEFILE).mif \$(INSTALL_DIR)/resource/modules
cp \$(MIFBASEFILE).mx \$(INSTALL_DIR)/resource/modules
EOF
#
# run platform-specific configuration
#
# . ./platform/$PLATFORM/configure
sed -e "s/PLATFORM_ANSI/PLATFORM_$PLATCAP/" < config.h \
> install/include/rscheme/platform.h
if test "$PLATFORM" = "next"
then LDX_FLAGS="-sectcreate IMAGE system ../install/resource/system.img $LDX_FLAGS"
fi
#
# pick up platform-dependent implementations of
# `mapf.c', `osglue.c', and `dynlink.c', if available
# else use the common ones
choose_most_specific() {
dest=$1
file=$2
if test -r platform/$PLATFORM/$file
then ln -f -s ../platform/$PLATFORM/$file $dest/$file
else ln -f -s ../platform/com/$file $dest/$file
fi
}
choose_most_specific heapi mapf.c
choose_most_specific runtime osglue.c
choose_most_specific runtime dynlink.c
#
# run some little config scripts, but only
# if the platform doesn't supply a file
#
if test -r platform/$PLATFORM/modulo.h
then cp platform/$PLATFORM/modulo.h install/include/rscheme
else $COMPILE cfg/mod.c
if test -x ./a.exe
then ax=./a.exe
else ax=./a.out
fi
$ax > install/include/rscheme/modulo.h
rm -f $ax
fi
#
# collect other compile-time flags
#
# CFLAGS="" ...already set above, may be overridden in a config file (style)
# there seems to be a bug in AIX 4.1.4 xlc that causes optimization
# to kill RScheme...
if test "$PLATFORM" = aix -a $GNU_C = false
then OPTIMIZE=false
fi
#
if $OPTIMIZE
then CFLAGS="$CFLAGS -O2"
fi
AC_MSG_CHECKING(if we should use hardware registers)
if test -r platform/$PLATFORM/fixhwregs -a $GNU_C = true
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DUSE_HW_REGS `cat platform/$PLATFORM/fixhwregs`"
else
AC_MSG_RESULT(no)
fi
if $ASSERTIONS
then CFLAGS="$CFLAGS -g"
else CFLAGS="$CFLAGS -DNDEBUG"
fi
if test "$PLATFORM" = "aix"
then CFLAGS="$CFLAGS -D_ALL_SOURCE"
fi
if $USE_INLINES
then CFLAGS="$CFLAGS -DINLINES"
if test $GC = "irc"
then CFLAGS="$CFLAGS -DGC_MACROS"
fi
fi
if $PERMIT_APPLY_BACKTRACE
then echo "#define RECORD_CALL_CHAIN" >> $CONFIG_H
fi
if $USE_STACK_CACHE
then echo "#define STACK_CACHE" >> $CONFIG_H
fi
if $GNU_C
then CFLAGS="$CFLAGS -Wall -Wno-unused"
if $ASSERTIONS
then echo "#define USE_CONSTRUCTOR_EXPRS" >> $CONFIG_H
fi
echo "#define _rs_volatile volatile" >> $CONFIG_H
echo "#define _rs_inline inline" >> $CONFIG_H
else echo "#define _rs_volatile /* empty */" >> $CONFIG_H
echo "#define _rs_inline /* empty */" >> $CONFIG_H
fi
if $FAKE_TIME_THREADS
then echo "#define TIMER_IS_MONOTONE_COUNTER" >> $CONFIG_H
fi
echo "#define PLATFORM_TYPE \"$PLATFORM\"" >> $CONFIG_H
#
# finish up...
#
echo "CC=$COMPILE" >> preamble.mak
echo "CFLAGS1=$CFLAGS" >> preamble.mak
echo "CFLAGS=\$(CFLAGS1) \$(IFLAGS)" >> preamble.mak
echo "CC=$COMPILE" >> install/resource/buildenv/preamble.mak
echo "CFLAGS1=$CFLAGS" >> install/resource/buildenv/preamble.mak
echo "CFLAGS=\$(CFLAGS1) \$(XCFLAGS) \$(IFLAGS)" >> install/resource/buildenv/preamble.mak
#
# copy the include files
#
# useinclude() {
# ln -f -s ../../../$1/$2 ../install/include/rscheme/$2
# }
useinclude() {
rm -f ../install/include/rscheme/$2
cp $2 ../install/include/rscheme/$2
}
for i in `cat subproj.lst`
do if test -r $i/includes.lst
then (cd $i
for j in `cat includes.lst`
do useinclude $i $j
done)
fi
if $USE_INLINES && test -r $i/inlines.lst
then (cd $i
for j in `cat inlines.lst`
do useinclude $i $j
done)
fi
done
#
#............. configure RTGC includes .............
#
if test "$GC" = "rtgc"
then rm -rf install/include/rtgc
cp -r cfg/gc/rtgc/rtgc install/include
rm -f install/include/rtgc/langtype.h
ln -f -s ../rtgc/gcserver.h install/include/rscheme
ln -f -s ../rscheme/langtype.h install/include/rtgc/langtype.h
ln -f -s ../rscheme/gcclient1.ci install/include/rtgc/gcclient1.ci
ln -f -s ../rscheme/gcclient2.ci install/include/rtgc/gcclient2.ci
fi
|