2002-12-13 Nathanael Nerode <neroden@gcc.gnu.org>
[deliverable/binutils-gdb.git] / configure.in
index 6b714947a6661414af85e192fa90d283080ad7ef..6969311c015df462806509aaec3d7fc00108fa70 100644 (file)
 
 ##############################################################################
 
+extra_host_args=
+# Define the trigger file to make sure configure will re-run whenever
+# the gcc version number changes.
+if [ "${with_gcc_version_trigger+set}" = set ]; then
+    gcc_version_trigger="$with_gcc_version_trigger"
+    gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
+else
+    # If gcc's sources are available, define the trigger file.
+    if [ -f ${topsrcdir}/gcc/version.c ] ; then
+       gcc_version_trigger=${topsrcdir}/gcc/version.c
+       gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
+       case "$arguments" in
+         *--with-gcc-version-trigger=$gcc_version_trigger* )
+           ;;
+         * )
+           # Add to all subconfigure arguments: build, host, and target.
+           arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
+           ;;
+       esac
+       # This will be redundant when we start all subconfigures from the Makefile.
+       extra_host_args="--with-gcc-version-trigger=$gcc_version_trigger $extra_host_args"
+    fi
+fi
+
 ### To add a new directory to the tree, first choose whether it is a target
 ### or a host dependent tool.  Then put it into the appropriate list
-### (library or tools, host or target), doing a dependency sort.  For
-### example, gdb requires that byacc (or bison) be built first, so it is in
-### the ${host_tools} list after byacc and bison.  
+### (library or tools, host or target), doing a dependency sort.
+
+# Subdirs will be configured in the order listed in build_configdirs, 
+# configdirs, or target_configdirs; see the serialization section below.
+
+# Dependency sorting is only needed when *configuration* must be done in 
+# a particular order.  In all cases a dependency should be specified in 
+# the Makefile, whether or not it's implicitly specified here.
 
+# Double entries in build_configdirs, configdirs, or target_configdirs may
+# cause circular dependencies and break everything horribly.
 
 # these libraries are used by various programs built for the host environment
 #
-host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk tclX itcl tix libgui zlib"
+host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk itcl tix libgui zlib"
 
 libstdcxx_version="target-libstdc++-v3"
 
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
 # know that we are building the simulator.
-host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar"
+# binutils, gas and ld appear in that order because it makes sense to run
+# "make check" in that particular order.
+host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -76,7 +109,7 @@ target_libs="target-libiberty \
 # list belongs in this list.  those programs are also very likely
 # candidates for the "native_only" list which follows
 #
-target_tools="target-examples target-groff target-gperf"
+target_tools="target-examples target-groff target-gperf target-rda"
 
 ################################################################################
 
@@ -197,12 +230,8 @@ esac
 # Configure extra directories which are host specific
 
 case "${host}" in
-  i[3456]86-*-go32*)
-    configdirs="$configdirs dosrel" ;;
-  i[3456]86-*-mingw32*)
-    configdirs="$configdirs dosrel" ;;
   *-cygwin*)
-    configdirs="$configdirs libtermcap dosrel" ;;
+    configdirs="$configdirs libtermcap" ;;
 esac
 
 # Remove more programs from consideration, based on the host or 
@@ -238,6 +267,9 @@ case "${host}" in
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
     ;;
+  *-*-darwin*)
+    noconfigdirs="$noconfigdirs tk itcl tix libgui"
+    ;;
 esac
 
 # Save it here so that, even in case of --enable-libgcj, if the Java
@@ -525,7 +557,7 @@ case "${target}" in
     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
     ;;
   powerpc-*-darwin*)
-    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb tk itcl tix libgui gprof ${libgcj}"
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof ${libgcj}"
     ;;
   powerpc-*-eabi)
     noconfigdirs="$noconfigdirs ${libgcj}"
@@ -852,13 +884,6 @@ case "$host" in
   *msdosdjgpp*)
     enable_gdbtk=no ;;
 esac
