1# Configure script for libada.
2#   Copyright (C) 2003-2014 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/unwind_ipinfo.m4)
23
24AC_INIT
25AC_PREREQ([2.64])
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# Very limited version of AC_MAINTAINER_MODE.
43AC_ARG_ENABLE([maintainer-mode],
44  [AC_HELP_STRING([--enable-maintainer-mode],
45                 [enable make rules and dependencies not useful (and
46                  sometimes confusing) to the casual installer])],
47  [case ${enable_maintainer_mode} in
48     yes) MAINT='' ;;
49     no) MAINT='#' ;;
50     *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
51   esac
52   maintainer_mode=${enableval}],
53  [MAINT='#'])
54AC_SUBST([MAINT])dnl
55
56AM_ENABLE_MULTILIB(, ..)
57# Calculate toolexeclibdir
58# Also toolexecdir, though it's only used in toolexeclibdir
59case ${enable_version_specific_runtime_libs} in
60  yes)
61    # Need the gcc compiler version to know where to install libraries
62    # and header files if --enable-version-specific-runtime-libs option
63    # is selected.
64    toolexecdir='$(libdir)/gcc/$(target_alias)'
65    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
66    ;;
67  no)
68    if test -n "$with_cross_host" &&
69       test x"$with_cross_host" != x"no"; then
70      # Install a library built with a cross compiler in tooldir, not libdir.
71      toolexecdir='$(exec_prefix)/$(target_alias)'
72      toolexeclibdir='$(toolexecdir)/lib'
73    else
74      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
75      toolexeclibdir='$(libdir)'
76    fi
77    multi_os_directory=`$CC -print-multi-os-directory`
78    case $multi_os_directory in
79      .) ;; # Avoid trailing /.
80      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
81    esac
82    ;;
83esac
84AC_SUBST(toolexecdir)
85AC_SUBST(toolexeclibdir)
86#TODO: toolexeclibdir is currently disregarded
87
88# Check the compiler.
89# The same as in boehm-gc and libstdc++. Have to borrow it from there.
90# We must force CC to /not/ be precious variables; otherwise
91# the wrong, non-multilib-adjusted value will be used in multilibs.
92# As a side effect, we have to subst CFLAGS ourselves.
93
94m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
95m4_define([_AC_ARG_VAR_PRECIOUS],[])
96AC_PROG_CC
97m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
98
99AC_SUBST(CFLAGS)
100
101AC_ARG_ENABLE([shared],
102[AC_HELP_STRING([--disable-shared],
103                [don't provide a shared libgnat])],
104[
105case $enable_shared in
106  yes | no) ;;
107  *)
108    enable_shared=no
109    IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
110    for pkg in $enableval; do
111      case $pkg in
112        ada | libada)
113          enable_shared=yes ;;
114      esac
115    done
116    IFS="$ac_save_ifs"
117    ;;
118esac
119], [enable_shared=yes])
120AC_SUBST([enable_shared])
121
122GCC_PICFLAG
123AC_SUBST([PICFLAG])
124
125# These must be passed down, or are needed by gcc/libgcc.mvars
126AC_PROG_AWK
127AC_PROG_LN_S
128
129# Determine what to build for 'gnatlib'
130if test $build = $target \
131   && test ${enable_shared} = yes ; then
132  # Note that build=target is almost certainly the wrong test; FIXME
133  default_gnatlib_target="gnatlib-shared"
134else
135  default_gnatlib_target="gnatlib-plain"
136fi
137AC_SUBST([default_gnatlib_target])
138
139# Check for _Unwind_GetIPInfo
140GCC_CHECK_UNWIND_GETIPINFO
141have_getipinfo=
142if test x$have_unwind_getipinfo = xyes; then
143  have_getipinfo=-DHAVE_GETIPINFO
144fi
145AC_SUBST(have_getipinfo)
146
147# Output: create a Makefile.
148AC_CONFIG_FILES([Makefile])
149
150AC_OUTPUT
151