1# Configure script for libada.
2#   Copyright (C) 2003-2020 Free Software Foundation, Inc.
3#
4# This file is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; see the file COPYING3.  If not see
16# <http://www.gnu.org/licenses/>.
17
18sinclude(../config/acx.m4)
19sinclude(../config/multi.m4)
20sinclude(../config/override.m4)
21sinclude(../config/picflag.m4)
22sinclude(../config/toolexeclibdir.m4)
23sinclude(../config/unwind_ipinfo.m4)
24
25AC_INIT
26
27AC_CONFIG_SRCDIR([Makefile.in])
28
29# Determine the host, build, and target systems
30AC_CANONICAL_BUILD
31AC_CANONICAL_HOST
32AC_CANONICAL_TARGET
33target_alias=${target_alias-$host_alias}
34
35# Determine the noncanonical target name, for directory use.
36ACX_NONCANONICAL_TARGET
37
38# Determine the target- and build-specific subdirectories
39GCC_TOPLEV_SUBDIRS
40
41# Command-line options.
42
43AC_ARG_ENABLE(version-specific-runtime-libs,
44  [AS_HELP_STRING([--enable-version-specific-runtime-libs],
45		  [specify that runtime libraries should be
46		   installed in a compiler-specific directory])],
47  [case "$enableval" in
48     yes|no)
49       ;;
50     *)
51       AC_MSG_ERROR([--enable-version-specific-runtime-libs must be yes or no])
52       ;;
53   esac],
54  [enable_version_specific_runtime_libs=yes]
55)
56
57# Very limited version of AC_MAINTAINER_MODE.
58AC_ARG_ENABLE([maintainer-mode],
59  [AC_HELP_STRING([--enable-maintainer-mode],
60                 [enable make rules and dependencies not useful (and
61                  sometimes confusing) to the casual installer])],
62  [case ${enable_maintainer_mode} in
63     yes) MAINT='' ;;
64     no) MAINT='#' ;;
65     *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
66   esac
67   maintainer_mode=${enableval}],
68  [MAINT='#'])
69AC_SUBST([MAINT])dnl
70
71GCC_WITH_TOOLEXECLIBDIR
72
73AM_ENABLE_MULTILIB(, ..)
74# Calculate toolexeclibdir
75# Also toolexecdir, though it's only used in toolexeclibdir
76case ${enable_version_specific_runtime_libs} in
77  yes)
78    # Need the gcc compiler version to know where to install libraries
79    # and header files if --enable-version-specific-runtime-libs option
80    # is selected.
81    toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
82    toolexeclibdir='$(toolexecdir)/$(version)$(MULTISUBDIR)/adalib'
83    ;;
84  no)
85    if test -n "$with_cross_host" &&
86       test x"$with_cross_host" != x"no"; then
87      # Install a library built with a cross compiler in tooldir, not libdir.
88      toolexecdir='$(exec_prefix)/$(target_alias)'
89      case ${with_toolexeclibdir} in
90	no)
91	  toolexeclibdir='$(toolexecdir)/lib'
92	  ;;
93	*)
94	  toolexeclibdir=${with_toolexeclibdir}
95	  ;;
96      esac
97    else
98      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
99      toolexeclibdir='$(libdir)'
100    fi
101    multi_os_directory=`$CC -print-multi-os-directory`
102    case $multi_os_directory in
103      .) ;; # Avoid trailing /.
104      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
105    esac
106    ;;
107esac
108AC_SUBST(toolexecdir)
109AC_SUBST(toolexeclibdir)
110
111# Check the compiler.
112# The same as in boehm-gc and libstdc++. Have to borrow it from there.
113# We must force CC to /not/ be precious variables; otherwise
114# the wrong, non-multilib-adjusted value will be used in multilibs.
115# As a side effect, we have to subst CFLAGS ourselves.
116
117m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
118m4_define([_AC_ARG_VAR_PRECIOUS],[])
119AC_PROG_CC
120m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
121
122AC_SUBST(CFLAGS)
123
124AC_ARG_ENABLE([shared],
125[AC_HELP_STRING([--disable-shared],
126                [don't provide a shared libgnat])],
127[
128case $enable_shared in
129  yes | no) ;;
130  *)
131    enable_shared=no
132    IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
133    for pkg in $enableval; do
134      case $pkg in
135        ada | libada)
136          enable_shared=yes ;;
137      esac
138    done
139    IFS="$ac_save_ifs"
140    ;;
141esac
142], [enable_shared=yes])
143AC_SUBST([enable_shared])
144
145GCC_PICFLAG
146AC_SUBST([PICFLAG])
147
148# These must be passed down, or are needed by gcc/libgcc.mvars
149AC_PROG_AWK
150AC_PROG_LN_S
151
152# Determine what to build for 'gnatlib'
153if test ${enable_shared} = yes; then
154  default_gnatlib_target="gnatlib-shared"
155else
156  default_gnatlib_target="gnatlib"
157fi
158AC_SUBST([default_gnatlib_target])
159
160# Check for _Unwind_GetIPInfo
161GCC_CHECK_UNWIND_GETIPINFO
162if test x$have_unwind_getipinfo = xyes; then
163  have_getipinfo=-DHAVE_GETIPINFO
164else
165  have_getipinfo=
166fi
167AC_SUBST([have_getipinfo])
168
169# Check for <sys/capability.h>
170AC_CHECK_HEADER([sys/capability.h], have_capability=-DHAVE_CAPABILITY, have_capability=)
171AC_SUBST([have_capability])
172
173# Determine what GCC version number to use in filesystem paths.
174GCC_BASE_VER
175
176# Output: create a Makefile.
177AC_CONFIG_FILES([Makefile])
178
179AC_OUTPUT
180