public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Incorrect i960 linker config
@ 1997-08-30 12:00 Stephen Williams
  1997-08-30 19:18 ` include hackery Bruce Korb
                   ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Stephen Williams @ 1997-08-30 12:00 UTC (permalink / raw)
  To: egcs

The LINK_SPEC doesn't deal with the -mjx and -mrp switches. Also,
ld handles not being given an architecture switch well enough by
looking at what its got. This very simply patch fixes the link spec
by adding the new Jx target types.

NOTE: I think I was the one who submitted the -mjx spec entries for the
assembler, so this is my error I'm correcting:-) (Joel, I'm suprised that
you missed this. I would have thought it would effect RTEMS/i960 links:-)

*** dist/egcs-970828/gcc/config/i960/i960.h     Mon Aug 11 08:57:28 1997
--- egcs-970828/gcc/config/i960/i960.h  Fri Aug 29 23:45:01 1997
***************
*** 81,87 ****
  #define LINK_SPEC \
        "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\
        %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\
!       %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:-AKB}}}}}}}}\
        %{mbout:-Fbout}%{mcoff:-Fcoff}\
        %{mlink-relax:-relax}"
  
--- 81,87 ----
  #define LINK_SPEC \
        "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\
        %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\
!         %{mja:-AJX}%{mjd:-AJX}%{mjf:-AJX}%{mrp:-AJX}\
        %{mbout:-Fbout}%{mcoff:-Fcoff}\
        %{mlink-relax:-relax}"
  

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
  1997-08-30 19:18 ` include hackery Bruce Korb
  1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
@ 1997-08-30 19:18 ` Joel Sherrill
  1997-08-30 21:24 ` libg++? Jason Merrill
  1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
  4 siblings, 0 replies; 36+ messages in thread
From: Joel Sherrill @ 1997-08-30 19:18 UTC (permalink / raw)
  To: egcs

On Sat, 30 Aug 1997, Stephen Williams wrote:

> My work largely involves freestanding C++. Please, libgcc needing things
> from the C library (and posix) is bad enough. Start bringing in libraries
> from all over the universe and ``main() { return 0; }'' will no longer
> fit on certain boards!-)

I have not tried lately to see what the smallest useful exeutable is but I
know it is sometimes surprising what gets pulled in.

> Also, this again gets back to the build cycle problems Joel keeps griping
> about (and I also experience) and extending it ot yet another library.

 I don't know if gripe is the right word.  I just did not want the
problem to get worse in the reorganization.  

The reorganization seems to be a big step in the right direction for
embedded targets. 

--joel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: Incorrect i960 linker config
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
  1997-08-30 19:18 ` include hackery Bruce Korb
@ 1997-08-30 19:18 ` Joel Sherrill
  1997-08-30 19:18 ` fixing the c++/f77 circular dependency Joel Sherrill
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 36+ messages in thread
From: Joel Sherrill @ 1997-08-30 19:18 UTC (permalink / raw)
  To: egcs

On Sat, 30 Aug 1997, Stephen Williams wrote:

> NOTE: I think I was the one who submitted the -mjx spec entries for the
> assembler, so this is my error I'm correcting:-) (Joel, I'm suprised that
> you missed this. I would have thought it would effect RTEMS/i960 links:-)

No one has submitted any i960 RTEMS stuff recently.  If this is jx or rp
specific, then I never would have noticed. Also I do not think I have
actually built the i960 port yet with egcs. I have concentrated on sparc,
m68k, and i386 configurations.  

Plus I spent a lot of time (mostly unsuccessfully) trying to build gnat
cross based on egcs.  I need to try again with the reorganized source. 

--joel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* include hackery
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
@ 1997-08-30 19:18 ` Bruce Korb
  1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 36+ messages in thread
From: Bruce Korb @ 1997-08-30 19:18 UTC (permalink / raw)
  To: egcs

This is a multi-part message in MIME format.

--------------15CB44B55F50
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

After the email traffic this past week, I decided to look at
what fixincludes was really doing, partly because it looked
like it might be prone to a development approach I have been
playing with.  What I found was:

1.  The egrep pattern used to select files for ansification of
    machine names always selected every file.

2.  The files are read in over and over in long lists.
    All processing of a single file should be done all at once
    so the file system cache can do its thing.

So, I used some editing magic and a little sweat (~2hrs) to extract
the 80 or so hacks into their fundamental descriptions.  These
descriptions consist of the list of files they might apply to,
tests to run to see if they should be attempted and the sed
or shell scripts needed to implement the hack.  From these
descriptions, I generated an equivalent shell script that addressed
issue #2.  I then simplified and separated the "#else", "#endif",
ansified machine names and the IO macro fixes to address #1.
The result works on my box.  If this script is found to work
generally (or found to work with minor mods), then I can *trivially*
generate a C program that does exactly the same thing.
At that point, I would be able to generate *BOTH* a shell script
and a C program from a *SINGLE* description of the needed changes.
Furthermore, the description file can work with the "config.h"
header file to omit the irrelevent tests.

Attached is the "inclhack.sh" generated script for your possible
assistence.
Also attached is the "inclhack.def" file, for your amusement.

-- 
Bruce Korb                      | Data Design Systems, Inc.
Korbb at DataDesign dot com     | 45 Cabot Dr., Suite 110
Voice:  408-260-0280            | Santa Clara,  CA   95051
Fax:    408-260-0281            | USA

--------------15CB44B55F50
Content-Type: application/x-sh; name="inclhack.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="inclhack.sh"

#!/bin/sh -p
#
#  DO NOT EDIT THIS FILE.
#
#  It has been autogen-ned from inclhack.tpl and inclhack.def
#
# Install modified versions of certain ANSI-incompatible system header files
# which are fixed to work correctly with ANSI C
# and placed in a directory that GNU C will search.

# See README-fixinc for more information.

# inclhack is free software.
# 
# You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 2, or (at your option) any later version.
# 
# inclhack is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with inclhack.  See the file "COPYING".  If not,
# write to:  The Free Software Foundation, Inc.,
#            59 Temple Place - Suite 330,
#            Boston,  MA  02111-1307, USA.
# # # # # # # # # # # # # # # # # # # # #
#
# Directory containing the original header files.
# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
#
INPUT=${2-${INPUT-/usr/include}}

( \cd ${INPUT} > /dev/null 2>&1 ) || {
  echo fixincludes:  input dir '`'$INPUT"' is an invalid directory"
  exit 1
}

# # # # # # # # # # # # # # # # # # # # #
#
# Directory in which to store the results.
# Fail if no arg to specify a directory for the output.
if [ "x$1" = "x" ]
then echo fixincludes: no output directory specified
exit 1
fi

LIB=${1}

# Make sure it exists.
if [ ! -d $LIB ]; then
  mkdir $LIB || {
    echo fixincludes:  output dir '`'$LIB"' cannot be created"
    exit 1
  }
else
  ( \cd $LIB && touch DONE && rm DONE ) || {
    echo fixincludes:  output dir '`'$LIB"' is an invalid directory"
    exit 1
  }
fi

# # # # # # # # # # # # # # # # # # # # #
#
# Define PWDCMD as a command to use to get the working dir
# in the form that we want.
PWDCMD=pwd

case "`$PWDCMD`" in
//*)
    # On an Apollo, discard everything before `/usr'.
    PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
    ;;
esac

# Original directory.
ORIGDIR=`${PWDCMD}`

# Figure out how to return from a function call
#
if test -z "$RANDOM"
then
    RETURN=exit
else
    RETURN=return
fi



# # # # # # # # # # # # # # # # # # # # #
#
rehack_file()
{
  if ( test ! -r $1/$3 -o \
      -n "`fgrep 'This file is part of the GNU C Library' $1/$3`" )
  then ${RETURN} 0 ; fi
  echo "Checking $3..."
  fixlist=""


  # Endif_Label fix
  #
    if ( test -n "`egrep '^[ 	]*#[ 	]*endif[ 	]+[!-.0-~]' $1/$3`"
       ) > /dev/null 2>&1 ; then
      fixlist="${fixlist}
	endif_label"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	else_label"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	IO_macros"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ansify"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ioctl_fix_quotes"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ioctl_fix_ctrl"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	undefine_NULL"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	systypes"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	hp_inline"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	statsswtch_syntax"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ultrix_ifdef"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	hp_sysfile"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sun_catmacro"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sun_rusers_semi"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sun_bogus_ifdef_vax"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sun_bogus_ifdef_sun4c"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sony_include"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	irix_cplusplus_comment"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	VxWorks_cplusplus_comment"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	no_double_slash"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	IRIX_sockaddr"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	sun_non_ansi_memcpy"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	rs6000_class_double"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	rs6000_fchmod_prototype"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	x11_class_conflict"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	x11_new_conflict"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	x11_class_conflict_usage"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	NeXT_math_prefix"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	NeXT_template"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	NeXT_volitile"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	AIX_syswait"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	NeXT_wait_union"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
    :
  else
    echo "#define __need___va_list"
    echo "#include "
  fi

  # Use __gnuc_va_list in arg types in place of va_list.
  # On 386BSD use __gnuc_va_list instead of _VA_LIST_.  We're hoping the
  # trailing parentheses and semicolon save all other systems from this.
  # Define __va_list__ (something harmless and unused) instead of va_list.
  # Don't claim to have defined va_list.
  sed -e 's@ va_list @ __gnuc_va_list @' \
      -e 's@ va_list)@ __gnuc_va_list)@' \
      -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
      -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
      -e 's@ va_list@ __va_list__@' \
      -e 's@\*va_list@*__va_list__@' \
      -e 's@ __va_list)@ __gnuc_va_list)@' \
      -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
      -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
      -e 's@VA_LIST@DUMMY_VA_LIST@' \
      -e 's@_Va_LIST@_VA_LIST@' )  $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Ultrix_ansi_compat"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	news_os_recursive_stdlib"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	limits_ifndefs"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1
	then sed -e '/define[ 	]HUGE_VAL[ 	]/i\
#ifndef HUGE_VAL
' \
	-e '/define[ 	]HUGE_VAL[ 	]/a\
#endif
'\
	-e "/define[ 	]HUGE_VAL[ 	]DBL_MAX/s/DBL_MAX/$dbl_max_def/"
	else sed -e '/define[ 	]HUGE_VAL[ 	]/i\
#ifndef HUGE_VAL
' \
	-e '/define[ 	]HUGE_VAL[ 	]/a\
#endif
'
	fi )  $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Alpha_bad_parens"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Lynx_bad_void_int"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	bad_struct_term"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	m88k_bad_s_if"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Alpha_getopt_decls"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Interactive_add1"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Interactive_add2"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Interactive_add3"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ISC_fmod"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	ISC_sys_limits"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	kandr_concatenation"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	SunOS_matherr_decl"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	hpux_assert_for_cxx"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	broken_assert_stdio"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	broken_assert_stdlib"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	Alpha_sbrk"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 &2
         rm -f $2/${3} $2/${3}. )  $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	m88k_multi_include"
      if [ ! -r $2/$3 ]
      then exec 4 &2
      cpp_wrapper=`echo $3 | sed -e 's,\.,_,g' -e 's,/,_,g'`
      sed -e "1i
#ifndef __GCC_GOT_${cpp_wrapper}_
#define __GCC_GOT_${cpp_wrapper}_
" \
	-e "$a
#endif /* ! __GCC_GOT_${cpp_wrapper}_ */
" )  $2/$3.
      exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	va_i960_macro_defs"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	VxWorks_gcc_problem"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	VxWorks_needs_vxWorks"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1 ; then
      fixlist="${fixlist}
	VxWorks_time_needs_vxTypes"
      if [ ! -r $2/$3 ]
      then exec 4 $2/$3.
      exec 4 /dev/null 2>&1
  then
    rm -f $2/$3
  else
    echo "Fixed $3:${fixlist}"

    # Find any include directives that use "file".
    #
    for include in `egrep '^[    ]*#[    ]*include[      ]*"[^/]' $2/$3 |
         sed -e 's/^[        ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`
    do
      dir=`echo $3 | sed -e s'|/[^/]*$||'`
      required="$required $1 $dir/$include $2/$dir/$include"
    done
  fi
}

