OSDN Git Service

* config/rs6000/aix43.h (ASM_SPEC): Only emit -mppc64 if no -mcpu
[pf3gnuchains/gcc-fork.git] / configure.in
index 10f9d3a..2cd0997 100644 (file)
@@ -1,5 +1,5 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+#   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
 
 AC_INIT(move-if-change)
+AC_PREREQ(2.13)
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 
@@ -82,7 +83,7 @@ if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
 
 # Export original configure arguments for use by sub-configures.
 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
-export TOPLEVEL_CONFIGURE_ARGUMENTS
+AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
 
 moveifchange=${srcdir}/move-if-change
 
@@ -112,7 +113,7 @@ else
         ;;
       * )
         # Add to all subconfigure arguments: build, host, and target.
-        ac_configure_args="--with-gcc-version-trigger=$gcc_version_trigger $ac_configure_args"
+        ac_configure_args="$ac_configure_args --with-gcc-version-trigger=$gcc_version_trigger"
         ;;
     esac
   fi
@@ -134,7 +135,7 @@ fi
 
 # these libraries are used by various programs built for the host environment
 #
-host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk itcl tix libgui zlib"
+host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib"
 
 libstdcxx_version="target-libstdc++-v3"
 
@@ -143,7 +144,7 @@ libstdcxx_version="target-libstdc++-v3"
 # know that we are building the simulator.
 # 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"
+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 diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -160,7 +161,7 @@ target_libs="target-libiberty \
                target-newlib \
                ${libstdcxx_version} \
                target-libf2c \
-               ${libgcj}
+               ${libgcj} \
                target-libobjc"
 
 # these tools are built using the target libs, and are intended to run only
@@ -257,7 +258,7 @@ esac
 
 # Some tools are only suitable for building in a "native" situation.
 # Remove these if host!=target.  
-native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
 
 # Similarly, some are only suitable for cross toolchains.
 # Remove these if host=target.
@@ -298,13 +299,13 @@ case "${host}" in
     noconfigdirs="$noconfigdirs byacc"
     ;;
   i[[3456]]86-*-vsta)
-    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv gettext"
+    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext"
     ;;
   i[[3456]]86-*-go32* | i[[3456]]86-*-msdosdjgpp*)
-    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix db snavigator gnuserv libffi"
+    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi"
        ;;
   i[[3456]]86-*-mingw32*)
-    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv"
+    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv"
      noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
        ;;
   i[[3456]]86-*-beos*)
@@ -317,7 +318,7 @@ case "${host}" in
     noconfigdirs="rcs"
     ;;
   ppc*-*-pe)
-     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix db snavigator gnuserv"
+     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
@@ -347,9 +348,20 @@ case "${target}" in
   *-*-chorusos)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-darwin*)
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
+    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
+    ;;
   *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-kaos*)
+    # Remove unsupported stuff on all kaOS configurations.
+    skipdirs="target-libiberty ${libgcj} ${libstdcxx_version} target-libf2c target-librx"
+    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
+    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
+    noconfigdirs="$noconfigdirs target-libgloss"
+    ;;
   *-*-netbsd*)
     # Skip some stuff on all NetBSD configurations.
     noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
@@ -534,7 +546,7 @@ case "${target}" in
     # Can't build gdb for mingw32 if not native.
     case "${host}" in
       i[[3456]]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv"
          ;;
     esac
     ;;    
@@ -547,7 +559,7 @@ case "${target}" in
     # Can't build gdb for Cygwin if not native.
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv"
          ;;
     esac
     ;;    
@@ -600,20 +612,17 @@ case "${target}" in
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
     target_configdirs="$target_configdirs target-winsup"
-    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}"
     # always build newlib.
     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
     ;;
     # This is temporary until we can link against shared libraries
   powerpcle-*-solaris*)
-    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
     ;;
-  powerpc-*-darwin*)
-    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof ${libgcj}"
-    ;;
   powerpc-*-eabi)
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
@@ -639,12 +648,11 @@ case "${target}" in
     noconfigdirs="$noconfigdirs ld gprof target-libgloss ${libgcj}"
     ;;
   mips*-*-irix6*)
-    # The GNU assembler does not support IRIX 6.
     # Linking libjava exceeds command-line length limits on at least
     # IRIX 6.2, but not on IRIX 6.5.
     # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
     # <oldham@codesourcery.com>
