]> git.ipfire.org Git - thirdparty/gcc.git/blame - libphobos/configure.ac
Work around Solaris ld bug linking __tls_get_addr on 64-bit x86
[thirdparty/gcc.git] / libphobos / configure.ac
CommitLineData
03385ed3 1# Process this file with autoconf to produce a configure script.
fbd26352 2# Copyright (C) 2006-2019 Free Software Foundation, Inc.
03385ed3 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#
1f580a79 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
03385ed3 25#
1f580a79 26# autoreconf2.69
03385ed3 27#
28
03385ed3 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
35
36target_alias=${target_alias-$target}
37AC_SUBST(target_alias)
38
39# 1.11.1: Require that version of automake.
40# foreign: Don't require README, INSTALL, NEWS, etc.
41# no-define: Don't define PACKAGE and VERSION.
42# no-dependencies: Don't generate automatic dependencies.
43# (because it breaks when using bootstrap-lean, since some of the
44# headers are gone at "make install" time).
a88a8aee 45# subdir-objects: Build objects in sub-directories.
03385ed3 46# -Wall: Issue all automake warnings.
47# -Wno-portability: Don't warn about constructs supported by GNU make.
48# (because GCC requires GNU make anyhow).
f00f02a3 49# -Wno-override: Overrides used in testsuite.
a88a8aee 50AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies subdir-objects -Wall -Wno-portability -Wno-override])
03385ed3 51
52m4_rename([_AC_ARG_VAR_PRECIOUS],[glibd_PRECIOUS])
53m4_define([_AC_ARG_VAR_PRECIOUS],[])
54AM_PROG_AS
55AC_PROG_CC
56AC_PROG_GDC
57WITH_LOCAL_DRUNTIME([GDC_CHECK_COMPILE], [])
58
59m4_rename_force([glibd_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
60
61AC_SUBST(CFLAGS)
62AM_MAINTAINER_MODE
63AC_PROG_RANLIB
64AC_PROG_INSTALL
65AC_PROG_MAKE_SET
66
67# This should be inherited in the recursive make, but ensure it is defined.
68test "$AR" || AR=ar
69AC_SUBST(AR)
70
71CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
72AC_SUBST(CC_FOR_BUILD)
73AC_SUBST(CFLAGS_FOR_BUILD)
74
75# Enable libtool
76LT_INIT(dlopen)
77AM_PROG_LIBTOOL
78WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
03385ed3 79
80# libtool variables for Phobos shared and position-independent compiles.
81#
82# Use phobos_compiler_shared_flag to designate the compile-time flags for
83# creating shared objects. Default: -fversion=Shared.
84#
85# Use phobos_compiler_pic_flag to designate the compile-time flags for
86# creating position-independent objects. This varies with the target
87# hardware and operating system, but is often: -fPIC.
88#
89# The distinction between pic and shared compilation flags is not present in
90# libtool, and so we make it here. How it is handled is that in shared
91# compilations the `lt_prog_compiler_pic_D' variable is used to instead
92# ensure that conditional compilation of shared runtime code is compiled in.
93# The original PIC flags are then used in the compilation of every object.
94#
95# Why are objects destined for libgphobos.a compiled with -fPIC?
96# Because -fPIC is not harmful to use for objects destined for static
97# libraries. In addition, using -fPIC will allow the use of static
98# libgphobos.a in the creation of other D shared libraries.
99if test "$enable_shared" = yes; then
100 phobos_compiler_pic_flag="$lt_prog_compiler_pic_D"
101 phobos_compiler_shared_flag="-fversion=Shared"
102else
103 phobos_compiler_pic_flag=
104 phobos_compiler_shared_flag=
105fi
106AC_SUBST(phobos_compiler_pic_flag)
107AC_SUBST(phobos_compiler_shared_flag)
108
109# Override the libtool's pic_flag and pic_mode.
110# Do this step after AM_PROG_LIBTOOL, but before AC_OUTPUT.
111# NB: this impacts --with-pic and --without-pic.
112lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
113pic_mode='default'
114
115# Determine what GCC version number to use in filesystem paths.
116GCC_BASE_VER
117
118# libphobos/libdruntime specific options and feature detection
119DRUNTIME_CONFIGURE
120DRUNTIME_MULTILIB
121DRUNTIME_WERROR
122DRUNTIME_GC
123DRUNTIME_OS_UNIX
124DRUNTIME_OS_SOURCES
125DRUNTIME_OS_THREAD_MODEL
126DRUNTIME_OS_ARM_EABI_UNWINDER
127DRUNTIME_OS_MINFO_BRACKETING
5b79027a 128DRUNTIME_OS_LINK_SPEC
f667f7c1 129DRUNTIME_LIBRARIES_CLIB
03385ed3 130
131WITH_LOCAL_DRUNTIME([
132 AC_LANG_PUSH([D])
133 AC_SEARCH_LIBS([malloc], [c])
134 DRUNTIME_LIBRARIES_THREAD
135 AC_SEARCH_LIBS([cosf], [m])
136 AC_SEARCH_LIBS([clock_gettime], [rt])
137 DRUNTIME_ENABLE_ATOMIC_BUILTINS
138 AC_LANG_POP([D])
139], [-nophoboslib])
140
141DRUNTIME_LIBRARIES_ATOMIC
142DRUNTIME_LIBRARIES_BACKTRACE
143DRUNTIME_LIBRARIES_DLOPEN
ebc4a4d2 144DRUNTIME_LIBRARIES_NET
03385ed3 145DRUNTIME_LIBRARIES_ZLIB
146DRUNTIME_INSTALL_DIRECTORIES
147
e06fcd5a 148# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
149if test "$DCFG_MINFO_BRACKETING" = "false"; then
150 DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
151else
152 DRTSTUFF_SPEC=/dev/null
153fi
154AC_SUBST_FILE(DRTSTUFF_SPEC)
155
03385ed3 156# Add dependencies for libgphobos.spec file
157SPEC_PHOBOS_DEPS="$LIBS"
158AC_SUBST(SPEC_PHOBOS_DEPS)
159
160# Libdruntime / phobos soname version
345422ff 161libtool_VERSION=76:3:0
162AC_SUBST(libtool_VERSION)
03385ed3 163
164# Set default flags (after DRUNTIME_WERROR!)
165if test -z "$GDCFLAGS"; then
166 GDCFLAGS="-Wall $WERROR_FLAG -g -frelease -O2"
167fi
168AC_SUBST(GDCFLAGS)
169
170if test -z "$GDCFLAGSX"; then
171 GDCFLAGSX="-Wall $WERROR_FLAG -g -fno-release -funittest"
172fi
173AC_SUBST(GDCFLAGSX)
174
175# Sanity check for the cross-compilation case:
176AC_CHECK_HEADER(stdio.h,:,
177 [AC_MSG_ERROR([cannot find stdio.h.])])
178
5114391d 179AC_CONFIG_FILES(Makefile)
03385ed3 180
181AC_CONFIG_FILES(libdruntime/gcc/config.d libdruntime/gcc/libbacktrace.d)
182AC_CONFIG_FILES(src/libgphobos.spec)
183AC_CONFIG_FILES([testsuite/testsuite_flags],[chmod +x testsuite/testsuite_flags])
184
5114391d 185# Multilibs need MULTISUBDIR defined correctly in certain makefiles so
186# that multilib installs will end up installed in the correct place.
187# The testsuite needs it for multilib-aware ABI baseline files.
188# To work around this not being passed down from config-ml.in ->
189# srcdir/Makefile.am -> srcdir/{src,libdruntime,...}/Makefile.am, manually
190# append it here. Only modify Makefiles that have just been created.
191#
192# Also, get rid of this simulated-VPATH thing that automake does.
193AC_CONFIG_FILES(AC_FOREACH([DIR], [libdruntime src testsuite], [DIR/Makefile ]),
194 [cat > vpsed$$ << \_EOF
195s!`test -f '$<' || echo '$(srcdir)/'`!!
03385ed3 196_EOF
5114391d 197 sed -f vpsed$$ $ac_file > tmp$$
198 mv tmp$$ $ac_file
199 rm vpsed$$
200 echo 'MULTISUBDIR =' >> $ac_file
201 ml_norecursion=yes
202 . ${multi_basedir}/config-ml.in
203 AS_UNSET([ml_norecursion])
03385ed3 204])
205
206AC_OUTPUT