# Make LIB absolute only if needed to avoid problems with the amd.
case $LIB in
/*)
    ;;
*)
    cd $LIB; LIB=`${PWDCMD}`
    ;;
esac

echo Building fixed headers in ${LIB}
 
# Determine whether this system has symbolic links.
if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
  rm -f $LIB/ShouldNotExist
  LINKS=true
elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
  rm -f /tmp/ShouldNotExist
  LINKS=true
else
  LINKS=false
fi
 
echo Finding directories and links to directories
cd ${INPUT}
# Find all directories and all symlinks that point to directories.
# Put the list in $files.
# Each time we find a symlink, add it to newdirs
# so that we do another find within the dir the link points to.
# Note that $files may have duplicates in it;
# later parts of this file are supposed to ignore them.
dirs="."
levels=2
while [ -n "$dirs" ] && [ $levels -gt 0 ]
do
    levels=`expr $levels - 1`
    newdirs=
    for d in $dirs
    do
    echo " Searching $INPUT/$d"
    if [ "$d" != . ]
    then
        d=$d/.
    fi
 
    # Find all directories under $d, relative to $d, excluding $d itself.
        files="$files `find $d -type d -print | \
               sed -e '/\/\.$/d' -e '/^\.$/d'`"
    # Find all links to directories.
    # Using `-exec test -d' in find fails on some systems,
    # and trying to run test via sh fails on others,
    # so this is the simplest alternative left.
    # First find all the links, then test each one.
    theselinks=
    $LINKS && \
      theselinks=`find $d -type l -print`
    for d1 in $theselinks --dummy--
    do
        # If the link points to a directory,
        # add that dir to $newdirs
        if [ -d $d1 ]
        then
        files="$files $d1"
        if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
        then
            newdirs="$newdirs $d1"
        fi
        fi
    done
    done
 
    dirs="$newdirs"
done
 
dirs=
echo "All directories (including links to directories):"
echo $files
 
for file in $files; do
  rm -rf $LIB/$file
  if [ ! -d $LIB/$file ]
  then mkdir $LIB/$file
  fi
done
mkdir $LIB/root
 
# treetops gets an alternating list
# of old directories to copy
# and the new directories to copy to.
treetops="${INPUT} ${LIB}"
 
if $LINKS; then
  echo 'Making symbolic directory links'
  for file in $files; do
    dest=`ls -ld $file | sed -n 's/.*-> //p'`
    if [ "$dest" ]; then
      cwd=`${PWDCMD}`
      # In case $dest is relative, get to $file's dir first.
      cd ${INPUT}
      cd `echo ./$file | sed -n 's&[^/]*$&&p'`
      # Check that the target directory exists.
      # Redirections changed to avoid bug in sh on Ultrix.
      (cd $dest) > /dev/null 2>&1
      if [ $? = 0 ]; then
    cd $dest
    # X gets the dir that the link actually leads to.
    x=`${PWDCMD}`
    # Canonicalize ${INPUT} now to minimize the time an
    # automounter has to change the result of ${PWDCMD}.
    cinput=`cd ${INPUT}; ${PWDCMD}`
    # If a link points to ., make a similar link to .
    if [ $x = ${cinput} ]; then
      echo $file '->' . ': Making link'
      rm -fr ${LIB}/$file > /dev/null 2>&1
      ln -s . ${LIB}/$file > /dev/null 2>&1
    # If link leads back into ${INPUT},
    # make a similar link here.
    elif expr $x : "${cinput}/.*" > /dev/null; then
      # Y gets the actual target dir name, relative to ${INPUT}.
      y=`echo $x | sed -n "s&${cinput}/&&p"`
      # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
      dots=`echo "$file" |
        sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
      echo $file '->' $dots$y ': Making link'
      rm -fr ${LIB}/$file > /dev/null 2>&1
      ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
    else
      # If the link is to a dir $target outside ${INPUT},
      # repoint the link at ${INPUT}/root$target
      # and process $target into ${INPUT}/root$target
      # treat this directory as if it actually contained the files.
      echo $file '->' root$x ': Making link'
      if [ -d $LIB/root$x ]
      then true
      else
        dirname=root$x/
        dirmade=.
        cd $LIB
        while [ x$dirname != x ]; do
          component=`echo $dirname | sed -e 's|/.*$||'`
          mkdir $component >/dev/null 2>&1
          cd $component
          dirmade=$dirmade/$component
          dirname=`echo $dirname | sed -e 's|[^/]*/||'`
        done
      fi
      # Duplicate directory structure created in ${LIB}/$file in new
      # root area.
      for file2 in $files; do
        case $file2 in
          $file/./*)
        dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
        echo "Duplicating ${file}'s ${dupdir}"
        if [ -d ${dupdir} ]
        then true
        else
          mkdir ${dupdir}
        fi
        ;;
          *)
        ;;
        esac
          done
      # Get the path from ${LIB} to $file, accounting for symlinks.
      parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
      libabs=`cd ${LIB}; ${PWDCMD}`
      file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
      # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
      dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
      rm -fr ${LIB}/$file > /dev/null 2>&1
      ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
      treetops="$treetops $x ${LIB}/root$x"
    fi
      fi
      cd $cwd
    fi
  done
fi
 
required=
set x $treetops
shift
while [ $# != 0 ]; do
  # $1 is an old directory to copy, and $2 is the new directory to copy to.
  cd ${INPUT}
  cd $1
  # The same dir can appear more than once in treetops.
  # There's no need to scan it more than once.
  if [ -f $2/DONE ]
  then
    shift ; shift
    continue
  fi

  touch $2/DONE
  echo Fixing directory $1 into $2

  # Check .h files which are symlinks as well as those which are files.
  # A link to a header file will not be processed by anything but this.
  if $LINKS; then
    files=`find . -name '*.h' \( -type f -o -type l \) -print`
  else
    files=`find . -name '*.h' -type f -print`
  fi
  echo Checking header files

  # Note that BSD43_* are used on recent MIPS systems.
  for file in $files; do
    rehack_file ${INPUT} ${LIB} $file
  done
  echo all files in ${1} have been rehacked
  shift ; shift
done

## Make sure that any include files referenced using double quotes
## exist in the fixed directory.  This comes last since otherwise
## we might end up deleting some of these files "because they don't
## need any change."
set x $required
shift
while [ $# != 0 ]; do
  newreq=
  while [ $# != 0 ]; do
    # $1 is the directory to copy from, $2 is the unfixed file,
    # $3 is the fixed file name.
    cd ${INPUT}
    cd $1
    if [ -r $2 ] && [ ! -r $3 ]; then
      cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2"
      chmod +w $3 2>/dev/null
      chmod a+r $3 2>/dev/null
      echo Copied $2
      for include in `egrep '^[ 	]*#[ 	]*include[ 	]*"[^/]' $3 |
             sed -e 's/^[ 	]*#[ 	]*include[ 	]*"\([^"]*\)".*$/\1/'`
      do
	dir=`echo $2 | sed -e s'|/[^/]*$||'`
	dir2=`echo $3 | sed -e s'|/[^/]*$||'`
	newreq="$newreq $1 $dir/$include $dir2/$include"
      done
    fi
    shift; shift; shift
  done
  set x $newreq
  shift
done

echo 'Cleaning up DONE files.'
cd $LIB
find . -name DONE -exec rm -f '{}' ';'

echo 'Removing unneeded directories:'
cd $LIB
files=`find . -type d -print | sort -r`
for file in $files; do
  rmdir $LIB/$file > /dev/null 2>&1
done

--------------15CB44B55F50
Content-Type: text/plain; charset=us-ascii; name="inclhack.def"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="inclhack.def"

/* -*- Mode: C -*- */

autogen definitions inclhack;

inclhack = {
    hackname = endif_label;
    select   = "^[ \t]*#[ \t]*endif[ \t]+[!-.0-~]";
    sed      = "
                                   :loop
          /\\\\$/                       N
          /\\\\$/                       b loop
          s@^[ \t]*#[ \t]*endif[ \t][ \t]*\\([!-.0-~].*\\)@"
                "#endif /* \\1 */@";
};

inclhack = {
    hackname = else_label;
    select   = "^[ \t]*#[ \t]*else[ \t]+[!-.0-~]";
    sed      = "
                                   :loop
          /\\\\$/                       N
          /\\\\$/                       b loop
          s@^[ \t]*#[ \t]*else[ \t][ \t]*\\([!-.0-~].*\\)@"
                "#else /* \\1 */@";
};

