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