From 6a9cf61e0fb67ba9df9ddd800cc8a4c272f91795 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 2 Jul 2004 07:56:07 +0000 Subject: 2004-07-01 Paolo Bonzini * Makefile.def (build_modules): Add bison, byacc, flex, m4, texinfo. (flags_to_pass): Add FLEX. * Makefile.tpl (BUILD_DIR_PREFIX, BASE_EXPORTS): New. (BUILD_EXPORTS, HOST_EXPORTS, BASE_TARGET_EXPORTS): Include it. (DEFAULT_YACC, USUAL_YACC, DEFAULT_LEX, USUAL_LEX, DEFAULT_M4, DEFAULT_MAKEINFO): Remove. (CONFIGURED_YACC, CONFIGURED_FLEX, CONFIGURED_BISON, CONFIGURED_LEX, CONFIGURED_M4, CONFIGURED_MAKEINFO): Substitute. (YACC, FLEX, BISON, LEX, M4, MAKEINFO): Define to look into objdir or else use configured tool. (all-build): New. (all): Depend on it. (Build module dependencies): Add. * Makefile.in: Regenerate. * configure.in: Better support for multiple build modules, matching what is done for host/target modules. Do not look for "plausible" locations of build tools if Canadian cross. Use autoconf's AC_PROG_CC to find a C compiler. Define BUILD_DIR_PREFIX. Look for flex, makeinfo and m4. * configure: Regenerate. --- configure.in | 170 +++++++++++++---------------------------------------------- 1 file changed, 38 insertions(+), 132 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 4ec0d21..a66e946 100644 --- a/configure.in +++ b/configure.in @@ -126,6 +126,14 @@ fi # Double entries in build_configdirs, configdirs, or target_configdirs may # cause circular dependencies and break everything horribly. +# these library is used by various programs built for the build +# environment +# +build_libs="build-libiberty" + +# these tools are built for the build environment +build_tools="build-texinfo build-byacc build-flex build-bison build-m4" + # these libraries are used by various programs built for the host environment # host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib libbanshee libcpp" @@ -173,20 +181,14 @@ target_tools="target-examples target-groff target-gperf target-rda" ## is important because configure will choke if they ever get through. ## ${configdirs} is directories we build using the host tools. ## ${target_configdirs} is directories we build using the target tools. -# configdirs=`echo ${host_libs} ${host_tools}` target_configdirs=`echo ${target_libraries} ${target_tools}` # Only make build modules if build != host. -# This should be done more generally, but at the moment it doesn't matter. if test ${host_alias} != ${build_alias} ; then - # This is the only build module. - build_modules=libiberty -else - build_modules= + build_configdirs=`echo ${build_libs} ${build_tools}` fi - ################################################################################ srcname="gnu development package" @@ -956,7 +958,6 @@ if test "${build}" != "${host}" ; then # If we are doing a Canadian Cross, in which the host and build systems # are not the same, we set reasonable default values for the tools. - BISON=${BISON-bison} CC=${CC-${host_alias}-gcc} CFLAGS=${CFLAGS-"-g -O2"} CXX=${CXX-${host_alias}-c++} @@ -966,49 +967,9 @@ if test "${build}" != "${host}" ; then CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++} GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj} GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}} + BUILD_DIR_PREFIX=${build_subdir} BUILD_PREFIX=${build_alias}- BUILD_PREFIX_1=${build_alias}- - MAKEINFO=${MAKEINFO-makeinfo} - - if test -z "${YACC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/bison; then - YACC="bison -y" - break - fi - if test -f $dir/byacc; then - YACC=byacc - break - fi - if test -f $dir/yacc; then - YACC=yacc - break - fi - done - IFS="$save_ifs" - if test -z "${YACC}" ; then - YACC="bison -y" - fi - fi - - if test -z "${LEX}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/flex; then - LEX=flex - break - fi - if test -f $dir/lex; then - LEX=lex - break - fi - done - IFS="$save_ifs" - LEX=${LEX-flex} - fi else # Set reasonable default values for some tools even if not Canadian. @@ -1019,71 +980,19 @@ else # in Makefile.in, so can still be overridden by fragments. # This is all going to change when we autoconfiscate... - BISON="\$(USUAL_BISON)" CC_FOR_BUILD="\$(CC)" GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)" + BUILD_DIR_PREFIX= BUILD_PREFIX= BUILD_PREFIX_1=loser- - MAKEINFO="\$(USUAL_MAKEINFO)" - LEX="\$(USUAL_LEX)" - YACC="\$(USUAL_YACC)" - - # If CC is still not set, try to get gcc. - cc_prog_is_gcc= - if test -z "${CC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - CC="gcc" - cc_prog_is_gcc=yes - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - break - fi - done - IFS="$save_ifs" - CC=${CC-cc} - else - # Determine if we are using gcc. - cat > conftest.c </dev/null 2>&1; then - cc_prog_is_gcc=yes - fi - rm -f conftest.c - if test -z "${CFLAGS}"; then - # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC - # is set to a version of gcc. - if test "$cc_prog_is_gcc" = yes; then - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - fi - fi - fi + + AC_PROG_CC # We must set the default linker to the linker used by gcc for the correct # operation of libtool. If LD is not defined and we are using gcc, try to # set the LD default to the ld used by gcc. if test -z "$LD"; then - if test "$cc_prog_is_gcc" = yes; then + if test "$GCC" = yes; then case $build in *-*-mingw*) gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; @@ -1349,6 +1258,15 @@ fi # Quietly strip out all directories which aren't configurable in this tree. # This relies on all configurable subdirectories being autoconfiscated, which # is now the case. +build_configdirs_all="$build_configdirs" +build_configdirs= +for i in ${build_configdirs_all} ; do + j=`echo $i | sed -e s/build-//g` + if test -f ${srcdir}/$j/configure ; then + build_configdirs="${build_configdirs} $i" + fi +done + configdirs_all="$configdirs" configdirs= for i in ${configdirs_all} ; do @@ -1356,6 +1274,7 @@ for i in ${configdirs_all} ; do configdirs="${configdirs} $i" fi done + target_configdirs_all="$target_configdirs" target_configdirs= for i in ${target_configdirs_all} ; do @@ -1382,7 +1301,7 @@ if test -n "${notsupp}" && test -z "${norecursion}" ; then appdirs="" break fi - if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then appdirs="" break fi @@ -1597,12 +1516,16 @@ esac tooldir='${exec_prefix}'/${target_alias} build_tooldir=${tooldir} -# Generate default definitions for YACC, M4, LEX. These are used if the -# Makefile can't locate these programs in objdir. +# Generate default definitions for YACC, M4, LEX and other programs that run +# on the build machine. These are used if the Makefile can't locate these +# programs in objdir. MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing -AC_CHECK_PROGS([DEFAULT_YACC], ['bison -y' byacc yacc], [$MISSING bison]) -AC_CHECK_PROGS([DEFAULT_M4], [gm4 gnum4 m4], [$MISSING m4]) -AC_CHECK_PROGS([DEFAULT_LEX], [flex lex], [$MISSING flex]) +AC_CHECK_PROGS([CONFIGURED_BISON], [bison], [$MISSING bison]) +AC_CHECK_PROGS([CONFIGURED_YACC], ['bison -y' byacc yacc], [$MISSING bison -y]) +AC_CHECK_PROGS([CONFIGURED_M4], [gm4 gnum4 m4], [$MISSING m4]) +AC_CHECK_PROGS([CONFIGURED_FLEX], [flex], [$MISSING flex]) +AC_CHECK_PROGS([CONFIGURED_LEX], [flex lex], [$MISSING flex]) +AC_CHECK_PROGS([CONFIGURED_MAKEINFO], makeinfo, [$MISSING makeinfo]) # Create a .gdbinit file which runs the one in srcdir # and tells GDB to look there for source files. @@ -1685,17 +1608,7 @@ esac # Record target_configdirs and the configure arguments for target and # build configuration in Makefile. target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'` - -# This is the final value for target_configdirs. configdirs already -# has its final value, as does build_modules. It's time to create some -# lists of valid targets. - -all_build_modules= -configure_build_modules= -for module in ${build_modules} ; do - all_build_modules=all-build-${module} - configure_build_modules=configure-build-${module} -done +build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'` # Determine whether gdb needs tk/tcl or not. # Use 'maybe' since enable_gdbtk might be true even if tk isn't available @@ -1761,7 +1674,7 @@ case "$enable_bootstrap" in esac AC_SUBST(default_target) -for module in ${build_modules} ; do +for module in ${build_configdirs} ; do if test -z "${no_recursion}" \ && test -f ${build_subdir}/${module}/Makefile; then echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure" @@ -2138,6 +2051,7 @@ AC_SUBST_FILE(ospace_frag) # Miscellanea: directories, flags, etc. AC_SUBST(SET_LIB_PATH) AC_SUBST(RPATH_ENVVAR) +AC_SUBST(BUILD_DIR_PREFIX) AC_SUBST(BUILD_PREFIX) AC_SUBST(BUILD_PREFIX_1) AC_SUBST(gcc_version_trigger) @@ -2150,8 +2064,7 @@ AC_SUBST(libstdcxx_incdir) # Build module lists & subconfigure args. AC_SUBST(build_configargs) -AC_SUBST(configure_build_modules) -AC_SUBST(all_build_modules) +AC_SUBST(build_configdirs) # Host module lists & subconfigure args. AC_SUBST(host_configargs) @@ -2162,11 +2075,7 @@ AC_SUBST(target_configargs) AC_SUBST(target_configdirs) # Build tools. -AC_SUBST(BISON) AC_SUBST(CC_FOR_BUILD) -AC_SUBST(LEX) -AC_SUBST(MAKEINFO) -AC_SUBST(YACC) AC_SUBST(config_shell) # Host tools. @@ -2184,9 +2093,6 @@ AC_SUBST(CXX) AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_FOR_BUILD) AC_SUBST(CXXFLAGS) -AC_SUBST(DEFAULT_YACC) -AC_SUBST(DEFAULT_LEX) -AC_SUBST(DEFAULT_M4) # Target tools. NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_AR_FOR_TARGET, ar) -- cgit v1.1