inclhack = {
    hackname = IO_macros;
    select   = "_IO[A-Z]*[ \t]";
    sed = "/[ \t]_IO[A-Z]*[ \t]*(/s/\\(_IO[A-Z]*[ \t]*(\\)\\(.\\),/"
                                   "\\1'\\''\\2'\\'',/";
    sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/s/(\\(.\\),/('\\''\\1'\\'',/";
    sed = "/#define.BSD43__IO/          s/'\\''\\([cgx]\\)'\\''/\\1/g";
};

inclhack = {
    hackname = ansify;
    /*
     *  Select '#else' and '#endif' with non-commentary text
     *  AND    '#if' and '#elif" with possible non-ansi symbols
     */
    select = "^#[ \t]*if[ \t].*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]"
             "|^#[ \t]*elif[ \t].*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]";
        sed = "
                                   :loop
          /\\\\$/                       N
          /\\\\$/                       b loop
          /#[\t ]*[el]*if/ {\n"
                "\t\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n"

                "\t\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n"
                "\t\ts/ _*host_mips / __host_mips__ /g\n"
                "\t\ts/ _*i386 / __i386__ /g\n"
                "\t\ts/ M32 / __M32__ /g\n"
                "\t\ts/ is68k / __is68k__ /g\n"
                "\t\ts/ m68k / __m68k__ /g\n"
                "\t\ts/ mc680\\([0-9]\\)0 / __mc680\\10__ /g\n"
                "\t\ts/ m88k / __m88k__ /g\n"
                "\t\ts/ _*mips / __mips__ /g\n"
                "\t\ts/ news\\([0-9]*\\) / __news\\1__ /g\n"
                "\t\ts/ ns32000 / __ns32000__ /g\n"
                "\t\ts/ pdp11 / __pdp11__ /g\n"
                "\t\ts/ pyr / __pyr__ /g\n"
                "\t\ts/ sel / __sel__ /g\n"
                "\t\ts/ sony_news / __sony_news__ /g\n"
                "\t\ts/ sparc / __sparc__ /g\n"
                "\t\ts/ sun\\([a-z0-9]*\\) / __sun\\1__ /g\n"
                "\t\ts/ tahoe / __tahoe__ /g\n"
                "\t\ts/ tower\\([_0-9]*\\) / __tower\\1__ /g\n"
                "\t\ts/ u370 / __u370__ /g\n"
                "\t\ts/ u3b\\([0-9]*\\) / __u3b\\1__ /g\n"
                "\t\ts/ unix / __unix__ /g\n"
                "\t\ts/ vax / __vax__ /g\n"
                "\t\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
                "\t\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
                "\t\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"

                "\t\ts/ \\([a-zA-Z0-9_][a-zA-Z0-9_]*\\) /\\1/g\n\t}";
};

inclhack = {
    hackname = ioctl_fix_quotes;
    select = "define[ \t][ \t]*_IO";
    sed    = "/define[ \t_[ \t]*_IO/s/'\\''\\([cgxtf]\\)'\\''/\\1/g";
};

inclhack = {
    hackname = ioctl_fix_ctrl;
    select = "CTRL[ \t]";
    sed =
        "/[^A-Z0-9_]CTRL[ \t]*(/   s/\\([^'\\'']\\))/'\\''\\1'\\'')/\n"
        "/[^A-Z0-9]_CTRL[ \t]*(/   s/\\([^'\\'']\\))/'\\''\\1'\\'')/\n"
        "/#define[ \t]*[ \t]CTRL/  s/'\\''\\([cgx]\\)'\\''/\\1/g\n"
        "/#define[ \t]*[ \t]_CTRL/ s/'\\''\\([cgx]\\)'\\''/\\1/g\n"
        "/#define[ \t]*[ \t]BSD43_CTRL/s/'\\''\\([cgx]\\)'\\''/\\1/g\n";
};

inclhack = {
    hackname = "undefine_NULL";
    select = "^#define[ \t][ \t]*NULL[ \t]";
    sed    = "/^#define[ \t][ \t]*NULL[ \t]/i\\\n"
		"#undef NULL\n";
};

inclhack = {
    hackname = systypes;
    files  = "sys/types.h";
    files  = "stdlib.h";
    files  = "sys/stdtypes.h";
    files  = "stddef.h";
    files  = "memory.h";
    files  = "unistd.h";
    select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
             "(size|ptrdiff|wchar)_t";

      sed  = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
                   "#ifndef __SIZE_TYPE__\\\n"
                   "#define __SIZE_TYPE__ long unsigned int\\\n"
                   "#endif\n";

      sed  = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
               "typedef __SIZE_TYPE__ size_t/";

      sed  = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
                   "#ifndef __PTRDIFF_TYPE__\\\n"
                   "#define __PTRDIFF_TYPE__ long int\\\n"
                   "#endif\n";

      sed  = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
               "typedef __PTRDIFF_TYPE__ ptrdiff_t/";

      sed  = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
                   "#ifndef __WCHAR_TYPE__\\\n"
                   "#define __WCHAR_TYPE__ int\\\n"
                   "#endif\\\n"
                   "#ifndef __cplusplus\n";

      sed  = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
                   "#endif\n";

      sed  = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
               "typedef __WCHAR_TYPE__ wchar_t/";
};


/*
 * Fix one other error in this file:
 *  a mismatched quote not inside a C comment.
 */
inclhack = {
    hackname = badquote;
    files    = sundev/vuid_event.h;
    /*
     *  The following uglitude is to allow an apostrophe inside
     *  of a single quote quoted string in a shell command line.
     */
    sed      = "s/doesn'\\''t/does not/";
};


/*
 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
 */
inclhack = {
    hackname = ecd_cursor;
    files  = "sunwindow/win_lock.h";
    files  = "sunwindow/win_cursor.h";
    sed    = "s/ecd.cursor/ecd_cursor/";
};



/*
 *  Fix this Sun file to avoid interfering with stddef.h.
 */
inclhack = {
    hackname = sun_stdtypes;
    files = sys/stdtypes.h;
    sed   = "/[\t ]size_t.*;/i\\\n"
              "#ifndef _GCC_SIZE_T\\\n"
              "#define _GCC_SIZE_T\n";

    sed   = "/[\t ]size_t.*;/a\\\n"
              "#endif\n";

    sed   = "/[\t ]ptrdiff_t.*;/i\\\n"
              "#ifndef _GCC_PTRDIFF_T\\\n"
              "#define _GCC_PTRDIFF_T\n";

    sed   = "/[\t ]ptrdiff_t.*;/a\\\n"
              "#endif\n";

    sed   = "/[\t ]wchar_t.*;/i\\\n"
              "#ifndef _GCC_WCHAR_T\\\n"
              "#define _GCC_WCHAR_T\n";

    sed   = "/[\t ]wchar_t.*;/a\\\n"
              "#endif\n";
};


/*
 *  Fix this ARM/RISCiX file to avoid interfering
 *  with the use of __wchar_t in cc1plus.
 */
inclhack = {
    hackname = arm_wchar;
    files  = stdlib.h;
    select = "#[ \t]*define[ \t]*__wchar_t";
    sed    = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
    sed    = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
};


/*
 *  Fix this ARM/RISCiX file where ___type is a Compiler
 *  hint that is specific to the Norcroft compiler.
 */
inclhack = {
    hackname = arm_norcroft_hint;
    files    = "X11/Intrinsic.h";
    sed      = "s/___type p_type/p_type/";
};


/*
 *  Fix this file to avoid interfering with stddef.h,
 *  but don't mistakenly match ssize_t present in AIX for the ps/2,
 *  or typedefs which use (but do not set) size_t.
 */
inclhack = {
    hackname = aix_systypes;
    files    = sys/types.h;
    select   = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";

    sed    = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
                 "#ifndef _GCC_SIZE_T\\\n"
                 "#define _GCC_SIZE_T\n";

    sed    = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
                 "#endif\n";
};



/*
 *  Fix HP's use of ../machine/inline.h to refer to
 *    /usr/include/machine/inline.h
 */
inclhack = {
    hackname = hp_inline;
    files  = sys/spinlock.h;
    select = "\\\"../machine/";
    sed    = "s,\"../machine/inline.h\", ,";
    sed    = "s,\"../machine/psl.h\", ,";
};


/*
 *  if the #if says _cplusplus, not the double underscore __cplusplus
 *  that it should be
 */
inclhack = {
    hackname = tinfo_cplusplus;
    files    = tinfo.h;
    sed      = "s/[ \t]_cplusplus/ __cplusplus/";
};


/*
 *  a missing semi-colon at the end of the statsswtch structure definition.
 */
inclhack = {
    hackname = statsswtch_syntax;
    files    = rpcsvc/rstat.h;
    select   = "boottime$";
    sed      = 's/boottime$/boottime;/';
};


/*
 *  a missing semi-colon at the end of the nodeent structure definition.
 */
inclhack = {
    hackname = nodeent_syntax;
    files    = netdnet/dnetdb.h;
    sed      = 's/char.*na_addr *$/char *na_addr;/';
};


/*
 *  Check for bad #ifdef line (in Ultrix 4.1)
 */
inclhack = {
    hackname = ultrix_ifdef;
    select   = "#ifdef KERNEL";
    files    = sys/file.h;
    sed      = 's/#ifdef KERNEL/#if defined(KERNEL)/';
};


/*
 *  Check for (...) in C++ code in HP/UX sys/file.h.
 */
inclhack = {
    hackname = hp_sysfile;
    files    = sys/file.h;
    select   = "HPUX_SOURCE";
    sed      = 's/(\\.\\.\\.)/(struct file * ...)/';
};


/*
 *  Check for superfluous `static' (in Ultrix 4.2)
 *  On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
 */
inclhack = {
    hackname = ultrix_static;
    files = machine/cpu.h;
    sed   = 's/^static struct tlb_pid_state/struct tlb_pid_state/';
    sed   = 's/^#include "r3_cpu\\.h"$/#include /';
    sed   = 's/^#include "r4_cpu\\.h"$/#include /';
};


/*
 *  Incorrect sprintf declaration in X11/Xmu.h
 */
inclhack = {
    hackname = x11_sprintf;
    files    = X11*/Xmu.h;
    sed      =
"s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\
extern char *\tsprintf();\\\n"
        "#endif /* !defined __STDC__ */,";
};


/*
 *  Check for missing ';' in struct
 */
inclhack = {
    hackname = ip_missing_semi;
    files    = netinet/ip.h;
    sed      = '/^struct/,/^};/s/}$/};/';
};


/*
 *  Fix the CAT macro in SunOS memvar.h.
 */
inclhack = {
    hackname = sun_catmacro;
    files  = pixrect/memvar.h;
    select = "^#define[ \t]+CAT(a,b)";
    sed    = "/^#define[ \t]CAT(a,b)/ i\\\n"
                 "#ifdef __STDC__ \\\n"
                 "#define CAT(a,b) a##b\\\n"
                 "#else\n";

    sed    = "/^#define[ \t]CAT(a,b)/ a\\\n"
                 "#endif\n";
};


/*
 *  Check for yet more missing ';' in struct (in SunOS 4.0.x)
 */
inclhack = {
    hackname = sun_rusers_semi;
    files    = rpcsvc/rusers.h;
    select   = "_cnt$";
    sed      = '/^struct/,/^};/s/_cnt$/_cnt;/';
};


/*
 *  Fix return type of exit and abort in  on SunOS 4.1.
 *  Also wrap protection around size_t for m88k-sysv3 systems.
 */
inclhack = {
    hackname = sun_exit_type;
    files    = stdlib.h;

    sed   = "s/int\tabort/void\tabort/g";
    sed   = "s/int\tfree/void\tfree/g";
    sed   = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
    sed   = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
    sed   = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
    sed   = "s/int[ \t][ \t]*exit/void\texit/g";

    sed   = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/i\\\n"
                "#ifndef _GCC_SIZE_T\\\n"
                "#define _GCC_SIZE_T\n";

    sed   = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/a\\\n"
                "#endif\n";
};


/*
 *  Fix return type of free and {c,m,re}alloc in  on SunOS 4.1.
 *  Also fix return type of {m,re}alloc in  on sysV68
 */
inclhack = {
    hackname = sun_malloc_return;
    files    = malloc.h;

    sed   = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
    sed   = "s/int[ \t][ \t]*free/void\tfree/g";
    sed   = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
    sed   = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
};


/*
 *  Fix bogus #ifdef on SunOS 4.1.
 */
inclhack = {
    hackname = sun_bogus_ifdef_vax;
    files  = "hsfs/hsfs_spec.h";
    files  = "hsfs/iso_spec.h";
    select = "#ifdef __i386__ || __vax__";
    sed    = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
};


/*
 *  Fix bogus #ifdef on SunOS 4.1.
 */
inclhack = {
    hackname = sun_bogus_ifdef_sun4c;
    files  = "hsfs/hsnode.h";
    select = "#ifdef __i386__ || __sun4c__";
    sed    = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
};



/*
 *  Incorrect #include in Sony News-OS 3.2.
 */
inclhack = {
    hackname = sony_include;
    files    = machine/machparam.h;
    select   = '"../machine/endian.h"';
    sed      = 's@"../machine/endian.h"@ @';
};



/*
 *  Multiline comment after typedef on IRIX 4.0.1.
 */
inclhack = {
    hackname = irix_Multiline_comment;
    files    = sys/types.h;

    sed   = 's@type of the result@type of the result */@';
    sed   = 's@of the sizeof@/* of the sizeof@';
};


/*
 *  Turning // comments into normal comments trashes this IRIX 4.0.1
 *  header file, which embeds // comments inside multi-line
 *  comments.  If this looks like the IRIX header file, we refix it by
 *  just throwing away the // comments.
 */
inclhack = {
    hackname = irix_cplusplus_comment;
    files    = fam.h;
    select   = indigo.esd;
    sed      = 's|//.*$||g';
};


/*
 *  There is a similar problem with the VxWorks drv/netif/if_med.h file.
 */
inclhack = {
    hackname = VxWorks_cplusplus_comment;
    files    = drv/netif/if_med.h;
    select   = 'Wind River';
    sed      = 's|//.*$||g';
};

/*
 *  Remove the double-slash comments
 */
inclhack = {
    hackname = no_double_slash;
    select = "//[^*]";
    sed = "/\\/\\/[^*]/s|//\\(.*\\)$|/*\\1*/|";
};


/*
 *  Some IRIX header files contain the string "//"
 */
inclhack = {
    hackname = irix_bogus_cplusplus_comment;
    files  = "elf_abi.h";
    files  = "elf.h";
    /*
     *  This really looks like it is replacing "/ * * /" with "//"
     *  Shouldn't the replacement really be " ## "?
     */
    sed      = 's|"/\\*"\\*/|"//"|';
};


/*
 *  IRIX 4.0.5  uses struct sockaddr
 *  in prototype without previous definition.
 */
inclhack = {
    hackname = IRIX_sockaddr;
    files    = rpc/auth.h;
    select   = "authdes_create.*struct sockaddr";
    sed      = "/authdes_create.*struct sockaddr/i\\\n"
               "struct sockaddr;\n";
};


/*
 *  IRIX 4.0.5  uses struct __file_s
 *  in prototype without previous definition.
 */
inclhack = {
    hackname = IRIX_struct__file_s;
    files = rpc/xdr.h;
    sed   = "/xdrstdio_create.*struct __file_s/i\\\n"
            "struct __file_s;\n";
};


/*
 *  Same problem with a file from SunOS 4.1.3 : a header file containing
 *  the string "//" embedded in "/ * * /"
 */
inclhack = {
    hackname = SunOS_slash_slash;
    files    = sbusdev/audiovar.h;
    sed      = 's|//.*$||g';
};


/*
 *  Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
 *  declaration on Sun OS 4.x.  We must only fix this on Sun OS 4.x, because
 *  many other systems have similar text but correct versions of the file.
 *  To ensure only Sun's is fixed, we grep for a likely unique string.
 */
inclhack = {
    hackname = sun_non_ansi_memcpy;
    files    = memory.h;
    select = "/\\*\t@\\(#\\)memory\\.h 1\\.[2-4] 8./../.. SMI;"
             " from S5R2 1\\.2\t\\*/";

    sed    = "1i\n/* This file was generated by fixincludes */\n"
             "#ifndef __memory_h__\n"
             "#define __memory_h__\n\n"
             "#ifdef __STDC__\n"
             "extern void *memccpy();\n"
             "extern void *memchr();\n"
             "extern void *memcpy();\n"
             "extern void *memset();\n"
             "#else\n"
             "extern char *memccpy();\n"
             "extern char *memchr();\n"
             "extern char *memcpy();\n"
             "extern char *memset();\n"
             "#endif /* __STDC__ */\n\n"
             "extern int memcmp();\n\n"
             "#endif /* __memory_h__ */\n";

    sed    = "1,$d";
};


/*
 *  parameters not const on DECstation Ultrix V4.0 and OSF/1.
 */
inclhack = {
    hackname = Ultrix_const_parameters;
    files    = stdio.h;

    sed   = 's@perror( char \\*__s );@perror( const char *__s );@';
    sed   = 's@fputs( char \\*__s,@fputs( const char *__s,@';
    sed   = 's@fopen( char \\*__filename, char \\*__type );@'
              'fopen( const char *__filename, const char *__type );@';
    sed   = 's@fwrite( void \\*__ptr,@fwrite( const void *__ptr,@';
    sed   = 's@fscanf( FILE \\*__stream, char \\*__format,@'
              'fscanf( FILE *__stream, const char *__format,@';
    sed   = 's@scanf( char \\*__format,@scanf( const char *__format,@';
    sed   = 's@sscanf( char \\*__s, char \\*__format,@'
              'sscanf( const char *__s, const char *__format,@';
    sed   = 's@popen(char \\*, char \\*);@popen(const char *, const char *);@';
    sed   = 's@tempnam(char\\*,char\\*);@tempnam(const char*,const char*);@';
};



/*
 *  parameters conflict with C++ new on rs/6000 
 */
inclhack = {
    hackname = rs6000_param_conflicts;
    files  = "stdio.h";
    files  = "unistd.h";

    sed = 's@rename(const char \\*old, const char \\*new)@'
            'rename(const char *_old, const char *_new)@';
};


/*
 *  function class(double x) conflicts with C++ keyword on rs/6000 
 */
inclhack = {
    hackname = rs6000_class_double;
    files    = math.h;
    select = 'class[(]';
    
    sed   = "/class[(]/i\\\n#ifndef __cplusplus\n";
    sed   = "/class[(]/a\\\n#endif\n";
};


/*
 *  Wrong fchmod prototype on RS/6000.
 */
inclhack = {
    hackname = rs6000_fchmod_prototype;
    files    = sys/stat.h;
    select   = "fchmod(char";
    sed      = 's/fchmod(char \\*/fchmod(int/';
};


/*
 *  There are several name conflicts with C++ reserved words in X11 header
 *  files.  These are fixed in some versions, so don't do the fixes if
 *  we find __cplusplus in the file.  These were found on the RS/6000.
 */
inclhack = {
    hackname = x11_class_conflict;
    files    = X11/ShellP.h;
    bypass   = __cplusplus;
    sed      = "/char [*]class;/i\\\n"
                   "#ifdef __cplusplus\\\n"
                   "\tchar *c_class;\\\n"
                   "#else\n";
    sed      = "/char [*]class;/a\\\n"
                   "#endif\n";
};


/*
 *  new in Xm/Traversal.h
 */
inclhack = {
    hackname = x11_new_conflict;
    files    = Xm/Traversal.h;
    bypass   = __cplusplus;

    sed      = "/Widget\told, new;/i\\\n"
                   "#ifdef __cplusplus\\\n"
                   "\tWidget\told, c_new;\\\n"
                   "#else\n";

    sed      = "/Widget\told, new;/a\\\n"
                   "#endif\n";

    sed      = "s/Widget new,/Widget c_new,/g";
};


/*
 *  class in Xm/BaseClassI.h
 */
inclhack = {
    hackname = x11_class_conflict_usage;
    files    = Xm/BaseClassI.h;
    bypass   = "__cplusplus";
    sed = 's/ class[)]/ c_class)/g';
};


/*
 *  NeXT 3.2 adds const prefix to some math functions.
 *  These conflict with the built-in functions.
 */
inclhack = {
    hackname = NeXT_math_prefix;
    files    = ansi/math.h;
    select   = "extern.*double.*__const__.*";

    sed = '/^extern.*double.*__const__.*cos(/s/__const__//';
    sed = '/^extern.*double.*__const__.*sin(/s/__const__//';
};


/*
 *  NeXT 3.2 uses the word "template" as a parameter for some
 *  functions. GCC reports an invalid use of a reserved key word
 *  with the built-in functions. NeXT 3.2 includes the keyword
 *  volatile in the prototype for abort(). This conflicts with
 *  the built-in definition.
 */
inclhack = {
    hackname = NeXT_template;
    files    = bsd/libc.h;
    select   = template;

    sed = '/\\(.*template\\)/s/template//';
    sed = '/extern.*volatile.*void.*abort/s/volatile//';
};


/*
 *  NeXT 3.2 includes the keyword volatile in the abort() and  exit()
 *  function prototypes. That conflicts with the  built-in functions.
 */
inclhack = {
    hackname = NeXT_volitile;
    files    = ansi/stdlib.h;
    select   = volatile;

    sed    = '/extern.*volatile.*void.*exit/s/volatile//';
    sed    = '/extern.*volatile.*void.*abort/s/volatile//';
};


/*
 *  sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
 *  of struct rusage, so the prototype (added by fixproto) causes havoc.
 */
inclhack = {
    hackname = AIX_syswait;
    files    = sys/wait.h;
    select = 'bos325,';
    sed    = '/^extern pid_t wait3();$/i\\\n'
             'struct rusage;\n';
};



/*
 *  NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
 *  Note that version 3 of the NeXT system has wait.h in a different directory,
 *  so that this code won't do anything.  But wait.h in version 3 has a
 *  conditional, so it doesn't need this fix.  So everything is okay.
 */
inclhack = {
    hackname = NeXT_wait_union;
    files    = sys/wait.h;

    select = 'wait[(]union wait';

    sed = 's@wait(union wait@wait(void@';
};


/*
 *  Don't use or define the name va_list in stdio.h.
 *  This is for ANSI and also to interoperate properly with gcc's varargs.h.
 *  Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
 */
inclhack = {
    hackname = stdio_va_list;
    files    = stdio.h;

    shell =
 "if ( egrep \"__need___va_list\" $1/$3 ) > /dev/null 2>&1 ; then
    :
  else
    echo \"#define __need___va_list\"
    echo \"#include \"
  fi

  # Use __gnuc_va_list in arg types in place of va_list.
  # On 386BSD use __gnuc_va_list instead of _VA_LIST_.  We're hoping the
  # trailing parentheses and semicolon save all other systems from this.
  # Define __va_list__ (something harmless and unused) instead of va_list.
  # Don't claim to have defined va_list.
  sed -e 's@ va_list @ __gnuc_va_list @' \\
      -e 's@ va_list)@ __gnuc_va_list)@' \\
      -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \\
      -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
      -e 's@ va_list@ __va_list__@' \\
      -e 's@\\*va_list@*__va_list__@' \\
      -e 's@ __va_list)@ __gnuc_va_list)@' \\
      -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
      -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
      -e 's@VA_LIST@DUMMY_VA_LIST@' \\
      -e 's@_Va_LIST@_VA_LIST@'";
};



/*
 *  Cancel out ansi_compat.h on Ultrix.  Replace it with empty file.
 */
inclhack = {
    hackname = Ultrix_ansi_compat;
    files    = ansi_compat.h;
    select   = ULTRIX;
    sed      = "1i\n/* This file intentionally left blank. */\n";
    sed      = "1,$d";
};



/*
 *  parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
 *  also get rid of bogus inline definitions in HP-UX 8.0
 */
inclhack = {
    hackname = Ultrix_atof_param;
    files    = math.h;

    sed = 's@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@';
    sed = 's@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@';
    sed = 's@inline double abs(double [a-z][a-z]*) {.*}@@';
    sed = 's@inline int sqr(int [a-z][a-z]*) {.*}@@';
    sed = 's@inline double sqr(double [a-z][a-z]*) {.*}@@';
};



/*
 *  fix bogus recursive stdlib.h in NEWS-OS 4.0C
 */
inclhack = {
    hackname = news_os_recursive_stdlib;
    files    = stdlib.h;
    select   = "#include ";
    sed      = "/^#include /i\\\n"
                    "#ifdef BOGUS_RECURSION\n";
    sed      = "/^#include /a\\\n"
                    "#endif\n";
};


/*
 *  Avoid nested comments on Ultrix 4.3.
 */
inclhack = {
    hackname = Ultrix_nested_comments;
    files    = rpc/svc.h;
    sed      = "s@^\\( \\*\tint protocol;  \\)/\\*@\\1*/ /*@";
};


/*
 *  nested comment
 */
inclhack = {
    hackname = nested_comment;
    files    = rpc/rpc.h;
    sed      = 's@^\\(/\\*.*rpc/auth_des.h>.*\\)/\\*@\\1*/ /*@';
};


/*
 *  In limits.h, put #ifndefs around things that are supposed to be defined
 *  in float.h to avoid redefinition errors if float.h is included first.
 *  On HP/UX this patch does not work, because on HP/UX limits.h uses
 *  multi line comments and the inserted #endif winds up inside the
 *  comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
 *  we find a #ifndef FLT_MIN we assume that all the required #ifndefs
 *  are there, and we do not add them ourselves.
 */
inclhack = {
    hackname = limits_ifndefs;
    files  = "limits.h";
    bypass = "ifndef[ \\t]+FLT_MIN";

    sed  = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
    sed  = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
    sed  = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
    sed  = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
    sed  = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
    sed  = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
    sed  = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
    sed  = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
    sed  = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
    sed  = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
    sed  = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
    sed  = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
};


/*
 * In math.h, put #ifndefs around things that might be defined
 * in a gcc specific math-*.h file.
 */
inclhack = {
    hackname = math_ifndefs_for_gcc;
    files    = math.h;
    shell    = " dbl_max_def="
        "\"`egrep 'define[ \t]+DBL_MAX[ \t]+.*' $1/float.h 2>/dev/null`\"\n\n"

        "\tif ( test -n \"${dbl_max_def}\" \\\n"
        "\t\t-a -n \"`egrep '#define[ \t]*HUGE_VAL[ \t]+DBL_MAX' $1/$3`\" \\\n"
        "\t\t-a -z \"`egrep '#define[ \t]+DBL_MAX[ \t]+' $1/$3`\"\n"
              "\t   ) > /dev/null 2>&1\n"

        "\tthen sed -e '/define[ \t]HUGE_VAL[ \t]/i\\\n"
            "#ifndef HUGE_VAL\n' \\\n"
        "\t-e '/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n'\\\n"
        "\t-e \"/define[ \t]HUGE_VAL[ \t]DBL_MAX/s/DBL_MAX/$dbl_max_def/\"\n"

        "\telse sed -e '/define[ \t]HUGE_VAL[ \t]/i\\\n"
            "#ifndef HUGE_VAL\n' \\\n"
        "\t-e '/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n'\n"
        "\tfi";
};


/*
 *  Remove erroneous parentheses in sym.h on Alpha OSF/1.
 */
inclhack = {
    hackname = Alpha_bad_parens;
    files    = sym.h;
    select   = "#ifndef\\(__mips64\\)";
    sed      = 's/#ifndef(__mips64)/#ifndef __mips64/';
};



/*
 *  Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
 *  in string.h on sysV68
 *  Correct the return type for strlen in string.h on Lynx.
 *  Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
 *  Add missing const for strdup on OSF/1 V3.0.
 */
inclhack = {
    hackname = sysV68_string_and_mem;
    files    = string.h;

    sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
    sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
    sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
    sed = "/^extern char$/N";
    sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
    sed = "/^\tstrncmp(),$/N";
    sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
          "extern unsigned int\\\n\\2/";
};



/*
 *  Correct the return type for strlen in strings.h in SunOS 4.
 */
inclhack = {
    hackname = SunOS_strlen_return;
    files    = strings.h;
    sed = 's/int[ \\t]*strlen();/__SIZE_TYPE__ strlen();/';
};



/*
 *  Delete the '#define void int' line from curses.h on Lynx
 */
inclhack = {
    hackname = Lynx_bad_void_int;
    files    = curses.h;
    select   = "#[ \t]*define[ \t]+void[ \t]+int";
    sed      = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
};


/*
 *  Fix `typedef struct term;' on hppa1.1-hp-hpux9.
 */
inclhack = {
    hackname = bad_struct_term;
    files  = curses.h;
    select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
    sed    = "s/^[ \t]*typedef[ \t][ \t]*"
             "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
};


/*
 *  For C++, avoid any typedef or macro definition of bool,
 *  and use the built in type instead.
 */
inclhack = {
    hackname = avoid_bool_type;
    files    = curses.h;

    sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
                "#ifndef __cplusplus\n";

    sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
                "#endif\n";

    sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
                "#ifndef __cplusplus\n";

    sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
                "#endif\n";
};


/*
 *  Fix incorrect S_IF* definitions on m88k-sysv3.
 */
inclhack = {
    hackname = m88k_bad_s_if;
    files    = sys/stat.h;
    select   = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";

    sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
            "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
            "\\1 (((m)\\&S_IFMT)==\\2)/";

    sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
            "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
            "\\1 (((m)\\&S_IFMT)==\\2)/";
};


/*
 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
 */
inclhack = {
    hackname = Alpha_getopt_decls;
    files  = "stdio.h";
    files  = "stdlib.h";
    select = "getopt(int, char \\*\\[";
    sed    = "s/getopt(int, char \\*\\[\\],[ ]*char \\*)/"
               "getopt(int, char *const[], const char *)/";
};


/* 
 * Determine if we're on Interactive Unix 2.2 or later, in which case we
 * need to fix some additional files.  This is the same test for ISC that
 * Autoconf uses.  On Interactive 2.2, certain traditional Unix
 * definitions (notably getc and putc in stdio.h) are omitted if __STDC__
 * is defined, not just if _POSIX_SOURCE is defined.  This makes it
 * impossible to compile any nontrivial program except with -posix.
 */
inclhack = {
    hackname = Interactive_add1;

    test   = "-d /etc/conf/kconfig.d";
    test   = '-n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';

    files  = "stdio.h";
    files  = "math.h";
    files  = "ctype.h";
    files  = "sys/limits.h";
    files  = "sys/fcntl.h";
    files  = "sys/dirent.h";

    sed    = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
               "!defined(_POSIX_SOURCE)/";
};

inclhack = {
    hackname = Interactive_add2;

    test   = "-d /etc/conf/kconfig.d";
    test   = '-n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';

    file   = math.h;
    sed    = 's/fmod(double)/fmod(double, double)/';
};

inclhack = {
    hackname = Interactive_add3;

    test   = "-d /etc/conf/kconfig.d";
    test   = '-n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';

    file   = sys/limits.h;

    sed    = "/CHILD_MAX/s,/\\* Max, Max,";
    sed    = "/OPEN_MAX/s,/\\* Max, Max,";
};
  
/*
 * Fixing ISC fmod declaration
 */
inclhack = {
    hackname = ISC_fmod;
    files    = math.h;
    select   = "fmod\\(double\\)";
    sed      = 's/fmod(double)/fmod(double, double)/';
};

  
/*
 * Fixing nested comments in ISC 
 */
inclhack = {
    hackname = ISC_sys_limits;
    files  = sys/limits.h;
    select = CHILD_MAX;
    sed    = '/CHILD_MAX/s,/\\* Max, Max,';
    sed    = '/OPEN_MAX/s,/\\* Max, Max,';
};


/*
 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
 * use / * * / to concatenate tokens.
 */
inclhack = {
    hackname = kandr_concatenation;
    files  = "sparc/asm_linkage.h";
    files  = "sun3/asm_linkage.h";
    files  = "sun3x/asm_linkage.h";
    files  = "sun4/asm_linkage.h";
    files  = "sun4c/asm_linkage.h";
    files  = "sun4m/asm_linkage.h";
    files  = "sun4c/debug/asm_linkage.h";
    files  = "sun4m/debug/asm_linkage.h";
    files  = "arm/as_support.h";
    files  = "arm/mc_type.h";
    files  = "arm/xcb.h";
    files  = "dev/chardefmac.h";
    files  = "dev/ps_irq.h";
    files  = "dev/screen.h";
    files  = "dev/scsi.h";
    files  = "sys/tty.h";
    files  = "Xm.acorn/XmP.h";
    files  = bsd43/bsd43_.h;
    select = '/\\*\\*/';
    sed    = 's|/\\*\\*/| ## |g';
};


/*
 *  math.h on SunOS 4 puts the declaration of matherr before the definition
 *  of struct exception, so the prototype (added by fixproto) causes havoc.
 */
inclhack = {
    hackname = SunOS_matherr_decl;
    files    = math.h;
    /*
     *  Find the first occurrance of 'struct exception'.
     *  If it is the definition, then the file is okay.
     *  If it is a usage, then the order is wrong and we
     *  must insert a forward reference.
     */
    test = "\"`fgrep 'struct exception' $1/$3 | line`\""
                  " != 'struct exception {'";

    sed = '/matherr/i\\\nstruct exception;\n';
};


/*
 *  assert.h on HP/UX is not C++ ready,
 *  even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
 */
inclhack = {
    hackname = hpux_assert_for_cxx;
    files    = assert.h;
    bypass = '"C"|__BEGIN_DECLS';

    sed = "1i\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n";
    sed = "$a\n#ifdef __cplusplus\n}\n#endif\n";
};



/*
 *  check for broken assert.h that needs stdio.h
 */
inclhack = {
    hackname = broken_assert_stdio;
    files    = assert.h;
    select   = 'stderr';
    bypass   = 'include.*stdio.h';
    sed      = "1i\n#ifdef __cplusplus\n#include \n#endif\n";
};

/*
 *  check for broken assert.h that needs stdlib.h
 */
inclhack = {
    hackname = broken_assert_stdlib;
    files    = assert.h;
    select   = "exit *\\(|abort *\\(";
    bypass   = 'include.*stdlib.h';
    sed      = "1i\n#ifdef __cplusplus\n#include \n#endif\n";
};


/*
 *  Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
 */
inclhack = {
    hackname = Alpha_sbrk;
    files    = unistd.h;
    select   = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
    sed  = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
};


/*
 *  This file on SunOS 4 has a very large macro.  When the sed loop
 *  tries pull it in, it overflows the pattern space size of the SunOS
 *  sed (GNU sed does not have this problem).  Since the file does not
 *  require fixing, we remove it from the fixed directory.
 */
inclhack = {
    hackname = SunOS_large_macro;
    files    = sundev/ipi_error.h;
    shell    =
        "echo \"Removing incorrect fix to SunOS \" >&2
         rm -f $2/${3} $2/${3}.";
};


/*
 * Put cpp wrappers around these include files to avoid redeclaration
 * errors during multiple inclusion on m88k-tektronix-sysv3.
 */
inclhack = {
    hackname = m88k_multi_include;
    files    = "time.h";
    bypass   = "#ifndef";
    shell    =
      "echo Fixing $3, to protect against multiple inclusion. >&2
      cpp_wrapper=`echo $3 | sed -e 's,\\.,_,g' -e 's,/,_,g'`
      sed -e \"1i\n"
        "#ifndef __GCC_GOT_${cpp_wrapper}_\n"
        "#define __GCC_GOT_${cpp_wrapper}_\n\" \\\n"
		"\t-e \"$a\n"
        "#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\n\"";
};


/*
 *  Fix fcntl prototype in fcntl.h on LynxOS.
 */
inclhack = {
    hackname = LynxOS_fcntl_proto;
    files    = fcntl.h;

  sed = 's/\\(fcntl.*(int, int, \\)int)/\\1...)/';
};


/*
 *  Fix definitions of macros used by va-i960.h in VxWorks header file.
 */
inclhack = {
    hackname = va_i960_macro_defs;
    files    = arch/i960/archI960.h;
    select   = "__(vsiz|vali|vpad|alignof__)";
    sed = 's/__vsiz/__vxvsiz/';
    sed = 's/__vali/__vxvali/';
    sed = 's/__vpad/__vxvpad/';
    sed = 's/__alignof__/__vxalignof__/';
};


/*
 *  Make VxWorks header which is almost gcc ready fully gcc ready.
 */
inclhack = {
    hackname = VxWorks_gcc_problem;
    files    = types/vxTypesBase.h;
    select   = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";

    sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
          "#if 1/";

    sed = "/[ \t]size_t/i\\\n"
        "#ifndef _GCC_SIZE_T\\\n"
        "#define _GCC_SIZE_T\n";

    sed = "/[ \t]size_t/a\\\n"
        "#endif\n";

    sed = "/[ \t]ptrdiff_t/i\\\n"
        "#ifndef _GCC_PTRDIFF_T\\\n"
        "#define _GCC_PTRDIFF_T\n";

    sed = "/[ \t]ptrdiff_t/a\\\n"
        "#endif\n";

    sed = "/[ \t]wchar_t/i\\\n"
        "#ifndef _GCC_WCHAR_T\\\n"
        "#define _GCC_WCHAR_T\n";

    sed = "/[ \t]wchar_t/a\\\n"
        "#endif\n";
};


/*
 *  Fix VxWorks  to not require including .
 */
inclhack = {
    hackname = VxWorks_needs_vxWorks;
    files    = sys/stat.h;
    test     = "-r types/vxTypesOld.h";
    test     = "-n \"`fgrep '#include' $1/$3`\"";
    test     = "-n \"`fgrep ULONG $1/$3`\"";
    test     = "-n \"`egrep '#define[ \t][ \t]*__INCstath' $1/$3`\"";

    sed = "/#define[ \t][ \t]*__INCstath/a\\\n"
          "#include \n";
};


/*
 *  Fix VxWorks  to not require including .
 */
inclhack = {
    hackname = VxWorks_time_needs_vxTypes;
    files    = time.h;
    select   = "uint_t[ \t][ \t]*_clocks_per_sec";
    sed      = 's/uint_t/unsigned int/';
};

--------------15CB44B55F50--

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: libg++?
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
                   ` (2 preceding siblings ...)
  1997-08-30 19:18 ` fixing the c++/f77 circular dependency Joel Sherrill
@ 1997-08-30 21:24 ` Jason Merrill
  1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
  4 siblings, 0 replies; 36+ messages in thread
From: Jason Merrill @ 1997-08-30 21:24 UTC (permalink / raw)
  To: egcs

>>>>> Chip Salzenberg  writes:

> Could someone please explain the relationships among libio, libstd++, and
> libg++?  And given all the activity in C++, could someone explain why
> libg++ hasn't been modified since 14 February 1997 (version 2.8.0b6)?

libio is Per's iostream code (and stdio, but most targets don't use that).
libstdc++ is the rest of the standard library.
libg++ is Doug Lea's old C++ class library.

The libg++ directory hasn't been modified because it doesn't relate to the
standard, and we're not interested in maintaining it anymore (I think;
right, Ulrich?).  Someone else is welcome to take it over.

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: Incorrect i960 linker config
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
                   ` (3 preceding siblings ...)
  1997-08-30 21:24 ` libg++? Jason Merrill
@ 1997-09-01 10:27 ` Jeffrey A Law
  4 siblings, 0 replies; 36+ messages in thread
From: Jeffrey A Law @ 1997-09-01 10:27 UTC (permalink / raw)
  To: Stephen Williams; +Cc: egcs

Thanks, I've installed your i960 LINK_SPEC patch.
jeff

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-30 12:00 Stephen Williams
  0 siblings, 0 replies; 36+ messages in thread
From: Stephen Williams @ 1997-08-30 12:00 UTC (permalink / raw)
  To: egcs

jason@cygnus.com said:
> That may be.  The code currently in libgcc is the freestanding 
> library, which includes some code called by various language 
> constructs, and therefore needs to be linked in automatically.  I 
> don't want people to have to pull in libstdc++ to get RTTI support.

My work largely involves freestanding C++. Please, libgcc needing things
from the C library (and posix) is bad enough. Start bringing in libraries
from all over the universe and ``main() { return 0; }'' will no longer
fit on certain boards!-)

Also, this again gets back to the build cycle problems Joel keeps griping
about (and I also experience) and extending it ot yet another library.

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 21:30 Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-25 21:30 UTC (permalink / raw)
  To: egcs

	So you do a 'make bootstrap'.  What's the problem?

See my initial message in this thread.  The problem incidentally has been
fixed.

	The Makefile has been fixed so LANGUAGES is passed to sub-makes, right?

Yes, but that is an unrelated problem.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-25 21:22 Jim Wilson
@ 1997-08-25 21:28 ` Robert Lipe
  0 siblings, 0 replies; 36+ messages in thread
From: Robert Lipe @ 1997-08-25 21:28 UTC (permalink / raw)
  To: egcs

> > There exist hosts where the native compiler will build a subtly 
> > disfunctional cc1plus that therefore won't reliably compile the
> 
> So you do a 'make bootstrap'.  What's the problem?

In current snapshots, nothing.   Sorry if I was unclear.   

> The Makefile has been fixed so LANGUAGES is passed to sub-makes, right?

Yes.   But this characteristic has come and gone in that "other" branch 
with depressing frequency.   This is to reiterate the point that Jim made
that it's rather non-obvious and ill-understood.

RJL

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 21:22 Jim Wilson
  1997-08-25 21:28 ` Robert Lipe
  0 siblings, 1 reply; 36+ messages in thread
From: Jim Wilson @ 1997-08-25 21:22 UTC (permalink / raw)
  To: egcs

Incidentally, this particular problem is not one that needs to be fixed before
the initial release.  There is no point in trying to change the libgcc.a
build rules before the initial release, because there is too much risk that
this will break something.  There are many more important things that
we should be spending our time on at this time.

The circular dependency that was preventing egcs from building was important,
but that was fixed last week.

This scheme does seem more elegant than what we have now, and just taking
a quick look, I don't see anything obviously wrong with it.

The subdir_libgcc rule needs to use LANGUAGES, so that we build a subdirectory
libgcc only if that language is being built.

In order to actually work, this probably needs to be a lot more complicated
than what you have so far, because you haven't considered multilib yet.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 21:16 Joe Buck
  0 siblings, 0 replies; 36+ messages in thread
From: Joe Buck @ 1997-08-25 21:16 UTC (permalink / raw)
  To: egcs

I wrote:

> | During the build process, don't build a library named libgcc.a.  Instead,
> | build libgcc-c.a, libgcc-c++.a, libgcc-f.a (Fortran), etc.  At
> | installation time or just before, combine all of these libraries into one,
> | named libgcc.a.  The LANGUAGES variable determines which language-specific
> | libraries are combined to make libgcc.a.  Normally, gcc passes -lgcc to
> | the linker, but a flag can disable this, so that the compiler can be
> | bootstrapped with -lgcc-c instead.  We do want to wind up with a combined
> | libgcc.a so that multi-language programs work.

meissner@cygnus.com writes:

> No, installation time is too late.  I routinely test compilers in place
> without installing them (using ./xgcc -B./).

OK, it doesn't have to be installation time; each build can use LANGUAGES
to make libgcc.a, but the bootstrap process would not use this libgcc.a
to build the compiler with itself, it would only use libgcc-c.a.

I don't know enough about MULTILIB issues to comment there.  Maybe all
that is really needed is a temporary C-only library that is used in the
bootstrapping process and my solution is overkill.  But recent 2.8.0
snapshots have resulted in bogus libgcc.a files (that mysteriously fix
themselves if libgcc.a and constituent .o files are zapped and rebuilt)
so we need something simple and reliable.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-25 20:41 David Edelsohn
  1997-08-25 20:47 ` Robert Lipe
@ 1997-08-25 20:59 ` Jason Merrill
  1 sibling, 0 replies; 36+ messages in thread
From: Jason Merrill @ 1997-08-25 20:59 UTC (permalink / raw)
  To: egcs

>>>>> Robert Lipe <robertl@dgii.com> writes:

> There exist hosts where the native compiler will build a subtly 
> disfunctional cc1plus that therefore won't reliably compile the
> C++ code to go into libgcc.a.

So you do a 'make bootstrap'.  What's the problem?

The Makefile has been fixed so LANGUAGES is passed to sub-makes, right?

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 20:59 meissner
  0 siblings, 0 replies; 36+ messages in thread
From: meissner @ 1997-08-25 20:59 UTC (permalink / raw)
  To: egcs

| The following notion just occurred to me.  I'm not sure it's the cleanest
| thing in the world, but it does break the circle. The basic idea:
| 
| During the build process, don't build a library named libgcc.a.  Instead,
| build libgcc-c.a, libgcc-c++.a, libgcc-f.a (Fortran), etc.  At
| installation time or just before, combine all of these libraries into one,
| named libgcc.a.  The LANGUAGES variable determines which language-specific
| libraries are combined to make libgcc.a.  Normally, gcc passes -lgcc to
| the linker, but a flag can disable this, so that the compiler can be
| bootstrapped with -lgcc-c instead.  We do want to wind up with a combined
| libgcc.a so that multi-language programs work.

No, installation time is too late.  I routinely test compilers in place without
installing them (using ./xgcc -B./).

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-25 20:41 David Edelsohn
@ 1997-08-25 20:47 ` Robert Lipe
  1997-08-25 20:59 ` Jason Merrill
  1 sibling, 0 replies; 36+ messages in thread
From: Robert Lipe @ 1997-08-25 20:47 UTC (permalink / raw)
  To: egcs

Jim Wilson wrote:

> There is a serious dependency problem which has already been mentioned a few
> times.  If libgcc.a contains C++ code, then libgcc.a depends on cc1plus,
> which means we always build cc1plus even if it is not in languages.  Simply

Though I think this is well understood by the few people really in the
know, it's worth reiterating Jim's point for the rest.

There exist hosts where the native compiler will build a subtly 
disfunctional cc1plus that therefore won't reliably compile the
C++ code to go into libgcc.a.     Quoting INSTALL:

     C is the only language that is sure to work when you build with
     other non-GNU C compilers.  In addition, building anything but C
     at this stage is a waste of time.

So if you have libgcc that depends on cc1plus and you're compiling
with a "non-GNU C compiler" you're in a catch-22.

Yes, I realize one Right Thing To Do is to track down the problem 
in using the native compiler to build cc1plus.

> The existing rule for the C++ libgcc.a stuff uses contortions to try to
> avoid an explicit cc1plus dependency, but it is ugly, does not work reliably,
> and has been causing problems.

I feel that pain.  I'll confess that "internal compiler error" when
building tinfo.cc did not exactly lead me to the Makefile as a 
prime suspect.

RJL

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 20:41 David Edelsohn
  1997-08-25 20:47 ` Robert Lipe
  1997-08-25 20:59 ` Jason Merrill
  0 siblings, 2 replies; 36+ messages in thread
From: David Edelsohn @ 1997-08-25 20:41 UTC (permalink / raw)
  To: egcs

>>>>> Joe Buck writes:

Joe> During the build process, don't build a library named libgcc.a.  Instead,
Joe> build libgcc-c.a, libgcc-c++.a, libgcc-f.a (Fortran), etc.  At
Joe> installation time or just before, combine all of these libraries into one,
Joe> named libgcc.a.  The LANGUAGES variable determines which language-specific
Joe> libraries are combined to make libgcc.a.  Normally, gcc passes -lgcc to
Joe> the linker, but a flag can disable this, so that the compiler can be
Joe> bootstrapped with -lgcc-c instead.  We do want to wind up with a combined
Joe> libgcc.a so that multi-language programs work.

	Don't forget all of the MULTILIB variants.  This could get quite
involved and complicated to build libgcc-c, libgcc-c++, and libgcc-f for
various command-line flag cominations and then demux them during the
install.

David

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 20:25 H.J. Lu
  0 siblings, 0 replies; 36+ messages in thread
From: H.J. Lu @ 1997-08-25 20:25 UTC (permalink / raw)
  To: egcs

> 
> 	Could someone please tell me why we cannot put a target libgcc.a in
> 	cp/Makefile.in? It will resolve that problem. I am willing to
> 	write a patch if people think it is a good idea.
> 
> There is a serious dependency problem which has already been mentioned a few
> times.  If libgcc.a contains C++ code, then libgcc.a depends on cc1plus,
> which means we always build cc1plus even if it is not in languages.  Simply
> moving the rule to cp/Makefile.in does not solve this problem, because
> we still have libgcc.a dependencing on cc1plus.
> 

What I have in mind is

1. In top level Makefile:

libgcc.a: .... cc1 subdir_libgcc
	autolock.sh libgcc.a.lck $(AR) ..

subdir_libgcc: cc1
	for d in  ...
	do
		$(MAKE) libgcc.a
	done

2. In cp/Makefile, we have

libgcc.a: ../cc1 ../cc1plus
	.....
	autolock.sh ../libgcc.a.lck $(AR) ..


H.J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 20:25 Joe Buck
  0 siblings, 0 replies; 36+ messages in thread
From: Joe Buck @ 1997-08-25 20:25 UTC (permalink / raw)
  To: egcs

> There is a serious dependency problem which has already been mentioned a few
> times.  If libgcc.a contains C++ code, then libgcc.a depends on cc1plus,
> which means we always build cc1plus even if it is not in languages.

The following notion just occurred to me.  I'm not sure it's the cleanest
thing in the world, but it does break the circle. The basic idea:

During the build process, don't build a library named libgcc.a.  Instead,
build libgcc-c.a, libgcc-c++.a, libgcc-f.a (Fortran), etc.  At
installation time or just before, combine all of these libraries into one,
named libgcc.a.  The LANGUAGES variable determines which language-specific
libraries are combined to make libgcc.a.  Normally, gcc passes -lgcc to
the linker, but a flag can disable this, so that the compiler can be
bootstrapped with -lgcc-c instead.  We do want to wind up with a combined
libgcc.a so that multi-language programs work.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 20:08 Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-25 20:08 UTC (permalink / raw)
  To: egcs

	Could someone please tell me why we cannot put a target libgcc.a in
	cp/Makefile.in? It will resolve that problem. I am willing to
	write a patch if people think it is a good idea.

There is a serious dependency problem which has already been mentioned a few
times.  If libgcc.a contains C++ code, then libgcc.a depends on cc1plus,
which means we always build cc1plus even if it is not in languages.  Simply
moving the rule to cp/Makefile.in does not solve this problem, because
we still have libgcc.a dependencing on cc1plus.

The existing rule for the C++ libgcc.a stuff uses contortions to try to
avoid an explicit cc1plus dependency, but it is ugly, does not work reliably,
and has been causing problems.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-25 18:48 H.J. Lu
@ 1997-08-25 19:30 ` Olivier Galibert
  0 siblings, 0 replies; 36+ messages in thread
From: Olivier Galibert @ 1997-08-25 19:30 UTC (permalink / raw)
  To: egcs

On Mon, Aug 25, 1997 at 11:32:36AM -0700, Jason Merrill wrote:
> The only other option would seem to be a third library, linked in along
> with libgcc.  Then the trick is insinuating it into the specs file.

This would be quite a pain if you want to link together C++ and fortran
object files...

  OG.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-25 18:48 H.J. Lu
  1997-08-25 19:30 ` Olivier Galibert
  0 siblings, 1 reply; 36+ messages in thread
From: H.J. Lu @ 1997-08-25 18:48 UTC (permalink / raw)
  To: egcs

> 
> >>>>> Jim Wilson <wilson@cygnus.com> writes:
> 
> > 	I'd like to see them in libgcc.a. It should not be hard to put
> > 	something in libgcc.a from cp/Makefile.
> 
> > I am not opposed to having C++ code in libgcc.a if it can be made to
> > work.  However, having already dealt with a number of problems resulting
> > from this, I am skeptical that it can be made to work cleanly.
> 
> That may be.  The code currently in libgcc is the freestanding library,
> which includes some code called by various language constructs, and
> therefore needs to be linked in automatically.  I don't want people to have
> to pull in libstdc++ to get RTTI support.
> 
> The only other option would seem to be a third library, linked in along
> with libgcc.  Then the trick is insinuating it into the specs file.
> 

Could someone please tell me why we cannot put a target libgcc.a in
cp/Makefile.in? It will resolve that problem. I am willing to
write a patch if people think it is a good idea.


-- 
H.J. Lu (hjl@gnu.ai.mit.edu)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-25 18:29 egcs release H.J. Lu
@ 1997-08-25 18:32 ` Jason Merrill
  0 siblings, 0 replies; 36+ messages in thread
From: Jason Merrill @ 1997-08-25 18:32 UTC (permalink / raw)
  To: egcs

>>>>> Jim Wilson <wilson@cygnus.com> writes:

> 	I'd like to see them in libgcc.a. It should not be hard to put
> 	something in libgcc.a from cp/Makefile.

> I am not opposed to having C++ code in libgcc.a if it can be made to
> work.  However, having already dealt with a number of problems resulting
> from this, I am skeptical that it can be made to work cleanly.

That may be.  The code currently in libgcc is the freestanding library,
which includes some code called by various language constructs, and
therefore needs to be linked in automatically.  I don't want people to have
to pull in libstdc++ to get RTTI support.

The only other option would seem to be a third library, linked in along
with libgcc.  Then the trick is insinuating it into the specs file.

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-24  3:43 Building of generated parser files Jim Meyering
@ 1997-08-24  3:43 ` Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

	I'd like to see them in libgcc.a. It should not be hard to put
	something in libgcc.a from cp/Makefile.

I am not opposed to having C++ code in libgcc.a if it can be made to
work.  However, having already dealt with a number of problems resulting
from this, I am skeptical that it can be made to work cleanly.

Simply moving the rules into cp/Makefile does not itself fix the problem.
If we have a rule in Makefile that adds the C++ library created by cp/Makefile
to libgcc.a, then we still have the problem that libgcc.a depends on LANGUAGES
and/or cc1plus.  If we have a rule in cp/Makefile that adds stuff to libgcc.a,
then we have two different rules in two different Makefile writing to the
same file, which seems even worse.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-22 19:47 H.J. Lu
  0 siblings, 0 replies; 36+ messages in thread
From: H.J. Lu @ 1997-08-22 19:47 UTC (permalink / raw)
  To: egcs

> 
> 	Why not fix it by moving the c++ part of libgcc.a into cp/Makefile?
> 
> That is one of the options I mentioned at the beginning of this discussion,
> and is still an open issue.
> 
> However, this does not fix the problem unless we move the c++ stuff out of
> libgcc.a and into a new library.  This means changing the c++ compiler to
> link in yet another library, and this isn't very desirable.  But now that
> we have added libstdc++ to the egcs distribution, this stuff could perhaps
> be moved into libstdc++.
> 

I'd like to see them in libgcc.a. It should not be hard to put
something in libgcc.a from cp/Makefile.

-- 
H.J. Lu (hjl@gnu.ai.mit.edu)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-22 19:23 Mike Stump
  0 siblings, 0 replies; 36+ messages in thread
From: Mike Stump @ 1997-08-22 19:23 UTC (permalink / raw)
  To: egcs

> Date: Fri, 22 Aug 1997 11:32:18 -0700
> From: Jim Wilson <wilson@cygnus.com>

> But now that we have added libstdc++ to the egcs distribution, this
> stuff could perhaps be moved into libstdc++.

That's where it started!  :-)

(One should not infer that I am against moving it from this message.)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-22 19:23 Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-22 19:23 UTC (permalink / raw)
  To: egcs

	Why not fix it by moving the c++ part of libgcc.a into cp/Makefile?

That is one of the options I mentioned at the beginning of this discussion,
and is still an open issue.

However, this does not fix the problem unless we move the c++ stuff out of
libgcc.a and into a new library.  This means changing the c++ compiler to
link in yet another library, and this isn't very desirable.  But now that
we have added libstdc++ to the egcs distribution, this stuff could perhaps
be moved into libstdc++.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-22 19:23 egcs-ss-970814 on m68k-next-nextstep3 Jeffrey A Law
@ 1997-08-22 19:23 ` Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-22 19:23 UTC (permalink / raw)
  To: egcs

	But LANGUAGES is still desirable for bootstrapping, because if you compile
	with an inferior system compiler you only want to build the C compiler
	with it, and them build the rest with the just built gcc.

We do need a way to build only the C compiler in the first stage of a
bootstrap.  However, we do not have any particular need for LANGUAGES itself.
If we can find some other way to build only the C compiler, then we can get
rid of LANGUAGES.  For instance, it might be possible to have a `make all'
target that builds all languages, and a `make only_c' target that builds
only the C language stuff.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-22 17:41 H.J. Lu
  0 siblings, 0 replies; 36+ messages in thread
From: H.J. Lu @ 1997-08-22 17:41 UTC (permalink / raw)
  To: egcs

> 
> Dave Love <d.love@dl.ac.uk> writes:
> 
> |>>>>>> "Doug" == Doug Evans <dje@cygnus.com> writes:
> |>  Doug> You could add a --enable-lang=foo [or some such] option,
> |>  Doug> so while LANGUAGES=x is gone, the ability to only build a few
> |>  Doug> is not.
> 
> |> I'd vote for that sort of thing.
> 
> But LANGUAGES is still desirable for bootstrapping, because if you compile
> with an inferior system compiler you only want to build the C compiler
> with it, and them build the rest with the just built gcc.
> 

Why not fix it by moving the c++ part of libgcc.a into cp/Makefile?

-- 
H.J. Lu (hjl@gnu.ai.mit.edu)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-22  8:36 Andreas Schwab
  0 siblings, 0 replies; 36+ messages in thread
From: Andreas Schwab @ 1997-08-22  8:36 UTC (permalink / raw)
  To: egcs

Dave Love <d.love@dl.ac.uk> writes:

|>>>>>> "Doug" == Doug Evans <dje@cygnus.com> writes:
|>  Doug> You could add a --enable-lang=foo [or some such] option,
|>  Doug> so while LANGUAGES=x is gone, the ability to only build a few
|>  Doug> is not.

|> I'd vote for that sort of thing.

But LANGUAGES is still desirable for bootstrapping, because if you compile
with an inferior system compiler you only want to build the C compiler
with it, and them build the rest with the just built gcc.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-21 18:45 Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-21 18:45 UTC (permalink / raw)
  To: egcs

	 Jim> The fourth option is easy to implement.  The only downside I can see is
	 Jim> that the f77-runtime is now configured always, 

	It shoudn't be, and I didn't think it was in the vanilla version.
	Will try to look at it before absconding for the holiday weekend.

You are confusing the issues here a little.  The f77-runtime is being
configured all of the time because I changed the Makefile rule.  This was an
intentional change necessary to break the circular dependency.  It is not
a problem that you need to look at.

Jim

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-21 16:51 Problems on PowerPC David Edelsohn
  1997-08-21 17:43 ` fixing the c++/f77 circular dependency Dave Love
@ 1997-08-21 17:47 ` Dave Love
  1 sibling, 0 replies; 36+ messages in thread
From: Dave Love @ 1997-08-21 17:47 UTC (permalink / raw)
  To: egcs

>>>>> "Doug" == Doug Evans <dje@cygnus.com> writes:

 Doug> You could add a --enable-lang=foo [or some such] option,
 Doug> so while LANGUAGES=x is gone, the ability to only build a few
 Doug> is not.

I'd vote for that sort of thing.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-21 16:51 Problems on PowerPC David Edelsohn
@ 1997-08-21 17:43 ` Dave Love
  1997-08-21 17:47 ` Dave Love
  1 sibling, 0 replies; 36+ messages in thread
From: Dave Love @ 1997-08-21 17:43 UTC (permalink / raw)
  To: egcs

>>>>> "Jim" == Jim Wilson <wilson@cygnus.com> writes:

 Jim> The fourth option is easy to implement.  The only downside I can see is
 Jim> that the f77-runtime is now configured always, 

It shoudn't be, and I didn't think it was in the vanilla version.
Will try to look at it before absconding for the holiday weekend.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-21  9:21 Problems on PowerPC David McWherter
@ 1997-08-21  9:21 ` Andreas Schwab
  0 siblings, 0 replies; 36+ messages in thread
From: Andreas Schwab @ 1997-08-21  9:21 UTC (permalink / raw)
  To: egcs

Doug Evans <dje@cygnus.com> writes:

|>    From: Alexandre Oliva <oliva@dcc.unicamp.br>
|>    Date: 21 Aug 1997 01:27:55 -0300

|>    > You could add a --enable-lang=foo [or some such] option,
|>    > so while LANGUAGES=x is gone, the ability to only build a few
|>    > is not.

|>    I'd rather have all languages enabled by default (as it is now), and
|>    configuring --without-g77, --without-g++ (is this a valid identifier,
|>    by the way?), etc would selectively disable them.  I could provide a
|>    patch for that, if you agree with it.

|> When I proposed and wrote a patch for --{with,without}-lang [over two
|> years ago] it was suggested that --{enable,disable} was more appropriate.

According to the autoconf manual --with[out]-PACKAGE should be used for
something optional that is external to the source package (eg,
--with-gnu-ld, --with-debugging-malloc).  --{enable,disable}-FEATURE is
for controling the inclusion of something which is part of the source
package, but optional (eg, --enable-haifa, --enable-maintainer-mode).

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
@ 1997-08-21  4:52 Doug Evans
  0 siblings, 0 replies; 36+ messages in thread
From: Doug Evans @ 1997-08-21  4:52 UTC (permalink / raw)
  To: egcs

   From: Alexandre Oliva <oliva@dcc.unicamp.br>
   Date: 21 Aug 1997 01:27:55 -0300

   > You could add a --enable-lang=foo [or some such] option,
   > so while LANGUAGES=x is gone, the ability to only build a few
   > is not.

   I'd rather have all languages enabled by default (as it is now), and
   configuring --without-g77, --without-g++ (is this a valid identifier,
   by the way?), etc would selectively disable them.  I could provide a
   patch for that, if you agree with it.

When I proposed and wrote a patch for --{with,without}-lang [over two
years ago] it was suggested that --{enable,disable} was more appropriate.

As for the behaviour, what's the default, etc. etc.
I don't have a strong opinion.  I realize it's reasonable
to want the default to be to install all languages.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-21  3:05 Ultrasparc addition for sparc.md (fwd) Oleg Krivosheev
@ 1997-08-21  4:27 ` Alexandre Oliva
  0 siblings, 0 replies; 36+ messages in thread
From: Alexandre Oliva @ 1997-08-21  4:27 UTC (permalink / raw)
  To: egcs

Doug Evans writes:

> You could add a --enable-lang=foo [or some such] option,
> so while LANGUAGES=x is gone, the ability to only build a few
> is not.

I'd rather have all languages enabled by default (as it is now), and
configuring --without-g77, --without-g++ (is this a valid identifier,
by the way?), etc would selectively disable them.  I could provide a
patch for that, if you agree with it.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
Universidade Estadual de Campinas, SP, Brasil

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: fixing the c++/f77 circular dependency
  1997-08-20 23:19 [REQ] If the x86 people could do something about this John Beppu
@ 1997-08-20 23:19 ` Doug Evans
  0 siblings, 0 replies; 36+ messages in thread
From: Doug Evans @ 1997-08-20 23:19 UTC (permalink / raw)
  To: egcs

   Date: Wed, 20 Aug 1997 15:18:31 -0700
   From: Jim Wilson <wilson@cygnus.com>

   I have thought of four possible solutions so far.
   1) Make all languages mandatory (eliminate LANGUAGES=X option).
   2) Move the C++ code out of libgcc.a.
   3) Move the f77-runtime out of the gcc directory.
   4) Put the f77-runtime in rest.encap instead of f77 LANGUAGES rule.

   The first option is probably too unpopular to consider further, though
   it would certainly simplify the Makefile.