-# Determine whether gdb needs tk/tcl or not.
-case "$enable_gdbtk" in
-  no)
-    GDB_TK="" ;;
-  *)
-    GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui" ;;
-esac
 
 copy_dirs=
 
@@ -1118,10 +1143,9 @@ if test -n "${host_makefile_frag}" ; then
   host_makefile_frag=mh-frag
 fi
 
+extra_arflags_for_target=
+extra_nmflags_for_target=
 case "${target}" in
-  v810*)
-    target_makefile_frag="config/mt-v810"
-    ;;
   i[3456]86-*-netware*)
     target_makefile_frag="config/mt-netware"
     ;;
@@ -1132,7 +1156,11 @@ case "${target}" in
     target_makefile_frag="config/mt-linux"
     ;;
   *-*-aix4.[3456789]* | *-*-aix[56789].*)
-    target_makefile_frag="config/mt-aix43"
+    # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm 
+    # commands to handle both 32-bit and 64-bit objects.  These flags are
+    # harmless if we're using GNU nm or ar.
+    extra_arflags_for_target=" -X32_64"
+    extra_nmflags_for_target=" -B -X32_64"
     ;;
   mips*-*-pe | sh*-*-pe | *arm-wince-pe)
     target_makefile_frag="config/mt-wince"
@@ -1194,21 +1222,21 @@ fi
 if test x${use_gnu_as} = x &&
    echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
   with_gnu_as=yes
-  withoptions="$withoptions --with-gnu-as"
+  extra_host_args="$extra_host_args --with-gnu-as"
 fi
 
 if test x${use_gnu_ld} = x &&
    echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then
   with_gnu_ld=yes
-  withoptions="$withoptions --with-gnu-ld"
+  extra_host_args="$extra_host_args --with-gnu-ld"
 fi
 
-# If using newlib, add --with-newlib to the withoptions so that gcc/configure
+# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
 # can detect this case.
 
 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
   with_newlib=yes
-  withoptions="$withoptions --with-newlib"
+  extra_host_args="$extra_host_args --with-newlib"
 fi
 
 # We default to --with-shared on platforms where -fpic is meaningless.
@@ -1235,13 +1263,13 @@ if test x${with_stabs} = x ; then
   case "${target}" in
   mips*-*-irix6*o32)
     with_stabs=yes;
-    withoptions="${withoptions} --with-stabs"
+    extra_host_args="${extra_host_args} --with-stabs"
     ;;
   mips*-*-irix6*)
     ;;
   mips*-*-* | alpha*-*-osf*)
     with_stabs=yes;
-    withoptions="${withoptions} --with-stabs"
+    extra_host_args="${extra_host_args} --with-stabs"
     ;;
   esac
 fi
@@ -1250,10 +1278,13 @@ fi
 # them automatically.
 case "${host}" in
   hppa*64*-*-hpux11*)  
-    withoptions="$withoptions -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
+    extra_host_args="$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
     ;;
 esac
 
+# This will go away when we start subconfigures from the Makefile.
+withoptions="${withoptions} ${extra_host_args}"
+
 # If we aren't going to be using gcc, see if we can extract a definition
 # of CC from the fragment.
 # Actually, use the 'pre-extracted' version above.
@@ -1345,6 +1376,107 @@ sed -e "s/@RPATH_ENVVAR@/${RPATH_ENVVAR}/" Makefile > Makefile.tem
 rm -f Makefile
 mv -f Makefile.tem Makefile
 
