OSDN Git Service

2000-09-25 Kazu Hirata <kazu@hxi.com>
[pf3gnuchains/gcc-fork.git] / gcc / configure.in
index 5197fb7..bc6d40e 100644 (file)
@@ -254,22 +254,25 @@ elif test x$withval != xno; then
   cpp_install_dir=$withval
 fi])
 
-dnl Disable this for the moment; the library interface is changing.
-dnl # Link cpplib into the compiler proper, for C/C++/ObjC.
-dnl AC_ARG_ENABLE(c-cpplib,
-dnl [  --enable-c-cpplib       link cpplib directly into C and C++ compilers
-dnl                           (EXPERIMENTAL) (implies --enable-cpplib).],
-dnl if test x$enable_c_cpplib != xno; then
-dnl  extra_c_objs="${extra_c_objs} libcpp.a"
-dnl  extra_cxx_objs="${extra_cxx_objs} ../libcpp.a"
-dnl  extra_c_flags="${extra_c_flags} -DUSE_CPPLIB=1"
-dnl fi)
+# Link cpplib into the compiler proper, for C/C++/ObjC.
+AC_ARG_ENABLE(c-cpplib,
+[  --enable-c-cpplib       link cpplib directly into C and C++ compilers
+                           (HIGHLY EXPERIMENTAL).],
+if test x$enable_c_cpplib != xno; then
+  extra_c_objs="${extra_c_objs} libcpp.a"
+  extra_cxx_objs="${extra_cxx_objs} ../libcpp.a"
+  AC_DEFINE(USE_CPPLIB, 1,
+  [Define if you want the preprocessor merged into the C and C++ compilers.
+   This mode is not ready for production use.])
+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
-  extra_c_flags="${extra_c_flags} -DMULTIBYTE_CHARS=1"
+  AC_DEFINE(MULTIBYTE_CHARS, 1,
+  [Define if you want the C and C++ compilers to support multibyte
+   character sets for source code.])
 fi)
   
 # Enable threads
@@ -277,10 +280,7 @@ fi)
 # Pass with a value to specify a thread package
 AC_ARG_ENABLE(threads,
 [  --enable-threads        enable thread usage for target GCC.
-  --enable-threads=LIB    use LIB thread package for target GCC.],
-if test x$enable_threads = xno; then
-       enable_threads=''
-fi,
+  --enable-threads=LIB    use LIB thread package for target GCC.],,
 enable_threads='')
 
 enable_threads_flag=$enable_threads
@@ -295,7 +295,7 @@ case x${enable_threads_flag} in
                target_thread_file=''
                ;;
        xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
-       xsolaris | xwin32 | xdce | xvxworks)
+       xsolaris | xwin32 | xdce | xvxworks | xaix)
                target_thread_file=$enable_threads_flag
                ;;
        *)
@@ -332,15 +332,13 @@ AC_SUBST(NO_MINUS_C_MINUS_O)
 
 gcc_AC_C_LONG_DOUBLE
 
