OSDN Git Service

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