From: erg Date: Mon, 31 Oct 2005 17:17:42 +0000 (+0000) Subject: Update old configure files, in particular, copying rather than X-Git-Tag: LAST_LIBGRAPH~32^2~6998 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b76132f9b59e53675a37c7c1038ab000f147b9a;p=graphviz Update old configure files, in particular, copying rather than moving template files. Update iffe. --- diff --git a/iffe b/iffe index 85f7f24f8..f448ad870 100755 --- a/iffe +++ b/iffe @@ -1,9 +1,9 @@ -USAGE_LICENSE="[-author?Glenn Fowler ][-author?Phong Vo ][-copyright?Copyright (c) 1994-2002 AT&T Corp.][-license?http://www.research.att.com/sw/license/ast-open.html][--catalog?INIT]" +USAGE_LICENSE="[-author?Glenn Fowler ][-author?Phong Vo ][-copyright?Copyright (c) 1994-2004 AT&T Corp.][-license?http://www.research.att.com/sw/license/ast-open.html][--catalog?INIT]" # Glenn Fowler & Phong Vo # AT&T Labs Research # # test if feature exists -# this script written to make it through all sh variants +# this script is written to make it through all sh variants # # NOTE: .exe a.out suffix and [\\/] in path patterns for dos/nt @@ -12,7 +12,7 @@ case $-:$BASH_VERSION in esac command=iffe -version=2002-02-14 # update in USAGE too # +version=2004-08-11 # update in USAGE too # pkg() # package { @@ -68,6 +68,7 @@ is() # op name dfn) mm="a macro with extractable value" ;; exp) mm="true" ;; hdr) mm="a header" ;; + id) mm="an identifier" ;; lcl) mm="a native header" ;; key) mm="a reserved keyword" ;; lib) mm="a library function" ;; @@ -85,7 +86,7 @@ is() # op name nxt) mm="an include path for the native header" ;; pth) mm="a file" ;; run) yy="capture output of" mm= ;; - siz) mm="a type with know size" ;; + siz) mm="a type with known size" ;; sym) mm="a typed variable" ;; sys) mm="a system header" ;; typ) mm="a type or typedef" ;; @@ -93,7 +94,7 @@ is() # op name *) yy= mm= ;; esac case $ii in - [abcdefghijklmnopqrstuvwxyz]*[abcdefghijklmnopqrstuvwxyz]"{") ii="$ii ... }end" ;; + [abcdefghijklmnopqrstuvwxyz]*[abcdefghijklmnopqrstuvwxyz]'{') ii="$ii ... }end" ;; esac $show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr complete=1 @@ -105,6 +106,14 @@ is() # op name success() { + case $1 in + -) shift + ;; + *) case $result in + UNKNOWN) result=SUCCESS ;; + esac + ;; + esac case $complete:$verbose in 1:1) case $suspended in 1) suspended=0 @@ -126,6 +135,10 @@ success() failure() { + case $1 in + -) shift ;; + *) result=FAILURE ;; + esac case $complete:$verbose in 1:1) case $suspended in 1) suspended=0 @@ -145,6 +158,102 @@ failure() esac } +# report +# +# - ignore global status +# -0 normal sense +# -1 inverted sense if ! def +# status test status 0:success *:failure +# success success comment +# failure failure comment +# default default setting comment +# +# globals +# +# $not invert test sense +# $M test variable +# $m test macro +# $v default macro + +report() # [-] [-0] [-1] status value success failure default +{ + case $1 in + -) _report_ignore=$1 + shift + ;; + *) _report_ignore= + ;; + esac + _report_not=$not + case $1 in + -0) shift + ;; + -1) shift + case $def in + ''|-) case $_report_not in + 1) _report_not= ;; + *) _report_not=1 ;; + esac + ;; + esac + ;; + esac + _report_status=$1 + case $_report_ignore:$_report_status in + -:*) ;; + *:0) success $_report_ignore ;; + *) failure $_report_ignore ;; + esac + _report_value=$2 + case $_report_not in + 1) case $_report_status in + 0) _report_status=1 ;; + *) _report_status=0 ;; + esac + _report_success=$4 + _report_failure=$3 + ;; + *) _report_success=$3 + _report_failure=$4 + ;; + esac + _report_default=$5 + case $_report_status in + 0) case $M in + *-*) ;; + *) usr="$usr$nl#define $m $_report_value" + case $_report_success in + ''|-) ;; + *) echo "#define $m $_report_value /* $_report_success */" ;; + esac + eval $m=\'$_report_value\' + ;; + esac + ;; + *) case $M in + *-*) ;; + *) case $_report_failure in + ''|-) ;; + *) case $define$all$config$undef in + 1?1?|1??1)echo "#undef $m /* $_report_failure */" ;; + 11??) echo "#define $m 0 /* $_report_failure */" ;; + esac + ;; + esac + case $_report_default in + ''|-) ;; + *) case $define$set in + 1?*) echo "#define $v $set /* $_report_default */" ;; + esac + ;; + esac + eval $m=0 + ;; + esac + ;; + esac +} + noisy() { case $complete:$verbose in @@ -160,8 +269,8 @@ copy() # output-file data { case $shell in ksh) case $1 in - -) print -r -- "$2" ;; - *) print -r -- "$2" > "$1" ;; + -) print -r - "$2" ;; + *) print -r - "$2" > "$1" ;; esac ;; *) case $1 in @@ -202,7 +311,7 @@ $2 checkread() { - posix_read=`(read -r line; echo $line) 2>/dev/null </dev/null <&$nullout - _execute_=$? - $tmp.exe <&$nullin | cat - elif test "" != "$cross" + if test "" != "$cross" then crossexec $cross "$@" _execute_=$? + elif test -d /NextDeveloper + then "$@" <&$nullin >&$nullout + _execute_=$? + "$@" <&$nullin | cat else "$@" _execute_=$? fi @@ -309,6 +418,7 @@ binding="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non complete=0 config=0 defhdr= +define=1 iff= usr= cross= @@ -320,6 +430,8 @@ executable="test -x" exists="test -e" gothdr= gotlib= +idno= +idyes= ifs=$IFS in= includes= @@ -353,6 +465,7 @@ $RANDOM)shell=bsh esac reallystatic= reallystatictest= +regress= static=. statictest= style=C @@ -402,8 +515,8 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in @(#)$Id$ ] '$USAGE_LICENSE$' -[+NAME?iffe - host C compilation environment feature probe] -[+DESCRIPTION?\biffe\b is a command interpreter that probes the host C +[+NAME?iffe - C compilation environment feature probe] +[+DESCRIPTION?\biffe\b is a command interpreter that probes the C compilation environment for features. A feature is any file, option or symbol that controls or is controlled by the C compiler. \biffe\b tests features by generating and compiling C programs and observing @@ -412,12 +525,12 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in operand list with the \b:\b operand or \bnewline\b as the line delimiter. The standard input is read if there are no command line statements or if \afile\a\b.iffe\b is omitted.] -[+?Though similar in concept to \bautoconfig\b(1) and \bconfig\b(1), there +[+?Though similar in concept to \bautoconf\b(1) and \bconfig\b(1), there are fundamental differences. The latter tend to generate global headers accessed by all components in a package, whereas \biffe\b is aimed at localized, self contained feature testing.] [+?Output is generated in \bFEATURE/\b\atest\a by default, where \atest\a is - the base name of \afile\a\b.iffe\b or the \biffe\b \brun\b command + the base name of \afile\a\b.iffe\b or the \biffe\b \brun\b file operand. Output is first generated in a temporary file; the output file is updated if it does not exist or if the temporary file is different. If the first operand is \b-\b then the output is written @@ -430,15 +543,16 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in tests.]:[C-compiler-name [C-compiler-flags ...]]] [C:config?Generate \bconfig\b(1) style \aHAVE_\a* macro names. This implies \b--undef\b. Since \bconfig\b(1) has inconsistent naming conventions, - the \bexp\b command may be needed to translate from the (consistent) + the \bexp\b op may be needed to translate from the (consistent) \biffe\b names. Unless otherwise noted a \bconfig\b macro name is the \biffe\b macro name prefixed with \bHAVE\b and converted to upper case. \b--config\b is set by default if the command arguments - contain a \brun\b command on an input file with the base name - \bconfig\b.] + contain a \brun\b op on an input file with the base name \bconfig\b.] [d:debug?Sets the debug level. Level 0 inhibits most error messages, level 1 shows compiler messages, and - level 2 traces internal \biffe\b \bsh\b(1) actions.]#[level] + level 2 traces internal \biffe\b \bsh\b(1) actions and does + not remove core dumps on exit.]#[level] +[D:define?Successful test macro definitions are emitted. This is the default.] [i:input?Sets the input file name to \afile\a, which must contain \biffe\b statements.]:[file] [I:include?Adds \b-I\b\adir\a to the C compiler flags.]:[dir] @@ -448,9 +562,11 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in [p:prototyped?Emits \b#pragma prototyped\b at the top of the output file. See \bproto\b(1).] [P:pragma?Emits \b#pragma\b \atext\a at the top of the output file.]:[text] -[s:shell?Sets the internal shell name to \ashell-path\a. Used for debugging +[r:regress?Massage output for regression testing.] +[s:shell?Sets the internal shell name to \aname\a. Used for debugging Bourne shell compatibility (otherwise \biffe\b uses \aksh\a constructs - if available).]:[shell-path] + if available). The supported names are \bksh\b, \bbsh\b, \bbash\b. + The default is determined by probing the shell at startup.]:[name] [S:static?Sets the C compiler flags that force static linking. If not set then \biffe\b probes the compiler to determine the flags. \biffe\b must use static linking (no dlls) because on some systems missing @@ -478,11 +594,16 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in that span more than one line contain \abegin\a\b{\b as the last operand (where \abegin\a is command specific) and zero or more data lines terminated by a line containing - \b}end\b as the first operand. The statements syntax is: - \aop\a[,\aop\a...]] [\aarg\a[,\aarg\a...]]]] [\aprereq\a ...]] - [\abegin\a{ ... |\bend\b ...]] [= [\adefault\a]]]]. \aop\as and \aarg\as - may be combined, separated by commas, to perform a set of operations - on a set of arguments.] + \b}end\b as the first operand. The statement syntax is: + [\aname\a \b=\b]] [\b!\b]] \atest\a[,\atest\a...]] [\b-\b]] + [\aarg\a[,\aarg\a...]]]] [\aprereq\a ...]] + [\abegin\a{ ... |\bend\b ...]] [= [\adefault\a]]]]. + \atest\as and \aarg\as may be combined, separated by commas, to perform + a set of tests on a set of arguments. \aname\a \b=\b before \atest\a + overrides the default test variable and macro name, and \b-\b after + \atest\a performs the test but does not define the test variable and + macro values. \b!\b before \atest\a inverts the test sense for \bif\b, + \belif\b, and \byes{\b and \bno{\b blocks.] [+?\aprereq\as are used when applying the features tests and may be combinations of:]{ [+compiler options?\b-D\b*, \b-L\b*, etc.] @@ -521,17 +642,17 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in [+#endif?] [+#define _NIL_(x) ((x)0)?] } -[+?= \adefault\a may be specified for the \bkey\b, \blib\b, \bmth\b and \btyp\b - commands. If the test fails for \aarg\a then +[+?= \adefault\a may be specified for the \bkey\b, \blib\b, \bmac\b, \bmth\b + and \btyp\b tests. If the test fails for \aarg\a then \b#define\b \aarg\a \adefault\a is emitted. \bkey\b accepts multiple \b= \b\adefault\a values; the first valid one is used.] [+?Each test statement generates a portion of a C language header that contains macro defintions, comments, and other text corresponding to the feature - test commands. \b#ifndef _def_\b\aname\a\b_\b\adirectory\a ... + tests. \b#ifndef _def_\b\aname\a\b_\b\adirectory\a ... \b#endif\b guards the generated header from multiple \b#include\bs, - where \aname\a is determined by either the \brun\b command input file - name if any, or the first \aop\a of the first command, and \adirectory\a - is the basname component of either the \brun\b command file, if any, + where \aname\a is determined by either the \brun\b statement input file + name if any, or the first \atest\a in the first statement, and \adirectory\a + is the basename component of either the \brun\b statement file, if any, or the current working directory. The output file name is determined in this order:]{ [+-?If the first command line operand is \b-\b then the output @@ -545,13 +666,13 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in \b#include "FEATURE/\b\afile\a". The \bnmake\b(1) base rules contain metarules for generating \bFEATURE/\b\afile\a from \bfeatures/\b\afile\a[\asuffix\a]], where \asuffix\a may be omitted, - \b.c\b, or \b.sh\b (see the \brun\b command below). Because + \b.c\b, or \b.sh\b (see the \brun\b test below). Because \b#include\b prerequisites are automatically detected, \bnmake\b(1) ensures that all prerequisite \biffe\b headers are generated before compilation. Note that the directories are deliberately named - \bFEATURE\b and \bfeatures\b to keep case-insensitive file systems + \bFEATURE\b and \bfeatures\b to keep case-ignorant file systems happy.] -[+?The feature test commands are:]{ +[+?The feature tests are:]{ [+# \acomment\a?Comment line - ignored.] [+cmd \aname\a?Defines \b_cmd_\b\aname\a if \aname\a is an executable in one of the standard system directories (\b/bin, /etc, @@ -571,20 +692,22 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in \bexpr\b(1) evaluation of \aexpression\a is not 0 then \aname\a is defined to be 1, otherwise \aname\a is defined to be 0. Identifiers in \aexpression\a may be previously defined names - from other \biffe\b commands; undefined names evaluate to 0. + from other \biffe\b tests; undefined names evaluate to 0. If \aname\a was defined in a previous successful test then the current and subsequent \bexp\b test on \aname\a are - skipped.] + skipped. If \aname\a is \b-\b then the \aexpression\a is + simply evaluated.] [+hdr \aname\a?Defines \b_hdr_\b\aname\a if the header \b<\b\aname\a\b.h>\b exists. The \b--config\b macro name is \bHAVE_\b\aNAME\a\b_H\b.] + [+if \astatement\a ... | \belif\b \astatement\a ... | \belse\b + | \bendif\b?Nested if-else test control.] [+iff \aname\a?The generated header \b#ifndef-#endif\b macro guard is \b_\b\aname\a\b_H\b.] [+key \aname\a?Defines \b_key_\b\aname\a if \aname\a is a reserved word (keyword).] [+lcl \aname\a?Generates a \b#include\b statement for the native version - of either the header \b<\b\aname\a\b.h>\b if it exists or the - header \b\b if it exists. Defines + of the header \b<\b\aname\a\b.h>\b if it exists. Defines \b_lcl_\b\aname\a on success. The \b--config\b macro name is \bHAVE_\b\aNAME\a\b_H\b.] [+lib \aname\a?Defines \b_lib_\b\aname\a if \aname\a is an external @@ -594,21 +717,20 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in if \amember\a is a member of the structure \astruct\a.] [+mth \aname\a?Defines \b_mth_\b\aname\a if \aname\a is an external symbol in the math library.] - [+nop \aname\a?If this is the first command then \aname\a may be used + [+nop \aname\a?If this is the first test then \aname\a may be used to name the output file and/or the output header guard macro. - Otherwise this command is ignored.] + Otherwise this test is ignored.] [+npt \aname\a?Defines \b_npt_\b\aname\a if the \aname\a symbol requires a prototype. The \b--config\b macro name is - \b\aNAME\a\b_DECLARED\b with the opposite sense.] + \bHAVE_\aNAME\a\b_DECL\b with the opposite sense.] [+num \aname\a?Defines \b_num_\b\aname\a if \aname\a is a numeric constant \aenum\a or \amacro\a.] [+nxt \aname\a?Defines a string macro \b_nxt_\b\aname\a suitable for a \b#include\b statement to include the next (on the include - path) or native version of either the header - \b<\b\aname\a\b.h>\b if it exists or the header - \b\b if it exists. Also defines the \"...\" - form \b_nxt_\b\aname\a\b_str\b. The \b--config\b - macro name is \bHAVE_\b\aNAME\a\b_NEXT\b.] + path) or native version of the header \b<\b\aname\a\b.h>\b + if it exists. Also defines the \"...\" form + \b_nxt_\b\aname\a\b_str\b. The \b--config\b macro name is + \bHAVE_\b\aNAME\a\b_NEXT\b.] [+one \aheader\a ...?Generates a \b#include\b statement for the first header found in the \aheader\a list.] [+pth \afile\a [ \adir\a ... | { \ag1\a - ... - \agn\a } | < \apkg\a [\aver\a ...]] > ]]?Defines @@ -651,36 +773,49 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in testing and are translated to \b_\b in the output macro name.] [+val \aname\a?The output of \becho\b \aname\a is written to the output file.] + [+var \aname\a?A user defined test on name. A source block must be + supplied. Sets the \bexp\b variable \b_\b\aname\a on success + but does not define a macro.] + [+(\aexpression\a)?Equivalent to \bexp -\b \aexpression\a.] } [+?Code block names may be prefixed by \bno\b to invert the test sense. The block names are:]{ [+cat?The block is copied to the output file.] [+compile?The block is compiled (\bcc -c\b).] + [+cross?The block is executed as a shell script using \bcrossexec\b(1) + if \b--cross\b is on, or on the local host otherwise, and the + output is copied to the output file. Test macros are not + exported to the script.] [+execute?The block is compiled, linked, and executed. \b0\b exit status means success.] - [+fail?If the test fails then the block text evaluated by \bsh\b(1).] + [+fail?If the test fails then the block text is evaluated by + \bsh\b(1).] [+link?The block is compiled and linked (\bcc -o\b).] [+macro?The block is preprocessed (\bcc -E\b) and lines containing text bracketed by \b<<"\b ... \b">>\b (\aless-than less-than double-quote ... double-quote greater-than greater-than\a) are copied to the output file with the brackets omitted.] [+no?If the test fails then the block text is copied to the - output file.] + output file. Deprecated: use { \bif\b \belif\b \belse\b + \bendif\b } with unnamed \b{\b ... \b}\b blocks.] [+note?If the test succeeds then the block is copied to the output as a \b/*\b ... \b*/\b comment.] [+output?The block is compiled, linked, and executed, and the output is copied to the output file.] - [+pass?If the test succeeds then the block text evaluated by \bsh\b(1).] + [+pass?If the test succeeds then the block text is evaluated by + \bsh\b(1).] [+preprocess?The block is preprocessed (\bcc -E\b).] [+run?The block is executed as a shell script and the output is copied to the output file. Succesful test macros are also defined as shell variables with value \b1\b and are available within the block. Likewise, failed test macros are defined as shell variables with value \b0\b.] - [+yes?If the test succeeds then the block text is copied to the - output file.] + [+yes?If the test succeeds then the block text is copied to the output + file. \byes{\b ... \b}end\b is equivalent to the unnamed block + \b{\b ... \b}\b. Deprecated: use { \bif\b \belif\b \belse\b + \bendif\b } with unnamed \b{\b ... \b}\b blocks.] } -[+SEE ALSO?\bautoconfig\b(1), \bconfig\b(1), \bcrossexec\b(1), \bnmake\b(1), +[+SEE ALSO?\bautoconf\b(1), \bconfig\b(1), \bcrossexec\b(1), \bnmake\b(1), \bpackage\b(1), \bproto\b(1), \bsh\b(1)] ' while getopts -a "$command" "$USAGE" OPT @@ -689,6 +824,7 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in c) set="$set set cc $OPTARG :" ;; C) set="$set set config :" ;; d) set="$set set debug $OPTARG :" ;; + D) set="$set set define :" ;; i) set="$set set input $OPTARG :" ;; I) set="$set set include $OPTARG :" ;; L) set="$set set library $OPTARG :" ;; @@ -696,6 +832,7 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in e) set="$set set package $OPTARG :" ;; p) set="$set set prototyped :" ;; P) set="$set set pragma $OPTARG :" ;; + r) set="$set set regress :" ;; s) set="$set set shell $OPTARG :" ;; S) set="$set set static $OPTARG :" ;; u) set="$set set undef :" ;; @@ -730,6 +867,9 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in --d=*|--de=*|--deb=*|--debu=*|--debug=*) REM=d`echo $1 | sed -e 's,[^=]*=,,'` ;; + --def|--defi|--defin|--define) + REM=D + ;; --e=*|--ex=*|--exc=*|--excl=*|--exclu=*|--exclud=*|--exclude=*) REM=X`echo $1 | sed -e 's,[^=]*=,,'` ;; @@ -754,6 +894,9 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in --pra=*|--prag=*|--pragma=*) REM=P`echo $1 | sed -e 's,[^=]*=,,'` ;; + --r|--re|--reg|--regre|--regres|--regress) + REM=r + ;; --sh=*|--she=*|--shel=*|--shell=*) REM=s`echo $1 | sed -e 's,[^=]*=,,'` ;; @@ -801,6 +944,7 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in c) set="$set set cc $OPTARG :" ;; C) set="$set set config :" ;; d) set="$set set debug $OPTARG :" ;; + D) set="$set set define :" ;; i) set="$set set input $OPTARG :" ;; I) set="$set set include $OPTARG :" ;; L) set="$set set library $OPTARG :" ;; @@ -808,13 +952,14 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in e) set="$set set package $OPTARG :" ;; p) set="$set set prototyped :" ;; P) set="$set set pragma $OPTARG :" ;; + r) set="$set set regress :" ;; s) set="$set set shell $OPTARG :" ;; S) set="$set set static $OPTARG :" ;; u) set="$set set undef :" ;; v) set="$set set verbose :" ;; x) set="$set set cross $OPTARG :" ;; X) set="$set set exclude $OPTARG :" ;; - *) echo "Usage: $command [-aCpuv] [-c C-compiler-name [C-compiler-flags ...]] [-d level] + *) echo "Usage: $command [-aCDpruv] [-c C-compiler-name [C-compiler-flags ...]] [-d level] [-i file] [-o file] [-e name] [-P text] [-s shell-path] [-S[flags]] [-x cross-exec-prefix] [-I dir] [-L dir] [-X dir] [ - ] [ file.iffe | statement [ : statement ... ] ]" >&2 @@ -846,8 +991,8 @@ esac # nullin /dev/null input # nullout /dev/null output -stdin=4 stdout=5 stderr=6 nullin=7 nullout=8 -eval "exec $stdin<&0 $nullin/dev/null $stdout>&1 $stderr>&2" +stdout=5 stderr=6 nullin=7 nullout=8 +eval "exec $nullin/dev/null $stdout>&1 $stderr>&2" case " $* " in *" set debug "[3456789]*) ;; @@ -857,7 +1002,7 @@ esac # prompt complications -case `print -n aha 2>/dev/null` in +case `print -n aha /dev/null` in aha) show='print -n' SHOW='' ;; *) case `echo -n aha 2>/dev/null` in -n*) show=echo SHOW='\c' ;; @@ -870,12 +1015,20 @@ esac # status: 0:success 1:failure 2:interrupt status=1 -if (ulimit -c 0) >/dev/null 2>&1 -then ulimit -c 0 - core= -else core=core -fi -trap "rm -f $core $tmp*.*; exit \$status" 0 1 2 +case $debug in +2) core= + ;; +*) if (ulimit -c 0) >/dev/null 2>&1 + then ulimit -c 0 + core= + else core="core core.??*" + fi + ;; +esac +trap " + rm -f $core $tmp*.* + exit \$status +" 0 1 2 if (:>$tmp.c) 2>/dev/null then rm -f $tmp.c else echo "$command: cannot create tmp files in current dir" >&2 @@ -902,7 +1055,7 @@ std='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) #define _END_EXTERNS_ #endif #define _NIL_(x) ((x)0)' -ext='#ifndef feof +ext='#if !defined(stdin) && !defined(feof) && !defined(L_tmpnam) _BEGIN_EXTERNS_ #if _STD_ extern int printf(const char*, ...); @@ -919,7 +1072,11 @@ cur=. can= cansep= cctest= +file= hdrtest= +ifelse=NONE +ifstack= +line=0 while : do case $in in "") case $argx:$* in @@ -929,19 +1086,93 @@ do case $in in shift ;; esac - case $# in - 0) set set out + ;; - esac ;; - *) read lin || lin="set out +" - set x $lin + *) if read lin + then case $shell in + ksh) let line=line+1 ;; + *) line=`expr $line + 1` ;; + esac + set x $lin + case $# in + 1) continue ;; + esac + else set x + fi shift ;; esac + case $# in + 0) case $ifstack in + ?*) echo "$command: $file$line: missing endif" >&$stderr + exit 1 + ;; + esac + set set out + + ;; + esac + + # if nesting + + while : + do case $1 in + "if") ifstack="$ifelse:$ifstack" + case $ifelse in + KEEP|NONE) + ifelse=TEST + ;; + TEST) ;; + *) ifelse=DONE + ;; + esac + shift + ;; + "elif") case $ifelse in + SKIP) ifelse=TEST + ;; + TEST) ;; + *) ifelse=DONE + ;; + NONE) echo "$command: $file$line: $1: no matching if" >&$stderr + exit 1 + ;; + esac + shift + ;; + "else") case $ifelse in + KEEP) ifelse=DONE + ;; + SKIP|TEST) + ifelse=KEEP + ;; + NONE) echo "$command: $file$line: $1: no matching if" >&$stderr + exit 1 + ;; + esac + shift + ;; + "endif")case $ifelse in + NONE) echo "$command: $file$line: $1: no matching if" >&$stderr + exit 1 + ;; + esac + case $shell in + ksh) ifelse=${ifstack%%:*} + ifstack=${ifstack#*:} + ;; + *) eval `echo $ifstack | sed 's,\([^:]*\):\(.*\),ifelse=\1 ifstack=\2,'` + ;; + esac + shift + ;; + *) break + ;; + esac + done # check if "run xxx" is equivalent to "set in xxx" case $1 in + "("*) set exp - "$@" ;; *.iffe|*.iff) set run "$@" ;; esac case $1 in @@ -950,7 +1181,7 @@ do case $in in ;; run) case $shell in bsh) case $2 in - */*) x=`echo $2 | sed -e 's,.*[\\/],,'` ;; + */*) x=`echo $2 | sed -e 's,.*[\\\\/],,'` ;; *) x=$2 ;; esac ;; @@ -969,11 +1200,11 @@ do case $in in # set drops out early case $1 in - ""|\#*) continue + ""|"#"*)continue ;; set) shift case $1 in - ""|\#*) op= + ""|"#"*)op= ;; *) arg= op=$1 @@ -999,6 +1230,7 @@ do case $in in c) op=cc ;; C) op=config ;; d) op=debug ;; + D) op=define ;; i) op=input ;; I) op=include ;; L) op=library ;; @@ -1006,6 +1238,7 @@ do case $in in e) op=package ;; p) op=prototyped ;; P) op=pragma ;; + r) op=regress ;; s) op=shell ;; S) op=static ;; u) op=undef ;; @@ -1024,7 +1257,7 @@ do case $in in *" "*) shift continue ;; - ""|\#*) break + ""|"#"*)break ;; :) shift break @@ -1099,6 +1332,9 @@ do case $in in esac continue ;; + define) define=1 + continue + ;; exclude)case $arg in ""|-) excludes= ;; *) excludes="$excludes $arg" ;; @@ -1116,11 +1352,12 @@ do case $in in exit 1 fi exec < $in + file=$in: case $out in "") case $in in *[.\\/]*) case $shell in - bsh) eval `echo $in | sed -e 's,.*[\\/],,' -e 's/\\.[^.]*//' -e 's/^/out=/'` + bsh) eval `echo $in | sed -e 's,.*[\\\\/],,' -e 's/\\.[^.]*//' -e 's/^/out=/'` ;; *) eval 'out=${in##*[\\/]}' eval 'out=${out%.*}' @@ -1153,6 +1390,10 @@ do case $in in set - continue ;; + nodefine) + define=0 + continue + ;; out|output) out=$arg defhdr= @@ -1164,6 +1405,8 @@ do case $in in case $op in output) continue ;; esac + def= + test= ;; package)protoflags="$protoflags -e $arg" continue @@ -1175,6 +1418,10 @@ do case $in in pragma) pragma="$pragma $arg" continue ;; + regress)regress=1 + version=1995-03-19 + continue + ;; shell) shell=$arg continue ;; @@ -1192,8 +1439,34 @@ do case $in in ;; esac ;; - *) case $1 in - *\{) op=- + *) case $2 in + '=') def=$1 + shift + shift + ;; + *) case $1 in + '-'|'?')def=- + shift + ;; + *) def= + ;; + esac + ;; + esac + case $1 in + '!') not=1 + shift + ;; + *) not= + ;; + esac + case $1 in + *'{') op=- + ;; + '('*) op=exp + case $def in + '') def=- ;; + esac ;; *) op=$1 shift @@ -1222,30 +1495,79 @@ do case $in in case $# in 0) ;; *) case $1 in - \#*) set x + "#"*) set x shift ;; *) case $op in ref) ;; *) case $1 in - *\{) arg=- + '('*|*'{') + arg=- + ;; + '-') case $2 in + -*) arg=$1 + shift + ;; + *) def=- + shift + case $1 in + '('*|*'{') + arg=- + ;; + *) arg=$1 + case $# in + 0) ;; + *) shift ;; + esac + ;; + esac + ;; + esac ;; *) arg=$1 shift + ;; + esac + ;; + esac + ;; + esac + case $1 in + '('*) while : + do case $# in + 0) break ;; + esac + case $1 in + *[.{}]*)break ;; + esac + case $test in + '') test=$1 ;; + *) test="$test $1" ;; + esac + shift + done + case $arg in + '') arg=- ;; + esac + case $op in + exp) case $def in + ''|'-') ;; + *) arg=$def ;; esac ;; esac ;; esac + sline=$line while : do case $# in 0) break ;; esac case $1 in "") ;; - \#*) set x + "#"*) set x ;; - \=) shift + "=") shift set=$* case $set in "") set=" " ;; @@ -1258,14 +1580,19 @@ do case $in in done break ;; - [abcdefghijklmnopqrstuvwxyz]*\{) + [abcdefghijklmnopqrstuvwxyz]*'{'|'{') v=$1 shift x= case $v in - note\{) sep=" " ;; + "note{") + sep=" " ;; *) sep=$nl ;; esac + case $v in + '{') e='}' ;; + *) e='}end' ;; + esac SEP= while : do case $# in @@ -1273,7 +1600,7 @@ do case $in in '') checkread ;; esac case $in in - "") echo "$command: missing }end" >&$stderr + "") echo "$command: $file$line: missing }end" >&$stderr exit 1 ;; esac @@ -1283,18 +1610,22 @@ do case $in in *) lin=`$posix_read` ;; esac case $? in - 0) $posix_noglob + 0) case $shell in + ksh) let line=line+1 ;; + *) line=`expr $line + 1` ;; + esac + $posix_noglob set x $lin $posix_glob case $2 in - \}end) shift + $e) shift break 2 ;; esac x="$x$SEP$lin" SEP=$sep ;; - *) echo "$command: missing }end" >&$stderr + *) echo "$command: $file$line: missing $e" >&$stderr exit 1 ;; esac @@ -1302,24 +1633,26 @@ do case $in in ;; esac case $1 in - \}end) break - ;; - *) x="$x$SEP$1" - SEP=$sep + $e) break ;; esac + x="$x$SEP$1" + SEP=$sep shift done - x="$x$nl" # \r\n bash needs this barf # case $v in - fail\{) fail=$x ;; - nofail\{) pass=$x v=pass\{ ;; - nopass\{) fail=$x v=fail\{ ;; - no\{) no=$x ;; - note\{) note=$x ;; - pass\{) pass=$x ;; - test\{) test=$x ;; - yes\{) yes=$x ;; + 'note{');; + *) x="$x$nl" # \r\n bash needs this barf # ;; + esac + case $v in + 'fail{') fail=$x ;; + 'nofail{') pass=$x v='pass{' ;; + 'nopass{') fail=$x v='fail{' ;; + 'no{') no=$x ;; + 'note{') note=$x ;; + 'pass{') pass=$x ;; + 'test{') test=$x ;; + 'yes{'|'{') yes=$x ;; *) src=$x run=$v ;; esac ;; @@ -1331,7 +1664,10 @@ do case $in in pth) pth="$pth $1" lst=pth ;; - *) test="$test $1" + *) case $test in + '') test=$1 ;; + *) test="$test $1" ;; + esac ;; esac ;; @@ -1401,7 +1737,10 @@ do case $in in pth) pth="$pth $1" lst=pth ;; - *) test="$test $1" + *) case $test in + '') test=$1 ;; + *) test="$test $1" ;; + esac ;; esac ;; @@ -1412,6 +1751,9 @@ do case $in in esac ;; esac + case $ifelse in + DONE|SKIP) continue ;; + esac # check for local package root directories @@ -1436,6 +1778,15 @@ do case $in in "") cc="$occ $includes" ;; esac + # some ops allow no args + + case $arg in + '') case $op in + iff) arg=- ;; + esac + ;; + esac + # save $* for ancient shells argx=1 @@ -1496,7 +1847,7 @@ do case $in in if $cc -E $tmp.c <&$nullin >&$nullout then success gothdr="$gothdr + $x" - can="$can$cansep#define $c 1 /* #include <$x> ok */" + can="$can$cansep#define $c 1 /* #include <$x> ok */" cansep=$nl eval $c=1 allinc="${allinc}#include <$x>$nl" @@ -1506,7 +1857,7 @@ do case $in in ?1?|??1)can="$can$cansep#undef $c /* #include <$x> not ok */" cansep=$nl ;; - 1??) can="$can$cansep#define $c 0 /* #include <$x> not ok */" + 1??) can="$can$cansep#define $c 0 /* #include <$x> not ok */" cansep=$nl ;; esac @@ -1546,7 +1897,7 @@ do case $in in *" + $x "*) ;; *) case $shell in - bsh) eval `echo $x | sed -e 's,^\\([^\\/]*\\).*[\\/]\\([^\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'` + bsh) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'` ;; *) eval 'c=${x##*[\\/]}' eval 'c=${c%%.*}' @@ -1573,7 +1924,7 @@ do case $in in if $cc -E $tmp.c <&$nullin >&$nullout then success gothdr="$gothdr + $x" - can="$can$cansep#define $c 1 /* #include <$x> ok */" + can="$can$cansep#define $c 1 /* #include <$x> ok */" cansep=$nl eval $c=1 else failure @@ -1582,7 +1933,7 @@ do case $in in ?1?|??1)can="$can$cansep#undef $c /* #include <$x> not ok */" cansep=$nl ;; - 1??) can="$can$cansep#define $c 0 /* #include <$x> not ok */" + 1??) can="$can$cansep#define $c 0 /* #include <$x> not ok */" cansep=$nl ;; esac @@ -1610,7 +1961,7 @@ do case $in in lib= p= hit=0 - echo "main(){return(0);}" > $tmp.c + echo "int main(){return(0);}" > $tmp.c for x in $z - do case $x in -) case $hit in @@ -1665,7 +2016,7 @@ do case $in in 0*' '*) case " $gotlib " in *[-+]" $x "*) ;; - *) can="$can$cansep#define _LIB_$c 1 /* $x is a library */" + *) can="$can$cansep#define _LIB_$c 1 /* $x is a library */" cansep=$nl eval _LIB_$c=1 ;; @@ -1682,7 +2033,7 @@ do case $in in 0*' '*) case " $gotlib " in *[-+]" $x "*) ;; - *) can="$can$cansep#define HAVE_${c}_LIB 1 /* $x is a library */" + *) can="$can$cansep#define HAVE_${c}_LIB 1 /* $x is a library */" cansep=$nl eval HAVE_${c}_LIB=1 ;; @@ -1702,7 +2053,7 @@ do case $in in *) q="a library" ;; esac case $e in - 0) can="$can$cansep#define $c 1 /* $p is $q */" + 0) can="$can$cansep#define $c 1 /* $p is $q */" cansep=$nl eval $c=1 case $hit in @@ -1713,7 +2064,7 @@ do case $in in ?1?|??1)can="$can$cansep#undef $c /* $p is not $q */" cansep=$nl ;; - 1??) can="$can$cansep#define $c 0 /* $p is not $q */" + 1??) can="$can$cansep#define $c 0 /* $p is not $q */" cansep=$nl ;; esac @@ -1758,36 +2109,57 @@ do case $in in # loop on the ops o and args a + result=UNKNOWN for o in $x do for a in $arg - do user_pf= user_yn= + do c= case $a in *[.\\/]*) case $o in - hdr|pth|sys) - case $a in - *[\\/]*) x=/ ;; - *) x=. ;; + hdr|lcl|nxt|pth|sys) + x=$a + case $x in + *.lcl|*.nxt) + case $o in + sys) x=sys/$x ;; + esac + case $shell in + bsh) eval `echo $x | sed -e 's,\\(.*\\)\.\\([^.]*\\),x=\\1 o=\\2,'` + ;; + *) o=${x##*.} + x=${x%.${o}} + ;; + esac + v=$x + ;; esac - case $shell in - bsh) case $x in - .) x="\\$x" ;; + case $x in + *[\\/]*)case $shell in + bsh) eval `echo $x | sed -e 's,\\(.*\\)[\\\\//]\\(.*\\),p=\\1 v=\\2,'` + ;; + *) eval 'p=${x%/*}' + eval 'v=${x##*/}' + ;; + esac + ;; + *.*) case $shell in + bsh) eval `echo $x | sed -e 's,\\(.*\\)\\.\\(.*\\),p=\\1 v=\\2,'` + ;; + *) eval 'p=${x%.*}' + eval 'v=${x##*.}' + ;; esac - eval `echo $a | sed -e 's,\\(.*\\)'"${x}"'\\(.*\\),p=\\1 v=\\2,'` ;; - *) eval 'p=${a%%${x}*}' - eval 'v=${a##*${x}}' + *) p= ;; esac - case $v in - lcl|nxt)t=$p - p=$v - v=$t - ;; + case $o in + lcl|nxt) c=$v.$o ;; + *) c=$v ;; esac ;; *) case $shell in - bsh) eval `echo $a | sed -e 's,.*[\\/],,' -e 's/\\(.*\\)\\.\\(.*\\)/p=\\1 v=\\2/'` + bsh) eval `echo $a | sed -e 's,.*[\\\\/],,' -e 's/\\(.*\\)\\.\\(.*\\)/p=\\1 v=\\2/'` ;; *) eval 'p=${a%.*}' eval 'p=${p##*[\\/]}' @@ -1797,7 +2169,10 @@ do case $in in esac ;; esac - f=${p}/${v} + case $p in + '') f=${v} ;; + *) f=${p}/${v} ;; + esac case $o in run) v=$p p= @@ -1818,7 +2193,10 @@ do case $in in 1) m=_${v}_in_${p} ;; esac ;; - *) m=_${p}_${v} + *) case $p in + '') m=_${v} ;; + *) m=_${p}_${v} ;; + esac ;; esac ;; @@ -1828,7 +2206,63 @@ do case $in in m=_${v} ;; esac + case $c in + '') c=$v ;; + esac M=$m + case $o in + out) case $a in + -) a=- + ;; + ?*) test="$a $test" + a= + ;; + esac + ;; + *) case " $idyes " in + *" $m "*) + i=1 + ;; + *) case " $idno " in + *" $m "*) + i=0 + ;; + *) case $m in + *'*') m=`echo "$m" | sed 's,\*,_ptr,g'` ;; + esac + case $m in + *[-+/\\]*) + i=0 + ;; + *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*) + is id $m + copy $tmp.c "int $m = 0;" + if $cc -c $tmp.c + then success - + idyes="$idyes $m" + i=1 + else failure - + idno="$idno $m" + i=0 + fi + ;; + *) i=1 + ;; + esac + ;; + esac + case $i in + 0) case $o in + dat|dfn|key|lib|mac|mth|nos|npt|siz|sym|typ|val) + continue + ;; + esac + ;; + esac + ;; + esac + ;; + esac case $m in *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*) m=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'` @@ -1840,7 +2274,7 @@ do case $in in case $out in $cur) ;; *) case $cur in - $a|$v) ;; + $a|$c) ;; *) case $cur in .) ;; -) case $iff in @@ -1890,7 +2324,7 @@ do case $in in esac case $out in "") case $a in - *[\\/]*|???????????????*) cur=$v ;; + *[\\/]*|???????????????*) cur=$c ;; *) cur=$a ;; esac ;; @@ -1910,7 +2344,8 @@ do case $in in # output header comments case $style in - C) echo "/* : : generated$x by $command version $version : : */" + C) + echo "/* : : generated$x by $command version $version : : */" for x in $pragma do echo "#pragma $x" done @@ -1940,14 +2375,24 @@ do case $in in esac case $o in iff) case $M in - ""|*-*) ;; + ""|*-*) iff= ;; *) iff=${m}_H ;; esac ;; - *) case $x in - *-*) ;; - *) x=`pwd | sed -e 's,.*[\\/],,' -e 's,\\..*,,' -e 's,^lib,,' -e 's,^,'${x}_',' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'` - iff=_def${x} + *) case $regress in + '') case $x in + *-*) ;; + *) x=`pwd | sed -e 's,.*[\\\\/],,' -e 's,\\..*,,' -e 's,^lib,,' -e 's,^,'${x}_',' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'` + # ksh n+ bug workaround + case $x in + *[!_]*) ;; + *) x=_$$ ;; + esac + iff=_def${x} + ;; + esac + ;; + *) iff=_REGRESS ;; esac ;; @@ -1966,7 +2411,9 @@ do case $in in ;; esac case $can in - ?*) echo "$can" + ?*) case $define in + 1) echo "$can" ;; + esac can= cansep= ;; @@ -1978,7 +2425,7 @@ do case $in in for x in $defhdr $hdr do case $x in *.h) case $shell in - bsh) eval `echo $x | sed -e 's,^\\([^\\/]*\\).*[\\/]\\([^\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'` + bsh) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'` ;; *) eval 'c=${x##*[\\/]}' eval 'c=${c%%.*}' @@ -2046,21 +2493,21 @@ do case $in in # src overrides builtin test - case $config in - 0) case $o in - tst) ;; + case $config:$def in + 0:) case $o in + tst|var);; *) m=_${o}${m} ;; esac ;; - 1) case $o in - tst) m=${v} ;; + 1:) case $o in + tst|var)m=${v} ;; esac case $shell in ksh) typeset -u u=$m ;; *) u=`echo $m | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;; esac case $o in - tst) case $m in + tst|var)case $m in $u) ;; *) case $m in hdr_*|lib_*|sys_*) @@ -2074,30 +2521,45 @@ do case $in in ;; esac ;; + dat) m=HAVE${u}_DATA ;; hdr|lcl)m=HAVE${u}_H ;; - npt|pth)case $op in - npt) m=${u}_DECLARED ;; - pth) m=${u}_PATH ;; - esac + key) m=HAVE${u}_RESERVED ;; + mth) m=HAVE${u}_MATH ;; + npt) m=HAVE${u}_DECL ;; + pth) m=${u}_PATH case $shell in ksh) m=${m#_} ;; *) m=`echo $m | sed 's,^_,,'` ;; esac ;; nxt) m=HAVE${u}_NEXT ;; + siz) m=SIZEOF${u} ;; sys) m=HAVE_SYS${u}_H ;; *) m=HAVE${u} ;; esac ;; + *) m=$def + M=$m + ;; esac case $v in *.*) pre= for x in `echo $v | sed 's,\\., ,g'` do pre="$pre -#undef $x" +#undef $x" done ;; - *) pre="#undef $v" + *) case $o in + siz|typ)case $v in + char|short|int|long) + ;; + *) pre="#undef $v" + ;; + esac + ;; + *) pre="#undef $v" + ;; + esac ;; esac case $src in @@ -2110,12 +2572,17 @@ $usr $inc $EXT $src" - e= + e=0 is tst "${note:-$run}" case $run in cat*|nocat*) copy - "$src" ;; + cross*|nocross*) + copy $tmp.sh "$src" + chmod +x $tmp.sh + execute $tmp.sh <&$nullin || e=1 + ;; run*|norun*) (eval "$src") <&$nullin || e=1 ;; @@ -2135,7 +2602,7 @@ $src" reallystatictest=. echo '#include -main(){printf("hello");return(0);}' > ${tmp}s.c +int main(){printf("hello");return(0);}' > ${tmp}s.c rm -f ${tmp}s.exe if $cc -c ${tmp}s.c <&$nullin >&$nullout && $cc -o ${tmp}s.exe ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe then e=`wc -l ${tmp}s.e` @@ -2198,11 +2665,11 @@ main(){printf("hello");return(0);}' > ${tmp}s.c then case $run in no[ls]*);; - [ls]*) e= && break ;; + [ls]*) e=0 && break ;; noo*) execute $tmp.exe <&$nullin || break ;; - o*) execute $tmp.exe <&$nullin && e= && break ;; + o*) execute $tmp.exe <&$nullin && e=0 && break ;; no*) execute $tmp.exe <&$nullin >&$nullout || break ;; - *) execute $tmp.exe <&$nullin >&$nullout && e= && break ;; + *) execute $tmp.exe <&$nullin >&$nullout && e=0 && break ;; esac else case $run in @@ -2211,7 +2678,7 @@ main(){printf("hello");return(0);}' > ${tmp}s.c fi case $# in 0) case $run in - no*) e= ;; + no*) e=0 ;; esac break ;; @@ -2221,45 +2688,12 @@ main(){printf("hello");return(0);}' > ${tmp}s.c esac case $run in no*) case $e in - "") e=1 ;; - *) e= ;; + 0) e=1 ;; + *) e=0 ;; esac ;; esac - case $e in - "") success - case $M in - *-*) ;; - *) usr="$usr$nl#define $m 1" - echo "#define $m 1 /* "${note:-"$run passed"}" */" - eval $m=1 - ;; - esac - user_pf=$pass user_yn=$yes - ;; - *) failure - case $M in - *-*) ;; - *) case $all$config$undef in - ?1?|??1)echo "#undef $m /* "${note:-"$run"}" failed */" ;; - 1??) echo "#define $m 0 /* "${note:-"$run"}" failed */" ;; - esac - eval $m=0 - ;; - esac - user_pf=$fail user_yn=$no - ;; - esac - case $user_pf in - ?*) (eval "$user_pf") <&$nullin ;; - esac - case $user_yn in - ?*) case $note in - ?*) user_yn="$user_yn /* $note */" ;; - esac - copy - "$user_yn" - ;; - esac + report $e 1 "${note:-$run\ passed}" "${note:-$run} failed" continue ;; esac @@ -2277,14 +2711,14 @@ $ext _BEGIN_EXTERNS_ extern int $statictest; _END_EXTERNS_ -main(){char* i = (char*)&$statictest; return i!=0;} +int main(){char* i = (char*)&$statictest; return i!=0;} " rm -f $tmp.exe if $cc -o $tmp.exe $tmp.c <&$nullin >&$nullout && $executable $tmp.exe then case $static in .) static= echo '#include -main(){printf("hello");return(0);}' > $tmp.c +int main(){printf("hello");return(0);}' > $tmp.c rm -f $tmp.exe if $cc -c $tmp.c <&$nullin >&$nullout && $cc -o $tmp.exe $tmp.o <&$nullin >&$nullout 2>$tmp.e && $executable $tmp.exe then e=`wc -l $tmp.e` @@ -2343,13 +2777,21 @@ main(){printf("hello");return(0);}' > $tmp.c do if test -f $d/$i/$a then case $k in "") k=1 - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $a in ?(/usr)/(bin|etc|ucb) */" + case $M in + *-*) ;; + *) usr="$usr$nl#define $m 1" + case $define in + 1) echo "#define $m 1 /* $a in ?(/usr)/(bin|etc|ucb) */" ;; + esac + ;; + esac ;; esac c=${s}_${i}_${v} usr="$usr$nl#define $c 1" - echo "#define $c 1 /* $d/$i/$a found */" + case $define in + 1) echo "#define $c 1 /* $d/$i/$a found */" ;; + esac fi done done @@ -2377,24 +2819,14 @@ _END_EXTERNS_" #else #define _REF_ & #endif -main(){char* i = (char*) _REF_ $v; return i!=0;}" +int main(){char* i = (char*) _REF_ $v; return i!=0;}" } > $tmp.c is $o $v rm -f $tmp.exe - if $cc -c $tmp.c <&$nullin >&$nullout && - $cc $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout && - $executable $tmp.exe - then success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v in default lib(s) */" - eval $m=1 - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v not in default lib(s) */" ;; - 1??) echo "#define $m 0 /* $v not in default lib(s) */" ;; - esac - eval $m=0 - fi + $cc -c $tmp.c <&$nullin >&$nullout && + $cc $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout && + $executable $tmp.exe + report $? 1 "$v in default lib(s)" "$v not in default lib(s)" ;; dfn) case $p in ?*) continue ;; @@ -2417,8 +2849,13 @@ $inc else failure fi ;; - exp) case $a in - -) ;; + exp) case $test in + '') echo "$command: $file$sline: test expression expected for $o" >&$stderr + exit 1 + ;; + esac + case $a in + -|'') ;; *) eval x='$'$a case $x in 1) continue ;; @@ -2426,132 +2863,75 @@ $inc ;; esac case $test in - \ \"*\"|\ [01]) + '"'*'"'|[01]) case $a in - -) ;; - *) case $note in - '') echo "#define $a $test" ;; - *) echo "#define $a $test /* $note */" ;; + -|'') ;; + *) case $define$note in + 1) echo "#define $a $test" ;; + 1*) echo "#define $a $test /* $note */" ;; esac ;; esac ;; - *) - case $note in + *) case $note in '') note=$test ;; - *) note=' '$note ;; esac - is exp "$note" - x= - for i in `echo '' $test | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], & ,g'` - do case $i in - [\ \ ]) - ;; - [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]*) - x="$x \${$i:-0}" - ;; - '!') x="$x 0 =" - ;; - '&'|'|')case $x in - *"$i") ;; - *) x="$x \\$i" ;; - esac - ;; - *) x="$x \\$i" - ;; - esac - done - case `eval expr $x 2>&$stderr` in - 0) failure - case $a in - -) ;; - *) case $all$config$undef in - ?1?|??1)echo "#undef $a /*$note is false */" ;; - 1??) echo "#define $a 0 /*$note is false */" ;; + case $test in + '') c=1 + ;; + *) is exp "$note" + x= + for i in `echo '' $test | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], & ,g'` + do case $i in + [\ \ ]) + ;; + [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]*) + x="$x \${$i:-0}" + ;; + '!') x="$x 0 =" + ;; + '&'|'|')case $x in + *"$i") ;; + *) x="$x \\$i" ;; + esac + ;; + *) x="$x \\$i" + ;; esac - eval $a=0 - ;; - esac - user_pf=$fail user_yn=$no - ;; - *) success - case $a in - -) ;; - *) usr="$usr$nl#define $a 1" - echo "#define $a 1 /*$note is true */" - eval $a=1 - ;; - esac - user_pf=$pass user_yn=$yes + done + c=`eval expr $x 2>&$stderr` ;; esac + case $c in + 0) c=1 ;; + *) c=0 ;; + esac + M=$a + m=$a + report $c 1 "$note is true" "$note is false" ;; esac ;; hdr|lcl|nxt|sys) case $o in - lcl|nxt)p=$o ;; - esac - case $p in - lcl|nxt)eval f='$'_${p}_$v - case $f in - ?*) continue ;; - esac - eval _${p}_$v=1 - f=$v - ;; - *) case $o in - hdr) x=$f.h ;; - sys) x=sys/$f.h ;; + lcl|nxt)case $M in + *-*) continue ;; esac - case " $gothdr " in - *" - $x "*) - ;; - *" + $x "*) - ;; - *) echo "${allinc}#include <$x>" > $tmp.c - is hdr $x - if $cc -E $tmp.c <&$nullin >&$nullout - then success - case " $puthdr " in - *" $m "*) - ;; - *) puthdr="$puthdr $m" - usr="$usr$nl#define $m 1" - ;; - esac - gothdr="$gothdr + $x" - echo "#define $m 1 /* #include <$x> ok */" - eval $m=1 - else failure - gothdr="$gothdr - $x" - case $all$config$undef in - ?1?|??1)echo "#undef $m /* #include <$x> not ok */" ;; - 1??) echo "#define $m 0 /* #include <$x> not ok */" ;; - esac - eval $m=0 - fi - ;; + eval x='$'_$m + case $x in + ?*) continue ;; esac - continue - ;; - esac - x=$f - case $f in - *[\\/]*)g=$f ;; - *) g="$f sys/$f" ;; - esac - is $o $x - for f in $g - do echo "$pre + eval _$m=1 + is $o $f + echo "$pre $inc #include <$f.h>" > $tmp.c case $f in sys/*) e= ;; - *) e='-e /[\\\/]sys[\\\/]'$x'\\.h"/d' ;; + *) e='-e /[\\\\\/]sys[\\\\\/]'$f'\\.h"/d' ;; esac if $cc -E $tmp.c <&$nullin >$tmp.i - then i=`sed -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\\/].*[\\\\\\/]'$x'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q` + then i=`sed -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\/].*[\\\\\/]'$f'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q` case $i in [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]:[\\/]*) ;; @@ -2560,7 +2940,7 @@ $inc $inc #include <$k>" > $tmp.c if $cc -E $tmp.c <&$nullin >$tmp.i - then j=`sed -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\\/].*[\\\\\\/]'$x'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q` + then j=`sed -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\/].*[\\\\\/]'$f'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q` wi=`wc < "$i"` wj=`wc < "$j"` case $wi in @@ -2581,7 +2961,7 @@ $inc case $i in [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]:[\\/]*|[\\/]*) success - case $p in + case $o in lcl) echo "#if defined(__STDPP__directive)" echo "__STDPP__directive pragma pp:hosted" echo "#endif" @@ -2599,7 +2979,7 @@ $inc break ;; ../*/*) success - case $p in + case $o in lcl) echo "#include <$i> /* the native <$f.h> */" echo "#undef $m" usr="$usr$nl#define $m 1" @@ -2615,10 +2995,10 @@ $inc break ;; *) failure - case $p in + case $o in lcl) case $all$config$undef in ?1?|??1)echo "#undef $m /* no native <$f.h> */" ;; - 1??) echo "#define $m 0 /* no native <$f.h> */" ;; + 1??) echo "#define $m 0 /* no native <$f.h> */" ;; esac eval $m=0 ;; @@ -2629,7 +3009,53 @@ $inc esac ;; esac - done + ;; + *) case $o in + hdr) x=$f.h ;; + sys) x=sys/$f.h ;; + esac + case " $gothdr " in + *" - $x "*) + ;; + *" + $x "*) + ;; + *) echo "${allinc}#include <$x>" > $tmp.c + is hdr $x + if $cc -E $tmp.c <&$nullin >&$nullout + then success + gothdr="$gothdr + $x" + case $M in + *-*) ;; + *) case " $puthdr " in + *" $m "*) + ;; + *) puthdr="$puthdr $m" + usr="$usr$nl#define $m 1" + ;; + esac + case $define in + 1) echo "#define $m 1 /* #include <$x> ok */" ;; + esac + eval $m=1 + ;; + esac + else failure + gothdr="$gothdr - $x" + case $M in + *-*) ;; + *) case $define$all$config$undef in + 1?1?|1??1)echo "#undef $m /* #include <$x> not ok */" ;; + 11??) echo "#define $m 0 /* #include <$x> not ok */" ;; + esac + eval $m=0 + ;; + esac + fi + ;; + esac + continue + ;; + esac ;; iff) ;; key) case $p in @@ -2667,21 +3093,15 @@ int f(){int $w = 1;return($w);}" > $tmp.c continue ;; esac - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $w is not a reserved keyword */" ;; - 1??) echo "#define $m 0 /* $w is not a reserved keyword */" ;; - esac - eval $m=0 - case $set in - ?*) echo "#define $v $set /* default for reserved keyword $v */" ;; - esac - else success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v is a reserved keyword */" - eval $m=1 - case $w in - $v) ;; - *) echo "#define $v $w /* alternate for reserved keyword $v */" ;; + report - 1 - "$w is not a reserved keyword" "default for reserved keyword $v" + else report 0 "$v is a reserved keyword" - + case $M in + *-*) ;; + *) case $define$w in + 1$v) ;; + 1*) echo "#define $v $w /* alternate for reserved keyword $v */" ;; + esac + ;; esac fi break @@ -2706,55 +3126,29 @@ _BEGIN_EXTERNS_ extern int $v(); _END_EXTERNS_ #endif -static _IFFE_fun i=(_IFFE_fun)$v;main(){return(i==0);} +static _IFFE_fun i=(_IFFE_fun)$v;int main(){return(i==0);} " - if $cc -D_IFFE_extern -c $tmp.c <&$nullin >&$nullout || $cc -c $tmp.c <&$nullin >&$nullout + d=-D_IFFE_extern + if $cc -c $tmp.c <&$nullin >&$nullout + then d= + elif $cc $d -c $tmp.c <&$nullin >&$nullout + then : + else d=error + fi + if test error != "$d" then rm -f $tmp.exe - if $cc $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout && $executable $tmp.exe + if $cc $d $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout && $executable $tmp.exe then case $o in - lib) success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() in default lib(s) */" - eval $m=1 - ;; - *) failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v() not in math lib */" ;; - 1??) echo "#define $m 0 /* $v() not in math lib */" ;; - esac - eval $m=0 - case $set in - ?*) echo "#define $v $set /* default for function $v() */" ;; - esac - ;; + lib) c=0 ;; + *) c=1 ;; esac + report $c 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()" else case $o in mth) rm -f $tmp.exe - if $cc $static -o $tmp.exe $tmp.o -lm <&$nullin >&$nullout && $executable $tmp.exe - then success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() in math lib */" - eval $m=1 - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v() not in math lib */" ;; - 1??) echo "#define $m 0 /* $v() not in math lib */" ;; - esac - eval $m=0 - case $set in - ?*) echo "#define $v $set /* default for function $v() */" ;; - esac - fi + $cc $d $static -o $tmp.exe $tmp.o -lm <&$nullin >&$nullout && $executable $tmp.exe + report $? 1 "$v() in math lib" "$v() not in math lib" "default for function $v()" ;; - *) failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v() not in default lib(s) */" ;; - 1??) echo "#define $m 0 /* $v() not in default lib(s) */" ;; - esac - eval $m=0 - case $set in - ?*) echo "#define $v $set /* default for function $v() */" ;; - esac + *) report 1 1 - "$v() not in default lib(s)" "default for function $v()" ;; esac fi @@ -2768,44 +3162,15 @@ $ext _BEGIN_EXTERNS_ extern int foo(); _END_EXTERNS_ -static int ((*i)())=foo;main(){return(i==0);} +static int ((*i)())=foo;int main(){return(i==0);} " - if $cc -c $tmp.c <&$nullin >&$nullout - then intrinsic=1 - else intrinsic=0 - fi + $cc -c $tmp.c <&$nullin >&$nullout + intrinsic=$? ;; esac - case $intrinsic in - 0) failure - case $o in - mth) case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v() not in math lib */" ;; - 1??) echo "#define $m 0 /* $v() not in math lib */" ;; - esac - eval $m=0 - ;; - *) case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v() not in default lib(s) */" ;; - 1??) echo "#define $m 0 /* $v() not in default lib(s) */" ;; - esac - eval $m=0 - ;; - esac - case $set in - ?*) echo "#define $v $set /* default for function $v() */" ;; - esac - ;; - 1) success - case $o in - lib) usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() in default lib(s) */" - ;; - mth) usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() in math lib */" - ;; - esac - ;; + case $o in + mth) report $intrinsic 1 "$v() in math lib" "$v() not in math lib" "default for function $v()" ;; + *) report $intrinsic 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()" ;; esac fi ;; @@ -2816,18 +3181,10 @@ static int ((*i)())=foo;main(){return(i==0);} echo "$pre $inc #ifdef $v -'#define $m 1 /* $v is a macro */' +'$m:$v' #endif" > $tmp.c - if $cc -E $tmp.c <&$nullin | sed -e "/#define/!d" -e "s/'//g" -e "s/^[ ][ ]*//" - then success - usr="$usr$nl#define $m 1" - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m 0 /* $v is not a macro */" ;; - 1??) echo "#define $m 0 /* $v is not a macro */" ;; - esac - eval $m=0 - fi + $cc -E $tmp.c <&$nullin | grep -c "'$m:$v'" >&$nullout + report $? 1 "$v is a macro" "$v is not a macro" "default for macro $v" ;; mem) case $p in ?*) eval i='$'_iffe_typedef_$p @@ -2839,35 +3196,26 @@ static $p i; int n = sizeof(i);" > $tmp.c is typ $p if $cc -c $tmp.c <&$nullin >&$nullout - then success + then success - eval _iffe_typedef_$p=1 i=1 - else failure + else failure - eval _iffe_typedef_$p=0 i=0 fi ;; esac case $i in - 0) p="struct $p" ;; + 0) i="$v is not a member of $p" p="struct $p" ;; + *) i=- ;; esac is mem $v "$p" echo "$pre $inc static $p i; int n = sizeof(i.$v);" > $tmp.c - if $cc -c $tmp.c <&$nullin >&$nullout - then success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v is a member of $p */" - eval $m=1 - else failure - case $all$config$undef$i in - ?1?0|??10)echo "#undef $m /* $v is not a member of $p */" ;; - 1??0) echo "#define $m 0 /* $v is not a member of $p */" ;; - esac - eval $m=0 - fi + $cc -c $tmp.c <&$nullin >&$nullout + report $? 1 "$v is a member of $p" "$i" ;; *) p=$v eval i='$'_iffe_typedef_$p @@ -2879,17 +3227,18 @@ static $p i; int n = sizeof(i);" > $tmp.c is typ $p if $cc -c $tmp.c <&$nullin >&$nullout - then success + then success - eval _iffe_typedef_$p=1 i=1 - else failure + else failure - eval _iffe_typedef_$p=0 i=0 fi ;; esac case $i in - 0) p="struct $p" ;; + 0) i="$p is not a non-opaque struct" p="struct $p" ;; + *) i=- ;; esac is nos "$p" echo "$pre @@ -2901,21 +3250,11 @@ int n = sizeof(i);" > $tmp.c $inc static $p i; unsigned long f() { return (unsigned long)i; }" > $tmp.c - if $cc -c $tmp.c <&$nullin >&$nullout - then : - else success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $p is a non-opaque struct */" - continue - fi + $cc -c $tmp.c <&$nullin >&$nullout + c=$? + else c=1 fi - failure - case $all$config$undef$i in - ?1?0|??10)echo "#undef $m /* $p is not a non-opaque struct */" ;; - 1??0) echo "#define $m 0 /* $p is not a non-opaque struct */" ;; - esac - eval $m=0 - ;; + report $c 1 "$p is a non-opaque struct" "$i" esac ;; nop) ;; @@ -2931,31 +3270,8 @@ struct _iffe_struct { int _iffe_member; }; extern struct _iffe_struct* $v _ARG_((struct _iffe_struct*)); _END_EXTERNS_ " - if $cc -c $tmp.c <&$nullin >&$nullout - then success - case $config in - 1) echo "#undef $m /* $v() needs a prototype */" - eval $m=0 - ;; - *) usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() needs a prototype */" - eval $m=1 - ;; - esac - else failure - case $config in - 1) usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v() does not need a prototype */" - eval $m=1 - ;; - *) case $all$undef in - ?1) echo "#undef $m /* $v() does not need a prototype */" ;; - 1?) echo "#define $m 0 /* $v() does not need a prototype */" ;; - esac - eval $m=0 - ;; - esac - fi + $cc -c $tmp.c <&$nullin >&$nullout + report -$config $? 1 "$v() needs a prototype" "$v() does not need a prototype" ;; num) is num $v copy $tmp.c " @@ -2968,18 +3284,8 @@ _BEGIN_EXTERNS_ int _iffe_int = $v / 2; _END_EXTERNS_ " - if $cc -c $tmp.c <&$nullin >&$nullout - then success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $v is a numeric constant */" - eval $m=1 - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $v is not a numeric constant */" ;; - 1??) echo "#define $m 0 /* $v is not a numeric constant */" ;; - esac - eval $m=0 - fi + $cc -c $tmp.c <&$nullin >&$nullout + report $? 1 "$v is a numeric constant" "$v is not a numeric constant" ;; one) for i in $a $hdr do x="#include <$i>" @@ -2994,7 +3300,7 @@ _END_EXTERNS_ if $cc -E $tmp.c <&$nullin >&$nullout then success gothdr="$gothdr + $x" - else failure + else failure - gothdr="$gothdr - $x" continue fi @@ -3009,9 +3315,9 @@ _END_EXTERNS_ if $cc -E $tmp.c <&$nullin >$tmp.i then c=$i case $c in - *[\\/]*) c=`echo $c | sed 's,[\\\\\\/],[\\\\\\/],g'` ;; + *[\\/]*) c=`echo $c | sed 's,[\\\\/],[\\\\/],g'` ;; esac - case `sed -e '/^#[line ]*1[ ][ ]*"[\\\\\\/].*[\\\\\\/]'$c'"/!d' $tmp.i` in + case `sed -e '/^#[line ]*1[ ][ ]*"[\\\\\/].*[\\\\\/]'$c'"/!d' $tmp.i` in ?*) break ;; esac fi @@ -3076,22 +3382,19 @@ _END_EXTERNS_ ;; esac case $f in - '') failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $a path not found */" ;; - esac + '') c=1 ;; - ?*) success - echo "#define $m \"$f\" /* ${note:-$a path} */" - eval $m=\\\"$f\\\" + *) c=0 + f="\"$f\"" ;; esac + report $c "$f" "${note:-$a path}" "$a path not found" ;; run) is run $a if test ! -r $a then failure not found case $verbose in - 0) echo "$command: $a: not found" >&$stderr ;; + 0) echo "$command: $file$line: $a: not found" >&$stderr ;; esac exit 1 fi @@ -3121,7 +3424,7 @@ set "cc='$cc' executable='$executable' id='$m' static='$static' tmp='$tmp'" $opt ;; *) failure cannot run case $verbose in - 0) echo "$command: $a: cannot run" >&$stderr ;; + 0) echo "$command: $file$line: $a: cannot run" >&$stderr ;; esac exit 1 ;; @@ -3162,7 +3465,7 @@ struct xxx* f() { return &v; }" *) echo "int g() { return sizeof($x$v)<=sizeof($v); }" ;; esac copy - " -main() { +int main() { f(); g(); printf(\"%u\\n\", sizeof($x$v)); @@ -3173,20 +3476,12 @@ main() { if $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout && $executable $tmp.exe && execute $tmp.exe > $tmp.dat - then success - z=`cat $tmp.dat` - usr="$usr$nl#define $m $z" - echo "#define $m $z /* sizeof($x$v) */" - eval $m=1 - user_pf=$pass user_yn=$yes - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $x$v not a type with known size */" ;; - 1??) echo "#define $m 0 /* $x$v not a type with known size */" ;; - esac - eval $m=0 - user_pf=$fail user_yn=$no + then z=`cat $tmp.dat` + c=0 + else z=0 + c=1 fi + report $c "$z" "sizeof($x$v)" "$x$v not a type with known size" ;; sym) case $test in "") x=$v ;; @@ -3253,52 +3548,60 @@ struct xxx* f() { return &v; }" esac case $x in ""|"struct "|"union ") - echo "main() { f(); return 0; }" ;; - *) echo "main() { f(); return sizeof($x$v)<=sizeof($v); }" ;; + echo "int main() { f(); return 0; }" ;; + *) echo "int main() { f(); return sizeof($x$v)<=sizeof($v); }" ;; esac } > $tmp.c rm -f $tmp.exe - if $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout && - $executable $tmp.exe && - execute $tmp.exe - then success - usr="$usr$nl#define $m 1" - echo "#define $m 1 /* $x$v is a type */" - eval $m=1 - user_pf=$pass user_yn=$yes - else failure - case $all$config$undef in - ?1?|??1)echo "#undef $m /* $x$v is not a type */" ;; - 1??) echo "#define $m 0 /* $x$v is not a type */" ;; - esac - eval $m=0 - case $set in - ?*) echo "#define $v $set /* default for type $x$v */" ;; - esac - user_pf=$fail user_yn=$no - fi + $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout && + $executable $tmp.exe && + execute $tmp.exe + report $? 1 "$x$v is a type" "$x$v is not a type" "default for type $x$v" ;; val) case $arg in - \"*\") echo $arg=\'$val\' ;; + '"'*'"')echo $arg=\'$val\' ;; *) echo $arg=\"$val\" ;; esac ;; - :) shift + 0) result=FAILURE ;; - *) echo "$command: $o: unknown feature test" >&$stderr - status=1 + 1) result=SUCCESS ;; - esac - case $user_pf in - ?*) (eval "$user_pf") <&$nullin ;; - esac - case $user_yn in - ?*) case $note in - ?*) user_yn="$user_yn /* $note */" ;; - esac - copy - "$user_yn" + :) ;; + -) ;; + *) echo "$command: $file$line: $o: unknown feature test" >&$stderr + status=1 ;; esac done done + case $not in + 1) case $result in + FAILURE) result=SUCCESS ;; + *) result=FAILURE ;; + esac + ;; + esac + case $result in + FAILURE) user_pf=$fail user_yn=$no ;; + *) user_pf=$pass user_yn=$yes ;; + esac + case $user_pf in + ?*) eval "$user_pf" <&$nullin ;; + esac + case $user_yn in + ?*) case $note in + ?*) case $user_yn in + *$nl*) user_yn="/* $note */$nl$user_yn" ;; + *) user_yn="$user_yn /* $note */" ;; + esac + ;; + esac + copy - "$user_yn" + ;; + esac + case $ifelse:$result in + TEST:SUCCESS) ifelse=KEEP ;; + TEST:*) ifelse=SKIP ;; + esac done