OSDN Git Service

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