You could add a --enable-lang=foo [or some such] option,
so while LANGUAGES=x is gone, the ability to only build a few
is not.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* fixing the c++/f77 circular dependency
@ 1997-08-20 22:18 Jim Wilson
  0 siblings, 0 replies; 36+ messages in thread
From: Jim Wilson @ 1997-08-20 22:18 UTC (permalink / raw)
  To: egcs

I have thought of four possible solutions so far.
1) Make all languages mandatory (eliminate LANGUAGES=X option).
2) Move the C++ code out of libgcc.a.
3) Move the f77-runtime out of the gcc directory.
4) Put the f77-runtime in rest.encap instead of f77 LANGUAGES rule.

The first option is probably too unpopular to consider further, though
it would certainly simplify the Makefile.

The second and third options are non-trivial to implement, though we may
have to move in this direction in the long term.

The fourth option is easy to implement.  The only downside I can see is
that the f77-runtime is now configured always, though it is only built
if f77 is in LANGUAGES (the f77-runtime rule already checks for this).
This seems to be the best solution for the short term.

Anyone see any serious problem with this, or want to suggest alternative
solutions?

Without some kind of patch for this, I can't build egcs on the system on
my desk, so this is a rather important problem to me. :-)

I have a tentative patch, though it needs to be cleaned up a bit.

