[PATCH] enable building newlib natively on i[3456]86-pc-linux*

Thomas Fitzsimmons fitzsim@redhat.com
Tue Mar 19 13:56:00 GMT 2002


Hello,

Jeff Johnston and I have enhanced newlib to enable building it natively
on i[3456]86-pc-linux*.

As part of this enhancement, we made some newlib-specific changes to the
sources.redhat.com top-level configure.in.  We (the newlib maintainers)
approved and commited the changes.

However, there is a new policy to use gcc's top-level configure.in in
the sources.redhat.com repository, so we would like our changes to be
included in gcc's repository.

The changes allow building newlib natively on i[3456]86-pc-linux* when
--with-newlib is specified at configuration time.  When --with-newlib is
not specified, native builds behave the same as before.

Previously, when targeting i[3456]86-pc-linux*, it was assumed that
glibc would provide everything needed, so newlib was not configured. 
With this patch, newlib is configured, but only for native builds, and
then, only when --with-newlib is specified.  The behaviour when cross
compiling to i[3456]86-pc-linux* is unchanged.

Also, when building newlib natively on i[3456]86-pc-linux*, we require
the glibc headers where we would normally require the newlib libc and
target-specific headers, so FLAGS_FOR_TARGET cannot contain -nostdinc,
nor can it list newlib's targ-include and libc/include directories as
-isystem directories. 

2002-03-19  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* configure.in (noconfigdirs): Do not add target-newlib if
	target == i[3456]86-pc-linux*, and host == target.
	(FLAGS_FOR_TARGET): When building newlib, if
	host == target == i[3456]86-pc-linux*, remove -nostdinc and do
	not specify newlib/targ-include and newlib/libc/include as
	-isystem directories.


Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/configure.in,v
retrieving revision 1.121
diff -c -3 -p -r1.121 configure.in
*** configure.in	7 Mar 2002 19:32:12 -0000	1.121
--- configure.in	19 Mar 2002 21:45:59 -0000
*************** case "${target}" in
*** 796,801 ****
--- 796,815 ----
           target_configdirs="${target_configdirs} target-libstub target-cygmon"
      fi
      ;;
+   i[3456]86-pc-linux*)
+     # This section makes it possible to build newlib natively on linux.
+     # If we are using a cross compiler then don't configure newlib.
+     if [ x${is_cross_compiler} != xno ] ; then
+          noconfigdirs="$noconfigdirs target-newlib"
+     fi
+     noconfigdirs="$noconfigdirs target-libgloss"
+     # If we are not using a cross compiler, do configure newlib.
+     # Note however, that newlib will only be configured in this situation
+     # if the --with-newlib option has been given, because otherwise
+     # 'target-newlib' will appear in skipdirs.
+     # linux has rx in libc
+     skipdirs="$skipdirs target-librx"
+     ;;
    *-*-linux*)
      noconfigdirs="$noconfigdirs target-newlib target-libgloss"
      # linux has rx in libc
*************** case " $skipdirs " in
*** 1481,1490 ****
       fi
     fi
  
!    # If we're building newlib, use its generic headers last, but search
!    # for any libc-related directories first (so make it the last -B
!    # switch).
!    FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
     ;;
    esac
    ;;
--- 1495,1513 ----
       fi
     fi
  
!    case "${target}-${is_cross_compiler}" in
!    i[3456]86-pc-linux*-no)
!     # Here host == target, so we want to use glibc's standard headers
!     FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
!     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/'
!     ;;
!    *)
!     # If we're building newlib, use its generic headers last, but search
!     # for any libc-related directories first (so make it the last -B
!     # switch).
!     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
!     ;;
!    esac
     ;;
    esac
    ;;



More information about the Newlib mailing list