aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/configure.in
blob: 7f59b13627458529ed6c47b6f3fed65edd35172e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# Process this file with autoconf to produce a configure script, like so:
# aclocal, autoconf, autoheader, automake

AC_PREREQ(2.13)
AC_INIT(src/ios.cc)

# When building with srcdir == objdir, links to the source files will
# be created in directories within the target_subdir.  We have to
# adjust toplevel_srcdir accordingly, so that configure finds
# install-sh and other auxiliary files that live in the top-level
# source directory.
if test "${srcdir}" = "."; then
  if test -z "${with_target_subdir}"; then
    toplevel_srcdir="\${top_srcdir}/.."
    auxdir="${srcdir}/.."
  else
    if test "${with_target_subdir}" != "."; then
      toplevel_srcdir="\${top_srcdir}/${with_multisrctop}../.."
      auxdir="${srcdir}/${with_multisrctop}../.."
    else
      toplevel_srcdir="\${top_srcdir}/${with_multisrctop}.."
      auxdir="${srcdir}/${with_multisrctop}.."
    fi
  fi
else
  toplevel_srcdir="\${top_srcdir}/.."
  auxdir="${srcdir}/.."
fi
AC_CONFIG_AUX_DIR($auxdir)
AC_SUBST(toplevel_srcdir)

dnl This is here just to satisfy automake.
ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])

# Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
AC_CANONICAL_SYSTEM

# We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[  --with-target-subdir=SUBDIR
                           configuring in a subdirectory])
AC_ARG_WITH(cross-host,
[  --with-cross-host=HOST  configuring with a cross compiler])

# Runs configure.host and configure.target. Have to run this before
# the GLIBCPP_ENABLE_* macros below.
GLIBCPP_CONFIGURE(.)

AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
GLIBCPP_CHECK_GNU_MAKE
  if test "x$_cv_gnu_make_command" = "x"; then
    AC_MSG_ERROR([GNU make not found. Please install it or correct your path.])
  fi
AM_CONFIG_HEADER(config.h)

# Check for c++ or library specific bits that don't require linking.
GLIBCPP_CHECK_COMPILER_VERSION

# Enable all the crazy c++ stuff.  C_MBCHAR must come early.
GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
GLIBCPP_ENABLE_CSTDIO
GLIBCPP_ENABLE_CLOCALE
GLIBCPP_ENABLE_C_MBCHAR([yes])
GLIBCPP_ENABLE_LONG_LONG([no])
GLIBCPP_ENABLE_CHEADERS([c_std])
GLIBCPP_ENABLE_THREADS
GLIBCPP_ENABLE_CXX_FLAGS([none])