Index: Makefile.in
===================================================================
RCS file: /cvs/cvsfiles/egcs/Makefile.in,v
retrieving revision 1.7
diff -p -r1.7 Makefile.in
*** Makefile.in	1997/08/19 15:36:20	1.7
--- Makefile.in	1997/08/20 21:56:56
*************** LANG_MAKEFILES = @all_lang_makefiles@
*** 510,515 ****
--- 510,516 ----
  LANG_STAGESTUFF = @all_stagestuff@
  LANG_DIFF_EXCLUDES = @all_diff_excludes@
  LANG_LIB2FUNCS = @all_lib2funcs@
+ LANG_REST_ENCAP = @all_rest_encap@
  LANG_EXTRA_HEADERS = @all_headers@
  
  # Flags to pass to recursive makes.
*************** all.build: native xgcc $(EXTRA_PARTS) la
*** 718,724 ****
  # This is what must be made before installing GCC and converting libraries.
  start.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
  # These can't be made until after GCC can run.
! rest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) lang.rest.encap
  # This is what is made with the host's compiler
  # whether making a cross compiler or not.
  native: config.status config.h cpp $(LANGUAGES) \
--- 719,725 ----
  # This is what must be made before installing GCC and converting libraries.
  start.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
  # These can't be made until after GCC can run.
