1# Process this file with autoconf to produce a configure script. 2# Copyright (C) 2006-2022 Free Software Foundation, Inc. 3# 4# GCC is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3, or (at your option) 7# any later version. 8# 9# GCC is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with GCC; see the file COPYING3. If not see 16# <http://www.gnu.org/licenses/>. 17 18# This requires that you have your environment set-up to use explicit 19# versions of automake and autoconf. 20# 21# export ACLOCAL=/usr/bin/aclocal-1.15 22# export AUTOMAKE=/usr/bin/automake-1.15 23# export AUTOM4TE=/usr/bin/autom4te2.69 24# export AUTOCONF=/usr/bin/autoconf2.69 25# 26# autoreconf2.69 27# 28 29AC_INIT(package-unused, version-unused,, libphobos) 30AC_CONFIG_SRCDIR(libdruntime/gcc/attribute.d) 31AC_CONFIG_HEADERS(config.h) 32 33AM_ENABLE_MULTILIB(, ..) 34AC_CANONICAL_SYSTEM 35AC_USE_SYSTEM_EXTENSIONS 36 37target_alias=${target_alias-$target} 38AC_SUBST(target_alias) 39 40# 1.11.1: Require that version of automake. 41# foreign: Don't require README, INSTALL, NEWS, etc. 42# no-define: Don't define PACKAGE and VERSION. 43# no-dependencies: Don't generate automatic dependencies. 44# (because it breaks when using bootstrap-lean, since some of the 45# headers are gone at "make install" time). 46# subdir-objects: Build objects in sub-directories. 47# -Wall: Issue all automake warnings. 48# -Wno-portability: Don't warn about constructs supported by GNU make. 49# (because GCC requires GNU make anyhow). 50# -Wno-override: Overrides used in testsuite. 51AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies subdir-objects -Wall -Wno-portability -Wno-override]) 52 53m4_rename([_AC_ARG_VAR_PRECIOUS],[glibd_PRECIOUS]) 54m4_define([_AC_ARG_VAR_PRECIOUS],[]) 55AM_PROG_AS 56AC_PROG_CC 57AC_PROG_GDC 58WITH_LOCAL_DRUNTIME([GDC_CHECK_COMPILE], []) 59 60m4_rename_force([glibd_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 61 62AC_SUBST(CFLAGS) 63AM_MAINTAINER_MODE 64AC_PROG_RANLIB 65AC_PROG_INSTALL 66AC_PROG_MAKE_SET 67 68# Add CET specific flags if CET is enabled 69GCC_CET_FLAGS(CET_FLAGS) 70AC_SUBST(CET_FLAGS) 71# To ensure that runtime code for CET is compiled in, add in D version flags. 72AS_IF([test x$enable_cet = xyes], [ 73 CET_DFLAGS="$CET_FLAGS -fversion=CET" 74 DCFG_ENABLE_CET=true 75], [ 76 CET_DFLAGS= 77 DCFG_ENABLE_CET=false 78]) 79AC_SUBST(CET_DFLAGS) 80AC_SUBST(DCFG_ENABLE_CET) 81 82# This should be inherited in the recursive make, but ensure it is defined. 83test "$AR" || AR=ar 84AC_SUBST(AR) 85 86CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} 87AC_SUBST(CC_FOR_BUILD) 88AC_SUBST(CFLAGS_FOR_BUILD) 89 90# Enable libtool 91LT_INIT(dlopen) 92AM_PROG_LIBTOOL 93WITH_LOCAL_DRUNTIME([LT_LANG([D])], []) 94AC_SUBST(enable_shared) 95AC_SUBST(enable_static) 96 97# libtool variables for Phobos shared and position-independent compiles. 98# 99# Use phobos_lt_pic_flag to designate the automake variable 100# used to encapsulate the default libtool approach to creating objects 101# with position-independent code. Default: -prefer-pic. 102# 103# Use phobos_compiler_shared_flag to designate the compile-time flags for 104# creating shared objects. Default: -fversion=Shared. 105# 106# Use phobos_compiler_pic_flag to designate the compile-time flags for 107# creating position-independent objects. This varies with the target 108# hardware and operating system, but is often: -fPIC. 109# 110# The distinction between pic and shared compilation flags is not present in 111# libtool, and so we make it here. How it is handled is that in shared 112# compilations the `lt_prog_compiler_pic_D' variable is used to instead 113# ensure that conditional compilation of shared runtime code is compiled in. 114if test "$enable_shared" = yes; then 115 phobos_lt_pic_flag="-prefer-pic" 116 phobos_compiler_pic_flag="$lt_prog_compiler_pic_D" 117 phobos_compiler_shared_flag="-fversion=Shared" 118else 119 phobos_lt_pic_flag= 120 phobos_compiler_pic_flag= 121 phobos_compiler_shared_flag= 122fi 123AC_SUBST(phobos_lt_pic_flag) 124AC_SUBST(phobos_compiler_pic_flag) 125AC_SUBST(phobos_compiler_shared_flag) 126 127# Override the libtool's pic_flag and pic_mode. 128# Do this step after AM_PROG_LIBTOOL, but before AC_OUTPUT. 129# NB: this impacts --with-pic and --without-pic. 130lt_prog_compiler_pic_D="$phobos_compiler_pic_flag $phobos_compiler_shared_flag" 131pic_mode='default' 132 133# Determine what GCC version number to use in filesystem paths. 134GCC_BASE_VER 135 136# libphobos/libdruntime specific options and feature detection 137DRUNTIME_CONFIGURE 138DRUNTIME_MULTILIB 139DRUNTIME_WERROR 140DRUNTIME_SECTION_FLAGS 141DRUNTIME_CPU_SOURCES 142DRUNTIME_OS_SOURCES 143DRUNTIME_OS_THREAD_MODEL 144DRUNTIME_OS_ARM_EABI_UNWINDER 145DRUNTIME_OS_MINFO_BRACKETING 146DRUNTIME_OS_DLPI_TLS_MODID 147DRUNTIME_OS_LINK_SPEC 148DRUNTIME_LIBRARIES_CLIB 149 150WITH_LOCAL_DRUNTIME([ 151 AC_LANG_PUSH([D]) 152 AC_SEARCH_LIBS([malloc], [c]) 153 AC_SEARCH_LIBS([pthread_create], [pthread]) 154 AC_SEARCH_LIBS([cosf], [m]) 155 AC_SEARCH_LIBS([clock_gettime], [rt]) 156 DRUNTIME_ENABLE_ATOMIC_BUILTINS 157 AC_LANG_POP([D]) 158], [-nophoboslib]) 159 160DRUNTIME_LIBRARIES_ATOMIC 161DRUNTIME_LIBRARIES_BACKTRACE 162DRUNTIME_LIBRARIES_DLOPEN 163DRUNTIME_LIBRARIES_NET 164DRUNTIME_LIBRARIES_UCONTEXT 165DRUNTIME_LIBRARIES_ZLIB 166DRUNTIME_INSTALL_DIRECTORIES 167 168AC_MSG_CHECKING([for --enable-libphobos]) 169AC_ARG_ENABLE(libphobos, 170 [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])]) 171AC_MSG_RESULT($enable_libphobos) 172 173AC_MSG_CHECKING([for --with-libphobos-druntime-only]) 174AC_ARG_WITH(libphobos-druntime-only, 175 AS_HELP_STRING([--with-libphobos-druntime-only={yes,no,auto}], 176 [build only the druntime library (default: auto)]),, 177 [with_libphobos_druntime_only=auto]) 178AC_MSG_RESULT($with_libphobos_druntime_only) 179 180case "$with_libphobos_druntime_only" in 181 yes|no|auto) ;; 182 *) AC_MSG_ERROR([Invalid argument for --with-libphobos-druntime-only]) ;; 183esac 184 185# See if supported. 186unset LIBPHOBOS_SUPPORTED 187unset LIBDRUNTIME_ONLY 188AC_MSG_CHECKING([for host support for libphobos]) 189. ${srcdir}/configure.tgt 190case ${host} in 191 x86_64-*-solaris2.* | i?86-*-solaris2.*) 192 # 64-bit D execution fails with Solaris ld without -z relax=transtls support. 193 if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then 194 LIBPHOBOS_SUPPORTED=no 195 fi 196 ;; 197esac 198AC_MSG_RESULT($LIBPHOBOS_SUPPORTED) 199 200# Decide if it's usable. 201case $LIBPHOBOS_SUPPORTED:$enable_libphobos in 202*:no) use_libphobos=no ;; 203*:yes) use_libphobos=yes ;; 204yes:*) use_libphobos=yes ;; 205*:*) use_libphobos=no ;; 206esac 207AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes) 208 209# Decide if only libdruntime should be built. 210case $LIBDRUNTIME_ONLY:$with_libphobos_druntime_only in 211*:no) only_libdruntime=no ;; 212*:yes) only_libdruntime=yes ;; 213yes:*) only_libdruntime=yes ;; 214*:*) only_libdruntime=no ;; 215esac 216AM_CONDITIONAL(ENABLE_LIBDRUNTIME_ONLY, test x$only_libdruntime = xyes) 217 218# Enable expensive internal checks 219AC_ARG_ENABLE(libphobos-checking, 220[AS_HELP_STRING([[--enable-libphobos-checking[=LIST]]], 221 [enable expensive run-time checks. With LIST, 222 enable only specific categories of checks. 223 Categories are: yes,no,all,none,release. 224 Flags are: assert or other strings])], 225[ac_checking_flags="${enableval}"],[ac_checking_flags=release]) 226IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," 227for check in release $ac_checking_flags 228do 229 case $check in 230 # These set all the flags to specific states 231 yes|all) RELEASE_FLAG="-fno-release" ; ASSERT_FLAG= ;; 232 no|none|release) RELEASE_FLAG="-frelease" ; ASSERT_FLAG= ;; 233 # These enable particular checks 234 assert) ASSERT_FLAG="-fassert" ;; 235 # Accept 236 *) ;; 237 esac 238done 239IFS="$ac_save_IFS" 240CHECKING_DFLAGS="$RELEASE_FLAG $ASSERT_FLAG" 241AC_SUBST(CHECKING_DFLAGS) 242 243# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec 244if test "$DCFG_MINFO_BRACKETING" = "false"; then 245 DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec 246else 247 DRTSTUFF_SPEC=/dev/null 248fi 249AC_SUBST_FILE(DRTSTUFF_SPEC) 250 251# Add dependencies for libgphobos.spec file 252SPEC_PHOBOS_DEPS="$LIBS" 253AC_SUBST(SPEC_PHOBOS_DEPS) 254 255# Libdruntime / phobos soname version 256libtool_VERSION=3:0:0 257AC_SUBST(libtool_VERSION) 258 259# Set default flags (after DRUNTIME_WERROR!) 260if test -z "$GDCFLAGS"; then 261 GDCFLAGS="-g -O2" 262fi 263AC_SUBST(GDCFLAGS) 264 265WARN_DFLAGS="-Wall $WERROR_FLAG" 266AC_SUBST(WARN_DFLAGS) 267 268# Sanity check for the cross-compilation case: 269AC_CHECK_HEADER(stdio.h,:, 270 [AC_MSG_ERROR([cannot find stdio.h.])]) 271 272AC_CONFIG_FILES(Makefile) 273 274AC_CONFIG_FILES(libdruntime/gcc/config.d libdruntime/gcc/libbacktrace.d) 275AC_CONFIG_FILES(src/libgphobos.spec) 276AC_CONFIG_FILES([testsuite/testsuite_flags],[chmod +x testsuite/testsuite_flags]) 277 278# Multilibs need MULTISUBDIR defined correctly in certain makefiles so 279# that multilib installs will end up installed in the correct place. 280# The testsuite needs it for multilib-aware ABI baseline files. 281# To work around this not being passed down from config-ml.in -> 282# srcdir/Makefile.am -> srcdir/{src,libdruntime,...}/Makefile.am, manually 283# append it here. Only modify Makefiles that have just been created. 284# 285# Also, get rid of this simulated-VPATH thing that automake does. 286AC_CONFIG_FILES(AC_FOREACH([DIR], [libdruntime src testsuite], [DIR/Makefile ]), 287 [cat > vpsed$$ << \_EOF 288s!`test -f '$<' || echo '$(srcdir)/'`!! 289_EOF 290 sed -f vpsed$$ $ac_file > tmp$$ 291 mv tmp$$ $ac_file 292 rm vpsed$$ 293 echo 'MULTISUBDIR =' >> $ac_file 294 ml_norecursion=yes 295 . ${multi_basedir}/config-ml.in 296 AS_UNSET([ml_norecursion]) 297]) 298 299AC_OUTPUT 300