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