! rest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) $(LANG_REST_ENCAP)
  # This is what is made with the host's compiler
  # whether making a cross compiler or not.
  native: config.status config.h cpp $(LANGUAGES) \
Index: configure.in
===================================================================
RCS file: /cvs/cvsfiles/egcs/configure.in,v
retrieving revision 1.7
diff -p -r1.7 configure.in
*** configure.in	1997/08/19 21:09:17	1.7
--- configure.in	1997/08/20 21:17:53
*************** all_outputs=Makefile
*** 2924,2929 ****
--- 2925,2931 ----
  all_lang_makefiles=
  all_headers=
  all_lib2funcs=
+ all_rest_encap=
  
  # Add the language fragments.
  # Languages are added via two mechanisms.  Some information must be
*************** do
*** 2970,2975 ****
--- 2972,2978 ----
  			oldstyle_subdirs="$oldstyle_subdirs $s"
  		fi
  		all_lib2funcs="$all_lib2funcs $lib2funcs"
+ 		all_rest_encap="$all_rest_encap $rest_encap"
  	fi
  done
  
*************** AC_SUBST(all_lang_makefiles)
*** 3046,3051 ****
--- 3049,3055 ----
  AC_SUBST(all_stagestuff)
  AC_SUBST(all_diff_excludes)
  AC_SUBST(all_lib2funcs)
