# configure.in for GNU CC # Process this file with autoconf to generate a configuration script. # Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. #This file is part of GNU CC. #GNU CC is free software; you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation; either version 2, or (at your option) #any later version. #GNU CC is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with GNU CC; see the file COPYING. If not, write to #the Free Software Foundation, 59 Temple Place - Suite 330, #Boston, MA 02111-1307, USA. # Initialization and defaults AC_PREREQ(2.13) AC_INIT(cppmain.c) AC_CONFIG_HEADER(auto-host.h:config.in) remove=rm hard_link=ln symbolic_link='ln -s' copy=cp # Check for additional parameters # With GNU ld AC_ARG_WITH(gnu-ld, [ --with-gnu-ld arrange to work with GNU ld.], gnu_ld_flag="$with_gnu_ld", gnu_ld_flag=no) # With pre-defined ld AC_ARG_WITH(ld, [ --with-ld arrange to use the specified ld (full pathname)], DEFAULT_LINKER="$with_ld") if test x"${DEFAULT_LINKER+set}" = x"set"; then if test ! -x "$DEFAULT_LINKER"; then AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then gnu_ld_flag=yes fi AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", [Define to enable the use of a default linker.]) fi # With GNU as AC_ARG_WITH(gnu-as, [ --with-gnu-as arrange to work with GNU as], gas_flag="$with_gnu_as", gas_flag=no) AC_ARG_WITH(as, [ --with-as arrange to use the specified as (full pathname)], DEFAULT_ASSEMBLER="$with_as") if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then if test ! -x "$DEFAULT_ASSEMBLER"; then AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then gas_flag=yes fi AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", [Define to enable the use of a default assembler.]) fi # With stabs AC_ARG_WITH(stabs, [ --with-stabs arrange to use stabs instead of host debug format], stabs="$with_stabs", stabs=no) # With ELF AC_ARG_WITH(elf, [ --with-elf arrange to use ELF instead of host debug format], elf="$with_elf", elf=no) # Specify the local prefix local_prefix= AC_ARG_WITH(local-prefix, [ --with-local-prefix=DIR specifies directory to put local include], [case "${withval}" in yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; no) ;; *) local_prefix=$with_local_prefix ;; esac]) # Default local prefix if it is empty if test x$local_prefix = x; then local_prefix=/usr/local fi # Enable Multibyte Characters for C/C++ AC_ARG_ENABLE(c-mbchar, [ --enable-c-mbchar enable multibyte characters for C and C++], if test x$enable_c_mbchar != xno; then AC_DEFINE(MULTIBYTE_CHARS, 1, [Define if you want the C and C++ compilers to support multibyte character sets for source code.]) fi) # Find the native compiler AC_PROG_CC AC_PROG_CC_C_O # autoconf is lame and doesn't give us any substitution variable for this. if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then NO_MINUS_C_MINUS_O=yes else OUTPUT_OPTION='-o $@' fi AC_SUBST(NO_MINUS_C_MINUS_O) AC_SUBST(OUTPUT_OPTION) AC_PROG_CPP AC_C_INLINE # sizeof(char) is 1 by definition. gcc_AC_COMPILE_CHECK_SIZEOF(short) gcc_AC_COMPILE_CHECK_SIZEOF(int) gcc_AC_COMPILE_CHECK_SIZEOF(long) gcc_AC_C_CHARSET # If the native compiler is GCC, we can enable warnings even in stage1. # That's useful for people building cross-compilers, or just running a # quick `make'. warn_cflags= if test "x$GCC" = "xyes"; then warn_cflags='$(GCC_WARN_CFLAGS)' fi AC_SUBST(warn_cflags) AC_PROG_MAKE_SET AC_MSG_CHECKING([whether a default assembler was specified]) if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then if test x"$gas_flag" = x"no"; then AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) else AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) fi else AC_MSG_RESULT(no) fi AC_MSG_CHECKING([whether a default linker was specified]) if test x"${DEFAULT_LINKER+set}" = x"set"; then if test x"$gnu_ld_flag" = x"no"; then AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) else AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) fi else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(for GNU C library) AC_CACHE_VAL(gcc_cv_glibc, [AC_TRY_COMPILE( [#include ],[ #if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) #error Not a GNU C library system #endif], [gcc_cv_glibc=yes], gcc_cv_glibc=no)]) AC_MSG_RESULT($gcc_cv_glibc) if test $gcc_cv_glibc = yes; then AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library]) fi # Find some useful tools gcc_AC_PROG_LN gcc_AC_PROG_LN_S AC_PROG_RANLIB gcc_AC_PROG_INSTALL AC_HEADER_STDC AC_HEADER_TIME gcc_AC_HEADER_STRING AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \ fcntl.h unistd.h sys/file.h sys/time.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \ direct.h malloc.h langinfo.h) # Check for thread headers. # These tests can't be done till we know if we have limits.h. gcc_AC_C_CHAR_BIT gcc_AC_C_COMPILE_ENDIAN # See if we have the mktemp command. AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) AC_CHECK_PROG(STRIP, strip, strip, :) # See if the stage1 system preprocessor understands the ANSI C # preprocessor stringification operator. (Used by symcat.h.) AC_C_STRINGIZE # Use only if it exists, # doesn't clash with , and declares intmax_t. AC_MSG_CHECKING(for inttypes.h) AC_CACHE_VAL(gcc_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [intmax_t i = -1;], [gcc_cv_header_inttypes_h=yes], gcc_cv_header_inttypes_h=no)]) AC_MSG_RESULT($gcc_cv_header_inttypes_h) if test $gcc_cv_header_inttypes_h = yes; then AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if you have a working header file.]) fi dnl Disabled until we have a complete test for buggy enum bitfields. dnl gcc_AC_C_ENUM_BF_UNSIGNED AC_CHECK_FUNCS(times clock strchr strrchr lstat) AC_CHECK_TYPE(ssize_t, int) AC_FUNC_MMAP_ANYWHERE AC_FUNC_MMAP_FILE # We will need to find libiberty.h and ansidecl.h saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" gcc_AC_CHECK_DECLS(getenv abort errno \ malloc realloc calloc free getopt clock, , ,[ #include "ansidecl.h" #include "system.h"]) gcc_AC_CHECK_DECLS(times, , ,[ #include "ansidecl.h" #include "system.h" #ifdef HAVE_SYS_TIMES_H #include #endif ]) # More time-related stuff. AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ AC_TRY_COMPILE([ #include "ansidecl.h" #include "system.h" #ifdef HAVE_SYS_TIMES_H #include #endif ], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)]) if test $ac_cv_struct_tms = yes; then AC_DEFINE(HAVE_STRUCT_TMS, 1, [Define if defines struct tms.]) fi # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. # revisit after autoconf 2.50. AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ AC_TRY_COMPILE([ #include "ansidecl.h" #include "system.h" ], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)]) if test $gcc_cv_type_clock_t = yes; then AC_DEFINE(HAVE_CLOCK_T, 1, [Define if defines clock_t.]) fi # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" # mkdir takes a single argument on some systems. gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG # File extensions manext='.1' objext='.o' AC_SUBST(manext) AC_SUBST(objext) build_xm_file= build_xm_defines= build_install_headers_dir=install-headers-tar build_exeext= host_xm_file= host_xm_defines= host_xmake_file= host_truncate_target= host_exeext= # Decode the host machine, then the target machine. # For the host machine, we save the xm_file variable as host_xm_file; # then we decode the target machine and forget everything else # that came from the host machine. #for machine in $build $host $target; do # . ${srcdir}/config.gcc #done extra_objs="${host_extra_objs} ${extra_objs}" # Default the target-machine variables that were not explicitly set. if test x"$tm_file" = x then tm_file=$cpu_type/$cpu_type.h; fi if test x"$extra_headers" = x then extra_headers=; fi if test x$md_file = x then md_file=$cpu_type/$cpu_type.md; fi if test x$out_file = x then out_file=$cpu_type/$cpu_type.c; fi if test x"$tmake_file" = x then tmake_file=$cpu_type/t-$cpu_type fi if test x"$dwarf2" = xyes then tm_file="$tm_file tm-dwarf2.h" fi # Handle cpp installation. if test x$enable_cpp != xno then tmake_file="$tmake_file t-install-cpp" fi # auto-host.h is the file containing items generated by autoconf and is # the first file included by config.h. # If host=build, it is correct to have hconfig include auto-host.h # as well. If host!=build, we are in error and need to do more # work to find out the build config parameters. if test x$host = x$build then build_auto=auto-host.h else # We create a subdir, then run autoconf in the subdir. # To prevent recursion we set host and build for the new # invocation of configure to the build for this invocation # of configure. tempdir=build.$$ rm -rf $tempdir mkdir $tempdir cd $tempdir case ${srcdir} in /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; *) realsrcdir=../${srcdir};; esac CC=${CC_FOR_BUILD} ${realsrcdir}/configure \ --target=$target --host=$build --build=$build # We just finished tests for the build machine, so rename # the file auto-build.h in the gcc directory. mv auto-host.h ../auto-build.h cd .. rm -rf $tempdir build_auto=auto-build.h fi tm_file="${tm_file} defaults.h" host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}" build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}" xm_file="ansidecl.h ${xm_file} ${tm_file}" # Truncate the target if necessary if test x$host_truncate_target != x; then target=`echo $target | sed -e 's/\(..............\).*/\1/'` fi # Get the version trigger filename from the toplevel if test "${with_gcc_version_trigger+set}" = set; then gcc_version_trigger=$with_gcc_version_trigger else gcc_version_trigger=${srcdir}/version.c fi changequote(,)dnl gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'` gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` # Compile in configure arguments. if test -f configargs.h ; then # Being re-configured. gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" else gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" fi cat > configargs.h < cstamp-h ;; esac # Avoid having to add intl to our include paths. if test -f intl/libintl.h; then echo creating libintl.h echo '#include "intl/libintl.h"' >libintl.h fi ], [ host='${host}' build='${build}' target='${target}' target_alias='${target_alias}' srcdir='${srcdir}' symbolic_link='${symbolic_link}' program_transform_set='${program_transform_set}' program_transform_name='${program_transform_name}' dep_host_xmake_file='${dep_host_xmake_file}' host_xmake_file='${host_xmake_file}' dep_tmake_file='${dep_tmake_file}' tmake_file='${tmake_file}' thread_file='${thread_file}' gcc_config_arguments='${gcc_config_arguments}' gcc_version='${gcc_version}' gcc_version_full='${gcc_version_full}' gcc_version_trigger='${gcc_version_trigger}' local_prefix='${local_prefix}' build_install_headers_dir='${build_install_headers_dir}' build_exeext='${build_exeext}' host_exeext='${host_exeext}' out_file='${out_file}' gdb_needs_out_file_path='${gdb_needs_out_file_path}' SET_MAKE='${SET_MAKE}' target_list='${target_list}' target_overrides='${target_overrides}' host_overrides='${host_overrides}' cross_defines='${cross_defines}' cross_overrides='${cross_overrides}' build_overrides='${build_overrides}' cpp_install_dir='${cpp_install_dir}' ])