-AC_MSG_CHECKING(whether ${CC-cc} accepts -Wno-long-long)
-echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -Wno-long-long -c conftest.c 2>&1`"; then
-  ac_cv_prog_cc_no_long_long=yes
-else
-  ac_cv_prog_cc_no_long_long=no
-fi
-rm -f conftest*
-echo "$ac_t"$ac_cv_prog_cc_no_long_long 1>&6
+AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
+ac_cv_prog_cc_no_long_long,
+[save_CFLAGS="$CFLAGS"
+CFLAGS="-Wno-long-long"
+AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
+              ac_cv_prog_cc_no_long_long=no)
+CFLAGS="$save_CFLAGS"])
 
 # 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
@@ -354,6 +352,19 @@ if test "x$GCC" = "xyes"; then
 else
   stage1_warn_cflags=""
 fi
+
+# Stage specific cflags for build.
+case $build in
+vax-*-*)
+  if test x$GCC = xyes
+  then
+    stage1_warn_cflags="$stage1_warn_cflags -Wa,-J"
+  else
+    stage1_warn_cflags="$stage1_warn_cflags -J"
+  fi
+  ;;
+esac
+
 AC_SUBST(stage1_warn_cflags)
 AC_SUBST(stage2_warn_cflags)
 
@@ -381,6 +392,20 @@ else
     AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING(for GNU C library)
+AC_CACHE_VAL(gcc_cv_glibc,
+[AC_TRY_COMPILE(
+  [#include <features.h>],[
+#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
+
 AC_C_INLINE
 
 # Find some useful tools
@@ -400,7 +425,7 @@ AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
                 fcntl.h unistd.h stab.h sys/file.h sys/time.h \
                 sys/resource.h sys/param.h sys/times.h sys/stat.h \
-                direct.h malloc.h)
+                direct.h malloc.h langinfo.h iconv.h)
 
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -476,10 +501,30 @@ fi
 AC_CHECK_FUNCS(strtoul bsearch putenv popen bcopy bzero bcmp \
        index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
        sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
-       fputs_unlocked getrusage valloc)
+       fputs_unlocked getrusage valloc iconv nl_langinfo)
 
 AC_CHECK_TYPE(ssize_t, int)
 
+# Try to determine the array type of the second argument of getgroups
+# for the target system (int or gid_t).
+AC_TYPE_GETGROUPS
+if test "${target}" = "${build}"; then
+  TARGET_GETGROUPS_T=$ac_cv_type_getgroups
+else
+  case "${target}" in
+       # This condition may need some tweaking.  It should include all
+       # targets where the array type of the second argument of getgroups
+       # is int and the type of gid_t is not equivalent to int.
+       *-*-sunos* | *-*-ultrix*)
+               TARGET_GETGROUPS_T=int
+               ;;
+       *)
+               TARGET_GETGROUPS_T=gid_t
+               ;;
+  esac
+fi
+AC_SUBST(TARGET_GETGROUPS_T)
+
 gcc_AC_FUNC_VFPRINTF_DOPRNT
 gcc_AC_FUNC_PRINTF_PTR
 
@@ -635,9 +680,9 @@ changequote([,])dnl
                ;;
        esac    
 
-       # Common parts for linux-gnu and openbsd systems
+       # Common parts for linux and openbsd systems
        case $machine in
-       *-*-linux-gnu*)
+       *-*-linux*)
                xm_defines="HAVE_ATEXIT POSIX BSTRING"
                ;;
        *-*-openbsd*)
@@ -712,7 +757,7 @@ changequote([,])dnl
                #prefix='$$INTERIX_ROOT'/usr/contrib
                #local_prefix='$$INTERIX_ROOT'/usr/contrib
                ;;
-       alpha*-*-linux-gnuecoff*)
+       alpha*-*-linux*ecoff*)
                tm_file="${tm_file} alpha/linux-ecoff.h alpha/linux.h"
                target_cpu_default="MASK_GAS"
                tmake_file="alpha/t-alpha alpha/t-ieee"
@@ -720,7 +765,7 @@ changequote([,])dnl
                xmake_file=none
                gas=yes gnu_ld=yes
                ;;
-       alpha*-*-linux-gnulibc1*)
+       alpha*-*-linux*libc1*)
                tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
                target_cpu_default="MASK_GAS"
                tmake_file="t-linux t-linux-gnulibc1 alpha/t-alpha alpha/t-crtbe alpha/t-ieee"
@@ -731,7 +776,7 @@ changequote([,])dnl
                        thread_file='posix'
                fi
                ;;
-       alpha*-*-linux-gnu*)
+       alpha*-*-linux*)
                tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
                target_cpu_default="MASK_GAS"
                tmake_file="t-linux alpha/t-crtbe alpha/t-alpha alpha/t-ieee"
@@ -867,14 +912,14 @@ changequote([,])dnl
                tmake_file="t-netbsd arm/t-netbsd"
                use_collect2=yes
                ;;
-       arm*-*-linux-gnuaout*)          # ARM GNU/Linux with a.out
+       arm*-*-linux*aout*)             # ARM GNU/Linux with a.out
                cpu_type=arm
                xmake_file=x-linux
                tm_file=arm/linux-aout.h
                tmake_file=arm/t-linux
                gnu_ld=yes
                ;;
-       arm*-*-linux-gnuoldld*)         # ARM GNU/Linux with old ELF linker
+       arm*-*-linux*oldld*)            # ARM GNU/Linux with old ELF linker
                xm_file=arm/xm-linux.h
                xmake_file=x-linux
                tm_file="arm/linux-oldld.h arm/linux-elf.h"
@@ -892,7 +937,7 @@ changequote([,])dnl
                        ;;
                esac
                ;;
-       arm*-*-linux-gnu*)              # ARM GNU/Linux with ELF
+       arm*-*-linux*)          # ARM GNU/Linux with ELF
                xm_file=arm/xm-linux.h
                xmake_file=x-linux
                tm_file="arm/linux-elf.h"
@@ -1116,10 +1161,11 @@ changequote([,])dnl
                if test x$enable_threads = x; then
                    enable_threads=$have_pthread_h
                fi
-               if test x$enable_threads = xyes; then
-                       thread_file='dce'
+               case x${enable_threads} in
+               xyes | xdce)
                        tmake_file="${tmake_file} pa/t-dce-thr"
-               fi
+                       ;;
+               esac
                install_headers_dir=install-headers-cpio
                use_collect2=yes
                ;;
@@ -1136,10 +1182,11 @@ changequote([,])dnl
                if test x$enable_threads = x; then
                    enable_threads=$have_pthread_h
                fi
-               if test x$enable_threads = xyes; then
-                       thread_file='dce'
+               case x${enable_threads} in
+               xyes | xdce)
                        tmake_file="${tmake_file} pa/t-dce-thr"
-               fi
+                       ;;
+               esac
                install_headers_dir=install-headers-cpio
                use_collect2=yes
                ;;
@@ -1405,23 +1452,12 @@ changequote([,])dnl
                tmake_file=i386/t-i386bare
                ;;
 changequote(,)dnl
-       i[34567]86-*-beospe*)
-changequote([,])dnl
-               xm_file=i386/xm-beos.h
-               xm_defines="USE_C_ALLOCA"
-               tmake_file=i386/t-beos
-               tm_file=i386/beos-pe.h
-               xmake_file=i386/x-beos
-               extra_objs=winnt.o
-               ;;
-changequote(,)dnl
        i[34567]86-*-beoself* | i[34567]86-*-beos*)
 changequote([,])dnl
                xm_file=i386/xm-beos.h
                tmake_file='i386/t-beos i386/t-crtpic'
                tm_file=i386/beos-elf.h
                xmake_file=i386/x-beos
-               extra_objs=winnt.o
                extra_parts='crtbegin.o crtend.o'
                ;;
 changequote(,)dnl
@@ -1508,7 +1544,7 @@ changequote([,])dnl
                install_headers_dir=install-headers-cpio
                ;;
 changequote(,)dnl
-       i[34567]86-*-linux-gnuoldld*)   # Intel 80386's running GNU/Linux
+       i[34567]86-*-linux*oldld*)      # Intel 80386's running GNU/Linux
 changequote([,])dnl                    # with a.out format using
                                        # pre BFD linkers
                xmake_file=x-linux-aout
@@ -1518,7 +1554,7 @@ changequote([,])dnl                       # with a.out format using
                float_format=i386
                ;;
 changequote(,)dnl
-       i[34567]86-*-linux-gnuaout*)    # Intel 80386's running GNU/Linux
+       i[34567]86-*-linux*aout*)       # Intel 80386's running GNU/Linux
 changequote([,])dnl                    # with a.out format
                xmake_file=x-linux-aout
                tmake_file="t-linux-aout i386/t-crtstuff"
@@ -1527,7 +1563,7 @@ changequote([,])dnl                       # with a.out format
                float_format=i386
                ;;
 changequote(,)dnl
-       i[34567]86-*-linux-gnulibc1)    # Intel 80386's running GNU/Linux
+       i[34567]86-*-linux*libc1)       # Intel 80386's running GNU/Linux
 changequote([,])dnl                    # with ELF format using the
                                        # GNU/Linux C library 5
                xmake_file=x-linux      
@@ -1541,7 +1577,7 @@ changequote([,])dnl                       # with ELF format using the
                fi
                ;;
 changequote(,)dnl
-       i[34567]86-*-linux-gnu*)        # Intel 80386's running GNU/Linux
+       i[34567]86-*-linux*)    # Intel 80386's running GNU/Linux
 changequote([,])dnl                    # with ELF format using glibc 2
                                        # aka GNU/Linux C library 6
                xmake_file=x-linux
@@ -2008,6 +2044,7 @@ changequote([,])dnl
                then
                        target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
                fi
+               float_format=i386
                ;;
        ia64*-*-linux*)
                tm_file=ia64/linux.h
@@ -2016,10 +2053,28 @@ changequote([,])dnl
                if test x$enable_threads = xyes; then
                        thread_file='posix'
                fi
+               float_format=i386
                ;;
        m32r-*-elf*)
                extra_parts="crtinit.o crtfini.o"
                ;;
+       # m68hc11 and m68hc12 share the same machine description.
+        m68hc11-*-*|m6811-*-*)
+               tm_file="m68hc11/m68hc11.h"
+                xm_file="m68hc11/xm-m68hc11.h"
+               tm_p_file="m68hc11/m68hc11-protos.h"
+               md_file="m68hc11/m68hc11.md"
+               out_file="m68hc11/m68hc11.c"
+               tmake_file="m68hc11/t-m68hc11-gas"
+                ;;
+        m68hc12-*-*|m6812-*-*)
+               tm_file="m68hc11/m68hc12.h"
+               tm_p_file="m68hc11/m68hc11-protos.h"
+                xm_file="m68hc11/xm-m68hc11.h"
+               md_file="m68hc11/m68hc11.md"
+               out_file="m68hc11/m68hc11.c"
+               tmake_file="m68hc11/t-m68hc11-gas"
+                ;;
        m68000-convergent-sysv*)
                tm_file=m68k/ctix.h
                xm_file="m68k/xm-3b1.h ${xm_file}"
@@ -2407,7 +2462,7 @@ changequote([,])dnl
                extra_headers=math-68881.h
                float_format=m68k
                ;;
-       m68k-*-linux-gnuaout*)          # Motorola m68k's running GNU/Linux
+       m68k-*-linux*aout*)             # Motorola m68k's running GNU/Linux
                                        # with a.out format
                xmake_file=x-linux
                tm_file=m68k/linux-aout.h
@@ -2416,7 +2471,7 @@ changequote([,])dnl
                float_format=m68k
                gnu_ld=yes
                ;;
-       m68k-*-linux-gnulibc1)          # Motorola m68k's running GNU/Linux
+       m68k-*-linux*libc1)             # Motorola m68k's running GNU/Linux
                                        # with ELF format using the
                                        # GNU/Linux C library 5
                xmake_file=x-linux
@@ -2427,7 +2482,7 @@ changequote([,])dnl
                float_format=m68k
                gnu_ld=yes
                ;;
-       m68k-*-linux-gnu*)              # Motorola m68k's running GNU/Linux
+       m68k-*-linux*)          # Motorola m68k's running GNU/Linux
                                        # with ELF format using glibc 2
                                        # aka the GNU/Linux C library 6.
                xmake_file=x-linux
@@ -2723,18 +2778,19 @@ changequote([,])dnl
                # On NetBSD, the headers are already okay, except for math.h.
                tmake_file=t-netbsd
                ;;
-       mips*-*-linux*)                         # Linux MIPS, either endian.
+       mips*-*-linux*)                         # Linux MIPS, either endian.
                xmake_file=x-linux
-               case $machine in
-                       mipsel-*)  tm_file="mips/elfl.h mips/linux.h" ;;
-                       *)         tm_file="mips/elf.h mips/linux.h" ;;
-               esac
+               case $machine in
+                      mips*el-*)  tm_file="mips/elfl.h mips/linux.h" ;;
+                      *)         tm_file="mips/elf.h mips/linux.h" ;;
+               esac
+               tmake_file=t-linux
                extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
                gnu_ld=yes
                gas=yes
-               if test x$enable_threads = xyes; then
-                       thread_file='posix'
-               fi
+               if test x$enable_threads = xyes; then
+                       thread_file='posix'
+               fi
                ;;
        mips*el-*-openbsd*)     # mips little endian
                target_cpu_default="MASK_GAS|MASK_ABICALLS"
@@ -3163,7 +3219,7 @@ changequote([,])dnl
                tmake_file="rs6000/t-ppcgas t-rtems rs6000/t-ppccomm"
                extra_headers=ppc-asm.h
                ;;
-       powerpc-*-linux-gnulibc1)
+       powerpc-*-linux*libc1)
                tm_file="rs6000/sysv4.h rs6000/linux.h"
                xm_file=rs6000/xm-sysv4.h
                out_file=rs6000/rs6000.c
@@ -3174,7 +3230,7 @@ changequote([,])dnl
                        thread_file='posix'
                fi
                ;;
-       powerpc-*-linux-gnu*)
+       powerpc-*-linux*)
                tm_file="rs6000/sysv4.h rs6000/linux.h"
                xm_file="rs6000/xm-sysv4.h"
                xm_defines="USG ${xm_defines}"
@@ -3270,7 +3326,7 @@ changequote([,])dnl
                then
                        xmake_file=rs6000/x-aix41-gld
                else
-                       tmake_file="rs6000/t-newas rs6000/t-aix41"
+                       tmake_file='rs6000/t-newas'
                fi
                xmake_file=rs6000/x-aix41
                float_format=none
@@ -3284,6 +3340,7 @@ changequote([,])dnl
                xmake_file=rs6000/x-aix41
                float_format=none
                use_collect2=yes
+               thread_file='aix'
                ;;
 changequote(,)dnl
        rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
@@ -3293,6 +3350,7 @@ changequote([,])dnl
                xmake_file=rs6000/x-aix41
                float_format=none
                use_collect2=yes
+               thread_file='aix'
                ;;
        rs6000-ibm-aix*)
                float_format=none
@@ -3316,17 +3374,28 @@ changequote([,])dnl
                use_collect2=yes
                ;;
        sh-*-elf*)
-               tm_file=sh/elf.h
+               tmake_file="sh/t-sh sh/t-elf"
+               tm_file="sh/sh.h sh/elf.h"
                float_format=sh
                ;;
        sh-*-rtemself*)
-               tmake_file="sh/t-sh t-rtems"
-               tm_file=sh/rtemself.h
+               tmake_file="sh/t-sh sh/t-elf t-rtems"
+               tm_file="sh/sh.h sh/elf.h sh/rtemself.h"
                float_format=sh
                ;;
        sh-*-rtems*)
                tmake_file="sh/t-sh t-rtems"
-               tm_file=sh/rtems.h
+               tm_file="sh/sh.h sh/rtems.h"
+               float_format=sh
+               ;;
+       sh-*-linux*)
+               tm_file="sh/sh.h sh/elf.h sh/linux.h"
+               tmake_file="sh/t-sh sh/t-elf sh/t-linux"
+               xmake_file=x-linux
+               gas=yes gnu_ld=yes
+               if test x$enable_threads = xyes; then
+                       thread_file='posix'
+               fi
                float_format=sh
                ;;
        sh-*-*)
@@ -3366,13 +3435,13 @@ changequote([,])dnl
                #float_format=i128
                float_format=i64
                ;;
-       sparc-*-linux-gnuaout*)         # Sparc's running GNU/Linux, a.out
+       sparc-*-linux*aout*)            # Sparc's running GNU/Linux, a.out
                xm_file="${xm_file} sparc/xm-linux.h"
                tm_file=sparc/linux-aout.h
                xmake_file=x-linux
                gnu_ld=yes
                ;;
-       sparc-*-linux-gnulibc1*)        # Sparc's running GNU/Linux, libc5
+       sparc-*-linux*libc1*)   # Sparc's running GNU/Linux, libc5
                xm_file="${xm_file} sparc/xm-linux.h"
                xmake_file=x-linux
                tm_file=sparc/linux.h
@@ -3381,7 +3450,7 @@ changequote([,])dnl
                gnu_ld=yes
                float_format=sparc
                ;;
-       sparc-*-linux-gnu*)             # Sparc's running GNU/Linux, libc6
+       sparc-*-linux*)         # Sparc's running GNU/Linux, libc6
                xm_file="${xm_file} sparc/xm-linux.h"
                xmake_file=x-linux
                tm_file=sparc/linux.h
@@ -3655,7 +3724,6 @@ changequote([,])dnl
                ;;
        vax-*-ultrix*)                  # vaxen running ultrix
                tm_file="${tm_file} vax/ultrix.h"
-               use_collect2=yes
                float_format=vax
                ;;
        vax-*-vms*)                     # vaxen running VMS
@@ -3677,7 +3745,7 @@ changequote([,])dnl
        esac
 
        case $machine in
-       *-*-linux-gnu*)
+       *-*-linux*)
                ;; # Existing GNU/Linux systems do not use the GNU setup.
        *-*-gnu*)
                # On the GNU system, the setup is just about the same on
@@ -4358,10 +4426,11 @@ if test -f ../ld/Makefile; then
 #      fi
 fi
 
-# Figure out what assembler alignment features are present.
-AC_MSG_CHECKING(assembler alignment features)
+# Figure out what assembler we will be using.
+AC_MSG_CHECKING(what assembler to use)
 gcc_cv_as=
-gcc_cv_as_alignment_features=
+gcc_cv_gas_major_version=
+gcc_cv_gas_minor_version=
 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
 if test -x "$DEFAULT_ASSEMBLER"; then
        gcc_cv_as="$DEFAULT_ASSEMBLER"
@@ -4385,21 +4454,9 @@ changequote(,)dnl
        gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
        gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
 changequote([,])dnl
-       if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
-               # Gas version 2.6 and later support for .balign and .p2align.
-               # bytes to skip when using .p2align.
-               if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
-                       gcc_cv_as_alignment_features=".balign and .p2align"
-                       AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
-               fi
-               # Gas version 2.8 and later support specifying the maximum
-               # bytes to skip when using .p2align.
-               if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
-                       gcc_cv_as_alignment_features=".p2align including maximum skip"
-                       AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
-               fi
-       fi
-elif test x$host = x$target; then
+fi
+
+if test "x$gcc_cv_as" = x -a x$host = x$target; then
        # Native build.
        # Search the same directories that the installed compiler will
        # search.  Else we may find the wrong assembler and lose.  If we
@@ -4451,7 +4508,39 @@ elif test x$host = x$target; then
                fi
        done
 fi
-if test x$gcc_cv_as != x; then
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+  AC_MSG_RESULT("newly built gas")
+else
+  AC_MSG_RESULT($gcc_cv_as)
+fi
+
+# Figure out what nm we will be using.
+AC_MSG_CHECKING(what nm to use)
+if test -x nm$host_exeext; then
+       gcc_cv_nm=./nm$host_exeext
+elif test x$host = x$target; then
+       # Native build.
+       gcc_cv_nm=nm$host_exeext
+fi
+AC_MSG_RESULT($gcc_cv_nm)
+
+# Figure out what assembler alignment features are present.
+AC_MSG_CHECKING(assembler alignment features)
+gcc_cv_as_alignment_features=
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+       # Gas version 2.6 and later support for .balign and .p2align.
+       # bytes to skip when using .p2align.
+       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
+               gcc_cv_as_alignment_features=".balign and .p2align"
+               AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
+       fi
+       # Gas version 2.8 and later support specifying the maximum
+       # bytes to skip when using .p2align.
+       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
+               gcc_cv_as_alignment_features=".p2align including maximum skip"
+               AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
+       fi
+elif test x$gcc_cv_as != x; then
        # Check if we have .balign and .p2align
        echo ".balign  4" > conftest.s
        echo ".p2align  2" >> conftest.s
@@ -4473,17 +4562,15 @@ AC_MSG_RESULT($gcc_cv_as_alignment_features)
 
 AC_MSG_CHECKING(assembler subsection support)
 gcc_cv_as_subsections=
-if test x$gcc_cv_as != x; then
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+  if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+    gcc_cv_as_subsections="working .subsection -1"
+  fi
+elif test x$gcc_cv_as != x; then
        # Check if we have .subsection
        echo ".subsection 1" > conftest.s
        if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
                gcc_cv_as_subsections=".subsection"
-               if test -x nm$host_exeext; then
-                       gcc_cv_nm=./nm$host_exeext
-               elif test x$host = x$target; then
-                       # Native build.
-                       gcc_cv_nm=nm$host_exeext
-               fi
                if test x$gcc_cv_nm != x; then
                        cat > conftest.s <<EOF
 conftest_label1: .word 0
@@ -4498,44 +4585,57 @@ EOF
                                        :
                                else
                                        gcc_cv_as_subsections="working .subsection -1"
-                                       AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
-[Define if your assembler supports .subsection and .subsection -1 starts
-   emitting at the beginning of your section.])
                                fi
                        fi
                fi
        fi
        rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
 fi
+if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then
+       AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
+[Define if your assembler supports .subsection and .subsection -1 starts
+   emitting at the beginning of your section.])
+fi
 AC_MSG_RESULT($gcc_cv_as_subsections)
 
 AC_MSG_CHECKING(assembler weak support)
 gcc_cv_as_weak=
-if test x$gcc_cv_as != x; then
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+  if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
+    gcc_cv_as_weak="yes"
+  fi
+elif test x$gcc_cv_as != x; then
        # Check if we have .weak
        echo "  .weak foobar" > conftest.s
        if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               AC_DEFINE(HAVE_GAS_WEAK, 1,
-                       [Define if your assembler supports .weak.])
                gcc_cv_as_weak="yes"
        fi
        rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
 fi
+if test x"$gcc_cv_as_weak" = xyes; then
+       AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])
+fi
 AC_MSG_RESULT($gcc_cv_as_weak)
 
 AC_MSG_CHECKING(assembler hidden support)
 gcc_cv_as_hidden=
-if test x$gcc_cv_as != x; then
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+  if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+    gcc_cv_as_hidden="yes"
+  fi
+elif test x$gcc_cv_as != x; then
        # Check if we have .hidden
        echo "  .hidden foobar" > conftest.s
        echo "foobar:" >> conftest.s
        if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               AC_DEFINE(HAVE_GAS_HIDDEN, 1,
-                       [Define if your assembler supports .hidden.])
                gcc_cv_as_hidden="yes"
        fi
        rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
 fi
+if test x"$gcc_cv_as_hidden" = xyes; then
+       AC_DEFINE(HAVE_GAS_HIDDEN, 1,
+               [Define if your assembler supports .hidden.])
+fi
 AC_MSG_RESULT($gcc_cv_as_hidden)
 
 case "$target" in 
@@ -4650,19 +4750,25 @@ changequote(,)dnl
 changequote([,])dnl
     AC_MSG_CHECKING(assembler instructions)
     gcc_cv_as_instructions=
-    if test x$gcc_cv_as != x; then
+    if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
+      if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then
+       gcc_cv_as_instructions="filds fists"
+      fi
+    elif test x$gcc_cv_as != x; then
        set "filds fists" "filds mem; fists mem"
        while test $# -gt 0
        do
                echo "$2" > conftest.s
                if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
                        gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" "
-                       AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$1" | tr '[a-z ]' '[A-Z_]'`)
                fi
                shift 2
        done
        rm -f conftest.s conftest.o
     fi
