]>
Commit | Line | Data |
---|---|---|
b4c522fa | 1 | # Process this file with autoconf to produce a configure script. |
99dee823 | 2 | # Copyright (C) 2006-2021 Free Software Foundation, Inc. |
b4c522fa IB |
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 | # | |
27f18a62 JP |
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 | |
b4c522fa | 25 | # |
27f18a62 | 26 | # autoreconf2.69 |
b4c522fa IB |
27 | # |
28 | ||
b4c522fa IB |
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 | |
235d1c46 | 35 | AC_USE_SYSTEM_EXTENSIONS |
b4c522fa IB |
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). | |
d7e418a1 | 46 | # subdir-objects: Build objects in sub-directories. |
b4c522fa IB |
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). | |
22e05272 | 50 | # -Wno-override: Overrides used in testsuite. |
d7e418a1 | 51 | AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies subdir-objects -Wall -Wno-portability -Wno-override]) |
b4c522fa IB |
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 | ||
08c1d39d L |
68 | # Add CET specific flags if CET is enabled |
69 | GCC_CET_FLAGS(CET_FLAGS) | |
70 | AC_SUBST(CET_FLAGS) | |
0ed75760 | 71 | # To ensure that runtime code for CET is compiled in, add in D version flags. |
5dbab7b3 | 72 | AS_IF([test x$enable_cet = xyes], [ |
0ed75760 | 73 | CET_DFLAGS="$CET_FLAGS -fversion=CET" |
5dbab7b3 IB |
74 | DCFG_ENABLE_CET=true |
75 | ], [ | |
76 | CET_DFLAGS= | |
77 | DCFG_ENABLE_CET=false | |
78 | ]) | |
79 | AC_SUBST(CET_DFLAGS) | |
80 | AC_SUBST(DCFG_ENABLE_CET) | |
08c1d39d | 81 | |
b4c522fa IB |
82 | # This should be inherited in the recursive make, but ensure it is defined. |
83 | test "$AR" || AR=ar | |
84 | AC_SUBST(AR) | |
85 | ||
86 | CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} | |
87 | AC_SUBST(CC_FOR_BUILD) | |
88 | AC_SUBST(CFLAGS_FOR_BUILD) | |
89 | ||
90 | # Enable libtool | |
91 | LT_INIT(dlopen) | |
92 | AM_PROG_LIBTOOL | |
93 | WITH_LOCAL_DRUNTIME([LT_LANG([D])], []) | |
fdfcb535 IB |
94 | AC_SUBST(enable_shared) |
95 | AC_SUBST(enable_static) | |
b4c522fa IB |
96 | |
97 | # libtool variables for Phobos shared and position-independent compiles. | |
98 | # | |
fdfcb535 IB |
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 | # | |
b4c522fa IB |
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. | |
b4c522fa | 114 | if test "$enable_shared" = yes; then |
fdfcb535 | 115 | phobos_lt_pic_flag="-prefer-pic" |
b4c522fa IB |
116 | phobos_compiler_pic_flag="$lt_prog_compiler_pic_D" |
117 | phobos_compiler_shared_flag="-fversion=Shared" | |
118 | else | |
fdfcb535 | 119 | phobos_lt_pic_flag= |
b4c522fa IB |
120 | phobos_compiler_pic_flag= |
121 | phobos_compiler_shared_flag= | |
122 | fi | |
fdfcb535 | 123 | AC_SUBST(phobos_lt_pic_flag) |
b4c522fa IB |
124 | AC_SUBST(phobos_compiler_pic_flag) |
125 | AC_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. | |
fdfcb535 | 130 | lt_prog_compiler_pic_D="$phobos_compiler_pic_flag $phobos_compiler_shared_flag" |
b4c522fa IB |
131 | pic_mode='default' |
132 | ||
bca0a321 RO |
133 | # Determine what GCC version number to use in filesystem paths. |
134 | GCC_BASE_VER | |
135 | ||
136 | # libphobos/libdruntime specific options and feature detection | |
137 | DRUNTIME_CONFIGURE | |
138 | DRUNTIME_MULTILIB | |
139 | DRUNTIME_WERROR | |
d118ec22 | 140 | DRUNTIME_SECTION_FLAGS |
bca0a321 | 141 | DRUNTIME_CPU_SOURCES |
bca0a321 RO |
142 | DRUNTIME_OS_SOURCES |
143 | DRUNTIME_OS_THREAD_MODEL | |
144 | DRUNTIME_OS_ARM_EABI_UNWINDER | |
145 | DRUNTIME_OS_MINFO_BRACKETING | |
146 | DRUNTIME_OS_DLPI_TLS_MODID | |
147 | DRUNTIME_OS_LINK_SPEC | |
148 | DRUNTIME_LIBRARIES_CLIB | |
149 | ||
150 | WITH_LOCAL_DRUNTIME([ | |
151 | AC_LANG_PUSH([D]) | |
152 | AC_SEARCH_LIBS([malloc], [c]) | |
6e286c8d | 153 | AC_SEARCH_LIBS([pthread_create], [pthread]) |
bca0a321 RO |
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 | ||
160 | DRUNTIME_LIBRARIES_ATOMIC | |
161 | DRUNTIME_LIBRARIES_BACKTRACE | |
162 | DRUNTIME_LIBRARIES_DLOPEN | |
163 | DRUNTIME_LIBRARIES_NET | |
ac1a0a38 | 164 | DRUNTIME_LIBRARIES_UCONTEXT |
bca0a321 RO |
165 | DRUNTIME_LIBRARIES_ZLIB |
166 | DRUNTIME_INSTALL_DIRECTORIES | |
167 | ||
7d31d331 RO |
168 | AC_MSG_CHECKING([for --enable-libphobos]) |
169 | AC_ARG_ENABLE(libphobos, | |
170 | [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])]) | |
171 | AC_MSG_RESULT($enable_libphobos) | |
172 | ||
261bd78d | 173 | AC_MSG_CHECKING([for --with-libphobos-druntime-only]) |
371d1011 | 174 | AC_ARG_WITH(libphobos-druntime-only, |
261bd78d IB |
175 | AS_HELP_STRING([--with-libphobos-druntime-only={yes,no,auto}], |
176 | [build only the druntime library (default: auto)]),, | |
371d1011 IB |
177 | [with_libphobos_druntime_only=auto]) |
178 | AC_MSG_RESULT($with_libphobos_druntime_only) | |
261bd78d | 179 | |
371d1011 | 180 | case "$with_libphobos_druntime_only" in |
261bd78d IB |
181 | yes|no|auto) ;; |
182 | *) AC_MSG_ERROR([Invalid argument for --with-libphobos-druntime-only]) ;; | |
183 | esac | |
184 | ||
7d31d331 RO |
185 | # See if supported. |
186 | unset LIBPHOBOS_SUPPORTED | |
261bd78d | 187 | unset LIBDRUNTIME_ONLY |
7d31d331 RO |
188 | AC_MSG_CHECKING([for host support for libphobos]) |
189 | . ${srcdir}/configure.tgt | |
190 | case ${host} in | |
191 | x86_64-*-solaris2.* | i?86-*-solaris2.*) | |
192 | # libphobos doesn't compile with the Solaris/x86 assembler due to a | |
193 | # relatively low linelength limit. | |
194 | as_prog=`$CC -print-prog-name=as` | |
195 | if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then | |
196 | druntime_cv_use_gas=yes; | |
197 | else | |
198 | druntime_cv_use_gas=no; | |
199 | fi | |
200 | rm -f a.out | |
201 | if test x$druntime_cv_use_gas = xno; then | |
202 | LIBPHOBOS_SUPPORTED=no | |
203 | fi | |
bca0a321 RO |
204 | # 64-bit D execution fails with Solaris ld without -z relax=transtls support. |
205 | if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then | |
206 | LIBPHOBOS_SUPPORTED=no | |
207 | fi | |
7d31d331 RO |
208 | ;; |
209 | esac | |
210 | AC_MSG_RESULT($LIBPHOBOS_SUPPORTED) | |
211 | ||
212 | # Decide if it's usable. | |
213 | case $LIBPHOBOS_SUPPORTED:$enable_libphobos in | |
214 | *:no) use_libphobos=no ;; | |
215 | *:yes) use_libphobos=yes ;; | |
216 | yes:*) use_libphobos=yes ;; | |
217 | *:*) use_libphobos=no ;; | |
218 | esac | |
219 | AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes) | |
220 | ||
261bd78d | 221 | # Decide if only libdruntime should be built. |
371d1011 | 222 | case $LIBDRUNTIME_ONLY:$with_libphobos_druntime_only in |
261bd78d IB |
223 | *:no) only_libdruntime=no ;; |
224 | *:yes) only_libdruntime=yes ;; | |
225 | yes:*) only_libdruntime=yes ;; | |
226 | *:*) only_libdruntime=no ;; | |
227 | esac | |
228 | AM_CONDITIONAL(ENABLE_LIBDRUNTIME_ONLY, test x$only_libdruntime = xyes) | |
229 | ||
c0dbfbd7 IB |
230 | # Enable expensive internal checks |
231 | AC_ARG_ENABLE(libphobos-checking, | |
232 | [AS_HELP_STRING([[--enable-libphobos-checking[=LIST]]], | |
233 | [enable expensive run-time checks. With LIST, | |
234 | enable only specific categories of checks. | |
235 | Categories are: yes,no,all,none,release. | |
236 | Flags are: assert or other strings])], | |
237 | [ac_checking_flags="${enableval}"],[ac_checking_flags=release]) | |
238 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," | |
239 | for check in release $ac_checking_flags | |
240 | do | |
241 | case $check in | |
242 | # These set all the flags to specific states | |
243 | yes|all) RELEASE_FLAG="-fno-release" ; ASSERT_FLAG= ;; | |
244 | no|none|release) RELEASE_FLAG="-frelease" ; ASSERT_FLAG= ;; | |
245 | # These enable particular checks | |
246 | assert) ASSERT_FLAG="-fassert" ;; | |
247 | # Accept | |
248 | *) ;; | |
249 | esac | |
250 | done | |
251 | IFS="$ac_save_IFS" | |
252 | CHECKING_DFLAGS="$RELEASE_FLAG $ASSERT_FLAG" | |
253 | AC_SUBST(CHECKING_DFLAGS) | |
254 | ||
0b6e3127 RO |
255 | # Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec |
256 | if test "$DCFG_MINFO_BRACKETING" = "false"; then | |
257 | DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec | |
258 | else | |
259 | DRTSTUFF_SPEC=/dev/null | |
260 | fi | |
261 | AC_SUBST_FILE(DRTSTUFF_SPEC) | |
262 | ||
b4c522fa IB |
263 | # Add dependencies for libgphobos.spec file |
264 | SPEC_PHOBOS_DEPS="$LIBS" | |
265 | AC_SUBST(SPEC_PHOBOS_DEPS) | |
266 | ||
267 | # Libdruntime / phobos soname version | |
be616904 | 268 | libtool_VERSION=2:0:0 |
85041a5b | 269 | AC_SUBST(libtool_VERSION) |
b4c522fa IB |
270 | |
271 | # Set default flags (after DRUNTIME_WERROR!) | |
272 | if test -z "$GDCFLAGS"; then | |
c0dbfbd7 | 273 | GDCFLAGS="-g -O2" |
b4c522fa IB |
274 | fi |
275 | AC_SUBST(GDCFLAGS) | |
276 | ||
38c3017f IB |
277 | WARN_DFLAGS="-Wall $WERROR_FLAG" |
278 | AC_SUBST(WARN_DFLAGS) | |
279 | ||
b4c522fa IB |
280 | # Sanity check for the cross-compilation case: |
281 | AC_CHECK_HEADER(stdio.h,:, | |
282 | [AC_MSG_ERROR([cannot find stdio.h.])]) | |
283 | ||
ac67752d | 284 | AC_CONFIG_FILES(Makefile) |
b4c522fa IB |
285 | |
286 | AC_CONFIG_FILES(libdruntime/gcc/config.d libdruntime/gcc/libbacktrace.d) | |
287 | AC_CONFIG_FILES(src/libgphobos.spec) | |
288 | AC_CONFIG_FILES([testsuite/testsuite_flags],[chmod +x testsuite/testsuite_flags]) | |
289 | ||
ac67752d IB |
290 | # Multilibs need MULTISUBDIR defined correctly in certain makefiles so |
291 | # that multilib installs will end up installed in the correct place. | |
292 | # The testsuite needs it for multilib-aware ABI baseline files. | |
293 | # To work around this not being passed down from config-ml.in -> | |
294 | # srcdir/Makefile.am -> srcdir/{src,libdruntime,...}/Makefile.am, manually | |
295 | # append it here. Only modify Makefiles that have just been created. | |
296 | # | |
297 | # Also, get rid of this simulated-VPATH thing that automake does. | |
298 | AC_CONFIG_FILES(AC_FOREACH([DIR], [libdruntime src testsuite], [DIR/Makefile ]), | |
299 | [cat > vpsed$$ << \_EOF | |
300 | s!`test -f '$<' || echo '$(srcdir)/'`!! | |
b4c522fa | 301 | _EOF |
ac67752d IB |
302 | sed -f vpsed$$ $ac_file > tmp$$ |
303 | mv tmp$$ $ac_file | |
304 | rm vpsed$$ | |
305 | echo 'MULTISUBDIR =' >> $ac_file | |
306 | ml_norecursion=yes | |
307 | . ${multi_basedir}/config-ml.in | |
308 | AS_UNSET([ml_norecursion]) | |
b4c522fa IB |
309 | ]) |
310 | ||
311 | AC_OUTPUT |