+ AC_SUBST(all_rest_encap)
  AC_SUBST(all_headers)
  AC_SUBST(extra_passes)
  AC_SUBST(extra_programs)
Index: f/Make-lang.in
===================================================================
RCS file: /cvs/cvsfiles/egcs/f/Make-lang.in,v
retrieving revision 1.4
diff -p -r1.4 Make-lang.in
*** Make-lang.in	1997/08/18 15:01:55	1.4
--- Make-lang.in	1997/08/20 21:18:15
*************** G77_CROSS_NAME = `t='$(program_transform
*** 96,102 ****
  # Note that it would be nice to move the dependency on g77
  # into the F77 rule, but that needs a little bit of work
  # to do the right thing within all.cross.
! F77 f77: f771 f77-runtime
  
  # Tell GNU make to ignore these if they exist.
  .PHONY: F77 f77 f77-runtime f77-runtime-unsafe f77.all.build f77.all.cross \
--- 96,102 ----
  # Note that it would be nice to move the dependency on g77
  # into the F77 rule, but that needs a little bit of work
  # to do the right thing within all.cross.
! F77 f77: f771
  
  # Tell GNU make to ignore these if they exist.
  .PHONY: F77 f77 f77-runtime f77-runtime-unsafe f77.all.build f77.all.cross \
Index: f/config-lang.in
===================================================================
RCS file: /cvs/cvsfiles/egcs/f/config-lang.in,v
retrieving revision 1.2
diff -p -r1.2 config-lang.in
*** config-lang.in	1997/08/12 17:12:05	1.2
--- config-lang.in	1997/08/20 21:18:15
***************
*** 25,30 ****
--- 25,31 ----
  # compilers	- value to add to $(COMPILERS)
  # stagestuff	- files to add to $(STAGESTUFF)
  # diff_excludes	- files to ignore when building diffs between two versions.
+ # rest_encap	- files to build after gcc can be used to link
  
  #if grep DECL_STATIC_CONSTRUCTOR $srcdir/tree.h >/dev/null; then
  #   if grep flag_move_all_movables $srcdir/toplev.c >/dev/null; then true
*************** case "$arguments" in
*** 58,63 ****
--- 59,66 ----
  esac
  
  diff_excludes="-x \"f/g77.info*\""
+ 
+ rest_encap="f77-runtime"
  
  # Create the runtime library directory tree if necessary.
  test -d f || mkdir f

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~1997-09-01 10:27 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
1997-08-30 19:18 ` include hackery Bruce Korb
1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
1997-08-30 19:18 ` fixing the c++/f77 circular dependency Joel Sherrill
1997-08-30 21:24 ` libg++? Jason Merrill
1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
  -- strict thread matches above, loose matches on Subject: below --
