configure.ac revision 132720
1132720Skan# Process this file with autoconf to produce a configure script, like so: 2132720Skan# aclocal && autoconf && autoheader && automake 3132720Skan 4132720SkanAC_PREREQ(2.57) 5132720SkanAC_INIT(package-unused, version-unused,, libstdc++) 6132720SkanAC_CONFIG_SRCDIR(src/ios.cc) 7132720SkanAC_CONFIG_HEADER(config.h) 8132720Skan 9132720Skan# This works around the fact that libtool configuration may change LD 10132720Skan# for this particular configuration, but some shells, instead of 11132720Skan# keeping the changes in LD private, export them just because LD is 12132720Skan# exported. Only used at the end of this file. 13132720Skan### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD 14132720Skan 15132720Skan# For libtool versioning info, format is CURRENT:REVISION:AGE 16132720Skanlibtool_VERSION=6:2:0 17132720SkanAC_SUBST(libtool_VERSION) 18132720Skan 19132720Skan# Find the rest of the source tree framework. 20132720SkanGLIBCXX_TOPREL_CONFIGURE 21132720Skan 22132720Skan# Gets build, host, target, *_vendor, *_cpu, *_os, etc. 23132720Skan# 24132720Skan# You will slowly go insane if you do not grok the following fact: when 25132720Skan# building v3 as part of the compiler, the top-level /target/ becomes the 26132720Skan# library's /host/. configure then causes --target to default to --host, 27132720Skan# exactly like any other package using autoconf. Therefore, 'target' and 28132720Skan# 'host' will always be the same. This makes sense both for native and 29132720Skan# cross compilers, just think about it for a little while. :-) 30132720Skan# 31132720Skan# Also, if v3 is being configured as part of a cross compiler, the top-level 32132720Skan# configure script will pass the "real" host as $with_cross_host. 33132720Skan# 34132720Skan# Do not delete or change the following two lines. For why, see 35132720Skan# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html 36132720SkanAC_CANONICAL_SYSTEM 37132720Skantarget_alias=${target_alias-$host_alias} 38132720Skan 39132720Skan# Handy for debugging: 40132720Skan#AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5 41132720Skan 42132720Skanif test "$build" != "$host"; then 43132720Skan # We are being configured with some form of cross compiler. 44132720Skan GLIBCXX_IS_NATIVE=false 45132720Skan GCC_NO_EXECUTABLES 46132720Skanelse 47132720Skan GLIBCXX_IS_NATIVE=true 48132720Skanfi 49132720Skan 50132720Skan# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the 51132720Skan# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am. 52132720Skan# 1.x: minimum required version 53132720Skan# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch 54132720Skan# of other PACKAGE_* variables will, however, and there's nothing 55132720Skan# we can do about that; they come from AC_INIT). 56132720Skan# foreign: we don't follow the normal rules for GNU packages (no COPYING 57132720Skan# file in the top srcdir, etc, etc), so stop complaining. 58132720Skan# no-dependencies: turns off auto dependency generation (just for now) 59132720Skan# -Wall: turns on all automake warnings... 60132720Skan# -Wno-portability: ...except this one, since GNU make is now required. 61132720SkanAM_INIT_AUTOMAKE([1.7.6 no-define foreign no-dependencies -Wall -Wno-portability]) 62132720Skan 63132720Skan# Runs configure.host, finds CC, CXX, and assorted other critical bits. Sets 64132720Skan# up critical shell variables. 65132720SkanGLIBCXX_CONFIGURE 66132720Skan 67132720Skan#AC_MSG_NOTICE([====== Starting libtool configuration]) 68132720SkanAC_LIBTOOL_DLOPEN 69132720SkanAM_PROG_LIBTOOL 70132720SkanAC_SUBST(enable_shared) 71132720SkanAC_SUBST(enable_static) 72132720Skan#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10 73132720Skan 74132720Skan# Possibly disable most of the library. 75132720Skan## XXX Consider skipping unncessary tests altogether in this case, rather 76132720Skan## than just ignoring the results. Faster /and/ more correct, win win. 77132720SkanGLIBCXX_ENABLE_HOSTED 78132720Skan 79132720Skan# Check for support bits and g++ features that don't require linking. 80132720SkanGLIBCXX_ENABLE_SJLJ_EXCEPTIONS 81132720SkanGLIBCXX_ENABLE_PCH($is_hosted) 82132720Skan 83132720Skan# Enable all the variable C++ runtime options. 84132720Skan# NB: C_MBCHAR must come early. 85132720SkanGLIBCXX_ENABLE_CSTDIO 86132720SkanGLIBCXX_ENABLE_CLOCALE 87132720SkanGLIBCXX_ENABLE_ALLOCATOR 88132720SkanGLIBCXX_ENABLE_CHEADERS($c_model) dnl c_model from configure.host 89132720SkanGLIBCXX_ENABLE_C_MBCHAR([yes]) 90132720SkanGLIBCXX_ENABLE_C99([yes]) 91132720SkanGLIBCXX_ENABLE_LONG_LONG([yes]) 92132720SkanGLIBCXX_ENABLE_THREADS 93132720SkanGLIBCXX_ENABLE_CONCEPT_CHECKS([no]) 94132720SkanGLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"]) 95132720SkanGLIBCXX_ENABLE_DEBUG([no]) 96132720SkanGLIBCXX_ENABLE_CXX_FLAGS 97132720Skan 98132720Skan# No surprises, no surprises... 99132720Skanif test $atomicity_dir = cpu/generic ; then 100132720Skan AC_MSG_WARN([No native atomic operations are provided for this platform.]) 101132720Skan if test $target_thread_file = single; then 102132720Skan AC_MSG_WARN([They cannot be faked when thread support is disabled.]) 103132720Skan AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.]) 104132720Skan else 105132720Skan AC_MSG_WARN([They will be faked using a mutex.]) 106132720Skan AC_MSG_WARN([Performance of certain classes will degrade as a result.]) 107132720Skan fi 108132720Skanfi 109132720Skan 110132720Skan 111132720Skanif $GLIBCXX_IS_NATIVE; then 112132720Skan 113132720Skan # We can do more elaborate tests that assume a working linker. 114132720Skan CANADIAN=no 115132720Skan 116132720Skan # Check for available headers. 117132720Skan AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \ 118132720Skan machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h \ 119132720Skan sys/types.h]) 120132720Skan 121132720Skan GLIBCXX_CHECK_COMPILER_FEATURES 122132720Skan GLIBCXX_CHECK_LINKER_FEATURES 123132720Skan GLIBCXX_CHECK_MATH_SUPPORT 124132720Skan GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT 125132720Skan GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT 126132720Skan GLIBCXX_CHECK_WCHAR_T_SUPPORT 127132720Skan GLIBCXX_CHECK_STDLIB_SUPPORT 128132720Skan 129132720Skan # For showmanyc_helper(). 130132720Skan AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) 131132720Skan GLIBCXX_CHECK_POLL 132132720Skan GLIBCXX_CHECK_S_ISREG_OR_S_IFREG 133132720Skan 134132720Skan # For xsputn_2(). 135132720Skan AC_CHECK_HEADERS(sys/uio.h) 136132720Skan GLIBCXX_CHECK_WRITEV 137132720Skan 138132720Skan # For the __streamoff_base_type typedef. 139132720Skan GLIBCXX_CHECK_INT64_T 140132720Skan 141132720Skan # For LFS support. 142132720Skan GLIBCXX_CHECK_LFS 143132720Skan 144132720Skan AC_LC_MESSAGES 145132720Skan 146132720Skan AC_TRY_COMPILE( 147132720Skan [#include <setjmp.h>], 148132720Skan [sigjmp_buf env; 149132720Skan while (! sigsetjmp (env, 1)) 150132720Skan siglongjmp (env, 1); 151132720Skan ], 152132720Skan [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.])]) 153132720Skan 154132720Skan AC_FUNC_MMAP 155132720Skan 156132720Skanelse 157132720Skan 158132720Skan # This lets us hard-code the functionality we know we'll have in the cross 159132720Skan # target environment. "Let" is a sugar-coated word placed on an especially 160132720Skan # dull and tedious hack, actually. 161132720Skan # 162132720Skan # Here's why GLIBCXX_CHECK_MATH_SUPPORT, and other autoconf macros 163132720Skan # that involve linking, can't be used: 164132720Skan # "cannot open sim-crt0.o" 165132720Skan # "cannot open crt0.o" 166132720Skan # etc. All this is because there currently exists no unified, consistent 167132720Skan # way for top level CC information to be passed down to target directories: 168132720Skan # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc. 169132720Skan # When all of that is done, all of this hokey, excessive AC_DEFINE junk for 170132720Skan # crosses can be removed. 171132720Skan 172132720Skan # If Canadian cross, then don't pick up tools from the build directory. 173132720Skan # Used only in GLIBCXX_EXPORT_INCLUDES. 174132720Skan if test -n "$with_cross_host" && 175132720Skan test x"$build_alias" != x"$with_cross_host" && 176132720Skan test x"$build" != x"$target"; 177132720Skan then 178132720Skan CANADIAN=yes 179132720Skan else 180132720Skan CANADIAN=no 181132720Skan fi 182132720Skan 183132720Skan # Construct crosses by hand, eliminating bits that need ld... 184132720Skan # GLIBCXX_CHECK_COMPILER_FEATURES 185132720Skan # GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT 186132720Skan # GLIBCXX_CHECK_MATH_SUPPORT 187132720Skan 188132720Skan # First, test for "known" system libraries. We may be using newlib even 189132720Skan # on a hosted environment. 190132720Skan if test "x${with_newlib}" = "xyes"; then 191132720Skan os_include_dir="os/newlib" 192132720Skan AC_DEFINE(HAVE_HYPOT) 193132720Skan 194132720Skan # GLIBCXX_CHECK_STDLIB_SUPPORT 195132720Skan AC_DEFINE(HAVE_STRTOF) 196132720Skan AC_DEFINE(HAVE_STRTOLD) 197132720Skan # AC_FUNC_MMAP 198132720Skan AC_DEFINE(HAVE_MMAP) 199132720Skan 200132720Skan AC_DEFINE(HAVE_ACOSF) 201132720Skan AC_DEFINE(HAVE_ASINF) 202132720Skan AC_DEFINE(HAVE_ATAN2F) 203132720Skan AC_DEFINE(HAVE_ATANF) 204132720Skan AC_DEFINE(HAVE_CEILF) 205132720Skan AC_DEFINE(HAVE_COPYSIGN) 206132720Skan AC_DEFINE(HAVE_COPYSIGNF) 207132720Skan AC_DEFINE(HAVE_COSF) 208132720Skan AC_DEFINE(HAVE_COSHF) 209132720Skan AC_DEFINE(HAVE_EXPF) 210132720Skan AC_DEFINE(HAVE_FABSF) 211132720Skan AC_DEFINE(HAVE_FLOORF) 212132720Skan AC_DEFINE(HAVE_FMODF) 213132720Skan AC_DEFINE(HAVE_FREXPF) 214132720Skan AC_DEFINE(HAVE_LDEXPF) 215132720Skan AC_DEFINE(HAVE_LOG10F) 216132720Skan AC_DEFINE(HAVE_LOGF) 217132720Skan AC_DEFINE(HAVE_MODFF) 218132720Skan AC_DEFINE(HAVE_POWF) 219132720Skan AC_DEFINE(HAVE_SINF) 220132720Skan AC_DEFINE(HAVE_SINHF) 221132720Skan AC_DEFINE(HAVE_SQRTF) 222132720Skan AC_DEFINE(HAVE_TANF) 223132720Skan AC_DEFINE(HAVE_TANHF) 224132720Skan 225132720Skan AC_DEFINE(HAVE_S_ISREG) 226132720Skan AC_DEFINE(HAVE_S_IFREG) 227132720Skan else 228132720Skan m4_include([crossconfig.m4]) 229132720Skan fi 230132720Skan 231132720Skan # At some point, we should differentiate between architectures 232132720Skan # like x86, which have long double versions, and alpha/powerpc/etc., 233132720Skan # which don't. For the time being, punt. 234132720Skan if test x"long_double_math_on_this_cpu" = x"yes"; then 235132720Skan AC_DEFINE(HAVE_ACOSL) 236132720Skan AC_DEFINE(HAVE_ASINL) 237132720Skan AC_DEFINE(HAVE_ATAN2L) 238132720Skan AC_DEFINE(HAVE_ATANL) 239132720Skan AC_DEFINE(HAVE_CEILL) 240132720Skan AC_DEFINE(HAVE_COPYSIGNL) 241132720Skan AC_DEFINE(HAVE_COSL) 242132720Skan AC_DEFINE(HAVE_COSHL) 243132720Skan AC_DEFINE(HAVE_EXPL) 244132720Skan AC_DEFINE(HAVE_FABSL) 245132720Skan AC_DEFINE(HAVE_FLOORL) 246132720Skan AC_DEFINE(HAVE_FMODL) 247132720Skan AC_DEFINE(HAVE_FREXPL) 248132720Skan AC_DEFINE(HAVE_LDEXPL) 249132720Skan AC_DEFINE(HAVE_LOG10L) 250132720Skan AC_DEFINE(HAVE_LOGL) 251132720Skan AC_DEFINE(HAVE_MODFL) 252132720Skan AC_DEFINE(HAVE_POWL) 253132720Skan AC_DEFINE(HAVE_SINCOSL) 254132720Skan AC_DEFINE(HAVE_SINL) 255132720Skan AC_DEFINE(HAVE_SINHL) 256132720Skan AC_DEFINE(HAVE_SQRTL) 257132720Skan AC_DEFINE(HAVE_TANL) 258132720Skan AC_DEFINE(HAVE_TANHL) 259132720Skan fi 260132720Skan 261132720Skanfi 262132720Skan 263132720Skan# This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. 264132720SkanGLIBCXX_ENABLE_SYMVERS([yes]) 265132720Skan 266132720Skan# This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE. 267132720SkanGLIBCXX_CONFIGURE_TESTSUITE 268132720Skan 269132720Skan# Propagate the target-specific source directories through the build chain. 270132720Skan# (Nothing currently uses cpu_include_dir directly; only atomicity_include_dir 271132720Skan# uses it, and it only gets used in this file.) 272132720SkanATOMICITY_SRCDIR=config/${atomicity_dir} 273132720SkanATOMIC_WORD_SRCDIR=config/${atomic_word_dir} 274132720SkanOS_INC_SRCDIR=config/${os_include_dir} 275132720SkanAC_SUBST(ATOMICITY_SRCDIR) 276132720SkanAC_SUBST(ATOMIC_WORD_SRCDIR) 277132720SkanAC_SUBST(OS_INC_SRCDIR) 278132720Skan 279132720Skan# Determine cross-compile flags and AM_CONDITIONALs. 280132720Skan#AC_SUBST(GLIBCXX_IS_NATIVE) 281132720Skan#AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes) 282132720Skan# from GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT: 283132720Skan#AM_CONDITIONAL(GLIBCXX_BUILD_LIBMATH, test $need_libmath = yes) 284132720SkanGLIBCXX_EVALUATE_CONDITIONALS 285132720Skan 286132720SkanAC_CACHE_SAVE 287132720Skan 288132720Skanif test ${multilib} = yes; then 289132720Skan multilib_arg="--enable-multilib" 290132720Skanelse 291132720Skan multilib_arg= 292132720Skanfi 293132720Skan 294132720Skan# Export all the install information. 295132720SkanGLIBCXX_EXPORT_INSTALL_INFO 296132720Skan 297132720Skan# Export all the include and flag information to Makefiles. 298132720SkanGLIBCXX_EXPORT_INCLUDES 299132720SkanGLIBCXX_EXPORT_FLAGS 300132720Skan 301132720Skanif ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features | 302132720Skan grep "enable shared" > /dev/null; 303132720Skanthen 304132720Skan LIBSUPCXX_PICFLAGS=-prefer-pic 305132720Skanelse 306132720Skan LIBSUPCXX_PICFLAGS= 307132720Skanfi 308132720SkanAC_SUBST(LIBSUPCXX_PICFLAGS) 309132720Skan 310132720Skandnl In autoconf 2.5x, AC_OUTPUT is replaced by four AC_CONFIG_* macros, 311132720Skandnl which can all be called multiple times as needed, plus one (different) 312132720Skandnl AC_OUTPUT macro. This one lists the files to be created: 313132720SkanAC_CONFIG_FILES( \ 314132720Skan Makefile \ 315132720Skan AC_FOREACH([DIR], glibcxx_SUBDIRS, [DIR/Makefile ]) 316132720Skan ) 317132720SkanAC_CONFIG_FILES([scripts/check_survey],[chmod +x scripts/check_survey]) 318132720SkanAC_CONFIG_FILES([scripts/testsuite_flags],[chmod +x scripts/testsuite_flags]) 319132720Skan 320132720Skandnl These commands are run at the end of config.status: 321132720SkanAC_CONFIG_COMMANDS([default], 322132720Skan[if test -n "$CONFIG_FILES"; then 323132720Skan # Multilibs need MULTISUBDIR defined correctly in certain makefiles so 324132720Skan # that multilib installs will end up installed in the correct place. 325132720Skan # The testsuite needs it for multilib-aware ABI baseline files. 326132720Skan # To work around this not being passed down from config-ml.in -> 327132720Skan # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually 328132720Skan # append it here. Only modify Makefiles that have just been created. 329132720Skan # 330132720Skan # Also, get rid of this simulated-VPATH thing that automake does. 331132720Skan cat > vpsed << \_EOF 332132720Skans!`test -f '$<' || echo '$(srcdir)/'`!! 333132720Skan_EOF 334132720Skan for i in $SUBDIRS; do 335132720Skan case $CONFIG_FILES in 336132720Skan *${i}/Makefile*) 337132720Skan #echo "Adding MULTISUBDIR to $i/Makefile" 338132720Skan sed -f vpsed $i/Makefile > tmp 339132720Skan grep '^MULTISUBDIR =' Makefile >> tmp 340132720Skan mv tmp $i/Makefile 341132720Skan ;; 342132720Skan esac 343132720Skan done 344132720Skan rm vpsed 345132720Skan fi 346132720Skan (cd include && ${MAKE-make}) 347132720Skan], 348132720Skan[ 349132720Skan# Variables needed in config.status (file generation) which aren't already 350132720Skan# passed by autoconf. 351132720SkanSUBDIRS="$SUBDIRS" 352132720Skan]) 353132720Skan 354132720Skandnl And this actually makes things happen: 355132720SkanAC_OUTPUT 356