OSDN Git Service

2002-07-29 Aldy Hernandez <aldy@quesejoda.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 # This works around the fact that libtool configuration may change LD
8 # for this particular configuration, but some shells, instead of
9 # keeping the changes in LD private, export them just because LD is
10 # exported.  Only used at the end of this file.
11 ORIGINAL_LD_FOR_MULTILIBS=$LD
12
13 PACKAGE=libstdc++
14 AC_SUBST(PACKAGE)
15 # For libtool versioning info, format is CURRENT:REVISION:AGE
16 libtool_VERSION=5:0:0
17 AC_SUBST(libtool_VERSION)
18
19 GLIBCPP_TOPREL_CONFIGURE
20
21 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
22 #
23 # You will slowly go insane if you do not grok the following fact:  when
24 # building v3 as part of the compiler, the top-level /target/ becomes the
25 # library's /host/.  `configure' then causes --target to default to --host,
26 # exactly like any other package using autoconf.  Therefore, 'target' and
27 # 'host' will always be the same.  This makes sense both for native and
28 # cross compilers, just think about it for a little while.  :-)
29 #
30 # Also, if v3 is being configured as part of a cross compiler, the top-level
31 # configure script will pass the "real" host as $with_cross_host.
32 #
33 # AC 2.5x sets target_alias iff the user specified --target, but we use it
34 # everywhere, so we set it here just to be sure.  In AC 2.13
35 # AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
36 AC_CANONICAL_SYSTEM
37 target_alias=${target_alias-$target}
38 AC_SUBST(target_alias)
39
40 # Runs configure.target, finds CC, CXX and assorted other critical bits.
41 # Must run this before the GLIBCPP_ENABLE_* macros below.
42 GLIBCPP_CONFIGURE(.)
43
44 AM_INIT_AUTOMAKE($PACKAGE, $gcc_version)
45 AM_CONFIG_HEADER(config.h)
46
47 AC_LIBTOOL_DLOPEN
48 AM_PROG_LIBTOOL
49 AC_SUBST(enable_shared)
50 AC_SUBST(enable_static)
51
52 # Check for c++ or library specific bits that don't require linking.
53 #GLIBCPP_CHECK_COMPILER_VERSION
54 GLIBCPP_CHECK_GNU_MAKE
55
56 # Enable all the variable C++ stuff.  C_MBCHAR must come early.
57 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
58 GLIBCPP_ENABLE_CSTDIO
59 GLIBCPP_ENABLE_CLOCALE
60 GLIBCPP_ENABLE_C_MBCHAR([yes])
61 GLIBCPP_ENABLE_C99([yes])
62 GLIBCPP_ENABLE_LONG_LONG([yes])
63 GLIBCPP_ENABLE_CHEADERS([$c_model])
64 GLIBCPP_ENABLE_THREADS
65 GLIBCPP_ENABLE_CXX_FLAGS([none])
66 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
67 GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
68 GLIBCPP_ENABLE_CONCEPT_CHECKS
69
70 # Check for headers necessary for libsupc++ using dyn-string.c/cxa_demangle.c
71 AC_CHECK_HEADERS(string.h stdlib.h)
72
73 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
74
75   # We are being configured with some form of cross compiler.
76   GLIBCPP_IS_CROSS_COMPILING=1
77
78   # This lets us hard-code the functionality we know we'll have in the cross
79   # target environment.  "Let" is a sugar-coated word placed on an especially
80   # dull and tedious hack, actually.
81   #
82   # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
83   # that involve linking, can't be used:
84   #    "cannot open sim-crt0.o"
85   #    "cannot open crt0.o"
86   # etc.  All this is because there currently exists no unified, consistent
87   # way for top level CC information to be passed down to target directories:
88   # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
89   # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
90   # crosses can be removed.
91
92   # If Canadian cross, then don't pick up tools from the build directory.
93   # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
94   if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
95     CANADIAN=yes
96   else
97     CANADIAN=no
98   fi
99
100   # Construct crosses by hand, eliminating bits that need ld...
101   # GLIBCPP_CHECK_COMPILER_FEATURES
102   # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
103   # GLIBCPP_CHECK_MATH_SUPPORT
104
105   case "$target_alias" in
106     *-linux*)
107       os_include_dir="os/gnu-linux"
108       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
109         machine/endian.h machine/param.h sys/machine.h sys/types.h \
110         fp.h locale.h float.h inttypes.h])
111       SECTION_FLAGS='-ffunction-sections -fdata-sections'
112       AC_SUBST(SECTION_FLAGS)
113       GLIBCPP_CHECK_LINKER_FEATURES
114       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
115       GLIBCPP_CHECK_WCHAR_T_SUPPORT
116       AC_DEFINE(HAVE_COPYSIGN)
117       AC_DEFINE(HAVE_COPYSIGNF)
118       AC_DEFINE(HAVE_FINITE)
119       AC_DEFINE(HAVE_FINITEF)
120       AC_DEFINE(HAVE_FREXPF)
121       AC_DEFINE(HAVE_HYPOTF)
122       AC_DEFINE(HAVE_ISINF)
123       AC_DEFINE(HAVE_ISINFF)
124       AC_DEFINE(HAVE_ISNAN)
125       AC_DEFINE(HAVE_ISNANF)
126       AC_DEFINE(HAVE_SINCOS)
127       AC_DEFINE(HAVE_SINCOSF)
128       if test x"long_double_math_on_this_cpu" = x"yes"; then
129         AC_DEFINE(HAVE_FINITEL)
130         AC_DEFINE(HAVE_HYPOTL)
131         AC_DEFINE(HAVE_ISINFL)
132         AC_DEFINE(HAVE_ISNANL)
133       fi
134       ;;
135     *-hpux*)
136       # Check for available headers.
137       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
138         machine/endian.h machine/param.h sys/machine.h sys/types.h \
139         fp.h locale.h float.h inttypes.h])
140       SECTION_FLAGS='-ffunction-sections -fdata-sections'
141       AC_SUBST(SECTION_FLAGS)
142       GLIBCPP_CHECK_LINKER_FEATURES
143       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
144       GLIBCPP_CHECK_WCHAR_T_SUPPORT
145       os_include_dir="os/hpux"
146       AC_DEFINE(HAVE_COPYSIGN)
147       AC_DEFINE(HAVE_COPYSIGNF)
148       AC_DEFINE(HAVE_FREXPF)
149       AC_DEFINE(HAVE_HYPOT)
150       case "$target_alias" in
151         *-hpux10*)
152           AC_DEFINE(HAVE_FINITE)
153           AC_DEFINE(HAVE_FINITEF)
154           AC_DEFINE(HAVE_ISINF)
155           AC_DEFINE(HAVE_ISINFF)
156           AC_DEFINE(HAVE_ISNAN)
157           AC_DEFINE(HAVE_ISNANF)
158           ;;
159       esac
160
161       ;;
162     *-netbsd*)
163       # Check for available headers.
164       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
165         machine/endian.h machine/param.h sys/machine.h sys/types.h \
166         fp.h locale.h float.h inttypes.h])
167       SECTION_FLAGS='-ffunction-sections -fdata-sections'
168       AC_SUBST(SECTION_FLAGS) 
169       GLIBCPP_CHECK_LINKER_FEATURES
170       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
171       GLIBCPP_CHECK_WCHAR_T_SUPPORT
172       os_include_dir="os/bsd/netbsd"
173       AC_DEFINE(HAVE_COPYSIGN)
174       AC_DEFINE(HAVE_COPYSIGNF)
175       AC_DEFINE(HAVE_FINITEF)
176       AC_DEFINE(HAVE_FINITE)
177       AC_DEFINE(HAVE_FREXPF)
178       AC_DEFINE(HAVE_HYPOTF)
179       AC_DEFINE(HAVE_ISINF)
180       AC_DEFINE(HAVE_ISINFF)
181       AC_DEFINE(HAVE_ISNAN)
182       AC_DEFINE(HAVE_ISNANF)
183       if test x"long_double_math_on_this_cpu" = x"yes"; then
184         AC_DEFINE(HAVE_FINITEL)
185         AC_DEFINE(HAVE_ISINFL)
186         AC_DEFINE(HAVE_ISNANL)
187       fi
188       ;;
189     *-mingw32*)
190       AC_CHECK_HEADERS([sys/types.h locale.h float.h])
191       GLIBCPP_CHECK_LINKER_FEATURES
192       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
193       GLIBCPP_CHECK_WCHAR_T_SUPPORT
194       os_include_dir="os/mingw32"
195       ;;
196     *-windiss*)
197       os_include_dir="os/windiss"
198       ;;
199 changequote(,)dnl
200     *-qnx6.[12]*)
201 changequote([,])dnl
202       SECTION_FLAGS='-ffunction-sections -fdata-sections'
203       AC_SUBST(SECTION_FLAGS) 
204       GLIBCPP_CHECK_LINKER_FEATURES
205       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
206       GLIBCPP_CHECK_WCHAR_T_SUPPORT
207       os_include_dir="os/qnx/qnx6.1"
208       AC_DEFINE(HAVE_COSF)
209       AC_DEFINE(HAVE_COSL)
210       AC_DEFINE(HAVE_COSHF)
211       AC_DEFINE(HAVE_COSHL)
212       AC_DEFINE(HAVE_LOGF)
213       AC_DEFINE(HAVE_LOGL)
214       AC_DEFINE(HAVE_LOG10F)
215       AC_DEFINE(HAVE_LOG10L)
216       AC_DEFINE(HAVE_SINF)
217       AC_DEFINE(HAVE_SINL)
218       AC_DEFINE(HAVE_SINHF)
219       AC_DEFINE(HAVE_SINHL)
220       ;;
221     *)
222       os_include_dir="os/newlib"
223       AC_DEFINE(HAVE_HYPOT)
224       ;;
225   esac
226
227   case "$target_alias" in
228     *-mingw32*)
229       ;;
230     *-windiss*)
231       AC_DEFINE(HAVE_ACOSF)
232       AC_DEFINE(HAVE_ASINF)
233       AC_DEFINE(HAVE_ATAN2F)
234       AC_DEFINE(HAVE_ATANF)
235       AC_DEFINE(HAVE_CEILF)
236       AC_DEFINE(HAVE_COPYSIGN)
237       AC_DEFINE(HAVE_COPYSIGNF)
238       AC_DEFINE(HAVE_COSF)
239       AC_DEFINE(HAVE_COSHF)
240       AC_DEFINE(HAVE_EXPF)
241       AC_DEFINE(HAVE_FABSF)
242       AC_DEFINE(HAVE_FLOORF)
243       AC_DEFINE(HAVE_FMODF)
244       AC_DEFINE(HAVE_FREXPF)
245       AC_DEFINE(HAVE_LDEXPF)
246       AC_DEFINE(HAVE_LOG10F)
247       AC_DEFINE(HAVE_LOGF)
248       AC_DEFINE(HAVE_MODFF)
249       AC_DEFINE(HAVE_POWF)
250       AC_DEFINE(HAVE_SINF)
251       AC_DEFINE(HAVE_SINHF)
252       AC_DEFINE(HAVE_SQRTF)
253       AC_DEFINE(HAVE_TANF)
254       AC_DEFINE(HAVE_TANHF)
255       ;;
256     *)
257       # GLIBCPP_CHECK_STDLIB_SUPPORT
258       AC_DEFINE(HAVE_STRTOF)        
259       AC_DEFINE(HAVE_STRTOLD)        
260       # AC_FUNC_MMAP
261       AC_DEFINE(HAVE_MMAP)
262
263       AC_DEFINE(HAVE_ACOSF)
264       AC_DEFINE(HAVE_ASINF)
265       AC_DEFINE(HAVE_ATAN2F)
266       AC_DEFINE(HAVE_ATANF)
267       AC_DEFINE(HAVE_CEILF)
268       AC_DEFINE(HAVE_COPYSIGN)
269       AC_DEFINE(HAVE_COPYSIGNF)
270       AC_DEFINE(HAVE_COSF)
271       AC_DEFINE(HAVE_COSHF)
272       AC_DEFINE(HAVE_EXPF)
273       AC_DEFINE(HAVE_FABSF)
274       AC_DEFINE(HAVE_FLOORF)
275       AC_DEFINE(HAVE_FMODF)
276       AC_DEFINE(HAVE_FREXPF)
277       AC_DEFINE(HAVE_LDEXPF)
278       AC_DEFINE(HAVE_LOG10F)
279       AC_DEFINE(HAVE_LOGF)
280       AC_DEFINE(HAVE_MODFF)
281       AC_DEFINE(HAVE_POWF)
282       AC_DEFINE(HAVE_SINF)
283       AC_DEFINE(HAVE_SINHF)
284       AC_DEFINE(HAVE_SQRTF)
285       AC_DEFINE(HAVE_TANF)
286       AC_DEFINE(HAVE_TANHF)
287       ;;
288   esac
289
290   # At some point, we should differentiate between architectures
291   # like x86, which have long double versions, and alpha/powerpc/etc.,
292   # which don't. For the time being, punt.
293   if test x"long_double_math_on_this_cpu" = x"yes"; then
294     AC_DEFINE(HAVE_ACOSL)
295     AC_DEFINE(HAVE_ASINL)
296     AC_DEFINE(HAVE_ATAN2L)
297     AC_DEFINE(HAVE_ATANL)
298     AC_DEFINE(HAVE_CEILL)
299     AC_DEFINE(HAVE_COPYSIGNL)
300     AC_DEFINE(HAVE_COSL)
301     AC_DEFINE(HAVE_COSHL)
302     AC_DEFINE(HAVE_EXPL)
303     AC_DEFINE(HAVE_FABSL)
304     AC_DEFINE(HAVE_FLOORL)
305     AC_DEFINE(HAVE_FMODL)
306     AC_DEFINE(HAVE_FREXPL)
307     AC_DEFINE(HAVE_LDEXPL)
308     AC_DEFINE(HAVE_LOG10L)
309     AC_DEFINE(HAVE_LOGL)
310     AC_DEFINE(HAVE_MODFL)
311     AC_DEFINE(HAVE_POWL)
312     AC_DEFINE(HAVE_SINCOSL)
313     AC_DEFINE(HAVE_SINL)
314     AC_DEFINE(HAVE_SINHL)
315     AC_DEFINE(HAVE_SQRTL)
316     AC_DEFINE(HAVE_TANL)
317     AC_DEFINE(HAVE_TANHL)
318   fi
319
320 else
321
322   # We are being configured natively. We can do more elaborate tests
323   # that include AC_TRY_COMPILE now, as the linker is assumed to be
324   # working.
325   GLIBCPP_IS_CROSS_COMPILING=0
326   CANADIAN=no
327
328   # Check for available headers.
329   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
330   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
331
332   GLIBCPP_CHECK_COMPILER_FEATURES
333   GLIBCPP_CHECK_LINKER_FEATURES
334   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
335   GLIBCPP_CHECK_MATH_SUPPORT
336   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
337   GLIBCPP_CHECK_WCHAR_T_SUPPORT
338   GLIBCPP_CHECK_STDLIB_SUPPORT
339   AC_LC_MESSAGES
340
341   AC_TRY_COMPILE([
342   #include <setjmp.h>
343   ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
344   [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])
345   ])
346
347   AC_FUNC_MMAP
348
349   # Establish limits on memory usage during 'make check'
350   GLIBCPP_CONFIGURE_TESTSUITE
351 fi
352
353 # This depends on the possibly-skipped linker test above.
354 GLIBCPP_ENABLE_SYMVERS([yes])
355
356 # Propagate the target-specific source directories through the build chain.
357 # (Nothing currently uses cpu_include_dir directly; only ATOMICITYH and
358 # CPULIMITSH [might] use it, and they only get used here.)
359 OS_INC_SRCDIR=config/${os_include_dir}
360 ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
361 CPU_LIMITS_INC_SRCDIR=config/${CPULIMITSH}
362 AC_SUBST(OS_INC_SRCDIR)
363 AC_SUBST(ATOMICITY_INC_SRCDIR)
364 AC_SUBST(CPU_LIMITS_INC_SRCDIR)
365
366 # Set up cross-compile flags
367 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)  dnl Unused so far.
368 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
369  
370 AC_CACHE_SAVE
371
372 if test "${multilib}" = "yes"; then
373   multilib_arg="--enable-multilib"
374 else
375   multilib_arg=
376 fi
377
378 # Export all the install information
379 GLIBCPP_EXPORT_INSTALL_INFO
380
381 # Export all the include and flag information to makefiles.
382 GLIBCPP_EXPORT_INCLUDES
383 GLIBCPP_EXPORT_FLAGS
384
385 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
386    grep "enable shared" > /dev/null; then
387   LIBSUPCXX_PICFLAGS=-prefer-pic
388 else
389   LIBSUPCXX_PICFLAGS=
390 fi
391 AC_SUBST(LIBSUPCXX_PICFLAGS)
392
393 # Generate the various Makefiles, include files, and scripts.
394 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
395 # and libsupc++/Makefile.am so that multilib installs will end up
396 # installed in the correct place. To work around this not being passed
397 # down from config-ml.in -> top_srcdir/Makefile.am ->
398 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
399 AC_OUTPUT(Makefile \
400     include/Makefile src/Makefile \
401     libmath/Makefile libio/Makefile libsupc++/Makefile \
402     po/Makefile testsuite/Makefile mkcheck testsuite_flags,
403 [if test -n "$CONFIG_FILES"; then
404   LD="${ORIGINAL_LD_FOR_MULTILIBS}"
405   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
406   grep '^MULTISUBDIR =' Makefile >> src/Makefile
407   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
408 fi
409 chmod +x mkcheck
410 chmod +x testsuite_flags
411 ],
412 srcdir=${srcdir}
413 host=${host}
414 target=${target}
415 with_multisubdir=${with_multisubdir}
416 ac_configure_args="${multilib_arg} ${ac_configure_args}"
417 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
418 glibcpp_basedir=${glibcpp_basedir}
419 CC="${CC}"
420 CXX="${CXX}"
421 )
422 dnl  In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
423 dnl  AC_CONFIG_FILES(Makefile \
424 dnl      include/Makefile src/Makefile \
425 dnl      libmath/Makefile libio/Makefile libsupc++/Makefile \
426 dnl      po/Makefile testsuite/Makefile mkcheck testsuite_flags)
427 dnl  AC_CONFIG_COMMANDS([default],
428 dnl  [if test -n "$CONFIG_FILES"; then
429 dnl    ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
430 dnl    grep '^MULTISUBDIR =' Makefile >> src/Makefile
431 dnl    grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
432 dnl  fi
433 dnl  chmod +x mkcheck
434 dnl  chmod +x testsuite_flags
435 dnl  ],
436 dnl  srcdir=${srcdir}
437 dnl  host=${host}
438 dnl  target=${target}
439 dnl  with_multisubdir=${with_multisubdir}
440 dnl  ac_configure_args="${multilib_arg} ${ac_configure_args}"
441 dnl  CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
442 dnl  glibcpp_basedir=${glibcpp_basedir}
443 dnl  CC="${CC}"
444 dnl  CXX="${CXX}"
445 dnl  )
446 dnl  AC_OUTPUT
447
448
449 # Sanity checking & User-visible messages.
450 # Checks down here, otherwise they get scrolled off before
451 # the user will notice.
452
453 # Trying to get more people to read documentation.  Possibly remove
454 # check and warn all the time. There is no "informational" AC_MSG_
455 # macro, so these are going to be printed even when --quiet/--silent
456 # is given.
457 if test ! -f stamp-sanity-warned; then
458   touch stamp-sanity-warned
459   echo ""
460   echo "Please make certain that you read the installation information here:"
461   echo "  faster => ${srcdir}/docs/html/install.html"
462   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
463   echo ""
464   echo "and the configuration information here:"
465   echo "  faster => ${srcdir}/docs/html/configopts.html"
466   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
467   echo ""
468   echo "before proceeding with ${_cv_gnu_make_command}."
469   echo ""
470 fi