if test -n "$with_cross_host"; then

  # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
  # may not work correctly, because the compiler may not be able to
  # link executables.
  xcompiling=1
  NATIVE=no

  # If Canadian cross, then don't pick up tools from the build
  # directory.
  if test x"$build" != x"$with_cross_host" && x"$build" != x"$target"; then
    CANADIAN=yes
    NULL_TARGET=yes
  else
    CANADIAN=no
    NULL_TARGET=no
  fi

  case "$target_alias" in
    *-linux*)
	# Construct linux crosses by hand, eliminating bits that need ld...
        # Check for available headers.
        AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
	machine/endian.h machine/param.h sys/machine.h fp.h locale.h \
	float.h inttypes.h])

	# GLIBCPP_CHECK_COMPILER_FEATURES
	WFMT_FLAGS='-fdiagnostics-show-location=once'
	SECTION_FLAGS='-ffunction-sections -fdata-sections'
	AC_SUBST(WFMT_FLAGS)
	AC_SUBST(SECTION_FLAGS)
	GLIBCPP_CHECK_LINKER_FEATURES
	# GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
	# GLIBCPP_CHECK_MATH_SUPPORT
	AC_DEFINE(HAVE_ACOSF)
	AC_DEFINE(HAVE_ASINF)
	AC_DEFINE(HAVE_ATAN2F)
	AC_DEFINE(HAVE_ATANF)
	AC_DEFINE(HAVE_CEILF)
	AC_DEFINE(HAVE_COPYSIGN)
	AC_DEFINE(HAVE_COPYSIGNF)
	AC_DEFINE(HAVE_COSF)
	AC_DEFINE(HAVE_COSHF)
	AC_DEFINE(HAVE_EXPF)
	AC_DEFINE(HAVE_FABSF)
	AC_DEFINE(HAVE_FINITE)
	AC_DEFINE(HAVE_FINITEF)
	AC_DEFINE(HAVE_FLOORF)
	AC_DEFINE(HAVE_FMODF)
	AC_DEFINE(HAVE_FREXPF)
	AC_DEFINE(HAVE_ISINF)
	AC_DEFINE(HAVE_ISINFF)
	AC_DEFINE(HAVE_ISNAN)
	AC_DEFINE(HAVE_ISNANF)
	AC_DEFINE(HAVE_LDEXPF)
	AC_DEFINE(HAVE_LOG10F)
	AC_DEFINE(HAVE_LOGF)
	AC_DEFINE(HAVE_MODFF)
	AC_DEFINE(HAVE_POWF)
	AC_DEFINE(HAVE_SINCOS)
	AC_DEFINE(HAVE_SINCOSF)
	AC_DEFINE(HAVE_SINF)
	AC_DEFINE(HAVE_SINHF)
	AC_DEFINE(HAVE_SQRTF)
	AC_DEFINE(HAVE_TANF)
	AC_DEFINE(HAVE_TANHF)

	# At some point, we should differentiate between architectures
	# like x86, which have long double versions, and alpha/powerpc/etc.,
	# which don't. For the time being, punt.
	if test x"long_double_math_on_this_cpu" = x"yes"; then
	  AC_DEFINE(HAVE_ACOSL)
	  AC_DEFINE(HAVE_ASINL)
	  AC_DEFINE(HAVE_ATAN2L)
	  AC_DEFINE(HAVE_ATANL)
	  AC_DEFINE(HAVE_CEILL)
	  AC_DEFINE(HAVE_COPYSIGNL)
	  AC_DEFINE(HAVE_COSL)
	  AC_DEFINE(HAVE_COSHL)
	  AC_DEFINE(HAVE_EXPL)
	  AC_DEFINE(HAVE_FABSL)
	  AC_DEFINE(HAVE_FINITEL)
	  AC_DEFINE(HAVE_FLOORL)
	  AC_DEFINE(HAVE_FMODL)
	  AC_DEFINE(HAVE_FREXPL)
	  AC_DEFINE(HAVE_ISINFL)
	  AC_DEFINE(HAVE_ISNANL)
	  AC_DEFINE(HAVE_LDEXPL)
	  AC_DEFINE(HAVE_LOG10L)
	  AC_DEFINE(HAVE_LOGL)
	  AC_DEFINE(HAVE_MODFL)
	  AC_DEFINE(HAVE_POWL)
	  AC_DEFINE(HAVE_SINCOSL)
	  AC_DEFINE(HAVE_SINL)
	  AC_DEFINE(HAVE_SINHL)
	  AC_DEFINE(HAVE_SQRTL)
	  AC_DEFINE(HAVE_TANL)
	  AC_DEFINE(HAVE_TANHL)
	fi
	GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
	GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
	GLIBCPP_CHECK_WCHAR_T_SUPPORT
	os_include_dir="config/os/gnu-linux"
	# GLIBCPP_CHECK_STDLIB_SUPPORT
	AC_DEFINE(HAVE_STRTOF)        
	AC_DEFINE(HAVE_STRTOLD)        
	# AC_FUNC_MMAP
	AC_DEFINE(HAVE_MMAP)
	;;
    *)
	# We assume newlib.  This lets us hard-code the functions we know
	# we'll have.
	AC_DEFINE(HAVE_FINITE)
	AC_DEFINE(HAVE_ISNAN)
	AC_DEFINE(HAVE_ISNANF)
	AC_DEFINE(HAVE_ISINF)
	AC_DEFINE(HAVE_ISINFF)

	os_include_dir="config/os/newlib"

	AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
	AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
	# need to check for faster f versions of math functions, ie sinf?
	;;
  esac
else

  # We are being configured natively. We can do more elaborate tests
  # that include AC_TRY_COMPILE now, as the linker is assumed to be
  # working.
  xcompiling=0
  NATIVE=yes
  CANADIAN=no
  NULL_TARGET=no

  # Check for available headers.
  AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
  machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])

  GLIBCPP_CHECK_COMPILER_FEATURES
  GLIBCPP_CHECK_LINKER_FEATURES
  GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
  GLIBCPP_CHECK_MATH_SUPPORT
  GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
  GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
  GLIBCPP_CHECK_WCHAR_T_SUPPORT
  GLIBCPP_CHECK_STDLIB_SUPPORT

  AC_FUNC_MMAP
fi

# Now that ctype is determined for all possible targets, we can do this...
AC_LINK_FILES($os_include_dir/bits/ctype_base.h, \
include/bits/ctype_base.h)
AC_LINK_FILES($os_include_dir/bits/ctype_inline.h, \
include/bits/ctype_inline.h)
AC_LINK_FILES($os_include_dir/bits/ctype_noninline.h, \
include/bits/ctype_noninline.h)
AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)

AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
 
AC_CACHE_SAVE
AC_LC_MESSAGES

if test "${multilib}" = "yes"; then
  multilib_arg="--enable-multilib"
else
  multilib_arg=
fi


