OSDN Git Service

2002-06-18 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_std])
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_FINITEF)
120       AC_DEFINE(HAVE_FREXPF)
121       AC_DEFINE(HAVE_HYPOTF)
122       AC_DEFINE(HAVE_SINCOS)
123       AC_DEFINE(HAVE_SINCOSF)
124       if test x"long_double_math_on_this_cpu" = x"yes"; then
125         AC_DEFINE(HAVE_HYPOTL)
126       fi
127       ;;
128     *-hpux*)
129       # Check for available headers.
130       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
131         machine/endian.h machine/param.h sys/machine.h sys/types.h \
132         fp.h locale.h float.h inttypes.h])
133       SECTION_FLAGS='-ffunction-sections -fdata-sections'
134       AC_SUBST(SECTION_FLAGS)
135       GLIBCPP_CHECK_LINKER_FEATURES
136       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
137       GLIBCPP_CHECK_WCHAR_T_SUPPORT
138       os_include_dir="os/hpux"
139       AC_DEFINE(HAVE_COPYSIGN)
140       AC_DEFINE(HAVE_COPYSIGNF)
141       AC_DEFINE(HAVE_FINITEF)
142       AC_DEFINE(HAVE_FREXPF)
143       AC_DEFINE(HAVE_HYPOT)
144       AC_DEFINE(HAVE_SINCOS)
145       AC_DEFINE(HAVE_SINCOSF)
146       ;;
147     *-netbsd*)
148       # Check for available headers.
149       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
150         machine/endian.h machine/param.h sys/machine.h sys/types.h \
151         fp.h locale.h float.h inttypes.h])
152       SECTION_FLAGS='-ffunction-sections -fdata-sections'
153       AC_SUBST(SECTION_FLAGS) 
154       GLIBCPP_CHECK_LINKER_FEATURES
155       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
156       GLIBCPP_CHECK_WCHAR_T_SUPPORT
157       os_include_dir="os/bsd/netbsd"
158       AC_DEFINE(HAVE_COPYSIGN)
159       AC_DEFINE(HAVE_COPYSIGNF)
160       AC_DEFINE(HAVE_FINITEF)
161       AC_DEFINE(HAVE_FREXPF)
162       AC_DEFINE(HAVE_HYPOTF)
163       ;;
164     *-mingw32*)
165       AC_CHECK_HEADERS([sys/types.h locale.h float.h])
166       GLIBCPP_CHECK_LINKER_FEATURES
167       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
168       GLIBCPP_CHECK_WCHAR_T_SUPPORT
169       os_include_dir="os/mingw32"
170       ;;
171     *-windiss*)
172       os_include_dir="os/windiss"
173       ;;
174 changequote(,)dnl
175     *-qnx6.[12]*)
176 changequote([,])dnl
177       SECTION_FLAGS='-ffunction-sections -fdata-sections'
178       AC_SUBST(SECTION_FLAGS) 
179       GLIBCPP_CHECK_LINKER_FEATURES
180       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
181       GLIBCPP_CHECK_WCHAR_T_SUPPORT
182       os_include_dir="os/qnx/qnx6.1"
183       AC_DEFINE(HAVE_COSF)
184       AC_DEFINE(HAVE_COSL)
185       AC_DEFINE(HAVE_COSHF)
186       AC_DEFINE(HAVE_COSHL)
187       AC_DEFINE(HAVE_LOGF)
188       AC_DEFINE(HAVE_LOGL)
189       AC_DEFINE(HAVE_LOG10F)
190       AC_DEFINE(HAVE_LOG10L)
191       AC_DEFINE(HAVE_SINF)
192       AC_DEFINE(HAVE_SINL)
193       AC_DEFINE(HAVE_SINHF)
194       AC_DEFINE(HAVE_SINHL)
195       ;;
196     *)
197       os_include_dir="os/newlib"
198       AC_DEFINE(HAVE_HYPOT)
199       ;;
200   esac
201
202   case "$target_alias" in
203     *-mingw32*)
204       ;;
205     *-windiss*)
206       AC_DEFINE(HAVE_ACOSF)
207       AC_DEFINE(HAVE_ASINF)
208       AC_DEFINE(HAVE_ATAN2F)
209       AC_DEFINE(HAVE_ATANF)
210       AC_DEFINE(HAVE_CEILF)
211       AC_DEFINE(HAVE_COPYSIGN)
212       AC_DEFINE(HAVE_COPYSIGNF)
213       AC_DEFINE(HAVE_COSF)
214       AC_DEFINE(HAVE_COSHF)
215       AC_DEFINE(HAVE_EXPF)
216       AC_DEFINE(HAVE_FABSF)
217       AC_DEFINE(HAVE_FLOORF)
218       AC_DEFINE(HAVE_FMODF)
219       AC_DEFINE(HAVE_FREXPF)
220       AC_DEFINE(HAVE_LDEXPF)
221       AC_DEFINE(HAVE_LOG10F)
222       AC_DEFINE(HAVE_LOGF)
223       AC_DEFINE(HAVE_MODFF)
224       AC_DEFINE(HAVE_POWF)
225       AC_DEFINE(HAVE_SINF)
226       AC_DEFINE(HAVE_SINHF)
227       AC_DEFINE(HAVE_SQRTF)
228       AC_DEFINE(HAVE_TANF)
229       AC_DEFINE(HAVE_TANHF)
230       ;;
231     *)
232       # GLIBCPP_CHECK_STDLIB_SUPPORT
233       AC_DEFINE(HAVE_STRTOF)        
234       AC_DEFINE(HAVE_STRTOLD)        
235       # AC_FUNC_MMAP
236       AC_DEFINE(HAVE_MMAP)
237
238       AC_DEFINE(HAVE_ACOSF)
239       AC_DEFINE(HAVE_ASINF)
240       AC_DEFINE(HAVE_ATAN2F)
241       AC_DEFINE(HAVE_ATANF)
242       AC_DEFINE(HAVE_CEILF)
243       AC_DEFINE(HAVE_COPYSIGN)
244       AC_DEFINE(HAVE_COPYSIGNF)
245       AC_DEFINE(HAVE_COSF)
246       AC_DEFINE(HAVE_COSHF)
247       AC_DEFINE(HAVE_EXPF)
248       AC_DEFINE(HAVE_FABSF)
249       AC_DEFINE(HAVE_FINITE)
250       AC_DEFINE(HAVE_FINITEF)
251       AC_DEFINE(HAVE_FLOORF)
252       AC_DEFINE(HAVE_FMODF)
253       AC_DEFINE(HAVE_FREXPF)
254       AC_DEFINE(HAVE_ISINF)
255       AC_DEFINE(HAVE_ISINFF)
256       AC_DEFINE(HAVE_ISNAN)
257       AC_DEFINE(HAVE_ISNANF)
258       AC_DEFINE(HAVE_LDEXPF)
259       AC_DEFINE(HAVE_LOG10F)
260       AC_DEFINE(HAVE_LOGF)
261       AC_DEFINE(HAVE_MODFF)
262       AC_DEFINE(HAVE_POWF)
263       AC_DEFINE(HAVE_SINF)
264       AC_DEFINE(HAVE_SINHF)
265       AC_DEFINE(HAVE_SQRTF)
266       AC_DEFINE(HAVE_TANF)
267       AC_DEFINE(HAVE_TANHF)
268       ;;
269   esac
270
271   # At some point, we should differentiate between architectures
272   # like x86, which have long double versions, and alpha/powerpc/etc.,
273   # which don't. For the time being, punt.
274   if test x"long_double_math_on_this_cpu" = x"yes"; then
275     AC_DEFINE(HAVE_ACOSL)
276     AC_DEFINE(HAVE_ASINL)
277     AC_DEFINE(HAVE_ATAN2L)
278     AC_DEFINE(HAVE_ATANL)
279     AC_DEFINE(HAVE_CEILL)
280     AC_DEFINE(HAVE_COPYSIGNL)
281     AC_DEFINE(HAVE_COSL)
282     AC_DEFINE(HAVE_COSHL)
283     AC_DEFINE(HAVE_EXPL)
284     AC_DEFINE(HAVE_FABSL)
285     AC_DEFINE(HAVE_FINITEL)
286     AC_DEFINE(HAVE_FLOORL)
287     AC_DEFINE(HAVE_FMODL)
288     AC_DEFINE(HAVE_FREXPL)
289     AC_DEFINE(HAVE_ISINFL)
290     AC_DEFINE(HAVE_ISNANL)
291     AC_DEFINE(HAVE_LDEXPL)
292     AC_DEFINE(HAVE_LOG10L)
293     AC_DEFINE(HAVE_LOGL)
294     AC_DEFINE(HAVE_MODFL)
295     AC_DEFINE(HAVE_POWL)
296     AC_DEFINE(HAVE_SINCOSL)
297     AC_DEFINE(HAVE_SINL)
298     AC_DEFINE(HAVE_SINHL)
299     AC_DEFINE(HAVE_SQRTL)
300     AC_DEFINE(HAVE_TANL)
301     AC_DEFINE(HAVE_TANHL)
302   fi
303
304 else
305
306   # We are being configured natively. We can do more elaborate tests
307   # that include AC_TRY_COMPILE now, as the linker is assumed to be
308   # working.
309   GLIBCPP_IS_CROSS_COMPILING=0
310   CANADIAN=no
311
312   # Check for available headers.
313   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
314   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
315
316   GLIBCPP_CHECK_COMPILER_FEATURES
317   GLIBCPP_CHECK_LINKER_FEATURES
318   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
319   GLIBCPP_CHECK_MATH_SUPPORT
320   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
321   GLIBCPP_CHECK_WCHAR_T_SUPPORT
322   GLIBCPP_CHECK_STDLIB_SUPPORT
323   AC_LC_MESSAGES
324
325   AC_TRY_COMPILE([
326   #include <setjmp.h>
327   ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
328   [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])
329   ])
330
331   AC_FUNC_MMAP
332
333   # Establish limits on memory usage during 'make check'
334   GLIBCPP_CONFIGURE_TESTSUITE
335 fi
336
337 # This depends on the possibly-skipped linker test above.
338 GLIBCPP_ENABLE_SYMVERS([yes])
339
340 # Propagate the target-specific source directories through the build chain.
341 # (Nothing currently uses cpu_include_dir directly; only ATOMICITYH and
342 # CPULIMITSH [might] use it, and they only get used here.)
343 OS_INC_SRCDIR=config/${os_include_dir}/bits
344 ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}/bits
345 CPU_LIMITS_INC_SRCDIR=config/${CPULIMITSH}/bits
346 AC_SUBST(OS_INC_SRCDIR)
347 AC_SUBST(ATOMICITY_INC_SRCDIR)
348 AC_SUBST(CPU_LIMITS_INC_SRCDIR)
349
350 # Set up cross-compile flags
351 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)  dnl Unused so far.
352 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
353  
354 AC_CACHE_SAVE
355
356 if test "${multilib}" = "yes"; then
357   multilib_arg="--enable-multilib"
358 else
359   multilib_arg=
360 fi
361
362 # Needed so that g++ can find the correct include subdir automatically.
363 INTERFACE=v3
364
365 # Export all the install information
366 GLIBCPP_EXPORT_INSTALL_INFO
367
368 # Export all the include and flag information to makefiles.
369 GLIBCPP_EXPORT_INCLUDES
370 GLIBCPP_EXPORT_FLAGS
371
372 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
373    grep "enable shared" > /dev/null; then
374   LIBSUPCXX_PICFLAGS=-prefer-pic
375 else
376   LIBSUPCXX_PICFLAGS=
377 fi
378 AC_SUBST(LIBSUPCXX_PICFLAGS)
379
380 # Generate the various Makefiles, include files, and scripts.
381 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
382 # and libsupc++/Makefile.am so that multilib installs will end up
383 # installed in the correct place. To work around this not being passed
384 # down from config-ml.in -> top_srcdir/Makefile.am ->
385 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
386 AC_OUTPUT(Makefile \
387     include/Makefile src/Makefile \
388     libmath/Makefile libio/Makefile libsupc++/Makefile \
389     po/Makefile testsuite/Makefile mkcheck testsuite_flags,
390 [if test -n "$CONFIG_FILES"; then
391   LD="${ORIGINAL_LD_FOR_MULTILIBS}"
392   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
393   grep '^MULTISUBDIR =' Makefile >> src/Makefile
394   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
395 fi
396 chmod +x mkcheck
397 chmod +x testsuite_flags
398 ],
399 srcdir=${srcdir}
400 host=${host}
401 target=${target}
402 with_multisubdir=${with_multisubdir}
403 ac_configure_args="${multilib_arg} ${ac_configure_args}"
404 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
405 glibcpp_basedir=${glibcpp_basedir}
406 CC="${CC}"
407 CXX="${CXX}"
408 )
409 dnl  In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
410 dnl  AC_CONFIG_FILES(Makefile \
411 dnl      include/Makefile src/Makefile \
412 dnl      libmath/Makefile libio/Makefile libsupc++/Makefile \
413 dnl      po/Makefile testsuite/Makefile mkcheck testsuite_flags)
414 dnl  AC_CONFIG_COMMANDS([default],
415 dnl  [if test -n "$CONFIG_FILES"; then
416 dnl    ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
417 dnl    grep '^MULTISUBDIR =' Makefile >> src/Makefile
418 dnl    grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
419 dnl  fi
420 dnl  chmod +x mkcheck
421 dnl  chmod +x testsuite_flags
422 dnl  ],
423 dnl  srcdir=${srcdir}
424 dnl  host=${host}
425 dnl  target=${target}
426 dnl  with_multisubdir=${with_multisubdir}
427 dnl  ac_configure_args="${multilib_arg} ${ac_configure_args}"
428 dnl  CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
429 dnl  glibcpp_basedir=${glibcpp_basedir}
430 dnl  CC="${CC}"
431 dnl  CXX="${CXX}"
432 dnl  )
433 dnl  AC_OUTPUT
434
435
436 # Sanity checking & User-visible messages.
437 # Checks down here, otherwise they get scrolled off before
438 # the user will notice.
439
440 # Trying to get more people to read documentation.  Possibly remove
441 # check and warn all the time. There is no "informational" AC_MSG_
442 # macro, so these are going to be printed even when --quiet/--silent
443 # is given.
444 if test ! -f stamp-sanity-warned; then
445   touch stamp-sanity-warned
446   echo ""
447   echo "Please make certain that you read the installation information here:"
448   echo "  faster => ${srcdir}/docs/html/install.html"
449   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
450   echo ""
451   echo "and the configuration information here:"
452   echo "  faster => ${srcdir}/docs/html/configopts.html"
453   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
454   echo ""
455   echo "before proceeding with ${_cv_gnu_make_command}."
456   echo ""
457 fi