OSDN Git Service

2002-02-21 Benjamin Kosnik <bkoz@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 GLIBCPP_ENABLE_CONCEPT_CHECKS
52
53
54 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
55
56   # This lets us hard-code the functionality we know
57   # we'll have in the cross target environment. "Let" is a
58   # sugar-coated word placed on an especially dull and tedious hack, actually.
59   # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
60   # that involve linking can't be used:
61   # "cannot open sim-crt0.o"
62   # "cannot open crt0.o"
63   # etc. All this is because there currently exists no unified,
64   # consistent way for top level CC information to be passed down
65   # to target directories: newlib includes, newlib linking info,
66   # libgloss versus newlib crt0.o, etc. When all of this is done, all
67   # of this hokey, excessive AC_DEFINE junk for crosses can be removed.
68
69   # We are being configured with some form of cross compiler.
70   GLIBCPP_IS_CROSS_COMPILING=1
71
72   # If Canadian cross, then don't pick up tools from the build
73   # directory.
74   if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
75     CANADIAN=yes
76   else
77     CANADIAN=no
78   fi
79
80   # Construct crosses by hand, eliminating bits that need ld...
81   # GLIBCPP_CHECK_COMPILER_FEATURES
82   # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
83   # GLIBCPP_CHECK_MATH_SUPPORT
84
85   case "$target_alias" in
86     *-linux*)
87       # Check for available headers.
88       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
89         machine/endian.h machine/param.h sys/machine.h sys/types.h \
90         fp.h locale.h float.h inttypes.h])
91       SECTION_FLAGS='-ffunction-sections -fdata-sections'
92       AC_SUBST(SECTION_FLAGS)
93       GLIBCPP_CHECK_LINKER_FEATURES
94       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
95       GLIBCPP_CHECK_WCHAR_T_SUPPORT
96       os_include_dir="config/os/gnu-linux"
97       AC_DEFINE(HAVE_COPYSIGN)
98       AC_DEFINE(HAVE_COPYSIGNF)
99       AC_DEFINE(HAVE_FINITEF)
100       AC_DEFINE(HAVE_FREXPF)
101       AC_DEFINE(HAVE_HYPOTF)
102       AC_DEFINE(HAVE_SINCOS)
103       AC_DEFINE(HAVE_SINCOSF)
104       if test x"long_double_math_on_this_cpu" = x"yes"; then
105         AC_DEFINE(HAVE_HYPOTL)
106       fi
107       ;;
108     *-hpux*)
109       # Check for available headers.
110       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
111         machine/endian.h machine/param.h sys/machine.h sys/types.h \
112         fp.h locale.h float.h inttypes.h])
113       SECTION_FLAGS='-ffunction-sections -fdata-sections'
114       AC_SUBST(SECTION_FLAGS)
115       GLIBCPP_CHECK_LINKER_FEATURES
116       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
117       GLIBCPP_CHECK_WCHAR_T_SUPPORT
118       os_include_dir="config/os/hpux"
119       AC_DEFINE(HAVE_COPYSIGN)
120       AC_DEFINE(HAVE_COPYSIGNF)
121       AC_DEFINE(HAVE_FINITEF)
122       AC_DEFINE(HAVE_FREXPF)
123       AC_DEFINE(HAVE_HYPOT)
124       AC_DEFINE(HAVE_SINCOS)
125       AC_DEFINE(HAVE_SINCOSF)
126       ;;
127     *-netbsd*)
128       # Check for available headers.
129       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
130         machine/endian.h machine/param.h sys/machine.h sys/types.h \
131         fp.h locale.h float.h inttypes.h])
132       SECTION_FLAGS='-ffunction-sections -fdata-sections'
133       AC_SUBST(SECTION_FLAGS) 
134       GLIBCPP_CHECK_LINKER_FEATURES
135       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
136       GLIBCPP_CHECK_WCHAR_T_SUPPORT
137       os_include_dir="config/os/bsd/netbsd"
138       AC_DEFINE(HAVE_COPYSIGN)
139       AC_DEFINE(HAVE_COPYSIGNF)
140       AC_DEFINE(HAVE_FINITEF)
141       AC_DEFINE(HAVE_FREXPF)
142       AC_DEFINE(HAVE_HYPOTF)
143       ;;
144     *)
145       os_include_dir="config/os/newlib"
146       AC_DEFINE(HAVE_HYPOT)
147       ;;
148   esac
149
150   # GLIBCPP_CHECK_STDLIB_SUPPORT
151   AC_DEFINE(HAVE_STRTOF)        
152   AC_DEFINE(HAVE_STRTOLD)        
153   # AC_FUNC_MMAP
154   AC_DEFINE(HAVE_MMAP)
155
156   AC_DEFINE(HAVE_ACOSF)
157   AC_DEFINE(HAVE_ASINF)
158   AC_DEFINE(HAVE_ATAN2F)
159   AC_DEFINE(HAVE_ATANF)
160   AC_DEFINE(HAVE_CEILF)
161   AC_DEFINE(HAVE_COPYSIGN)
162   AC_DEFINE(HAVE_COPYSIGNF)
163   AC_DEFINE(HAVE_COSF)
164   AC_DEFINE(HAVE_COSHF)
165   AC_DEFINE(HAVE_EXPF)
166   AC_DEFINE(HAVE_FABSF)
167   AC_DEFINE(HAVE_FINITE)
168   AC_DEFINE(HAVE_FINITEF)
169   AC_DEFINE(HAVE_FLOORF)
170   AC_DEFINE(HAVE_FMODF)
171   AC_DEFINE(HAVE_FREXPF)
172   AC_DEFINE(HAVE_ISINF)
173   AC_DEFINE(HAVE_ISINFF)
174   AC_DEFINE(HAVE_ISNAN)
175   AC_DEFINE(HAVE_ISNANF)
176   AC_DEFINE(HAVE_LDEXPF)
177   AC_DEFINE(HAVE_LOG10F)
178   AC_DEFINE(HAVE_LOGF)
179   AC_DEFINE(HAVE_MODFF)
180   AC_DEFINE(HAVE_POWF)
181   AC_DEFINE(HAVE_SINF)
182   AC_DEFINE(HAVE_SINHF)
183   AC_DEFINE(HAVE_SQRTF)
184   AC_DEFINE(HAVE_TANF)
185   AC_DEFINE(HAVE_TANHF)
186
187   # At some point, we should differentiate between architectures
188   # like x86, which have long double versions, and alpha/powerpc/etc.,
189   # which don't. For the time being, punt.
190   if test x"long_double_math_on_this_cpu" = x"yes"; then
191     AC_DEFINE(HAVE_ACOSL)
192     AC_DEFINE(HAVE_ASINL)
193     AC_DEFINE(HAVE_ATAN2L)
194     AC_DEFINE(HAVE_ATANL)
195     AC_DEFINE(HAVE_CEILL)
196     AC_DEFINE(HAVE_COPYSIGNL)
197     AC_DEFINE(HAVE_COSL)
198     AC_DEFINE(HAVE_COSHL)
199     AC_DEFINE(HAVE_EXPL)
200     AC_DEFINE(HAVE_FABSL)
201     AC_DEFINE(HAVE_FINITEL)
202     AC_DEFINE(HAVE_FLOORL)
203     AC_DEFINE(HAVE_FMODL)
204     AC_DEFINE(HAVE_FREXPL)
205     AC_DEFINE(HAVE_ISINFL)
206     AC_DEFINE(HAVE_ISNANL)
207     AC_DEFINE(HAVE_LDEXPL)
208     AC_DEFINE(HAVE_LOG10L)
209     AC_DEFINE(HAVE_LOGL)
210     AC_DEFINE(HAVE_MODFL)
211     AC_DEFINE(HAVE_POWL)
212     AC_DEFINE(HAVE_SINCOSL)
213     AC_DEFINE(HAVE_SINL)
214     AC_DEFINE(HAVE_SINHL)
215     AC_DEFINE(HAVE_SQRTL)
216     AC_DEFINE(HAVE_TANL)
217     AC_DEFINE(HAVE_TANHL)
218   fi
219 else
220
221   # We are being configured natively. We can do more elaborate tests
222   # that include AC_TRY_COMPILE now, as the linker is assumed to be
223   # working.
224   GLIBCPP_IS_CROSS_COMPILING=0
225   CANADIAN=no
226
227   # Check for available headers.
228   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
229   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
230
231   GLIBCPP_CHECK_COMPILER_FEATURES
232   GLIBCPP_CHECK_LINKER_FEATURES
233   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
234   GLIBCPP_CHECK_MATH_SUPPORT
235   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
236   GLIBCPP_CHECK_WCHAR_T_SUPPORT
237   GLIBCPP_CHECK_STDLIB_SUPPORT
238   AC_LC_MESSAGES
239
240   AC_TRY_COMPILE([
241   #include <setjmp.h>
242   ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
243   [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])
244   ])
245
246   AC_FUNC_MMAP
247
248   # Establish limits on memory usage during 'make check'
249   GLIBCPP_CONFIGURE_TESTSUITE
250 fi
251
252 # This depends on the possibly-skipped linker test above.
253 GLIBCPP_ENABLE_SYMVERS([yes])
254
255 # Propagate the target-specific source directories through the build chain.
256 OS_INC_SRCDIR=$os_include_dir/bits
257 ATOMICITY_INC_SRCDIR=$ATOMICITYH/bits
258 CPU_LIMITS_INC_SRCDIR=$CPULIMITSH/bits
259 AC_SUBST(OS_INC_SRCDIR)
260 AC_SUBST(ATOMICITY_INC_SRCDIR)
261 AC_SUBST(CPU_LIMITS_INC_SRCDIR)
262
263 # Set up cross-compile flags
264 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
265 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
266  
267 AC_CACHE_SAVE
268
269 if test "${multilib}" = "yes"; then
270   multilib_arg="--enable-multilib"
271 else
272   multilib_arg=
273 fi
274
275 # Needed so that g++ can find the correct include subdir automatically.
276 INTERFACE=v3
277
278 # Export all the install information
279 GLIBCPP_EXPORT_INSTALL_INFO
280
281 # Export all the include and flag information to makefiles.
282 GLIBCPP_EXPORT_INCLUDES
283 GLIBCPP_EXPORT_FLAGS
284
285 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
286    grep "enable shared" > /dev/null; then
287   LIBSUPCXX_PICFLAGS=-prefer-pic
288 else
289   LIBSUPCXX_PICFLAGS=
290 fi
291 AC_SUBST(LIBSUPCXX_PICFLAGS)
292
293 # Generate the various Makefiles, include files, and scripts.
294 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
295 # and libsupc++/Makefile.am so that multilib installs will end up
296 # installed in the correct place. To work around this not being passed
297 # down from config-ml.in -> top_srcdir/Makefile.am ->
298 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
299 AC_OUTPUT(Makefile \
300     include/Makefile src/Makefile \
301     libmath/Makefile libio/Makefile libsupc++/Makefile \
302     po/Makefile testsuite/Makefile mkcheck testsuite_flags,
303 [if test -n "$CONFIG_FILES"; then
304   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
305   grep '^MULTISUBDIR =' Makefile >> src/Makefile
306   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
307 fi
308 chmod +x mkcheck
309 chmod +x testsuite_flags
310 ],
311 srcdir=${srcdir}
312 host=${host}
313 target=${target}
314 with_multisubdir=${with_multisubdir}
315 ac_configure_args="${multilib_arg} ${ac_configure_args}"
316 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
317 glibcpp_basedir=${glibcpp_basedir}
318 CC="${CC}"
319 CXX="${CXX}"
320 )
321
322
323 # Sanity checking & User-visible messages.
324 # Checks down here, otherwise they get scrolled off before
325 # the user will notice.
326
327 # Trying to get more people to read documentation.  Possibly remove
328 # check and warn all the time. There is no "informational" AC_MSG_
329 # macro, so these are going to be printed even when --quiet/--silent
330 # is given.
331 if test ! -f stamp-sanity-warned; then
332   touch stamp-sanity-warned
333   echo ""
334   echo "Please make certain that you read the installation information here:"
335   echo "  faster => ${srcdir}/docs/install.html"
336   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
337   echo ""
338   echo "and the configuration information here:"
339   echo "  faster => ${srcdir}/docs/configopts.html"
340   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
341   echo ""
342   echo "before proceeding with ${_cv_gnu_make_command}."
343   echo ""
344 fi