# Generate the various Makefiles, include files, and scripts.

# This helps subvert libstdcxx_interface, as calculated by devo/config.if
# Needed so that g++ can find the correct include subdir automatically.
INTERFACE=v3

# Check for the interface version number for specifying where header
# files are installed, if a version number is provided.
AC_MSG_CHECKING([for interface version number])
libstdcxx_interface=$INTERFACE
AC_MSG_RESULT($libstdcxx_interface)
AC_SUBST(libstdcxx_interface)

# Process the option --with-gxx-include-dir=<path to include-files directory>
AC_MSG_CHECKING([for --with-gxx-include-dir])
AC_ARG_WITH(gxx-include-dir,
[ --with-gxx-include-dir  the installation directory for include files],
[case "${withval}" in
  yes)
    AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
    gxx_include_dir=no
    ;;
  no)
    gxx_include_dir=no
    ;;
  *)
    gxx_include_dir=${withval}
    ;;
esac], [gxx_include_dir=no])
AC_MSG_RESULT($gxx_include_dir)
AC_SUBST(gxx_include_dir)
AM_CONDITIONAL(GXX_INCLUDE_DIR, test x${gxx_include_dir} != xno)

# Process the option "--enable-version-specific-runtime-libs"
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
[  version_specific_libs=yes
# Need the gcc compiler version to know where to install libraries
# and header files if --enable-version-specific-runtime-libs option
# is selected.
changequote(,)dnl
gcc_tmp=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $6}'`
gcc_num=`echo ${gcc_tmp} | sed 's/\"//g'`
#gcc_date=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $7}'`
#gcc_version=$gcc_num-$gcc_date
gcc_version=$gcc_num
changequote([,])dnl
AC_SUBST(gcc_version)
],version_specific_libs=no)
AC_MSG_RESULT($version_specific_libs)
if test x${version_specific_libs} = xyes; then
  AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x${version_specific_libs} = xyes)
  AC_MSG_WARN(version specific directory is: $gcc_version)
fi

# We have to install all the generated or linked includes files
# specified as build_headers in src/Makefile.am in a target-dependent
# place, or else multiple installs for different compilers will
# overwrite these files.
# NB: Keep this and gcc/Makefile.in's -DGPLUSPLUS_TOOL_INCLUDE_DIR in sync.
gxx_target_include_dir='$(exec_prefix)/$(target_alias)/include/g++-$(libstdcxx_interface)'
AC_SUBST(gxx_target_include_dir)


# Export all the include and flag information to makefiles.
GLIBCPP_EXPORT_INCLUDES
GLIBCPP_EXPORT_FLAGS

# This should be done by mkincludedir, but hack around it now.
blddir=`pwd`
echo "checking for $blddir/include"

if test ! -d "$blddir/include"; then
  mkdir "$blddir/include"
fi

# NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
# and libsupc++/Makefile.am so that multilib installs will end up
# installed in the correct place. To work around this not being passed
# down from config-ml.in -> top_srcdir/Makefile.am ->
# top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
AC_OUTPUT(tests_flags mkcheck Makefile src/Makefile libmath/Makefile libio/Makefile libsupc++/Makefile,
[if test -n "$CONFIG_FILES"; then
  ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
  grep '^MULTISUBDIR =' Makefile >> src/Makefile
  grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
fi
chmod +x tests_flags
chmod +x mkcheck
],
srcdir=${srcdir}
host=${host}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${multilib_arg} ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
glibcpp_basedir=${glibcpp_basedir}
CC="${CC}"
CXX="${CXX}"
)


# Generate bits/c++config.h
# NB: This must be the first generated file as others include it. . .
$srcdir/mkc++config $blddir $srcdir

# Generate bits/std_limits.h and src/limitsMEMBERS.cc
if test ! -f stamp-limits; then
  $srcdir/mknumeric_limits $blddir $srcdir $xcompiling
  if test ! -f include/bits/std_limits.h; then
    echo "mknumeric_limits failed to execute properly: exiting"
    exit 1
  else
    touch stamp-limits 
  fi
fi


# Sanity checking & User-visible messages.
# Checks down here, otherwise they get scrolled off before
# the user will notice.

# Trying to get more people to read documentation.  Possibly remove
# check and warn all the time. There is no "informational" AC_MSG_
# macro, so these are going to be printed even when --quiet/--silent
# is given.
if test ! -f stamp-sanity-warned; then
  touch stamp-sanity-warned
  echo ""
  echo "Please make certain that you read the installation information here:"
  echo "  faster => ${srcdir}/docs/install.html"
  echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
  echo ""
  echo "and the configuration information here:"
  echo "  faster => ${srcdir}/docs/configopts.html"
  echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
  echo ""
  echo "before proceeding with ${_cv_gnu_make_command}."
  echo ""
fi