Merge in most of the changes from pre-v15 branch; eliminate gratuitous
authorChris Hanson <org/chris-hanson/cph>
Thu, 11 Jan 2007 21:07:29 +0000 (21:07 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 11 Jan 2007 21:07:29 +0000 (21:07 +0000)
differences with that file.

v7/src/microcode/configure.ac

index 50435eeeed7fdcf27b75c458980d3462190370d1..92b3fb83095230fdca3902bf7a999eab7549b3a5 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT([MIT/GNU Scheme microcode], [14.18], [bug-mit-scheme@gnu.org], [mit-scheme])
-AC_REVISION([$Id: configure.ac,v 1.24 2007/01/10 08:17:22 cph Exp $])
+AC_REVISION([$Id: configure.ac,v 1.25 2007/01/11 21:07:29 cph Exp $])
 AC_CONFIG_SRCDIR([boot.c])
 AC_CONFIG_HEADERS([config.h])
 AC_PROG_MAKE_SET
@@ -113,47 +113,50 @@ AH_BOTTOM(
 
 #endif /* SCM_CONFIG_H */])
 
-dnl Feature options.
-AC_ARG_ENABLE([c-back-end],
-    AS_HELP_STRING([--enable-c-back-end],
-       [Build portable system with C output [[no]]]))
+dnl Feature options
 AC_ARG_ENABLE([static-libs],
     AS_HELP_STRING([--enable-static-libs],
        [Link some libraries statically [[no]]]))
-AC_ARG_ENABLE([dynamic-modules],
-    AS_HELP_STRING([--enable-dynamic-modules],
-       [Link some primitives dynamically [[yes]]]))
+: ${enable_static_libs='no'}
+
 AC_ARG_ENABLE([valgrind-mode],
     AS_HELP_STRING([--enable-valgrind-mode],
        [Support running under valgrind [[no]]]))
+: ${enable_valgrind_mode='no'}
+
+AC_ARG_ENABLE([native-code],
+    AS_HELP_STRING([--enable-native-code],
+       [Support native compiled code if available [[yes]]]))
+: ${enable_native_code='yes'}
+
 AC_ARG_WITH([openssl],
     AS_HELP_STRING([--with-openssl],
        [Use OpenSSL crypto library if available [[yes]]]))
+: ${with_openssl='yes'}
+
 AC_ARG_WITH([mhash],
     AS_HELP_STRING([--with-mhash],
        [Use mhash library if available [[yes]]]))
+: ${with_mhash='yes'}
+
 AC_ARG_WITH([mcrypt],
     AS_HELP_STRING([--with-mcrypt],
        [Use mcrypt library if available [[yes]]]))
+: ${with_mcrypt='yes'}
+
 AC_ARG_WITH([gdbm],
     AS_HELP_STRING([--with-gdbm],
        [Use gdbm library if available [[yes]]]))
-AC_ARG_WITH([db4],
-    AS_HELP_STRING([--with-db4],
+: ${with_gdbm='yes'}
+
+AC_ARG_WITH([db-4],
+    AS_HELP_STRING([--with-db-4],
        [Use Berkeley DB v4 library if available [[yes]]]))
+: ${with_db_4='yes'}
+
 AC_ARG_WITH([libpq],
     AS_HELP_STRING([--with-libpq],
        [Use PostgreSQL libpq library if available [[yes]]]))
-
-: ${enable_c_back_end='no'}
-: ${enable_static_libs='no'}
-: ${enable_dynamic_modules='yes'}
-: ${enable_valgrind_mode='no'}
-: ${with_openssl='yes'}
-: ${with_mhash='yes'}
-: ${with_mcrypt='yes'}
-: ${with_gdbm='yes'}
-: ${with_db4='yes'}
 : ${with_libpq='yes'}
 
 dnl Substitution variables to be filled in below.
@@ -161,10 +164,9 @@ AS_FLAGS=
 GC_HEAD_FILES=
 M4_FLAGS=
 OPTIONAL_BASES=
-OPTIONAL_OBJECTS=
 OPTIONAL_SOURCES=
+OPTIONAL_OBJECTS=
 STATIC_LIBS=
-QUASI_STATIC_LIBS=
 STATIC_PREFIX=
 STATIC_SUFFIX=
 PRBFISH_LIBS=
@@ -172,12 +174,15 @@ PRMD5_LIBS=
 SCHEME_DEFS=
 DLD_LDFLAGS=
 MODULE_BASES=
+MODULE_LIBS=
+MODULE_TARGETS=
+MODULE_RULES=/dev/null
 MODULE_CFLAGS="-DCOMPILE_AS_MODULE"
 MODULE_LDFLAGS=
 COMPILED_DEFS=
 COMPILED_SOURCES=
 COMPILED_OBJECTS=
-CBE_RULES=
+CBE_RULES=/dev/null
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -185,7 +190,7 @@ AC_PROG_GCC_TRADITIONAL
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
-if test "${GCC}" = yes; then
+if test ${GCC} = yes; then
     CFLAGS="${CFLAGS} -Wall"
 fi
 FOO=`${INSTALL} --help 2> /dev/null | fgrep -e --preserve-timestamps`
@@ -194,298 +199,242 @@ if test "x${FOO}" != x; then
 fi
 
 dnl Checks for libraries.
-AC_CHECK_LIB([dl], [dlopen])
 AC_CHECK_LIB([m], [exp])
 
-AC_CHECK_LIB([ncurses], [tparm],
-    [scheme_cv_lib_ncurses=yes],
-    [scheme_cv_lib_ncurses=no])
-AC_CHECK_LIB([ncurses], [tparam],
-    [scheme_cv_lib_ncurses_defines_tparam=yes],
-    [scheme_cv_lib_ncurses_defines_tparam=no])
-AC_CHECK_LIB([curses], [tparm],
-    [scheme_cv_lib_curses=yes],
-    [scheme_cv_lib_curses=no])
-AC_CHECK_LIB([termcap], [tparam],
-    [scheme_cv_lib_termcap=yes],
-    [scheme_cv_lib_termcap=no])
-
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
+AC_HEADER_STDBOOL
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 AC_CHECK_HEADERS([bsdtty.h fcntl.h limits.h malloc.h sgtty.h stropts.h time.h])
 AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/poll.h])
 AC_CHECK_HEADERS([sys/ptyio.h sys/socket.h sys/time.h sys/un.h sys/vfs.h])
-AC_CHECK_HEADERS([stdbool.h termio.h termios.h unistd.h utime.h])
-AC_CHECK_HEADERS([curses.h term.h dlfcn.h sys/mman.h])
-
-dnl Checks for typedefs
+AC_CHECK_HEADERS([termio.h termios.h unistd.h utime.h])
+AC_CHECK_HEADERS([dlfcn.h netdb.h signal.h])
+AC_CHECK_HEADERS([sys/mman.h float.h assert.h stdint.h])
+
+define([SCM_INC_TIME],
+    [
+    #ifdef TIME_WITH_SYS_TIME
+    #  include <sys/time.h>
+    #  include <time.h>
+    #else
+    #  ifdef HAVE_SYS_TIME_H
+    #    include <sys/time.h>
+    #  else
+    #    include <time.h>
+    #  endif
+    #endif
+    ])
+
+define([SCM_INC_TERMIO],
+    [
+    #ifdef HAVE_TERMIOS_H
+    #  include <termios.h>
+    #else
+    #  ifdef HAVE_TERMIO_H
+    #    include <termio.h>
+    #  endif
+    #endif
+    ])
+
+define([SCM_INC_NETDB],
+    [
+    #ifdef HAVE_NETDB_H
+    #  include <netdb.h>
+    #endif
+    ])
+
+define([SCM_INC_SIGNAL],
+    [
+    #ifdef HAVE_SIGNAL_H
+    #  include <signal.h>
+    #endif
+    ])
+
+define([SCM_INC_SOCKET],
+    [
+    #include <sys/types.h>
+    #ifdef HAVE_SYS_SOCKET_H
+    #  include <sys/socket.h>
+    #endif
+    ])
+
+define([SCM_INC_BSDTTY],
+    [
+    #ifdef HAVE_BSDTTY_H
+    #  include <bsdtty.h>
+    #endif
+    ])
+
+dnl Checks for types and structs
 AC_TYPE_MODE_T
 AC_TYPE_OFF_T
 AC_TYPE_PID_T
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 AC_TYPE_UID_T
-AC_CHECK_TYPE([nlink_t], [short])
 
-AC_MSG_CHECKING([for clock_t])
-AC_TRY_COMPILE([
-#ifdef TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else
-#    include <time.h>
-#  endif
-#endif],
-    [clock_t x;],
-    [scheme_cv_type_clock_t=yes],
-    [scheme_cv_type_clock_t=no])
-AC_MSG_RESULT(${scheme_cv_type_clock_t})
-if test "${scheme_cv_type_clock_t}" = no; then
-    AC_DEFINE([clock_t], [unsigned long],
-       [Define to `unsigned long' if <time.h> doesn't define.])
-fi
+AC_TYPE_INT8_T
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INTPTR_T
+
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINTPTR_T
+
+AC_CHECK_SIZEOF([char])
+AC_CHECK_SIZEOF([short])
+AC_CHECK_SIZEOF([int])
+AC_CHECK_SIZEOF([long])
+AC_CHECK_SIZEOF([unsigned char])
+AC_CHECK_SIZEOF([unsigned short])
+AC_CHECK_SIZEOF([unsigned int])
+AC_CHECK_SIZEOF([unsigned long])
+AC_CHECK_SIZEOF([void *])
+AC_CHECK_SIZEOF([intptr_t])
+AC_CHECK_SIZEOF([uintptr_t])
 
-AC_MSG_CHECKING([for time_t])
-AC_TRY_COMPILE([
-#ifdef TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else
-#    include <time.h>
-#  endif
-#endif],
-    [time_t x;],
-    [scheme_cv_type_time_t=yes],
-    [scheme_cv_type_time_t=no])
-AC_MSG_RESULT(${scheme_cv_type_time_t})
-if test "${scheme_cv_type_time_t}" = no; then
-    AC_DEFINE([time_t], [long],
-       [Define to `long' if <time.h> doesn't define.])
+if test ${ac_cv_sizeof_char} -ne 1; then
+    AC_MSG_ERROR([SIZEOF_CHAR is not 1])
 fi
 
-if test "${ac_cv_header_sys_socket_h}" = yes; then
-    AC_MSG_CHECKING([for socklen_t])
-    AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>],
-       [socklen_t x;],
-       [scheme_cv_type_socklen_t=yes],
-       [scheme_cv_type_socklen_t=no])
-    AC_MSG_RESULT(${scheme_cv_type_socklen_t})
-    if test "${scheme_cv_type_socklen_t}" = no; then
-       AC_DEFINE([socklen_t], [int],
-           [Define to `int' if <sys/socket.h> doesn't define.])
-    fi
+if test ${ac_cv_sizeof_unsigned_char} -ne 1; then
+    AC_MSG_ERROR([SIZEOF_UNSIGNED_CHAR is not 1])
 fi
 
-AC_MSG_CHECKING([for cc_t])
-AC_TRY_COMPILE([
-#ifdef HAVE_TERMIOS_H
-#  include <termios.h>
-#else
-#  ifdef HAVE_TERMIO_H
-#    include <termio.h>
-#  endif
-#endif],
-       [cc_t x;],
-       [scheme_cv_type_cc_t=yes],
-       [scheme_cv_type_cc_t=no])
-AC_MSG_RESULT(${scheme_cv_type_cc_t})
-if test "${scheme_cv_type_cc_t}" = no; then
-    AC_DEFINE([cc_t], [unsigned char],
-       [Define to `unsigned char' if <termios.h> doesn't define.])
-fi
+AC_CHECK_TYPE([nlink_t],
+    [],
+    [AC_DEFINE([nlink_t], [short],
+       [Define to 'short' if undefined.])])
 
-AC_MSG_CHECKING([for speed_t])
-AC_TRY_COMPILE([
-#ifdef HAVE_TERMIOS_H
-#  include <termios.h>
-#else
-#  ifdef HAVE_TERMIO_H
-#    include <termio.h>
-#  endif
-#endif],
-       [speed_t x;],
-       [scheme_cv_type_speed_t=yes],
-       [scheme_cv_type_speed_t=no])
-AC_MSG_RESULT(${scheme_cv_type_speed_t})
-if test "${scheme_cv_type_speed_t}" = no; then
-    AC_DEFINE([speed_t], [short],
-       [Define to `short' if <termios.h> doesn't define.])
-fi
+AC_CHECK_TYPE([clock_t],
+    [],
+    [AC_DEFINE([clock_t], [unsigned long],
+       [Define to `unsigned long' if <time.h> doesn't define.])],
+    [SCM_INC_TIME])
+
+AC_CHECK_TYPE([time_t], 
+    [],
+    [AC_DEFINE([time_t], [long],
+       [Define to `long' if <time.h> doesn't define.])],
+    [SCM_INC_TIME])
+
+AC_CHECK_TYPE([socklen_t],
+    [],
+    [AC_DEFINE([socklen_t], [int],
+       [Define to `int' if <sys/socket.h> doesn't define.])],
+    [SCM_INC_SOCKET])
+
+AC_CHECK_TYPE([cc_t],
+    [],
+    [AC_DEFINE([cc_t], [unsigned char],
+       [Define to `unsigned char' if <termios.h> doesn't define.])],
+    [SCM_INC_TERMIO])
+
+AC_CHECK_TYPE([speed_t],
+    [],
+    [AC_DEFINE([speed_t], [short],
+       [Define to `short' if <termios.h> doesn't define.])],
+    [SCM_INC_TERMIO])
 
