]> git.ipfire.org Git - thirdparty/gcc.git/blame - libf2c/aclocal.m4
configure.in: Avoid trailing /.
[thirdparty/gcc.git] / libf2c / aclocal.m4
CommitLineData
1e6347d8 1dnl Copyright (C) 1994, 1995-8, 1999, 2001, 2002 Free Software Foundation, Inc.
ceb5e20f
GK
2dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved.
5
6dnl This program is distributed in the hope that it will be useful,
7dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
8dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9dnl PARTICULAR PURPOSE.
10
11dnl
12dnl Initialize configure bits.
13dnl
aebb8c22
DD
14dnl GLIBCPP_TOPREL_CONFIGURE
15AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [
ceb5e20f
GK
16 dnl Default to --enable-multilib
17 AC_ARG_ENABLE(multilib,
18 [ --enable-multilib build hella library versions (default)],
19 [case "${enableval}" in
20 yes) multilib=yes ;;
21 no) multilib=no ;;
22 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
23 esac], [multilib=yes])dnl
24
25# When building with srcdir == objdir, links to the source files will
26# be created in directories within the target_subdir. We have to
27# adjust toplevel_srcdir accordingly, so that configure finds
28# install-sh and other auxiliary files that live in the top-level
29# source directory.
30if test "${srcdir}" = "."; then
31 if test -z "${with_target_subdir}"; then
32 toprel=".."
33 else
34 if test "${with_target_subdir}" != "."; then
35 toprel="${with_multisrctop}../.."
36 else
37 toprel="${with_multisrctop}.."
38 fi
39 fi
40else
41 toprel=".."
42fi
43AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
44toplevel_srcdir=\${top_srcdir}/$toprel
45AC_SUBST(toplevel_srcdir)
aebb8c22 46])
ceb5e20f 47
aebb8c22
DD
48dnl
49dnl Initialize configure bits.
50dnl
51dnl GLIBCPP_CONFIGURE
52AC_DEFUN(GLIBCPP_CONFIGURE, [
ceb5e20f
GK
53# Export build and source directories.
54# These need to be absolute paths, yet at the same time need to
55# canonicalize only relative paths, because then amd will not unmount
56# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
1e6347d8 57glibcpp_builddir=`${PWDCMD-pwd}`
ceb5e20f
GK
58case $srcdir in
59[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
60*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
61esac
62AC_SUBST(glibcpp_builddir)
63AC_SUBST(glibcpp_srcdir)
64
65dnl This is here just to satisfy automake.
66ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
67
68# Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
69# be 'cp -p' if linking isn't available.
70#ac_cv_prog_LN_S='cp -p'
71AC_PROG_LN_S
72
73# We use these options to decide which functions to include.
74AC_ARG_WITH(target-subdir,
75[ --with-target-subdir=SUBDIR
76 configuring in a subdirectory])
77AC_ARG_WITH(cross-host,
78[ --with-cross-host=HOST configuring with a cross compiler])
79
80 # Never versions of autoconf add an underscore to these functions.
81 # Prevent future problems ...
82 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
83 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
84 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
85 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
86
87# AC_PROG_CC
88
89# FIXME: We temporarily define our own version of AC_PROG_CC. This is
90# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
91# are probably using a cross compiler, which will not be able to fully
92# link an executable. This should really be fixed in autoconf
93# itself.
94
95AC_DEFUN(LIB_AC_PROG_CC,
96[AC_BEFORE([$0], [AC_PROG_CPP])dnl
97dnl Fool anybody using AC_PROG_CC.
98AC_PROVIDE([AC_PROG_CC])
99AC_CHECK_PROG(CC, gcc, gcc)
100if test -z "$CC"; then
101 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
102 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
103fi
104
105AC_PROG_CC_GNU
106
107if test $ac_cv_prog_gcc = yes; then
108 GCC=yes
109dnl Check whether -g works, even if CFLAGS is set, in case the package
110dnl plays around with CFLAGS (such as to build both debugging and
111dnl normal versions of a library), tasteless as that idea is.
112 ac_test_CFLAGS="${CFLAGS+set}"
113 ac_save_CFLAGS="$CFLAGS"
114 CFLAGS=
115 AC_PROG_CC_G
116 if test "$ac_test_CFLAGS" = set; then
117 CFLAGS="$ac_save_CFLAGS"
118 elif test $ac_cv_prog_cc_g = yes; then
119 CFLAGS="-g -O2"
120 else
121 CFLAGS="-O2"
122 fi
123else
124 GCC=
125 test "${CFLAGS+set}" = set || CFLAGS="-g"
126fi
127])
128
129LIB_AC_PROG_CC
130
131 AC_CHECK_TOOL(AS, as)
132 AC_CHECK_TOOL(AR, ar)
133 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
134 AC_PROG_INSTALL
135
136 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
137 # at least currently, we never actually build a program, so we never
138 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
139 # fails, because we are probably configuring with a cross compiler
140 # which can't create executables. So we include AC_EXEEXT to keep
141 # automake happy, but we don't execute it, since we don't care about
142 # the result.
143 if false; then
144 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
145 # to nothing, so nothing would remain between `then' and `fi' if it
146 # were not for the `:' below.
147 :
148 AC_EXEEXT
149 fi
150])
151
152
153dnl
154dnl GLIBCPP_EXPORT_INSTALL_INFO
155dnl calculates gxx_install_dir
156dnl exports glibcpp_toolexecdir
157dnl exports glibcpp_toolexeclibdir
158dnl exports glibcpp_prefixdir
159dnl
160dnl Assumes cross_compiling bits already done, and with_cross_host in
161dnl particular
162dnl
163dnl GLIBCPP_EXPORT_INSTALL_INFO
164AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
165# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
166# exported correctly in GLIBCPP_CONFIGURE.
167glibcpp_toolexecdir=no
168glibcpp_toolexeclibdir=no
169glibcpp_prefixdir=${prefix}
170
171AC_MSG_CHECKING([for interface version number])
172libstdcxx_interface=$INTERFACE
173AC_MSG_RESULT($libstdcxx_interface)
174
175# Process the option "--enable-version-specific-runtime-libs"
176AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
177AC_ARG_ENABLE(version-specific-runtime-libs,
178[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
179[case "$enableval" in
180 yes) version_specific_libs=yes ;;
181 no) version_specific_libs=no ;;
182 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
183 esac],
184version_specific_libs=no)dnl
185# Option set, now we can test it.
186AC_MSG_RESULT($version_specific_libs)
187
a2b3412c 188gcc_version_trigger=${toplevel_srcdir}/gcc/version.c
ceb5e20f
GK
189gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
190gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
191AC_SUBST(gcc_version)
192AC_SUBST(gcc_version_trigger)
193
194if test $version_specific_libs = yes; then
195 # Need the gcc compiler version to know where to install libraries
196 # and header files if --enable-version-specific-runtime-libs option
197 # is selected.
198 changequote(,)dnl
199 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
200 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
201 changequote([,])dnl
202fi
203
204# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
205# Install a library built with a cross compiler in tooldir, not libdir.
206if test x"$glibcpp_toolexecdir" = x"no"; then
207 if test -n "$with_cross_host" &&
208 test x"$with_cross_host" != x"no"; then
209 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
233888d3 210 glibcpp_toolexeclibdir='$(toolexecdir)/lib'
ceb5e20f
GK
211 else
212 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
233888d3 213 glibcpp_toolexeclibdir='$(libdir)'
ceb5e20f 214 fi
ff8b9ca8
AS
215 multi_os_directory=`$CC -print-multi-os-directory`
216 case $multi_os_directory in
217 .) ;; # Avoid trailing /.
218 *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
219 esac
ceb5e20f
GK
220fi
221
222AC_SUBST(glibcpp_prefixdir)
223AC_SUBST(glibcpp_toolexecdir)
224AC_SUBST(glibcpp_toolexeclibdir)
225])
226
dedc4a53
JP
227sinclude(../libtool.m4)
228dnl The lines below arrange for aclocal not to bring an installed
229dnl libtool.m4 into aclocal.m4, while still arranging for automake to
230dnl add a definition of LIBTOOL to Makefile.in.
231ifelse(,,,[AC_SUBST(LIBTOOL)
232AC_DEFUN([AM_PROG_LIBTOOL])
ceb5e20f
GK
233AC_DEFUN([AC_LIBTOOL_DLOPEN])
234AC_DEFUN([AC_PROG_LD])
dedc4a53 235])