This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch to fix host_makefile_frag problem in configure.in


Hello.

I'm trying to port egcs-20000626 on Hitachi 3050RX running HI-UX/WE2.
I found a problem in egcs-20000626/configure.in.
It's not a "target specific" problem.

There is the following code at line 266 in configure.in:

  if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
    xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
    if [ -n "${xx}" ] ; then
      CC=$xx
    fi
  fi


[ -f "${srcdir}/${host_makefile_frag}" ] is never true, because
${host_makefile_frag} is a string which begins with white space,
so in the case of hppa1.1-hitachi-hiuxwe2, ${srcdir}/${host_makefile_frag}
is set to "./ config/mh-hpux", not "./config/mh-hpux", which is nonexistent
file.

In the case of hppa1.1-hitachi-hiuxwe2, the value host_makefile_frag is set 
at line 235 in configure.in by the following code:

  *-*-hiux*)
    host_makefile_frag="${host_makefile_frag} config/mh-hpux"
    ;;

I think that the author of this code intends that one shall have 
as many files as he likes for host_makefile_frag.
The intension is also shown in the following code (around line 332 in
configure.in):

if [ -n "${host_makefile_frag}" ] ; then
  for f in ${host_makefile_frag}
  do
    cat ${srcdir}/$f >> mh-frag
  done
  host_makefile_frag=mh-frag
fi

So, one solution is the following patch:

==================================================================
*** /usr/prj/gnu-hit/work-hiuxwe2/matusita/gcc-2.95.2/egcs/egcs-20000626.orig/configure.in	Fri May 19 02:04:14 2000
--- egcs-20000626/configure.in	Tue Jun 27 20:27:12 2000
***************
*** 264,272 ****
    done
    IFS="$save_ifs"
!   if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
!     xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
!     if [ -n "${xx}" ] ; then
!       CC=$xx
      fi
    fi
  fi
--- 264,277 ----
    done
    IFS="$save_ifs"
!   if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] ; then
!     for f in ${host_makefile_frag}
!     do
!     if [ -f "${srcdir}/${f}" ] ; then
! 	xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${f}`
! 	if [ -n "${xx}" ] ; then
! 	    CC=$xx
! 	fi
      fi
+     done
    fi
  fi
==================================================================

Another possible solution is to use mh-frag instead of host_makefile_frag.

==================================================================
diff -cr2 -N egcs-20000619.orig/configure.in egcs-20000619/configure.in
*** egcs-20000619.orig/configure.in	Fri May 19 02:04:14 2000
--- egcs-20000619/configure.in	Tue Jun 27 15:30:08 2000
***************
*** 251,275 ****
  fi
  
- # If we aren't going to be using gcc, see if we can extract a definition
- # of CC from the fragment.
- if [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
-   IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
-   found=
-   for dir in $PATH; do
-     test -z "$dir" && dir=.
-     if test -f $dir/gcc; then
-       found=yes
-       break
-     fi
-   done
-   IFS="$save_ifs"
-   if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
-     xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
-     if [ -n "${xx}" ] ; then
-       CC=$xx
-     fi
-   fi
- fi
- 
  # We default to --with-shared on platforms where -fpic is meaningless.
  # Well, we don't yet, but we will.
--- 251,254 ----
***************
*** 331,334 ****
--- 310,334 ----
    done
    host_makefile_frag=mh-frag
+ fi
+ 
+ # If we aren't going to be using gcc, see if we can extract a definition
+ # of CC from the fragment.
+ if [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
+   IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+   found=
+   for dir in $PATH; do
+     test -z "$dir" && dir=.
+     if test -f $dir/gcc; then
+       found=yes
+       break
+     fi
+   done
+   IFS="$save_ifs"
+   if [ -z "${found}" ] && [ -f "mh-frag" ]; then
+     xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < mh-frag`
+     if [ -n "${xx}" ] ; then
+       CC=$xx
+     fi
+   fi
  fi
  
======================================================================

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]