3
### Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993,
4
### 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
5
### 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Massachusetts
6
### Institute of Technology
8
### This file is part of MIT/GNU Scheme.
10
### MIT/GNU Scheme is free software; you can redistribute it and/or
11
### modify it under the terms of the GNU General Public License as
12
### published by the Free Software Foundation; either version 2 of the
13
### License, or (at your option) any later version.
15
### MIT/GNU Scheme is distributed in the hope that it will be useful,
16
### but WITHOUT ANY WARRANTY; without even the implied warranty of
17
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
### General Public License for more details.
20
### You should have received a copy of the GNU General Public License
21
### along with MIT/GNU Scheme; if not, write to the Free Software
22
### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27
dnl Save these prior to running AC_PROG_CC.
28
SAVED_CFLAGS=${CFLAGS}
29
SAVED_LDFLAGS=${LDFLAGS}
31
dnl Checks for programs.
34
if test "x${ac_cv_prog_cc_c99}" != xno; then
35
AC_DEFINE([HAVE_STDC_99], [1], [Does the compiler support C99?])
37
if test "x${ac_cv_prog_cc_c89}" != xno; then
38
AC_DEFINE([HAVE_STDC_89], [1], [Does the compiler support C89?])
55
if test ${GCC} = yes; then
57
dnl Discard flags computed by AC_PROG_CC; we'll use our own.
58
CFLAGS=${SAVED_CFLAGS}
59
LDFLAGS=${SAVED_LDFLAGS}
61
if test ${enable_debugging} = no; then
62
CFLAGS="${CFLAGS} -O3"
64
CFLAGS="${CFLAGS} -O0 -g -DENABLE_DEBUGGING_TOOLS"
65
LDFLAGS="${LDFLAGS} -g"
67
CFLAGS="${CFLAGS} -Wall -Wundef -Wpointer-arith -Winline"
68
CFLAGS="${CFLAGS} -Wstrict-prototypes -Wnested-externs -Wredundant-decls"
70
AC_MSG_CHECKING([for GCC>=4])
84
CFLAGS="${CFLAGS} -Wextra -Wno-sign-compare -Wno-unused-parameter"
85
CFLAGS="${CFLAGS} -Wold-style-definition"
87
[AC_MSG_RESULT([no])])
89
# other possibilities:
90
# -Wmissing-prototypes -Wunreachable-code -Wwrite-strings
92
FOO=`${INSTALL} --help 2> /dev/null | ${FGREP} -e --preserve-timestamps`
93
if test "x${FOO}" != x; then
94
INSTALL="${INSTALL} --preserve-timestamps"
98
MIT_SCHEME_NATIVE_CODE([${enable_native_code}],[${host_cpu}])
100
if test x${mit_scheme_native_code} = xhppa; then
101
GC_HEAD_FILES="${GC_HEAD_FILES} hppacach.h"
104
AUXDIR_NAME=mit-scheme-${mit_scheme_native_code}
105
EXE_NAME=mit-scheme-${mit_scheme_native_code}
107
dnl Add OS-dependent customizations. This must happen before checking
108
dnl any headers or library routines, because it may add CFLAGS or
109
dnl LDFLAGS that the subsequent checks require.
115
M4_FLAGS="${M4_FLAGS} -P __linux__,1"
120
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
125
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
130
if test -n "${with_macosx_version}"; then
131
MACOSX=${with_macosx_version}
132
MACOSX_CFLAGS="-mmacosx-version-min=${MACOSX}"
134
MACOSX=`sw_vers | ${GREP} ^ProductVersion: \
135
| ${EGREP} -o '[[0-9]+\.[0-9]+]'`
136
if test -z "${MACOSX}"; then
137
AC_MSG_ERROR([Unable to determine MacOSX version])
141
if test "${MACOSX}" = 10.4; then
146
MACOSX_SYSROOT=/Developer/SDKs/${SDK}.sdk
147
if test ! -d "${MACOSX_SYSROOT}"; then
148
AC_MSG_ERROR([No MacOSX SDK for version: ${MACOSX}])
150
MACOSX_CFLAGS="${MACOSX_CFLAGS} -isysroot ${MACOSX_SYSROOT}"
151
MACOSX_CFLAGS="${MACOSX_CFLAGS} -fconstant-cfstrings"
152
MACOSX_CFLAGS="${MACOSX_CFLAGS} -DSIGNAL_HANDLERS_CAN_USE_SCHEME_STACK"
153
AC_MSG_NOTICE([Compiling for MacOSX version ${MACOSX}])
154
case ${mit_scheme_native_code} in
156
MACOSX_CFLAGS="-arch i386 ${MACOSX_CFLAGS}"
157
AS_FLAGS="-arch i386 ${AS_FLAGS}"
158
SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -Wl,-pagezero_size,04000000"
161
MACOSX_CFLAGS="-arch x86_64 ${MACOSX_CFLAGS}"
162
AS_FLAGS="-arch x86_64 ${AS_FLAGS}"
165
CFLAGS="${CFLAGS} ${MACOSX_CFLAGS} -frounding-math"
166
LDFLAGS="${LDFLAGS} ${MACOSX_CFLAGS} -Wl,-syslibroot,${MACOSX_SYSROOT}"
167
LDFLAGS="${LDFLAGS} -framework CoreFoundation"
168
MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle"
169
if test "${with_module_loader}" != no; then
170
if test "${with_module_loader}" = yes; then
171
MODULE_LOADER='${SCHEME_EXE}'
173
MODULE_LOADER="${with_module_loader}"
175
MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle_loader ${MODULE_LOADER}"
177
AUX_PROGRAMS="${AUX_PROGRAMS} macosx-starter"
184
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
189
# How do we tell whether we're using GNU ld or Solaris ld?
190
if test ${GCC} = yes; then
192
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
194
LDFLAGS="${LDFLAGS} -lsocket -lnsl"
198
if test "${DO_GCC_TESTS}" = yes; then
199
if test "${GNU_LD}" = yes; then
200
SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -export-dynamic"
202
MODULE_CFLAGS="${MODULE_CFLAGS} -fPIC"
203
MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared -fPIC"
204
AC_MSG_CHECKING([for ELF binaries])
217
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
218
M4_FLAGS="${M4_FLAGS} -P __ELF__,1"
220
[AC_MSG_RESULT([no])])