| 1 |
# Configure script for libgcobol. |
| 2 |
# Adapted by James K. Lowden from configure script for libalg68. |
| 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,,libgcobol) |
| 26 |
AC_CONFIG_SRCDIR(Makefile.am) |
| 27 |
AC_CONFIG_HEADER(config.h) |
| 28 |
|
| 29 |
# Do not delete or change the following two lines. For why, see |
| 30 |
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html |
| 31 |
AC_CANONICAL_SYSTEM |
| 32 |
ACX_NONCANONICAL_TARGET |
| 33 |
|
| 34 |
AM_ENABLE_MULTILIB(, ..) |
| 35 |
|
| 36 |
target_alias=${target_alias-$host_alias} |
| 37 |
AC_SUBST(target_alias) |
| 38 |
|
| 39 |
AM_MAINTAINER_MODE |
| 40 |
|
| 41 |
AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability]) |
| 42 |
|
| 43 |
AC_MSG_CHECKING([for --enable-libgcobol]) |
| 44 |
AC_ARG_ENABLE(libgcobol, |
| 45 |
[AS_HELP_STRING([--enable-libgcobol], [Enable libgcobol])]) |
| 46 |
AC_MSG_RESULT($enable_libgcobol) |
| 47 |
|
| 48 |
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) |
| 49 |
AC_ARG_ENABLE(version-specific-runtime-libs, |
| 50 |
AS_HELP_STRING([--enable-version-specific-runtime-libs], |
| 51 |
[Specify that runtime libraries should be installed in a compiler-specific directory]), |
| 52 |
[case "$enableval" in |
| 53 |
yes) version_specific_libs=yes ;; |
| 54 |
no) version_specific_libs=no ;; |
| 55 |
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; |
| 56 |
esac], |
| 57 |
[version_specific_libs=no]) |
| 58 |
AC_MSG_RESULT($version_specific_libs) |
| 59 |
|
| 60 |
# This works around the fact that libtool configuration may change LD |
| 61 |
# for this particular configuration, but some shells, instead of |
| 62 |
# keeping the changes in LD private, export them just because LD is |
| 63 |
# exported. |
| 64 |
ORIGINAL_LD_FOR_MULTILIBS=$LD |
| 65 |
|
| 66 |
GCC_NO_EXECUTABLES |
| 67 |
|
| 68 |
AC_USE_SYSTEM_EXTENSIONS |
| 69 |
|
| 70 |
# Find other programs we need. |
| 71 |
AC_CHECK_TOOL(AR, ar) |
| 72 |
AC_CHECK_TOOL(NM, nm) |
| 73 |
AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
| 74 |
AC_PROG_MAKE_SET |
| 75 |
AC_PROG_INSTALL |
| 76 |
|
| 77 |
AM_PROG_LIBTOOL |
| 78 |
LT_INIT |
| 79 |
|
| 80 |
AC_LIBTOOL_DLOPEN |
| 81 |
LT_LIB_M |
| 82 |
|
| 83 |
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) |
| 84 |
|
| 85 |
AC_SUBST(enable_shared) |
| 86 |
AC_SUBST(enable_static) |
| 87 |
|
| 88 |
# This library is written in C++ and needs to link with the C++ runtime. |
| 89 |
AC_LANG([C++]) |
| 90 |
|
| 91 |
# We must force CC/CXX to /not/ be precious variables; otherwise |
| 92 |
# the wrong, non-multilib-adjusted value will be used in multilibs. |
| 93 |
# As a side effect, we have to subst CFLAGS ourselves. |
| 94 |
|
| 95 |
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) |
| 96 |
m4_define([_AC_ARG_VAR_PRECIOUS],[]) |
| 97 |
AC_PROG_CXX |
| 98 |
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
| 99 |
|
| 100 |
AC_SUBST(CXXFLAGS) |
| 101 |
|
| 102 |
GCC_WITH_TOOLEXECLIBDIR |
| 103 |
|
| 104 |
# Calculate toolexeclibdir |
| 105 |
# Also toolexecdir, though it's only used in toolexeclibdir |
| 106 |
case ${version_specific_libs} in |
| 107 |
yes) |
| 108 |
# Need the gcc compiler version to know where to install libraries |
| 109 |
# and header files if --enable-version-specific-runtime-libs option |
| 110 |
# is selected. |
| 111 |
toolexecdir='$(libdir)/gcc/$(target_noncanonical)' |
| 112 |
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' |
| 113 |
;; |
| 114 |
no) |
| 115 |
if test -n "$with_cross_host" && |
| 116 |
test x"$with_cross_host" != x"no"; then |
| 117 |
# Install a library built with a cross compiler in tooldir, not libdir. |
| 118 |
toolexecdir='$(exec_prefix)/$(target_noncanonical)' |
| 119 |
toolexeclibdir='$(toolexecdir)/lib' |
| 120 |
else |
| 121 |
toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' |
| 122 |
toolexeclibdir='$(libdir)' |
| 123 |
fi |
| 124 |
multi_os_directory=`$CC -print-multi-os-directory` |
| 125 |
case $multi_os_directory in |
| 126 |
.) ;; # Avoid trailing /. |
| 127 |
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; |
| 128 |
esac |
| 129 |
;; |
| 130 |
esac |
| 131 |
AC_SUBST(toolexecdir) |
| 132 |
AC_SUBST(toolexeclibdir) |
| 133 |
|
| 134 |
# For iconv support. |
| 135 |
AM_ICONV |
| 136 |
|
| 137 |
# Checks for header files. |
| 138 |
AC_CHECK_HEADERS(malloc.h) |
| 139 |
|
| 140 |
AC_CHECK_SIZEOF([void *]) |
| 141 |
|
| 142 |
# Get target configury. |
| 143 |
unset LIBGCOBOL_SUPPORTED |
| 144 |
. ${srcdir}/configure.tgt |
| 145 |
|
| 146 |
# Decide if it's usable. |
| 147 |
case $LIBGCOBOL_SUPPORTED:$enable_libgcobol in |
| 148 |
*:no) use_libgcobol=no ;; |
| 149 |
*:yes) use_libgcobol=yes ;; |
| 150 |
yes:*) use_libgcobol=yes ;; |
| 151 |
*:*) use_libgcobol=no ;; |
| 152 |
esac |
| 153 |
|
| 154 |
# ----------------- |
| 155 |
# __int128 support |
| 156 |
# ----------------- |
| 157 |
|
| 158 |
AC_CACHE_CHECK([whether __int128 is supported], [libgcobol_cv_have_int128], |
| 159 |
[GCC_TRY_COMPILE_OR_LINK([ |
| 160 |
__int128 foo (__int128 ) |
| 161 |
{ |
| 162 |
__int128 aaa; |
| 163 |
return (__int128) aaa; |
| 164 |
} |
| 165 |
|
| 166 |
__int128 bar (__int128 ) |
| 167 |
{ |
| 168 |
__int128 aaa; |
| 169 |
return (__int128) aaa; |
| 170 |
} |
| 171 |
],[ |
| 172 |
foo (1); |
| 173 |
bar (1); |
| 174 |
],[ |
| 175 |
libgcobol_cv_have_int128=yes |
| 176 |
],[ |
| 177 |
libgcobol_cv_have_int128=no |
| 178 |
])]) |
| 179 |
|
| 180 |
AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$use_libgcobol" = xyes && test "x$libgcobol_cv_have_int128" = xyes]) |
| 181 |
|
| 182 |
# Check if functions are available in libc before adding extra libs. |
| 183 |
AC_SEARCH_LIBS([malloc], [c]) |
| 184 |
AC_SEARCH_LIBS([clock_gettime], [c rt]) |
| 185 |
|
| 186 |
# libgcobol soname version |
| 187 |
LIBGCOBOL_VERSION=1:0:0 |
| 188 |
AC_SUBST(LIBGCOBOL_VERSION) |
| 189 |
|
| 190 |
## added, currently unused. |
| 191 |
# VERSION_SUFFIX=$(echo $LIBGCOBOL_VERSION | tr ':' '.' ) |
| 192 |
# AC_SUBST(VERSION_SUFFIX) |
| 193 |
## end added |
| 194 |
|
| 195 |
extra_ldflags_libgcobol= |
| 196 |
case $host in |
| 197 |
*-*-darwin*) |
| 198 |
extra_ldflags_libgcobol=-Wl,-U,___cobol_main ;; |
| 199 |
*) ;; |
| 200 |
esac |
| 201 |
AC_SUBST(extra_ldflags_libgcobol) |
| 202 |
|
| 203 |
AC_CHECK_HEADERS_ONCE(floatingpoint.h ieeefp.h fenv.h fptrap.h \ |
| 204 |
complex.h stdlib.h errno.h) |
| 205 |
|
| 206 |
# Look for a way to represent the program name |
| 207 |
# First, check the GLIBC case |
| 208 |
AC_CHECK_DECLS([program_invocation_short_name], , ,[ |
| 209 |
#if HAVE_ERRNO_H |
| 210 |
# define _GNU_SOURCE |
| 211 |
# include <errno.h> |
| 212 |
#endif |
| 213 |
]) |
| 214 |
|
| 215 |
# Check an alternate |
| 216 |
AC_CHECK_FUNCS_ONCE(getprogname) |
| 217 |
|
| 218 |
# These are GLIBC |
| 219 |
AC_CHECK_FUNCS_ONCE(random_r srandom_r initstate_r setstate_r) |
| 220 |
|
| 221 |
# Some functions we check to figure out if the libc Float128 support |
| 222 |
# is adequate. |
| 223 |
|
| 224 |
# These are C23. |
| 225 |
AC_CHECK_FUNCS_ONCE(strfromf32 strfromf64) |
| 226 |
|
| 227 |
# These are GLIBC. |
| 228 |
AC_CHECK_FUNCS_ONCE(strtof128 strfromf128) |
| 229 |
# We need to make sure to check libc before adding libm. |
| 230 |
libgcobol_have_sinf128=no |
| 231 |
AC_SEARCH_LIBS([sinf128], [c m], libgcobol_have_sinf128=yes) |
| 232 |
libgcobol_have_cacosf128=no |
| 233 |
AC_SEARCH_LIBS([cacosf128], [c m], libgcobol_have_cacosf128=yes) |
| 234 |
|
| 235 |
# Copied from gcc/configure.ac. 2025-06-05 R.J.Dubner |
| 236 |
# At least for glibc, clock_gettime is in librt. But don't pull that |
| 237 |
# in if it still doesn't give us the function we want. |
| 238 |
ac_cv_func_clock_gettime=no |
| 239 |
if test $ac_cv_func_clock_gettime = no; then |
| 240 |
AC_CHECK_LIB(rt, clock_gettime, |
| 241 |
[LIBS="-lrt $LIBS" |
| 242 |
AC_DEFINE(HAVE_CLOCK_GETTIME, 1, |
| 243 |
[Define to 1 if you have the `clock_gettime' function.])]) |
| 244 |
fi |
| 245 |
|
| 246 |
have_iec_60559_libc_support=no |
| 247 |
if test "x$ac_cv_func_strtof128$ac_cv_func_strfromf128" = xyesyes \ |
| 248 |
&& test "x$libgcobol_have_sinf128$libgcobol_have_cacosf128" = xyesyes; then |
| 249 |
have_iec_60559_libc_support=yes |
| 250 |
fi |
| 251 |
|
| 252 |
# Check whether libquadmath should be used |
| 253 |
AC_ARG_ENABLE(libquadmath, |
| 254 |
AS_HELP_STRING([--disable-libquadmath], |
| 255 |
[disable libquadmath support for libgcobol]), |
| 256 |
ENABLE_LIBQUADMATH_SUPPORT=$enableval, |
| 257 |
if test "x$have_iec_60559_libc_support" = xyes; then |
| 258 |
ENABLE_LIBQUADMATH_SUPPORT=default |
| 259 |
else |
| 260 |
ENABLE_LIBQUADMATH_SUPPORT=yes |
| 261 |
fi) |
| 262 |
enable_libquadmath_support= |
| 263 |
if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then |
| 264 |
enable_libquadmath_support=no |
| 265 |
elif test "${ENABLE_LIBQUADMATH_SUPPORT}" = "default" ; then |
| 266 |
enable_libquadmath_support=default |
| 267 |
fi |
| 268 |
LIBGCOBOL_CHECK_FLOAT128 |
| 269 |
|
| 270 |
# struct tm tm_zone is a POSIX.1-2024 addition. |
| 271 |
AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <time.h>]) |
| 272 |
|
| 273 |
if test "${multilib}" = "yes"; then |
| 274 |
multilib_arg="--enable-multilib" |
| 275 |
else |
| 276 |
multilib_arg= |
| 277 |
fi |
| 278 |
|
| 279 |
# Determine what GCC version number to use in filesystem paths. |
| 280 |
GCC_BASE_VER |
| 281 |
|
| 282 |
# Add dependencies for libgcobol.spec file, this might be excessive - since |
| 283 |
# the spec file might not use all of them. |
| 284 |
SPEC_LIBGCOBOL_DEPS="$LIBS" |
| 285 |
AC_SUBST(SPEC_LIBGCOBOL_DEPS) |
| 286 |
|
| 287 |
AC_CONFIG_FILES([ |
| 288 |
Makefile |
| 289 |
libgcobol.spec |
| 290 |
]) |
| 291 |
|
| 292 |
AC_MSG_NOTICE([libgcobol has been configured.]) |
| 293 |
|
| 294 |
AC_OUTPUT |