From f93e3c62b12e73cc059eb03c340bf47d466f772c Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 12 Oct 2013 19:58:57 -0700 Subject: [PATCH] More FFI cleanups: no need to include microcode/achost.ac. --- src/configure.ac | 13 +-- src/microcode/achost.ac | 230 ------------------------------------- src/microcode/configure.ac | 207 ++++++++++++++++++++++++++++++++- 3 files changed, 208 insertions(+), 242 deletions(-) delete mode 100644 src/microcode/achost.ac diff --git a/src/configure.ac b/src/configure.ac index e7ddee137..3d275b728 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -137,6 +137,8 @@ else fi if test x"${found_p}" = xyes; then AC_MSG_RESULT([yes, using ${MIT_SCHEME_EXE}]) + # To get some version numbers into the build log: + ${MIT_SCHEME_EXE} --version else message= if test x"${env_p}" = xyes; then @@ -184,17 +186,6 @@ compiler/configure "${mit_scheme_native_code}" || exit $? AC_CONFIG_SUBDIRS([microcode]) -m4_include(microcode/achost.ac) - -AC_SUBST([CCLD]) -AC_SUBST([DEFS]) -AC_SUBST([CFLAGS]) -AC_SUBST([CPPFLAGS]) -AC_SUBST([LDFLAGS]) -AC_SUBST([MODULE_CFLAGS]) -AC_SUBST([MODULE_LDFLAGS]) -AC_SUBST([MODULE_LOADER]) - AC_CONFIG_FILES([ Makefile Makefile.tools diff --git a/src/microcode/achost.ac b/src/microcode/achost.ac deleted file mode 100644 index 547766d29..000000000 --- a/src/microcode/achost.ac +++ /dev/null @@ -1,230 +0,0 @@ -### -*-M4-*- -### -### Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, -### 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -### 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 -### Massachusetts Institute of Technology -### -### This file is part of MIT/GNU Scheme. -### -### MIT/GNU Scheme is free software; you can redistribute it and/or -### modify it under the terms of the GNU General Public License as -### published by the Free Software Foundation; either version 2 of the -### License, or (at your option) any later version. -### -### MIT/GNU Scheme is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -### General Public License for more details. -### -### You should have received a copy of the GNU General Public License -### along with MIT/GNU Scheme; if not, write to the Free Software -### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -### 02110-1301, USA. - -AC_CANONICAL_HOST - -dnl Save these prior to running AC_PROG_CC. -SAVED_CFLAGS=${CFLAGS} -SAVED_LDFLAGS=${LDFLAGS} - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CC_STDC -if test "x${ac_cv_prog_cc_c99}" != xno; then - AC_DEFINE([HAVE_STDC_99], [1], [Does the compiler support C99?]) -fi -if test "x${ac_cv_prog_cc_c89}" != xno; then - AC_DEFINE([HAVE_STDC_89], [1], [Does the compiler support C89?]) -fi -AC_C_BACKSLASH_A -AC_C_BIGENDIAN -AC_C_CONST -AC_C_RESTRICT -AC_C_VOLATILE -AC_C_INLINE -AC_C_STRINGIZE -AC_C_PROTOTYPES -AC_PROG_EGREP -AC_PROG_FGREP -AC_PROG_GREP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - -if test ${GCC} = yes; then - - dnl Discard flags computed by AC_PROG_CC; we'll use our own. - CFLAGS=${SAVED_CFLAGS} - LDFLAGS=${SAVED_LDFLAGS} - - if test ${enable_debugging} = no; then - CFLAGS="${CFLAGS} -O3" - else - CFLAGS="${CFLAGS} -O0 -g -DENABLE_DEBUGGING_TOOLS" - LDFLAGS="${LDFLAGS} -g" - fi - CFLAGS="${CFLAGS} -Wall -Wundef -Wpointer-arith -Winline" - CFLAGS="${CFLAGS} -Wstrict-prototypes -Wnested-externs -Wredundant-decls" - - AC_MSG_CHECKING([for GCC>=4]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #if __GNUC__ >= 4 - ; - #else - #error "gcc too old" - #endif - ]], - [[]] - )], - [ - AC_MSG_RESULT([yes]) - CFLAGS="${CFLAGS} -Wextra -Wno-sign-compare -Wno-unused-parameter" - CFLAGS="${CFLAGS} -Wold-style-definition" - ], - [AC_MSG_RESULT([no])]) - - # other possibilities: - # -Wmissing-prototypes -Wunreachable-code -Wwrite-strings -fi -FOO=`${INSTALL} --help 2> /dev/null | ${FGREP} -e --preserve-timestamps` -if test "x${FOO}" != x; then - INSTALL="${INSTALL} --preserve-timestamps" -fi -CCLD=${CC} - -MIT_SCHEME_NATIVE_CODE([${enable_native_code}],[${host_cpu}]) - -if test x${mit_scheme_native_code} = xhppa; then - GC_HEAD_FILES="${GC_HEAD_FILES} hppacach.h" -fi - -AUXDIR_NAME=mit-scheme-${mit_scheme_native_code} -EXE_NAME=mit-scheme-${mit_scheme_native_code} - -dnl Add OS-dependent customizations. This must happen before checking -dnl any headers or library routines, because it may add CFLAGS or -dnl LDFLAGS that the subsequent checks require. - -DO_GCC_TESTS=no -GNU_LD=no -case ${host_os} in -linux-gnu) - M4_FLAGS="${M4_FLAGS} -P __linux__,1" - DO_GCC_TESTS=yes - GNU_LD=yes - ;; -freebsd*) - M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" - DO_GCC_TESTS=yes - GNU_LD=yes - ;; -dragonfly*) - M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" - DO_GCC_TESTS=yes - GNU_LD=yes - ;; -darwin*) - if test -n "${with_macosx_version}"; then - MACOSX=${with_macosx_version} - MACOSX_CFLAGS="-mmacosx-version-min=${MACOSX}" - else - MACOSX=`sw_vers | ${GREP} ^ProductVersion: \ - | ${EGREP} -o '[[0-9]+\.[0-9]+]'` - if test -z "${MACOSX}"; then - AC_MSG_ERROR([Unable to determine MacOSX version]) - fi - MACOSX_CFLAGS= - fi - if test "${MACOSX}" = 10.4; then - SDK=MacOSX${MACOSX}u - else - SDK=MacOSX${MACOSX} - fi - MACOSX_SYSROOT= - for dir in /Developer/SDKs \ - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs - do - if test -d "${dir}"; then - MACOSX_SYSROOT=${dir} - break - fi - done - if test -z "${MACOSX_SYSROOT}"; then - AC_MSG_WARN([Can't find SDKs directory, not checking for SDK]) - else - MACOSX_SYSROOT=${MACOSX_SYSROOT}/${SDK}.sdk - if test ! -d "${MACOSX_SYSROOT}"; then - AC_MSG_ERROR([No MacOSX SDK for version: ${MACOSX}]) - fi - fi - MACOSX_CFLAGS="${MACOSX_CFLAGS} -isysroot ${MACOSX_SYSROOT}" - MACOSX_CFLAGS="${MACOSX_CFLAGS} -fconstant-cfstrings" - MACOSX_CFLAGS="${MACOSX_CFLAGS} -DSIGNAL_HANDLERS_CAN_USE_SCHEME_STACK" - AC_MSG_NOTICE([Compiling for MacOSX version ${MACOSX}]) - case ${mit_scheme_native_code} in - i386) - MACOSX_CFLAGS="-arch i386 ${MACOSX_CFLAGS}" - AS_FLAGS="-arch i386 ${AS_FLAGS}" - SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -Wl,-pagezero_size,04000000" - ;; - x86-64) - MACOSX_CFLAGS="-arch x86_64 ${MACOSX_CFLAGS}" - AS_FLAGS="-arch x86_64 ${AS_FLAGS}" - ;; - esac - CFLAGS="${CFLAGS} ${MACOSX_CFLAGS} -frounding-math" - LDFLAGS="${LDFLAGS} ${MACOSX_CFLAGS} -Wl,-syslibroot,${MACOSX_SYSROOT}" - LDFLAGS="${LDFLAGS} -framework CoreFoundation" - MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle" - if test "${with_module_loader}" != no; then - if test "${with_module_loader}" = yes; then - MODULE_LOADER='${SCHEME_EXE}' - else - MODULE_LOADER="${with_module_loader}" - fi - MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle_loader ${MODULE_LOADER}" - fi - AUX_PROGRAMS="${AUX_PROGRAMS} macosx-starter" - ;; -netbsd*) - DO_GCC_TESTS=yes - GNU_LD=yes - ;; -openbsd*) - M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" - DO_GCC_TESTS=yes - GNU_LD=yes - ;; -solaris*) - # How do we tell whether we're using GNU ld or Solaris ld? - if test ${GCC} = yes; then - DO_GCC_TESTS=yes - M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" - fi - LDFLAGS="${LDFLAGS} -lsocket -lnsl" - ;; -esac - -if test "${DO_GCC_TESTS}" = yes; then - if test "${GNU_LD}" = yes; then - SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -export-dynamic" - fi - MODULE_CFLAGS="${MODULE_CFLAGS} -fPIC" - MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared -fPIC" - AC_MSG_CHECKING([for ELF binaries]) - AC_EGREP_CPP([yes], - [ - #ifdef __ELF__ - yes - #endif - ], - [ - AC_MSG_RESULT([yes]) - M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" - M4_FLAGS="${M4_FLAGS} -P __ELF__,1" - ], - [AC_MSG_RESULT([no])]) -fi diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 068c1a359..17bb00739 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -201,7 +201,212 @@ AUXDIR_NAME= EXE_NAME= INSTALL_INCLUDE= -m4_include(achost.ac) +AC_CANONICAL_HOST + +dnl Save these prior to running AC_PROG_CC. +SAVED_CFLAGS=${CFLAGS} +SAVED_LDFLAGS=${LDFLAGS} + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CC_STDC +if test "x${ac_cv_prog_cc_c99}" != xno; then + AC_DEFINE([HAVE_STDC_99], [1], [Does the compiler support C99?]) +fi +if test "x${ac_cv_prog_cc_c89}" != xno; then + AC_DEFINE([HAVE_STDC_89], [1], [Does the compiler support C89?]) +fi +AC_C_BACKSLASH_A +AC_C_BIGENDIAN +AC_C_CONST +AC_C_RESTRICT +AC_C_VOLATILE +AC_C_INLINE +AC_C_STRINGIZE +AC_C_PROTOTYPES +AC_PROG_EGREP +AC_PROG_FGREP +AC_PROG_GREP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +if test ${GCC} = yes; then + + dnl Discard flags computed by AC_PROG_CC; we'll use our own. + CFLAGS=${SAVED_CFLAGS} + LDFLAGS=${SAVED_LDFLAGS} + + if test ${enable_debugging} = no; then + CFLAGS="-O3 ${CFLAGS}" + else + CFLAGS="-O0 -g -DENABLE_DEBUGGING_TOOLS ${CFLAGS}" + LDFLAGS="${LDFLAGS} -g" + fi + CFLAGS="-Wall -Wundef -Wpointer-arith -Winline ${CFLAGS}" + CFLAGS="-Wstrict-prototypes -Wnested-externs -Wredundant-decls ${CFLAGS}" + + AC_MSG_CHECKING([for GCC>=4]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #if __GNUC__ >= 4 + ; + #else + #error "gcc too old" + #endif + ]], + [[]] + )], + [ + AC_MSG_RESULT([yes]) + CFLAGS="-Wextra -Wno-sign-compare -Wno-unused-parameter ${CFLAGS}" + CFLAGS="-Wold-style-definition ${CFLAGS}" + ], + [AC_MSG_RESULT([no])]) + + # other possibilities: + # -Wmissing-prototypes -Wunreachable-code -Wwrite-strings +fi +FOO=`${INSTALL} --help 2> /dev/null | ${FGREP} -e --preserve-timestamps` +if test "x${FOO}" != x; then + INSTALL="${INSTALL} --preserve-timestamps" +fi +CCLD=${CC} + +MIT_SCHEME_NATIVE_CODE([${enable_native_code}],[${host_cpu}]) + +if test x${mit_scheme_native_code} = xhppa; then + GC_HEAD_FILES="${GC_HEAD_FILES} hppacach.h" +fi + +AUXDIR_NAME=mit-scheme-${mit_scheme_native_code} +EXE_NAME=mit-scheme-${mit_scheme_native_code} + +dnl Add OS-dependent customizations. This must happen before checking +dnl any headers or library routines, because it may add CFLAGS or +dnl LDFLAGS that the subsequent checks require. + +DO_GCC_TESTS=no +GNU_LD=no +case ${host_os} in +linux-gnu) + M4_FLAGS="${M4_FLAGS} -P __linux__,1" + DO_GCC_TESTS=yes + GNU_LD=yes + ;; +freebsd*) + M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + DO_GCC_TESTS=yes + GNU_LD=yes + ;; +dragonfly*) + M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + DO_GCC_TESTS=yes + GNU_LD=yes + ;; +darwin*) + if test -n "${with_macosx_version}"; then + MACOSX=${with_macosx_version} + MACOSX_CFLAGS="-mmacosx-version-min=${MACOSX}" + else + MACOSX=`sw_vers | ${GREP} ^ProductVersion: \ + | ${EGREP} -o '[[0-9]+\.[0-9]+]'` + if test -z "${MACOSX}"; then + AC_MSG_ERROR([Unable to determine MacOSX version]) + fi + MACOSX_CFLAGS= + fi + if test "${MACOSX}" = 10.4; then + SDK=MacOSX${MACOSX}u + else + SDK=MacOSX${MACOSX} + fi + MACOSX_SYSROOT= + for dir in /Developer/SDKs \ + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs + do + if test -d "${dir}"; then + MACOSX_SYSROOT=${dir} + break + fi + done + if test -z "${MACOSX_SYSROOT}"; then + AC_MSG_WARN([Can't find SDKs directory, not checking for SDK]) + else + MACOSX_SYSROOT=${MACOSX_SYSROOT}/${SDK}.sdk + if test ! -d "${MACOSX_SYSROOT}"; then + AC_MSG_ERROR([No MacOSX SDK for version: ${MACOSX}]) + fi + fi + MACOSX_CFLAGS="${MACOSX_CFLAGS} -isysroot ${MACOSX_SYSROOT}" + MACOSX_CFLAGS="${MACOSX_CFLAGS} -fconstant-cfstrings" + MACOSX_CFLAGS="${MACOSX_CFLAGS} -DSIGNAL_HANDLERS_CAN_USE_SCHEME_STACK" + AC_MSG_NOTICE([Compiling for MacOSX version ${MACOSX}]) + case ${mit_scheme_native_code} in + i386) + MACOSX_CFLAGS="-arch i386 ${MACOSX_CFLAGS}" + AS_FLAGS="-arch i386 ${AS_FLAGS}" + SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -Wl,-pagezero_size,04000000" + ;; + x86-64) + MACOSX_CFLAGS="-arch x86_64 ${MACOSX_CFLAGS}" + AS_FLAGS="-arch x86_64 ${AS_FLAGS}" + ;; + esac + CFLAGS="${CFLAGS} ${MACOSX_CFLAGS} -frounding-math" + LDFLAGS="${LDFLAGS} ${MACOSX_CFLAGS} -Wl,-syslibroot,${MACOSX_SYSROOT}" + LDFLAGS="${LDFLAGS} -framework CoreFoundation" + MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle" + if test "${with_module_loader}" != no; then + if test "${with_module_loader}" = yes; then + MODULE_LOADER='${SCHEME_EXE}' + else + MODULE_LOADER="${with_module_loader}" + fi + MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle_loader ${MODULE_LOADER}" + fi + AUX_PROGRAMS="${AUX_PROGRAMS} macosx-starter" + ;; +netbsd*) + DO_GCC_TESTS=yes + GNU_LD=yes + ;; +openbsd*) + M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + DO_GCC_TESTS=yes + GNU_LD=yes + ;; +solaris*) + # How do we tell whether we're using GNU ld or Solaris ld? + if test ${GCC} = yes; then + DO_GCC_TESTS=yes + M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + fi + LDFLAGS="${LDFLAGS} -lsocket -lnsl" + ;; +esac + +if test "${DO_GCC_TESTS}" = yes; then + if test "${GNU_LD}" = yes; then + SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -export-dynamic" + fi + MODULE_CFLAGS="-fPIC ${MODULE_CFLAGS}" + MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared -fPIC" + AC_MSG_CHECKING([for ELF binaries]) + AC_EGREP_CPP([yes], + [ + #ifdef __ELF__ + yes + #endif + ], + [ + AC_MSG_RESULT([yes]) + M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + M4_FLAGS="${M4_FLAGS} -P __ELF__,1" + ], + [AC_MSG_RESULT([no])]) +fi dnl Checks for libraries. AC_CHECK_LIB([m], [exp]) -- 2.25.1