configure.ac revision 1.1.1.2
1# Process this file with autoconf to produce a configure script. 2# Copyright (C) 2006-2020 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# This should be inherited in the recursive make, but ensure it is defined. 69test "$AR" || AR=ar 70AC_SUBST(AR) 71 72CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} 73AC_SUBST(CC_FOR_BUILD) 74AC_SUBST(CFLAGS_FOR_BUILD) 75 76# Enable libtool 77LT_INIT(dlopen) 78AM_PROG_LIBTOOL 79WITH_LOCAL_DRUNTIME([LT_LANG([D])], []) 80 81# libtool variables for Phobos shared and position-independent compiles. 82# 83# Use phobos_compiler_shared_flag to designate the compile-time flags for 84# creating shared objects. Default: -fversion=Shared. 85# 86# Use phobos_compiler_pic_flag to designate the compile-time flags for 87# creating position-independent objects. This varies with the target 88# hardware and operating system, but is often: -fPIC. 89# 90# The distinction between pic and shared compilation flags is not present in 91# libtool, and so we make it here. How it is handled is that in shared 92# compilations the `lt_prog_compiler_pic_D' variable is used to instead 93# ensure that conditional compilation of shared runtime code is compiled in. 94# The original PIC flags are then used in the compilation of every object. 95# 96# Why are objects destined for libgphobos.a compiled with -fPIC? 97# Because -fPIC is not harmful to use for objects destined for static 98# libraries. In addition, using -fPIC will allow the use of static 99# libgphobos.a in the creation of other D shared libraries. 100if test "$enable_shared" = yes; then 101 phobos_compiler_pic_flag="$lt_prog_compiler_pic_D" 102 phobos_compiler_shared_flag="-fversion=Shared" 103else 104 phobos_compiler_pic_flag= 105 phobos_compiler_shared_flag= 106fi 107AC_SUBST(phobos_compiler_pic_flag) 108AC_SUBST(phobos_compiler_shared_flag) 109 110# Override the libtool's pic_flag and pic_mode. 111# Do this step after AM_PROG_LIBTOOL, but before AC_OUTPUT. 112# NB: this impacts --with-pic and --without-pic. 113lt_prog_compiler_pic_D="$phobos_compiler_shared_flag" 114pic_mode='default' 115 116# Determine what GCC version number to use in filesystem paths. 117GCC_BASE_VER 118 119# libphobos/libdruntime specific options and feature detection 120DRUNTIME_CONFIGURE 121DRUNTIME_MULTILIB 122DRUNTIME_WERROR 123DRUNTIME_CPU_SOURCES 124DRUNTIME_OS_SOURCES 125DRUNTIME_OS_THREAD_MODEL 126DRUNTIME_OS_ARM_EABI_UNWINDER 127DRUNTIME_OS_MINFO_BRACKETING 128DRUNTIME_OS_DLPI_TLS_MODID 129DRUNTIME_OS_LINK_SPEC 130DRUNTIME_LIBRARIES_CLIB 131 132WITH_LOCAL_DRUNTIME([ 133 AC_LANG_PUSH([D]) 134 AC_SEARCH_LIBS([malloc], [c]) 135 AC_SEARCH_LIBS([pthread_create], [pthread]) 136 AC_SEARCH_LIBS([cosf], [m]) 137 AC_SEARCH_LIBS([clock_gettime], [rt]) 138 DRUNTIME_ENABLE_ATOMIC_BUILTINS 139 AC_LANG_POP([D]) 140], [-nophoboslib]) 141 142DRUNTIME_LIBRARIES_ATOMIC 143DRUNTIME_LIBRARIES_BACKTRACE 144DRUNTIME_LIBRARIES_DLOPEN 145DRUNTIME_LIBRARIES_NET 146DRUNTIME_LIBRARIES_UCONTEXT 147DRUNTIME_LIBRARIES_ZLIB 148DRUNTIME_INSTALL_DIRECTORIES 149 150AC_MSG_CHECKING([for --enable-libphobos]) 151AC_ARG_ENABLE(libphobos, 152 [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])]) 153AC_MSG_RESULT($enable_libphobos) 154 155AC_MSG_CHECKING([for --with-libphobos-druntime-only]) 156AC_ARG_WITH(libphobos-druntime-only, 157 AS_HELP_STRING([--with-libphobos-druntime-only={yes,no,auto}], 158 [build only the druntime library (default: auto)]),, 159 [with_libphobos_druntime_only=auto]) 160AC_MSG_RESULT($with_libphobos_druntime_only) 161 162case "$with_libphobos_druntime_only" in 163 yes|no|auto) ;; 164 *) AC_MSG_ERROR([Invalid argument for --with-libphobos-druntime-only]) ;; 165esac 166 167# See if supported. 168unset LIBPHOBOS_SUPPORTED 169unset LIBDRUNTIME_ONLY 170AC_MSG_CHECKING([for host support for libphobos]) 171. ${srcdir}/configure.tgt 172case ${host} in 173 x86_64-*-solaris2.* | i?86-*-solaris2.*) 174 # libphobos doesn't compile with the Solaris/x86 assembler due to a 175 # relatively low linelength limit. 176 as_prog=`$CC -print-prog-name=as` 177 if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then 178 druntime_cv_use_gas=yes; 179 else 180 druntime_cv_use_gas=no; 181 fi 182 rm -f a.out 183 if test x$druntime_cv_use_gas = xno; then 184 LIBPHOBOS_SUPPORTED=no 185 fi 186 # 64-bit D execution fails with Solaris ld without -z relax=transtls support. 187 if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then 188 LIBPHOBOS_SUPPORTED=no 189 fi 190 ;; 191esac 192AC_MSG_RESULT($LIBPHOBOS_SUPPORTED) 193 194# Decide if it's usable. 195case $LIBPHOBOS_SUPPORTED:$enable_libphobos in 196*:no) use_libphobos=no ;; 197*:yes) use_libphobos=yes ;; 198yes:*) use_libphobos=yes ;; 199*:*) use_libphobos=no ;; 200esac 201AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes) 202 203# Decide if only libdruntime should be built. 204case $LIBDRUNTIME_ONLY:$with_libphobos_druntime_only in 205*:no) only_libdruntime=no ;; 206*:yes) only_libdruntime=yes ;; 207yes:*) only_libdruntime=yes ;; 208*:*) only_libdruntime=no ;; 209esac 210AM_CONDITIONAL(ENABLE_LIBDRUNTIME_ONLY, test x$only_libdruntime = xyes) 211 212# Enable expensive internal checks 213AC_ARG_ENABLE(libphobos-checking, 214[AS_HELP_STRING([[--enable-libphobos-checking[=LIST]]], 215 [enable expensive run-time checks. With LIST, 216 enable only specific categories of checks. 217 Categories are: yes,no,all,none,release. 218 Flags are: assert or other strings])], 219[ac_checking_flags="${enableval}"],[ac_checking_flags=release]) 220IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," 221for check in release $ac_checking_flags 222do 223 case $check in 224 # These set all the flags to specific states 225 yes|all) RELEASE_FLAG="-fno-release" ; ASSERT_FLAG= ;; 226 no|none|release) RELEASE_FLAG="-frelease" ; ASSERT_FLAG= ;; 227 # These enable particular checks 228 assert) ASSERT_FLAG="-fassert" ;; 229 # Accept 230 *) ;; 231 esac 232done 233IFS="$ac_save_IFS" 234CHECKING_DFLAGS="$RELEASE_FLAG $ASSERT_FLAG" 235AC_SUBST(CHECKING_DFLAGS) 236 237# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec 238if test "$DCFG_MINFO_BRACKETING" = "false"; then 239 DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec 240else 241 DRTSTUFF_SPEC=/dev/null 242fi 243AC_SUBST_FILE(DRTSTUFF_SPEC) 244 245# Add dependencies for libgphobos.spec file 246SPEC_PHOBOS_DEPS="$LIBS" 247AC_SUBST(SPEC_PHOBOS_DEPS) 248 249# Libdruntime / phobos soname version 250libtool_VERSION=1:0:0 251AC_SUBST(libtool_VERSION) 252 253# Set default flags (after DRUNTIME_WERROR!) 254if test -z "$GDCFLAGS"; then 255 GDCFLAGS="-g -O2" 256fi 257AC_SUBST(GDCFLAGS) 258 259WARN_DFLAGS="-Wall $WERROR_FLAG" 260AC_SUBST(WARN_DFLAGS) 261 262# Sanity check for the cross-compilation case: 263AC_CHECK_HEADER(stdio.h,:, 264 [AC_MSG_ERROR([cannot find stdio.h.])]) 265 266AC_CONFIG_FILES(Makefile) 267 268AC_CONFIG_FILES(libdruntime/gcc/config.d libdruntime/gcc/libbacktrace.d) 269AC_CONFIG_FILES(src/libgphobos.spec) 270AC_CONFIG_FILES([testsuite/testsuite_flags],[chmod +x testsuite/testsuite_flags]) 271 272# Multilibs need MULTISUBDIR defined correctly in certain makefiles so 273# that multilib installs will end up installed in the correct place. 274# The testsuite needs it for multilib-aware ABI baseline files. 275# To work around this not being passed down from config-ml.in -> 276# srcdir/Makefile.am -> srcdir/{src,libdruntime,...}/Makefile.am, manually 277# append it here. Only modify Makefiles that have just been created. 278# 279# Also, get rid of this simulated-VPATH thing that automake does. 280AC_CONFIG_FILES(AC_FOREACH([DIR], [libdruntime src testsuite], [DIR/Makefile ]), 281 [cat > vpsed$$ << \_EOF 282s!`test -f '$<' || echo '$(srcdir)/'`!! 283_EOF 284 sed -f vpsed$$ $ac_file > tmp$$ 285 mv tmp$$ $ac_file 286 rm vpsed$$ 287 echo 'MULTISUBDIR =' >> $ac_file 288 ml_norecursion=yes 289 . ${multi_basedir}/config-ml.in 290 AS_UNSET([ml_norecursion]) 291]) 292 293AC_OUTPUT 294