| 1 |
# Configure script for libgm2. |
| 2 |
# Copyright (C) 2013-2024 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
# This file is part of GCC. |
| 5 |
|
| 6 |
# GCC is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 3, or (at your option) |
| 9 |
# any later version. |
| 10 |
|
| 11 |
# GCC is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
|
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with GCC; see the file COPYING3. If not see |
| 18 |
# <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
# Configure looks for the existence of this file to auto-config each language. |
| 21 |
# We define several parameters used by configure: |
| 22 |
|
| 23 |
# Process this file with autoreconf to produce a configure script. |
| 24 |
|
| 25 |
AC_INIT(package-unused, version-unused,,libgm2) |
| 26 |
AC_CONFIG_SRCDIR(Makefile.am) |
| 27 |
# AC_CONFIG_MACRO_DIR([config]) |
| 28 |
AC_CONFIG_HEADER(config.h) |
| 29 |
|
| 30 |
libtool_VERSION=20:0:0 |
| 31 |
AC_SUBST(libtool_VERSION) |
| 32 |
|
| 33 |
AM_ENABLE_MULTILIB(, ..) |
| 34 |
|
| 35 |
GCC_NO_EXECUTABLES |
| 36 |
|
| 37 |
AC_USE_SYSTEM_EXTENSIONS |
| 38 |
|
| 39 |
# Do not delete or change the following two lines. For why, see |
| 40 |
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html |
| 41 |
AC_CANONICAL_SYSTEM |
| 42 |
target_alias=${target_alias-$host_alias} |
| 43 |
AC_SUBST(target_alias) |
| 44 |
|
| 45 |
if test "$build" != "$host"; then |
| 46 |
# We are being configured with some form of cross compiler. |
| 47 |
GLIBCXX_IS_NATIVE=false |
| 48 |
case "$host","$target" in |
| 49 |
# Darwin crosses can use the host system's libraries and headers, |
| 50 |
# because of the fat library support. Of course, it must be the |
| 51 |
# same version of Darwin on both sides. Allow the user to |
| 52 |
# just say --target=foo-darwin without a version number to mean |
| 53 |
# "the version on this system". |
| 54 |
*-*-darwin*,*-*-darwin*) |
| 55 |
hostos=`echo $host | sed 's/.*-darwin/darwin/'` |
| 56 |
targetos=`echo $target | sed 's/.*-darwin/darwin/'` |
| 57 |
if test $hostos = $targetos || test $targetos = darwin ; then |
| 58 |
GLIBCXX_IS_NATIVE=true |
| 59 |
fi |
| 60 |
;; |
| 61 |
|
| 62 |
*) |
| 63 |
GCC_NO_EXECUTABLES |
| 64 |
;; |
| 65 |
esac |
| 66 |
else |
| 67 |
GLIBCXX_IS_NATIVE=true |
| 68 |
fi |
| 69 |
|
| 70 |
# Runs configure.host, and assorted other critical bits. Sets |
| 71 |
# up critical shell variables. |
| 72 |
GLIBCXX_CONFIGURE |
| 73 |
|
| 74 |
# For gettimeofday support. |
| 75 |
GLIBCXX_CHECK_GETTIMEOFDAY |
| 76 |
|
| 77 |
# For clock_gettime, nanosleep and sched_yield support. |
| 78 |
GLIBCXX_ENABLE_LIBSTDCXX_TIME |
| 79 |
|
| 80 |
AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability]) |
| 81 |
|
| 82 |
AH_TEMPLATE(PACKAGE, [Name of package]) |
| 83 |
AH_TEMPLATE(VERSION, [Version number of package]) |
| 84 |
|
| 85 |
AC_ARG_WITH(cross-host, |
| 86 |
[ --with-cross-host=HOST Configuring with a cross compiler]) |
| 87 |
|
| 88 |
# Checks for header files. |
| 89 |
AC_HEADER_STDC |
| 90 |
AC_HEADER_SYS_WAIT |
| 91 |
AC_HEADER_TIME |
| 92 |
|
| 93 |
AC_CHECK_HEADER([math.h], |
| 94 |
[AC_DEFINE([HAVE_MATH_H], [1], [have math.h])]) |
| 95 |
|
| 96 |
AC_CHECK_HEADERS(getopt.h limits.h stddef.h string.h strings.h \ |
| 97 |
stdlib.h time.h \ |
| 98 |
fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ |
| 99 |
sys/resource.h sys/param.h sys/times.h sys/stat.h \ |
| 100 |
sys/socket.h \ |
| 101 |
sys/wait.h sys/ioctl.h errno.h sys/errno.h \ |
| 102 |
pwd.h direct.h dirent.h signal.h malloc.h langinfo.h \ |
| 103 |
pthread.h stdarg.h stdio.h sys/types.h termios.h \ |
| 104 |
netinet/in.h netdb.h sys/uio.h sys/stat.h wchar.h) |
| 105 |
|
| 106 |
AC_STRUCT_TIMEZONE |
| 107 |
|
| 108 |
AC_CHECK_MEMBER([struct tm.tm_year], |
| 109 |
[AC_DEFINE(WE_HAVE_STRUCT_TM, [1], [struct tm was found])], |
| 110 |
[], [[#include <time.h>]]) |
| 111 |
AC_CHECK_MEMBER([struct tm.tm_year], |
| 112 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])], |
| 113 |
[], [[#include <time.h>]]) |
| 114 |
AC_CHECK_MEMBER([struct tm.tm_mon], |
| 115 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_MON, [1], [struct tm.tm_mon was found])], |
| 116 |
[], [[#include <time.h>]]) |
| 117 |
AC_CHECK_MEMBER([struct tm.tm_mday], |
| 118 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_MDAY, [1], [struct tm.tm_mday was found])], |
| 119 |
[], [[#include <time.h>]]) |
| 120 |
AC_CHECK_MEMBER([struct tm.tm_hour], |
| 121 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_HOUR, [1], [struct tm.tm_hour was found])], |
| 122 |
[], [[#include <time.h>]]) |
| 123 |
AC_CHECK_MEMBER([struct tm.tm_min], |
| 124 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_MIN, [1], [struct tm.tm_min was found])], |
| 125 |
[], [[#include <time.h>]]) |
| 126 |
AC_CHECK_MEMBER([struct tm.tm_sec], |
| 127 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_SEC, [1], [struct tm.tm_sec was found])], |
| 128 |
[], [[#include <time.h>]]) |
| 129 |
AC_CHECK_MEMBER([struct tm.tm_year], |
| 130 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])], |
| 131 |
[], [[#include <time.h>]]) |
| 132 |
AC_CHECK_MEMBER([struct tm.tm_yday], |
| 133 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_YDAY, [1], [struct tm.tm_yday was found])], |
| 134 |
[], [[#include <time.h>]]) |
| 135 |
AC_CHECK_MEMBER([struct tm.tm_wday], |
| 136 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_WDAY, [1], [struct tm.tm_wday was found])], |
| 137 |
[], [[#include <time.h>]]) |
| 138 |
AC_CHECK_MEMBER([struct tm.tm_isdst], |
| 139 |
[AC_DEFINE(WE_HAVE_STRUCT_TM_ISDST, [1], [struct tm.tm_isdst was found])], |
| 140 |
[], [[#include <time.h>]]) |
| 141 |
|
| 142 |
AC_CHECK_MEMBER([struct timeval.tv_sec], |
| 143 |
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL, [1], [struct timeval was found])]) |
| 144 |
AC_CHECK_MEMBER([struct timeval.tv_sec], |
| 145 |
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_SEC, [1], [struct timeval.tv_sec was found])]) |
| 146 |
AC_CHECK_MEMBER([struct timeval.tv_usec], |
| 147 |
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_USEC, [1], [struct timeval.tv_usec was found])]) |
| 148 |
|
| 149 |
AC_CANONICAL_HOST |
| 150 |
ACX_NONCANONICAL_HOST |
| 151 |
ACX_NONCANONICAL_TARGET |
| 152 |
GCC_TOPLEV_SUBDIRS |
| 153 |
|
| 154 |
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) |
| 155 |
AC_ARG_ENABLE(version-specific-runtime-libs, |
| 156 |
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], |
| 157 |
[case "$enableval" in |
| 158 |
yes) version_specific_libs=yes ;; |
| 159 |
no) version_specific_libs=no ;; |
| 160 |
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; |
| 161 |
esac], |
| 162 |
[version_specific_libs=no]) |
| 163 |
AC_MSG_RESULT($version_specific_libs) |
| 164 |
|
| 165 |
AC_ARG_WITH(slibdir, |
| 166 |
[ --with-slibdir=DIR shared libraries in DIR [LIBDIR]], |
| 167 |
slibdir="$with_slibdir", |
| 168 |
if test "${version_specific_libs}" = yes; then |
| 169 |
slibdir='$(libsubdir)' |
| 170 |
elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then |
| 171 |
slibdir='$(exec_prefix)/$(host_noncanonical)/lib' |
| 172 |
else |
| 173 |
slibdir='$(libdir)' |
| 174 |
fi) |
| 175 |
AC_SUBST(slibdir) |
| 176 |
|
| 177 |
# Command-line options. |
| 178 |
# Very limited version of AC_MAINTAINER_MODE. |
| 179 |
AC_ARG_ENABLE([maintainer-mode], |
| 180 |
[AC_HELP_STRING([--enable-maintainer-mode], |
| 181 |
[enable make rules and dependencies not useful (and |
| 182 |
sometimes confusing) to the casual installer])], |
| 183 |
[case ${enable_maintainer_mode} in |
| 184 |
yes) MAINT='' ;; |
| 185 |
no) MAINT='#' ;; |
| 186 |
*) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;; |
| 187 |
esac |
| 188 |
maintainer_mode=${enableval}], |
| 189 |
[MAINT='#']) |
| 190 |
AC_SUBST([MAINT])dnl |
| 191 |
|
| 192 |
toolexecdir=no |
| 193 |
toolexeclibdir=no |
| 194 |
|
| 195 |
# Calculate toolexeclibdir |
| 196 |
# Also toolexecdir, though it's only used in toolexeclibdir |
| 197 |
case ${version_specific_libs} in |
| 198 |
yes) |
| 199 |
# Need the gcc compiler version to know where to install libraries |
| 200 |
# and header files if --enable-version-specific-runtime-libs option |
| 201 |
# is selected. |
| 202 |
toolexecdir='$(libdir)/gcc/$(target_noncanonical)' |
| 203 |
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' |
| 204 |
;; |
| 205 |
no) |
| 206 |
if test -n "$with_cross_host" && |
| 207 |
test x"$with_cross_host" != x"no"; then |
| 208 |
# Install a library built with a cross compiler in tooldir, not libdir. |
| 209 |
toolexecdir='$(exec_prefix)/$(target_noncanonical)' |
| 210 |
toolexeclibdir='$(toolexecdir)/lib' |
| 211 |
else |
| 212 |
toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' |
| 213 |
toolexeclibdir='$(libdir)' |
| 214 |
fi |
| 215 |
multi_os_directory=`$CC -print-multi-os-directory` |
| 216 |
case $multi_os_directory in |
| 217 |
.) ;; # Avoid trailing /. |
| 218 |
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; |
| 219 |
esac |
| 220 |
;; |
| 221 |
esac |
| 222 |
|
| 223 |
AC_SUBST(toolexecdir) |
| 224 |
AC_SUBST(toolexeclibdir) |
| 225 |
|
| 226 |
AH_TEMPLATE(PACKAGE, [Name of package]) |
| 227 |
AH_TEMPLATE(VERSION, [Version number of package]) |
| 228 |
|
| 229 |
AM_MAINTAINER_MODE |
| 230 |
|
| 231 |
# Check the compiler. |
| 232 |
# The same as in boehm-gc and libstdc++. Have to borrow it from there. |
| 233 |
# We must force CC to /not/ be precious variables; otherwise |
| 234 |
# the wrong, non-multilib-adjusted value will be used in multilibs. |
| 235 |
# As a side effect, we have to subst CFLAGS ourselves. |
| 236 |
|
| 237 |
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) |
| 238 |
m4_define([_AC_ARG_VAR_PRECIOUS],[]) |
| 239 |
AC_PROG_CC |
| 240 |
AC_PROG_CXX |
| 241 |
AM_PROG_AS |
| 242 |
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
| 243 |
|
| 244 |
AC_SUBST(CFLAGS) |
| 245 |
|
| 246 |
# In order to override CFLAGS_FOR_TARGET, all of our special flags go |
| 247 |
# in XCFLAGS. But we need them in CFLAGS during configury. So put them |
| 248 |
# in both places for now and restore CFLAGS at the end of config. |
| 249 |
save_CFLAGS="$CFLAGS" |
| 250 |
|
| 251 |
# Find other programs we need. |
| 252 |
AC_CHECK_TOOL(AR, ar) |
| 253 |
AC_CHECK_TOOL(NM, nm) |
| 254 |
AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
| 255 |
AC_PROG_MAKE_SET |
| 256 |
AC_PROG_INSTALL |
| 257 |
|
| 258 |
AM_PROG_LIBTOOL |
| 259 |
LT_INIT |
| 260 |
AC_LIBTOOL_DLOPEN |
| 261 |
|
| 262 |
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) |
| 263 |
|
| 264 |
AC_SUBST(enable_shared) |
| 265 |
AC_SUBST(enable_static) |
| 266 |
|
| 267 |
if test "${multilib}" = "yes"; then |
| 268 |
multilib_arg="--enable-multilib" |
| 269 |
else |
| 270 |
multilib_arg= |
| 271 |
fi |
| 272 |
|
| 273 |
AC_CHECK_TYPES([struct timezone, struct stat, struct timespec, struct timeval, struct tm]) |
| 274 |
|
| 275 |
# Check if struct tm contains the tm_gmtoff field. |
| 276 |
AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff, |
| 277 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ |
| 278 |
#include <time.h> |
| 279 |
], [ |
| 280 |
struct tm tm; |
| 281 |
tm.tm_gmtoff = 1; |
| 282 |
])], |
| 283 |
[ac_cv_struct_tm_gmtoff=yes], |
| 284 |
[ac_cv_struct_tm_gmtoff=no] |
| 285 |
) |
| 286 |
) |
| 287 |
|
| 288 |
if (test "$ac_cv_struct_tm_gmtoff" = "yes"); then |
| 289 |
AC_MSG_CHECKING([m2 front end detects struct tm with the tm_gmtoff field.]) |
| 290 |
AC_DEFINE(HAVE_TM_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field.]) |
| 291 |
fi |
| 292 |
|
| 293 |
AC_LANG_C |
| 294 |
# Check the compiler. |
| 295 |
# The same as in boehm-gc and libstdc++. Have to borrow it from there. |
| 296 |
# We must force CC to /not/ be precious variables; otherwise |
| 297 |
# the wrong, non-multilib-adjusted value will be used in multilibs. |
| 298 |
# As a side effect, we have to subst CFLAGS ourselves. |
| 299 |
|
| 300 |
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) |
| 301 |
m4_define([_AC_ARG_VAR_PRECIOUS],[]) |
| 302 |
AC_PROG_CC |
| 303 |
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
| 304 |
|
| 305 |
AC_SUBST(CFLAGS) |
| 306 |
|
| 307 |
AC_DEFUN([GM2_UNDEF],[ |
| 308 |
$as_echo "#undef HAVE_$1" >>confdefs.h |
| 309 |
]) |
| 310 |
|
| 311 |
AC_DEFUN([GM2_CHECK_LIB],[ |
| 312 |
AC_MSG_CHECKING([m2 front end checking $1 library for $2]) |
| 313 |
if test x$gcc_no_link != xyes; then |
| 314 |
AC_CHECK_LIB([$1],[$2],[AC_DEFINE([HAVE_$3],[1],[found $2])],[GM2_UNDEF([$3],[$2])]) |
| 315 |
else |
| 316 |
if test "x$[ac_cv_lib_$1_$2]" = xyes; then |
| 317 |
AC_DEFINE([HAVE_$3],[1],[lib$1 includes $2]) |
| 318 |
elif test "x$[ac_cv_func_$2]" = xyes; then |
| 319 |
AC_DEFINE([HAVE_$3],[1],[function $2 exists]) |
| 320 |
else |
| 321 |
GM2_UNDEF([$3],[$2]) |
| 322 |
fi |
| 323 |
fi |
| 324 |
]) |
| 325 |
|
| 326 |
GM2_CHECK_LIB([c],[access],[ACCESS]) |
| 327 |
GM2_CHECK_LIB([c],[brk],[BRK]) |
| 328 |
GM2_CHECK_LIB([c],[cfmakeraw],[CFMAKERAW]) |
| 329 |
GM2_CHECK_LIB([c],[clock_gettime],[CLOCK_GETTIME]) |
| 330 |
GM2_CHECK_LIB([c],[clock_settime],[CLOCK_SETTIME]) |
| 331 |
GM2_CHECK_LIB([c],[close],[CLOSE]) |
| 332 |
GM2_CHECK_LIB([c],[ctime],[CTIME]) |
| 333 |
GM2_CHECK_LIB([c],[creat],[CREAT]) |
| 334 |
GM2_CHECK_LIB([c],[daylight],[DAYLIGHT]) |
| 335 |
GM2_CHECK_LIB([c],[dup],[DUP]) |
| 336 |
GM2_CHECK_LIB([c],[execve],[EXECVE]) |
| 337 |
GM2_CHECK_LIB([c],[exit],[EXIT]) |
| 338 |
GM2_CHECK_LIB([c],[fcntl],[FCNTL]) |
| 339 |
GM2_CHECK_LIB([c],[fstat],[FSTAT]) |
| 340 |
GM2_CHECK_LIB([c],[getdents],[GETDENTS]) |
| 341 |
GM2_CHECK_LIB([c],[getgid],[GETGID]) |
| 342 |
GM2_CHECK_LIB([c],[getopt_long],[GETOPT_LONG]) |
| 343 |
GM2_CHECK_LIB([c],[getopt_long_only],[GETOPT_LONG_ONLY]) |
| 344 |
GM2_CHECK_LIB([c],[getpid],[GETPID]) |
| 345 |
GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFDAY]) |
| 346 |
GM2_CHECK_LIB([c],[getuid],[GETUID]) |
| 347 |
GM2_CHECK_LIB([c],[ioctl],[IOCTL]) |
| 348 |
GM2_CHECK_LIB([c],[kill],[KILL]) |
| 349 |
GM2_CHECK_LIB([c],[link],[LINK]) |
| 350 |
GM2_CHECK_LIB([c],[lseek],[LSEEK]) |
| 351 |
GM2_CHECK_LIB([c],[open],[OPEN]) |
| 352 |
GM2_CHECK_LIB([c],[pause],[PAUSE]) |
| 353 |
GM2_CHECK_LIB([c],[pipe],[PIPE]) |
| 354 |
GM2_CHECK_LIB([c],[rand],[RAND]) |
| 355 |
GM2_CHECK_LIB([c],[read],[READ]) |
| 356 |
GM2_CHECK_LIB([c],[select],[SELECT]) |
| 357 |
GM2_CHECK_LIB([c],[setitimer],[SETITIMER]) |
| 358 |
GM2_CHECK_LIB([c],[setgid],[SETGID]) |
| 359 |
GM2_CHECK_LIB([c],[settimeofday],[SETTIMEOFDAY]) |
| 360 |
GM2_CHECK_LIB([c],[setuid],[SETUID]) |
| 361 |
GM2_CHECK_LIB([c],[stat],[STAT]) |
| 362 |
GM2_CHECK_LIB([c],[strsignal],[STRSIGNAL]) |
| 363 |
GM2_CHECK_LIB([c],[strtod],[STRTOD]) |
| 364 |
GM2_CHECK_LIB([c],[strtold],[STRTOLD]) |
| 365 |
GM2_CHECK_LIB([c],[times],[TIMES]) |
| 366 |
GM2_CHECK_LIB([c],[timezone],[TIMEZONE]) |
| 367 |
GM2_CHECK_LIB([c],[tzname],[TZNAME]) |
| 368 |
GM2_CHECK_LIB([c],[unlink],[UNLINK]) |
| 369 |
GM2_CHECK_LIB([c],[wait],[WAIT]) |
| 370 |
GM2_CHECK_LIB([c],[write],[WRITE]) |
| 371 |
|
| 372 |
GM2_CHECK_LIB([m],[exp10],[EXP10]) |
| 373 |
GM2_CHECK_LIB([m],[exp10f],[EXP10F]) |
| 374 |
GM2_CHECK_LIB([m],[exp10l],[EXP10L]) |
| 375 |
GM2_CHECK_LIB([m],[signbit],[SIGNBIT]) |
| 376 |
GM2_CHECK_LIB([m],[signbitf],[SIGNBITF]) |
| 377 |
GM2_CHECK_LIB([m],[signbitl],[SIGNBITL]) |
| 378 |
|
| 379 |
AC_CHECK_DECLS([getenv]) |
| 380 |
|
| 381 |
AC_MSG_NOTICE([libgm2 has finished checking target libc and libm contents.]) |
| 382 |
|
| 383 |
# We test the host here and later on check the target. |
| 384 |
|
| 385 |
# All known M2_HOST_OS values. This is the union of all host operating systems |
| 386 |
# supported by gm2. |
| 387 |
|
| 388 |
M2_SUPPORTED_HOST_OS="aix freebsd hurd linux netbsd openbsd solaris windows darwin" |
| 389 |
|
| 390 |
M2_HOST_OS=unknown |
| 391 |
|
| 392 |
case ${host} in |
| 393 |
*-*-darwin*) M2_HOST_OS=darwin ;; |
| 394 |
*-*-freebsd*) M2_HOST_OS=freebsd ;; |
| 395 |
*-*-linux*) M2_HOST_OS=linux ;; |
| 396 |
*-*-netbsd*) M2_HOST_OS=netbsd ;; |
| 397 |
*-*-openbsd*) M2_HOST_OS=openbsd ;; |
| 398 |
*-*-solaris2*) M2_HOST_OS=solaris ;; |
| 399 |
*-*-aix*) M2_HOST_OS=aix ;; |
| 400 |
*-*-gnu*) M2_HOST_OS=hurd ;; |
| 401 |
esac |
| 402 |
|
| 403 |
M2_TARGET_OS=unknown |
| 404 |
|
| 405 |
case ${target} in |
| 406 |
*-*-darwin*) M2_TARGET_OS=darwin ;; |
| 407 |
*-*-freebsd*) M2_TARGET_OS=freebsd ;; |
| 408 |
*-*-linux*) M2_TARGET_OS=linux ;; |
| 409 |
*-*-netbsd*) M2_TARGET_OS=netbsd ;; |
| 410 |
*-*-openbsd*) M2_TARGET_OS=openbsd ;; |
| 411 |
*-*-solaris2*) M2_TARGET_OS=solaris ;; |
| 412 |
*-*-aix*) M2_TARGET_OS=aix ;; |
| 413 |
*-*-gnu*) M2_TARGET_OS=hurd ;; |
| 414 |
esac |
| 415 |
|
| 416 |
# M2_HOST_OS=unknown |
| 417 |
if test x${M2_HOST_OS} = xunknown; then |
| 418 |
AC_MSG_NOTICE([unsupported host, will build a minimal m2 library]) |
| 419 |
BUILD_PIMLIB=false |
| 420 |
BUILD_ISOLIB=false |
| 421 |
BUILD_CORLIB=false |
| 422 |
BUILD_LOGLIB=false |
| 423 |
else |
| 424 |
AC_MSG_NOTICE([m2 library will be built on ${M2_HOST_OS}]) |
| 425 |
BUILD_PIMLIB=true |
| 426 |
BUILD_ISOLIB=true |
| 427 |
BUILD_CORLIB=true |
| 428 |
BUILD_LOGLIB=true |
| 429 |
fi |
| 430 |
|
| 431 |
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} |
| 432 |
AC_SUBST(CC_FOR_BUILD) |
| 433 |
|
| 434 |
# Propagate GM2_FOR_TARGET into Makefiles |
| 435 |
GM2_FOR_TARGET=${GM2_FOR_TARGET:-gcc} |
| 436 |
AC_SUBST(GM2_FOR_TARGET) |
| 437 |
|
| 438 |
# Now we check the target as long as it is a supported host. |
| 439 |
# For some embedded targets we choose minimal runtime system which is |
| 440 |
# just enough to satisfy the linker targetting raw metal. |
| 441 |
if test x${M2_HOST_OS} != xunknown; then |
| 442 |
AC_MSG_NOTICE([m2 library building for target ${target}]) |
| 443 |
case "$target" in |
| 444 |
|
| 445 |
avr25*-*-* | avr31*-*-* | avr35*-*-* | avr4*-*-* | avr5*-*-* | avr51*-*-* | avr6*-*-*) |
| 446 |
BUILD_PIMLIB=false |
| 447 |
BUILD_ISOLIB=false |
| 448 |
BUILD_CORLIB=false |
| 449 |
BUILD_LOGLIB=false |
| 450 |
;; |
| 451 |
|
| 452 |
avrxmega2*-*-* | avrxmega4*-*-* | avrxmega5*-*-* | avrxmega6*-*-* | avrxmega7*-*-*) |
| 453 |
BUILD_PIMLIB=false |
| 454 |
BUILD_ISOLIB=false |
| 455 |
BUILD_CORLIB=false |
| 456 |
BUILD_LOGLIB=false |
| 457 |
;; |
| 458 |
|
| 459 |
avr3-*-*) |
| 460 |
BUILD_PIMLIB=true |
| 461 |
BUILD_ISOLIB=true |
| 462 |
BUILD_CORLIB=true |
| 463 |
BUILD_LOGLIB=true |
| 464 |
;; |
| 465 |
esp32-*-*) |
| 466 |
BUILD_PIMLIB=false |
| 467 |
BUILD_ISOLIB=false |
| 468 |
BUILD_CORLIB=false |
| 469 |
BUILD_LOGLIB=false |
| 470 |
;; |
| 471 |
|
| 472 |
esac |
| 473 |
fi |
| 474 |
|
| 475 |
# GM2_MSG_RESULT issue a query message from the first parameter and a boolean result |
| 476 |
# in the second parameter is printed as a "yes" or "no". |
| 477 |
|
| 478 |
AC_DEFUN([GM2_MSG_RESULT],[ |
| 479 |
AC_MSG_CHECKING([$1]) |
| 480 |
if test x${$2} = xtrue; then |
| 481 |
AC_MSG_RESULT([yes]) |
| 482 |
else |
| 483 |
AC_MSG_RESULT([no]) |
| 484 |
fi |
| 485 |
]) |
| 486 |
|
| 487 |
if test x${M2_HOST_OS} = xunknown; then |
| 488 |
AC_MSG_NOTICE([m2 front end will only build minimal Modula-2 runtime library on this host]) |
| 489 |
else |
| 490 |
GM2_MSG_RESULT([m2 front end will build PIM libraries:],[BUILD_PIMLIB]) |
| 491 |
GM2_MSG_RESULT([m2 front end will build ISO libraries:],[BUILD_ISOLIB]) |
| 492 |
GM2_MSG_RESULT([m2 front end will build coroutine libraries:],[BUILD_CORLIB]) |
| 493 |
GM2_MSG_RESULT([m2 front end will build Logitech compatability libraries:],[BUILD_LOGLIB]) |
| 494 |
fi |
| 495 |
|
| 496 |
AM_CONDITIONAL([BUILD_PIMLIB], [test x$BUILD_PIMLIB = xtrue]) |
| 497 |
AM_CONDITIONAL([BUILD_ISOLIB], [test x$BUILD_ISOLIB = xtrue]) |
| 498 |
AM_CONDITIONAL([BUILD_CORLIB], [test x$BUILD_CORLIB = xtrue]) |
| 499 |
AM_CONDITIONAL([BUILD_LOGLIB], [test x$BUILD_LOGLIB = xtrue]) |
| 500 |
AM_CONDITIONAL([TARGET_DARWIN], [test x$M2_TARGET_OS = xdarwin]) |
| 501 |
|
| 502 |
# Determine what GCC version number to use in filesystem paths. |
| 503 |
GCC_BASE_VER |
| 504 |
|
| 505 |
AC_CONFIG_SRCDIR([Makefile.am]) |
| 506 |
AC_CONFIG_FILES([Makefile]) |
| 507 |
|
| 508 |
AC_CONFIG_FILES(AC_FOREACH([DIR], [libm2min libm2pim libm2iso libm2cor libm2log], [DIR/Makefile ]), |
| 509 |
[ cat > vpsed$$ << \_EOF |
| 510 |
s!`test -f '$<' || echo '$(srcdir)/'`!! |
| 511 |
_EOF |
| 512 |
sed -f vpsed$$ $ac_file > tmp$$ |
| 513 |
mv tmp$$ $ac_file |
| 514 |
rm vpsed$$ |
| 515 |
echo 'MULTISUBDIR =' >> $ac_file |
| 516 |
ml_norecursion=yes |
| 517 |
. ${multi_basedir}/config-ml.in |
| 518 |
AS_UNSET([ml_norecursion]) |
| 519 |
]) |
| 520 |
|
| 521 |
AC_MSG_NOTICE([libgm2 has been configured.]) |
| 522 |
|
| 523 |
AC_OUTPUT |