OSDN Git Service

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