OSDN Git Service

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