From: Andy Dougherty Date: Mon, 3 Feb 1997 10:37:38 +0000 (+1200) Subject: Configure updates for intsize and ssizetype X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24fef2a7cd8a0fa32e8f3397b46c72d088f692bc;p=p5sagit%2Fp5-mst-13.2.git Configure updates for intsize and ssizetype --- diff --git a/Configure b/Configure index bc7beb8..c5fbe4e 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $ # -# Generated on Mon Jan 27 12:33:55 EST 1997 [metaconfig 3.0 PL60] +# Generated on Sat Feb 1 00:26:40 EST 1997 [metaconfig 3.0 PL60] cat >/tmp/c1$$ <&4 - $cat >try.c <<'EOCP' + $cat >intsize.c <<'EOCP' #include main() { - printf("%d\n", sizeof(int)); + printf("intsize=%d;\n", sizeof(int)); + printf("longsize=%d;\n", sizeof(long)); + printf("shortsize=%d;\n", sizeof(short)); + fflush(stdout); exit(0); } EOCP - if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then - intsize=`./try` +# If $libs contains -lsfio, and sfio is mis-configured, then it +# sometimes (apparently) runs and exits with a 0 status, but with no +# output!. Thus we check with test -s whether we actually got any +# output. I think it has to do with sfio's use of _exit vs. exit, +# but I don't know for sure. --Andy Dougherty 1/27/97. + if $cc $optimize $ccflags $ldflags -o intsize intsize.c $libs >/dev/null 2>&1 && + ./intsize > intsize.out 2>/dev/null && test -s intsize.out ; then + eval `$cat intsize.out` echo "Your integers are $intsize bytes long." + echo "Your long integers are $longsize bytes long." + echo "Your short integers are $shortsize bytes long." else - dflt='4' - echo "(I can't seem to compile the test program. Guessing...)" + $cat >&4 < /dev/null 2>&1 && - ./ssize > /dev/null 2>&1 ; then - ssizetype=`./ssize` +# If $libs contains -lsfio, and sfio is mis-configured, then it +# sometimes (apparently) runs and exits with a 0 status, but with no +# output!. Thus we check with test -s whether we actually got any +# output. I think it has to do with sfio's use of _exit vs. exit, +# but I don't know for sure. --Andy Dougherty 1/27/97. +if $cc $optimize $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 && + ./ssize > ssize.out 2>/dev/null && test -s ssize.out ; then + ssizetype=`$cat ssize.out` echo "I'll be using $ssizetype for functions returning a byte count." >&4 else - echo "(I can't compile and run the test program--please enlighten me!)" - $cat <&4 <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #$i_vfork I_VFORK /**/ /* INTSIZE: - * This symbol contains the size of an int, so that the C preprocessor - * can make decisions based on it. + * This symbol contains the value of sizeof(int) so that the C + * preprocessor can make decisions based on it. + */ +/* LONGSIZE: + * This symbol contains the value of sizeof(long) so that the C + * preprocessor can make decisions based on it. + */ +/* SHORTSIZE: + * This symbol contains the value of sizeof(short) so that the C + * preprocessor can make decisions based on it. */ #define INTSIZE $intsize /**/ +#define LONGSIZE $longsize /**/ +#define SHORTSIZE $shortsize /**/ /* Off_t: * This symbol holds the type used to declare offsets in the kernel. diff --git a/handy.h b/handy.h index 056bf2c..efb4f03 100644 --- a/handy.h +++ b/handy.h @@ -81,6 +81,23 @@ standard library calls (where we pass an I32 and the library is expecting an int), but the disadvantage that an I32 is not 32 bits. Andy Dougherty August 1996 + + In the future, we may perhaps want to think about something like + #if INTSIZE == 4 + typedef I32 int; + #else + # if LONGSIZE == 4 + typedef I32 long; + # else + # if SHORTSIZE == 4 + typedef I32 short; + # else + typedef I32 int; + # endif + # endif + #endif + For the moment, these are mentioned here so metaconfig will + construct Configure to figure out the various sizes. */ typedef char I8;