1997-08-30 12:00 fixing the c++/f77 circular dependency Stephen Williams
1997-08-25 21:30 Jim Wilson
1997-08-25 21:22 Jim Wilson
1997-08-25 21:28 ` Robert Lipe
1997-08-25 21:16 Joe Buck
1997-08-25 20:59 meissner
1997-08-25 20:41 David Edelsohn
1997-08-25 20:47 ` Robert Lipe
1997-08-25 20:59 ` Jason Merrill
1997-08-25 20:25 Joe Buck
1997-08-25 20:25 H.J. Lu
1997-08-25 20:08 Jim Wilson
1997-08-25 18:48 H.J. Lu
1997-08-25 19:30 ` Olivier Galibert
1997-08-25 18:29 egcs release H.J. Lu
1997-08-25 18:32 ` fixing the c++/f77 circular dependency Jason Merrill
1997-08-24  3:43 Building of generated parser files Jim Meyering
1997-08-24  3:43 ` fixing the c++/f77 circular dependency Jim Wilson
1997-08-22 19:47 H.J. Lu
1997-08-22 19:23 Mike Stump
1997-08-22 19:23 Jim Wilson
1997-08-22 19:23 egcs-ss-970814 on m68k-next-nextstep3 Jeffrey A Law
1997-08-22 19:23 ` fixing the c++/f77 circular dependency Jim Wilson
1997-08-22 17:41 H.J. Lu
1997-08-22  8:36 Andreas Schwab
1997-08-21 18:45 Jim Wilson
1997-08-21 16:51 Problems on PowerPC David Edelsohn
1997-08-21 17:43 ` fixing the c++/f77 circular dependency Dave Love
1997-08-21 17:47 ` Dave Love
1997-08-21  9:21 Problems on PowerPC David McWherter
1997-08-21  9:21 ` fixing the c++/f77 circular dependency Andreas Schwab
1997-08-21  4:52 Doug Evans
1997-08-21  3:05 Ultrasparc addition for sparc.md (fwd) Oleg Krivosheev
1997-08-21  4:27 ` fixing the c++/f77 circular dependency Alexandre Oliva
1997-08-20 23:19 [REQ] If the x86 people could do something about this John Beppu
1997-08-20 23:19 ` fixing the c++/f77 circular dependency Doug Evans
1997-08-20 22:18 Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).