-    noconfigdirs="$noconfigdirs gas gprof target-libgloss ${libgcj}"
+    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
     ;;
   mips*-dec-bsd*)
     noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
@@ -867,20 +875,6 @@ if test -n "${target_configdirs}" ; then
   fi
 fi
 
-# Deconfigure all subdirectories, in case we are changing the
-# configuration from one where a subdirectory is supported to one where it
-# is not.
-if test -z "${norecursion}" && test -n "${configdirs}" ; then
-  for i in `echo ${configdirs} | sed -e s/target-//g` ; do
-    rm -f $i/Makefile
-  done
-fi
-if test -z "${norecursion}" && test -n "${target_configdirs}" ; then
-  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
-    rm -f ${target_subdir}/$i/Makefile
-  done
-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.
@@ -1456,12 +1450,14 @@ else
   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"}
@@ -1477,11 +1473,20 @@ else
     IFS="$save_ifs"
     CC=${CC-cc}
   else
+    # Determine if we are using gcc.
+    cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+    if ${CC} -E conftest.c | grep yes >/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.
-      case "${CC}" in
-      *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"}
@@ -1491,7 +1496,25 @@ else
          CXXFLAGS=${CXXFLAGS-"-O2"}
        fi
        rm -f conftest*
-       ;;
+      fi
+    fi
+  fi
+
+  # 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
+      case $build in
+      *-*-mingw*)
+       gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
+      *)
+       gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
+      esac
+      case $gcc_prog_ld in
+      # Accept absolute paths.
+      [[\\/]* | [A-Za-z]:[\\/]*)]
+        LD="$gcc_prog_ld" ;;
       esac
     fi
   fi
@@ -1638,13 +1661,24 @@ 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.
 
+# While at that, we remove Makefiles if we were started for recursive
+# configuration, such that the top-level Makefile reconfigures them,
+# like we used to do when configure itself was recursive.
+
 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
+  for module in libiberty ; do
+    all_build_modules=all-build-${module}
+    configure_build_modules=configure-build-${module}
+    if test -z "${no_recursion}" \
+       && test -f ${build_subdir}/${module}/Makefile; then
+      echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
+      rm -f ${build_subdir}/${module}/Makefile
+    fi
+  done
 fi
 
 all_host_modules=
@@ -1656,6 +1690,11 @@ for module in ${configdirs} ; do
   check_host_modules="${check_host_modules} check-${module}"
   install_host_modules="${install_host_modules} install-${module}"
   configure_host_modules="${configure_host_modules} configure-${module}"
+  if test -z "${no_recursion}" \
+     && test -f ${module}/Makefile; then
+    echo 1>&2 "*** removing ${module}/Makefile to force reconfigure"
+    rm -f ${module}/Makefile
+  fi
 done
 install_host_modules_nogcc=`echo "${install_host_modules}" | sed -e 's/install-gcc//g'`
 
@@ -1668,6 +1707,11 @@ for module in ${target_configdirs} ; do
   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}"
+  if test -z "${no_recursion}" \
+     && test -f ${target_subdir}/${module}/Makefile; then
+    echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
+    rm -f ${target_subdir}/${module}/Makefile
+  fi
 done
 
 # Determine whether gdb needs tk/tcl or not.
@@ -1677,15 +1721,28 @@ done
 # 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.
+
+gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui"
 case "$enable_gdbtk" in
   no)
     GDB_TK="" ;;
+  yes)
+    GDB_TK="${gdb_tk}" ;;
   *)
-    GDB_TK="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui" ;;
+    # Only add the dependency on gdbtk when GDBtk is part of the gdb
+    # distro.  Eventually someone will fix this and move Insight, nee
+    # gdbtk to a separate directory.
+    if test -d ${srcdir}/gdb/gdbtk ; then
+      GDB_TK="${gdb_tk}"
+    else
+      GDB_TK=""
+    fi
+    ;;
 esac
 
 # Create the 'maybe dependencies'.  This uses a temporary file.
 rm -f maybedep.tmp
+echo '# maybedep.tmp' > 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} \
@@ -1697,45 +1754,66 @@ AC_SUBST_FILE(maybe_dependencies)
 
 # Create the serialization dependencies.  This uses a temporary file.
 
+AC_ARG_ENABLE([serial-configure],
+[  --disable-serial-[{host,target,build}-]configure
+                          Don't force sequential configuration of
+                          sub-packages for the host, target or build
+                         machine, or of any sub-packages at all])
+
 # 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