+# 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.  It's time to create some lists of valid targets.
+
+all_build_modules=
+configure_build_modules=
+# 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
+  all_build_modules=all-build-libiberty
+  configure_build_modules=configure-build-libiberty
+fi
+
+all_host_modules=
+check_host_modules=
+install_host_modules=
+configure_host_modules=
+for module in ${configdirs} ; do
+  all_host_modules="${all_host_modules} all-${module}"
+  check_host_modules="${check_host_modules} check-${module}"
+  install_host_modules="${install_host_modules} install-${module}"
+  configure_host_modules="${configure_host_modules} configure-${module}"
+done
+install_host_modules_nogcc=`echo "${install_host_modules}" | sed -e 's/install-gcc//g'`
+
+all_target_modules=
+check_target_modules=
+install_target_modules=
+configure_target_modules=
+for module in ${target_configdirs} ; do
+  all_target_modules="${all_target_modules} all-target-${module}"
+  check_target_modules="${check_target_modules} check-target-${module}"
+  install_target_modules="${install_target_modules} install-target-${module}"
+  configure_target_modules="${configure_target_modules} configure-target-${module}"
+done
+
+# Determine whether gdb needs tk/tcl or not.
+# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
+# and in that case we want gdb to be built without tk.  Ugh!
+# In fact I believe gdb is the *only* package directly dependent on tk,
+# so we should be able to put the 'maybe's in unconditionally and
+# leave out the maybe dependencies when enable_gdbtk is false.  I'm not
+# 100% sure that that's safe though.
+case "$enable_gdbtk" in
+  no)
+    GDB_TK="" ;;
+  *)
+    GDB_TK="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui" ;;
+esac
+
+# Create the 'maybe dependencies'.  This uses a temporary file.
+rm -f maybedep.tmp
+for item in ${all_build_modules} ${all_host_modules} ${all_target_modules} \
+       ${install_host_modules} ${install_target_modules} \
+       ${configure_build_modules} ${configure_host_modules} ${configure_target_modules} \
+       ; do
+  echo "maybe-${item}: ${item}" >> maybedep.tmp
+done
+sed -e '/@maybe_dependencies@/r maybedep.tmp' \
+    -e 's/@maybe_dependencies@//' Makefile > Makefile.tem
+rm -f Makefile
+mv -f Makefile.tem Makefile
+rm -f maybedep.tmp
+
+# Create the serialization dependencies.  This uses a temporary file.
+
+# These force 'configure's to be done one at a time, to avoid problems
+# with contention over a shared config.cache.
+rm -f serdep.tmp
+olditem=
+for item in ${build_configdirs} ; do
+  case ${olditem} in
+    "") ;;
+    *) echo "\$(BUILD_SUBDIR)/${item}/Makefile: \$(BUILD_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+  esac
+  olditem=${item}
+done
+olditem=
+for item in ${configdirs} ; do
+  case ${olditem} in
+    "") ;;
+    *) echo "${item}/Makefile: ${olditem}/Makefile" >> serdep.tmp ;;
+  esac
+  olditem=${item}
+done
+olditem=
+for item in ${target_configdirs} ; do
+  case ${olditem} in
+    "") ;;
+    *) echo "\$(TARGET_SUBDIR)/${item}/Makefile: \$(TARGET_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+  esac
+  olditem=${item}
+done
+sed -e '/@serialization_dependencies@/r serdep.tmp' \
+    -e 's/@serialization_dependencies@//' Makefile > Makefile.tem
+rm -f Makefile
+mv -f Makefile.tem Makefile
+rm -f serdep.tmp
 
 # Base args.  Strip norecursion, cache-file, srcdir, host, build, target.
 # These are the ones we might not want to pass down to subconfigures.
