1dnl Process this file with autoconf to produce a configure script. 2 3AC_INIT([MIT/GNU Scheme microcode], [15.3], [bug-mit-scheme@gnu.org], [mit-scheme]) 4AC_CONFIG_SRCDIR([boot.c]) 5AC_CONFIG_HEADERS([config.h]) 6AC_PROG_MAKE_SET 7 8AC_COPYRIGHT( 9[Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 10 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 11 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts 12 Institute of Technology 13 14This file is part of MIT/GNU Scheme. 15 16MIT/GNU Scheme is free software; you can redistribute it and/or modify 17it under the terms of the GNU General Public License as published by 18the Free Software Foundation; either version 2 of the License, or (at 19your option) any later version. 20 21MIT/GNU Scheme is distributed in the hope that it will be useful, but 22WITHOUT ANY WARRANTY; without even the implied warranty of 23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24General Public License for more details. 25 26You should have received a copy of the GNU General Public License 27along with MIT/GNU Scheme; if not, write to the Free Software 28Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 29USA. 30]) 31 32AH_TOP([/* 33 34Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 35 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 36 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts 37 Institute of Technology 38 39This file is part of MIT/GNU Scheme. 40 41MIT/GNU Scheme is free software; you can redistribute it and/or modify 42it under the terms of the GNU General Public License as published by 43the Free Software Foundation; either version 2 of the License, or (at 44your option) any later version. 45 46MIT/GNU Scheme is distributed in the hope that it will be useful, but 47WITHOUT ANY WARRANTY; without even the implied warranty of 48MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 49General Public License for more details. 50 51You should have received a copy of the GNU General Public License 52along with MIT/GNU Scheme; if not, write to the Free Software 53Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 54USA. 55 56*/ 57 58#ifndef SCM_CONFIG_H 59#define SCM_CONFIG_H]) 60 61AH_BOTTOM( 62[#ifndef __unix__ 63# define __unix__ 64#endif 65 66#if defined(_IRIX) || defined(_IRIX4) || defined(_IRIX6) 67# define __IRIX__ 68#endif 69 70#if defined(__hpux) || defined(hpux) 71# define __HPUX__ 72#endif 73 74/* If we're running under GNU libc, turn on all the features. 75 Otherwise this should be harmless. */ 76#define _GNU_SOURCE 77 78#include <sys/types.h> 79 80#ifdef TIME_WITH_SYS_TIME 81# include <sys/time.h> 82# include <time.h> 83#else 84# ifdef HAVE_SYS_TIME_H 85# include <sys/time.h> 86# else 87# include <time.h> 88# endif 89#endif 90 91#ifdef HAVE_TERMIOS_H 92# include <termios.h> 93#else 94# ifdef HAVE_TERMIO_H 95# include <termio.h> 96# endif 97#endif 98 99#ifdef HAVE_SYS_MMAN_H 100# include <sys/mman.h> 101#endif 102 103#ifdef HAVE_MMAP 104# if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) 105# define MAP_ANONYMOUS MAP_ANON 106# endif 107# ifdef MAP_ANONYMOUS 108# define USE_MMAP_HEAP_MALLOC 109# endif 110#endif 111 112/* Include the shared configuration header. */ 113#include "confshared.h" 114 115#endif /* SCM_CONFIG_H */]) 116 117dnl Feature options 118AC_ARG_ENABLE([valgrind-mode], 119 AS_HELP_STRING([--enable-valgrind-mode], 120 [Support running under valgrind [[no]]])) 121: ${enable_valgrind_mode='no'} 122 123AC_ARG_ENABLE([debugging], 124 AS_HELP_STRING([--enable-debugging], 125 [Compile with debugging support [[no]]])) 126: ${enable_debugging='no'} 127 128AC_ARG_ENABLE([native-code], 129 AS_HELP_STRING([--enable-native-code], 130 [Support native compiled code if available [[yes]]])) 131: ${enable_native_code='yes'} 132 133AC_ARG_WITH([openssl], 134 AS_HELP_STRING([--with-openssl], 135 [Use OpenSSL crypto library if available [[yes]]])) 136: ${with_openssl='yes'} 137 138AC_ARG_WITH([mhash], 139 AS_HELP_STRING([--with-mhash], 140 [Use mhash library if available [[yes]]])) 141: ${with_mhash='yes'} 142 143AC_ARG_WITH([mcrypt], 144 AS_HELP_STRING([--with-mcrypt], 145 [Use mcrypt library if available [[yes]]])) 146: ${with_mcrypt='yes'} 147 148AC_ARG_WITH([gdbm], 149 AS_HELP_STRING([--with-gdbm], 150 [Use gdbm library if available [[yes]]])) 151: ${with_gdbm='yes'} 152 153AC_ARG_WITH([db-4], 154 AS_HELP_STRING([--with-db-4], 155 [Use Berkeley DB v4 library if available [[yes]]])) 156: ${with_db_4='yes'} 157 158AC_ARG_WITH([libpq], 159 AS_HELP_STRING([--with-libpq], 160 [Use PostgreSQL libpq library if available [[yes]]])) 161: ${with_libpq='yes'} 162 163AC_ARG_WITH([termcap], 164 AS_HELP_STRING([--with-termcap], 165 [Use a termcap library if available [[yes]]])) 166: ${with_termcap='yes'} 167 168dnl For reasons I don't understand, it is necessary to use 169dnl quadigraphs here instead of [[ ... ]]. 170AC_ARG_WITH([macosx-version], 171 AS_HELP_STRING([--with-macosx-version], 172 [MacOSX version to compile for @<:@host's version@:>@])) 173 174AC_ARG_WITH([module-loader], 175 AS_HELP_STRING([--with-module-loader], 176 [Pathname of the Scheme executable, for building modules only])) 177: ${with_module_loader='yes'} 178 179dnl Substitution variables to be filled in below. 180GC_HEAD_FILES="gccode.h cmpgc.h cmpintmd-config.h cmpintmd.h" 181OPTIONAL_BASES= 182OPTIONAL_SOURCES= 183OPTIONAL_OBJECTS= 184PRBFISH_LIBS= 185PRMD5_LIBS= 186SCHEME_DEFS=-DMIT_SCHEME 187SCHEME_LDFLAGS= 188MODULE_BASES= 189MODULE_AUX_BASES= 190MODULE_LIBS= 191MODULE_TARGETS= 192MODULE_RULES=/dev/null 193MODULE_CFLAGS= 194MODULE_LDFLAGS= 195MODULE_LOADER= 196LIARC_VARS=/dev/null 197LIARC_RULES=/dev/null 198AUX_PROGRAMS= 199AUX_DATA= 200AUXDIR_NAME= 201EXE_NAME= 202INSTALL_INCLUDE= 203 204AC_CANONICAL_HOST 205 206dnl Save these prior to running AC_PROG_CC. 207SAVED_CFLAGS=${CFLAGS} 208SAVED_LDFLAGS=${LDFLAGS} 209 210dnl Checks for programs. 211AC_PROG_CC 212AC_PROG_CC_STDC 213if test "x${ac_cv_prog_cc_c99}" != xno; then 214 AC_DEFINE([HAVE_STDC_99], [1], [Does the compiler support C99?]) 215fi 216if test "x${ac_cv_prog_cc_c89}" != xno; then 217 AC_DEFINE([HAVE_STDC_89], [1], [Does the compiler support C89?]) 218fi 219AC_C_BACKSLASH_A 220AC_C_BIGENDIAN 221AC_C_CONST 222AC_C_RESTRICT 223AC_C_VOLATILE 224AC_C_INLINE 225AC_C_STRINGIZE 226AC_C_PROTOTYPES 227AC_PROG_EGREP 228AC_PROG_FGREP 229AC_PROG_GREP 230AC_PROG_INSTALL 231AC_PROG_LN_S 232AC_PROG_MAKE_SET 233 234if test ${GCC} = yes; then 235 236 dnl Discard flags computed by AC_PROG_CC; we'll use our own. 237 CFLAGS=${SAVED_CFLAGS} 238 LDFLAGS=${SAVED_LDFLAGS} 239 240 if test ${enable_debugging} = no; then 241 CFLAGS="-O3 ${CFLAGS}" 242 else 243 CFLAGS="-O0 -g -DENABLE_DEBUGGING_TOOLS ${CFLAGS}" 244 LDFLAGS="${LDFLAGS} -g" 245 fi 246 CFLAGS="-Wall -Wundef -Wpointer-arith -Winline ${CFLAGS}" 247 CFLAGS="-Wstrict-prototypes -Wnested-externs -Wredundant-decls ${CFLAGS}" 248 249 AC_MSG_CHECKING([for GCC>=4]) 250 AC_COMPILE_IFELSE( 251 [AC_LANG_PROGRAM( 252 [[ 253 #if __GNUC__ >= 4 254 ; 255 #else 256 #error "gcc too old" 257 #endif 258 ]], 259 [[]] 260 )], 261 [ 262 AC_MSG_RESULT([yes]) 263 CFLAGS="-Wextra -Wno-sign-compare -Wno-unused-parameter ${CFLAGS}" 264 CFLAGS="-Wold-style-definition ${CFLAGS}" 265 ], 266 [AC_MSG_RESULT([no])]) 267 268 # other possibilities: 269 # -Wmissing-prototypes -Wunreachable-code -Wwrite-strings 270fi 271FOO=`${INSTALL} --help 2> /dev/null | ${FGREP} -e --preserve-timestamps` 272if test "x${FOO}" != x; then 273 INSTALL="${INSTALL} --preserve-timestamps" 274fi 275CCLD=${CC} 276 277MIT_SCHEME_NATIVE_CODE([${enable_native_code}],[${host_cpu}]) 278 279if test x${mit_scheme_native_code} = xhppa; then 280 GC_HEAD_FILES="${GC_HEAD_FILES} hppacach.h" 281fi 282 283AUXDIR_NAME=mit-scheme-${mit_scheme_native_code} 284EXE_NAME=mit-scheme-${mit_scheme_native_code} 285 286dnl Add OS-dependent customizations. This must happen before checking 287dnl any headers or library routines, because it may add CFLAGS or 288dnl LDFLAGS that the subsequent checks require. 289 290DO_GCC_TESTS=no 291GNU_LD=no 292case ${host_os} in 293linux-gnu) 294 M4_FLAGS="${M4_FLAGS} -P __linux__,1" 295 DO_GCC_TESTS=yes 296 GNU_LD=yes 297 ;; 298freebsd*) 299 M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" 300 DO_GCC_TESTS=yes 301 GNU_LD=yes 302 ;; 303dragonfly*) 304 M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" 305 DO_GCC_TESTS=yes 306 GNU_LD=yes 307 ;; 308darwin*) 309 if test -n "${with_macosx_version}"; then 310 MACOSX=${with_macosx_version} 311 MACOSX_CFLAGS="-mmacosx-version-min=${MACOSX}" 312 else 313 MACOSX=`sw_vers | ${GREP} ^ProductVersion: \ 314 | ${EGREP} -o '[[0-9]+\.[0-9]+]'` 315 if test -z "${MACOSX}"; then 316 AC_MSG_ERROR([Unable to determine MacOSX version]) 317 fi 318 MACOSX_CFLAGS= 319 fi 320 if test "${MACOSX}" = 10.4; then 321 SDK=MacOSX${MACOSX}u 322 else 323 SDK=MacOSX${MACOSX} 324 fi 325 MACOSX_SYSROOT= 326 for dir in /Developer/SDKs \ 327 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs 328 do 329 if test -d "${dir}"; then 330 MACOSX_SYSROOT=${dir} 331 break 332 fi 333 done 334 if test -z "${MACOSX_SYSROOT}"; then 335 AC_MSG_WARN([Can't find SDKs directory, not checking for SDK]) 336 else 337 MACOSX_SYSROOT=${MACOSX_SYSROOT}/${SDK}.sdk 338 if test ! -d "${MACOSX_SYSROOT}"; then 339 AC_MSG_ERROR([No MacOSX SDK for version: ${MACOSX}]) 340 fi 341 fi 342 MACOSX_CFLAGS="${MACOSX_CFLAGS} -isysroot ${MACOSX_SYSROOT}" 343 MACOSX_CFLAGS="${MACOSX_CFLAGS} -fconstant-cfstrings" 344 MACOSX_CFLAGS="${MACOSX_CFLAGS} -DSIGNAL_HANDLERS_CAN_USE_SCHEME_STACK" 345 AC_MSG_NOTICE([Compiling for MacOSX version ${MACOSX}]) 346 case ${mit_scheme_native_code} in 347 i386) 348 MACOSX_CFLAGS="-arch i386 ${MACOSX_CFLAGS}" 349 AS_FLAGS="-arch i386 ${AS_FLAGS}" 350 SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -Wl,-pagezero_size,04000000" 351 ;; 352 x86-64) 353 MACOSX_CFLAGS="-arch x86_64 ${MACOSX_CFLAGS}" 354 AS_FLAGS="-arch x86_64 ${AS_FLAGS}" 355 ;; 356 esac 357 CFLAGS="${CFLAGS} ${MACOSX_CFLAGS} -frounding-math" 358 LDFLAGS="${LDFLAGS} ${MACOSX_CFLAGS} -Wl,-syslibroot,${MACOSX_SYSROOT}" 359 LDFLAGS="${LDFLAGS} -framework CoreFoundation" 360 MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle" 361 if test "${with_module_loader}" != no; then 362 if test "${with_module_loader}" = yes; then 363 MODULE_LOADER='${SCHEME_EXE}' 364 else 365 MODULE_LOADER="${with_module_loader}" 366 fi 367 MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle_loader ${MODULE_LOADER}" 368 fi 369 AUX_PROGRAMS="${AUX_PROGRAMS} macosx-starter" 370 ;; 371netbsd*) 372 DO_GCC_TESTS=yes 373 GNU_LD=yes 374 ;; 375openbsd*) 376 M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" 377 DO_GCC_TESTS=yes 378 GNU_LD=yes 379 ;; 380solaris*) 381 # How do we tell whether we're using GNU ld or Solaris ld? 382 if test ${GCC} = yes; then 383 DO_GCC_TESTS=yes 384 M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" 385 fi 386 LDFLAGS="${LDFLAGS} -lsocket -lnsl" 387 ;; 388esac 389 390if test "${DO_GCC_TESTS}" = yes; then 391 if test "${GNU_LD}" = yes; then 392 SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -rdynamic" 393 fi 394 MODULE_CFLAGS="-fPIC ${MODULE_CFLAGS}" 395 MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared -fPIC" 396 AC_MSG_CHECKING([for ELF binaries]) 397 AC_EGREP_CPP([yes], 398 [ 399 #ifdef __ELF__ 400 yes 401 #endif 402 ], 403 [ 404 AC_MSG_RESULT([yes]) 405 M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" 406 M4_FLAGS="${M4_FLAGS} -P __ELF__,1" 407 ], 408 [AC_MSG_RESULT([no])]) 409fi 410 411dnl Checks for libraries. 412AC_CHECK_LIB([m], [exp]) 413 414dnl Checks for header files. 415AC_HEADER_DIRENT 416AC_HEADER_STDC 417AC_HEADER_STDBOOL 418AC_HEADER_SYS_WAIT 419AC_HEADER_TIME 420AC_CHECK_HEADERS([bsdtty.h fcntl.h fenv.h ieeefp.h limits.h malloc.h poll.h]) 421AC_CHECK_HEADERS([sgtty.h stropts.h time.h]) 422AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/mount.h sys/param.h]) 423AC_CHECK_HEADERS([sys/ptyio.h sys/socket.h sys/time.h sys/timex.h sys/un.h]) 424AC_CHECK_HEADERS([sys/vfs.h]) 425AC_CHECK_HEADERS([termio.h termios.h unistd.h util.h utime.h]) 426AC_CHECK_HEADERS([dlfcn.h netdb.h signal.h]) 427AC_CHECK_HEADERS([sys/mman.h float.h assert.h stdint.h]) 428 429define([SCM_INC_TIME], 430 [ 431 #ifdef TIME_WITH_SYS_TIME 432 # include <sys/time.h> 433 # include <time.h> 434 #else 435 # ifdef HAVE_SYS_TIME_H 436 # include <sys/time.h> 437 # else 438 # include <time.h> 439 # endif 440 #endif 441 ]) 442 443define([SCM_INC_SYS_TIMEX], 444 [ 445 SCM_INC_TIME 446 #ifdef HAVE_SYS_TIMEX_H 447 # include <sys/timex.h> 448 #endif 449 ]) 450 451define([SCM_INC_TERMIO], 452 [ 453 #ifdef HAVE_TERMIOS_H 454 # include <termios.h> 455 #else 456 # ifdef HAVE_TERMIO_H 457 # include <termio.h> 458 # endif 459 #endif 460 ]) 461 462define([SCM_INC_NETDB], 463 [ 464 #ifdef HAVE_NETDB_H 465 # include <netdb.h> 466 #endif 467 ]) 468 469define([SCM_INC_SIGNAL], 470 [ 471 #ifdef HAVE_SIGNAL_H 472 # include <signal.h> 473 #endif 474 ]) 475 476define([SCM_INC_SOCKET], 477 [ 478 #include <sys/types.h> 479 #ifdef HAVE_SYS_SOCKET_H 480 # include <sys/socket.h> 481 #endif 482 ]) 483 484define([SCM_INC_BSDTTY], 485 [ 486 #ifdef HAVE_BSDTTY_H 487 # include <bsdtty.h> 488 #endif 489 ]) 490 491dnl Checks for types and structs 492AC_TYPE_MODE_T 493AC_TYPE_OFF_T 494AC_TYPE_PID_T 495AC_TYPE_SIGNAL 496AC_TYPE_SIZE_T 497AC_TYPE_UID_T 498 499AC_TYPE_INT8_T 500AC_TYPE_INT16_T 501AC_TYPE_INT32_T 502AC_TYPE_INT64_T 503AC_TYPE_INTPTR_T 504AC_TYPE_INTMAX_T 505AC_TYPE_UINT8_T 506AC_TYPE_UINT16_T 507AC_TYPE_UINT32_T 508AC_TYPE_UINT64_T 509AC_TYPE_UINTPTR_T 510AC_TYPE_UINTMAX_T 511 512AC_CHECK_SIZEOF([char]) 513AC_CHECK_SIZEOF([short]) 514AC_CHECK_SIZEOF([int]) 515AC_CHECK_SIZEOF([long]) 516AC_CHECK_SIZEOF([unsigned char]) 517AC_CHECK_SIZEOF([unsigned short]) 518AC_CHECK_SIZEOF([unsigned int]) 519AC_CHECK_SIZEOF([unsigned long]) 520AC_CHECK_SIZEOF([void *]) 521AC_CHECK_SIZEOF([intptr_t]) 522AC_CHECK_SIZEOF([uintptr_t]) 523AC_CHECK_SIZEOF([intmax_t]) 524AC_CHECK_SIZEOF([uintmax_t]) 525 526if test ${ac_cv_sizeof_char} -ne 1; then 527 AC_MSG_ERROR([SIZEOF_CHAR is not 1]) 528fi 529 530if test ${ac_cv_sizeof_unsigned_char} -ne 1; then 531 AC_MSG_ERROR([SIZEOF_UNSIGNED_CHAR is not 1]) 532fi 533 534AC_CHECK_TYPE([nlink_t], 535 [], 536 [AC_DEFINE([nlink_t], [short], 537 [Define to 'short' if undefined.])]) 538 539AC_CHECK_TYPE([clock_t], 540 [], 541 [AC_DEFINE([clock_t], [unsigned long], 542 [Define to `unsigned long' if <time.h> doesn't define.])], 543 [SCM_INC_TIME]) 544 545AC_CHECK_TYPE([time_t], 546 [], 547 [AC_DEFINE([time_t], [long], 548 [Define to `long' if <time.h> doesn't define.])], 549 [SCM_INC_TIME]) 550 551AC_CHECK_TYPE([socklen_t], 552 [], 553 [AC_DEFINE([socklen_t], [int], 554 [Define to `int' if <sys/socket.h> doesn't define.])], 555 [SCM_INC_SOCKET]) 556 557AC_CHECK_TYPE([cc_t], 558 [], 559 [AC_DEFINE([cc_t], [unsigned char], 560 [Define to `unsigned char' if <termios.h> doesn't define.])], 561 [SCM_INC_TERMIO]) 562 563AC_CHECK_TYPE([speed_t], 564 [], 565 [AC_DEFINE([speed_t], [short], 566 [Define to `short' if <termios.h> doesn't define.])], 567 [SCM_INC_TERMIO]) 568 569define([SCM_INC_FENV], 570 [ 571 #include <fenv.h> 572 ]) 573 574if test "x$ac_cv_header_fenv_h" = "xyes"; then 575 AC_CHECK_TYPES([fenv_t], [], [], [SCM_INC_FENV]) 576 AC_CHECK_TYPES([fexcept_t], [], [], [SCM_INC_FENV]) 577fi 578 579AC_CHECK_SIZEOF([time_t]) 580AC_CHECK_SIZEOF([off_t]) 581 582AC_STRUCT_TM 583AC_STRUCT_TIMEZONE 584 585dnl Timezone stuff is hairy; there's no standard. 586have_timezone_info=no 587val_tm_gmtoff= 588val_timezone= 589 590if test ${have_timezone_info} = no; then 591 AC_CHECK_MEMBER([struct tm.tm_gmtoff], 592 [ 593 have_timezone_info=yes 594 val_tm_gmtoff=tm_gmtoff 595 ], 596 [], 597 [SCM_INC_TIME]) 598fi 599 600if test ${have_timezone_info} = no; then 601 AC_CHECK_MEMBER([struct tm.__tm_gmtoff], 602 [ 603 have_timezone_info=yes 604 val_tm_gmtoff=__tm_gmtoff 605 ], 606 [], 607 [SCM_INC_TIME]) 608fi 609 610if test ${have_timezone_info} = no; then 611 AC_CHECK_DECL([__timezone], 612 [ 613 have_timezone_info=yes 614 val_timezone=__timezone 615 ], 616 [], 617 [SCM_INC_TIME]) 618fi 619 620if test ${have_timezone_info} = no; then 621 AC_CHECK_DECL([_timezone], 622 [ 623 have_timezone_info=yes 624 val_timezone=_timezone 625 ], 626 [], 627 [SCM_INC_TIME]) 628fi 629 630if test ${have_timezone_info} = no; then 631 AC_CHECK_DECL([timezone], 632 [ 633 have_timezone_info=yes 634 val_timezone=timezone 635 ], 636 [], 637 [SCM_INC_TIME]) 638fi 639 640if test -n "${val_tm_gmtoff}"; then 641 AC_DEFINE([HAVE_TM_GMTOFF], [1], 642 [Define if `struct tm' has the `tm_gmtoff' member.]) 643 AC_DEFINE_UNQUOTED([TM_GMTOFF], [${val_tm_gmtoff}], 644 [Define to name of `tm_gmtoff' member if available.]) 645fi 646 647if test -n "${val_timezone}"; then 648 AC_DEFINE([HAVE_TIMEZONE], [1], 649 [Define if timezone variable is available.]) 650 AC_DEFINE_UNQUOTED([TIMEZONE], [${val_timezone}], 651 [Define to name of timezone variable if available.]) 652fi 653 654AC_CHECK_TYPE([struct ltchars], 655 [AC_DEFINE([HAVE_STRUCT_LTCHARS], [1], 656 [Define if `struct ltchars' is defined in <bsdtty.h>.])], 657 [], 658 [SCM_INC_BSDTTY]) 659 660AC_CHECK_MEMBER([struct hostent.h_addr_list], 661 [AC_DEFINE([HAVE_HOSTENT_H_ADDR_LIST], [1], 662 [Define if `struct hostent' has the `h_addr_list' member.])], 663 [], 664 [SCM_INC_NETDB]) 665 666AC_CHECK_TYPE([struct sigcontext], 667 [AC_DEFINE([HAVE_STRUCT_SIGCONTEXT], [1], 668 [Define if `struct sigcontext' is defined in <signal.h>.])], 669 [], 670 [SCM_INC_SIGNAL]) 671 672AC_CHECK_TYPE([struct ntptimeval], 673 [AC_DEFINE([HAVE_STRUCT_NTPTIMEVAL], [1], 674 [Define if `struct ntptimeval' is defined in <sys/timex.h>.]) 675 AC_CHECK_MEMBER([struct ntptimeval.tai], 676 [AC_DEFINE([HAVE_NTPTIMEVAL_TAI], [1], 677 [Define if `struct ntptimeval' has the `tai' member.])], 678 [], 679 [SCM_INC_SYS_TIMEX]) 680 AC_CHECK_MEMBER([struct ntptimeval.time.tv_nsec], 681 [AC_DEFINE([HAVE_NTPTIMEVAL_TIME_TV_NSEC], [1], 682 [Define if `struct ntptimeval' has the `time.tv_nsec' member.])], 683 [], 684 [SCM_INC_SYS_TIMEX])], 685 [], 686 [SCM_INC_SYS_TIMEX]) 687 688AC_CHECK_TYPE([struct timex], 689 [AC_DEFINE([HAVE_STRUCT_TIMEX], [1], 690 [Define if `struct timex' is defined in <sys/timex.h>.]) 691 AC_CHECK_MEMBER([struct timex.tai], 692 [AC_DEFINE([HAVE_TIMEX_TAI], [1], 693 [Define if `struct timex' has the `tai' member.])], 694 [], 695 [SCM_INC_SYS_TIMEX]) 696 AC_CHECK_MEMBER([struct timex.time.tv_usec], 697 [AC_DEFINE([HAVE_TIMEX_TIME_TV_USEC], [1], 698 [Define if `struct timex' has the `time.tv_usec' member.])], 699 [], 700 [SCM_INC_SYS_TIMEX])], 701 [], 702 [SCM_INC_SYS_TIMEX]) 703 704dnl Checks for compiler characteristics. 705AC_C_BIGENDIAN 706AC_C_CHAR_UNSIGNED 707AC_C_CONST 708 709dnl Checks for C library functions. 710AC_FUNC_GETPGRP 711AC_FUNC_MEMCMP 712AC_FUNC_MMAP 713AC_FUNC_SETPGRP 714AC_FUNC_SETVBUF_REVERSED 715AC_FUNC_UTIME_NULL 716AC_FUNC_VFORK 717AC_FUNC_VPRINTF 718AC_FUNC_WAIT3 719AC_CHECK_FUNCS([clock_gettime closefrom ctermid]) 720AC_CHECK_FUNCS([dup2]) 721AC_CHECK_FUNCS([expm1]) 722AC_CHECK_FUNCS([fcntl fdatasync feclearexcept fedisableexcept feenableexcept]) 723AC_CHECK_FUNCS([fegetenv fegetexcept fegetexceptflag fegetround feholdexcept]) 724AC_CHECK_FUNCS([feraiseexcept fesetenv fesetexceptflag fesetround]) 725AC_CHECK_FUNCS([fetestexcept feupdateenv floor fmod fpathconf fpgetround]) 726AC_CHECK_FUNCS([fpsetround frexp fsync fsync_range ftruncate]) 727AC_CHECK_FUNCS([getcwd gethostbyname gethostname getlogin getpagesize getpgrp]) 728AC_CHECK_FUNCS([getpt gettimeofday getwd grantpt]) 729AC_CHECK_FUNCS([kill]) 730AC_CHECK_FUNCS([lockf log1p]) 731AC_CHECK_FUNCS([madvise memcpy mkdir mktime modf]) 732AC_CHECK_FUNCS([nice ntp_adjtime ntp_gettime]) 733AC_CHECK_FUNCS([openpty]) 734AC_CHECK_FUNCS([poll pollts ppoll posix_madvise posix_openpt prealloc]) 735AC_CHECK_FUNCS([rename rmdir]) 736AC_CHECK_FUNCS([pselect select setitimer setpgrp setpgrp2 shmat sigaction]) 737AC_CHECK_FUNCS([sighold sigsuspend socket statfs strchr strerror strstr strtol]) 738AC_CHECK_FUNCS([strtoul symlink sync_file_range sysconf]) 739AC_CHECK_FUNCS([times truncate]) 740AC_CHECK_FUNCS([uname utime]) 741AC_CHECK_FUNCS([waitpid]) 742 743if test ${ac_cv_type_signal} = void; then 744 AC_DEFINE([VOID_SIGNAL_HANDLERS], [1], 745 [Define if RETSIGTYPE is `void'.]) 746fi 747 748dnl Checks for system characteristics. 749AC_PATH_X 750AC_SYS_LARGEFILE 751AC_SYS_LONG_FILE_NAMES 752 753dnl curses/termcap/terminfo support 754 755dnl This is a mess because neither `tparam' nor `tparm' is available 756dnl everywhere, but as long as we have some access to the termcap 757dnl database, we can emulate `tparam' -- either in terms of `tparm' or 758dnl by pretending we know the format -- without bringing in the local 759dnl termcap reimplementation. 760 761if test "x${with_termcap}" = xyes; then 762 763 AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.]) 764 AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h]) 765 AC_CHECK_LIB([ncurses], [tgetent], [have_ncurses=yes]) 766 AC_CHECK_LIB([ncurses], [tparm], [have_ncurses_tparm=yes]) 767 AC_CHECK_LIB([ncurses], [tparam], [have_ncurses_tparam=yes]) 768 AC_CHECK_LIB([curses], [tgetent], [have_curses=yes]) 769 AC_CHECK_LIB([curses], [tparm], [have_curses_tparm=yes]) 770 AC_CHECK_LIB([curses], [tparam], [have_curses_tparam=yes]) 771 AC_CHECK_LIB([termcap], [tgetent], [have_termcap=yes]) 772 AC_CHECK_LIB([termcap], [tparm], [have_termcap_tparm=yes]) 773 AC_CHECK_LIB([termcap], [tparam], [have_termcap_tparam=yes]) 774 775 if test "x${have_ncurses}" = xyes; then 776 with_termcap=ncurses 777 elif test "x${have_curses_tparm}" != xyes \ 778 || test "x${have_curses_tparam}" != xyes 779 then 780 if test "x${have_termcap}" = xyes; then 781 with_termcap=termcap 782 elif test "x${have_curses}" = xyes; then 783 with_termcap=curses 784 fi 785 dnl This is a little unusual (that we have either `tparm' or `tparam' 786 dnl from `-lcurses', but not `tgetent'), but we should check anyway. 787 elif test "x${have_curses}" = xyes; then 788 with_termcap=curses 789 elif test "x${have_termcap}" = xyes; then 790 with_termcap=termcap 791 fi 792 793elif test "x${with_termcap}" != xno; then 794 795 AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.]) 796 AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h]) 797 lib=${with_termcap} 798 AC_CHECK_LIB([${lib}], [tgetent], [eval have_${lib}=yes]) 799 AC_CHECK_LIB([${lib}], [tparm], [eval have_${lib}_tparm=yes]) 800 AC_CHECK_LIB([${lib}], [tparam], [eval have_${lib}_tparam=yes]) 801 802 if eval test "\"x\${have_${lib}}\"" != xyes; then 803 AC_MSG_ERROR([No tgetent in termcap library: ${with_termcap}]) 804 fi 805 806fi 807 808case "${with_termcap}" in 809yes) 810 AC_MSG_WARN([No termcap library found; will emulate it]) 811 OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam tterm" 812 ;; 813no) 814 AC_MSG_NOTICE([Termcap disabled.]) 815 ;; 816*) 817 LIBS="-l${with_termcap} ${LIBS}" 818 eval have_tparam=\$have_${with_termcap}_tparam 819 if test "x${have_tparam}" != xyes; then 820 eval have_tparm=\$have_${with_termcap}_tparm 821 if test "x${have_tparm}" = xyes; then 822 AC_MSG_WARN([No tparam found; will emulate it from terminfo tparm]) 823 OPTIONAL_BASES="${OPTIONAL_BASES} terminfo tterm" 824 else 825 AC_MSG_WARN([No tparam found; will emulate it]) 826 OPTIONAL_BASES="${OPTIONAL_BASES} tparam tterm" 827 fi 828 fi 829 ;; 830esac 831 832dnl The OpenSSL crypto library provides support for blowfish and MD5. 833if test "${with_openssl}" != no; then 834 if test "${with_openssl}" != yes; then 835 CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include" 836 LDFLAGS="${LDFLAGS} -L${with_openssl}/lib" 837 fi 838 FOUND= 839 AC_CHECK_HEADERS([openssl/blowfish.h openssl/md5.h], 840 [ 841 AC_CHECK_LIB([crypto], [BF_set_key], 842 [ 843 AC_DEFINE([HAVE_LIBCRYPTO], [1], 844 [Define to 1 if you have the `crypto' library (-lcrypto).]) 845 FOUND=yes 846 ]) 847 ]) 848 if test -n "${FOUND}"; then 849 MODULE_LIBS="-lcrypto ${MODULE_LIBS}" 850 MODULE_BASES="${MODULE_BASES} prbfish prmd5" 851 PRBFISH_LIBS="-lcrypto" 852 PRMD5_LIBS="-lcrypto" 853 fi 854fi 855 856dnl These libraries might not be installed, so take care generating 857dnl file dependencies using "makegen/makegen.scm" when called on 858dnl "makegen/files-optional.scm". To wit, "prmhash.c" & "prmcrypt.c" 859dnl must conditionalize their dependencies on <mhash.h> & <mcrypt.h>, 860dnl respectively, to avoid warnings in "Makefile.deps" and its embeds. 861dnl Finally, note that "prmd5.c" is similarly conditionalized as well. 862 863dnl The mhash library provides MD5 support. It can be loaded in addition 864dnl to other MD5 libraries and provides a rich set of hashes. 865if test "${with_mhash}" != no; then 866 if test "${with_mhash}" != yes; then 867 CPPFLAGS="${CPPFLAGS} -I${with_mhash}/include" 868 LDFLAGS="${LDFLAGS} -L${with_mhash}/lib" 869 fi 870 AC_CHECK_HEADER([mhash.h], 871 [ 872 AC_DEFINE([HAVE_MHASH_H], [1], 873 [Define to 1 if you have the <mhash.h> header file.]) 874 AC_CHECK_LIB([mhash], [mhash_count], 875 [ 876 AC_DEFINE([HAVE_LIBMHASH], [1], 877 [Define to 1 if you have the `mhash' library (-lmhash).]) 878 if test ${enable_debugging} != no; then 879 LIBS="-lmhash ${LIBS}" 880 fi 881 MODULE_LIBS="-lmhash ${MODULE_LIBS}" 882 MODULE_BASES="${MODULE_BASES} prmhash" 883 if test "x${PRMD5_LIBS}" = x; then 884 PRMD5_LIBS="-lmhash" 885 fi 886 ]) 887 ]) 888fi 889 890dnl The mcrypt library provides blowfish, but its CFB mode is 8 bit. 891dnl We have been using 64-bit CFB, so this isn't really compatible. 892dnl But mcrypt provides many ciphers and can be loaded in addition. 893if test "${with_mcrypt}" != no; then 894 if test "${with_mcrypt}" != yes; then 895 CPPFLAGS="${CPPFLAGS} -I${with_mcrypt}/include" 896 LDFLAGS="${LDFLAGS} -L${with_mcrypt}/lib" 897 fi 898 AC_CHECK_HEADER([mcrypt.h], 899 [ 900 AC_DEFINE([HAVE_MCRYPT_H], [1], 901 [Define to 1 if you have the <mcrypt.h> header file.]) 902 AC_CHECK_LIB([mcrypt], [mcrypt_generic_init], 903 [ 904 AC_DEFINE([HAVE_LIBMCRYPT], [1], 905 [Define to 1 if you have the `mcrypt' library (-lmcrypt).]) 906 MODULE_LIBS="-lmcrypt ${MODULE_LIBS}" 907 MODULE_BASES="${MODULE_BASES} prmcrypt" 908 ]) 909 ]) 910fi 911 912dnl gdbm support 913if test "${with_gdbm}" != no; then 914 if test "${with_gdbm}" != yes; then 915 CPPFLAGS="${CPPFLAGS} -I${with_gdbm}/include" 916 LDFLAGS="${LDFLAGS} -L${with_gdbm}/lib" 917 fi 918 AC_CHECK_HEADER([gdbm.h], 919 [ 920 AC_DEFINE([HAVE_GDBM_H], [1], 921 [Define to 1 if you have the <gdbm.h> header file.]) 922 AC_CHECK_LIB([gdbm], [gdbm_open], 923 [ 924 AC_DEFINE([HAVE_LIBGDBM], [1], 925 [Define to 1 if you have the `gdbm' library (-lgdbm).]) 926 MODULE_LIBS="-lgdbm ${MODULE_LIBS}" 927 MODULE_BASES="${MODULE_BASES} prgdbm" 928 ]) 929 ]) 930fi 931 932dnl DB v4 support 933if test "${with_db_4}" != no; then 934 if test "${with_db_4}" != yes; then 935 CPPFLAGS="${CPPFLAGS} -I${with_db_4}/include" 936 LDFLAGS="${LDFLAGS} -L${with_db_4}/lib" 937 fi 938 AC_CHECK_HEADER([db.h], 939 [ 940 AC_DEFINE([HAVE_DB_H], [1], 941 [Define to 1 if you have the <db.h> header file.]) 942 AC_MSG_CHECKING([for db_create in -ldb-4]) 943 save_LIBS=${LIBS} 944 LIBS="${LIBS} -ldb-4" 945 AC_LINK_IFELSE( 946 [AC_LANG_PROGRAM( 947 [[#include <db.h>]], 948 [[db_create (0, 0, 0)]])], 949 [ 950 AC_MSG_RESULT([yes]) 951 AC_DEFINE([HAVE_LIBDB_4], [1], 952 [Define to 1 if you have the `db-4' library (-ldb-4).]) 953 MODULE_LIBS="-ldb-4 ${MODULE_LIBS}" 954 MODULE_BASES="${MODULE_BASES} prdb4" 955 ], 956 [ 957 AC_MSG_RESULT([no]) 958 ]) 959 LIBS=${save_LIBS} 960 ]) 961fi 962 963dnl PostgreSQL support 964if test "${with_libpq}" != no; then 965 if test "${with_libpq}" != yes; then 966 libpq_inc=${with_libpq}/include 967 libpq_lib=${with_libpq}/lib 968 else 969 AC_PATH_PROG([PG_CONFIG], [pg_config]) 970 if test "x${PG_CONFIG}" != x; then 971 libpq_inc=`${PG_CONFIG} --includedir 2>/dev/null` 972 libpq_lib=`${PG_CONFIG} --libdir 2>/dev/null` 973 else 974 if test -d /usr/include/postgresql; then 975 libpq_inc=/usr/include/postgresql 976 else 977 libpq_inc=/usr/include 978 fi 979 libpq_lib=/usr/lib 980 fi 981 fi 982 if test "x${libpq_inc}" != x; then 983 if test "${libpq_inc}" != /usr/include; then 984 CPPFLAGS="${CPPFLAGS} -I${libpq_inc}" 985 fi 986 fi 987 if test "x${libpq_lib}" != x; then 988 if test "${libpq_lib}" != /usr/lib; then 989 LDFLAGS="${LDFLAGS} -L${libpq_lib}" 990 fi 991 fi 992 AC_CHECK_HEADER([libpq-fe.h], 993 [ 994 AC_DEFINE([HAVE_LIBPQ_FE_H], [1], 995 [Define to 1 if you have the <libpq-fe.h> header file.]) 996 AC_CHECK_LIB([pq], [PQconnectdb], 997 [ 998 AC_DEFINE([HAVE_LIBPQ], [1], 999 [Define to 1 if you have the `pq' library (-lpq).]) 1000 MODULE_LIBS="-lpq ${MODULE_LIBS}" 1001 MODULE_BASES="${MODULE_BASES} prpgsql" 1002 ]) 1003 ]) 1004fi 1005 1006dnl Add support for X if present. 1007if test "${no_x}" != yes; then 1008 if test "x${x_includes}" != x; then 1009 FOO=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` 1010 CPPFLAGS="${CPPFLAGS} ${FOO}" 1011 fi 1012 if test "x${x_libraries}" != x; then 1013 FOO=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` 1014 LDFLAGS="${LDFLAGS} ${FOO}" 1015 fi 1016 MODULE_LIBS="-lX11 ${MODULE_LIBS}" 1017 MODULE_BASES="${MODULE_BASES} prx11" 1018 MODULE_AUX_BASES="${MODULE_AUX_BASES} x11base x11color x11graph x11term" 1019fi 1020 1021dnl Check for dynamic loader support. 1022AC_CHECK_FUNC([dlopen], 1023 [], 1024 [ 1025 AC_CHECK_LIB([dl], [dlopen], 1026 [ 1027 AC_DEFINE([HAVE_LIBDL], [1], 1028 [Define to 1 if you have the `dl' library (-ldl).]) 1029 LIBS="-ldl ${LIBS}" 1030 ], 1031 [ 1032 if test ${mit_scheme_native_code} = c; then 1033 AC_MSG_ERROR( 1034 [--enable-native-code=c requires dynamic loader support]) 1035 fi 1036 ]) 1037 ]) 1038OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld pruxffi" 1039AC_DEFINE([UX_DLD_ENABLED], [1], 1040 [Define to 1 if unix dynamic loading support is enabled.]) 1041 1042if test ${enable_valgrind_mode} != no; then 1043 SCHEME_DEFS="${SCHEME_DEFS} -DVALGRIND_MODE" 1044 M4_FLAGS="${M4_FLAGS} -P VALGRIND_MODE,1" 1045fi 1046 1047OPTIONAL_BASES="${OPTIONAL_BASES} cmpint cmpintmd comutl" 1048 1049case ${mit_scheme_native_code} in 1050none) 1051 ;; 1052c) 1053 AC_CONFIG_LINKS([cmpauxmd.c:cmpauxmd/c.c]) 1054 AC_CONFIG_FILES([liarc-cc], [chmod +x liarc-cc]) 1055 AC_CONFIG_FILES([liarc-ld], [chmod +x liarc-ld]) 1056 OPTIONAL_BASES="${OPTIONAL_BASES} cmpauxmd unstackify compinit" 1057 LIARC_VARS=liarc-vars 1058 LIARC_RULES=liarc-rules 1059 AUX_PROGRAMS="gen-nonce extract-liarc-decls" 1060 INSTALL_INCLUDE=install-include 1061 ;; 1062svm1) 1063 OPTIONAL_BASES="${OPTIONAL_BASES} svm1-interp" 1064 ;; 1065*) 1066 AC_CHECK_PROG([M4], [m4], [m4]) 1067 if test "x${M4}" = x; then 1068 AC_MSG_ERROR([m4 not found]) 1069 fi 1070 AC_CONFIG_LINKS([cmpauxmd.m4:cmpauxmd/${mit_scheme_native_code}.m4]) 1071 OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.m4" 1072 OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} cmpauxmd.o" 1073 ;; 1074esac 1075 1076AC_CONFIG_LINKS([ 1077 cmpintmd.h:cmpintmd/${mit_scheme_native_code}.h 1078 cmpintmd.c:cmpintmd/${mit_scheme_native_code}.c 1079 cmpintmd-config.h:cmpintmd/${mit_scheme_native_code}-config.h 1080 ]) 1081 1082for base in ${OPTIONAL_BASES}; do 1083 OPTIONAL_SOURCES="${OPTIONAL_SOURCES} ${base}.c" 1084 OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} ${base}.o" 1085done 1086 1087if test "x${MODULE_BASES}" != x; then 1088 MODULE_RULES=config-rules.module 1089 rm -f ${MODULE_RULES} 1090 for BASE in ${MODULE_BASES}; do 1091 MODULE_TARGETS="${MODULE_TARGETS} ${BASE}.so" 1092 MODULE_AUX_BASES="${MODULE_AUX_BASES} ${BASE}" 1093 done 1094 for BASE in ${MODULE_AUX_BASES}; do 1095 echo >> ${MODULE_RULES} 1096 echo ${BASE}.o: ${BASE}.c >> ${MODULE_RULES} 1097 echo " " '$(COMPILE_MODULE)' -c '$*.c' >> ${MODULE_RULES} 1098 done 1099fi 1100if test "x${MODULE_TARGETS}" != x; then 1101 if test ! -e ../lib/lib; then mkdir ../lib/lib; fi 1102 for BASE in ${MODULE_TARGETS}; do 1103 ln -sf ../../microcode/${BASE} ../lib/lib/${BASE} 1104 done 1105fi 1106 1107AC_SUBST([AS_FLAGS]) 1108AC_SUBST([GC_HEAD_FILES]) 1109AC_SUBST([M4_FLAGS]) 1110AC_SUBST([M4]) 1111AC_SUBST([OPTIONAL_SOURCES]) 1112AC_SUBST([OPTIONAL_OBJECTS]) 1113AC_SUBST([PRBFISH_LIBS]) 1114AC_SUBST([PRMD5_LIBS]) 1115AC_SUBST([SCHEME_DEFS]) 1116AC_SUBST([SCHEME_LDFLAGS]) 1117AC_SUBST([MODULE_TARGETS]) 1118AC_SUBST_FILE([MODULE_RULES]) 1119AC_SUBST([MODULE_CFLAGS]) 1120AC_SUBST([MODULE_LDFLAGS]) 1121AC_SUBST([MODULE_LOADER]) 1122AC_SUBST_FILE([LIARC_VARS]) 1123AC_SUBST_FILE([LIARC_RULES]) 1124AC_SUBST([AUX_PROGRAMS]) 1125AC_SUBST([AUX_DATA]) 1126AC_SUBST([AUXDIR_NAME]) 1127AC_SUBST([EXE_NAME]) 1128AC_SUBST([INSTALL_INCLUDE]) 1129AC_SUBST([CCLD]) 1130 1131AC_CONFIG_FILES([Makefile]) 1132AC_OUTPUT 1133 1134# Make custom compilation program for "makegen.scm". 1135rm -f makegen-cc 1136echo "#!/bin/sh" > makegen-cc 1137echo exec gcc -MM -MG -DMIT_SCHEME ${CPPFLAGS} '"${1}"' >> makegen-cc 1138chmod +x makegen-cc 1139 1140if test ${MODULE_RULES} != /dev/null; then 1141 rm -f ${MODULE_RULES} 1142fi 1143