1# Copyright (c) 1995, 1996 Cygnus Support
2#
3# The authors hereby grant permission to use, copy, modify, distribute,
4# and license this software and its documentation for any purpose, provided
5# that existing copyright notices are retained in all copies and that this
6# notice is included verbatim in any distributions. No written agreement,
7# license, or royalty fee is required for any of the authorized uses.
8# Modifications to this software may be copyrighted by their authors
9# and need not follow the licensing terms described here, provided that
10# the new terms are clearly indicated on the first page of each file where
11# they apply.
12#
13# process this file with autoconf to produce a configure script.
14AC_PREREQ(2.5)dnl
15AC_INIT(crt0.S)
16
17if test "${enable_shared}" = "yes" ; then
18    echo "Shared libraries not supported for cross compiling, ignored"
19fi
20
21if test "$srcdir" = "." ; then
22  if test "${with_target_subdir}" != "." ; then
23    libgloss_topdir="${with_multisrctop}../../.."
24  else
25    libgloss_topdir="${with_multisrctop}../.."
26  fi
27else
28  libgloss_topdir="${srcdir}/../.."
29fi
30
31AC_CONFIG_AUX_DIR($libgloss_topdir)
32AC_CANONICAL_SYSTEM
33AC_ARG_PROGRAM
34
35AC_PROG_INSTALL
36
37# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
38# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
39# are probably using a cross compiler, which will not be able to fully
40# link an executable.  This should really be fixed in autoconf
41# itself.
42
43AC_DEFUN(LIB_AC_PROG_CC,
44[AC_BEFORE([$0], [AC_PROG_CPP])dnl
45AC_CHECK_PROG(CC, gcc, gcc)
46if test -z "$CC"; then
47  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
48  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
49fi
50
51AC_PROG_CC_GNU
52
53if test $ac_cv_prog_gcc = yes; then
54  GCC=yes
55dnl Check whether -g works, even if CFLAGS is set, in case the package
56dnl plays around with CFLAGS (such as to build both debugging and
57dnl normal versions of a library), tasteless as that idea is.
58  ac_test_CFLAGS="${CFLAGS+set}"
59  ac_save_CFLAGS="$CFLAGS"
60  CFLAGS=
61  AC_PROG_CC_G
62  if test "$ac_test_CFLAGS" = set; then
63    CFLAGS="$ac_save_CFLAGS"
64  elif test $ac_cv_prog_cc_g = yes; then
65    CFLAGS="-g -O2"
66  else
67    CFLAGS="-O2"
68  fi
69else
70  GCC=
71  test "${CFLAGS+set}" = set || CFLAGS="-g"
72fi
73])
74
75LIB_AC_PROG_CC
76
77AS=${AS-as}
78AC_SUBST(AS)
79AR=${AR-ar}
80AC_SUBST(AR)
81LD=${LD-ld}
82AC_SUBST(LD)
83AC_PROG_RANLIB
84
85host_makefile_frag=${srcdir}/../config/default.mh
86target_makefile_frag=${srcdir}/../config/default.mt
87
88dnl We have to assign the same value to other variables because autoconf
89dnl doesn't provide a mechanism to substitute a replacement keyword with
90dnl arbitrary data or pathnames.
91dnl
92host_makefile_frag_path=$host_makefile_frag
93AC_SUBST(host_makefile_frag_path)
94AC_SUBST_FILE(host_makefile_frag)
95target_makefile_frag_path=$target_makefile_frag
96AC_SUBST(target_makefile_frag_path)
97AC_SUBST_FILE(target_makefile_frag)
98
99AC_OUTPUT(Makefile,
100. ${libgloss_topdir}/config-ml.in,
101srcdir=${srcdir}
102target=${target}
103ac_configure_args="${ac_configure_args} --enable-multilib"
104CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
105libgloss_topdir=${libgloss_topdir}
106)
107
108