OSDN Git Service

2001-07-15 Phil Edwards <pme@sources.redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / configure.in
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal, autoconf, autoheader, automake
3
4 AC_PREREQ(2.13)
5 AC_INIT(src/ios.cc)
6
7 # When building with srcdir == objdir, links to the source files will
8 # be created in directories within the target_subdir.  We have to
9 # adjust toplevel_srcdir accordingly, so that configure finds
10 # install-sh and other auxiliary files that live in the top-level
11 # source directory.
12 if test "${srcdir}" = "."; then
13   if test -z "${with_target_subdir}"; then
14     toprel=".."
15   else
16     if test "${with_target_subdir}" != "."; then
17       toprel="${with_multisrctop}../.."
18     else
19       toprel="${with_multisrctop}.."
20     fi
21   fi
22 else
23   toprel=".."
24 fi
25 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
26 toplevel_srcdir=\${top_srcdir}/$toprel
27 AC_SUBST(toplevel_srcdir)
28
29 dnl This is here just to satisfy automake.
30 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
31
32 # Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
33 # AC 2.50 sets target_alias iff the user specified --target, but we use it
34 # everywhere, so we set it here just to be sure.
35 AC_CANONICAL_SYSTEM
36 target_alias=${target_alias-$target}
37 AC_SUBST(target_alias)
38
39 # Will set LN_S to either 'ln -s' or 'ln'.  With autoconf 2.50+, can also
40 # be 'cp -p' if linking isn't available.
41 ac_cv_prog_LN_S='cp -p'
42 AC_PROG_LN_S
43
44 # We use these options to decide which functions to include.
45 AC_ARG_WITH(target-subdir,
46 [  --with-target-subdir=SUBDIR
47                            configuring in a subdirectory])
48 AC_ARG_WITH(cross-host,
49 [  --with-cross-host=HOST  configuring with a cross compiler])
50
51 # Runs configure.host and configure.target. Have to run this before
52 # the GLIBCPP_ENABLE_* macros below.
53 GLIBCPP_CONFIGURE(.)
54
55 AC_LIBTOOL_DLOPEN
56 AM_PROG_LIBTOOL
57 AC_SUBST(enable_shared)
58 AC_SUBST(enable_static)
59 GLIBCPP_CHECK_GNU_MAKE
60
61 AM_CONFIG_HEADER(config.h)
62
63 # Check for c++ or library specific bits that don't require linking.
64 GLIBCPP_CHECK_COMPILER_VERSION
65
66 # Enable all the crazy c++ stuff.  C_MBCHAR must come early.
67 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
68 GLIBCPP_ENABLE_CSTDIO
69 GLIBCPP_ENABLE_CLOCALE
70 GLIBCPP_ENABLE_C_MBCHAR([yes])
71 GLIBCPP_ENABLE_C99([yes])
72 GLIBCPP_ENABLE_LONG_LONG([yes])
73 GLIBCPP_ENABLE_CHEADERS([c_std])
74 GLIBCPP_ENABLE_THREADS
75 GLIBCPP_ENABLE_CXX_FLAGS([none])
76 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
77
78 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
79
80   # We are being configured with some form of cross compiler.
81   # mknumeric_limits may not work correctly, either because the
82   # compiler may not run on this machine, may not be able to link
83   # executables, or may produce executables we can't run on this
84   # machine.
85   GLIBCPP_IS_CROSS_COMPILING=1
86
87   # If Canadian cross, then don't pick up tools from the build
88   # directory.
89   if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
90     CANADIAN=yes
91   else
92     CANADIAN=no
93   fi
94
95   case "$target_alias" in
96     *-linux*)
97         # Construct linux crosses by hand, eliminating bits that need ld...
98         # Check for available headers.
99         AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
100         machine/endian.h machine/param.h sys/machine.h fp.h locale.h \
101         float.h inttypes.h])
102
103         # GLIBCPP_CHECK_COMPILER_FEATURES
104         SECTION_FLAGS='-ffunction-sections -fdata-sections'
105         AC_SUBST(SECTION_FLAGS)
106         GLIBCPP_CHECK_LINKER_FEATURES
107         # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
108         # GLIBCPP_CHECK_MATH_SUPPORT
109         AC_DEFINE(HAVE_ACOSF)
110         AC_DEFINE(HAVE_ASINF)
111         AC_DEFINE(HAVE_ATAN2F)
112         AC_DEFINE(HAVE_ATANF)
113         AC_DEFINE(HAVE_CEILF)
114         AC_DEFINE(HAVE_COPYSIGN)
115         AC_DEFINE(HAVE_COPYSIGNF)
116         AC_DEFINE(HAVE_COSF)
117         AC_DEFINE(HAVE_COSHF)
118         AC_DEFINE(HAVE_EXPF)
119         AC_DEFINE(HAVE_FABSF)
120         AC_DEFINE(HAVE_FINITE)
121         AC_DEFINE(HAVE_FINITEF)
122         AC_DEFINE(HAVE_FLOORF)
123         AC_DEFINE(HAVE_FMODF)
124         AC_DEFINE(HAVE_FREXPF)
125         AC_DEFINE(HAVE_ISINF)
126         AC_DEFINE(HAVE_ISINFF)
127         AC_DEFINE(HAVE_ISNAN)
128         AC_DEFINE(HAVE_ISNANF)
129         AC_DEFINE(HAVE_LDEXPF)
130         AC_DEFINE(HAVE_LOG10F)
131         AC_DEFINE(HAVE_LOGF)
132         AC_DEFINE(HAVE_MODFF)
133         AC_DEFINE(HAVE_POWF)
134         AC_DEFINE(HAVE_SINCOS)
135         AC_DEFINE(HAVE_SINCOSF)
136         AC_DEFINE(HAVE_SINF)
137         AC_DEFINE(HAVE_SINHF)
138         AC_DEFINE(HAVE_SQRTF)
139         AC_DEFINE(HAVE_TANF)
140         AC_DEFINE(HAVE_TANHF)
141
142         # At some point, we should differentiate between architectures
143         # like x86, which have long double versions, and alpha/powerpc/etc.,
144         # which don't. For the time being, punt.
145         if test x"long_double_math_on_this_cpu" = x"yes"; then
146           AC_DEFINE(HAVE_ACOSL)
147           AC_DEFINE(HAVE_ASINL)
148           AC_DEFINE(HAVE_ATAN2L)
149           AC_DEFINE(HAVE_ATANL)
150           AC_DEFINE(HAVE_CEILL)
151           AC_DEFINE(HAVE_COPYSIGNL)
152           AC_DEFINE(HAVE_COSL)
153           AC_DEFINE(HAVE_COSHL)
154           AC_DEFINE(HAVE_EXPL)
155           AC_DEFINE(HAVE_FABSL)
156           AC_DEFINE(HAVE_FINITEL)
157           AC_DEFINE(HAVE_FLOORL)
158           AC_DEFINE(HAVE_FMODL)
159           AC_DEFINE(HAVE_FREXPL)
160           AC_DEFINE(HAVE_ISINFL)
161           AC_DEFINE(HAVE_ISNANL)
162           AC_DEFINE(HAVE_LDEXPL)
163           AC_DEFINE(HAVE_LOG10L)
164           AC_DEFINE(HAVE_LOGL)
165           AC_DEFINE(HAVE_MODFL)
166           AC_DEFINE(HAVE_POWL)
167           AC_DEFINE(HAVE_SINCOSL)
168           AC_DEFINE(HAVE_SINL)
169           AC_DEFINE(HAVE_SINHL)
170           AC_DEFINE(HAVE_SQRTL)
171           AC_DEFINE(HAVE_TANL)
172           AC_DEFINE(HAVE_TANHL)
173         fi
174         GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
175         GLIBCPP_CHECK_WCHAR_T_SUPPORT
176         os_include_dir="config/os/gnu-linux"
177         # GLIBCPP_CHECK_STDLIB_SUPPORT
178         AC_DEFINE(HAVE_STRTOF)        
179         AC_DEFINE(HAVE_STRTOLD)        
180         # AC_FUNC_MMAP
181         AC_DEFINE(HAVE_MMAP)
182         ;;
183     *)
184         # We assume newlib.  This lets us hard-code the functions we know
185         # we'll have.
186         AC_DEFINE(HAVE_FINITE)
187         AC_DEFINE(HAVE_ISNAN)
188         AC_DEFINE(HAVE_ISNANF)
189         AC_DEFINE(HAVE_ISINF)
190         AC_DEFINE(HAVE_ISINFF)
191
192         os_include_dir="config/os/newlib"
193
194         # need to check for faster f versions of math functions, ie sinf?
195         ;;
196   esac
197 else
198
199   # We are being configured natively. We can do more elaborate tests
200   # that include AC_TRY_COMPILE now, as the linker is assumed to be
201   # working.
202   GLIBCPP_IS_CROSS_COMPILING=0
203   CANADIAN=no
204
205   # Check for available headers.
206   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
207   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
208
209   GLIBCPP_CHECK_COMPILER_FEATURES
210   GLIBCPP_CHECK_LINKER_FEATURES
211   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
212   GLIBCPP_CHECK_MATH_SUPPORT
213   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
214   GLIBCPP_CHECK_WCHAR_T_SUPPORT
215   GLIBCPP_CHECK_STDLIB_SUPPORT
216
217   AC_TRY_COMPILE([
218 #include <setjmp.h>
219 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
220 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])])
221
222   AC_FUNC_MMAP
223 fi
224
225 # Propagate the target-specific source directories through the build chain.
226 OS_INC_SRCDIR=$os_include_dir/bits
227 ATOMICITY_INC_SRCDIR=$ATOMICITYH/bits
228 AC_SUBST(OS_INC_SRCDIR)
229 AC_SUBST(ATOMICITY_INC_SRCDIR)
230
231 # Set up cross-compile flags
232 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
233 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
234  
235 AC_CACHE_SAVE
236 AC_LC_MESSAGES
237
238 if test "${multilib}" = "yes"; then
239   multilib_arg="--enable-multilib"
240 else
241   multilib_arg=
242 fi
243
244 # Needed so that g++ can find the correct include subdir automatically.
245 INTERFACE=v3
246
247 # Export all the install information
248 GLIBCPP_EXPORT_INSTALL_INFO
249
250 # Export all the include and flag information to makefiles.
251 GLIBCPP_EXPORT_INCLUDES
252 GLIBCPP_EXPORT_FLAGS
253
254 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
255    grep "enable shared" > /dev/null; then
256   LIBSUPCXX_PICFLAGS=-prefer-pic
257 else
258   LIBSUPCXX_PICFLAGS=
259 fi
260 AC_SUBST(LIBSUPCXX_PICFLAGS)
261
262 # Generate the various Makefiles, include files, and scripts.
263 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
264 # and libsupc++/Makefile.am so that multilib installs will end up
265 # installed in the correct place. To work around this not being passed
266 # down from config-ml.in -> top_srcdir/Makefile.am ->
267 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
268 AC_OUTPUT(Makefile \
269     include/Makefile src/Makefile \
270     libmath/Makefile libio/Makefile libsupc++/Makefile \
271     testsuite/Makefile mkcheck testsuite_flags,
272 [if test -n "$CONFIG_FILES"; then
273   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
274   grep '^MULTISUBDIR =' Makefile >> src/Makefile
275   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
276 fi
277 chmod +x mkcheck
278 chmod +x testsuite_flags
279 ],
280 srcdir=${srcdir}
281 host=${host}
282 target=${target}
283 with_multisubdir=${with_multisubdir}
284 ac_configure_args="${multilib_arg} ${ac_configure_args}"
285 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
286 glibcpp_basedir=${glibcpp_basedir}
287 CC="${CC}"
288 CXX="${CXX}"
289 )
290
291
292 # Sanity checking & User-visible messages.
293 # Checks down here, otherwise they get scrolled off before
294 # the user will notice.
295
296 # Trying to get more people to read documentation.  Possibly remove
297 # check and warn all the time. There is no "informational" AC_MSG_
298 # macro, so these are going to be printed even when --quiet/--silent
299 # is given.
300 if test ! -f stamp-sanity-warned; then
301   touch stamp-sanity-warned
302   echo ""
303   echo "Please make certain that you read the installation information here:"
304   echo "  faster => ${srcdir}/docs/install.html"
305   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
306   echo ""
307   echo "and the configuration information here:"
308   echo "  faster => ${srcdir}/docs/configopts.html"
309   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
310   echo ""
311   echo "before proceeding with ${_cv_gnu_make_command}."
312   echo ""
313 fi