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 ` fixing the c++/f77 circular dependency Joel Sherrill
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ 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] 18+ 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 ` Joel Sherrill
  1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ 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] 18+ messages in thread

* Re: Incorrect i960 linker config
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
  1997-08-30 19:18 ` fixing the c++/f77 circular dependency Joel Sherrill
@ 1997-08-30 19:18 ` Joel Sherrill
  1997-08-30 19:18 ` include hackery Bruce Korb
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ 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] 18+ messages in thread

* include hackery
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
  1997-08-30 19:18 ` fixing the c++/f77 circular dependency Joel Sherrill
  1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
@ 1997-08-30 19:18 ` Bruce Korb
  1997-08-30 21:24 ` libg++? Jason Merrill
  1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
  4 siblings, 0 replies; 18+ 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] 18+ messages in thread

* Re: libg++?
  1997-08-30 12:00 Incorrect i960 linker config Stephen Williams
                   ` (2 preceding siblings ...)
  1997-08-30 19:18 ` include hackery Bruce Korb
@ 1997-08-30 21:24 ` Jason Merrill
  1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
  4 siblings, 0 replies; 18+ 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] 18+ 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; 18+ 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] 18+ messages in thread

* Re: libg++
  1998-06-30 19:49 ` libg++ Nathan Myers
@ 1998-07-01  7:26   ` H.J. Lu
  0 siblings, 0 replies; 18+ messages in thread
From: H.J. Lu @ 1998-07-01  7:26 UTC (permalink / raw)
  To: Nathan Myers; +Cc: egcs

> 
> Daniel Bernstein wrote:
> > 
> > If I want to install libg++ with egcs, do I have to put it in before
> > compiling egcs, or can it be added afterward?
> 
> In case you didn't know... libg++ is considered obsolete
> (well, *I* consider it obsolete).  Anyway, it's not being
> maintained.
> 

But it is a very good test bed for egcs. IMHO, anyone who works
on egcs should get the libg++ addon, just for sanity check.

-- 
H.J. Lu (hjl@gnu.org)

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

* Re: libg++
       [not found] <Pine.SUN.3.95-heb-2.07.980629191358.564A-100000.cygnus.egcs@beitza.jct.ac.il>
@ 1998-06-30 19:49 ` Nathan Myers
  1998-07-01  7:26   ` libg++ H.J. Lu
  0 siblings, 1 reply; 18+ messages in thread
From: Nathan Myers @ 1998-06-30 19:49 UTC (permalink / raw)
  To: egcs

Daniel Bernstein wrote:
> 
> If I want to install libg++ with egcs, do I have to put it in before
> compiling egcs, or can it be added afterward?

In case you didn't know... libg++ is considered obsolete
(well, *I* consider it obsolete).  Anyway, it's not being
maintained.

Nathan Myers
ncm@cantrip.org

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

* Re: libg++
  1998-06-29 23:55 libg++ Daniel Bernstein
  1998-06-30 11:53 ` libg++ H.J. Lu
@ 1998-06-30 14:08 ` Manfred Hollstein
  1 sibling, 0 replies; 18+ messages in thread
From: Manfred Hollstein @ 1998-06-30 14:08 UTC (permalink / raw)
  To: bernste; +Cc: egcs

On Tue, 30 June 1998, 09:54:36, bernste@avoda.jct.ac.il wrote:

 > If I want to install libg++ with egcs, do I have to put it in before
 > compiling egcs, or can it be added afterward?
 > 
 > Thanks..
 > 
 > 

If you are talking about the official libg++-2.8.1.1a, it doesn't
matter when you put the stuff into your source tree. Simply rerun
"make all" will correctly configure the new subdirectory and the build 
it.

I guess the same is true with H.J.'s libg++ addons.

manfred

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

* Re: libg++
  1998-06-29 23:55 libg++ Daniel Bernstein
@ 1998-06-30 11:53 ` H.J. Lu
  1998-06-30 14:08 ` libg++ Manfred Hollstein
  1 sibling, 0 replies; 18+ messages in thread
From: H.J. Lu @ 1998-06-30 11:53 UTC (permalink / raw)
  To: bernste; +Cc: egcs

> 
> If I want to install libg++ with egcs, do I have to put it in before
> compiling egcs, or can it be added afterward?
> 

You drop librx and libg++ directories in the tope level egcs source
directory along with gcc. Then you build egcs as usual.

-- 
H.J. Lu (hjl@gnu.org)

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

* libg++
@ 1998-06-29 23:55 Daniel Bernstein
  1998-06-30 11:53 ` libg++ H.J. Lu
  1998-06-30 14:08 ` libg++ Manfred Hollstein
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel Bernstein @ 1998-06-29 23:55 UTC (permalink / raw)
  To: egcs

If I want to install libg++ with egcs, do I have to put it in before
compiling egcs, or can it be added afterward?

Thanks..



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

* Re: libg++
  1998-01-20 14:54 libg++ Oleg Krivosheev
@ 1998-01-23 11:15 ` H.J. Lu
  0 siblings, 0 replies; 18+ messages in thread
From: H.J. Lu @ 1998-01-23 11:15 UTC (permalink / raw)
  To: Oleg Krivosheev; +Cc: egcs

> 
> 
> Hi,
> 
> can someone point out where is 
> separate libg++ for egcs?
> 

ftp://ftp.yggdrasil.com/private/hjl/libg++-2.8.1-980119.tar.gz


-- 
H.J. Lu (hjl@gnu.org)

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