-dnl Checks for structures.
 AC_STRUCT_TM
 AC_STRUCT_TIMEZONE
 
-
 dnl Timezone stuff is hairy; there's no standard.
 have_timezone_info=no
+val_tm_gmtoff=
+val_timezone=
 
-if test "${have_timezone_info}" = no; then
-    AC_MSG_CHECKING([for tm_gmtoff in struct tm])
-    AC_TRY_LINK(
-       [#include <time.h>],
-       [struct tm t; t.tm_gmtoff],
-       [scheme_cv_struct_tm_gmtoff=yes],
-       [scheme_cv_struct_tm_gmtoff=no])
-    AC_MSG_RESULT(${scheme_cv_struct_tm_gmtoff})
-    if test "${scheme_cv_struct_tm_gmtoff}" = yes; then
-       AC_DEFINE([HAVE_TM_GMTOFF], [1],
-           [Define if `struct tm' has the `tm_gmtoff' member.])
-       AC_DEFINE([TM_GMTOFF], [tm_gmtoff],
-           [Define to name of `tm_gmtoff' member if available.])
+if test ${have_timezone_info} = no; then
+    AC_CHECK_MEMBER([struct tm.tm_gmtoff],
+       [
        have_timezone_info=yes
-    fi
+       val_tm_gmtoff=tm_gmtoff
+       ],
+       [],
+       [SCM_INC_TIME])
 fi
 
-if test "${have_timezone_info}" = no; then
-    AC_MSG_CHECKING([for __tm_gmtoff in struct tm])
-    AC_TRY_LINK(
-       [#include <time.h>],
-       [struct tm t; t.__tm_gmtoff],
-       [scheme_cv_struct___tm_gmtoff=yes],
-       [scheme_cv_struct___tm_gmtoff=no])
-    AC_MSG_RESULT(${scheme_cv_struct___tm_gmtoff})
-    if test "${scheme_cv_struct___tm_gmtoff}" = yes; then
-       AC_DEFINE([HAVE_TM_GMTOFF], [1],
-           [Define if `struct tm' has the `tm_gmtoff' member.])
-       AC_DEFINE([TM_GMTOFF], [__tm_gmtoff],
-           [Define to name of `tm_gmtoff' member if available.])
+if test ${have_timezone_info} = no; then
+    AC_CHECK_MEMBER([struct tm.__tm_gmtoff],
+       [
        have_timezone_info=yes
-    fi
+       val_tm_gmtoff=__tm_gmtoff
+       ],
+       [],
+       [SCM_INC_TIME])
 fi
 
-if test "${have_timezone_info}" = no; then
-    AC_MSG_CHECKING([for __timezone])
-    AC_TRY_LINK([
-#ifdef TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else
-#    include <time.h>
-#  endif
-#endif],
-       [__timezone;],
-       [scheme_cv_var___timezone=yes],
-       [scheme_cv_var___timezone=no])
-    AC_MSG_RESULT(${scheme_cv_var___timezone})
-    if test "${scheme_cv_var___timezone}" = yes; then
-       AC_DEFINE([HAVE_TIMEZONE], [1],
-           [Define if timezone variable is available.])
-       AC_DEFINE([TIMEZONE], [__timezone],
-           [Define to name of timezone variable if available.])
+if test ${have_timezone_info} = no; then
+    AC_CHECK_DECL([__timezone],
+       [
        have_timezone_info=yes
-    fi
+       val_timezone=__timezone
+       ],
+       [],
+       [SCM_INC_TIME])
 fi
 
-if test "${have_timezone_info}" = no; then
-    AC_MSG_CHECKING([for _timezone])
-    AC_TRY_LINK([
-#ifdef TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else
-#    include <time.h>
-#  endif
-#endif],
-       [_timezone;],
-       [scheme_cv_var__timezone=yes],
-       [scheme_cv_var__timezone=no])
-    AC_MSG_RESULT(${scheme_cv_var__timezone})
-    if test "${scheme_cv_var__timezone}" = yes; then
-       AC_DEFINE([HAVE_TIMEZONE], [1],
-           [Define if timezone variable is available.])
-       AC_DEFINE([TIMEZONE], [_timezone],
-           [Define to name of timezone variable if available.])
+if test ${have_timezone_info} = no; then
+    AC_CHECK_DECL([_timezone],
+       [
        have_timezone_info=yes
-    fi
+       val_timezone=_timezone
+       ],
+       [],
+       [SCM_INC_TIME])
 fi
 
-if test "${have_timezone_info}" = no; then
-    AC_MSG_CHECKING([for timezone])
-    AC_TRY_LINK([
-#ifdef TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else
-#    include <time.h>
-#  endif
-#endif],
-       [timezone;],
-       [scheme_cv_var_timezone=yes],
-       [scheme_cv_var_timezone=no])
-    AC_MSG_RESULT(${scheme_cv_var_timezone})
-    if test "${scheme_cv_var_timezone}" = yes; then
-       AC_DEFINE([HAVE_TIMEZONE], [1],
-           [Define if timezone variable is available.])
-       AC_DEFINE([TIMEZONE], [timezone],
-           [Define to name of timezone variable if available.])
+if test ${have_timezone_info} = no; then
+    AC_CHECK_DECL([timezone],
+       [
        have_timezone_info=yes
-    fi
+       val_timezone=timezone
+       ],
+       [],
+       [SCM_INC_TIME])
 fi
 
-if test "${ac_cv_header_bsdtty_h}" = yes; then
-    AC_MSG_CHECKING([for struct ltchars])
-    AC_TRY_COMPILE(
-       [#include <bsdtty.h>],
-       [struct ltchars x;],
-       [scheme_cv_struct_ltchars=yes],
-       [scheme_cv_struct_ltchars=no])
-    AC_MSG_RESULT(${scheme_cv_struct_ltchars})
-    if test "${scheme_cv_struct_ltchars}" = yes; then
-       AC_DEFINE([HAVE_STRUCT_LTCHARS], [1],
-           [Define if `struct ltchars' is defined in <bsdtty.h>.])
-    fi
+if test -n ${val_tm_gmtoff}; then
+    AC_DEFINE([HAVE_TM_GMTOFF], [1],
+       [Define if `struct tm' has the `tm_gmtoff' member.])
+    AC_DEFINE_UNQUOTED([TM_GMTOFF], [${val_tm_gmtoff}],
+       [Define to name of `tm_gmtoff' member if available.])
 fi
 
-AC_MSG_CHECKING([for hostent h_addr_list])
-AC_TRY_COMPILE(
-    [#include <netdb.h>],
-    [struct hostent x; x.h_addr_list;],
-    [scheme_cv_struct_hostent_h_addr_list=yes],
-    [scheme_cv_struct_hostent_h_addr_list=no])
-AC_MSG_RESULT(${scheme_cv_struct_hostent_h_addr_list})
-if test "${scheme_cv_struct_hostent_h_addr_list}" = yes; then
-    AC_DEFINE([HAVE_HOSTENT_H_ADDR_LIST], [1],
-       [Define if `struct hostent' has the `h_addr_list' member.])
+if test -n ${val_timezone}; then
+    AC_DEFINE([HAVE_TIMEZONE], [1],
+       [Define if timezone variable is available.])
+    AC_DEFINE_UNQUOTED([TIMEZONE], [${val_timezone}],
+       [Define to name of timezone variable if available.])
 fi
 
-AC_MSG_CHECKING([for struct sigcontext])
-AC_TRY_COMPILE(
-    [#include <signal.h>],
-    [struct sigcontext x;],
-    [scheme_cv_struct_sigcontext=yes],
-    [scheme_cv_struct_sigcontext=no])
-AC_MSG_RESULT(${scheme_cv_struct_sigcontext})
-if test "${scheme_cv_struct_sigcontext}" = yes; then
-    AC_DEFINE([HAVE_STRUCT_SIGCONTEXT], [1],
-       [Define if `struct sigcontext' is defined in <signal.h>.])
-fi
+AC_CHECK_TYPE([struct ltchars],
+    [AC_DEFINE([HAVE_STRUCT_LTCHARS], [1],
+       [Define if `struct ltchars' is defined in <bsdtty.h>.])],
+    [],
+    [SCM_INC_BSDTTY])
+
+AC_CHECK_MEMBER([struct hostent.h_addr_list],
+    [AC_DEFINE([HAVE_HOSTENT_H_ADDR_LIST], [1],
+       [Define if `struct hostent' has the `h_addr_list' member.])],
+    [],
+    [SCM_INC_NETDB])
+
+AC_CHECK_TYPE([struct sigcontext],
+    [AC_DEFINE([HAVE_STRUCT_SIGCONTEXT], [1],
+       [Define if `struct sigcontext' is defined in <signal.h>.])],
+    [],
+    [SCM_INC_SIGNAL])
 
 dnl Checks for compiler characteristics.
 AC_C_BIGENDIAN
 AC_C_CHAR_UNSIGNED
 AC_C_CONST
-AC_CHECK_SIZEOF([unsigned long])
 
 dnl Checks for C library functions.
 AC_FUNC_GETPGRP
@@ -515,7 +464,7 @@ AC_CHECK_FUNCS([times truncate])
 AC_CHECK_FUNCS([uname utime])
 AC_CHECK_FUNCS([waitpid])
 
-if test "${ac_cv_type_signal}" = "void"; then
+if test ${ac_cv_type_signal} = void; then
     AC_DEFINE([VOID_SIGNAL_HANDLERS], [1],
        [Define if RETSIGTYPE is `void'.])
 fi
@@ -527,66 +476,67 @@ AC_SYS_LARGEFILE
 AC_SYS_LONG_FILE_NAMES
 AC_SYS_RESTARTABLE_SYSCALLS
 
-if test "${ac_cv_lib_dl_dlopen}" = yes; then
-    OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld"
-    : ${enable_dynamic_modules='yes'}
-else
-    enable_dynamic_modules=no
-fi
-
-dnl curses/termcap/terminfo support.
-if test "${scheme_cv_lib_ncurses}" = yes; then
+dnl curses/termcap/terminfo support
+AC_CHECK_LIB([ncurses], [tparm],
+    [
     AC_DEFINE([HAVE_LIBNCURSES], [1],
-       [Define if ncurses library is present.])
-    if test "${ac_cv_header_curses_h}" = yes \
-       && test "${ac_cv_header_term_h}" = yes; then
-       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lncurses"
-       if test "${scheme_cv_lib_ncurses_defines_tparam}" = yes; then
-           AC_DEFINE([LIBNCURSES_DEFINES_TPARAM], [1],
-               [Define if ncurses library defines `tparam'.])
-       else
-           OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
-       fi
-    fi
-else
-    if test "${scheme_cv_lib_curses}" = yes; then
+       [Define to 1 if you have the `ncurses' library (-lncurses).])
+    STATIC_LIBS="-lncurses ${STATIC_LIBS}"
+    AC_CHECK_HEADER([curses.h],
+       [
+       AC_DEFINE([HAVE_CURSES_H], [1],
+           [Define to 1 if you have the <curses.h> header file.])
+       AC_CHECK_HEADER([term.h],
+           [
+           AC_DEFINE([HAVE_TERM_H], [1],
+               [Define to 1 if you have the <term.h> header file.])
+           AC_CHECK_LIB([ncurses], [tparam],
+               [
+               AC_DEFINE([LIBNCURSES_DEFINES_TPARAM], [1],
+                   [Define if ncurses library defines `tparam'.])
+               ],
+               [
+               OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
+               ])
+           ])
+       ])
+    ],
+    [AC_CHECK_LIB([curses], [tparm],
+       [
        AC_DEFINE([HAVE_LIBCURSES], [1],
-           [Define if curses library is present.])
-       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcurses"
+           [Define to 1 if you have the `curses' library (-lcurses).])
+       STATIC_LIBS="-lcurses ${STATIC_LIBS}"
        OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
-    else
-       if test "${scheme_cv_lib_termcap}" = yes; then
+       ],
+       [
+       AC_CHECK_LIB([termcap], [tparam],
+           [
            AC_DEFINE([HAVE_LIBTERMCAP], [1],
-               [Define if termcap library is present.])
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -ltermcap"
-           OPTIONAL_BASES="${OPTIONAL_BASES} tparam"
-       else
+               [Define to 1 if you have the `termcap' library (-ltermcap).])
+           STATIC_LIBS="-ltermcap ${STATIC_LIBS}"
+           ],
+           [
            OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam"
-       fi
-    fi
-fi
+           ])
+       ])
+    ])
 
+dnl The OpenSSL crypto library provides support for blowfish and MD5.
 if test "${with_openssl}" != no; then
     if test "${with_openssl}" != yes; then
        CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include"
-       LIBS="${LIBS} -L${with_openssl}/lib"
+       LDFLAGS="${LDFLAGS} -L${with_openssl}/lib"
     fi
     AC_CHECK_HEADERS([openssl/blowfish.h openssl/md5.h])
-    AC_CHECK_LIB([crypto], [BF_set_key])
-    if test "${ac_cv_header_openssl_blowfish_h}" = yes \
-           && test "${ac_cv_header_openssl_md5_h}" = yes \
-           && test "${ac_cv_lib_crypto_bf_set_key}" = yes ; then
+    AC_CHECK_LIB([crypto], [BF_set_key],
+       [
        AC_DEFINE([HAVE_LIBCRYPTO], [1],
-           [Define if OpenSSL crypto library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
-           MODULE_BASES="${MODULE_BASES} prbfish prmd5"
-           PRBFISH_LIBS="-lcrypto"
-           PRMD5_LIBS="-lcrypto"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcrypto"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prbfish prmd5"
-       fi
-    fi
+           [Define to 1 if you have the `crypto' library (-lcrypto).])
+       MODULE_LIBS="-lcrypto ${MODULE_LIBS}"
+       MODULE_BASES="${MODULE_BASES} prbfish prmd5"
+       PRBFISH_LIBS="-lcrypto"
+       PRMD5_LIBS="-lcrypto"
+       ])
 fi
 
 dnl These libraries might not be installed, so take care generating
@@ -601,21 +551,26 @@ dnl to other MD5 libraries and provides a rich set of hashes.
 if test "${with_mhash}" != no; then
     if test "${with_mhash}" != yes; then
        CPPFLAGS="${CPPFLAGS} -I${with_mhash}/include"
-       LIBS="${LIBS} -L${with_mhash}/lib"
+       LDFLAGS="${LDFLAGS} -L${with_mhash}/lib"
     fi
-    AC_CHECK_HEADERS([mhash.h])
-    AC_CHECK_LIB([mhash], [mhash_count])
-    if test "${ac_cv_header_mhash_h}" = yes \
-           && test "${ac_cv_lib_mhash_mhash_count}" = yes ; then
-       AC_DEFINE([HAVE_LIBMHASH], [1],
-           [Define if mhash library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
+    AC_CHECK_HEADER([mhash.h],
+       [
+       AC_DEFINE([HAVE_MHASH_H], [1],
+           [Define to 1 if you have the <mhash.h> header file.])
+       AC_CHECK_LIB([mhash], [mhash_count],
+           [
+           AC_DEFINE([HAVE_LIBMHASH], [1],
+               [Define to 1 if you have the `mhash' library (-lmhash).])
+           if test ${enable_debugging} != no; then
+              LIBS="-lmhash ${LIBS}"
+           fi
+           MODULE_LIBS="-lmhash ${MODULE_LIBS}"
            MODULE_BASES="${MODULE_BASES} prmhash"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmhash"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prmhash"
-       fi
-    fi
+           if test "x${PRMD5_LIBS}" = x; then
+               PRMD5_LIBS="-lmhash"
+           fi
+           ])
+       ])
 fi
 
 dnl The mcrypt library provides blowfish, but its CFB mode is 8 bit.
@@ -624,115 +579,116 @@ dnl But mcrypt provides many ciphers and can be loaded in addition.
 if test "${with_mcrypt}" != no; then
     if test "${with_mcrypt}" != yes; then
        CPPFLAGS="${CPPFLAGS} -I${with_mcrypt}/include"
-       LIBS="${LIBS} -L${with_mcrypt}/lib"
+       LDFLAGS="${LDFLAGS} -L${with_mcrypt}/lib"
     fi
-    AC_CHECK_HEADERS([mcrypt.h])
-    AC_CHECK_LIB([mcrypt], [mcrypt_generic_init], [], [], [-lltdl])
-    if test "${ac_cv_header_mcrypt_h}" = yes \
-           && test "${ac_cv_lib_mcrypt_mcrypt_generic_init}" = yes ; then
-       AC_DEFINE([HAVE_LIBMCRYPT], [1],
-           [Define if mcrypt library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
+    AC_CHECK_HEADER([mcrypt.h],
+       [
+       AC_DEFINE([HAVE_MCRYPT_H], [1],
+           [Define to 1 if you have the <mcrypt.h> header file.])
+       AC_CHECK_LIB([tdl], [lt_dlinit], [mc_libs=-lltdl], [mc_libs=])
+       AC_CHECK_LIB([mcrypt], [mcrypt_generic_init],
+           [
+           AC_DEFINE([HAVE_LIBMCRYPT], [1],
+               [Define to 1 if you have the `mcrypt' library (-lmcrypt).])
+           MODULE_LIBS="-lmcrypt ${mc_libs} ${MODULE_LIBS}"
            MODULE_BASES="${MODULE_BASES} prmcrypt"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmcrypt -lltdl"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prmcrypt"
-       fi
-    fi
+           ],
+           [],
+           [${mc_libs}])
+       ])
 fi
 
 dnl gdbm support
 if test "${with_gdbm}" != no; then
     if test "${with_gdbm}" != yes; then
        CPPFLAGS="${CPPFLAGS} -I${with_gdbm}/include"
-       LIBS="${LIBS} -L${with_gdbm}/lib"
+       LDFLAGS="${LDFLAGS} -L${with_gdbm}/lib"
     fi
-    AC_CHECK_HEADERS([gdbm.h])
-    AC_CHECK_LIB([gdbm], [gdbm_open])
-    if test "${ac_cv_header_gdbm_h}" = yes \
-           && test "${ac_cv_lib_gdbm_gdbm_open}" = yes; then
-       AC_DEFINE([HAVE_LIBGDBM], [1],
-           [Define if gdbm library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
+    AC_CHECK_HEADER([gdbm.h],
+       [
+       AC_DEFINE([HAVE_GDBM_H], [1],
+           [Define to 1 if you have the <gdbm.h> header file.])
+       AC_CHECK_LIB([gdbm], [gdbm_open],
+           [
+           AC_DEFINE([HAVE_LIBGDBM], [1],
+               [Define to 1 if you have the `gdbm' library (-lgdbm).])
+           MODULE_LIBS="-lgdbm ${MODULE_LIBS}"
            MODULE_BASES="${MODULE_BASES} prgdbm"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lgdbm"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prgdbm"
-       fi
-    fi
+           ])
+       ])
 fi
 
-dnl db4 support
-if test "${with_db4}" != no; then
-    if test "${with_db4}" != yes; then
-       CPPFLAGS="${CPPFLAGS} -I${with_db4}/include"
-       LIBS="${LIBS} -L${with_db4}/lib"
+dnl DB v4 support
+if test "${with_db_4}" != no; then
+    if test "${with_db_4}" != yes; then
+       CPPFLAGS="${CPPFLAGS} -I${with_db_4}/include"
+       LDFLAGS="${LDFLAGS} -L${with_db_4}/lib"
     fi
-    AC_CHECK_HEADERS([db.h])
-    AC_MSG_CHECKING([for db_create in -ldb-4])
-    save_LIBS=${LIBS}
-    LIBS="-ldb-4 ${LIBS}"
-    AC_TRY_LINK(
-       [#include <db.h>],
-       [DB * db; db_create ((&db), 0, 0);],
-       [scheme_cv_lib_db4=yes],
-       [scheme_cv_lib_db4=no])
-    LIBS=${save_LIBS}
-    AC_MSG_RESULT(${scheme_cv_lib_db4})
-    if test "${ac_cv_header_db_h}" = yes \
-           && test "${scheme_cv_lib_db4}" = yes; then
-       AC_DEFINE([HAVE_LIBDB4], [1],
-           [Define if db4 library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
+    AC_CHECK_HEADER([db.h],
+       [
+       AC_DEFINE([HAVE_DB_H], [1],
+           [Define to 1 if you have the <db.h> header file.])
+       AC_CHECK_LIB([db-4], [db_create],
+           [
+           AC_DEFINE([HAVE_LIBDB_4], [1], 
+               [Define to 1 if you have the `db-4' library (-ldb-4).])
+           MODULE_LIBS="-ldb-4 ${MODULE_LIBS}"
            MODULE_BASES="${MODULE_BASES} prdb4"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -ldb-4"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prdb4"
-       fi
-    fi
+           ],
+           [],
+           [#include <db.h>])
+       ])
 fi
 
 dnl PostgreSQL support
 if test "${with_libpq}" != no; then
     if test "${with_libpq}" != yes; then
        CPPFLAGS="${CPPFLAGS} -I${with_libpq}/include"
-       LIBS="${LIBS} -L${with_libpq}/lib"
+       LDFLAGS="${LDFLAGS} -L${with_libpq}/lib"
     else
        AC_PATH_PROG([PG_CONFIG], [pg_config])
-       if test "${PG_CONFIG}" != no; then
+       if test ${PG_CONFIG} != no; then
            libpq_inc=`${PG_CONFIG} --includedir 2>/dev/null`
            if test "${libpq_inc}" != /usr/include; then
                CPPFLAGS="${CPPFLAGS} -I${libpq_inc}"
            fi
            libpq_lib=`${PG_CONFIG} --libdir 2>/dev/null`
            if test "${libpq_lib}" != /usr/lib; then
-               LIBS="${LIBS} -L${libpq_lib}"
+               LDFLAGS="${LDFLAGS} -L${libpq_lib}"
            fi
        fi
     fi
-    AC_CHECK_HEADERS([libpq-fe.h])
-    AC_CHECK_LIB([pq], [PQconnectdb])
-    if test "${ac_cv_header_libpq_fe_h}" = yes \
-           && test "${ac_cv_lib_pq_pqconnectdb}" = yes ; then
-       AC_DEFINE([HAVE_LIBPQ], [1],
-           [Define if PostgreSQL libpq library is present.])
-       if test "${enable_dynamic_modules}" = yes; then
+    AC_CHECK_HEADER([libpq-fe.h],
+       [
+       AC_DEFINE([HAVE_LIBPQ_FE_H], [1],
+           [Define to 1 if you have the <libpq-fe.h> header file.])
+       AC_CHECK_LIB([pq], [PQconnectdb],
+           [
+           AC_DEFINE([HAVE_LIBPQ], [1],
+               [Define to 1 if you have the `pq' library (-lpq).])
+           MODULE_LIBS="-lpq ${MODULE_LIBS}"
            MODULE_BASES="${MODULE_BASES} prpgsql"
-       else
-           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lpq"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prpgsql"
-       fi
-    fi
+           ])
+       ])
 fi
 
 dnl Decide whether we're using static or dynamic libraries.
 if test "${enable_static_libs}" = no; then
-    LIBS="${LIBS}${QUASI_STATIC_LIBS}"
-else
-    STATIC_LIBS="${STATIC_LIBS}${QUASI_STATIC_LIBS}"
+    AC_CHECK_LIB([dl], [dlopen],
+       [
+       AC_DEFINE([HAVE_LIBDL], [1],
+           [Define to 1 if you have the `dl' library (-ldl).])
+       LIBS="${STATIC_LIBS} -ldl ${LIBS}"
+       STATIC_LIBS=
+       OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld"
+       ],
+       [enable_static_libs=yes])
+fi
+if test ${enable_static_libs} != no; then
+    STATIC_LIBS=${MODULE_LIBS}${STATIC_LIBS}
 fi
 
-if test "${enable_valgrind_mode}" != no; then
+if test ${enable_valgrind_mode} != no; then
     SCHEME_DEFS="${SCHEME_DEFS} -DVALGRIND_MODE"
     M4_FLAGS="${M4_FLAGS} -P VALGRIND_MODE,1"
 fi
@@ -764,14 +720,14 @@ darwin*)
     MODULE_LDFLAGS="${MODULE_LDFLAGS} -dynamiclib -flat_namespace -undefined suppress"
     ;;
 solaris*)
-    if test "${GCC}" = yes; then
+    if test ${GCC} = yes; then
        DO_GCC_TESTS=yes
        M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
     fi
     ;;
 esac
 
-if test "${DO_GCC_TESTS}" = yes; then
+if test ${DO_GCC_TESTS} = yes; then
     if test "x${STATIC_LIBS}" != x; then
        STATIC_PREFIX="-Xlinker -Bstatic"
        STATIC_SUFFIX="-Xlinker -Bdynamic"
@@ -780,77 +736,80 @@ if test "${DO_GCC_TESTS}" = yes; then
     MODULE_CFLAGS="${MODULE_CFLAGS} -fPIC"
     MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared"
     AC_MSG_CHECKING([for ELF binaries])
-    AC_TRY_RUN(
-[int
-main ()
-{
-#ifdef __ELF__
-return 0;
-#endif
-return 1;
-}],
-       [scheme_cv_linux_elf=yes],
-       [scheme_cv_linux_elf=no])
-    AC_MSG_RESULT(${scheme_cv_linux_elf})
-    if test "${scheme_cv_linux_elf}" = yes; then
+    AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[]],
+           [[
+           #ifdef __ELF__
+           return 0;
+           #endif
+           return 1;
+           ]]
+       )],
+       [
+       AC_MSG_RESULT([yes])
        M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
-    fi
+       ],
+       [AC_MSG_RESULT([no])])
 fi
 
-dnl Add architecture-dependent customizations.
-dnl This is mostly support for native-code compilation.
 AC_MSG_CHECKING([for native-code support])
-scheme_arch=
 OPTIONAL_BASES="${OPTIONAL_BASES} cmpint"
 GC_HEAD_FILES="gccode.h cmpgc.h"
-if test "${enable_c_back_end}" = no; then
+SCM_ARCH=none
+ECN_WARNP=no
+
+case ${enable_native_code} in
+yes)
     case ${host_cpu} in
     alpha*)
-       scheme_arch=alpha
+       SCM_ARCH=alpha
        ;;
     hppa*)
-       scheme_arch=hppa
+       SCM_ARCH=hppa
        GC_HEAD_FILES="${GC_HEAD_FILES} hppacach.h"
        ;;
     i?86)
-       scheme_arch=i386
+       SCM_ARCH=i386
        ;;
     # x86_64)
-    #     scheme_arch=i386
+    #     SCM_ARCH=i386
     #     CFLAGS="${CFLAGS} -m32"
     #     LDFLAGS="${LDFLAGS} -m32"
     #     ;;
     m68k|m680?0)
-       scheme_arch=mc68k
+       SCM_ARCH=mc68k
        ;;
     mips*)
-       scheme_arch=mips
+       SCM_ARCH=mips
        ;;
     vax)
-       scheme_arch=vax
+       SCM_ARCH=vax
        ;;
     esac
-fi
-AC_DEFINE([HAS_COMPILER_SUPPORT], [1],
-    [Define if architecture has native-code compiler support.])
-if test "x${scheme_arch}" != x; then
-    AC_MSG_RESULT([yes, for ${scheme_arch}])
-    test -f cmpauxmd.m4 || ${LN_S} cmpauxmd/${scheme_arch}.m4 cmpauxmd.m4
-    test -f cmpintmd.h || ${LN_S} cmpintmd/${scheme_arch}.h cmpintmd.h
-    OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.m4"
-    OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} cmpauxmd.o"
-    GC_HEAD_FILES="${GC_HEAD_FILES} cmpintmd.h"
-    CBE_RULES=/dev/null
-else
+    ;;
+c)
+    SCM_ARCH=c
+    ;;
+no|none)
+    ;;
+*)
+    ECN_WARNP=yes
+    ;;
+esac
+
+case ${SCM_ARCH} in
+none)
+    AC_MSG_RESULT([no])
+    ;;
+c)
     AC_MSG_RESULT([yes, using portable C code])
     AC_DEFINE([NATIVE_CODE_IS_C], [1],
         [Define that the compiler outputs C code instead of binaries.])
-    test -f cmpauxmd.c || ${LN_S} cmpauxmd/c.c cmpauxmd.c
-    test -f cmpintmd.h || ${LN_S} cmpintmd/c.h cmpintmd.h
-    OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.c unstackify.c compinit.c"
-    OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} cmpauxmd.o unstackify.o compinit.o"
-    GC_HEAD_FILES="${GC_HEAD_FILES} cmpintmd.h"
-    COMPILED_DEFS="-DCOMPILE_FOR_STATIC_LINKING"
+    AC_CONFIG_LINKS([cmpauxmd.c:cmpauxmd/c.c])
+    AC_DEFINE([COMPILE_FOR_STATIC_LINKING], [1],
+       [Define to 1 for static compilation of C native code.])
+    OPTIONAL_BASES="${OPTIONAL_BASES} cmpauxmd unstackify compinit"
     COMPILED_SOURCES="utabmd.c"
     for D in runtime sf cref star-parser compiler; do
        COMPILED_SOURCES="${COMPILED_SOURCES} \$(wildcard ../${D}/*.c)"
@@ -859,6 +818,24 @@ else
        COMPILED_SOURCES="${COMPILED_SOURCES} \$(wildcard ../compiler/${D}/*.c)"
     done
     CBE_RULES=makegen/cbe-rules
+    ;;
+*)
+    AC_MSG_RESULT([yes, for ${SCM_ARCH}])
+    AC_CONFIG_LINKS([cmpauxmd.m4:cmpauxmd/${SCM_ARCH}.m4])
+    OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.m4"
+    OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} cmpauxmd.o"
+    ;;
+esac
+
+if test ${ECN_WARNP} = yes; then
+    AC_MSG_WARN([illegal --enable-native-code value: ${enable_native_code}])
+fi
+
+if test ${SCM_ARCH} != none; then
+    AC_DEFINE([HAS_COMPILER_SUPPORT], [1],
+       [Define if architecture has native-code compiler support.])
+    AC_CONFIG_LINKS([cmpintmd.h:cmpintmd/${SCM_ARCH}.h])
+    GC_HEAD_FILES="${GC_HEAD_FILES} cmpintmd.h"
 fi
 
 for base in ${OPTIONAL_BASES}; do
@@ -866,25 +843,22 @@ for base in ${OPTIONAL_BASES}; do
     OPTIONAL_OBJECTS="${OPTIONAL_OBJECTS} ${base}.o"
 done
 
-MODULE_TARGETS=
-if test "x${MODULE_BASES}" = x; then
-    MODULE_RULES=/dev/null
-else
-    MODULE_RULES=config.modrules
-    rm -f "${MODULE_RULES}"
+if test "x${MODULE_BASES}" != x; then
+    MODULE_RULES=config-rules.module
+    rm -f ${MODULE_RULES}
     for BASE in ${MODULE_BASES}; do
        MODULE_TARGETS="${MODULE_TARGETS} ${BASE}.so"
-       echo >> "${MODULE_RULES}"
-       echo "${BASE}.o: ${BASE}.c" >> "${MODULE_RULES}"
-       echo "  \$(COMPILE_MODULE) -c \$*.c" >> "${MODULE_RULES}"
+       echo >> ${MODULE_RULES}
+       echo ${BASE}.o: ${BASE}.c >> ${MODULE_RULES}
+       echo "  " '$(COMPILE_MODULE)' -c '$*.c' >> ${MODULE_RULES}
     done
 fi
 
 AC_SUBST([AS_FLAGS])
 AC_SUBST([GC_HEAD_FILES])
 AC_SUBST([M4_FLAGS])
-AC_SUBST([OPTIONAL_OBJECTS])
 AC_SUBST([OPTIONAL_SOURCES])
+AC_SUBST([OPTIONAL_OBJECTS])
 AC_SUBST([STATIC_LIBS])
 AC_SUBST([STATIC_PREFIX])
 AC_SUBST([STATIC_SUFFIX])
@@ -907,9 +881,9 @@ AC_OUTPUT
 # Make custom compilation program for "makegen.scm".
 rm -f makegen-cc
 echo "#!/bin/sh" > makegen-cc
-echo "exec gcc -MM -DMIT_SCHEME ${CPPFLAGS} \"\${1}\"" >> makegen-cc
+echo exec gcc -MM -DMIT_SCHEME ${CPPFLAGS} '"${1}"' >> makegen-cc
 chmod +x makegen-cc
 
-if test "${MODULE_RULES}" != "/dev/null"; then
-    rm -f "${MODULE_RULES}"
+if test ${MODULE_RULES} != /dev/null; then
+    rm -f ${MODULE_RULES}
 fi