@@ -1361,9 +1493,18 @@ baseargs=`echo "${arguments}" | \
 # desired.
 buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}"
 
-# Record target_configdirs and the configure arguments for target and
-# build configuration in Makefile.
-target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
+# For host modules, accept cache file option, or specification as blank.
+case "${cache_file}" in
+"") # empty
+  cache_file_option="" ;;
+/* | [A-Za-z]:[\\/]* ) # absolute path
+  cache_file_option="--cache-file=${cache_file}" ;;
+*) # relative path
+  cache_file_option="--cache-file=../${cache_file}" ;;
+esac
+
+hostargs="${cache_file_option} ${buildopt} --host=${host_alias} --target=${target_alias} ${extra_host_args} ${baseargs}"
+
 targargs=${baseargs}
 
 # Passing a --with-cross-host argument lets the target libraries know
@@ -1515,7 +1656,8 @@ case $GCJ_FOR_TARGET in
 esac
 
 # Don't use libstdc++-v3's flags to configure/build itself.
-libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
 
 if test "x${CXX_FOR_TARGET+set}" = xset; then
   :
@@ -1523,17 +1665,28 @@ elif test -d ${srcdir}/gcc; then
   # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead
   # of g++ for linking C++ or Java, because g++ has -shared-libgcc by
   # default whereas gcc does not.
-  CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava) echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+  # RAW_CXX_FOR_TARGET is for linking C++ or java; CXX_FOR_TARGET is for
+  # all other cases.
+  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+  RAW_CXX_FOR_TARGET='$$r/gcc/xgcc -shared-libgcc -B$$r/gcc/ -nostdinc++ '$raw_libstdcxx_flags
 elif test "$host" = "$target"; then
   CXX_FOR_TARGET='$(CXX)'
+  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
 else
   CXX_FOR_TARGET=`echo c++ | sed -e 's/x/x/' ${program_transform_name}`
+  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
 fi
 case $CXX_FOR_TARGET in
 *' $(FLAGS_FOR_TARGET)') ;;
 *) CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
 esac
+case $RAW_CXX_FOR_TARGET in
+*' $(FLAGS_FOR_TARGET)') ;;
+*) RAW_CXX_FOR_TARGET=$RAW_CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
+esac
+
 qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'`
+qRAW_CXX_FOR_TARGET=`echo "$RAW_CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'`
 
 # We want to defer the evaluation of `cmd`s and shell variables in
 # CXX_FOR_TARGET when recursing in the top-level Makefile, such as for
@@ -1542,27 +1695,46 @@ qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'`
 # can be expanded by the nested make as shell variables, not as make
 # macros.
 qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
+qqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
+
+# BASE_CC_FOR_TARGET is the actual program file of CC_FOR_TARGET,
+# for use in dependencies.  Replace $$r with a relative
+# path if it's present.
+set dummy $CC_FOR_TARGET; cc_for_target_first_word=$2
+BASE_CC_FOR_TARGET=`echo "$cc_for_target_first_word" | sed -e 's,[$][$]r,.,'`
 
 sedtemp=sed.$$
 cat >$sedtemp <<EOF
+s%@GDB_TK@%${GDB_TK}%
+s%@configure_build_modules@%${configure_build_modules}%
+s%@all_build_modules@%${all_build_modules}%
+s%@configure_host_modules@%${configure_host_modules}%
+s%@all_host_modules@%${all_host_modules}%
+s%@check_host_modules@%${check_host_modules}%
+s%@install_host_modules@%${install_host_modules}%
+s%@install_host_modules_nogcc@%${install_host_modules_nogcc}%
+s%@configure_target_modules@%${configure_target_modules}%
+s%@all_target_modules@%${all_target_modules}%
+s%@check_target_modules@%${check_target_modules}%
+s%@install_target_modules@%${install_target_modules}%
 s:@target_configdirs@:${target_configdirs}:
 s%@target_configargs@%${targargs}%
 s%@FLAGS_FOR_TARGET@%${FLAGS_FOR_TARGET}%
 s%@CC_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}%
+s%@BASE_CC_FOR_TARGET@%${BASE_CC_FOR_TARGET}%
 s%@GCJ_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}%
 s%@CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}%
+s%@RAW_CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}%
 s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}%
+s%@RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%\$(STAGE_CC_WRAPPER) ${qqRAW_CXX_FOR_TARGET}%
 s%@target_subdir@%${target_subdir}%
 s%@build_subdir@%${build_subdir}%
 s%@build_configargs@%${buildargs}%
 s%@gxx_include_dir@%${gxx_include_dir}%
+s%@host_configargs@%${hostargs}%
 EOF
 sed -f $sedtemp Makefile > Makefile.tem
 rm -f Makefile $sedtemp
 mv -f Makefile.tem Makefile
 
 #
-# Local Variables:
-# fill-column: 131
-# End:
-#
This page took 0.027842 seconds and 4 git commands to generate.