* libg++
@ 1998-01-20 14:54 Oleg Krivosheev
  1998-01-23 11:15 ` libg++ H.J. Lu
  0 siblings, 1 reply; 18+ messages in thread
From: Oleg Krivosheev @ 1998-01-20 14:54 UTC (permalink / raw)
  To: egcs

Hi,

can someone point out where is 
separate libg++ for egcs?

IMO, it's perfect Q&A for FAQ and
probably we should keep it (i.e. libg++)
in infrastructure dir.

just a thought...

regards

OK


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

* Re: libg++
  1997-12-02  9:23 libg++ Lee Iverson
  1997-12-02 13:14 ` libg++ Mumit Khan
@ 1997-12-02 18:18 ` H.J. Lu
  1 sibling, 0 replies; 18+ messages in thread
From: H.J. Lu @ 1997-12-02 18:18 UTC (permalink / raw)
  To: Lee Iverson; +Cc: egcs

> 
> 
> Is anyone working on reconstructing libg++ so that it will work with
> egcs?  I realize that it is somewhat officially considered *obsolete*
> but we have a bunch of legacy code that, until we get it converted,
> depends critically on libg++.
> 

ftp://ftp.yggdrasil.com/private/hjl/libg++-2.8.0b6.3.tar.gz


H.J.

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

* Re: libg++
  1997-12-02  9:23 libg++ Lee Iverson
@ 1997-12-02 13:14 ` Mumit Khan
  1997-12-02 18:18 ` libg++ H.J. Lu
  1 sibling, 0 replies; 18+ messages in thread
From: Mumit Khan @ 1997-12-02 13:14 UTC (permalink / raw)
  To: Lee Iverson; +Cc: egcs

Lee Iverson <leei@ai.sri.com> writes:
> 
> Is anyone working on reconstructing libg++ so that it will work with
> egcs?  I realize that it is somewhat officially considered *obsolete*
> but we have a bunch of legacy code that, until we get it converted,
> depends critically on libg++.
> 

I use a slightly modified version of libg++-2.8.0b6. The only mods are:
    
    - patch from HJ Lu to fix a bug (shows up only with glibc2? Can't
      remember exactly)
    - replace gxx_includedir with gxx_include_dir to conform to the new
      egcs configure (as of egcs-971127 I believe).

Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/

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

* libg++
@ 1997-12-02  9:23 Lee Iverson
  1997-12-02 13:14 ` libg++ Mumit Khan
  1997-12-02 18:18 ` libg++ H.J. Lu
  0 siblings, 2 replies; 18+ messages in thread
From: Lee Iverson @ 1997-12-02  9:23 UTC (permalink / raw)
  To: egcs

Is anyone working on reconstructing libg++ so that it will work with
egcs?  I realize that it is somewhat officially considered *obsolete*
but we have a bunch of legacy code that, until we get it converted,
depends critically on libg++.

-------------------------------------------------------------------------------
Lee Iverson     		SRI International
leei@ai.sri.com			333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/	(650) 859-3307

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

* Re: libg++?
  1997-08-30 22:12 egcs-970828 install Weiwen Liu
@ 1997-08-30 22:12 ` Joe Buck
  0 siblings, 0 replies; 18+ messages in thread
From: Joe Buck @ 1997-08-30 22:12 UTC (permalink / raw)
  To: egcs

> 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.

The only parts of old libg++ that I think are that interesting anymore are
the random number classes: there's a nice scheme to generate a variety of
types of random numbers with different distributions.  I think these
originally came from Dirk Grunwald's Awesime project, not from Doug Lea.
Ptolemy used them.

Much of the rest of libg++ I would consider obsolete: String, Complex,
the containers, especially now that we have the SGI hashing classes and
singly linked list.  Just the same, some people still use it, so we can
put it out and call it deprecated.

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

* libg++?
@ 1997-08-30 11:27 Chip Salzenberg
  0 siblings, 0 replies; 18+ messages in thread
From: Chip Salzenberg @ 1997-08-30 11:27 UTC (permalink / raw)
  To: egcs

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)?
-- 
Chip Salzenberg          - a.k.a. -           
 (Roller coaster on camera:)  "Wow, this square quarter mile
    has unbelievably good light rail transit!"  // MST3K

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

end of thread, other threads:[~1998-07-01  7:26 UTC | newest]

Thread overview: 18+ 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 ` fixing the c++/f77 circular dependency Joel Sherrill
1997-08-30 19:18 ` Incorrect i960 linker config Joel Sherrill
1997-08-30 19:18 ` include hackery Bruce Korb
1997-08-30 21:24 ` libg++? Jason Merrill
1997-09-01 10:27 ` Incorrect i960 linker config Jeffrey A Law
     [not found] <Pine.SUN.3.95-heb-2.07.980629191358.564A-100000.cygnus.egcs@beitza.jct.ac.il>
1998-06-30 19:49 ` libg++ Nathan Myers
1998-07-01  7:26   ` libg++ H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
1998-06-29 23:55 libg++ Daniel Bernstein
1998-06-30 11:53 ` libg++ H.J. Lu
1998-06-30 14:08 ` libg++ Manfred Hollstein
1998-01-20 14:54 libg++ Oleg Krivosheev
1998-01-23 11:15 ` libg++ H.J. Lu
1997-12-02  9:23 libg++ Lee Iverson
1997-12-02 13:14 ` libg++ Mumit Khan
1997-12-02 18:18 ` libg++ H.J. Lu
1997-08-30 22:12 egcs-970828 install Weiwen Liu
1997-08-30 22:12 ` libg++? Joe Buck
1997-08-30 11:27 libg++? Chip Salzenberg

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).