1# Configure script for libada.
2#   Copyright 2003, 2004, 2009, 2012 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/override.m4)
20
21AC_INIT
22
23AC_CONFIG_SRCDIR([Makefile.in])
24
25# Command-line options.
26# Very limited version of AC_MAINTAINER_MODE.
27AC_ARG_ENABLE([maintainer-mode],
28  [AC_HELP_STRING([--enable-maintainer-mode],
29                 [enable make rules and dependencies not useful (and
30                  sometimes confusing) to the casual installer])],
31  [case ${enable_maintainer_mode} in
32     yes) MAINT='' ;;
33     no) MAINT='#' ;;
34     *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
35   esac
36   maintainer_mode=${enableval}],
37  [MAINT='#'])
38AC_SUBST([MAINT])dnl
39
40# Start of actual configure tests
41
42AC_PROG_INSTALL
43
44AC_CANONICAL_BUILD
45AC_CANONICAL_HOST
46AC_CANONICAL_TARGET
47
48ACX_NONCANONICAL_HOST
49ACX_NONCANONICAL_TARGET
50
51# Need to pass this down for now :-P
52AC_PROG_LN_S
53
54# Target-specific stuff (defaults)
55TOOLS_TARGET_PAIRS=
56AC_SUBST(TOOLS_TARGET_PAIRS)
57EXTRA_GNATTOOLS=
58AC_SUBST(EXTRA_GNATTOOLS)
59
60# Per-target case statement
61# -------------------------
62case "${target}" in
63  *-*-aix*)
64    TOOLS_TARGET_PAIRS="\
65    mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \
66    indepsw.adb<indepsw-aix.adb"
67    ;;
68  *-*-darwin*)
69    TOOLS_TARGET_PAIRS="\
70    mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb \
71    indepsw.adb<indepsw-darwin.adb"
72    ;;
73  *-*-dragonfly*)
74    TOOLS_TARGET_PAIRS="\
75    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
76    indepsw.adb<indepsw-gnu.adb"
77    ;;
78  *-*-freebsd*)
79    TOOLS_TARGET_PAIRS="\
80    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
81    indepsw.adb<indepsw-gnu.adb"
82    ;;
83  *-*-linux*)
84    TOOLS_TARGET_PAIRS="\
85    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
86    indepsw.adb<indepsw-gnu.adb"
87    ;;
88  *-*-solaris*)
89    TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb"
90    ;;
91  *-*-vxworks*)
92    TOOLS_TARGET_PAIRS="\
93    mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
94    indepsw.adb<indepsw-gnu.adb"
95    ;;
96  hppa*-hp-hpux10*)
97    ;;
98  hppa*-hp-hpux11*)
99    TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb"
100    ;;
101  ia64-hp-hpux11*)
102    TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-ia64-hpux.adb"
103    ;;
104  alpha*-*-vms* | alpha*-*-openvms*)
105    TOOLS_TARGET_PAIRS="\
106    mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \
107    symbols.adb<symbols-vms.adb \
108    symbols-processing.adb<symbols-processing-vms-alpha.adb"
109    EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)'
110    ;;
111  ia64-*-vms* | ia64-*-openvms*)
112    TOOLS_TARGET_PAIRS="\
113    mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \
114    symbols.adb<symbols-vms.adb \
115    symbols-processing.adb<symbols-processing-vms-ia64.adb"
116    EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)'
117    ;;
118  *-*-cygwin32* | *-*-mingw32* | *-*-pe)
119    TOOLS_TARGET_PAIRS="\
120    mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \
121    indepsw.adb<indepsw-mingw.adb"
122    EXTRA_GNATTOOLS='../../gnatdll$(exeext)'
123    ;;
124esac
125
126# From user or toplevel makefile.
127AC_SUBST(ADA_CFLAGS)
128
129# This is testing the CC passed from the toplevel Makefile, not the
130# one we will select below.
131AC_PROG_CC
132warn_cflags=
133if test "x$GCC" = "xyes"; then
134  warn_cflags='$(GCC_WARN_CFLAGS)'
135fi
136AC_SUBST(warn_cflags)
137
138# Determine what to build for 'gnattools'.  Test after the above,
139# because testing for CC sets the final value of cross_compiling, even
140# if we end up using a different CC.  We want to build
141# gnattools-native when: (a) this is a native build, i.e.,
142# cross_compiling=no, otherwise we know we cannot run binaries
143# produced by the toolchain used for the build, not even the binaries
144# created within ../gcc/; (b) build and host are the same, otherwise
145# this is to be regarded as a cross build environment even if it seems
146# that we can run host binaries; (c) host and target are the same,
147# otherwise the tools in ../gcc/ generate code for a different
148# platform.  If you change this test, be sure to adjust
149# ../gcc/ada/gcc-interface/config-lang.in as well.
150if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
151  default_gnattools_target="gnattools-native"
152else
153  default_gnattools_target="gnattools-cross"
154fi
155AC_SUBST([default_gnattools_target])
156
157# Output: create a Makefile.
158AC_CONFIG_FILES([Makefile])
159
160AC_OUTPUT
161