OSDN Git Service

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