2 # Process this file with autoconf to generate a configuration script.
4 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
6 #This file is part of GCC.
8 #GCC is free software; you can redistribute it and/or modify it under
9 #the terms of the GNU General Public License as published by the Free
10 #Software Foundation; either version 2, or (at your option) any later
13 #GCC is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING. If not, write to the Free
20 #Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 # Initialization and defaults
26 AC_CONFIG_HEADER(auto-host.h:config.in)
33 # Check for additional parameters
37 [ --with-gnu-ld arrange to work with GNU ld.],
38 gnu_ld_flag="$with_gnu_ld",
43 [ --with-ld arrange to use the specified ld (full pathname)],
44 DEFAULT_LINKER="$with_ld")
45 if test x"${DEFAULT_LINKER+set}" = x"set"; then
46 if test ! -x "$DEFAULT_LINKER"; then
47 AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
48 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
51 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
52 [Define to enable the use of a default linker.])
57 [ --with-gnu-as arrange to work with GNU as],
58 gas_flag="$with_gnu_as",
62 [ --with-as arrange to use the specified as (full pathname)],
63 DEFAULT_ASSEMBLER="$with_as")
64 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
65 if test ! -x "$DEFAULT_ASSEMBLER"; then
66 AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
67 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
70 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
71 [Define to enable the use of a default assembler.])
76 [ --with-stabs arrange to use stabs instead of host debug format],
82 [ --with-elf arrange to use ELF instead of host debug format],
86 # Specify the local prefix
88 AC_ARG_WITH(local-prefix,
89 [ --with-local-prefix=DIR specifies directory to put local include],
91 yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
93 *) local_prefix=$with_local_prefix ;;
96 # Default local prefix if it is empty
97 if test x$local_prefix = x; then
98 local_prefix=/usr/local
103 # Enable Multibyte Characters for C/C++
104 AC_ARG_ENABLE(c-mbchar,
105 [ --enable-c-mbchar enable multibyte characters for C and C++],
106 if test x$enable_c_mbchar != xno; then
107 AC_DEFINE(MULTIBYTE_CHARS, 1,
108 [Define if you want the C and C++ compilers to support multibyte
109 character sets for source code.])
112 # Find the native compiler
115 # autoconf is lame and doesn't give us any substitution variable for this.
116 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
117 NO_MINUS_C_MINUS_O=yes
119 OUTPUT_OPTION='-o $@'
121 AC_SUBST(NO_MINUS_C_MINUS_O)
122 AC_SUBST(OUTPUT_OPTION)
129 # sizeof(char) is 1 by definition.
130 gcc_AC_COMPILE_CHECK_SIZEOF(short)
131 gcc_AC_COMPILE_CHECK_SIZEOF(int)
132 gcc_AC_COMPILE_CHECK_SIZEOF(long)
136 # If the native compiler is GCC, we can enable warnings even in stage1.
137 # That's useful for people building cross-compilers, or just running a
140 if test "x$GCC" = "xyes"; then
141 warn_cflags='$(GCC_WARN_CFLAGS)'
143 AC_SUBST(warn_cflags)
147 AC_MSG_CHECKING([whether a default assembler was specified])
148 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
149 if test x"$gas_flag" = x"no"; then
150 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
152 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
158 AC_MSG_CHECKING([whether a default linker was specified])
159 if test x"${DEFAULT_LINKER+set}" = x"set"; then
160 if test x"$gnu_ld_flag" = x"no"; then
161 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
163 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
169 # Find some useful tools
177 gcc_AC_HEADER_STDBOOL
180 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
181 fcntl.h unistd.h sys/file.h sys/time.h \
182 sys/param.h sys/stat.h \
185 # Check for thread headers.
187 # These tests can't be done till we know if we have limits.h.
189 gcc_AC_C_COMPILE_ENDIAN
191 # See if we have the mktemp command.
192 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
194 AC_CHECK_PROG(STRIP, strip, strip, :)
196 # See if the stage1 system preprocessor understands the ANSI C
197 # preprocessor stringification operator. (Used by symcat.h.)
200 dnl Disabled until we have a complete test for buggy enum bitfields.
201 dnl gcc_AC_C_ENUM_BF_UNSIGNED
203 AC_CHECK_FUNCS(clock strchr strrchr lstat)
205 AC_CHECK_TYPE(ssize_t, int)
207 AC_FUNC_MMAP_ANYWHERE
210 # We will need to find libiberty.h and ansidecl.h
211 saved_CFLAGS="$CFLAGS"
212 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
213 gcc_AC_CHECK_DECLS(getenv abort errno \
214 malloc realloc calloc free clock, , ,[
215 #include "ansidecl.h"
216 #include "system.h"])
218 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
219 CFLAGS="$saved_CFLAGS"
221 # mkdir takes a single argument on some systems.
222 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
232 build_install_headers_dir=install-headers-tar
237 host_truncate_target=
240 # Decode the host machine, then the target machine.
241 # For the host machine, we save the xm_file variable as host_xm_file;
242 # then we decode the target machine and forget everything else
243 # that came from the host machine.
244 #for machine in $build $host $target; do
245 # . ${srcdir}/config.gcc
248 extra_objs="${host_extra_objs} ${extra_objs}"
250 # Default the target-machine variables that were not explicitly set.
251 if test x"$tm_file" = x
252 then tm_file=$cpu_type/$cpu_type.h; fi
254 if test x"$extra_headers" = x
255 then extra_headers=; fi
257 if test x$md_file = x
258 then md_file=$cpu_type/$cpu_type.md; fi
260 if test x$out_file = x
261 then out_file=$cpu_type/$cpu_type.c; fi
263 if test x"$tmake_file" = x
264 then tmake_file=$cpu_type/t-$cpu_type
267 if test x"$dwarf2" = xyes
268 then tm_file="$tm_file tm-dwarf2.h"
271 # Handle cpp installation.
272 if test x$enable_cpp != xno
274 tmake_file="$tmake_file t-install-cpp"
277 # auto-host.h is the file containing items generated by autoconf and is
278 # the first file included by config.h.
279 # If host=build, it is correct to have hconfig include auto-host.h
280 # as well. If host!=build, we are in error and need to do more
281 # work to find out the build config parameters.
282 if test x$host = x$build
284 build_auto=auto-host.h
286 # We create a subdir, then run autoconf in the subdir.
287 # To prevent recursion we set host and build for the new
288 # invocation of configure to the build for this invocation
295 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
296 *) realsrcdir=../${srcdir};;
298 CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
299 --target=$target --host=$build --build=$build
301 # We just finished tests for the build machine, so rename
302 # the file auto-build.h in the gcc directory.
303 mv auto-host.h ../auto-build.h
306 build_auto=auto-build.h
309 tm_file="${tm_file} defaults.h"
310 host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}"
311 build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}"
312 xm_file="ansidecl.h ${xm_file} ${tm_file}"
314 # Truncate the target if necessary
315 if test x$host_truncate_target != x; then
316 target=`echo $target | sed -e 's/\(..............\).*/\1/'`
319 # Get the version trigger filename from the toplevel
320 if test "${with_gcc_version_trigger+set}" = set; then
321 gcc_version_trigger=$with_gcc_version_trigger
323 gcc_version_trigger=${srcdir}/version.c
326 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
327 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
329 # Compile in configure arguments.
330 if test -f configargs.h ; then
331 # Being re-configured.
332 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
333 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
335 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
337 cat > configargs.h <<EOF
338 /* Generated automatically. */
339 static const char configuration_arguments[] = "$gcc_config_arguments";
340 static const char thread_model[] = "$thread_file";
344 # Internationalization
346 VERSION="$gcc_version"
347 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
348 [Define to the name of the distribution.])
349 AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
350 [Define to the version of the distribution.])
356 # Get an absolute path to the GCC top-level source directory
362 out_object_file=`basename $out_file .c`.o
364 # Figure out what assembler we will be using.
365 AC_MSG_CHECKING(what assembler to use)
367 gcc_cv_gas_major_version=
368 gcc_cv_gas_minor_version=
369 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
370 if test -x "$DEFAULT_ASSEMBLER"; then
371 gcc_cv_as="$DEFAULT_ASSEMBLER"
372 elif test -x "$AS"; then
374 elif test -x as$host_exeext; then
375 # Build using assembler in the current directory.
376 gcc_cv_as=./as$host_exeext
377 elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then
378 # Single tree build which includes gas.
379 for f in $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
382 gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
384 if test x$gcc_cv_gas_version != x; then
389 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
390 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
394 if test "x$gcc_cv_as" = x -a x$host = x$target; then
396 # Search the same directories that the installed compiler will
397 # search. Else we may find the wrong assembler and lose. If we
398 # do not find a suitable assembler binary, then try the user's
401 # Also note we have to check MD_EXEC_PREFIX before checking the
402 # user's path. Unfortunately, there is no good way to get at the
403 # value of MD_EXEC_PREFIX here. So we do a brute force search
404 # through all the known MD_EXEC_PREFIX values. Ugh. This needs
405 # to be fixed as part of the make/configure rewrite too.
407 if test "x$exec_prefix" = xNONE; then
408 if test "x$prefix" = xNONE; then
409 test_prefix=/usr/local
414 test_prefix=$exec_prefix
417 # If the loop below does not find an assembler, then use whatever
418 # one we can find in the users's path.
420 gcc_cv_as=as$host_exeext
422 test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
423 $test_prefix/lib/gcc-lib/$target \
424 /usr/lib/gcc/$target/$gcc_version \
425 /usr/lib/gcc/$target \
426 $test_prefix/$target/bin/$target/$gcc_version \
427 $test_prefix/$target/bin \
432 /bsd43/usr/lib/cmplrs/cc \
433 /usr/cross64/usr/bin \
435 /sysv/usr/lib/cmplrs/cc \
436 /svr4/usr/lib/cmplrs/cc \
439 for dir in $test_dirs; do
440 if test -f $dir/as$host_exeext; then
441 gcc_cv_as=$dir/as$host_exeext
446 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
447 AC_MSG_RESULT("newly built gas")
449 AC_MSG_RESULT($gcc_cv_as)
452 # Figure out what nm we will be using.
453 AC_MSG_CHECKING(what nm to use)
454 if test -x nm$host_exeext; then
455 gcc_cv_nm=./nm$host_exeext
456 elif test x$host = x$target; then
458 gcc_cv_nm=nm$host_exeext
460 AC_MSG_RESULT($gcc_cv_nm)
462 dnl Very limited version of automake's enable-maintainer-mode
464 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
465 dnl maintainer-mode is disabled by default
466 AC_ARG_ENABLE(maintainer-mode,
467 [ --enable-maintainer-mode
468 enable make rules and dependencies not useful
469 (and sometimes confusing) to the casual installer],
470 maintainer_mode=$enableval,
473 AC_MSG_RESULT($maintainer_mode)
475 if test "$maintainer_mode" = "yes"; then
482 # These (without "all_") are set in each config-lang.in.
483 # `language' must be a single word so is spelled singularly.
485 all_outputs='Makefile'
486 # List of language makefile fragments.
488 # Add the language fragments.
489 # Languages are added via two mechanisms. Some information must be
490 # recorded in makefile variables, these are defined in config-lang.in.
491 # We accumulate them and plug them into the main Makefile.
492 # The other mechanism is a set of hooks for each of the main targets
493 # like `clean', `install', etc.
495 language_fragments="Make-lang"
497 # Define variables host_canonical and build_canonical
498 # because some Cygnus local changes in the Makefile depend on them.
499 build_canonical=${build}
500 host_canonical=${host}
502 if test "${host}" != "${target}" ; then
503 target_subdir=${target_alias}/
505 AC_SUBST(build_canonical)
506 AC_SUBST(host_canonical)
507 AC_SUBST(target_subdir)
509 # Nothing to do for FLOAT_H, float_format already handled.
513 # Substitute configuration variables
514 AC_SUBST(all_stagestuff)
515 AC_SUBST(build_exeext)
516 AC_SUBST(build_install_headers_dir)
517 AC_SUBST(build_xm_file_list)
518 AC_SUBST(build_xm_file)
519 AC_SUBST(build_xm_defines)
520 AC_SUBST(check_languages)
521 AC_SUBST(dep_host_xmake_file)
522 AC_SUBST(dep_tmake_file)
523 AC_SUBST(extra_c_flags)
524 AC_SUBST(extra_headers_list)
526 AC_SUBST(extra_parts)
527 AC_SUBST(extra_passes)
528 AC_SUBST(extra_programs)
529 AC_SUBST(gcc_config_arguments)
530 AC_SUBST(gcc_version)
531 AC_SUBST(gcc_version_full)
532 AC_SUBST(gcc_version_trigger)
533 AC_SUBST(host_exeext)
534 AC_SUBST(host_extra_gcc_objs)
536 AC_SUBST(lang_tree_files)
537 AC_SUBST(local_prefix)
540 AC_SUBST(out_object_file)
541 AC_SUBST(symbolic_link)
542 AC_SUBST(thread_file)
543 AC_SUBST(c_target_objs)
545 #AC_SUBST_FILE(target_overrides)
546 #AC_SUBST_FILE(host_overrides)
547 #AC_SUBST(cross_defines)
548 #AC_SUBST_FILE(cross_overrides)
549 #AC_SUBST_FILE(build_overrides)
551 # Create the Makefile
552 # and configure language subdirectories
553 AC_OUTPUT($all_outputs,
555 case x$CONFIG_HEADERS in
556 xauto-host.h:config.in)
560 # Avoid having to add intl to our include paths.
561 if test -f intl/libintl.h; then
562 echo creating libintl.h
563 echo '#include "intl/libintl.h"' >libintl.h
570 target_alias='${target_alias}'
572 symbolic_link='${symbolic_link}'
573 program_transform_set='${program_transform_set}'
574 program_transform_name='${program_transform_name}'
575 dep_host_xmake_file='${dep_host_xmake_file}'
576 host_xmake_file='${host_xmake_file}'
577 dep_tmake_file='${dep_tmake_file}'
578 tmake_file='${tmake_file}'
579 thread_file='${thread_file}'
580 gcc_config_arguments='${gcc_config_arguments}'
581 gcc_version='${gcc_version}'
582 gcc_version_full='${gcc_version_full}'
583 gcc_version_trigger='${gcc_version_trigger}'
584 local_prefix='${local_prefix}'
585 build_install_headers_dir='${build_install_headers_dir}'
586 build_exeext='${build_exeext}'
587 host_exeext='${host_exeext}'
588 out_file='${out_file}'
589 gdb_needs_out_file_path='${gdb_needs_out_file_path}'
590 SET_MAKE='${SET_MAKE}'
591 target_list='${target_list}'
592 target_overrides='${target_overrides}'
593 host_overrides='${host_overrides}'
594 cross_defines='${cross_defines}'
595 cross_overrides='${cross_overrides}'
596 build_overrides='${build_overrides}'
597 cpp_install_dir='${cpp_install_dir}'