+echo '# serdep.tmp' > serdep.tmp
 olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_build_configure}" = xno ||
 for item in ${build_configdirs} ; do
   case ${olditem} in
     "") ;;
-    *) echo "\$(BUILD_SUBDIR)/${item}/Makefile: \$(BUILD_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+    *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
   esac
   olditem=${item}
 done
 olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_host_configure}" = xno ||
 for item in ${configdirs} ; do
   case ${olditem} in
     "") ;;
-    *) echo "${item}/Makefile: ${olditem}/Makefile" >> serdep.tmp ;;
+    *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
   esac
   olditem=${item}
 done
 olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_target_configure}" = xno ||
 for item in ${target_configdirs} ; do
   case ${olditem} in
     "") ;;
-    *) echo "\$(TARGET_SUBDIR)/${item}/Makefile: \$(TARGET_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+    *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
   esac
   olditem=${item}
 done
 serialization_dependencies=serdep.tmp
 AC_SUBST_FILE(serialization_dependencies)
 
-# Base args.  Strip norecursion, cache-file, srcdir, host, build, target.
-# These are the ones we might not want to pass down to subconfigures.
-baseargs=`echo "${ac_configure_args}" | \
-       sed -e 's/--no[[^       ]]*//' \
-           -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
-           -e 's/--sr[[a-z-]]*=[[^     ]]*//' \
-           -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
-           -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
-           -e 's/--ta[[a-z-]]*=[[^     ]]*//'`
+# Base args.  Strip norecursion, cache-file, srcdir, host, build,
+# target and nonopt.  These are the ones we might not want to pass
+# down to subconfigures.
+baseargs=`echo " ${ac_configure_args} " | \
+       sed -e 's/ --no[[^ ]]* / /' \
+           -e 's/ --c[[a-z-]]*[[= ]][[^ ]]* / /' \
+           -e 's/ --sr[[a-z-]]*[[= ]][[^ ]]* / /' \
+           -e 's/ --ho[[a-z-]]*[[= ]][[^ ]]* / /' \
+           -e 's/ --bu[[a-z-]]*[[= ]][[^ ]]* / /' \
+           -e 's/ --t[[a-z-]]*[[= ]][[^ ]]* / /' \
+           -e 's/ -cache-file[[= ]][[^ ]]* / /' \
+           -e 's/ -srcdir[[= ]][[^ ]]* / /' \
+           -e 's/ -host[[= ]][[^ ]]* / /' \
+           -e 's/ -build[[= ]][[^ ]]* / /' \
+           -e 's/ -target[[= ]][[^ ]]* / /' \
+           -e 's/ [[^ -][^ ]*] / /' \
+           -e 's/^ *//;s/ *$//'`
 
 # For the build-side libraries, we just need to pretend we're native,
 # and not use the same cache file.  Multilibs are neither needed nor
@@ -1881,7 +1959,7 @@ elif test -d ${srcdir}/gcc; then
 elif test "$host" = "$target"; then
   CC_FOR_TARGET='$(CC)'
 else
-  CC_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
+  CC_FOR_TARGET=`echo gcc | sed "${program_transform_name}"`
 fi
 CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)'
 
@@ -1892,7 +1970,7 @@ elif test -d ${srcdir}/gcc; then
 elif test "$host" = "$target"; then
   GCJ_FOR_TARGET='gcj'
 else
-  GCJ_FOR_TARGET=`echo gcj | sed -e 's/x/x/' ${program_transform_name}`
+  GCJ_FOR_TARGET=`echo gcj | sed "${program_transform_name}"`
 fi
 GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)'
 
@@ -1914,7 +1992,7 @@ 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}`
+  CXX_FOR_TARGET=`echo c++ | sed "${program_transform_name}"`
   RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
 fi
 CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)'
@@ -2056,4 +2134,23 @@ AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
 
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+AC_MSG_RESULT($USE_MAINTAINER_MODE)
+AC_SUBST(MAINTAINER_MODE_TRUE)
+AC_SUBST(MAINTAINER_MODE_FALSE)
+if test "$USE_MAINTAINER_MODE" = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi     
+MAINT=$MAINTAINER_MODE_TRUE
+AC_SUBST(MAINT)dnl
+
 AC_OUTPUT(Makefile)