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