+    if test x"$gcc_cv_as_instructions" != x; then
+       AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | tr '[a-z ]' '[A-Z_]'`)
+    fi
     AC_MSG_RESULT($gcc_cv_as_instructions)
     ;;
 esac
@@ -4757,6 +4863,17 @@ fi])
 AC_SUBST(GGC)
 echo "Using $GGC for garbage collection."
 
+# Use the system's zlib library.
+zlibdir=-L../../zlib
+zlibinc="-I\$(srcdir)/../../zlib"
+AC_ARG_WITH(system-zlib,
+[  --with-system-zlib      use installed libz],
+zlibdir=
+zlibinc=
+)
+AC_SUBST(zlibdir)
+AC_SUBST(zlibinc)
+
 # Build a new-abi (c++) system
 AC_ARG_ENABLE(new-gxx-abi,
 [  --enable-new-gxx-abi
@@ -4775,7 +4892,7 @@ AC_MSG_CHECKING([for libstdc++ to install])
 AC_ARG_ENABLE(libstdcxx-v3,
 [  --enable-libstdcxx-v3 
                          enable libstdc++-v3 for building and installation],
-  [enable_libstdcxx_v3=yes], [enable_libstdcxx_v3=no])
+  [enable_libstdcxx_v3="$enableval"], [enable_libstdcxx_v3=no])
 
 if test x$enable_libstdcxx_v3 = xyes; then
   AC_MSG_RESULT(v3)