| 1 |
dnl Process this file with autoconf to produce a configure script. |
| 2 |
AC_PREREQ([2.71]) |
| 3 |
AC_INIT([Gauche],[0.9.15-p2],[[email protected]],[],[https://practical-scheme.net/gauche/]) |
| 4 |
BUILD_GOSH_VERSION=0.9.15 # Host Gauche version required to build from scratch |
| 5 |
AC_CANONICAL_BUILD |
| 6 |
AC_CANONICAL_HOST |
| 7 |
AC_CANONICAL_TARGET |
| 8 |
AC_CONFIG_HEADERS([src/gauche/config.h src/gauche/priv/configP.h]) |
| 9 |
AC_CONFIG_MACRO_DIRS([m4]) |
| 10 |
|
| 11 |
# ABI_VERSION is set to major.minor of Gauche version by default. |
| 12 |
# It can be overridden by uncommenting the following line. |
| 13 |
# (This may be useful for "prerelease", such as 0.99.x as pre-1.0) |
| 14 |
GAUCHE_ABI_VERSION=0.98 |
| 15 |
|
| 16 |
# SNAPSHOT_ID is a string uniquely identifies a snapshot tarball that shares |
| 17 |
# the same version string. It is not included in (gauche-version), but |
| 18 |
# in GAUCHE_SIGNATURE and shown in the output of 'gosh -V'. |
| 19 |
# |
| 20 |
# For official release versions, this should be empty. Mostly intended |
| 21 |
# to be used for automated bleeding-edge tarballs (in that case, this string |
| 22 |
# has a timestamp YYYYMMDD). It can be specified manually in case when we |
| 23 |
# need a special snapshot. |
| 24 |
# |
| 25 |
# The reason we don't use versions is that we don't want to create versioned |
| 26 |
# subdirectories for every snapshot. |
| 27 |
GAUCHE_SNAPSHOT_ID=20241205 |
| 28 |
|
| 29 |
AC_CHECK_TOOL(RC, windres, false) |
| 30 |
|
| 31 |
LT_INIT |
| 32 |
|
| 33 |
dnl Some files needs to be pre-generated before running configure |
| 34 |
if test ! -f $srcdir/src/genconfig.in; then |
| 35 |
echo "ERROR: src/genconfig.in should be pre-generated. Run ./DIST gen." |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
|
| 39 |
dnl ========================================================== |
| 40 |
dnl Process args given to configure |
| 41 |
dnl |
| 42 |
|
| 43 |
dnl ---------------------------------------------------------- |
| 44 |
dnl Determine thread subsystem |
| 45 |
dnl |
| 46 |
AC_MSG_CHECKING([thread type]) |
| 47 |
|
| 48 |
dnl Platform-dependent thread configuration. This must be in sync |
| 49 |
dnl with gc's configure.ac. |
| 50 |
GAUCHE_THREAD_TYPE= |
| 51 |
AS_CASE(["$host"], |
| 52 |
[*-*-linux*], [ |
| 53 |
AC_DEFINE(GC_LINUX_THREADS,1,[Define to use Linux threads]) |
| 54 |
AC_DEFINE(_REENTRANT,1,[Define to use reentrant libc]) |
| 55 |
THREADLIBS="-lpthread" |
| 56 |
GAUCHE_THREAD_TYPE=pthreads |
| 57 |
], |
| 58 |
[*-*-hpux*], [ |
| 59 |
AC_MSG_WARN("Only HP/UX 11 threads are supported.") |
| 60 |
AC_DEFINE(GC_HPUX_THREADS,1,[Define to use HP-UX threads]) |
| 61 |
AC_DEFINE(_POSIX_C_SOURCE,199506L,[Define POSIX C version]) |
| 62 |
THREADLIBS="-lpthread -lrt" |
| 63 |
GAUCHE_THREAD_TYPE=pthreads |
| 64 |
], |
| 65 |
[*-*-*freebsd*|*-*-dragonfly*], [ |
| 66 |
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.") |
| 67 |
AC_DEFINE(GC_FREEBSD_THREADS,1,[Define to use FreeBSD threads]) |
| 68 |
INCLUDES="$INCLUDES -pthread" |
| 69 |
THREADLIBS="-pthread" |
| 70 |
GAUCHE_THREAD_TYPE=pthreads |
| 71 |
], |
| 72 |
[*-*-kfreebsd*-gnu], [ |
| 73 |
AC_DEFINE(GC_FREEBSD_THREADS,1,[Define to use FreeBSD threads]) |
| 74 |
INCLUDES="$INCLUDES -pthread" |
| 75 |
THREADDLLIBS=-pthread |
| 76 |
AC_DEFINE(_REENTRANT,1,[Define to use reentrant libc]) |
| 77 |
], |
| 78 |
[*-*-gnu*], [ |
| 79 |
AC_DEFINE(GC_GNU_THREADS,1,[Define to use GNU threads]) |
| 80 |
AC_DEFINE(_REENTRANT,1,[Define to use reentrant libc]) |
| 81 |
THREADLIBS="-lpthread" |
| 82 |
GAUCHE_THREAD_TYPE=pthreads |
| 83 |
], |
| 84 |
[*-*-netbsd*], [ |
| 85 |
AC_MSG_WARN("Only on NetBSD 2.0 or later.") |
| 86 |
AC_DEFINE(GC_NETBSD_THREADS,1,[Define to use NetBSD threads]) |
| 87 |
AC_DEFINE(_REENTRANT, [], [Define to use reentrant libc]) |
| 88 |
AC_DEFINE(_PTHREADS, [], [Define if thread support requires this symbol]) |
| 89 |
THREADLIBS="-lpthread" |
| 90 |
THREADDLLIBS="-lpthread -lrt" |
| 91 |
GAUCHE_THREAD_TYPE=pthreads |
| 92 |
], |
| 93 |
[*-*-openbsd*], [ |
| 94 |
AC_MSG_WARN([Gauche with pthread on OpenBSD has unresolved issues. We recommend you to build without threads (--disable-threads) unless you're trying to fix the issues. See https://github.com/shirok/Gauche/issues/276 and https://github.com/shirok/Gauche/issues/334 .]) |
| 95 |
AC_DEFINE(GC_OPENBSD_THREADS,1,[Define to use OpenBSD threads]) |
| 96 |
THREADLIBS="-lpthread" |
| 97 |
THREADDLLIBS="-lpthread" |
| 98 |
GAUCHE_THREAD_TYPE=pthreads |
| 99 |
], |
| 100 |
[*-*-solaris*], [ |
| 101 |
AC_DEFINE(GC_SOLARIS_THREADS,1,[Define to use Solaris threads]) |
| 102 |
AC_DEFINE(GC_SOLARIS_PTHREADS,1,[Define to use Solaris pthreads]) |
| 103 |
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS,1,[Define to use Solaris pthreads]) |
| 104 |
THREADLIBS="-lpthread" |
| 105 |
GAUCHE_THREAD_TYPE=pthreads |
| 106 |
], |
| 107 |
[*-*-irix*], [ |
| 108 |
AC_DEFINE(GC_IRIX_THREADS,1,[Define to use IRIX threads]) |
| 109 |
THREADLIBS="-lpthread" |
| 110 |
GAUCHE_THREAD_TYPE=pthreads |
| 111 |
], |
| 112 |
[*-*-cygwin*], [ |
| 113 |
AC_DEFINE(GC_WIN32_THREADS,1,[Define to use Win32 threads]) |
| 114 |
THREADLIBS="-lpthread" |
| 115 |
GAUCHE_THREAD_TYPE=pthreads |
| 116 |
], |
| 117 |
[*-*-darwin*], [ |
| 118 |
AC_DEFINE(GC_DARWIN_THREADS,1,[Define to use Darwin threads]) |
| 119 |
INCLUDES="$INCLUDES -I/sw/include" |
| 120 |
THREADLIBS="-lpthread" |
| 121 |
GAUCHE_THREAD_TYPE=pthreads |
| 122 |
], |
| 123 |
[*-*-mingw*], [ |
| 124 |
GAUCHE_THREAD_TYPE=win32 |
| 125 |
], |
| 126 |
[ |
| 127 |
AC_MSG_ERROR([Can't determine thread subsystem type on $host]) |
| 128 |
]) |
| 129 |
AS_CASE([$GAUCHE_THREAD_TYPE], |
| 130 |
[pthreads], [ AC_DEFINE(GAUCHE_USE_PTHREADS,1,[Define if we use pthreads]) ], |
| 131 |
[win32], [ AC_DEFINE(GAUCHE_USE_WTHREADS,1,[Define if we use windows threads]) ], |
| 132 |
[]) |
| 133 |
|
| 134 |
LIBS="$LIBS $THREADLIBS" |
| 135 |
dnl Save thread model to be inherited by gc/ subdir. |
| 136 |
AC_SUBST(GAUCHE_THREAD_TYPE) |
| 137 |
AC_MSG_RESULT([$GAUCHE_THREAD_TYPE]) |
| 138 |
|
| 139 |
dnl ---------------------------------------------------------- |
| 140 |
dnl with-slib |
| 141 |
dnl |
| 142 |
SLIB_DIR=/usr/local/slib |
| 143 |
AC_ARG_WITH(slib, |
| 144 |
AS_HELP_STRING([--with-slib=PATH], |
| 145 |
[Configure Gauche's slib module to use Aubrey Jaffer's SLIB |
| 146 |
installed under PATH. If PATH is not specified, or this option is omitted, |
| 147 |
Gauche still tries to find your slib installation from some typical places.]), |
| 148 |
[ |
| 149 |
AS_CASE([$with_slib], |
| 150 |
[no], [search_slib=no], |
| 151 |
[yes], [search_slib=yes], |
| 152 |
[search_slib=no; SLIB_DIR=$with_slib]) |
| 153 |
], [ search_slib=yes ]) |
| 154 |
|
| 155 |
AS_IF([test $search_slib = "yes"], [ |
| 156 |
AC_MSG_CHECKING(slib) |
| 157 |
slib_found=no |
| 158 |
for dir in /usr/share/slib /usr/local/slib /usr/local/lib/slib /usr/local/share/slib /usr/src/slib /opt/share/slib; do |
| 159 |
AS_IF([test -f $dir/require.scm], [ |
| 160 |
SLIB_DIR=$dir |
| 161 |
AC_MSG_RESULT($SLIB_DIR) |
| 162 |
slib_found=yes |
| 163 |
break |
| 164 |
]) |
| 165 |
done |
| 166 |
AS_IF([test $slib_found = "no"], [ |
| 167 |
AC_MSG_RESULT([not found, using fallback $SLIB_DIR]) |
| 168 |
]) |
| 169 |
]) |
| 170 |
AC_SUBST(SLIB_DIR) |
| 171 |
AC_DEFINE_UNQUOTED(SLIB_DIR, "$SLIB_DIR", [Slib installation path]) |
| 172 |
|
| 173 |
dnl ---------------------------------------------------------- |
| 174 |
dnl with-api-version=N |
| 175 |
dnl |
| 176 |
|
| 177 |
AC_ARG_WITH(api-version, |
| 178 |
AS_HELP_STRING([--with-api-version=N], |
| 179 |
[Compile Gauche with the given API version N, where N is |
| 180 |
a positive integer calculated as API_MAJOR_VERSION * 1000 + API_MINOR_VERSION. |
| 181 |
This is for developers to test their code with the specified API version. |
| 182 |
Available API versions may differ for each release; consult release notes |
| 183 |
for the details.]), |
| 184 |
[ AS_IF([echo "$with_api_version" | grep -E '^[[0-9]]+$' > /dev/null ], |
| 185 |
[AC_MSG_RESULT([Overriding API version with $with_api_version])], |
| 186 |
[AC_MSG_ERROR([The argument of --with-api-version must be a positive integer, but got "$with_api_version"])]) |
| 187 |
AC_DEFINE(GAUCHE_API_VERSION, $with_api_version, [Overriding API VERSION]) |
| 188 |
]) |
| 189 |
|
| 190 |
dnl ---------------------------------------------------------- |
| 191 |
dnl with-local=PATH:... |
| 192 |
dnl |
| 193 |
AC_ARG_WITH(local, |
| 194 |
AS_HELP_STRING([--with-local=PATH:PATH...], |
| 195 |
[For each PATH, add PATH/include to the include search |
| 196 |
paths and PATH/lib to the library search paths. Useful if you have some |
| 197 |
libraries installed in non-standard places. On MinGW/MSYS, use ';' as a |
| 198 |
separator instead of ':'.]), |
| 199 |
[ |
| 200 |
AS_CASE([$with_local], |
| 201 |
[yes|no|""], [], dnl no effect |
| 202 |
[IFS_save=$IFS |
| 203 |
AS_CASE([$host], |
| 204 |
[*mingw*], [IFS=";"], |
| 205 |
[IFS=":"]) |
| 206 |
sep0="" |
| 207 |
sep1="" |
| 208 |
for p in $with_local; do |
| 209 |
LOCAL_INC="${LOCAL_INC}${sep0}-I$p/include" |
| 210 |
LOCAL_LIB="${LOCAL_LIB}${sep0}-L$p/lib" |
| 211 |
LOCAL_INCDIRS="${LOCAL_INCDIRS}${sep1}$p/include" |
| 212 |
LOCAL_LIBDIRS="${LOCAL_LIBDIRS}${sep1}$p/lib" |
| 213 |
sep0=" " |
| 214 |
sep1="$IFS" |
| 215 |
done |
| 216 |
IFS=$IFS_save ]) |
| 217 |
]) |
| 218 |
AC_SUBST(LOCAL_INC) |
| 219 |
AC_SUBST(LOCAL_LIB) |
| 220 |
AC_SUBST(LOCAL_INCDIRS) |
| 221 |
AC_SUBST(LOCAL_LIBDIRS) |
| 222 |
dnl need to add here, for it may be used by the tests below. |
| 223 |
INCLUDES="$INCLUDES $LOCAL_INC" |
| 224 |
CPPFLAGS="$CPPFLAGS $LOCAL_INC" |
| 225 |
LDFLAGS="$LDFLAGS $LOCAL_LIB" |
| 226 |
|
| 227 |
dnl ---------------------------------------------------------- |
| 228 |
dnl with-rpath=PATH:... |
| 229 |
dnl |
| 230 |
try_rpath=yes |
| 231 |
rpath= |
| 232 |
AC_ARG_WITH(rpath, |
| 233 |
AS_HELP_STRING([--with-rpath=PATH:PATH...], |
| 234 |
[Use -rpath option while building dynamically loadable objects (experimental).]), |
| 235 |
[ |
| 236 |
AS_CASE([$with_rpath], |
| 237 |
[yes], [], |
| 238 |
[no], [try_rpath=no], |
| 239 |
[rpath=`echo $with_rpath | sed -e 's/^/-Wl,-rpath=/ ; s/:/,-rpath=/g'`]) |
| 240 |
]) |
| 241 |
|
| 242 |
dnl ---------------------------------------------------------- |
| 243 |
dnl with-libatomic-ops[=yes|no|check|none] |
| 244 |
dnl |
| 245 |
dnl The check is fairly complicated, so we let gc/configure work on it. |
| 246 |
dnl There are four cases regarding libatomic-ops usage: |
| 247 |
dnl 1. No libatomic_ops is used (no threads) |
| 248 |
dnl 2. Internal - gc/libatomic_ops/* will have compiled library. |
| 249 |
dnl 3. External - we need to link with system's libatomic_ops library. |
| 250 |
dnl 4. Intrinsic - use compiler intrinsic support. |
| 251 |
dnl Among these cases, only 3 needs a special care, where we have to know |
| 252 |
dnl the compiler and library flags. It is set in ATOMIC_OPS_CFLAGS and |
| 253 |
dnl ATOMIC_OPS_LIBS inside gc/Makefile, and we extract them at compile time. |
| 254 |
dnl |
| 255 |
dnl Caveat: There's a case that the compiler supports intrinsic atomic ops |
| 256 |
dnl yet not having C11 stdatomic.h (gcc 4.8). |
| 257 |
dnl The following test is to catch it. See src/gauche/priv/atomicP.h for |
| 258 |
dnl how we handle it. |
| 259 |
|
| 260 |
AC_CHECK_HEADERS(stdatomic.h) |
| 261 |
|
| 262 |
dnl ---------------------------------------------------------- |
| 263 |
dnl enable-shared-commands |
| 264 |
dnl |
| 265 |
AC_ARG_ENABLE(shared-commands, |
| 266 |
AS_HELP_STRING([--enable-shared-commands], |
| 267 |
[Install commands with SRFI-defined common names such as compile-r7rs. Note that other Scheme implementations may also install commands with the same name. This option overwrites them if there's any.]), |
| 268 |
[ |
| 269 |
AS_CASE([$enableval], |
| 270 |
[no], [], |
| 271 |
[install_common_commands=yes]) |
| 272 |
], []) |
| 273 |
|
| 274 |
dnl ---------------------------------------------------------- |
| 275 |
dnl enable-framework |
| 276 |
dnl |
| 277 |
ac_gauche_framework=no |
| 278 |
AC_ARG_ENABLE(framework, |
| 279 |
AS_HELP_STRING([--enable-framework], |
| 280 |
[On MacOSX, build Gauche as a framework. This flag has no effect on other platforms.]), |
| 281 |
[ |
| 282 |
AS_CASE([$enableval], |
| 283 |
[no], [], |
| 284 |
[ac_gauche_framework=yes]) |
| 285 |
], []) |
| 286 |
|
| 287 |
dnl ---------------------------------------------------------- |
| 288 |
dnl with-gperftools |
| 289 |
dnl |
| 290 |
AC_ARG_WITH(gperftools, |
| 291 |
AS_HELP_STRING([--with-gperftools], |
| 292 |
[Link with gperftools profiler. When linked, and run with CPUPROFILE=FILE environment variable, sampling profiler is run and the result is dumped to FILE. This is to profile Gauche system itself, not the programs written in Scheme (the latter is supported with gosh's -ptime runtime option). It is not recommended to build production release with this option.]), |
| 293 |
[ |
| 294 |
AS_CASE([$with_gperftools], |
| 295 |
[no], [], |
| 296 |
[AC_CHECK_HEADERS(gperftools/profiler.h) |
| 297 |
AC_CHECK_LIB(profiler, ProfilerStart) |
| 298 |
AS_IF([test "x$ac_cv_header_gperftools_profiler_h" != xyes |
| 299 |
-o "x$ac_cv_lib_profiler_ProfilerStart" != xyes], |
| 300 |
[AC_MSG_ERROR([The --with-gperftools option requires gperftools, but it doesn't appear to be installed on this system.])]) |
| 301 |
]) |
| 302 |
], []) |
| 303 |
|
| 304 |
dnl ---------------------------------------------------------- |
| 305 |
dnl enable-unsafe-jit-api |
| 306 |
dnl |
| 307 |
|
| 308 |
dnl This is a temporary option to experiment JIT implemtnation strategies. |
| 309 |
dnl Once we get a stable JIT mechanism, we'll remove this option. |
| 310 |
ac_gauche_enable_unsafe_jit_api=no |
| 311 |
AC_ARG_ENABLE(unsafe-jit-api, |
| 312 |
[], |
| 313 |
[ |
| 314 |
AC_DEFINE(GAUCHE_ENABLE_UNSAFE_JIT_API, 1, [Define 1 if unsafe JIT API is enabled]) |
| 315 |
], []) |
| 316 |
|
| 317 |
dnl =========================================================== |
| 318 |
dnl Set up version-related macros |
| 319 |
GAUCHE_VERSION=$PACKAGE_VERSION |
| 320 |
AC_SUBST(GAUCHE_VERSION) |
| 321 |
AC_DEFINE_UNQUOTED(GAUCHE_VERSION, "$GAUCHE_VERSION", [Gauche version string]) |
| 322 |
|
| 323 |
GAUCHE_VERSION_TRUNC=`echo $GAUCHE_VERSION | sed 's/@<:@-_@:>@.*//'` |
| 324 |
OLD_IFS=$IFS; IFS="."; set $GAUCHE_VERSION_TRUNC; IFS=$OLD_IFS |
| 325 |
GAUCHE_MAJOR_VERSION=$1 |
| 326 |
GAUCHE_MINOR_VERSION=$2 |
| 327 |
GAUCHE_MICRO_VERSION=$3 |
| 328 |
if test -z "$GAUCHE_MICRO_VERSION"; then GAUCHE_MICRO_VERSION=0; fi |
| 329 |
AC_SUBST(GAUCHE_MAJOR_VERSION) |
| 330 |
AC_SUBST(GAUCHE_MINOR_VERSION) |
| 331 |
AC_SUBST(GAUCHE_MICRO_VERSION) |
| 332 |
AC_DEFINE_UNQUOTED(GAUCHE_MAJOR_VERSION, $GAUCHE_MAJOR_VERSION,[Gauche major version number]) |
| 333 |
AC_DEFINE_UNQUOTED(GAUCHE_MINOR_VERSION, $GAUCHE_MINOR_VERSION,[Gauche minor version number]) |
| 334 |
AC_DEFINE_UNQUOTED(GAUCHE_MICRO_VERSION, $GAUCHE_MICRO_VERSION,[Gauche patch level number]) |
| 335 |
AC_SUBST(BUILD_GOSH_VERSION) |
| 336 |
|
| 337 |
if test -z "$GAUCHE_ABI_VERSION"; then |
| 338 |
GAUCHE_ABI_VERSION="$GAUCHE_MAJOR_VERSION.$GAUCHE_MINOR_VERSION" |
| 339 |
fi |
| 340 |
AC_SUBST(GAUCHE_ABI_VERSION) |
| 341 |
AC_DEFINE_UNQUOTED(GAUCHE_ABI_VERSION, "$GAUCHE_ABI_VERSION", [Gauche ABI version string]) |
| 342 |
|
| 343 |
if test -n "$GAUCHE_SNAPSHOT_ID"; then |
| 344 |
AC_DEFINE_UNQUOTED(GAUCHE_SNAPSHOT_ID, "$GAUCHE_SNAPSHOT_ID", [Gauche snapshot ID]) |
| 345 |
fi |
| 346 |
|
| 347 |
GAUCHE_SIGNATURE="$GAUCHE_ABI_VERSION,utf8,$GAUCHE_THREAD_TYPE" |
| 348 |
AC_DEFINE_UNQUOTED(GAUCHE_SIGNATURE, "$GAUCHE_SIGNATURE", [Gauche signature string]) |
| 349 |
|
| 350 |
LIBGAUCHE=libgauche-$GAUCHE_ABI_VERSION |
| 351 |
AC_SUBST(LIBGAUCHE) |
| 352 |
LIBGAUCHE_STATIC=libgauche-static-$GAUCHE_ABI_VERSION |
| 353 |
AC_SUBST(LIBGAUCHE_STATIC) |
| 354 |
LINKGAUCHE=gauche-$GAUCHE_ABI_VERSION |
| 355 |
AC_SUBST(LINKGAUCHE) |
| 356 |
|
| 357 |
dnl put the args to the configure in gauche-config script for later use. |
| 358 |
dnl the use of ac_configure_args depends on autoconf 2.52. |
| 359 |
GAUCHE_CONFIGURE_ARGS=`echo "$ac_configure_args" | sed 's/@<:@\\"\`\$@:>@/\\\\&/g'` |
| 360 |
AC_SUBST(GAUCHE_CONFIGURE_ARGS) |
| 361 |
|
| 362 |
dnl ========================================================== |
| 363 |
dnl Checks for programs. |
| 364 |
|
| 365 |
dnl Kludge for Solaris. We need this setup before start checking with |
| 366 |
dnl the compiler. NB: These flags do not coexist with -std=gnu99 flag. |
| 367 |
dnl Be careful when we start using C99 features. |
| 368 |
case $host in |
| 369 |
*-pc-solaris2.*) |
| 370 |
CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__" ;; |
| 371 |
esac |
| 372 |
|
| 373 |
AC_PROG_CC |
| 374 |
AC_PROG_CPP |
| 375 |
AC_C_CONST |
| 376 |
AC_PROG_MAKE_SET |
| 377 |
AC_PROG_INSTALL |
| 378 |
AC_PROG_LN_S |
| 379 |
AC_CHECK_PROGS(INSTALL_INFO, install-info) |
| 380 |
AC_CHECK_TOOLS(AR, ar gar) |
| 381 |
AC_CHECK_PROGS(MAKEINFO, makeinfo) |
| 382 |
AC_CHECK_PROGS(GZIP_PROGRAM, gzip) |
| 383 |
|
| 384 |
if test -z "$MAKEINFO" -o -z "$GZIP_PROGRAM"; then |
| 385 |
build_doc="No (requires makeinfo and gzip to build documents)" |
| 386 |
else |
| 387 |
build_doc=Yes |
| 388 |
fi |
| 389 |
|
| 390 |
dnl for cross build |
| 391 |
AC_CHECK_PROGS(BUILD_CC, ${build}-gcc ${build_alias}-gcc gcc cc) |
| 392 |
|
| 393 |
dnl for build from repo, we need preinstalled gosh |
| 394 |
dnl NB: The third arg is the value when we don't detect preinstalled gosh. |
| 395 |
dnl In such case, building from repo fails anyway; shall we use alternative |
| 396 |
dnl name or something to tell the builder that she needs preinstalled gosh? |
| 397 |
AC_ARG_VAR(BUILD_GOSH, [gosh command used during build]) |
| 398 |
if test -z ${BUILD_GOSH+z}; then |
| 399 |
AC_PATH_PROG(BUILD_GOSH, gosh, gosh) |
| 400 |
fi |
| 401 |
|
| 402 |
dnl Safe default CFLAGS (usually -g -O2 if you're using gcc, empty otherwise). |
| 403 |
dnl If the user overrides CFLAGS during configure, which is recorded. |
| 404 |
dnl This information is used when configuring extensions. |
| 405 |
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-label" |
| 406 |
DEFAULT_CFLAGS="$CFLAGS" |
| 407 |
AC_SUBST(DEFAULT_CFLAGS) |
| 408 |
|
| 409 |
dnl =========================================================== |
| 410 |
dnl Checks for header files. |
| 411 |
dnl We check sys/types.h merely to include it in the following tests, |
| 412 |
dnl for some tests needs it. |
| 413 |
|
| 414 |
AC_CHECK_HEADERS_ONCE([sys/time.h]) |
| 415 |
AC_CHECK_HEADERS(time.h sys/time.h sys/types.h glob.h dlfcn.h getopt.h sched.h) |
| 416 |
AC_CHECK_HEADERS(unistd.h rpc/types.h malloc.h) |
| 417 |
AC_CHECK_HEADERS(syslog.h crypt.h) |
| 418 |
AC_CHECK_HEADERS(pty.h util.h bsd/libutil.h libutil.h sys/loadavg.h sys/resource.h) |
| 419 |
AC_CHECK_HEADERS(sys/statvfs.h) |
| 420 |
AC_CHECK_HEADERS(sys/mman.h) |
| 421 |
|
| 422 |
dnl C11 stdalign availability |
| 423 |
AC_CHECK_HEADERS(stdalign.h) |
| 424 |
|
| 425 |
dnl glibc specific |
| 426 |
AC_CHECK_HEADERS(fpu_control.h) |
| 427 |
|
| 428 |
dnl Linux specific |
| 429 |
AC_CHECK_HEADERS(sys/inotify.h) |
| 430 |
|
| 431 |
dnl BSD specific |
| 432 |
AC_CHECK_HEADERS(sys/event.h) |
| 433 |
|
| 434 |
dnl Solaris specific |
| 435 |
AC_CHECK_HEADERS(sunmath.h) |
| 436 |
|
| 437 |
dnl OSX specific. If this header exists, we assume that extern char **environ |
| 438 |
dnl isn't available and we should use _NSGetEnviron(). |
| 439 |
AC_CHECK_HEADERS(crt_externs.h) |
| 440 |
|
| 441 |
dnl OSX specific. To call proc_pidpath(). Note that this is not officially |
| 442 |
dnl supported by Apple. |
| 443 |
AC_CHECK_HEADERS(libproc.h) |
| 444 |
|
| 445 |
dnl =========================================================== |
| 446 |
dnl Checks processor type, for processor-specific stuff |
| 447 |
AS_CASE([$host], |
| 448 |
[i?86-apple-darwin*], [ |
| 449 |
AC_CHECK_DEFINE([i386],[AC_DEFINE(SCM_TARGET_I386,1,Define to use i386 optimizations)])], |
| 450 |
[i?86-*], [ |
| 451 |
AC_DEFINE(SCM_TARGET_I386,1,[Define to use i386 optimizations])], |
| 452 |
[x86_64-*], [ |
| 453 |
AC_DEFINE(SCM_TARGET_X86_64,1,[Define to use x86_64 optimizations])], |
| 454 |
[alpha*|sh4-*|sh4el-*|sh4eb-*], [ |
| 455 |
CFLAGS="$CFLAGS -mieee"], |
| 456 |
[arm*], [ |
| 457 |
dnl ARM processor may use a special mixed endian for doubles. It can |
| 458 |
dnl be switched by processor configuration. So we check it at runtime. |
| 459 |
AC_DEFINE(DOUBLE_ARMENDIAN,1,[Define to use mixed endian ARM processor])]) |
| 460 |
|
| 461 |
dnl =========================================================== |
| 462 |
dnl Checks for typedefs, structures, and compiler characteristics. |
| 463 |
AC_SYS_LARGEFILE |
| 464 |
AC_C_INLINE |
| 465 |
AC_C_BIGENDIAN |
| 466 |
AC_STRUCT_TM |
| 467 |
AC_CHECK_SIZEOF(long) |
| 468 |
AC_CHECK_SIZEOF(int) |
| 469 |
AC_CHECK_SIZEOF(intptr_t) |
| 470 |
AC_CHECK_SIZEOF(uintptr_t) |
| 471 |
AC_CHECK_SIZEOF(size_t) |
| 472 |
AC_CHECK_SIZEOF(ssize_t) |
| 473 |
AC_CHECK_SIZEOF(ptrdiff_t) |
| 474 |
AC_CHECK_SIZEOF(off_t) |
| 475 |
AC_CHECK_SIZEOF(double) |
| 476 |
AC_CHECK_SIZEOF(float) |
| 477 |
AC_CHECK_TYPES([long long, long double]) |
| 478 |
AC_CHECK_TYPES([struct timespec]) |
| 479 |
|
| 480 |
if test "$GAUCHE_THREAD_TYPE" = pthreads; then |
| 481 |
AC_CHECK_TYPES(pthread_spinlock_t,,,[#include <pthread.h>]) |
| 482 |
fi |
| 483 |
|
| 484 |
AC_CHECK_SIZEOF(rlim_t,,[ |
| 485 |
#if HAVE_SYS_TIME_H |
| 486 |
# include <sys/time.h> |
| 487 |
#endif |
| 488 |
#if HAVE_SYS_RESOURCE_H |
| 489 |
# include <sys/resource.h> |
| 490 |
#endif |
| 491 |
]) |
| 492 |
|
| 493 |
dnl Checks nanosecond resolution in stat structure |
| 494 |
AC_CHECK_MEMBERS([struct stat.st_atim, |
| 495 |
struct stat.st_mtim, |
| 496 |
struct stat.st_ctim],,,[#include <sys/stat.h>]) |
| 497 |
|
| 498 |
dnl Checks non-POSIX members of system structure |
| 499 |
AC_CHECK_MEMBERS([struct group.gr_passwd],,,[#include <grp.h>]) |
| 500 |
AC_CHECK_MEMBERS([struct passwd.pw_passwd, |
| 501 |
struct passwd.pw_gecos, |
| 502 |
struct passwd.pw_class],,,[#include <pwd.h>]) |
| 503 |
|
| 504 |
dnl checks if time_t is integer or flonum |
| 505 |
AC_CACHE_CHECK(time_t is integral, ac_cv_type_time_t_integral, [ |
| 506 |
AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 507 |
#include <time.h> |
| 508 |
int main() |
| 509 |
{ |
| 510 |
time_t t = 3.14; |
| 511 |
return (t == 3.14); |
| 512 |
}]])],[ac_cv_type_time_t_integral=yes],[ac_cv_type_time_t_integral=no],[ac_cv_type_time_t_integral=yes])]) |
| 513 |
|
| 514 |
if test "$ac_cv_type_time_t_integral" = yes; then |
| 515 |
AC_DEFINE(INTEGRAL_TIME_T,1,[Define if time_t is typedef'ed to an integral type]) |
| 516 |
fi |
| 517 |
|
| 518 |
dnl =========================================================== |
| 519 |
dnl Checks for library functions. |
| 520 |
|
| 521 |
dnl This is required to test trunc and rint below |
| 522 |
AC_CHECK_LIB(m, sin) |
| 523 |
|
| 524 |
dnl x86-solaris 9 requires this to use isinf |
| 525 |
AC_CHECK_LIB(sunmath, isinf) |
| 526 |
|
| 527 |
dnl clock_gettime may be in librt |
| 528 |
AC_CHECK_LIB(rt, clock_gettime) |
| 529 |
|
| 530 |
dnl OSX specific |
| 531 |
AC_CHECK_LIB(proc, proc_pidpath) |
| 532 |
|
| 533 |
dnl For Windows/MinGW, manually adds several libraries |
| 534 |
dnl Also adds -DUNICODE to CFLAGS enable Windows wchar API, |
| 535 |
dnl Also adds -D__USE_MINGW_ANSI_STDIO to CFLAGS to support |
| 536 |
dnl C99 printf format string. |
| 537 |
dnl ALTERNATIVE_GOSH is no-console version of gosh; only built on Windows. |
| 538 |
case "$host" in |
| 539 |
*mingw*) LIBS="$LIBS -lnetapi32 -lshlwapi -lws2_32 -lbcrypt" |
| 540 |
ALTERNATIVE_GOSH="gosh-noconsole.exe" |
| 541 |
CFLAGS="$CFLAGS -DUNICODE -D__USE_MINGW_ANSI_STDIO" ;; |
| 542 |
*) ALTERNATIVE_GOSH="" ;; |
| 543 |
esac |
| 544 |
AC_SUBST(ALTERNATIVE_GOSH) |
| 545 |
|
| 546 |
AC_FUNC_ALLOCA |
| 547 |
AC_CHECK_FUNCS(isnan isinf trunc rint tgamma lgamma) |
| 548 |
AC_CHECK_FUNCS(symlink readlink lchown realpath nanosleep usleep utimensat) |
| 549 |
AC_CHECK_FUNCS(random srandom lrand48 srand48) |
| 550 |
AC_CHECK_FUNCS(putenv setenv unsetenv clearenv getpgid setgroups) |
| 551 |
AC_CHECK_FUNCS(gethostname sethostname getdomainname setdomainname) |
| 552 |
AC_CHECK_FUNCS(gettimeofday getloadavg clock_gettime clock_getres) |
| 553 |
AC_CHECK_FUNCS(syslog setlogmask) |
| 554 |
AC_CHECK_FUNCS(sigwait) |
| 555 |
AC_CHECK_FUNCS(fpsetprec) |
| 556 |
AC_CHECK_FUNCS(issetugid) |
| 557 |
AC_CHECK_FUNCS(strsignal) |
| 558 |
|
| 559 |
dnl KLUDGE: As of Dec 2015, Mingw-w64 provides mkstemp() but it opens |
| 560 |
dnl the file with _O_TEMPORARY flag, so the file gets automatically deleted |
| 561 |
dnl when its opened file descriptors are all closed. It is incompatible |
| 562 |
dnl for typical behavior and we avoid using it. This kludge should be |
| 563 |
dnl removed once mingw-w64 fixes mkstemp. (We include mkdtemp here as |
| 564 |
dnl well, just because it's nice to see them togeter. Mingw-w64 doesn't |
| 565 |
dnl have mkdtemp yet, so it doesn't matter wheter we include it or not.) |
| 566 |
case "$host" in |
| 567 |
*mingw*) ;; |
| 568 |
*) |
| 569 |
AC_CHECK_FUNCS(mkdtemp mkstemp);; |
| 570 |
esac |
| 571 |
|
| 572 |
dnl Check for select(). HP-UX and MinGW doesn't like the way configure tests |
| 573 |
dnl select() existence and we know they have one, so we skip the test on them. |
| 574 |
case "$host" in |
| 575 |
*-hpux*|*mingw*) |
| 576 |
AC_DEFINE(HAVE_SELECT, 1, [Define if you have select]) ;; |
| 577 |
*) |
| 578 |
AC_CHECK_FUNCS(select);; |
| 579 |
esac |
| 580 |
|
| 581 |
dnl Checks for pty-related fns. It appears that recent Cygwin has them, |
| 582 |
dnl but only in a static library. That prevents us from creating DLL |
| 583 |
dnl version of gauche. Thus we explicitly exclude them on cygwin. |
| 584 |
case "$host" in |
| 585 |
*cygwin*) |
| 586 |
: ;; |
| 587 |
*) |
| 588 |
AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty])) |
| 589 |
AC_SEARCH_LIBS(forkpty, util, AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty])) |
| 590 |
;; |
| 591 |
esac |
| 592 |
|
| 593 |
dnl Check for fcntl |
| 594 |
AC_CHECK_FUNCS(fcntl) |
| 595 |
|
| 596 |
dnl Checks if crypt() exists and whether it's in libc or libcrypt. |
| 597 |
dnl Note: on cygwin, libcrypt is only available as a static library, |
| 598 |
dnl and prevents libgauche.dll from building. We explicitly excludes it. |
| 599 |
dnl |
| 600 |
case "$host" in |
| 601 |
*cygwin*) |
| 602 |
: ;; |
| 603 |
*) |
| 604 |
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT,1,[Define if uses libcrypt])) |
| 605 |
;; |
| 606 |
esac |
| 607 |
|
| 608 |
dnl Checks if dlopen exists, and if it's in libc or libdl. |
| 609 |
dnl On MinGW, we call LoadLibrary so we don't need dlopen (see dl_win.c) |
| 610 |
case "$host" in |
| 611 |
*mingw*) |
| 612 |
: ;; |
| 613 |
*) |
| 614 |
AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN,1,[Define if the system has dlopen()])) |
| 615 |
;; |
| 616 |
esac |
| 617 |
|
| 618 |
dnl Checks for sched_yield. |
| 619 |
AC_SEARCH_LIBS(sched_yield, rt, AC_DEFINE(HAVE_SCHED_YIELD,1,[Define if uses librt])) |
| 620 |
|
| 621 |
dnl Check for pthread_cancel. $LIBS should already have thread libraries. |
| 622 |
if test "$GAUCHE_THREAD_TYPE" = pthreads; then |
| 623 |
AC_CHECK_FUNCS(pthread_cancel) |
| 624 |
fi |
| 625 |
|
| 626 |
|
| 627 |
dnl Use Resource file |
| 628 |
AS_CASE([$host], |
| 629 |
[*mingw*], [USE_WIN_RESOURCE_yes="" |
| 630 |
USE_WIN_RESOURCE_no="@%:@"], |
| 631 |
[USE_WIN_RESOURCE_yes="@%:@" |
| 632 |
USE_WIN_RESOURCE_no=""]) |
| 633 |
AC_SUBST(USE_WIN_RESOURCE_yes) |
| 634 |
AC_SUBST(USE_WIN_RESOURCE_no) |
| 635 |
|
| 636 |
dnl |
| 637 |
dnl Checks compiler options for dynamic link and thread support. |
| 638 |
dnl |
| 639 |
dnl SHLIB_SO_SUFFIX Suffix of dlopen-able module. most systems doesn't |
| 640 |
dnl have restriction for this. default "so". |
| 641 |
dnl SHLIB_DYLIB_SUFFIX Suffix of dynamic linkable module. On Unices |
| 642 |
dnl it is usuallly "so". On MacOSX it is "dylib". |
| 643 |
dnl On Win32 it is "dll". If not explicitly specified, |
| 644 |
dnl SHLIB_SO_SUFFIX is used. |
| 645 |
dnl SHLIB_SO_CFLAGS flags to compile files which is dlopen-able |
| 646 |
dnl e.g. "-fpic" |
| 647 |
dnl SHLIB_SO_LDFLAGS flags to link files to create dlopen-able |
| 648 |
dnl module, e.g. "-shared -o" |
| 649 |
dnl SHLIB_DYLIB_LDFLAGS flags to link files to create dynamically linkable |
| 650 |
dnl module. On most unices this is the same as |
| 651 |
dnl SHLIB_SO_LDFLAGS. |
| 652 |
dnl SHLIB_MAIN_LDFLAGS flags required to compile a main program which |
| 653 |
dnl exposes symbols to be referred by the dynamically |
| 654 |
dnl loaded module, e.g. "-rdynamic" |
| 655 |
dnl LINK_HELPER A script that helps linking libgauche. Sort of |
| 656 |
dnl simplified libtool. So far we only need this on |
| 657 |
dnl MacOSX. We have absolutely no intention to |
| 658 |
dnl re-invent libtool, though. |
| 659 |
dnl LIBGAUCHE_SO defined as "libgauche.$(SHLIB_SO_SUFFIX)" if |
| 660 |
dnl system supports dso. empty otherwise. |
| 661 |
dnl GOSH_USE_SHLIB If set to "yes", gosh uses dynamic linkable version |
| 662 |
dnl of libgauche, instead of statically links libgauche.a. |
| 663 |
dnl On Win32 it is required to allow extensions to work. |
| 664 |
|
| 665 |
AC_MSG_CHECKING(how to make dynamic loadable module) |
| 666 |
|
| 667 |
# A flag to indicate libgauche can be linked when building extension module. |
| 668 |
# It is required on cygwin; it has to be omitted on MacOS X; Other unices |
| 669 |
# generally don't care. |
| 670 |
ext_use_libgauche=no |
| 671 |
|
| 672 |
# A flag to indicate we need to create a link with version numbers to |
| 673 |
# libgauche.so after building it. |
| 674 |
libgauche_version_link=yes |
| 675 |
|
| 676 |
# A flag to indicate uvector.so should be added when linking extension module |
| 677 |
# that refers to uvector. It is required if we want to resolve all symbols, |
| 678 |
# and although it's the usual case, we can't add it on MacOS X, on which |
| 679 |
# we only build the static version of libgauche. |
| 680 |
ext_use_uvector=no |
| 681 |
|
| 682 |
# We put additional information, such as whether we use Framework for |
| 683 |
# darwin, in this variable. |
| 684 |
xhost=$host |
| 685 |
|
| 686 |
# On cygwin, we likely to need rebaseall to make dlls work with sys-fork. |
| 687 |
CYGWIN_FIXDLL=: |
| 688 |
|
| 689 |
AS_CASE([$host], |
| 690 |
[*freebsd2*], [ |
| 691 |
SHLIB_SO_CFLAGS="-fpic -fPIC" |
| 692 |
SHLIB_SO_LDFLAGS="-v;ld -Bshareable -o" |
| 693 |
SHLIB_SO_SUFFIX="so" |
| 694 |
SHLIB_MAIN_LDFLAGS="" |
| 695 |
SHLIB_OK=ok |
| 696 |
], |
| 697 |
[*-linux-*|*-*-gnu*|*freebsd*|*dragonfly*], [ |
| 698 |
SHLIB_SO_CFLAGS="-fPIC" |
| 699 |
SHLIB_SO_LDFLAGS="$rpath -shared -o" |
| 700 |
SHLIB_SO_SUFFIX="so" |
| 701 |
SHLIB_MAIN_LDFLAGS="-rdynamic" |
| 702 |
SHLIB_OK=ok |
| 703 |
], |
| 704 |
[*netbsd*|*openbsd*], [ |
| 705 |
SHLIB_SO_CFLAGS="-fPIC -DPIC" |
| 706 |
SHLIB_SO_LDFLAGS="$rpath -shared -o" |
| 707 |
SHLIB_SO_SUFFIX="so" |
| 708 |
SHLIB_MAIN_LDFLAGS="-rdynamic" |
| 709 |
SHLIB_OK=ok |
| 710 |
], |
| 711 |
[*darwin*], [ |
| 712 |
dnl -no-cpp-precomp is not related to shared library, but needed to |
| 713 |
dnl get src/{vm.c,char.c} compiled -skimu |
| 714 |
dnl [Shiro] Darwin 1.3 and later needs different flags |
| 715 |
CPPFLAGS="$CPPFLAGS -no-cpp-precomp" |
| 716 |
AS_CASE([$host_os], |
| 717 |
[darwin1.@<:@012@:>@], [FLAT_NAMESPACE=""], |
| 718 |
[FLAT_NAMESPACE="-flat_namespace"]) |
| 719 |
AS_CASE([$host_os], |
| 720 |
[darwin9.8.*], [], dnl Leopard doesn't like -no_pie |
| 721 |
[SHLIB_MAIN_LDFLAGS="-Wl,-no_pie"]) |
| 722 |
SHLIB_SO_CFLAGS="-no-cpp-precomp -fPIC -fno-common" |
| 723 |
SHLIB_SO_LDFLAGS="-bundle $FLAT_NAMESPACE -undefined suppress -o" |
| 724 |
SHLIB_SO_SUFFIX="so" |
| 725 |
SHLIB_DYLIB_LDFLAGS='-framework CoreServices -framework CoreFoundation -dynamiclib -o' |
| 726 |
AS_IF([test "$ac_gauche_framework" = yes], [ |
| 727 |
AC_DEFINE(GAUCHE_MACOSX_FRAMEWORK, 1, [Define 1 if building framework on MacOSX]) |
| 728 |
xhost="${host}-framework" |
| 729 |
]) |
| 730 |
SHLIB_DYLIB_SUFFIX="dylib" |
| 731 |
SHLIB_LIBS_FOR_EXT="" |
| 732 |
SHLIB_OK=ok |
| 733 |
LINK_HELPER='$(srcdir)/link-dylib' |
| 734 |
ext_use_libgauche=no |
| 735 |
libgauche_version_link=no |
| 736 |
], |
| 737 |
[mips-sgi-irix*], [ |
| 738 |
AS_IF([test "$GCC" = yes], |
| 739 |
[SHLIB_SO_CFLAGS="-fPIC"], |
| 740 |
[SHLIB_SO_CFLAGS="-KPIC"]) |
| 741 |
SHLIB_SO_LDFLAGS="$rpath -shared -o" |
| 742 |
SHLIB_SO_SUFFIX="so" |
| 743 |
SHLIB_MAIN_LDFLAGS="" |
| 744 |
SHLIB_OK=ok |
| 745 |
], |
| 746 |
[*solaris*], [ |
| 747 |
AS_IF([test "$GCC" = yes], [ |
| 748 |
SHLIB_SO_CFLAGS="-fPIC" |
| 749 |
SHLIB_SO_LDFLAGS="-shared -o" |
| 750 |
], [ |
| 751 |
SHLIB_SO_CFLAGS="-Kpic" |
| 752 |
SHLIB_SO_LDFLAGS="-G -o" |
| 753 |
]) |
| 754 |
SHLIB_SO_SUFFIX="so" |
| 755 |
SHLIB_MAIN_LDFLAGS="" |
| 756 |
SHLIB_OK=ok |
| 757 |
], |
| 758 |
[*hp*], [ |
| 759 |
AS_IF([test "$GCC" = yes], [ |
| 760 |
SHLIB_SO_CFLAGS="-fPIC" |
| 761 |
SHLIB_SO_LDFLAGS="-shared -o" |
| 762 |
], [ |
| 763 |
SHLIB_SO_CFLAGS="+z +Z" |
| 764 |
SHLIB_SO_LDFLAGS=";ld -b -o" |
| 765 |
]) |
| 766 |
SHLIB_SO_SUFFIX="sl" |
| 767 |
SHLIB_MAIN_LDFLAGS="" |
| 768 |
SHLIB_OK=ok |
| 769 |
LINK_HELPER='$(srcdir)/link-hpux' |
| 770 |
], |
| 771 |
[*cygwin*], [ |
| 772 |
SHLIB_SO_CFLAGS="" |
| 773 |
SHLIB_SO_LDFLAGS='-Wl,--export-all-symbols -Wl,--enable-auto-import -shared -o' |
| 774 |
SHLIB_SO_SUFFIX="dll" |
| 775 |
SHLIB_DYLIB_SUFFIX="dll" |
| 776 |
SHLIB_MAIN_LDFLAGS="-Wl,--enable-auto-import" |
| 777 |
SHLIB_OK=ok |
| 778 |
GOSH_USE_SHLIB=yes |
| 779 |
ext_use_uvector=yes |
| 780 |
ext_use_libgauche=yes |
| 781 |
libgauche_version_link=no |
| 782 |
CYGWIN_FIXDLL='$(srcdir)/src/cygwin-fixdll.sh' |
| 783 |
], |
| 784 |
[*mingw*], [ |
| 785 |
dnl Kludge: We add -static-libgcc flag when creating dll, in order to avoid |
| 786 |
dnl introducing dependency to libgcc_s_dw2-1.dll. |
| 787 |
SHLIB_SO_CFLAGS="" |
| 788 |
SHLIB_SO_LDFLAGS='-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -static-libgcc -shared -o' |
| 789 |
SHLIB_SO_SUFFIX="dll" |
| 790 |
SHLIB_DYLIB_SUFFIX="dll" |
| 791 |
SHLIB_MAIN_LDFLAGS="-Wl,--enable-auto-import -static-libgcc" |
| 792 |
SHLIB_OK=ok |
| 793 |
GOSH_USE_SHLIB=yes |
| 794 |
ext_use_uvector=yes |
| 795 |
ext_use_libgauche=yes |
| 796 |
libgauche_version_link=no |
| 797 |
], |
| 798 |
[ |
| 799 |
SHLIB_SO_CFLAGS="" |
| 800 |
SHLIB_SO_LDFLAGS="" |
| 801 |
SHLIB_SO_SUFFIX="" |
| 802 |
SHLIB_MAIN_LDFLAGS="" |
| 803 |
SHLIB_OK=unknown |
| 804 |
]) |
| 805 |
AS_IF([test -z "$SHLIB_DYLIB_LDFLAGS"], |
| 806 |
[SHLIB_DYLIB_LDFLAGS=$SHLIB_SO_LDFLAGS]) |
| 807 |
AS_IF([test -z "$SHLIB_DYLIB_SUFFIX"], |
| 808 |
[SHLIB_DYLIB_SUFFIX=$SHLIB_SO_SUFFIX]) |
| 809 |
AS_IF([test "$SHLIB_OK" = ok], |
| 810 |
[LIBGAUCHE_SO="$LIBGAUCHE.$SHLIB_DYLIB_SUFFIX"], |
| 811 |
[LIBGAUCHE_SO=]) |
| 812 |
AS_IF([test "$ext_use_libgauche" = yes], |
| 813 |
[EXT_LIBGAUCHE="-l$LINKGAUCHE"], |
| 814 |
[EXT_LIBGAUCHE=]) |
| 815 |
AS_IF([test "$ext_use_uvector" = yes], |
| 816 |
[EXT_UVECTOR='$(top_builddir)/ext/uvector/libgauche-uvector.$(SOEXT)'], |
| 817 |
[EXT_UVECTOR=]) |
| 818 |
AS_IF([test "$libgauche_version_link" = yes -a "$SHLIB_OK" = ok], |
| 819 |
[MAKEVERSLINK='$(SHELL) ./makeverslink'], |
| 820 |
[MAKEVERSLINK=:]) |
| 821 |
AS_IF([test "$install_common_commands" = yes], |
| 822 |
[INSTALL_COMMON_COMMANDS='$(SHELL) $(top_srcdir)/tools/install-shared-commands.sh'], |
| 823 |
[INSTALL_COMMON_COMMANDS=:]) |
| 824 |
|
| 825 |
AC_SUBST(xhost) |
| 826 |
AC_SUBST(SHLIB_SO_CFLAGS) |
| 827 |
AC_SUBST(SHLIB_SO_LDFLAGS) |
| 828 |
AC_SUBST(SHLIB_SO_SUFFIX) |
| 829 |
AC_SUBST(SHLIB_LIBS_FOR_EXT) |
| 830 |
AC_SUBST(SHLIB_DYLIB_LDFLAGS) |
| 831 |
AC_SUBST(SHLIB_DYLIB_SUFFIX) |
| 832 |
AC_SUBST(SHLIB_MAIN_LDFLAGS) |
| 833 |
AC_SUBST(EXT_LIBGAUCHE) |
| 834 |
AC_SUBST(EXT_UVECTOR) |
| 835 |
AC_SUBST(LIBGAUCHE_SO) |
| 836 |
AC_SUBST(GOSH_USE_SHLIB) |
| 837 |
AC_DEFINE_UNQUOTED(SHLIB_SO_SUFFIX, "$SHLIB_SO_SUFFIX", [Shared library file suffix]) |
| 838 |
AC_SUBST(LINK_HELPER) |
| 839 |
AC_SUBST(MAKEVERSLINK) |
| 840 |
AC_SUBST(INSTALL_COMMON_COMMANDS) |
| 841 |
AC_SUBST(CYGWIN_FIXDLL) |
| 842 |
AC_MSG_RESULT($SHLIB_OK) |
| 843 |
|
| 844 |
dnl Check to see if the linker takes --rpath flag via -Wl. |
| 845 |
RPATH_FLAG= |
| 846 |
if test "$try_rpath" = "yes"; then |
| 847 |
cflags_save="$CFLAGS" |
| 848 |
CFLAGS="$CFLAGS -Wl,--rpath=/" |
| 849 |
AC_CACHE_CHECK([linker takes --rpath flag], ac_cv_linker_rpath_flag, [ |
| 850 |
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
| 851 |
ac_cv_linker_rpath_flag=yes, |
| 852 |
ac_cv_linker_rpath_flag=no) |
| 853 |
]) |
| 854 |
CFLAGS="$cflags_save" |
| 855 |
if test "$ac_cv_linker_rpath_flag" = "yes"; then |
| 856 |
RPATH_FLAG='-Wl,--rpath=' |
| 857 |
else |
| 858 |
# solaris' ld uses -R instead of --rpath |
| 859 |
CFLAGS="$CFLAGS -Wl,-R,/" |
| 860 |
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
| 861 |
ac_cv_linker_rpath_flag=yes, |
| 862 |
ac_cv_linker_rpath_flag=no) |
| 863 |
CFLAGS="$cflags_save" |
| 864 |
if test "$ac_cv_linker_rpath_flag" = "yes"; then |
| 865 |
RPATH_FLAG='-Wl,-R,' |
| 866 |
fi |
| 867 |
fi |
| 868 |
if test "$RPATH_FLAG" != ""; then |
| 869 |
RPATH_TMP=$RPATH_FLAG'"`pwd`"' |
| 870 |
RPATH_REAL='' |
| 871 |
fi |
| 872 |
fi |
| 873 |
AC_SUBST(RPATH_FLAG) |
| 874 |
AC_SUBST(RPATH_TMP) |
| 875 |
AC_SUBST(RPATH_REAL) |
| 876 |
|
| 877 |
dnl Check to see if the linker takes --soname flag |
| 878 |
cflags_save="$CFLAGS" |
| 879 |
CFLAGS="$CFLAGS -Wl,--soname,libgauche.so.0" |
| 880 |
AC_CACHE_CHECK([linker takes --soname flag], ac_cv_linker_soname_flag, [ |
| 881 |
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
| 882 |
ac_cv_linker_soname_flag=yes, |
| 883 |
ac_cv_linker_soname_flag=no) |
| 884 |
]) |
| 885 |
CFLAGS="$cflags_save" |
| 886 |
if test "$ac_cv_linker_soname_flag" = "yes"; then |
| 887 |
SONAME_FLAG="-Wl,--soname,$LIBGAUCHE.so.0" |
| 888 |
fi |
| 889 |
AC_SUBST(SONAME_FLAG) |
| 890 |
|
| 891 |
dnl Sets some optimization flags by heuristics. |
| 892 |
AC_GAUCHE_OPTFLAGS |
| 893 |
|
| 894 |
dnl =========================================================== |
| 895 |
dnl More tests for specific components |
| 896 |
dnl These are separate *.ac files for easier management |
| 897 |
|
| 898 |
m4_include([ac/net.ac]) |
| 899 |
|
| 900 |
dnl =========================================================== |
| 901 |
dnl Tests for extensions |
| 902 |
|
| 903 |
EXT_LIBS= |
| 904 |
# Those *.ac's may add libraries to EXT_LIBS. |
| 905 |
m4_include([ext/charconv/charconv.ac]) |
| 906 |
m4_include([ext/dbm/dbm.ac]) |
| 907 |
m4_include([ext/zlib/zlib.ac]) |
| 908 |
m4_include([ext/tls/tls.ac]) |
| 909 |
|
| 910 |
dnl Setup STATIC_LIBS |
| 911 |
#STATIC_LIBS= |
| 912 |
#for lib in $EXT_LIBS $LIBS; do |
| 913 |
# AS_IF([ echo "${STATIC_LIBS}" | grep -F -w -e "${lib}" > /dev/null 2>&1 ], |
| 914 |
# [], dnl lib is alreay in STATIC_LIBS. do nothing |
| 915 |
# [STATIC_LIBS="$STATIC_LIBS $lib"]) |
| 916 |
#done |
| 917 |
STATIC_LIBS="$EXT_LIBS $LIBS" |
| 918 |
STATIC_LIBS="`echo $LIBGAUCHE_STATIC | sed s/^lib/-l/` $STATIC_LIBS" |
| 919 |
AS_CASE([$host], |
| 920 |
[*darwin*], [ |
| 921 |
STATIC_LIBS="-framework CoreServices -framework CoreFoundation $STATIC_LIBS" |
| 922 |
], |
| 923 |
[]) |
| 924 |
AC_SUBST(STATIC_LIBS) |
| 925 |
|
| 926 |
dnl =========================================================== |
| 927 |
dnl Cross compiling |
| 928 |
if test ${cross_compiling} = no ; then |
| 929 |
# self compile |
| 930 |
CROSS_COMPILING_yes="@%:@" |
| 931 |
CROSS_COMPILING_no= |
| 932 |
else |
| 933 |
# cross compile |
| 934 |
CROSS_COMPILING_yes= |
| 935 |
CROSS_COMPILING_no="@%:@" |
| 936 |
fi |
| 937 |
AC_SUBST(CROSS_COMPILING_yes) |
| 938 |
AC_SUBST(CROSS_COMPILING_no) |
| 939 |
|
| 940 |
dnl =========================================================== |
| 941 |
dnl Configure gc |
| 942 |
AC_CONFIG_SUBDIRS(gc) |
| 943 |
|
| 944 |
dnl =========================================================== |
| 945 |
dnl Create output files |
| 946 |
AC_CONFIG_FILES([ |
| 947 |
Makefile |
| 948 |
src/Makefile src/genconfig src/makeverslink |
| 949 |
lib/Makefile |
| 950 |
doc/gosh.1 doc/gauche-config.1 doc/gauche-cesconv.1 |
| 951 |
doc/gauche-install.1 doc/gauche-package.1 doc/Makefile |
| 952 |
ext/Makefile ext/Makefile.ext |
| 953 |
ext/bcrypt/Makefile |
| 954 |
ext/binary/Makefile |
| 955 |
ext/charconv/Makefile ext/charconv/iconv-adapter.h |
| 956 |
ext/data/Makefile |
| 957 |
ext/dbm/Makefile |
| 958 |
ext/digest/Makefile |
| 959 |
ext/fcntl/Makefile |
| 960 |
ext/file/Makefile |
| 961 |
ext/gauche/Makefile |
| 962 |
ext/mt-random/Makefile |
| 963 |
ext/native/Makefile |
| 964 |
ext/peg/Makefile |
| 965 |
ext/scheme/Makefile |
| 966 |
ext/sparse/Makefile |
| 967 |
ext/srfi/Makefile |
| 968 |
ext/sxml/Makefile |
| 969 |
ext/syslog/Makefile |
| 970 |
ext/tls/Makefile |
| 971 |
ext/termios/Makefile |
| 972 |
ext/text/Makefile |
| 973 |
ext/util/Makefile |
| 974 |
ext/uvector/Makefile |
| 975 |
ext/vport/Makefile |
| 976 |
ext/rfc/Makefile |
| 977 |
ext/zlib/Makefile |
| 978 |
ext/windows/Makefile |
| 979 |
examples/Makefile |
| 980 |
examples/standalone/Makefile |
| 981 |
gc/configure.gnu-gauche:tools/gc-configure.gnu-gauche.in |
| 982 |
Gauche.spec |
| 983 |
tools/Makefile |
| 984 |
tools/scoop/Makefile |
| 985 |
tools/tls/Makefile |
| 986 |
]) |
| 987 |
AC_CONFIG_COMMANDS([VERSION], |
| 988 |
[echo "${GAUCHE_VERSION}" > VERSION], |
| 989 |
[GAUCHE_VERSION="${GAUCHE_VERSION}"]) |
| 990 |
AC_CONFIG_COMMANDS([src/features], |
| 991 |
[${srcdir}/src/gen-features.sh ${ac_srcdir} ${ac_builddir} ${host}]) |
| 992 |
AC_OUTPUT |
| 993 |
|
| 994 |
dnl =========================================================== |
| 995 |
dnl Show some of the configuration results, for developer's |
| 996 |
dnl convenience. |
| 997 |
|
| 998 |
[OPTDBMS=`echo "$DBM_SCMFILES" | sed 's/\.sci//g'`] |
| 999 |
AS_IF([test "$ac_cv_use_zlib" = yes], [OPTZLIB=" zlib"], [OPTZLIB=" "]) |
| 1000 |
|
| 1001 |
AC_MSG_RESULT( |
| 1002 |
[ |
| 1003 |
This Gauche has been configured with the following parameters: |
| 1004 |
version: $GAUCHE_VERSION |
| 1005 |
documentation: $build_doc |
| 1006 |
slib: $SLIB_DIR |
| 1007 |
thread: $GAUCHE_THREAD_TYPE |
| 1008 |
tls/ssl: $GAUCHE_TLS_TYPES |
| 1009 |
CA store: $TLS_CA_TYPE $TLS_CA_PATH |
| 1010 |
optional modules: $OPTDBMS$OPTZLIB |
| 1011 |
]) |
| 1012 |
|
| 1013 |
AS_IF([test -z "$GAUCHE_TLS_TYPES" -a "$tls_explicitly_disabled" != yes], [ |
| 1014 |
AC_MSG_RESULT([ |
| 1015 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 1016 |
!!! No TLS support is configured. !!! |
| 1017 |
!!! You won't be able to do TLS communication, such as connecting to !!! |
| 1018 |
!!! websites with https. If this is not intended, check --with-tls !!! |
| 1019 |
!!! configure option (type ./configure --help for the details). !!! |
| 1020 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 1021 |
]) |
| 1022 |
]) |