Subject: Re: Some problems compiling libg++-2.6.2 on NetBSD
To: None <bug-lib-g++@prep.ai.mit.edu>
From: Douglas Thomas Crosher <dtc@scrooge.ee.swin.oz.au>
List: current-users
Date: 03/04/1995 02:45:46
I have read up on sh and sed, and through trial and error have developed
patches to libio/gen-params that correct the problems I mentioned for
NetBSD1.0 i486.
The patches should work for all platforms of NetBSD and I had tested
them on both NetBSD1.0 and NetBSD-current's include files. I have
added extra cases for NetBSD without removing any existing
functionality so I would hope that they would not break any other
platforms.
Regards
Douglas Crosher
*** gen-params.orig Fri Mar 3 13:59:06 1995
--- gen-params Sat Mar 4 01:55:59 1995
*************** else
*** 254,260 ****
fi
tr ' ' ' ' <TMP >dummy.out
! for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int8_t uint8_t int16_t uint16_t int32_t uint_32_t int64_t uint64_t; do
IMPORTED=`eval 'echo $'"$TYPE"`
if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED"
--- 254,260 ----
fi
tr ' ' ' ' <TMP >dummy.out
! for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int8_t uint8_t int16_t uint16_t int32_t uint_32_t int64_t uint64_t u_int8_t u_int16_t u_int32_t u_int64_t; do
IMPORTED=`eval 'echo $'"$TYPE"`
if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED"
*************** for TYPE in dev_t clock_t fpos_t gid_t i
*** 268,283 ****
if [ -s TMP ]; then
# VALUE is now the typedef'd definition of $TYPE.
eval "VALUE='`${SED} -e 's| *$||' -e '2,$d' <TMP`'"
! # Unless VALUE contains a blank, look for a typedef for it
! # in turn (this could be a loop, but that would be over-kill).
! if echo $VALUE | grep " " >/dev/null ; then true
! else
! rm -f TMP
! ${SED} -n -e "s|.*typedef[ ][ ]*\(.*[^a-zA-Z0-9_]\)${VALUE}[ ]*;.*|\1|w TMP" <dummy.out>/dev/null
! if [ -s TMP ]; then
! eval "VALUE='`${SED} -e '2,$d' -e 's|[ ]*$||' <TMP`'"
! fi
! fi
eval "$TYPE='$VALUE'"
fi
fi
--- 268,285 ----
if [ -s TMP ]; then
# VALUE is now the typedef'd definition of $TYPE.
eval "VALUE='`${SED} -e 's| *$||' -e '2,$d' <TMP`'"
! for i in 1 2 3 4 ; do
! # Unless VALUE contains a blank, look for a typedef for it
! # in turn (this could be a loop, but that would be over-kill).
! if echo $VALUE | grep " " >/dev/null ; then true
! else
! rm -f TMP
! ${SED} -n -e "s|.*typedef[ ][ ]*\(.*[^a-zA-Z0-9_]\)${VALUE}[ ]*;.*|\1|w TMP" <dummy.out>/dev/null
! if [ -s TMP ]; then
! eval "VALUE='`${SED} -e '2,$d' -e 's|[ ]*$||' <TMP`'"
! fi
! fi
! done
eval "$TYPE='$VALUE'"
fi
fi
*************** for NAME in SHRT_MAX INT_MAX LONG_MAX LO
*** 428,434 ****
eval "$NAME='$IMPORTED /* specified */"
else
rm -f TMP
! ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
<dummy.out>/dev/null
# Now select the first definition.
if [ -s TMP ]; then
--- 430,436 ----
eval "$NAME='$IMPORTED /* specified */"
else
rm -f TMP
! ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9,a-f,x]*\)L* *;|\1|w TMP" \
<dummy.out>/dev/null
# Now select the first definition.
if [ -s TMP ]; then
*************** default_int16=
*** 443,462 ****
default_int32=
default_int64=
INT16=32767
INT32=2147483647
INT64=9223372036854775807
! if [ "${SHRT_MAX}" = $INT16 ] ; then
default_int16=short
! if [ "${LONG_MAX}" = $INT32 ] ; then
default_int32=long
! if [ "${LONG_LONG_MAX}" = $INT64 ] ; then
# Most Unices, DOS
default_int64="long long"
fi
! elif [ "${INT_MAX}" = $INT32 ] ; then
default_int32=int
! if [ "${LONG_MAX}" = $INT64 ] ; then
# Some 64-bit Unices, like OSF/1 on the Alpha
default_int64=long
fi
--- 445,467 ----
default_int32=
default_int64=
INT16=32767
+ INT16hex=0x7fff
INT32=2147483647
+ INT32hex=0x7fffffff
INT64=9223372036854775807
+ INT64hex=0x7fffffffffffffff
! if [ "${SHRT_MAX}" = $INT16 -o "${SHRT_MAX}" = $INT16hex ] ; then
default_int16=short
! if [ "${LONG_MAX}" = $INT32 -o "${LONG_MAX}" = $INT32hex ] ; then
default_int32=long
! if [ "${LONG_LONG_MAX}" = $INT64 -o "${LONG_LONG_MAX}" = $INT64hex ] ; then
# Most Unices, DOS
default_int64="long long"
fi
! elif [ "${INT_MAX}" = $INT32 -o "${INT_MAX}" = $INT32hex ] ; then
default_int32=int
! if [ "${LONG_MAX}" = $INT64 -o "${LONG_MAX}" = $INT64hex ] ; then
# Some 64-bit Unices, like OSF/1 on the Alpha
default_int64=long
fi
*************** fi
*** 466,472 ****
if [ -n "${int64_t-${default_int64}}" ] ; then
int64_lines="#define HAVE_INT64
typedef ${int64_t-${default_int64}} ${macro_prefix}int64_t;
! typedef ${uint64_t-unsigned ${default_int64}} ${macro_prefix}uint64_t;"
if [ "${default_int64}" = "long long" ] ; then
int64_lines="#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(_NO_LONGLONG)
${int64_lines}
--- 471,477 ----
if [ -n "${int64_t-${default_int64}}" ] ; then
int64_lines="#define HAVE_INT64
typedef ${int64_t-${default_int64}} ${macro_prefix}int64_t;
! typedef ${uint64_t-${u_int64_t-unsigned ${default_int64}}} ${macro_prefix}uint64_t;"
if [ "${default_int64}" = "long long" ] ; then
int64_lines="#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(_NO_LONGLONG)
${int64_lines}
*************** cat <<!EOF!
*** 478,488 ****
#ifdef __STDC__
typedef ${int8_t-signed char} ${macro_prefix}int8_t;
#endif
! typedef ${uint8_t-unsigned char} ${macro_prefix}uint8_t;
typedef ${int16_t-${default_int16-short}} ${macro_prefix}int16_t;
! typedef ${uint16_t-unsigned ${default_int16-short}} ${macro_prefix}uint16_t;
typedef ${int32_t-${default_int32-int}} ${macro_prefix}int32_t;
! typedef ${uint32_t-unsigned ${default_int32-int}} ${macro_prefix}uint32_t;
${int64_lines}
#define ${macro_prefix}BUFSIZ ${BUFSIZ-1024 /* default */}
#define ${macro_prefix}FOPEN_MAX ${FOPEN_MAX-32 /* default */}
--- 483,493 ----
#ifdef __STDC__
typedef ${int8_t-signed char} ${macro_prefix}int8_t;
#endif
! typedef ${uint8_t-${u_int8_t-unsigned char}} ${macro_prefix}uint8_t;
typedef ${int16_t-${default_int16-short}} ${macro_prefix}int16_t;
! typedef ${uint16_t-${u_int16_t-unsigned ${default_int16-short}}} ${macro_prefix}uint16_t;
typedef ${int32_t-${default_int32-int}} ${macro_prefix}int32_t;
! typedef ${uint32_t-${u_int32_t-unsigned ${default_int32-int}}} ${macro_prefix}uint32_t;
${int64_lines}
#define ${macro_prefix}BUFSIZ ${BUFSIZ-1024 /* default */}
#define ${macro_prefix}FOPEN_MAX ${FOPEN_MAX-32 /* default */}